当前位置: 首页>>代码示例>>Java>>正文


Java RenderState类代码示例

本文整理汇总了Java中com.jme3.material.RenderState的典型用法代码示例。如果您正苦于以下问题:Java RenderState类的具体用法?Java RenderState怎么用?Java RenderState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RenderState类属于com.jme3.material包,在下文中一共展示了RenderState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createCollisionPlane

import com.jme3.material.RenderState; //导入依赖的package包/类
/**
 * Create collision plane.
 */
@FromAnyThread
private void createCollisionPlane() {

    final AssetManager assetManager = EDITOR.getAssetManager();

    final Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    final RenderState renderState = material.getAdditionalRenderState();
    renderState.setFaceCullMode(RenderState.FaceCullMode.Off);
    renderState.setWireframe(true);

    final float size = 20000;

    final Geometry geometry = new Geometry("plane", new Quad(size, size));
    geometry.setMaterial(material);
    geometry.setLocalTranslation(-size / 2, -size / 2, 0);

    collisionPlane = new Node();
    collisionPlane.attachChild(geometry);
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:23,代码来源:AbstractSceneEditor3DState.java

示例2: getDebugMaterial

import com.jme3.material.RenderState; //导入依赖的package包/类
protected static Material getDebugMaterial(Geometry geometry, boolean colors, boolean wire, boolean normals, boolean faceCullOff) {
//        RenderState renderState = geometry.getMaterial().getAdditionalRenderState();

        Material debugMaterial;
        Material originalMaterial = geometry.getMaterial();
        if(normals) {
            debugMaterial = DebugUtil.createNormalMaterial(geometry);
        }  else if(colors || !wire || originalMaterial == null) {
            debugMaterial = DebugUtil.createDebugMaterial(geometry, colors);
        } else {
            debugMaterial = geometry.getMaterial().clone();
            wire = true;
        }

        RenderState debugRenderState = debugMaterial.getAdditionalRenderState();

        if(wire) {
            debugRenderState.setWireframe(originalMaterial == null || !originalMaterial.getAdditionalRenderState().isWireframe());
        }

        if(faceCullOff) {
            debugRenderState.setFaceCullMode(RenderState.FaceCullMode.Off);
        }

        return debugMaterial;
    }
 
开发者ID:NemesisMate,项目名称:UtilJME3-Debug,代码行数:27,代码来源:DebugMeshState.java

示例3: AbstractMeshElement

import com.jme3.material.RenderState; //导入依赖的package包/类
public AbstractMeshElement(BaseScreen screen, Vector2f position, Size dimension) {
	super(screen, null, position, dimension, Vector4f.ZERO, null);
	setIgnoreMouse(true);

	meshMaterial = new Material(screen.getApplication().getAssetManager(), "icetone/shaders/Unshaded.j3md");
	meshMaterial.setVector2("OffsetAlphaTexCoord", new Vector2f(0, 0));
	meshMaterial.setFloat("GlobalAlpha", screen.getGlobalAlpha());
	meshMaterial.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);
	meshMaterial.getAdditionalRenderState().setFaceCullMode(RenderState.FaceCullMode.Back);

	setLayoutManager(new DefaultLayout() {

		@Override
		protected void onCalcClip(ElementContainer<?,?> container) {
			super.onCalcClip(container);
			if (!clippingLayers.isEmpty()) {
				meshMaterial.setVector4("Clipping", getClippingBounds());
				meshMaterial.setBoolean("UseClipping", true);
			} else {
				meshMaterial.setBoolean("UseClipping", false);
			}
		}

	});
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:26,代码来源:AbstractMeshElement.java

示例4: checkMaterial

import com.jme3.material.RenderState; //导入依赖的package包/类
protected void checkMaterial(BaseScreen screen) {
	if (mat == null) {
		mat = new Material(ToolKit.get().getApplication().getAssetManager(), "icetone/shaders/Unshaded.j3md");
		mat.setVector2("OffsetAlphaTexCoord", new Vector2f(0, 0));
		mat.setFloat("GlobalAlpha", getAlphaValue());
		mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
		mat.getAdditionalRenderState().setFaceCullMode(RenderState.FaceCullMode.Back);
		if (isAtlasTextureInUse()) {
			mat.setBoolean("UseEffectTexCoords", true);
		} else {
			mat.setBoolean("UseEffectTexCoords", false);
		}
		mat.setColor("Color", defaultColor);
		mat.setTexture("ColorMap", null);
	}
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:17,代码来源:BaseElement.java

示例5: createShape

import com.jme3.material.RenderState; //导入依赖的package包/类
/**
 * Convenience factory method that creates a debuging bounding sphere geometry
 * @param assetManager the assetManager
 * @return the bounding sphere debug geometry.
 */
public static Geometry createShape(AssetManager assetManager) {
    ProbeRadiusShape b = new ProbeRadiusShape();
    Geometry geom = new Geometry("BoundingDebug", b);

    Material mat = new Material(assetManager, "com/jme3/gde/scenecomposer/gizmo/light/mat/dashed/dashed.j3md");        
    mat.getAdditionalRenderState().setWireframe(true);
    mat.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);
    mat.getAdditionalRenderState().setDepthWrite(false);
    mat.getAdditionalRenderState().setDepthTest(false);  
    mat.setFloat("DashSize", 0.5f);
    geom.setQueueBucket(RenderQueue.Bucket.Transparent);
    geom.addControl(new BillboardControl());
    
    
    geom.setMaterial(mat);
    return geom;

}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:24,代码来源:ProbeRadiusShape.java

示例6: createShape

import com.jme3.material.RenderState; //导入依赖的package包/类
public static Geometry createShape(AssetManager assetManager, String name, int radialSample) {
    RadiusShape b = new RadiusShape(radialSample);
    Geometry geom = new Geometry(name, b);

    Material mat = new Material(assetManager, "com/jme3/gde/scenecomposer/gizmo/mat/dashed/dashed.j3md");
    mat.getAdditionalRenderState().setWireframe(true);
    mat.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);
    mat.getAdditionalRenderState().setDepthWrite(false);
    mat.getAdditionalRenderState().setDepthTest(false);
    mat.getAdditionalRenderState().setLineWidth(2f);

    mat.setColor("Color", ColorRGBA.Orange);
    mat.setFloat("DashSize", 0.5f);
    geom.setQueueBucket(RenderQueue.Bucket.Transparent);

    geom.setMaterial(mat);
    return geom;

}
 
