当前位置: 首页>>代码示例>>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;未经允许,请勿转载。