當前位置: 首頁>>代碼示例>>Java>>正文


Java ColorRGBA類代碼示例

本文整理匯總了Java中com.jme3.math.ColorRGBA的典型用法代碼示例。如果您正苦於以下問題:Java ColorRGBA類的具體用法?Java ColorRGBA怎麽用?Java ColorRGBA使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ColorRGBA類屬於com.jme3.math包,在下文中一共展示了ColorRGBA類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addObject

import com.jme3.math.ColorRGBA; //導入依賴的package包/類
@Override
protected Spatial addObject(Entity e) {
    Vector3f loc = e.get(PhysicsPosition.class).getLocation();
    Mesh mesh = MeshFactory.createSphere(0.25f);
    Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    material.setColor("Color", ColorRGBA.Orange);
    TextureKey key = new TextureKey("Interface/grid-shaded.png");
    key.setGenerateMips(true);
    Texture texture = assetManager.loadTexture(key);
    texture.setWrap(Texture.WrapMode.Repeat);
    material.setTexture("ColorMap", texture);
    Geometry geometry = new Geometry("PhysicsPosition: "+e.getId(), mesh);
    geometry.setMaterial(material);
    geometry.setLocalTranslation(loc);
    rootNode.attachChild(geometry);
    return geometry;
}
 
開發者ID:jvpichowski,項目名稱:ZayES-Bullet,代碼行數:18,代碼來源:ESDebugViewState.java

示例2: updateObject

import com.jme3.math.ColorRGBA; //導入依賴的package包/類
@Override
protected void updateObject(Spatial geom, Entity e) {
    if(geom instanceof Node){
        LOGGER.info("Can't update mesh for "+e.getId()+" recreate it!");
        return;
    }
    Mesh mesh = factory.getMesh(e.get(componentType));
    ((Geometry)geom).setMesh(mesh);
    geom.updateModelBound();
    RigidBody body = e.get(RigidBody.class);
    if(body.isKinematic()){
        geom.setMaterial(createMaterial(ColorRGBA.Green));
    }else {
        if(body.getMass() == 0) {
            geom.setMaterial(createMaterial(ColorRGBA.Cyan.mult(ColorRGBA.DarkGray)));
        }else {
            geom.setMaterial(createMaterial(ColorRGBA.Red));
        }
    }
}
 
開發者ID:jvpichowski,項目名稱:ZayES-Bullet,代碼行數:21,代碼來源:ESDebugViewState.java

示例3: initWorld

import com.jme3.math.ColorRGBA; //導入依賴的package包/類
private void initWorld(){
    EntityId centerFloor = entityData.createEntity();
    entityData.setComponents(centerFloor,
            new BoxShape(new Vector3f(5f, 0.2f, 5f)),
            new BoxView(new Vector3f(5f, 0.2f, 5f)),
            new ShadedColor(ColorRGBA.Green),
            new PhysicsToViewLocation(),
            new PhysicsToViewRotation(),
            new RigidBody(false, 0)
    );
    EntityId forceFieldFloor = entityData.createEntity();
    entityData.setComponents(forceFieldFloor,
            new BoxShape(new Vector3f(5f, 0.2f, 5f)),
            new BoxView(new Vector3f(5f, 0.2f, 5f)),
            new ShadedColor(ColorRGBA.Red),
            new PhysicsToViewLocation(),
            new PhysicsToViewRotation(),
            new RigidBody(false, 0),
            new WarpPosition(new Vector3f(10, 0,0), new Quaternion())
    );
}
 
開發者ID:jvpichowski,項目名稱:ZayES-Bullet,代碼行數:22,代碼來源:ForceFieldExample.java

示例4: simpleInitApp