开发者ID:jMonkeyEngine,项目名称:sdk,代码行数:20,代码来源:RadiusShape.java

示例7: getNode

import com.jme3.material.RenderState; //导入依赖的package包/类
public Node getNode(AssetManager assetM, ColorRGBA color) {
    Node n = new Node();
    if (SHOW_HITBOX) {
        //geo.setCullHint(Spatial.CullHint.Always);
        //}else {
        Material mat = new Material(assetM, "Common/MatDefs/Misc/Unshaded.j3md");
        ColorRGBA col = color.clone();
        col.a = .5f;
        mat.setColor("Color", col);
        mat.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);
        Geometry geo = new Geometry(name, new Quad(w, h));
        geo.setMaterial(mat);
        geo.setLocalTranslation(-w / 2, -h / 2, 0);
        n.attachChild(geo);
    }
    return n;
}
 
开发者ID:Pesegato,项目名称:MonkeySheet,代码行数:18,代码来源:HBRect.java

示例8: MSMaterialControl

import com.jme3.material.RenderState; //导入依赖的package包/类
public MSMaterialControl(AssetManager assetManager, Geometry geo, MSContainer msCont, MSControl msc){
    material = new Material(assetManager, "MonkeySheet/MatDefs/Anim.j3md");
    Texture[] sheetsX=new Texture[msCont.sheets.length];
    for (int i = 0; i < msCont.sheets.length; i++) {
        sheetsX[i]=assetManager.loadTexture(msCont.sheets[i]);
    }
    material.setFloat("SizeX", msCont.numTiles);
    material.setFloat("SizeY", msCont.numTiles);
    material.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);
    for (MTween mt:MonkeySheetAppState.anis.values()){
        if (mt.msCont==msCont)
            mt.setTextures(sheetsX);
    }
    geo.setMaterial(material);
    geo.addControl(this);
    this.msc=msc;
        material.setFloat("Position", msc.anim.anim[msc.position].position);
        material.setTexture("ColorMap", msc.anim.anim[msc.position].sheetX);
        material.setFloat("FlipHorizontal", 0.0f);
        material.setFloat("AlphaValue", 1.0f);
        material.setColor("FogColor", fogColor);
        material.setFloat("FogIntensity", 0.0f);
}
 
