Search in sources :

Example 16 with Filter

use of com.jme3.post.Filter in project jmonkeyengine by jMonkeyEngine.

the class AbstractShadowRenderer method setEdgeFilteringMode.

/**
     * Sets the filtering mode for shadow edges. See {@link EdgeFilteringMode}
     * for more info.
     *
     * @param filterMode the desired filter mode (not null)
     */
public final void setEdgeFilteringMode(EdgeFilteringMode filterMode) {
    if (filterMode == null) {
        throw new NullPointerException();
    }
    this.edgeFilteringMode = filterMode;
    postshadowMat.setInt("FilterMode", filterMode.getMaterialParamValue());
    postshadowMat.setFloat("PCFEdge", edgesThickness);
    if (shadowCompareMode == CompareMode.Hardware) {
        for (Texture2D shadowMap : shadowMaps) {
            if (filterMode == EdgeFilteringMode.Bilinear) {
                shadowMap.setMagFilter(MagFilter.Bilinear);
                shadowMap.setMinFilter(MinFilter.BilinearNoMipMaps);
            } else {
                shadowMap.setMagFilter(MagFilter.Nearest);
                shadowMap.setMinFilter(MinFilter.NearestNoMipMaps);
            }
        }
    }
}
Also used : Texture2D(com.jme3.texture.Texture2D)

Example 17 with Filter

use of com.jme3.post.Filter in project jmonkeyengine by jMonkeyEngine.

the class LightFilterTest method setUp.

@Before
public void setUp() {
    filter = new DefaultLightFilter();
    cam = new Camera(512, 512);
    cam.setFrustumPerspective(45, 1, 1, 1000);
    cam.setLocation(Vector3f.ZERO);
    cam.lookAtDirection(Vector3f.UNIT_Z, Vector3f.UNIT_Y);
    filter.setCamera(cam);
    Box box = new Box(1, 1, 1);
    geom = new Geometry("geom", box);
    geom.setLocalTranslation(0, 0, 10);
    geom.updateGeometricState();
    list = new LightList(geom);
}
Also used : Geometry(com.jme3.scene.Geometry) Box(com.jme3.scene.shape.Box) Camera(com.jme3.renderer.Camera) Before(org.junit.Before)

Example 18 with Filter

use of com.jme3.post.Filter in project jmonkeyengine by jMonkeyEngine.

the class TestOgg method simpleInitApp.

@Override
public void simpleInitApp() {
    System.out.println("Playing without filter");
    audioSource = new AudioNode(assetManager, "Sound/Effects/Foot steps.ogg", DataType.Buffer);
    audioSource.play();
}
Also used : AudioNode(com.jme3.audio.AudioNode)

Example 19 with Filter

use of com.jme3.post.Filter in project jmonkeyengine by jMonkeyEngine.

the class BlenderContext method getLinkedFeature.

/**
     * The method returns linked feature of a given name from the specified blender path.
     * @param blenderFilePath
     *            the blender file path
     * @param featureName
     *            the feature name we want to get
     * @return linked feature or null if none was found
     */
