Search in sources :

Example 31 with RenderManager

use of com.jme3.renderer.RenderManager in project jmonkeyengine by jMonkeyEngine.

the class FogFilter method initFilter.

@Override
protected void initFilter(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h) {
    material = new Material(manager, "Common/MatDefs/Post/Fog.j3md");
    material.setColor("FogColor", fogColor);
    material.setFloat("FogDensity", fogDensity);
    material.setFloat("FogDistance", fogDistance);
}
Also used : Material(com.jme3.material.Material)

Example 32 with RenderManager

use of com.jme3.renderer.RenderManager in project jmonkeyengine by jMonkeyEngine.

the class LightScatteringFilter method initFilter.

@Override
protected void initFilter(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h) {
    this.viewPort = vp;
    material = new Material(manager, "Common/MatDefs/Post/LightScattering.j3md");
}
Also used : Material(com.jme3.material.Material)

Example 33 with RenderManager

use of com.jme3.renderer.RenderManager in project jmonkeyengine by jMonkeyEngine.

the class EnvironmentCamera method render.

@Override
public void render(final RenderManager renderManager) {
    if (jobs.isEmpty()) {
        return;
    }
    final SnapshotJob job = jobs.get(0);
    for (int i = 0; i < 6; i++) {
        viewports[i].clearScenes();
        viewports[i].attachScene(job.scene);
        renderManager.renderViewPort(viewports[i], 0.16f);
        buffers[i] = BufferUtils.createByteBuffer(size * size * imageFormat.getBitsPerPixel() / 8);
        renderManager.getRenderer().readFrameBufferWithFormat(framebuffers[i], buffers[i], imageFormat);
        images[i] = new Image(imageFormat, size, size, buffers[i], ColorSpace.Linear);
    }
    final TextureCubeMap map = EnvMapUtils.makeCubeMap(images[0], images[1], images[2], images[3], images[4], images[5], imageFormat);
    job.callback.done(map);
    map.getImage().dispose();
    jobs.remove(0);
}
Also used : TextureCubeMap(com.jme3.texture.TextureCubeMap) Image(com.jme3.texture.Image)

Example 34 with RenderManager

use of com.jme3.renderer.RenderManager in project jmonkeyengine by jMonkeyEngine.

the class ParticleEmitter method renderFromControl.

/**
     * Callback from Control.render(), do not use.
     *
     * @param rm
     * @param vp
     */
private void renderFromControl(RenderManager rm, ViewPort vp) {
    Camera cam = vp.getCamera();
    if (meshType == ParticleMesh.Type.Point) {
        float C = cam.getProjectionMatrix().m00;
        C *= cam.getWidth() * 0.5f;
        // send attenuation params
        this.getMaterial().setFloat("Quadratic", C);
    }
    Matrix3f inverseRotation = Matrix3f.IDENTITY;
    TempVars vars = null;
    if (!worldSpace) {
        vars = TempVars.get();
        inverseRotation = this.getWorldRotation().toRotationMatrix(vars.tempMat3).invertLocal();
    }
    particleMesh.updateParticleData(particles, cam, inverseRotation);
    if (!worldSpace) {
        vars.release();
    }
}
Also used : Matrix3f(com.jme3.math.Matrix3f) Camera(com.jme3.renderer.Camera) TempVars(com.jme3.util.TempVars)

Example 35 with RenderManager

use of com.jme3.renderer.RenderManager in project jmonkeyengine by jMonkeyEngine.

the class BitmapText method render.

public void render(RenderManager rm, ColorRGBA color) {
    for (BitmapTextPage page : textPages) {
        Material mat = page.getMaterial();
        mat.setTexture("ColorMap", page.getTexture());
        //ColorRGBA original = getColor(mat, "Color");
        //mat.setColor("Color", color);
        mat.render(page, rm);
    //if( original == null ) {
    //    mat.clearParam("Color");
    //} else {
    //    mat.setColor("Color", original);
    //}
    }
}
Also used : Material(com.jme3.material.Material)

Aggregations

Material (com.jme3.material.Material)25 Camera (com.jme3.renderer.Camera)15 Renderer (com.jme3.renderer.Renderer)11 Vector3f (com.jme3.math.Vector3f)8 Texture2D (com.jme3.texture.Texture2D)5 DirectionalLight (com.jme3.light.DirectionalLight)4 Geometry (com.jme3.scene.Geometry)4 Picture (com.jme3.ui.Picture)4 TempVars (com.jme3.util.TempVars)4 Light (com.jme3.light.Light)3 PointLight (com.jme3.light.PointLight)3 SpotLight (com.jme3.light.SpotLight)3 Pass (com.jme3.post.Filter.Pass)3 RenderManager (com.jme3.renderer.RenderManager)3 Spatial (com.jme3.scene.Spatial)3 Shader (com.jme3.shader.Shader)3 FrameBuffer (com.jme3.texture.FrameBuffer)3 Texture (com.jme3.texture.Texture)3 Test (org.junit.Test)3 Technique (com.jme3.material.Technique)2