com.badlogic.gdx.graphics.g3d.attributes.DepthTestAttribute Java Examples
The following examples show how to use
com.badlogic.gdx.graphics.g3d.attributes.DepthTestAttribute.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Sky.java From gdx-proto with Apache License 2.0 | 6 votes |
public static void createSkyBox (Texture xpos, Texture xneg, Texture ypos, Texture yneg, Texture zpos, Texture zneg) { modelInstance = new ModelInstance(model, "Skycube"); // Set material textures modelInstance.materials.get(0).set(TextureAttribute.createDiffuse(xpos)); modelInstance.materials.get(1).set(TextureAttribute.createDiffuse(xneg)); modelInstance.materials.get(2).set(TextureAttribute.createDiffuse(ypos)); modelInstance.materials.get(3).set(TextureAttribute.createDiffuse(yneg)); modelInstance.materials.get(5).set(TextureAttribute.createDiffuse(zpos)); modelInstance.materials.get(4).set(TextureAttribute.createDiffuse(zneg)); //Disable depth test modelInstance.materials.get(0).set(new DepthTestAttribute(0)); modelInstance.materials.get(1).set(new DepthTestAttribute(0)); modelInstance.materials.get(2).set(new DepthTestAttribute(0)); modelInstance.materials.get(3).set(new DepthTestAttribute(0)); modelInstance.materials.get(4).set(new DepthTestAttribute(0)); modelInstance.materials.get(5).set(new DepthTestAttribute(0)); enabled = true; }
Example #2
Source File: SceneSkybox.java From gdx-gltf with Apache License 2.0 | 5 votes |
public SceneSkybox(Cubemap cubemap){ super(); // create shader provider Config shaderConfig = new Config(); String basePathName = "net/mgsx/gltf/shaders/skybox"; shaderConfig.vertexShader = Gdx.files.classpath(basePathName + ".vs.glsl").readString(); shaderConfig.fragmentShader = Gdx.files.classpath(basePathName + ".fs.glsl").readString(); shaderProvider = new DefaultShaderProvider(shaderConfig); // create box float boxScale = (float)(1.0 / Math.sqrt(2.0)); boxModel = new ModelBuilder().createBox(boxScale, boxScale, boxScale, new Material(), VertexAttributes.Usage.Position); box = boxModel.nodes.first().parts.first().setRenderable(new Renderable()); // assign environment Environment env = new Environment(); env.set(new CubemapAttribute(CubemapAttribute.EnvironmentMap, cubemap)); env.set(new ColorAttribute(ColorAttribute.AmbientLight, Color.WHITE)); box.environment = env; // set hint to render last but before transparent ones box.userData = SceneRenderableSorter.Hints.OPAQUE_LAST; // set material options : preserve background depth box.material = new Material(ColorAttribute.createDiffuse(Color.WHITE)); box.material.set(new DepthTestAttribute(false)); // assign shader box.shader = shaderProvider.getShader(box); }
Example #3
Source File: Sky.java From gdx-proto with Apache License 2.0 | 5 votes |
public static void createSkyBox (Texture skybox) { modelInstance = new ModelInstance(model, "Skybox"); // Set material texutres and Disable depth test modelInstance.materials.get(0).set(TextureAttribute.createDiffuse(skybox)); modelInstance.materials.get(0).set(new DepthTestAttribute(0)); enabled = true; }