import com.jme3.math.ColorRGBA; //導入依賴的package包/類
@Override
public void simpleInitApp() {
    getRootNode().attachChild(sceneRoot);

    EntityId box = entityData.createEntity();
    entityData.setComponents(box,
            new PhysicsToViewLocation(),        //the translation offset between the physics object and the view object
            new PhysicsToViewRotation(),        //the rotational offset between the physics object and the view object
            new UnshadedColor(ColorRGBA.Cyan),  //the color of the view object
            new BoxView(),                      //the view object
            new BoxShape(),                     //the physics object
            new RigidBody(true,0));

    //We have to add logic to translate the physics position to the view position.
    //The transition is defined by the components.
    SimpleLogicManagerState logicManager = getStateManager().getState(SimpleLogicManagerState.class);
    logicManager.attach(new PhysicsToViewRotation.Logic());
    logicManager.attach(new PhysicsToViewLocation.Logic());

    //Just add a debug view to compare physics and view.
    ESBulletState esBulletState = stateManager.getState(ESBulletState.class);
    esBulletState.onInitialize(() -> {
        BulletDebugAppState debugAppState = new BulletDebugAppState(esBulletState.getPhysicsSpace());
        getStateManager().attach(debugAppState);
    });
}
 
開發者ID:jvpichowski,項目名稱:ZayES-Bullet,代碼行數:27,代碼來源:PhysicsViewExample.java

示例5: render

import com.jme3.math.ColorRGBA; //導入依賴的package包/類
public void render( List<Prof> ofs, Tweed tweed, ColorRGBA col, Node n ) {

//		Random randy = new Random(ofs.hashCode());
		
		Material mat = new Material( tweed.getAssetManager(), "Common/MatDefs/Light/Lighting.j3md" );
		
//		ColorRGBA col = new ColorRGBA(
//				randy.nextFloat(), 
//				0.2f+ 0.5f * randy.nextFloat(), 
//				0.5f+ 0.5f * randy.nextFloat(), 1);
		
		mat.setColor( "Diffuse", col );
		mat.setColor( "Ambient", col.mult( 0.1f ) );
		mat.setBoolean( "UseMaterialColors", true );
		
		for (Prof p : ofs) {
			Geometry g = new Geometry();
			g.setMesh( p.renderStrip(  TweedSettings.settings.profileHSampleDist/2, null ) );
			g.setMaterial( mat );
			n.attachChild( g );
		}
	}
 
開發者ID:twak,項目名稱:chordatlas,代碼行數:23,代碼來源:ProfileGen.java

示例6: getEditableProperties

