本文整理汇总了Java中com.jme3.material.RenderState.FaceCullMode类的典型用法代码示例。如果您正苦于以下问题:Java FaceCullMode类的具体用法?Java FaceCullMode怎么用?Java FaceCullMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FaceCullMode类属于com.jme3.material.RenderState包,在下文中一共展示了FaceCullMode类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Sprite
import com.jme3.material.RenderState.FaceCullMode; //导入依赖的package包/类
public Sprite(final String name, final Texture texture, Vector2f size, final boolean transparent, final Vector3f rotation,
final Vector3f translation, final AssetManager assetManager) {
super(name, new Quad(size.getX(), size.getY()));
final Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
setMaterial(material);
if (texture != null) {
setTexture(texture);
}
material.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
material.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);
if (transparent) {
setQueueBucket(Bucket.Transparent);
} else {
setQueueBucket(Bucket.Opaque);
}
if (rotation != null) {
rotate(rotation.getX() * FastMath.DEG_TO_RAD, rotation.getY() * FastMath.DEG_TO_RAD, rotation.getZ()
* FastMath.DEG_TO_RAD);
}
if (translation != null) {
setLocalTranslation(translation);
}
}
示例2: convertToGrassMat
import com.jme3.material.RenderState.FaceCullMode; //导入依赖的package包/类
private Material convertToGrassMat(Material originMat) {
Material grassMat = new Material(getAssetManager(), "LuoYingSys/Assets/MatDefs/Grass/Grass.j3md");
grassMat.setName("Grass Material");
transferMatParam(originMat, grassMat, "AlphaDiscardThreshold", VarType.Float);
transferMatParam(originMat, grassMat, "UseMaterialColors", VarType.Boolean);
transferMatParam(originMat, grassMat, "UseVertexColor", VarType.Boolean);
transferMatParam(originMat, grassMat, "Ambient", VarType.Vector4);
transferMatParam(originMat, grassMat, "Diffuse", VarType.Vector4);
transferMatParam(originMat, grassMat, "Specular", VarType.Vector4);
transferMatParam(originMat, grassMat, "Shininess", VarType.Float);
transferMatParam(originMat, grassMat, "DiffuseMap", VarType.Texture2D);
transferMatParam(originMat, grassMat, "NormalMap", VarType.Texture2D);
transferMatParam(originMat, grassMat, "SpecularMap", VarType.Texture2D);
grassMat.setTransparent(true);
grassMat.getAdditionalRenderState().setDepthWrite(true);
grassMat.getAdditionalRenderState().setDepthTest(true);
grassMat.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);
grassMat.setBoolean("Swaying", true);
grassMat.setVector3("SwayData", new Vector3f(1.5f, 0, 1));
grassMat.setVector2("Wind", new Vector2f(1f, 1f));
return grassMat;
}
示例3: write
import com.jme3.material.RenderState.FaceCullMode; //导入依赖的package包/类
@Override
public void write(JmeExporter e) throws IOException {
super.write(e);
OutputCapsule oc = e.getCapsule(this);
oc.write(fps, "fps", DEFAULT_FPS);
oc.write(featuresToLoad, "features-to-load", FeaturesToLoad.ALL);
oc.write(loadUnlinkedAssets, "load-unlinked-assets", false);
oc.write(assetRootPath, "asset-root-path", null);
oc.write(fixUpAxis, "fix-up-axis", true);
oc.write(generatedTexturePPU, "generated-texture-ppu", 128);
oc.write(usedWorld, "used-world", null);
oc.write(defaultMaterial, "default-material", null);
oc.write(faceCullMode, "face-cull-mode", FaceCullMode.Off);
oc.write(layersToLoad, "layers-to-load", -1);
oc.write(mipmapGenerationMethod, "mipmap-generation-method", MipmapGenerationMethod.GENERATE_WHEN_NEEDED);
}
示例4: read
import com.jme3.material.RenderState.FaceCullMode; //导入依赖的package包/类
@Override
public void read(JmeImporter e) throws IOException {
super.read(e);
InputCapsule ic = e.getCapsule(this);
fps = ic.readInt("fps", DEFAULT_FPS);
featuresToLoad = ic.readInt("features-to-load", FeaturesToLoad.ALL);
loadUnlinkedAssets = ic.readBoolean("load-unlinked-assets", false);
assetRootPath = ic.readString("asset-root-path", null);
fixUpAxis = ic.readBoolean("fix-up-axis", true);
generatedTexturePPU = ic.readInt("generated-texture-ppu", 128);
usedWorld = ic.readString("used-world", null);
defaultMaterial = (Material) ic.readSavable("default-material", null);
faceCullMode = ic.readEnum("face-cull-mode", FaceCullMode.class, FaceCullMode.Off);
layersToLoad = ic.readInt("layers-to=load", -1);
mipmapGenerationMethod = ic.readEnum("mipmap-generation-method", MipmapGenerationMethod.class, MipmapGenerationMethod.GENERATE_WHEN_NEEDED);
}
示例5: makeMesh
import com.jme3.material.RenderState.FaceCullMode; //导入依赖的package包/类
@Override
protected void makeMesh(AssetManager assetManager){
geometry = assetManager.loadModel(meshfile);
geometry.setLocalScale(scale);
geometry.getLocalRotation().multLocal(new Quaternion().fromAngleNormalAxis(angle, Vector3f.UNIT_Y));
deleteSpecialNodes();
((Node)geometry).depthFirstTraversal(new SceneGraphVisitor() {
@Override
public void visit(Spatial spatial) {
if(spatial instanceof LightNode)
spatial.getParent().detachChild(spatial);
if(!cull && spatial instanceof Geometry){
((Geometry)spatial).getMaterial().getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);
}
}
});
}
示例6: makeMesh
import com.jme3.material.RenderState.FaceCullMode; //导入依赖的package包/类
@Override
protected void makeMesh(AssetManager assetManager) {
Spatial meshNode = assetManager.loadModel("sniper/sniper.mesh.xml");
meshNode.setLocalScale(2.3f);
((Geometry) ((Node) meshNode).getChild("Material #148")).getMaterial().getAdditionalRenderState().setFaceCullMode(FaceCullMode.Front);
((Geometry) ((Node) meshNode).getChild("Material #147")).getMaterial().getAdditionalRenderState().setFaceCullMode(FaceCullMode.Front);
geometry = new Node();
((Node) geometry).attachChild(meshNode);
meshNode.setLocalTranslation(0, -4.0f, 0);
this.control = ((Node) geometry).getChild("sniper-ogremesh").getControl(AnimControl.class);
control.addListener(this);
channel = control.createChannel();
channel.setAnim("walk");
channel.setLoopMode(LoopMode.Loop);
channel.setSpeed(1.4f);
}
示例7: PreDepthProcessor
import com.jme3.material.RenderState.FaceCullMode; //导入依赖的package包/类
public PreDepthProcessor(AssetManager assetManager){
this.assetManager = assetManager;
preDepth = new Material(assetManager, "Common/MatDefs/Shadow/PreShadow.j3md");
preDepth.getAdditionalRenderState().setPolyOffset(0, 0);
preDepth.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Back);
forcedRS = new RenderState();
forcedRS.setDepthTest(true);
forcedRS.setDepthWrite(false);
}
示例8: readRenderStateStatement
import com.jme3.material.RenderState.FaceCullMode; //导入依赖的package包/类
private void readRenderStateStatement() throws IOException{
String word = scan.next();
if (word.equals("Wireframe")){
renderState.setWireframe(parseBoolean(scan.next()));
}else if (word.equals("FaceCull")){
renderState.setFaceCullMode(FaceCullMode.valueOf(scan.next()));
}else if (word.equals("DepthWrite")){
renderState.setDepthWrite(parseBoolean(scan.next()));
}else if (word.equals("DepthTest")){
renderState.setDepthTest(parseBoolean(scan.next()));
}else if (word.equals("Blend")){
renderState.setBlendMode(BlendMode.valueOf(scan.next()));
}else if (word.equals("AlphaTestFalloff")){
renderState.setAlphaTest(true);
renderState.setAlphaFallOff(scan.nextFloat());
}else if (word.equals("PolyOffset")){
float factor = scan.nextFloat();
float units = scan.nextFloat();
renderState.setPolyOffset(factor, units);
}else if (word.equals("ColorWrite")){
renderState.setColorWrite(parseBoolean(scan.next()));
}else if (word.equals("PointSprite")){
renderState.setPointSprite(parseBoolean(scan.next()));
}else{
throwIfNequal(null, word);
}
}
示例9: initializeGeometry
import com.jme3.material.RenderState.FaceCullMode; //导入依赖的package包/类
@Override
public void initializeGeometry(AssetManager assetManager)
{
this.instance = this;
videoImage = new Image(TEXTURE_FORMAT, WIDTH, HEIGHT, null);
videoTexture = new Texture2D(videoImage);
quad = new CenteredQuad(vidWidth, vidHeight);
quadGeometry = new Geometry("quad_geom", quad);
mat = new Material(MultiplicityClient.assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
mat.setTexture("ColorMap", videoTexture);
mat.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Front);
quadGeometry.setMaterial(mat);
Node transformNode = new Node();
transformNode.attachChild(quadGeometry);
transformNode.rotate(0f, 0f, FastMath.DEG_TO_RAD * 180f);
transformNode.rotate(0f, FastMath.DEG_TO_RAD * 180f, 0f);
this.setVisible(false);
ItemMap.register(quadGeometry, this);
log.fine("Attaching image quad geometry!");
attachChild(transformNode);
hasStarted = true;
}
示例10: readRenderStateStatement
import com.jme3.material.RenderState.FaceCullMode; //导入依赖的package包/类
private void readRenderStateStatement(String statement) throws IOException{
String[] split = statement.split(whitespacePattern);
if (split[0].equals("Wireframe")){
renderState.setWireframe(parseBoolean(split[1]));
}else if (split[0].equals("FaceCull")){
renderState.setFaceCullMode(FaceCullMode.valueOf(split[1]));
}else if (split[0].equals("DepthWrite")){
renderState.setDepthWrite(parseBoolean(split[1]));
}else if (split[0].equals("DepthTest")){
renderState.setDepthTest(parseBoolean(split[1]));
}else if (split[0].equals("Blend")){
renderState.setBlendMode(BlendMode.valueOf(split[1]));
}else if (split[0].equals("AlphaTestFalloff")){
renderState.setAlphaTest(true);
renderState.setAlphaFallOff(Float.parseFloat(split[1]));
}else if (split[0].equals("PolyOffset")){
float factor = Float.parseFloat(split[1]);
float units = Float.parseFloat(split[2]);
renderState.setPolyOffset(factor, units);
}else if (split[0].equals("ColorWrite")){
renderState.setColorWrite(parseBoolean(split[1]));
}else if (split[0].equals("PointSprite")){
renderState.setPointSprite(parseBoolean(split[1]));
}else{
throwIfNequal(null, split[0]);
}
}
示例11: createAxisMarker
import com.jme3.material.RenderState.FaceCullMode; //导入依赖的package包/类
/**
* Create the axis marker that is selectable
*/
protected Node createAxisMarker() {
float size = 2;
float arrowSize = size;
float planeSize = size * 0.7f;
Quaternion YAW090 = new Quaternion().fromAngleAxis(-FastMath.PI / 2, new Vector3f(0, 1, 0));
Quaternion PITCH090 = new Quaternion().fromAngleAxis(FastMath.PI / 2, new Vector3f(1, 0, 0));
redMat = new Material(manager, "Common/MatDefs/Misc/Unshaded.j3md");
redMat.getAdditionalRenderState().setWireframe(true);
redMat.setColor("Color", ColorRGBA.Red);
//redMat.getAdditionalRenderState().setDepthTest(false);
greenMat = new Material(manager, "Common/MatDefs/Misc/Unshaded.j3md");
greenMat.getAdditionalRenderState().setWireframe(true);
greenMat.setColor("Color", ColorRGBA.Green);
//greenMat.getAdditionalRenderState().setDepthTest(false);
blueMat = new Material(manager, "Common/MatDefs/Misc/Unshaded.j3md");
blueMat.getAdditionalRenderState().setWireframe(true);
blueMat.setColor("Color", ColorRGBA.Blue);
//blueMat.getAdditionalRenderState().setDepthTest(false);
yellowMat = new Material(manager, "Common/MatDefs/Misc/Unshaded.j3md");
yellowMat.getAdditionalRenderState().setWireframe(false);
yellowMat.setColor("Color", new ColorRGBA(1f, 1f, 0f, 0.25f));
yellowMat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
yellowMat.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);
//yellowMat.getAdditionalRenderState().setDepthTest(false);
cyanMat = new Material(manager, "Common/MatDefs/Misc/Unshaded.j3md");
cyanMat.getAdditionalRenderState().setWireframe(false);
cyanMat.setColor("Color", new ColorRGBA(0f, 1f, 1f, 0.25f));
cyanMat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
cyanMat.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);
//cyanMat.getAdditionalRenderState().setDepthTest(false);
magentaMat = new Material(manager, "Common/MatDefs/Misc/Unshaded.j3md");
magentaMat.getAdditionalRenderState().setWireframe(false);
magentaMat.setColor("Color", new ColorRGBA(1f, 0f, 1f, 0.25f));
magentaMat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
magentaMat.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);
//magentaMat.getAdditionalRenderState().setDepthTest(false);
orangeMat = new Material(manager, "Common/MatDefs/Misc/Unshaded.j3md");
orangeMat.getAdditionalRenderState().setWireframe(false);
orangeMat.setColor("Color", new ColorRGBA(251f / 255f, 130f / 255f, 0f, 0.4f));
orangeMat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
orangeMat.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);
Node axis = new Node();
// create arrows
Geometry arrowX = new Geometry("arrowX", new Arrow(new Vector3f(arrowSize, 0, 0)));
Geometry arrowY = new Geometry("arrowY", new Arrow(new Vector3f(0, arrowSize, 0)));
Geometry arrowZ = new Geometry("arrowZ", new Arrow(new Vector3f(0, 0, arrowSize)));
axis.attachChild(arrowX);
axis.attachChild(arrowY);
axis.attachChild(arrowZ);
// create planes
quadXY = new Geometry("quadXY", new Quad(planeSize, planeSize));
quadXZ = new Geometry("quadXZ", new Quad(planeSize, planeSize));
quadXZ.setLocalRotation(PITCH090);
quadYZ = new Geometry("quadYZ", new Quad(planeSize, planeSize));
quadYZ.setLocalRotation(YAW090);
// axis.attachChild(quadXY);
// axis.attachChild(quadXZ);
// axis.attachChild(quadYZ);
axis.setModelBound(new BoundingBox());
return axis;
}
示例12: setFaceCullMode
import com.jme3.material.RenderState.FaceCullMode; //导入依赖的package包/类
/**
* This method sets the face cull mode.
* @param faceCullMode
* the face cull mode
*/
public void setFaceCullMode(FaceCullMode faceCullMode) {
this.faceCullMode = faceCullMode;
}
示例13: getFaceCullMode
import com.jme3.material.RenderState.FaceCullMode; //导入依赖的package包/类
/**
* This method returns the face cull mode.
* @return the face cull mode
*/
public FaceCullMode getFaceCullMode() {
return faceCullMode;
}