开发者ID:Pesegato,项目名称:MonkeySheet,代码行数:24,代码来源:MSMaterialControl.java

示例9: resetMaterial

import com.jme3.material.RenderState; //导入依赖的package包/类
private static void resetMaterial(Geometry geo) {
        // 准许透明
        geo.getMaterial().getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);
        // 树叶不需要Cull
        geo.getMaterial().getAdditionalRenderState().setFaceCullMode(RenderState.FaceCullMode.Off);
        
        // 重要:让alpha透明图片不会盖住后面的图片(特别是在手机上)
        geo.getMaterial().getAdditionalRenderState().setDepthWrite(true);
        geo.getMaterial().getAdditionalRenderState().setDepthTest(true);
        geo.getMaterial().getAdditionalRenderState().setAlphaTest(true);
        geo.getMaterial().getAdditionalRenderState().setAlphaFallOff(alphaFallOff);
        geo.getMaterial().getAdditionalRenderState().setColorWrite(true);
        
//        geo.getMaterial().setBoolean("UseAlpha", true);
        geo.getMaterial().setBoolean("UseMaterialColors", true);
        geo.getMaterial().setFloat("AlphaDiscardThreshold", alphaFallOff);
        geo.getMaterial().setFloat("Shininess", 0.3f);
        geo.getMaterial().setColor("Ambient", new ColorRGBA(0.7f, 0.7f, 0.7f, 1f));
        geo.getMaterial().setColor("Diffuse", new ColorRGBA(0.7f, 0.7f, 0.7f, 1f));
        geo.getMaterial().setColor("Specular", new ColorRGBA(0, 0, 0, 1));
        
        // 设置Transparent,否则与背景的天空盒混合时会树叶的透明信息变成黑色。
        // 部分树形不能使用Translucent,只能用Transparent
        geo.setQueueBucket(Bucket.Transparent);
    }
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:26,代码来源:TreeFixUtils.java

示例10: convertToGrassMaterial

