com.jme3.math.ColorRGBA Java Examples

The following examples show how to use com.jme3.math.ColorRGBA. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestExplosionEffect.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void createDebris(){
        debris = new ParticleEmitter("Debris", Type.Triangle, 15 * COUNT_FACTOR);
        debris.setSelectRandomImage(true);
        debris.setRandomAngle(true);
        debris.setRotateSpeed(FastMath.TWO_PI * 4);
        debris.setStartColor(new ColorRGBA(1f, 0.59f, 0.28f, 1.0f / COUNT_FACTOR_F));
        debris.setEndColor(new ColorRGBA(.5f, 0.5f, 0.5f, 0f));
        debris.setStartSize(.2f);
        debris.setEndSize(.2f);

//        debris.setShape(new EmitterSphereShape(Vector3f.ZERO, .05f));
        debris.setParticlesPerSec(0);
        debris.setGravity(0, 12f, 0);
        debris.setLowLife(1.4f);
        debris.setHighLife(1.5f);
        debris.getParticleInfluencer()
                .setInitialVelocity(new Vector3f(0, 15, 0));
        debris.getParticleInfluencer().setVelocityVariation(.60f);
        debris.setImagesX(3);
        debris.setImagesY(3);
        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
        mat.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/Debris.png"));
        debris.setMaterial(mat);
        explosionEffect.attachChild(debris);
    }
 
Example #2
Source File: TestUnshadedModel.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public void simpleInitApp() {
    Sphere sphMesh = new Sphere(32, 32, 1);
    sphMesh.setTextureMode(Sphere.TextureMode.Projected);
    sphMesh.updateGeometry(32, 32, 1, false, false);
    TangentBinormalGenerator.generate(sphMesh);

    Geometry sphere = new Geometry("Rock Ball", sphMesh);
    Material mat = assetManager.loadMaterial("Textures/Terrain/Pond/Pond.j3m");
    mat.setColor("Ambient", ColorRGBA.DarkGray);
    mat.setColor("Diffuse", ColorRGBA.White);
    mat.setBoolean("UseMaterialColors", true);
    sphere.setMaterial(mat);
    rootNode.attachChild(sphere);

    PointLight pl = new PointLight();
    pl.setColor(ColorRGBA.White);
    pl.setPosition(new Vector3f(4f, 0f, 0f));
    rootNode.addLight(pl);

    AmbientLight al = new AmbientLight();
    al.setColor(ColorRGBA.White);
    rootNode.addLight(al);
}
 
Example #3
Source File: TranslucentBucketFilter.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
protected void initFilter(AssetManager manager, RenderManager rm, ViewPort vp, int w, int h) {
    this.renderManager = rm;
    this.viewPort = vp;
    material = new Material(manager, "Common/MatDefs/Post/Overlay.j3md");
    material.setColor("Color", ColorRGBA.White);
    Texture2D tex = processor.getFilterTexture();
    material.setTexture("Texture", tex);
    if (tex.getImage().getMultiSamples() > 1) {
        material.setInt("NumSamples", tex.getImage().getMultiSamples());
    } else {
        material.clearParam("NumSamples");
    }
    renderManager.setHandleTranslucentBucket(false);
    if (enabledSoftParticles && depthTexture != null) {
        initSoftParticles(vp, true);
    }
}
 
Example #4
Source File: SkeletonControl.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void showSkeleton(boolean flag) {
    if (flag) {
        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        mat.setColor("Color", ColorRGBA.Green);
        mat.getAdditionalRenderState().setDepthTest(false);
        SkeletonWire sw = new SkeletonWire(skeleton);
        Geometry skeletonWireGeom = new Geometry("skeletonWire", sw);
        model.attachChild(skeletonWireGeom);
        skeletonWireGeom.setMaterial(mat);
        skeletonWireGeom.setQueueBucket(Bucket.Transparent);
    } else {
        if (skeletonLineNode != null) {
            skeletonLineNode.removeFromParent();
            skeletonLineNode = null;
        }
    }
}
 