@SuppressWarnings("unchecked")
public Object getLinkedFeature(String blenderFilePath, String featureName) {
    Map<String, Object> linkedFeatures = this.linkedFeatures.get(blenderFilePath);
    if (linkedFeatures != null) {
        String namePrefix = (featureName.charAt(0) + "" + featureName.charAt(1)).toUpperCase();
        featureName = featureName.substring(2);
        if ("SC".equals(namePrefix)) {
            List<Node> scenes = (List<Node>) linkedFeatures.get("scenes");
            if (scenes != null) {
                for (Node scene : scenes) {
                    if (featureName.equals(scene.getName())) {
                        return scene;
                    }
                }
            }
        } else if ("OB".equals(namePrefix)) {
            List<Node> features = (List<Node>) linkedFeatures.get("objects");
            if (features != null) {
                for (Node feature : features) {
                    if (featureName.equals(feature.getName())) {
                        return feature;
                    }
                }
            }
        } else if ("ME".equals(namePrefix)) {
            List<TemporalMesh> temporalMeshes = (List<TemporalMesh>) linkedFeatures.get("meshes");
            if (temporalMeshes != null) {
                for (TemporalMesh temporalMesh : temporalMeshes) {
                    if (featureName.equals(temporalMesh.getName())) {
                        return temporalMesh;
                    }
                }
            }
        } else if ("MA".equals(namePrefix)) {
            List<MaterialContext> features = (List<MaterialContext>) linkedFeatures.get("materials");
            if (features != null) {
                for (MaterialContext feature : features) {
                    if (featureName.equals(feature.getName())) {
                        return feature;
                    }
                }
            }
        } else if ("TX".equals(namePrefix)) {
            List<Texture> features = (List<Texture>) linkedFeatures.get("textures");
            if (features != null) {
                for (Texture feature : features) {
                    if (featureName.equals(feature.getName())) {
                        return feature;
                    }
                }
            }
        } else if ("IM".equals(namePrefix)) {
            List<Texture> features = (List<Texture>) linkedFeatures.get("images");
            if (features != null) {
                for (Texture feature : features) {
                    if (featureName.equals(feature.getName())) {
                        return feature;
                    }
                }
            }
        } else if ("AC".equals(namePrefix)) {
            List<Animation> features = (List<Animation>) linkedFeatures.get("animations");
            if (features != null) {
                for (Animation feature : features) {
                    if (featureName.equals(feature.getName())) {
                        return feature;
                    }
                }
            }
        } else if ("CA".equals(namePrefix)) {
            List<Camera> features = (List<Camera>) linkedFeatures.get("cameras");
            if (features != null) {
                for (Camera feature : features) {
                    if (featureName.equals(feature.getName())) {
                        return feature;
                    }
                }
            }
        } else if ("LA".equals(namePrefix)) {
            List<Light> features = (List<Light>) linkedFeatures.get("lights");
            if (features != null) {
                for (Light feature : features) {
                    if (featureName.equals(feature.getName())) {
                        return feature;
                    }
                }
            }
        } else if ("FI".equals(featureName)) {
            List<Filter> features = (List<Filter>) linkedFeatures.get("lights");
            if (features != null) {
                for (Filter feature : features) {
                    if (featureName.equals(feature.getName())) {
                        return feature;
                    }
                }
            }
        }
    }
    return null;
}
Also used : Node(com.jme3.scene.Node) Texture(com.jme3.texture.Texture) TemporalMesh(com.jme3.scene.plugins.blender.meshes.TemporalMesh) Filter(com.jme3.post.Filter) Light(com.jme3.light.Light) MaterialContext(com.jme3.scene.plugins.blender.materials.MaterialContext) Animation(com.jme3.animation.Animation) ArrayList(java.util.ArrayList) List(java.util.List) Camera(com.jme3.renderer.Camera)

Example 20 with Filter

use of com.jme3.post.Filter in project jmonkeyengine by jMonkeyEngine.

the class BulletDebugAppState method updateGhosts.

private void updateGhosts() {
    HashMap<PhysicsGhostObject, Spatial> oldObjects = ghosts;
    ghosts = new HashMap<PhysicsGhostObject, Spatial>();
    Collection<PhysicsGhostObject> current = space.getGhostObjectList();
    //create new map
    for (Iterator<PhysicsGhostObject> it = current.iterator(); it.hasNext(); ) {
        PhysicsGhostObject physicsObject = it.next();
        //copy existing spatials
        if (oldObjects.containsKey(physicsObject)) {
            Spatial spat = oldObjects.get(physicsObject);
            ghosts.put(physicsObject, spat);
            oldObjects.remove(physicsObject);
        } else {
            if (filter == null || filter.displayObject(physicsObject)) {
                logger.log(Level.FINE, "Create new debug GhostObject");
                //create new spatial
                Node node = new Node(physicsObject.toString());
                node.addControl(new BulletGhostObjectDebugControl(this, physicsObject));
                ghosts.put(physicsObject, node);
                physicsDebugRootNode.attachChild(node);
            }
        }
    }
    //remove leftover spatials
    for (Map.Entry<PhysicsGhostObject, Spatial> entry : oldObjects.entrySet()) {
        PhysicsGhostObject object = entry.getKey();
        Spatial spatial = entry.getValue();
        spatial.removeFromParent();
    }
}
Also used : Spatial(com.jme3.scene.Spatial) Node(com.jme3.scene.Node) PhysicsGhostObject(com.jme3.bullet.objects.PhysicsGhostObject) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

Node (com.jme3.scene.Node)10 Vector3f (com.jme3.math.Vector3f)7 FilterPostProcessor (com.jme3.post.FilterPostProcessor)7 Spatial (com.jme3.scene.Spatial)7 Texture2D (com.jme3.texture.Texture2D)6 HashMap (java.util.HashMap)6 Map (java.util.Map)6 SSAOFilter (com.jme3.post.ssao.SSAOFilter)5 DirectionalLight (com.jme3.light.DirectionalLight)4 Material (com.jme3.material.Material)4 Quaternion (com.jme3.math.Quaternion)4 Filter (com.jme3.post.Filter)4 AudioNode (com.jme3.audio.AudioNode)3 KeyTrigger (com.jme3.input.controls.KeyTrigger)3 ColorRGBA (com.jme3.math.ColorRGBA)3 FogFilter (com.jme3.post.filters.FogFilter)3 DirectionalLightShadowFilter (com.jme3.shadow.DirectionalLightShadowFilter)3 Texture (com.jme3.texture.Texture)3 TextureKey (com.jme3.asset.TextureKey)2 LowPassFilter (com.jme3.audio.LowPassFilter)2