import com.jme3.material.RenderState; //导入依赖的package包/类
private Material convertToGrassMaterial(Material originMat
        , boolean swaying, float swayFrequency, float swayVariation, float swayDistance, Vector2f wind) {
    Material grassMat = new Material(LuoYing.getAssetManager(), AssetConstants.MATERIAL_GRASS);
    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(RenderState.FaceCullMode.Off);
    
    grassMat.setBoolean("Swaying", swaying);
    grassMat.setVector3("SwayData", new Vector3f(swayFrequency, swayVariation, swayDistance));
    grassMat.setVector2("Wind", wind);
    
    return grassMat;
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:27,代码来源:PlantEntity.java

示例11: ProjectProcessor

import com.jme3.material.RenderState; //导入依赖的package包/类
public ProjectProcessor(Node root, AssetManager assetManager) {
        castCam = new Camera((int)128, (int)128);
        castCam.setParallelProjection(true);
        castCam.setFrustum(-1, 1, -1, 1, 1, -1);
        
        //Textures\tex\magic\magic.jpg
        // Textures\tex\sky\default\east.jpg
        tex = assetManager.loadTexture("Textures/tex/magic/magic.jpg");
//        tex = assetManager.loadTexture("Textures/tex/sky/default/east.jpg");
//        tex = assetManager.loadTexture("Interface/item/face/female5.jpg");
        mat = new Material(assetManager, "MatDefs/Projection/Projection.j3md");
        
        QuadXYC quad = new QuadXYC(1,1);
        projGeo = new Geometry("ProjGeo", quad);
        projGeo.setLocalScale(width, height, 1);
        Material debugMat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        debugMat.getAdditionalRenderState().setFaceCullMode(RenderState.FaceCullMode.Off);
        projGeo.setMaterial(debugMat);
        projGeo.setCullHint(Spatial.CullHint.Always);
        root.attachChild(projGeo);
        
    }
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:23,代码来源:ProjectProcessor.java

示例12: createSunFlag

import com.jme3.material.RenderState; //导入依赖的package包/类
private Spatial createSunFlag(String icon) {
    Material mat = MaterialUtils.createUnshaded();
    mat.setTexture("ColorMap", Jfx.getJmeApp().getAssetManager().loadTexture(icon));
    mat.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);
    
    Geometry flagObj = new Geometry("DirectionalLightEntitySelectObj", new QuadXYC(1, 1));
    flagObj.setMaterial(mat);
    flagObj.setQueueBucket(RenderQueue.Bucket.Translucent);
    
    // 让flag始终朝向镜头
    BillboardControl bc = new BillboardControl();
    bc.setAlignment(BillboardControl.Alignment.Screen);
    flagObj.addControl(bc);
    
    return flagObj;
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:17,代码来源:PointLightEntityControlTile.java

示例13: createTorus

import com.jme3.material.RenderState; //导入依赖的package包/类
private Spatial createTorus(String name, ColorRGBA color) {
    Node torus = new Node(name);
    
    // 可见的旋转圈
    Material mat = MaterialUtils.createUnshaded(color);
    mat.getAdditionalRenderState().setFaceCullMode(RenderState.FaceCullMode.Off);
    mat.getAdditionalRenderState().setDepthTest(false);
    Geometry torusInner = new Geometry(name + "tours", new Torus(80, 6, 0.005f, 1.0f));
    torusInner.setMaterial(mat);
    
    // 用于优化点选
    Geometry torusOuter = new Geometry(name + "picker", new Torus(20, 4, 0.15f, 1.0f));
    torusOuter.setMaterial(MaterialUtils.createUnshaded());
    torusOuter.setCullHint(CullHint.Always);
    
    torus.attachChild(torusInner);
    torus.attachChild(torusOuter);
    
    return torus;
}
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:21,代码来源:RotationAxis.java

示例14: registerInput

import com.jme3.material.RenderState; //导入依赖的package包/类
private void registerInput() {
	if (brushGeom == null) {
		brushGeom = new Geometry("brush", new Quad(BRUSH_RADIUS*2, BRUSH_RADIUS*2));
		Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
		mat.setTexture("ColorMap", app.getAssetManager().loadTexture("org/shaman/terrain/polygonal/Brush.png"));
		mat.getAdditionalRenderState().setDepthTest(false);
		mat.getAdditionalRenderState().setDepthWrite(false);
		mat.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);
		brushGeom.setMaterial(mat);
		graphNode.attachChild(brushGeom);
		brushGeom.setCullHint(Spatial.CullHint.Always);
		
		listener = new InputListenerImpl();
		app.getInputManager().addMapping("PolygonalMouseX+", new MouseAxisTrigger(MouseInput.AXIS_X, false));
		app.getInputManager().addMapping("PolygonalMouseX-", new MouseAxisTrigger(MouseInput.AXIS_X, true));
		app.getInputManager().addMapping("PolygonalMouseY+", new MouseAxisTrigger(MouseInput.AXIS_Y, false));
		app.getInputManager().addMapping("PolygonalMouseY-", new MouseAxisTrigger(MouseInput.AXIS_Y, true));
		app.getInputManager().addMapping("PolygonalMouseLeft", new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
		app.getInputManager().addMapping("PolygonalMouseRight", new MouseButtonTrigger(MouseInput.BUTTON_RIGHT));
	}
	app.getInputManager().addListener(listener, "PolygonalMouseX+", "PolygonalMouseX-", "PolygonalMouseY+", 
			"PolygonalMouseY-", "PolygonalMouseLeft", "PolygonalMouseRight");
}
 
开发者ID:shamanDevel,项目名称:ProceduralTerrain,代码行数:24,代码来源:PolygonalMapGenerator.java

示例15: initWaterPlane

import com.jme3.material.RenderState; //导入依赖的package包/类
private void initWaterPlane() {
	float size = map.getSize() * TerrainHeighmapCreator.TERRAIN_SCALE;
	Quad quad = new Quad(size, size);
	Material mat = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
	mat.setColor("Color", new ColorRGBA(0, 0, 0.5f, 0.5f));
	mat.setTransparent(true);
	mat.getAdditionalRenderState().setAlphaTest(true);
	mat.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);
	mat.getAdditionalRenderState().setFaceCullMode(RenderState.FaceCullMode.Off);
	mat.getAdditionalRenderState().setDepthWrite(false);
	Geometry geom = new Geometry("water", quad);
	geom.setMaterial(mat);
	geom.setQueueBucket(RenderQueue.Bucket.Transparent);
	geom.rotate(FastMath.HALF_PI, 0, 0);
	geom.move(-size/2, 0, -size/2);
	waterPlane = geom;
	sceneNode.attachChild(geom);
}
 
开发者ID:shamanDevel,项目名称:ProceduralTerrain,代码行数:19,代码来源:SketchTerrain.java


注:本文中的com.jme3.material.RenderState类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。