Example #5
Source File: TestExplosionEffect.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void createFlame(){
    flame = new ParticleEmitter("Flame", EMITTER_TYPE, 32 * COUNT_FACTOR);
    flame.setSelectRandomImage(true);
    flame.setStartColor(new ColorRGBA(1f, 0.4f, 0.05f, (float) (1f / COUNT_FACTOR_F)));
    flame.setEndColor(new ColorRGBA(.4f, .22f, .12f, 0f));
    flame.setStartSize(1.3f);
    flame.setEndSize(2f);
    flame.setShape(new EmitterSphereShape(Vector3f.ZERO, 1f));
    flame.setParticlesPerSec(0);
    flame.setGravity(0, -5, 0);
    flame.setLowLife(.4f);
    flame.setHighLife(.5f);
    flame.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 7, 0));
    flame.getParticleInfluencer().setVelocityVariation(1f);
    flame.setImagesX(2);
    flame.setImagesY(2);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
    mat.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/flame.png"));
    mat.setBoolean("PointSprite", POINT_SPRITE);
    flame.setMaterial(mat);
    explosionEffect.attachChild(flame);
}
 
Example #6
Source File: SingleColorTextureFileCreator.java    From jmonkeybuilder with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example #7
Source File: TestCartoonEdge.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public void simpleInitApp() {
    viewPort.setBackgroundColor(ColorRGBA.Gray);

    cam.setLocation(new Vector3f(-5.6310086f, 5.0892987f, -13.000479f));
    cam.setRotation(new Quaternion(0.1779095f, 0.20036356f, -0.03702727f, 0.96272093f));
    cam.update();

    cam.setFrustumFar(300);
    flyCam.setMoveSpeed(30);

    rootNode.setCullHint(CullHint.Never);

    setupLighting();
    setupModel();
    setupFilters();
}
 
Example #8
Source File: CubeField.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Initializes game 
 */
@Override
public void simpleInitApp() {
    Logger.getLogger("com.jme3").setLevel(Level.WARNING);

    flyCam.setEnabled(false);
    setDisplayStatView(false);

    Keys();

    defaultFont = assetManager.loadFont("Interface/Fonts/Default.fnt");
    pressStart = new BitmapText(defaultFont, false);
    fpsScoreText = new BitmapText(defaultFont, false);

    loadText(fpsScoreText, "Current Score: 0", defaultFont, 0, 2, 0);
    loadText(pressStart, "PRESS ENTER", defaultFont, 0, 5, 0);
    
    player = createPlayer();
    rootNode.attachChild(player);
    cubeField = new ArrayList<Geometry>();
    obstacleColors = new ArrayList<ColorRGBA>();

    gameReset();
}
 
Example #9
Source File: RenderDeviceJme.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void renderImage(RenderImage image, int x, int y, int width, int height,
                       Color color, float imageScale){

        RenderImageJme jmeImage = (RenderImageJme) image;

        niftyMat.getAdditionalRenderState().setBlendMode(convertBlend());
        niftyMat.setColor("Color", ColorRGBA.White);
        niftyMat.setTexture("Texture", jmeImage.getTexture());
        niftyMat.setBoolean("UseTex", true);
        setColor(color);

        quad.clearBuffer(Type.TexCoord);
        quad.setBuffer(quadDefaultTC);

        float x0 = x + 0.5f * width  * (1f - imageScale);
        float y0 = y + 0.5f * height * (1f - imageScale);

        tempMat.loadIdentity();
        tempMat.setTranslation(x0, getHeight() - y0, 0);
        tempMat.setScale(width * imageScale, height * imageScale, 0);

        rm.setWorldMatrix(tempMat);
        niftyMat.render(quadGeom, rm);
//        
//        System.out.println("renderImage");
    }
 
