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);
}
}
}
}
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);
}
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();
}
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;
}
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();
}
}
Aggregations