本文整理汇总了Java中com.jme3.shadow.EdgeFilteringMode类的典型用法代码示例。如果您正苦于以下问题:Java EdgeFilteringMode类的具体用法?Java EdgeFilteringMode怎么用?Java EdgeFilteringMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EdgeFilteringMode类属于com.jme3.shadow包,在下文中一共展示了EdgeFilteringMode类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createScene
import com.jme3.shadow.EdgeFilteringMode; //导入依赖的package包/类
@Override
@NotNull
protected SceneNode createScene() {
final EditableLightingStateShadowFilter shadowFilter = new EditableLightingStateShadowFilter();
shadowFilter.setRenderBackFacesShadows(true);
shadowFilter.setEdgesThickness(7);
shadowFilter.setEdgeFilteringMode(EdgeFilteringMode.PCF8);
final SceneNode sceneNode = super.createScene();
sceneNode.addFilter(new EditableFXAAFilter());
sceneNode.addFilter(shadowFilter);
sceneNode.setShadowMode(RenderQueue.ShadowMode.CastAndReceive);
final EditableLightingSceneAppState lightingState = new EditableLightingSceneAppState();
lightingState.setTimeOfDay(0.947F);
final EditableSkySceneAppState skyState = new EditableSkySceneAppState();
skyState.setFlatShaded(false);
skyState.init(lightingState.getLightDirRef(), EDITOR.getAssetManager());
sceneNode.addAppState(lightingState);
sceneNode.addAppState(skyState);
return sceneNode;
}
示例2: setCastShadow
import com.jme3.shadow.EdgeFilteringMode; //导入依赖的package包/类
public void setCastShadow(boolean castShadow) {
boolean changed = this.castShadow != castShadow;
this.castShadow = castShadow;
if (castShadow && changed) {
if (shadowRenderer == null) {
shadowRenderer = new SpotLightShadowRenderer(manager, 512);
shadowRenderer.setShadowZExtend(0.5f);
shadowRenderer.setLight(spotLight);
shadowRenderer.setEdgeFilteringMode(EdgeFilteringMode.PCFPOISSON);
}
}
if (changed) {
ShadowEvent se = new ShadowEvent(this);
GlobalObjects.getInstance().postEvent(se);
}
}
示例3: getEditableProperties
import com.jme3.shadow.EdgeFilteringMode; //导入依赖的package包/类
@Override
public @NotNull List<EditableProperty<?, ?>> getEditableProperties() {
final List<EditableProperty<?, ?>> result = new ArrayList<>();
result.add(new SimpleProperty<>(ENUM, "Edge filtering mode", this,
makeGetter(this, EdgeFilteringMode.class, "getEdgeFilteringMode"),
makeSetter(this, EdgeFilteringMode.class, "setEdgeFilteringMode")));
result.add(new SimpleProperty<>(ENUM, "Shadow compare mode", this,
makeGetter(this, CompareMode.class, "getShadowCompareMode"),
makeSetter(this, CompareMode.class, "setShadowCompareMode")));
result.add(new SimpleProperty<>(FLOAT, "Shadow z extend", this,
makeGetter(this, float.class, "getShadowZExtend"),
makeSetter(this, float.class, "setShadowZExtend")));
result.add(new SimpleProperty<>(FLOAT, "Shadow z fade length", this,
makeGetter(this, float.class, "getShadowZFadeLength"),
makeSetter(this, float.class, "setShadowZFadeLength")));
result.add(new SimpleProperty<>(FLOAT, "Lambda", this,
makeGetter(this, float.class, "getLambda"),
makeSetter(this, float.class, "setLambda")));
result.add(new SimpleProperty<>(FLOAT, "Shadow intensity", 0.1F, 0F, 1F, this,
makeGetter(this, float.class, "getShadowIntensity"),
makeSetter(this, float.class, "setShadowIntensity")));
result.add(new SimpleProperty<>(INTEGER, "Edges thickness", 1F, 1, 10, this,
makeGetter(this, int.class, "getEdgesThickness"),
makeSetter(this, int.class, "setEdgesThickness")));
result.add(new SimpleProperty<>(BOOLEAN, "Back faces shadows", this,
makeGetter(this, Boolean.class, "isRenderBackFacesShadows"),
makeSetter(this, Boolean.class, "setRenderBackFacesShadows")));
result.add(new SimpleProperty<>(BOOLEAN, "Stabilization", this,
makeGetter(this, boolean.class, "isEnabledStabilization"),
makeSetter(this, boolean.class, "setEnabledStabilization")));
return result;
}
示例4: getEditableProperties
import com.jme3.shadow.EdgeFilteringMode; //导入依赖的package包/类
@Override
public @NotNull List<EditableProperty<?, ?>> getEditableProperties() {
final List<EditableProperty<?, ?>> result = new ArrayList<>(8);
result.add(new SimpleProperty<>(ENUM, "Edge filtering mode", this,
makeGetter(this, EdgeFilteringMode.class, "getEdgeFilteringMode"),
makeSetter(this, EdgeFilteringMode.class, "setEdgeFilteringMode")));
result.add(new SimpleProperty<>(ENUM, "Shadow compare mode", this,
makeGetter(this, CompareMode.class, "getShadowCompareMode"),
makeSetter(this, CompareMode.class, "setShadowCompareMode")));
result.add(new SimpleProperty<>(FLOAT, "Shadow z extend", this,
makeGetter(this, float.class, "getShadowZExtend"),
makeSetter(this, float.class, "setShadowZExtend")));
result.add(new SimpleProperty<>(FLOAT, "Shadow z fade length", this,
makeGetter(this, float.class, "getShadowZFadeLength"),
makeSetter(this, float.class, "setShadowZFadeLength")));
result.add(new SimpleProperty<>(FLOAT, "Shadow intensity", 0.1F, 0F, 1F, this,
makeGetter(this, float.class, "getShadowIntensity"),
makeSetter(this, float.class, "setShadowIntensity")));
result.add(new SimpleProperty<>(INTEGER, "Edges thickness", 1F, 1, 10, this,
makeGetter(this, int.class, "getEdgesThickness"),
makeSetter(this, int.class, "setEdgesThickness")));
result.add(new SimpleProperty<>(BOOLEAN, "Back faces shadows", this,
makeGetter(this, Boolean.class, "isRenderBackFacesShadows"),
makeSetter(this, Boolean.class, "setRenderBackFacesShadows")));
return result;
}
示例5: afterPropertiesSet
import com.jme3.shadow.EdgeFilteringMode; //导入依赖的package包/类
@Override
public void afterPropertiesSet() throws Exception {
directionalLight = new DirectionalLight();
directionalLight.setColor(ColorRGBA.White.mult(0.5f));
directionalLight.setDirection(new Vector3f(0.0f, -1.0f, 0.0f));
ambientLight = new AmbientLight();
ambientLight.setColor(ColorRGBA.White.mult(0.15f));
lights = new LinkedList<>();
lights.add(directionalLight);
lights.add(ambientLight);
final int SHADOWMAP_SIZE = 4096;
DirectionalLightShadowRenderer dlsr = new DirectionalLightShadowRenderer(assetManager, SHADOWMAP_SIZE, 4);
dlsr.setLight(directionalLight);
dlsr.setShadowIntensity(0.3f);
dlsr.setRenderBackFacesShadows(Boolean.TRUE);
dlsr.setShadowCompareMode(CompareMode.Hardware);
dlsr.setEdgeFilteringMode(EdgeFilteringMode.PCF8);
camera.addEffect(dlsr);
float initialWaterHeight = 1500f; // choose a value for your scene
/*water = new WaterFilter(rootNode, directionalLight.getDirection());
water.setWaterHeight(initialWaterHeight);
camera.addNearEffect(water);*/
/*DirectionalLightShadowFilter dlsf = new DirectionalLightShadowFilter(assetManager, SHADOWMAP_SIZE, 3);
dlsf.setLight(directionalLight);
dlsf.setEnabled(true);
camera.addNearEffect(dlsf);*/
}
示例6: simpleInitApp
import com.jme3.shadow.EdgeFilteringMode; //导入依赖的package包/类
@Override
public void simpleInitApp() {
Init.initialize(this);
this.flyCam.setMoveSpeed(20);
inputManager.addMapping("do", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
inputManager.addListener(actionListener, "do");
Entity sky = Loader.load("envSky");
rootNode.attachChild(sky.getSpatial());
DirectionalLight dl = new DirectionalLight();
dl.setDirection(new Vector3f(-1, -1, -1));
this.rootNode.addLight(dl);
FilterPostProcessor processor = new FilterPostProcessor(this.assetManager);
this.viewPort.addProcessor(processor);
DirectionalLightShadowFilter filter = new DirectionalLightShadowFilter(assetManager, 1024, 1);
filter.setLambda(0.55f);
filter.setShadowIntensity(0.75f);
filter.setShadowCompareMode(CompareMode.Hardware);
filter.setEdgeFilteringMode(EdgeFilteringMode.PCF4);
filter.setLight(dl);
processor.addFilter(filter);
Spatial terrain = this.assetManager.loadModel("Models/env/terrain/scene.j3o");
terrain.setShadowMode(RenderQueue.ShadowMode.Receive);
this.rootNode.attachChild(terrain);
Spatial tree = this.assetManager.loadModel("Models/trees/tree/tree978.j3o");
tree.setShadowMode(RenderQueue.ShadowMode.Cast);
this.rootNode.attachChild(tree);
}
示例7: setData
import com.jme3.shadow.EdgeFilteringMode; //导入依赖的package包/类
@Override
public void setData(EntityData data) {
super.setData(data);
shadowMapSize = data.getAsInteger("shadowMapSize", shadowMapSize);
shadowMaps = data.getAsInteger("shadowMaps", shadowMaps);
String tempEdgeFilteringMode = data.getAsString("edgeFilteringMode");
if (tempEdgeFilteringMode != null) {
for (EdgeFilteringMode efm : EdgeFilteringMode.values()) {
if (efm.name().equals(tempEdgeFilteringMode)) {
edgeFilteringMode = efm;
break;
}
}
}
edgesThickness = data.getAsInteger("edgesThickness", edgesThickness);
enabledStabilization = data.getAsBoolean("enabledStabilization", enabledStabilization);
lambda = data.getAsFloat("lambda", lambda);
renderBackFacesShadows = data.getAsBoolean("renderBackFacesShadows", renderBackFacesShadows);
String tempShadowCompareMode = data.getAsString("shadowCompareMode");
if (tempShadowCompareMode != null) {
for (CompareMode cm : CompareMode.values()) {
if (cm.name().equals(tempShadowCompareMode)) {
shadowCompareMode = cm;
break;
}
}
}
shadowIntensity = data.getAsFloat("shadowIntensity", shadowIntensity);
shadowZExtend = data.getAsFloat("shadowZExtend", shadowZExtend);
shadowZFadeLength = data.getAsFloat("shadowZFadeLength", shadowZFadeLength);
}
示例8: setupLights
import com.jme3.shadow.EdgeFilteringMode; //导入依赖的package包/类
public void setupLights() {
AmbientLight al = new AmbientLight();
al.setColor(new ColorRGBA(0.1f, 0.1f, 0.1f, 1));
rootNode.addLight(al);
SpotLight sl = new SpotLight();
sl.setColor(ColorRGBA.White.mult(1.0f));
sl.setPosition(new Vector3f(1.2074411f, 10.6868908f, 4.1489987f));
sl.setDirection(sl.getPosition().mult(-1));
sl.setSpotOuterAngle(0.1f);
sl.setSpotInnerAngle(0.004f);
rootNode.addLight(sl);
//pointlight to fake indirect light coming from the ground
PointLight pl = new PointLight();
pl.setColor(ColorRGBA.White.mult(1.5f));
pl.setPosition(new Vector3f(0, 0, 1));
pl.setRadius(2);
rootNode.addLight(pl);
SpotLightShadowRenderer shadows = new SpotLightShadowRenderer(assetManager, 1024);
shadows.setLight(sl);
shadows.setShadowIntensity(0.3f);
shadows.setEdgeFilteringMode(EdgeFilteringMode.PCF8);
viewPort.addProcessor(shadows);
FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
SSAOFilter filter = new SSAOFilter(0.10997847f,0.440001f,0.39999998f,-0.008000026f);;
fpp.addFilter(filter);
fpp.addFilter(new FXAAFilter());
fpp.addFilter(new FXAAFilter());
viewPort.addProcessor(fpp);
}
示例9: setupLights
import com.jme3.shadow.EdgeFilteringMode; //导入依赖的package包/类
public void setupLights() {
AmbientLight al = new AmbientLight();
al.setColor(new ColorRGBA(0.1f, 0.1f, 0.1f, 1));
rootNode.addLight(al);
SpotLight sl = new SpotLight();
sl.setColor(ColorRGBA.White.mult(1.0f));
sl.setPosition(new Vector3f(1.2074411f, 10.6868908f, 4.1489987f));
sl.setDirection(sl.getPosition().mult(-1));
sl.setSpotOuterAngle(0.1f);
sl.setSpotInnerAngle(0.004f);
rootNode.addLight(sl);
//pointlight to fake indirect light coming from the ground
PointLight pl = new PointLight();
pl.setColor(ColorRGBA.White.mult(1.5f));
pl.setPosition(new Vector3f(0, 0, 1));
pl.setRadius(2);
rootNode.addLight(pl);
SpotLightShadowRenderer shadows = new SpotLightShadowRenderer(assetManager, 1024);
shadows.setLight(sl);
shadows.setShadowIntensity(0.3f);
shadows.setEdgeFilteringMode(EdgeFilteringMode.PCF8);
viewPort.addProcessor(shadows);
FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
SSAOFilter filter = new SSAOFilter(0.10997847f,0.440001f,0.39999998f,-0.008000026f);;
fpp.addFilter(filter);
fpp.addFilter(new FXAAFilter());
fpp.addFilter(new FXAAFilter());
viewPort.addProcessor(fpp);
}
示例10: setEdgeFilteringMode
import com.jme3.shadow.EdgeFilteringMode; //导入依赖的package包/类
/**
* Sets the filtering mode for shadow edges. See {@link EdgeFilteringMode} for more info.
*
* @param filterMode the desired filter mode (not null)
*/
final public void setEdgeFilteringMode(EdgeFilteringMode filterMode) {
if (filterMode == null) {
throw new NullPointerException();
}
this.edgeFilteringMode = filterMode;
if (shadowCompareMode == CompareMode.Hardware) {
if (filterMode == EdgeFilteringMode.Bilinear || filterMode == EdgeFilteringMode.PCFPOISSON) {
if (directionalShadowLights > 0) {
directionalShadowTextures.setMagFilter(Texture.MagFilter.Bilinear);
directionalShadowTextures.setMinFilter(Texture.MinFilter.BilinearNoMipMaps);
}
if (pointShadowLights > 0) {
pointShadowTextures.setMagFilter(Texture.MagFilter.Bilinear);
pointShadowTextures.setMinFilter(Texture.MinFilter.BilinearNoMipMaps);
}
if (spotShadowLights > 0) {
spotShadowTextures.setMagFilter(Texture.MagFilter.Bilinear);
spotShadowTextures.setMinFilter(Texture.MinFilter.BilinearNoMipMaps);
}
} else {
if (directionalShadowLights > 0) {
directionalShadowTextures.setMagFilter(Texture.MagFilter.Nearest);
directionalShadowTextures.setMinFilter(Texture.MinFilter.NearestNoMipMaps);
}
if (pointShadowLights > 0) {
pointShadowTextures.setMagFilter(Texture.MagFilter.Nearest);
pointShadowTextures.setMinFilter(Texture.MinFilter.NearestNoMipMaps);
}
if (spotShadowLights > 0) {
spotShadowTextures.setMagFilter(Texture.MagFilter.Nearest);
spotShadowTextures.setMinFilter(Texture.MinFilter.NearestNoMipMaps);
}
}
}
}
示例11: LightDrawer
import com.jme3.shadow.EdgeFilteringMode; //导入依赖的package包/类
public LightDrawer(MapView view, AssetManager am, Node rootNode, ViewPort vp) {
this.view = view;
this.rootNode = rootNode;
FilterPostProcessor fpp = new FilterPostProcessor(am);
int SHADOWMAP_SIZE = 4096;
// sr = new DirectionalLightShadowRenderer(am, SHADOWMAP_SIZE, 1);
// sr.setEdgeFilteringMode(EdgeFilteringMode.PCF4);
// sr.setShadowIntensity((float) ModelManager.getBattlefield().getSunLight().shadowCaster.intensity);
// vp.addProcessor(sr);
sf = new DirectionalLightShadowFilter(am, SHADOWMAP_SIZE, 1);
sf.setEnabled(true);
sf.setEdgeFilteringMode(EdgeFilteringMode.PCF4);
sf.setShadowZExtend(SHADOWMAP_SIZE);
fpp.addFilter(sf);
// Ambiant occlusion filter
SSAOFilter ssaoFilter = new SSAOFilter(0.5f, 4f, 0.2f, 0.3f);
// fpp.addFilter(ssaoFilter);
// Glow filter
BloomFilter bloom = new BloomFilter(BloomFilter.GlowMode.Objects);
fpp.addFilter(bloom);
vp.addProcessor(fpp);
}
示例12: setShadowCompareMode
import com.jme3.shadow.EdgeFilteringMode; //导入依赖的package包/类
/**
* Sets the shadow compare mode. See {@link CompareMode} for more info.
*
* @param compareMode the desired compare mode (not null)
*/
final public void setShadowCompareMode(CompareMode compareMode) {
if (compareMode == null) {
throw new IllegalArgumentException("Shadow compare mode cannot be null");
}
this.shadowCompareMode = compareMode;
if (compareMode == CompareMode.Hardware) {
if (directionalShadowLights > 0) {
directionalShadowTextures.setShadowCompareMode(Texture.ShadowCompareMode.LessOrEqual);
}
if (pointShadowLights > 0) {
pointShadowTextures.setShadowCompareMode(Texture.ShadowCompareMode.LessOrEqual);
}
if (spotShadowLights > 0) {
spotShadowTextures.setShadowCompareMode(Texture.ShadowCompareMode.LessOrEqual);
}
if (edgeFilteringMode == EdgeFilteringMode.Bilinear) {
if (directionalShadowLights > 0) {
directionalShadowTextures.setMagFilter(Texture.MagFilter.Bilinear);
directionalShadowTextures.setMinFilter(Texture.MinFilter.BilinearNoMipMaps);
}
if (pointShadowLights > 0) {
pointShadowTextures.setMagFilter(Texture.MagFilter.Bilinear);
pointShadowTextures.setMinFilter(Texture.MinFilter.BilinearNoMipMaps);
}
if (spotShadowLights > 0) {
spotShadowTextures.setMagFilter(Texture.MagFilter.Bilinear);
spotShadowTextures.setMinFilter(Texture.MinFilter.BilinearNoMipMaps);
}
} else {
if (directionalShadowLights > 0) {
directionalShadowTextures.setMagFilter(Texture.MagFilter.Nearest);
directionalShadowTextures.setMinFilter(Texture.MinFilter.NearestNoMipMaps);
}
if (pointShadowLights > 0) {
pointShadowTextures.setMagFilter(Texture.MagFilter.Nearest);
pointShadowTextures.setMinFilter(Texture.MinFilter.NearestNoMipMaps);
}
if (spotShadowLights > 0) {
spotShadowTextures.setMagFilter(Texture.MagFilter.Nearest);
spotShadowTextures.setMinFilter(Texture.MinFilter.NearestNoMipMaps);
}
}
} else {
if (directionalShadowLights > 0) {
directionalShadowTextures.setShadowCompareMode(Texture.ShadowCompareMode.Off);
directionalShadowTextures.setMagFilter(Texture.MagFilter.Nearest);
directionalShadowTextures.setMinFilter(Texture.MinFilter.NearestNoMipMaps);
}
if (pointShadowLights > 0) {
pointShadowTextures.setShadowCompareMode(Texture.ShadowCompareMode.Off);
pointShadowTextures.setMagFilter(Texture.MagFilter.Nearest);
pointShadowTextures.setMinFilter(Texture.MinFilter.NearestNoMipMaps);
}
if (spotShadowLights > 0) {
spotShadowTextures.setShadowCompareMode(Texture.ShadowCompareMode.Off);
spotShadowTextures.setMagFilter(Texture.MagFilter.Nearest);
spotShadowTextures.setMinFilter(Texture.MinFilter.NearestNoMipMaps);
}
}
}
示例13: getEdgeFilteringMode
import com.jme3.shadow.EdgeFilteringMode; //导入依赖的package包/类
/**
* returns the edge filtering mode
*
* @see EdgeFilteringMode
* @return
*/
public EdgeFilteringMode getEdgeFilteringMode() {
return edgeFilteringMode;
}