Example #10
Source File: TestImageRaster.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private Image createTestImage() {
    Image testImage = new Image(Format.BGR8, 4, 3, BufferUtils.createByteBuffer(4 * 4 * 3), null, ColorSpace.Linear);
    
    ImageRaster io = ImageRaster.create(testImage);
    io.setPixel(0, 0, ColorRGBA.Black);
    io.setPixel(1, 0, ColorRGBA.Gray);
    io.setPixel(2, 0, ColorRGBA.White);
    io.setPixel(3, 0, ColorRGBA.White.mult(4)); // HDR color

    io.setPixel(0, 1, ColorRGBA.Red);
    io.setPixel(1, 1, ColorRGBA.Green);
    io.setPixel(2, 1, ColorRGBA.Blue);
    io.setPixel(3, 1, new ColorRGBA(0, 0, 0, 0));

    io.setPixel(0, 2, ColorRGBA.Yellow);
    io.setPixel(1, 2, ColorRGBA.Magenta);
    io.setPixel(2, 2, ColorRGBA.Cyan);
    io.setPixel(3, 2, new ColorRGBA(1, 1, 1, 0));
    
    return testImage;
}
 
Example #11
Source File: RenderDeviceJme.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void renderQuad(int x, int y, int width, int height, Color color){
        niftyMat.getAdditionalRenderState().setBlendMode(convertBlend());
        niftyMat.setColor("Color", ColorRGBA.White);
        niftyMat.clearParam("Texture");
        niftyMat.setBoolean("UseTex", false);
        setColor(color);

        tempMat.loadIdentity();
        tempMat.setTranslation(x, getHeight() - y, 0);
        tempMat.setScale(width, height, 0);

        rm.setWorldMatrix(tempMat);
        niftyMat.render(quadGeom, rm);
        
//        System.out.println("renderQuad (Solid)");
    }
 
Example #12
Source File: TestAnisotropicFilter.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private static Texture2D createCheckerBoardTexture() {
    Image image = new Image(Format.RGBA8, 1024, 1024, BufferUtils.createByteBuffer(1024 * 1024 * 4), ColorSpace.sRGB);
    
    ImageRaster raster = ImageRaster.create(image);
    for (int y = 0; y < 1024; y++) {
        for (int x = 0; x < 1024; x++) {
            if (y < 512) {
                if (x < 512) {
                    raster.setPixel(x, y, ColorRGBA.Black);
                } else {
                    raster.setPixel(x, y, ColorRGBA.White);
                }
            } else {
                if (x < 512) {
                    raster.setPixel(x, y, ColorRGBA.White);
                } else {
                    raster.setPixel(x, y, ColorRGBA.Black);
                }
            }
        }
    }

    return new Texture2D(image);
}
 
Example #13
Source File: TestExplosionEffect.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void createDebris(){
        debris = new ParticleEmitter("Debris", Type.Triangle, 15 * COUNT_FACTOR);
        debris.setSelectRandomImage(true);
        debris.setRandomAngle(true);
        debris.setRotateSpeed(FastMath.TWO_PI * 4);
        debris.setStartColor(new ColorRGBA(1f, 0.59f, 0.28f, (float) (1.0f / COUNT_FACTOR_F)));
        debris.setEndColor(new ColorRGBA(.5f, 0.5f, 0.5f, 0f));
        debris.setStartSize(.2f);
        debris.setEndSize(.2f);

//        debris.setShape(new EmitterSphereShape(Vector3f.ZERO, .05f));
        debris.setParticlesPerSec(0);
        debris.setGravity(0, 12f, 0);
        debris.setLowLife(1.4f);
        debris.setHighLife(1.5f);
        debris.setInitialVelocity(new Vector3f(0, 15, 0));
        debris.setVelocityVariation(.60f);
        debris.setImagesX(3);
        debris.setImagesY(3);
        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
        mat.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/Debris.png"));
        debris.setMaterial(mat);
        explosionEffect.attachChild(debris);
    }
 