import com.jme3.math.ColorRGBA; //導入依賴的package包/類
@Override
public @NotNull List<EditableProperty<?, ?>> getEditableProperties() {

    final List<EditableProperty<?, ?>> result = new ArrayList<>(4);

    result.add(new SimpleProperty<>(COLOR, "Ambient color", this,
            makeGetter(this, ColorRGBA.class, "getAmbientColor"),
            makeSetter(this, ColorRGBA.class, "setAmbientColor")));

    result.add(new SimpleProperty<>(COLOR, "Sun color", this,
            makeGetter(this, ColorRGBA.class, "getSunColor"),
            makeSetter(this, ColorRGBA.class, "setSunColor")));

    result.add(new SimpleProperty<>(FLOAT, "Time of day", 0.03F, -0.300F, 1.300F, this,
            makeGetter(this, float.class, "getTimeOfDay"),
            makeSetter(this, float.class, "setTimeOfDay")));

    result.add(new SimpleProperty<>(FLOAT, "Orientation", 0.1F, 0F, 6.283F, this,
            makeGetter(this, float.class, "getOrientation"),
            makeSetter(this, float.class, "setOrientation")));

    return result;
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder-extension,代碼行數:24,代碼來源:EditableLightingSceneAppState.java

示例7: getEditableProperties

import com.jme3.math.ColorRGBA; //導入依賴的package包/類
@Override
public @NotNull List<EditableProperty<?, ?>> getEditableProperties() {

    final List<EditableProperty<?, ?>> result = new ArrayList<>(3);

    result.add(new SimpleProperty<>(COLOR, "Shadow color", this,
            makeGetter(this, ColorRGBA.class, "getShadowColor"),
            makeSetter(this, ColorRGBA.class, "setShadowColor")));
    result.add(new SimpleProperty<>(INTEGER, "Max shadows", this,
            makeGetter(this, int.class, "getMaxShadows"),
            makeSetter(this, int.class, "setMaxShadows")));
    result.add(new SimpleProperty<>(FLOAT, "Shadow intensity", 0.005F, 0F, 1F, this,
            makeGetter(this, float.class, "getShadowIntensity"),
            makeSetter(this, float.class, "setShadowIntensity")));

    return result;
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder-extension,代碼行數:18,代碼來源:EditableDropShadowFilter.java

示例8: getEditableProperties

import com.jme3.math.ColorRGBA; //導入依賴的package包/類
@Override
public @NotNull List<EditableProperty<?, ?>> getEditableProperties() {

    final List<EditableProperty<?, ?>> result = new ArrayList<>(3);

    result.add(new SimpleProperty<>(COLOR, "Fog color", this,
            makeGetter(this, ColorRGBA.class, "getFogColor"),
            makeSetter(this, ColorRGBA.class, "setFogColor")));
    result.add(new SimpleProperty<>(FLOAT, "Fog density", 0.01F, 0F, 100F, this,
            makeGetter(this, float.class, "getFogDensity"),
            makeSetter(this, float.class, "setFogDensity")));
    result.add(new SimpleProperty<>(FLOAT, "Fog distance", 1F, 0F, Integer.MAX_VALUE, this,
            makeGetter(this, float.class, "getFogDistance"),
            makeSetter(this, float.class, "setFogDistance")));

    return result;
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder-extension,代碼行數:18,代碼來源:EditableFogFilter.java

示例9: processRemove

import com.jme3.math.ColorRGBA; //導入依賴的package包/類
@Override
protected void processRemove() {

    final ColorInfluencer influencer = getInfluencer();
    final List<ColorRGBA> colors = influencer.getColors();

    final ColorRGBA color = influencer.getColor(colors.size() - 1);
    final Interpolation interpolation = influencer.getInterpolation(colors.size() - 1);

    execute(true, false, (colorInfluencer, needRemove) -> {
        if (needRemove) {
            colorInfluencer.removeLast();
        } else {
            colorInfluencer.addColor(color, interpolation);
        }
    });
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder,代碼行數:18,代碼來源:ColorInfluencerControl.java

示例10: validate

import com.jme3.math.ColorRGBA; //導入依賴的package包/類
@Override
@FXThread
protected boolean validate(@NotNull final VarTable vars) {

    final Color color = UIUtils.from(vars.get(PROP_COLOR, ColorRGBA.class));

    final int width = vars.getInteger(PROP_WIDTH);
    final int height = vars.getInteger(PROP_HEIGHT);

    final WritableImage writableImage = new WritableImage(width, height);
    final PixelWriter pixelWriter = writableImage.getPixelWriter();

    for (int i = 0; i < width; i++) {
        for (int j = 0; j < height; j++) {
            pixelWriter.setColor(i, j, color);
        }
    }

    getImageView().setImage(writableImage);
    return true;
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder,代碼行數:22,代碼來源:SingleColorTextureFileCreator.java

示例11: writeData

import com.jme3.math.ColorRGBA; //導入依賴的package包/類
@Override
@BackgroundThread
protected void writeData(@NotNull final VarTable vars, final @NotNull Path resultFile) throws IOException {
    super.writeData(vars, resultFile);

    final Color color = UIUtils.from(vars.get(PROP_COLOR, ColorRGBA.class));

    final int width = vars.getInteger(PROP_WIDTH);
    final int height = vars.getInteger(PROP_HEIGHT);

    final WritableImage writableImage = new WritableImage(width, height);
    final PixelWriter pixelWriter = writableImage.getPixelWriter();

    for (int i = 0; i < width; i++) {
        for (int j = 0; j < height; j++) {
            pixelWriter.setColor(i, j, color);
        }
    }

    final BufferedImage bufferedImage = SwingFXUtils.fromFXImage(writableImage, null);

    try (final OutputStream out = Files.newOutputStream(resultFile)) {
        ImageIO.write(bufferedImage, "png", out);
    }
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder,代碼行數:26,代碼來源:SingleColorTextureFileCreator.java

示例12: change

import com.jme3.math.ColorRGBA; //導入依賴的package包/類
/**
 * Notify about wanting to change color of a point.
 *
 * @param index the index
 * @param color the color
 */
protected void change(final int index, @NotNull final ColorRGBA color) {

    final Array<ColorPoint> colorPoints = getColorPoints();
    final ColorPoint search = colorPoints.search(index, (point, toCheck) -> point.index == toCheck);

    if (search != null) {
        search.red = color.r;
        search.green = color.g;
        search.blue = color.b;
        search.alpha = color.a;
        return;
    }

    colorPoints.add(new ColorPoint(index, color.r, color.g, color.b, color.a));
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder,代碼行數:22,代碼來源:PaintTerrainToolControl.java

示例13: setButtonHoverInfo

import com.jme3.math.ColorRGBA; //導入依賴的package包/類
/**
 * Sets the texture image path and color to use when the button has mouse
 * focus
 * 
 * @param pathHoverImg
 *            String path to image for mouse focus event
 * @param hoverFontColor
 *            ColorRGBA to use for mouse focus event
 */
public final Button setButtonHoverInfo(String pathHoverImg, ColorRGBA hoverFontColor) {
	PropertyDeclaration decl = new PropertyDeclaration(CSSName.BACKGROUND_IMAGE,
			pathHoverImg == null ? new PropertyValue(IdentValue.AUTO)
					: new PropertyValue(new FSFunction("url", Arrays.asList(pathHoverImg))),
			false, StylesheetInfo.USER);
	getCssState().addCssDeclaration(decl, PseudoStyle.hover);
	applyCss(decl);
	PropertyDeclaration declf = new PropertyDeclaration(CSSName.COLOR, hoverFontColor == null
			? new PropertyValue(IdentValue.AUTO) : new PropertyValue(CssUtil.rgbaColor(hoverFontColor)), false,
			StylesheetInfo.USER);
	getCssState().addCssDeclaration(declf, PseudoStyle.hover);
	applyCss(declf);
	layoutChildren();
	return this;
}
 
開發者ID:rockfireredmoon,項目名稱:icetone,代碼行數:25,代碼來源:Button.java

示例14: createCanvas

import com.jme3.math.ColorRGBA; //導入依賴的package包/類
protected void createCanvas() {

		dragLayer = new BaseElement(screen);
		dragLayer.setStyleId("drag-layer");
		dragLayer.setDefaultColor(ColorRGBA.Gray);
		dragLayer.setElementAlpha(0.5f);
		dragLayer.setDragDropDropElement(true);

		canvas = new BaseElement(screen);
		canvas.setStyleId("canvas");

		canvasStack = new Element(screen);
		canvasStack.setStyleId("canvas");
		canvasStack.setLayoutManager(new FillLayout());
		canvasStack.addElement(canvas);
	}
 
開發者ID:rockfireredmoon,項目名稱:icetone,代碼行數:17,代碼來源:DesignerAppState.java

示例15: doCreateSpatial

import com.jme3.math.ColorRGBA; //導入依賴的package包/類
@Override
protected Spatial doCreateSpatial(Node parent) {
    NewGeometrySettings cfg = new NewGeometrySettings();
    Sphere b = new Sphere(
        cfg.getSphereZSamples()
        , cfg.getSpherRadialSamples()
        , cfg.getSphereRadius()
        , cfg.getSphereUseEvenSlices()
        , cfg.getSphereInterior()
    );
    b.setMode(cfg.getSphereMode());
    Geometry geom = new Geometry(cfg.getSphereName(), b);
    Material mat = new Material(pm, "Common/MatDefs/Misc/Unshaded.j3md");
    ColorRGBA  c = cfg.getMatRandom() ?ColorRGBA.randomColor() : cfg.getMatColor();
    mat.setColor("Color", c);
    geom.setMaterial(mat);        
    parent.attachChild(geom);
    return geom;
}
 
開發者ID:jMonkeyEngine,項目名稱:sdk,代碼行數:20,代碼來源:NewGeometrySphereAction.java


注:本文中的com.jme3.math.ColorRGBA類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。