Example #14
Source File: PopupState.java    From Lemur with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
protected Geometry createBlocker( float z, ColorRGBA backgroundColor ) {
    Camera cam = getApplication().getCamera();
 
    // Get the inverse scale of whatever the current guiNode is so that
    // we can find a proper screen size
    float width = cam.getWidth() / guiNode.getLocalScale().x;
    float height = cam.getHeight() / guiNode.getLocalScale().y;
    
    Quad quad = new Quad(width, height);
    Geometry result = new Geometry("blocker", quad);
    GuiMaterial guiMat = createBlockerMaterial(backgroundColor);
    result.setMaterial(guiMat.getMaterial());
    //result.setQueueBucket(Bucket.Transparent); // no, it goes in the gui bucket.
    result.setLocalTranslation(0, 0, z);
    return result;
}
 
Example #15
Source File: Picture.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Set the texture to put on the picture.
 * 
 * @param assetManager The {@link AssetManager} to use to load the material.
 * @param tex The texture
 * @param useAlpha If true, the picture will appear transparent and allow
 * objects behind it to appear through. If false, the transparent
 * portions will be the image's color at that pixel.
 */
public void setTexture(AssetManager assetManager, Texture2D tex, boolean useAlpha){
    if (getMaterial() == null){
        Material mat = new Material(assetManager, "Common/MatDefs/Gui/Gui.j3md");
        mat.setColor("Color", ColorRGBA.White);
        setMaterial(mat);
    }
    material.getAdditionalRenderState().setBlendMode(useAlpha ? BlendMode.Alpha : BlendMode.Off);
    material.setTexture("Texture", tex);
}
 
Example #16
Source File: PssmShadowRenderer.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private Geometry createFrustum(Vector3f[] pts, int i) {
    WireFrustum frustum = new WireFrustum(pts);
    Geometry frustumMdl = new Geometry("f", frustum);
    frustumMdl.setCullHint(Spatial.CullHint.Never);
    frustumMdl.setShadowMode(ShadowMode.Off);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat.getAdditionalRenderState().setWireframe(true);
    frustumMdl.setMaterial(mat);
    switch (i) {
        case 0:
            frustumMdl.getMaterial().setColor("Color", ColorRGBA.Pink);
            break;
        case 1:
            frustumMdl.getMaterial().setColor("Color", ColorRGBA.Red);
            break;
        case 2:
            frustumMdl.getMaterial().setColor("Color", ColorRGBA.Green);
            break;
        case 3:
            frustumMdl.getMaterial().setColor("Color", ColorRGBA.Blue);
            break;
        default:
            frustumMdl.getMaterial().setColor("Color", ColorRGBA.White);
            break;
    }

    frustumMdl.updateGeometricState();
    return frustumMdl;
}
 
Example #17
Source File: TestTexture3DLoading.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void simpleInitApp() {
    viewPort.setBackgroundColor(ColorRGBA.DarkGray);
    flyCam.setEnabled(false);


    Quad q = new Quad(10, 10);

    Geometry geom = new Geometry("Quad", q);
    Material material = new Material(assetManager, "jme3test/texture/tex3DThumb.j3md");
    TextureKey key = new TextureKey("Textures/3D/flame.dds");
    key.setGenerateMips(true);
    key.setAsTexture3D(true);

    Texture t = assetManager.loadTexture(key);

    int rows = 4;//4 * 4

    q.scaleTextureCoordinates(new Vector2f(rows, rows));

    //The image only have 8 pictures and we have 16 thumbs, the data will be interpolated by the GPU
    material.setFloat("InvDepth", 1f / 16f);
    material.setInt("Rows", rows);
    material.setTexture("Texture", t);
    geom.setMaterial(material);

    rootNode.attachChild(geom);

    cam.setLocation(new Vector3f(4.7444625f, 5.160054f, 13.1939f));
}
 
Example #18
Source File: FogFilter.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Create a fog filter 
 * @param fogColor the color of the fog (default is white)
 * @param fogDensity the density of the fog (default is 0.7)
 * @param fogDistance the distance of the fog (default is 1000)
 */
public FogFilter(ColorRGBA fogColor, float fogDensity, float fogDistance) {
    this();
    this.fogColor = fogColor;
    this.fogDensity = fogDensity;
    this.fogDistance = fogDistance;
}
 
Example #19
Source File: TestBatchNodeCluster.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public ColorRGBA randomColor() {
    ColorRGBA color = ColorRGBA.Black;
    int randomn = rand.nextInt(4);
    if (randomn == 0) {
        color = ColorRGBA.Orange;
    } else if (randomn == 1) {
        color = ColorRGBA.Blue;
    } else if (randomn == 2) {
        color = ColorRGBA.Brown;
    } else if (randomn == 3) {
        color = ColorRGBA.Magenta;
    }
    return color;
}
 
Example #20
Source File: OSVRViewManager.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void setupFinalFullTexture(Camera cam) {
	
	if (environment != null){
		if (environment.getApplication() != null){
			// create offscreen framebuffer
	        FrameBuffer out = new FrameBuffer(cam.getWidth(), cam.getHeight(), 1);
	        //offBuffer.setSrgb(true);

	        //setup framebuffer's texture
	        dualEyeTex = new Texture2D(cam.getWidth(), cam.getHeight(), Image.Format.RGBA8);
	        dualEyeTex.setMinFilter(Texture.MinFilter.BilinearNoMipMaps);
	        dualEyeTex.setMagFilter(Texture.MagFilter.Bilinear);

	        logger.config("Dual eye texture "+dualEyeTex.getName()+" ("+dualEyeTex.getImage().getId()+")");
	        logger.config("               Type: "+dualEyeTex.getType());
	        logger.config("               Size: "+dualEyeTex.getImage().getWidth()+"x"+dualEyeTex.getImage().getHeight());
	        logger.config("        Image depth: "+dualEyeTex.getImage().getDepth());
	        logger.config("       Image format: "+dualEyeTex.getImage().getFormat());
	        logger.config("  Image color space: "+dualEyeTex.getImage().getColorSpace());
	        
	        //setup framebuffer to use texture
	        out.setDepthBuffer(Image.Format.Depth);
	        out.setColorTexture(dualEyeTex);       

	        ViewPort viewPort = environment.getApplication().getViewPort();
	        viewPort.setClearFlags(true, true, true);
	        viewPort.setBackgroundColor(ColorRGBA.Black);
	        viewPort.setOutputFrameBuffer(out);
		} else {
			throw new IllegalStateException("This VR environment is not attached to any application.");
		}
	} else {
		throw new IllegalStateException("This VR view manager is not attached to any VR environment.");
	}  
}
 
Example #21
Source File: TestCartoonEdge.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void setupFilters(){
    if (renderer.getCaps().contains(Caps.GLSL100)){
        fpp=new FilterPostProcessor(assetManager);
        //fpp.setNumSamples(4);
        int numSamples = getContext().getSettings().getSamples();
        if( numSamples > 0 ) {
            fpp.setNumSamples(numSamples); 
        }
        CartoonEdgeFilter toon=new CartoonEdgeFilter();
        toon.setEdgeColor(ColorRGBA.Yellow);
        fpp.addFilter(toon);
        viewPort.addProcessor(fpp);
    }
}
 
Example #22
Source File: Button.java    From Lemur with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
protected void resetColors() {
    if( focusOn && highlightOn ) {
        // Mix them
        ColorRGBA color = mix(getHighlightColor(), getFocusColor());
        if( color != null ) {
            super.setColor(color);
        }
        ColorRGBA shadow = mix(getHighlightShadowColor(), getFocusShadowColor());
        if( shadow != null ) {
            super.setShadowColor(shadow);
        } 
    } else if( highlightOn ) {
        if( getHighlightColor() != null )
            super.setColor(getHighlightColor());
        if( getHighlightShadowColor() != null )
            super.setShadowColor(getHighlightShadowColor());
    } else if( focusOn ) {
        if( getFocusColor() != null )
            super.setColor(getFocusColor());
        if( getFocusShadowColor() != null )
            super.setShadowColor(getFocusShadowColor());
    } else {
        // Just the plain color
        super.setColor(getColor());
        super.setShadowColor(getShadowColor());
    }
}
 
Example #23
Source File: Letters.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * @param start start index to set style. inclusive.
 * @param end   end index to set style. EXCLUSIVE.
 * @param color
 */
void setColor(int start, int end, ColorRGBA color) {
    LetterQuad cursor = head.getNext();
    while (!cursor.isTail()) {
        if (cursor.getIndex() >= start && cursor.getIndex() < end) {
            cursor.setColor(color);
        }
        cursor = cursor.getNext();
    }
}
 
Example #24
Source File: HelloCollision.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void setUpLight() {
  // We add light so we see the scene
  AmbientLight al = new AmbientLight();
  al.setColor(ColorRGBA.White.mult(1.3f));
  rootNode.addLight(al);

  DirectionalLight dl = new DirectionalLight();
  dl.setColor(ColorRGBA.White);
  dl.setDirection(new Vector3f(2.8f, -2.8f, -2.8f).normalizeLocal());
  rootNode.addLight(dl);
}
 
Example #25
Source File: AbstractPaintingControl.java    From jmonkeybuilder with Apache License 2.0 5 votes vote down vote up
/**
 * Create a colored material.
 *
 * @param color the color.
 * @return the colored material.
 */
@JmeThread
protected @NotNull Material createColoredMaterial(@NotNull final ColorRGBA color) {
    final Material material = new Material(EditorUtil.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
    material.setColor("Color", color);
    return material;
}
 
Example #26
Source File: CrossHatchFilter.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Sets color used to draw lines
 * @param lineColor 
 */
public void setLineColor(ColorRGBA lineColor) {
    this.lineColor = lineColor;
    if (material != null) {
        material.setColor("LineColor", lineColor);
    }
}
 
Example #27
Source File: BloomFilter.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
protected void postQueue(RenderQueue queue) {
    if (glowMode != GlowMode.Scene) {           
        renderManager.getRenderer().setBackgroundColor(ColorRGBA.BlackNoAlpha);            
        renderManager.getRenderer().setFrameBuffer(preGlowPass.getRenderFrameBuffer());
        renderManager.getRenderer().clearBuffers(true, true, true);
        renderManager.setForcedTechnique("Glow");
        renderManager.renderViewPortQueues(viewPort, false);         
        renderManager.setForcedTechnique(null);
        renderManager.getRenderer().setFrameBuffer(viewPort.getOutputFrameBuffer());
    }
}
 
Example #28
Source File: CubeField.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private Node createPlayer() {
    Dome b = new Dome(Vector3f.ZERO, 10, 100, 1);
    Geometry playerMesh = new Geometry("Box", b);

    playerMaterial = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    playerMaterial.setColor("Color", ColorRGBA.Red);
    playerMesh.setMaterial(playerMaterial);
    playerMesh.setName("player");

    Box floor = new Box(100, 0, 100);
    
    Geometry floorMesh = new Geometry("Box", floor);

    Vector3f translation = Vector3f.ZERO.add(playerMesh.getLocalTranslation().getX(),
            playerMesh.getLocalTranslation().getY() - 1, 0);

    floorMesh.setLocalTranslation(translation);

    floorMaterial = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    floorMaterial.setColor("Color", ColorRGBA.LightGray);
    floorMesh.setMaterial(floorMaterial);
    floorMesh.setName("floor");

    Node playerNode = new Node();
    playerNode.attachChild(playerMesh);
    playerNode.attachChild(floorMesh);

    return playerNode;
}
 
Example #29
Source File: TestCartoonEdge.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void setupLighting(){

     DirectionalLight dl = new DirectionalLight();
     dl.setDirection(new Vector3f(-1, -1, 1).normalizeLocal());
     dl.setColor(new ColorRGBA(2,2,2,1));

     rootNode.addLight(dl);
 }
 
Example #30
Source File: TestMousePick.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/** A floor to show that the "shot" can go through several objects. */
protected Geometry makeFloor() {
    Box box = new Box(15, .2f, 15);
    Geometry floor = new Geometry("the Floor", box);
    floor.setLocalTranslation(0, -4, -5);
    Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat1.setColor("Color", ColorRGBA.Gray);
    floor.setMaterial(mat1);
    return floor;
}