OSDN Git Service

Move Environment and add CubemapAttribute
authorXoppa <contact@xoppa.nl>
Sat, 28 Sep 2013 19:34:49 +0000 (21:34 +0200)
committerXoppa <contact@xoppa.nl>
Sat, 28 Sep 2013 19:34:49 +0000 (21:34 +0200)
21 files changed:
demos/invaders/gdx-invaders/src/com/badlogic/gdxinvaders/Renderer.java
gdx/src/com/badlogic/gdx/graphics/g3d/Environment.java [moved from gdx/src/com/badlogic/gdx/graphics/g3d/environment/Environment.java with 78% similarity]
gdx/src/com/badlogic/gdx/graphics/g3d/ModelBatch.java
gdx/src/com/badlogic/gdx/graphics/g3d/Renderable.java
gdx/src/com/badlogic/gdx/graphics/g3d/attributes/CubemapAttribute.java [new file with mode: 0644]
gdx/src/com/badlogic/gdx/graphics/g3d/attributes/TextureAttribute.java
gdx/src/com/badlogic/gdx/graphics/g3d/shaders/DefaultShader.java
gdx/src/com/badlogic/gdx/graphics/g3d/shaders/GLES10Shader.java
gdx/src/com/badlogic/gdx/graphics/g3d/utils/TextureDescriptor.java
tests/gdx-tests/src/com/badlogic/gdx/tests/bullet/BaseBulletTest.java
tests/gdx-tests/src/com/badlogic/gdx/tests/bullet/BaseWorld.java
tests/gdx-tests/src/com/badlogic/gdx/tests/bullet/BasicBulletTest.java
tests/gdx-tests/src/com/badlogic/gdx/tests/bullet/BulletWorld.java
tests/gdx-tests/src/com/badlogic/gdx/tests/g3d/Animation3DTest.java
tests/gdx-tests/src/com/badlogic/gdx/tests/g3d/Basic3DSceneTest.java
tests/gdx-tests/src/com/badlogic/gdx/tests/g3d/Basic3DTest.java
tests/gdx-tests/src/com/badlogic/gdx/tests/g3d/FogTest.java
tests/gdx-tests/src/com/badlogic/gdx/tests/g3d/ModelTest.java
tests/gdx-tests/src/com/badlogic/gdx/tests/g3d/ShaderCollectionTest.java
tests/gdx-tests/src/com/badlogic/gdx/tests/g3d/ShaderTest.java
tests/gdx-tests/src/com/badlogic/gdx/tests/g3d/voxel/VoxelTest.java

index b4dd89c..ed61722 100644 (file)
@@ -23,9 +23,9 @@ import com.badlogic.gdx.graphics.Texture;
 import com.badlogic.gdx.graphics.Texture.TextureFilter;\r
 import com.badlogic.gdx.graphics.g2d.BitmapFont;\r
 import com.badlogic.gdx.graphics.g2d.SpriteBatch;\r
+import com.badlogic.gdx.graphics.g3d.Environment;\r
 import com.badlogic.gdx.graphics.g3d.ModelBatch;\r
 import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight;\r
-import com.badlogic.gdx.graphics.g3d.environment.Environment;\r
 import com.badlogic.gdx.math.Matrix3;\r
 import com.badlogic.gdx.math.Matrix4;\r
 import com.badlogic.gdx.math.Vector3;\r
@@ -1,15 +1,17 @@
-package com.badlogic.gdx.graphics.g3d.environment;
+package com.badlogic.gdx.graphics.g3d;
 
 import com.badlogic.gdx.graphics.Color;
 import com.badlogic.gdx.graphics.Cubemap;
-import com.badlogic.gdx.graphics.g3d.Attributes;
+import com.badlogic.gdx.graphics.g3d.environment.BaseLight;
+import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight;
+import com.badlogic.gdx.graphics.g3d.environment.PointLight;
+import com.badlogic.gdx.graphics.g3d.environment.ShadowMap;
 import com.badlogic.gdx.utils.Array;
 import com.badlogic.gdx.utils.GdxRuntimeException;
 
 public class Environment extends Attributes {
        /** @deprecated Experimental, likely to change, do not use! */
        public ShadowMap shadowMap;
-       public Cubemap environmentCubemap;
        public final Array<DirectionalLight> directionalLights = new Array<DirectionalLight>();
        public final Array<PointLight> pointLights = new Array<PointLight>();
        
index fbb60d7..236f913 100644 (file)
@@ -3,7 +3,6 @@ package com.badlogic.gdx.graphics.g3d;
 import com.badlogic.gdx.Gdx;
 import com.badlogic.gdx.files.FileHandle;
 import com.badlogic.gdx.graphics.Camera;
-import com.badlogic.gdx.graphics.g3d.environment.Environment;
 import com.badlogic.gdx.graphics.g3d.shaders.DefaultShader;
 import com.badlogic.gdx.graphics.g3d.utils.DefaultRenderableSorter;
 import com.badlogic.gdx.graphics.g3d.utils.DefaultShaderProvider;
index 7ab2286..afc9c57 100644 (file)
@@ -2,7 +2,6 @@ package com.badlogic.gdx.graphics.g3d;
 
 import com.badlogic.gdx.graphics.GL20;
 import com.badlogic.gdx.graphics.Mesh;
-import com.badlogic.gdx.graphics.g3d.environment.Environment;
 import com.badlogic.gdx.graphics.g3d.model.Node;
 import com.badlogic.gdx.graphics.g3d.utils.ShaderProvider;
 import com.badlogic.gdx.math.Matrix4;
diff --git a/gdx/src/com/badlogic/gdx/graphics/g3d/attributes/CubemapAttribute.java b/gdx/src/com/badlogic/gdx/graphics/g3d/attributes/CubemapAttribute.java
new file mode 100644 (file)
index 0000000..184d232
--- /dev/null
@@ -0,0 +1,55 @@
+package com.badlogic.gdx.graphics.g3d.attributes;
+
+import com.badlogic.gdx.graphics.Cubemap;
+import com.badlogic.gdx.graphics.Texture;
+import com.badlogic.gdx.graphics.g3d.Attribute;
+import com.badlogic.gdx.graphics.g3d.utils.TextureDescriptor;
+import com.badlogic.gdx.utils.GdxRuntimeException;
+
+public class CubemapAttribute extends Attribute {
+       public final static String EnvironmentMapAlias = "environmentMapTexture";
+       public final static long EnvironmentMap = register(EnvironmentMapAlias);
+       
+       // FIXME add more types!
+       // FIXME add scaling + offset?
+       // FIXME add filter settings? MipMap needs to be obeyed during loading :/
+       
+       protected static long Mask = EnvironmentMap;
+       
+       public final static boolean is(final long mask) {
+               return (mask & Mask) != 0;
+       }
+       
+       public final TextureDescriptor<Cubemap> textureDescription;
+       
+       public CubemapAttribute(final long type) {
+               super(type);
+               if (!is(type))
+                       throw new GdxRuntimeException("Invalid type specified");
+               textureDescription = new TextureDescriptor<Cubemap>();
+       }
+       
+       public <T extends Cubemap> CubemapAttribute(final long type, final TextureDescriptor<T> textureDescription) {
+               this(type);
+               this.textureDescription.set(textureDescription);
+       }
+       
+       public CubemapAttribute(final long type, final Cubemap texture) {
+               this(type);
+               textureDescription.texture = texture;
+       }
+       
+       public CubemapAttribute(final CubemapAttribute copyFrom) {
+               this(copyFrom.type, copyFrom.textureDescription);
+       }
+       
+       @Override
+       public Attribute copy () {
+               return new CubemapAttribute(this);
+       }
+
+       @Override
+       protected boolean equals (Attribute other) {
+               return ((CubemapAttribute)other).textureDescription.equals(textureDescription);
+       }
+}
index 3066d72..504f2b2 100644 (file)
@@ -1,5 +1,6 @@
 package com.badlogic.gdx.graphics.g3d.attributes;
 
+import com.badlogic.gdx.graphics.GLTexture;
 import com.badlogic.gdx.graphics.Texture;
 import com.badlogic.gdx.graphics.g3d.Attribute;
 import com.badlogic.gdx.graphics.g3d.utils.TextureDescriptor;
@@ -33,21 +34,23 @@ public class TextureAttribute extends Attribute {
                return new TextureAttribute(Specular, texture);
        }
        
-       public final TextureDescriptor textureDescription;
+       public final TextureDescriptor<Texture> textureDescription;
        
-       public TextureAttribute(final long type, final TextureDescriptor textureDescription) {
+       public TextureAttribute(final long type) {
                super(type);
                if (!is(type))
                        throw new GdxRuntimeException("Invalid type specified");
-               this.textureDescription = textureDescription; // FIXME Add TextureDescriptor#copy or #addRef ?
+               textureDescription = new TextureDescriptor<Texture>();
        }
        
-       public TextureAttribute(final long type) {
-               this(type, new TextureDescriptor());
+       public <T extends Texture> TextureAttribute(final long type, final TextureDescriptor<T> textureDescription) {
+               this(type);
+               this.textureDescription.set(textureDescription);
        }
        
        public TextureAttribute(final long type, final Texture texture) {
-               this(type, new TextureDescriptor(texture));
+               this(type);
+               textureDescription.texture = texture;
        }
        
        public TextureAttribute(final TextureAttribute copyFrom) {
index d478b68..cd9795e 100644 (file)
@@ -9,18 +9,19 @@ import com.badlogic.gdx.graphics.VertexAttributes;
 import com.badlogic.gdx.graphics.VertexAttributes.Usage;
 import com.badlogic.gdx.graphics.g3d.Attribute;
 import com.badlogic.gdx.graphics.g3d.Attributes;
+import com.badlogic.gdx.graphics.g3d.Environment;
 import com.badlogic.gdx.graphics.g3d.Material;
 import com.badlogic.gdx.graphics.g3d.Renderable;
 import com.badlogic.gdx.graphics.g3d.Shader;
 import com.badlogic.gdx.graphics.g3d.attributes.BlendingAttribute;
 import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute;
+import com.badlogic.gdx.graphics.g3d.attributes.CubemapAttribute;
 import com.badlogic.gdx.graphics.g3d.attributes.DepthTestAttribute;
 import com.badlogic.gdx.graphics.g3d.attributes.FloatAttribute;
 import com.badlogic.gdx.graphics.g3d.attributes.IntAttribute;
 import com.badlogic.gdx.graphics.g3d.attributes.TextureAttribute;
 import com.badlogic.gdx.graphics.g3d.environment.AmbientCubemap;
 import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight;
-import com.badlogic.gdx.graphics.g3d.environment.Environment;
 import com.badlogic.gdx.graphics.g3d.environment.PointLight;
 import com.badlogic.gdx.graphics.g3d.utils.RenderContext;
 import com.badlogic.gdx.graphics.glutils.ShaderProgram;
@@ -249,9 +250,8 @@ public class DefaultShader extends BaseShader {
                public final static Setter environmentCubemap = new Setter() {
                        @Override public boolean isGlobal (BaseShader shader, int inputID) { return false; }
                        @Override public void set (BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) {
-                               if (renderable.environment != null && renderable.environment.environmentCubemap != null) {
-                                       final int unit = shader.context.textureBinder.bind(renderable.environment.environmentCubemap);
-                                       shader.set(inputID, unit);
+                               if (combinedAttributes.has(CubemapAttribute.EnvironmentMap)) {
+                                       shader.set(inputID, shader.context.textureBinder.bind(((CubemapAttribute)combinedAttributes.get(CubemapAttribute.EnvironmentMap)).textureDescription));
                                }
                        }
                };
@@ -367,7 +367,8 @@ public class DefaultShader extends BaseShader {
        public DefaultShader(final Renderable renderable, final Config config, final ShaderProgram shaderProgram) {
                this.program = shaderProgram;
                this.lighting = renderable.environment != null;
-               this.environmentCubemap = lighting && renderable.environment.environmentCubemap != null;
+               this.environmentCubemap = renderable.material.has(CubemapAttribute.EnvironmentMap) || (
+                               lighting && renderable.environment.has(CubemapAttribute.EnvironmentMap));
                this.shadowMap = lighting && renderable.environment.shadowMap != null;
                this.fog = lighting && renderable.environment.has(ColorAttribute.Fog);
                this.renderable = renderable;
@@ -470,7 +471,7 @@ public class DefaultShader extends BaseShader {
                                }
                                if (renderable.environment.shadowMap != null)
                                        prefix += "#define shadowMapFlag\n";
-                               if (renderable.environment.environmentCubemap != null)
+                               if (renderable.material.has(CubemapAttribute.EnvironmentMap) || renderable.environment.has(CubemapAttribute.EnvironmentMap))
                                        prefix += "#define environmentCubemapFlag\n";
                        }
                }
index 6f5a8c8..4f23757 100644 (file)
@@ -7,6 +7,7 @@ import com.badlogic.gdx.graphics.GL10;
 import com.badlogic.gdx.graphics.Mesh;
 import com.badlogic.gdx.graphics.Texture;
 import com.badlogic.gdx.graphics.g3d.Attribute;
+import com.badlogic.gdx.graphics.g3d.Environment;
 import com.badlogic.gdx.graphics.g3d.Material;
 import com.badlogic.gdx.graphics.g3d.Renderable;
 import com.badlogic.gdx.graphics.g3d.Shader;
@@ -15,7 +16,6 @@ import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute;
 import com.badlogic.gdx.graphics.g3d.attributes.IntAttribute;
 import com.badlogic.gdx.graphics.g3d.attributes.TextureAttribute;
 import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight;
-import com.badlogic.gdx.graphics.g3d.environment.Environment;
 import com.badlogic.gdx.graphics.g3d.environment.PointLight;
 import com.badlogic.gdx.graphics.g3d.utils.RenderContext;
 import com.badlogic.gdx.graphics.g3d.utils.TextureDescriptor;
index 76afe76..f5e839f 100644 (file)
@@ -4,26 +4,26 @@ import com.badlogic.gdx.graphics.GLTexture;
 import com.badlogic.gdx.graphics.GL10;
 import com.badlogic.gdx.graphics.Texture;
 
-public class TextureDescriptor {
-       public GLTexture texture = null;
+public class TextureDescriptor<T extends GLTexture> {
+       public T texture = null;
        public Texture.TextureFilter minFilter;
        public Texture.TextureFilter magFilter;
        public Texture.TextureWrap uWrap;
        public Texture.TextureWrap vWrap;
        // TODO add other values, see http://www.opengl.org/sdk/docs/man/xhtml/glTexParameter.xml
        
-       public TextureDescriptor(final Texture texture, final Texture.TextureFilter minFilter, final Texture.TextureFilter magFilter, final Texture.TextureWrap uWrap, final Texture.TextureWrap vWrap) {
+       public TextureDescriptor(final T texture, final Texture.TextureFilter minFilter, final Texture.TextureFilter magFilter, final Texture.TextureWrap uWrap, final Texture.TextureWrap vWrap) {
                set(texture, minFilter, magFilter, uWrap, vWrap);
        }
        
-       public TextureDescriptor(final Texture texture) {
+       public TextureDescriptor(final T texture) {
                this(texture, null, null, null, null);
        }
        
        public TextureDescriptor() {
        }
 
-       public void set(final GLTexture texture, final Texture.TextureFilter minFilter, final Texture.TextureFilter magFilter, final Texture.TextureWrap uWrap, final Texture.TextureWrap vWrap) {
+       public void set(final T texture, final Texture.TextureFilter minFilter, final Texture.TextureFilter magFilter, final Texture.TextureWrap uWrap, final Texture.TextureWrap vWrap) {
                this.texture = texture;
                this.minFilter = minFilter;
                this.magFilter = magFilter;
@@ -31,7 +31,7 @@ public class TextureDescriptor {
                this.vWrap = vWrap;
        }
        
-       public void set(final TextureDescriptor other) {
+       public <V extends T> void set(final TextureDescriptor<V> other) {
                texture = other.texture;
                minFilter = other.minFilter;
                magFilter = other.magFilter;
@@ -44,7 +44,7 @@ public class TextureDescriptor {
                if (obj == null) return false;
                if (obj == this) return true;
                if (!(obj instanceof TextureDescriptor)) return false;
-               final TextureDescriptor other = (TextureDescriptor)obj;
+               final TextureDescriptor<?> other = (TextureDescriptor<?>)obj;
                return other.texture == texture && other.minFilter == minFilter && other.magFilter == magFilter &&
                        other.uWrap == uWrap && other.vWrap == vWrap;
        }
index c212f02..32a7465 100644 (file)
@@ -26,6 +26,7 @@ import com.badlogic.gdx.graphics.PerspectiveCamera;
 import com.badlogic.gdx.graphics.VertexAttribute;
 import com.badlogic.gdx.graphics.VertexAttributes;
 import com.badlogic.gdx.graphics.VertexAttributes.Usage;
+import com.badlogic.gdx.graphics.g3d.Environment;
 import com.badlogic.gdx.graphics.g3d.Material;
 import com.badlogic.gdx.graphics.g3d.Model;
 import com.badlogic.gdx.graphics.g3d.ModelBatch;
@@ -33,7 +34,6 @@ import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute;
 import com.badlogic.gdx.graphics.g3d.attributes.FloatAttribute;
 import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight;
 import com.badlogic.gdx.graphics.g3d.environment.DirectionalShadowLight;
-import com.badlogic.gdx.graphics.g3d.environment.Environment;
 import com.badlogic.gdx.graphics.g3d.environment.PointLight;
 import com.badlogic.gdx.graphics.g3d.loader.ObjLoader;
 import com.badlogic.gdx.graphics.g3d.shaders.DefaultShader;
index 2f30f80..6e28013 100644 (file)
@@ -20,9 +20,9 @@ import com.badlogic.gdx.graphics.Camera;
 import com.badlogic.gdx.graphics.Color;
 import com.badlogic.gdx.graphics.GL10;
 import com.badlogic.gdx.graphics.Mesh;
+import com.badlogic.gdx.graphics.g3d.Environment;
 import com.badlogic.gdx.graphics.g3d.Model;
 import com.badlogic.gdx.graphics.g3d.ModelBatch;
-import com.badlogic.gdx.graphics.g3d.environment.Environment;
 import com.badlogic.gdx.math.Matrix4;
 import com.badlogic.gdx.utils.Array;
 import com.badlogic.gdx.utils.Disposable;
index 15bc536..8a240b7 100644 (file)
@@ -20,6 +20,7 @@ import com.badlogic.gdx.graphics.Color;
 import com.badlogic.gdx.graphics.GL10;
 import com.badlogic.gdx.graphics.PerspectiveCamera;
 import com.badlogic.gdx.graphics.VertexAttributes.Usage;
+import com.badlogic.gdx.graphics.g3d.Environment;
 import com.badlogic.gdx.graphics.g3d.Material;
 import com.badlogic.gdx.graphics.g3d.Model;
 import com.badlogic.gdx.graphics.g3d.ModelBatch;
@@ -28,7 +29,6 @@ import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute;
 import com.badlogic.gdx.graphics.g3d.attributes.FloatAttribute;
 import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight;
 import com.badlogic.gdx.graphics.g3d.environment.DirectionalShadowLight;
-import com.badlogic.gdx.graphics.g3d.environment.Environment;
 import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder;
 import com.badlogic.gdx.math.MathUtils;
 import com.badlogic.gdx.math.Matrix4;
index 669fe64..702f4f7 100644 (file)
@@ -16,8 +16,8 @@
 package com.badlogic.gdx.tests.bullet;
 
 import com.badlogic.gdx.Gdx;
+import com.badlogic.gdx.graphics.g3d.Environment;
 import com.badlogic.gdx.graphics.g3d.ModelBatch;
-import com.badlogic.gdx.graphics.g3d.environment.Environment;
 import com.badlogic.gdx.math.Matrix4;
 import com.badlogic.gdx.math.Vector3;
 import com.badlogic.gdx.math.WindowedMean;
index 44a3cc2..69e53ea 100644 (file)
@@ -6,6 +6,7 @@ import com.badlogic.gdx.graphics.Color;
 import com.badlogic.gdx.graphics.GL10;
 import com.badlogic.gdx.graphics.Texture;
 import com.badlogic.gdx.graphics.VertexAttributes.Usage;
+import com.badlogic.gdx.graphics.g3d.Environment;
 import com.badlogic.gdx.graphics.g3d.Material;
 import com.badlogic.gdx.graphics.g3d.Model;
 import com.badlogic.gdx.graphics.g3d.ModelBatch;
@@ -14,7 +15,6 @@ import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute;
 import com.badlogic.gdx.graphics.g3d.attributes.TextureAttribute;
 import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight;
 import com.badlogic.gdx.graphics.g3d.environment.DirectionalShadowLight;
-import com.badlogic.gdx.graphics.g3d.environment.Environment;
 import com.badlogic.gdx.graphics.g3d.model.Animation;
 import com.badlogic.gdx.graphics.g3d.model.MeshPart;
 import com.badlogic.gdx.graphics.g3d.model.Node;
index a85a0a9..b228317 100644 (file)
@@ -5,6 +5,7 @@ import com.badlogic.gdx.Gdx;
 import com.badlogic.gdx.assets.AssetManager;
 import com.badlogic.gdx.graphics.GL10;
 import com.badlogic.gdx.graphics.PerspectiveCamera;
+import com.badlogic.gdx.graphics.g3d.Environment;
 import com.badlogic.gdx.graphics.g3d.Model;
 import com.badlogic.gdx.graphics.g3d.ModelBatch;
 import com.badlogic.gdx.graphics.g3d.ModelInstance;
@@ -12,7 +13,6 @@ import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute;
 import com.badlogic.gdx.graphics.g3d.attributes.IntAttribute;
 import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight;
 import com.badlogic.gdx.graphics.g3d.environment.DirectionalShadowLight;
-import com.badlogic.gdx.graphics.g3d.environment.Environment;
 import com.badlogic.gdx.graphics.g3d.model.Node;
 import com.badlogic.gdx.graphics.g3d.utils.CameraInputController;
 import com.badlogic.gdx.math.Vector3;
index dca8ac2..f0a9c0a 100644 (file)
@@ -6,11 +6,11 @@ import com.badlogic.gdx.graphics.Color;
 import com.badlogic.gdx.graphics.GL10;
 import com.badlogic.gdx.graphics.PerspectiveCamera;
 import com.badlogic.gdx.graphics.VertexAttributes.Usage;
+import com.badlogic.gdx.graphics.g3d.Environment;
 import com.badlogic.gdx.graphics.g3d.Model;
 import com.badlogic.gdx.graphics.g3d.ModelBatch;
 import com.badlogic.gdx.graphics.g3d.ModelInstance;
 import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight;
-import com.badlogic.gdx.graphics.g3d.environment.Environment;
 import com.badlogic.gdx.graphics.g3d.loader.G3dModelLoader;
 import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute;
 import com.badlogic.gdx.graphics.g3d.Material;
index fbaa0c8..daae478 100644 (file)
@@ -7,6 +7,7 @@ import com.badlogic.gdx.graphics.Color;
 import com.badlogic.gdx.graphics.GL10;
 import com.badlogic.gdx.graphics.PerspectiveCamera;
 import com.badlogic.gdx.graphics.VertexAttributes.Usage;
+import com.badlogic.gdx.graphics.g3d.Environment;
 import com.badlogic.gdx.graphics.g3d.Material;
 import com.badlogic.gdx.graphics.g3d.Model;
 import com.badlogic.gdx.graphics.g3d.ModelBatch;
@@ -14,7 +15,6 @@ import com.badlogic.gdx.graphics.g3d.ModelInstance;
 import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute;
 import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight;
 import com.badlogic.gdx.graphics.g3d.environment.DirectionalShadowLight;
-import com.badlogic.gdx.graphics.g3d.environment.Environment;
 import com.badlogic.gdx.graphics.g3d.utils.CameraInputController;
 import com.badlogic.gdx.graphics.g3d.utils.ModelBuilder;
 import com.badlogic.gdx.tests.utils.GdxTest;
index 45ea2ac..6eb567e 100644 (file)
@@ -3,6 +3,7 @@ package com.badlogic.gdx.tests.g3d;
 import com.badlogic.gdx.Gdx;
 import com.badlogic.gdx.Input.Keys;
 import com.badlogic.gdx.graphics.GL10;
+import com.badlogic.gdx.graphics.g3d.Environment;
 import com.badlogic.gdx.graphics.g3d.Model;
 import com.badlogic.gdx.graphics.g3d.ModelBatch;
 import com.badlogic.gdx.graphics.g3d.ModelInstance;
@@ -10,7 +11,6 @@ import com.badlogic.gdx.graphics.g3d.attributes.BlendingAttribute;
 import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute;
 import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight;
 import com.badlogic.gdx.graphics.g3d.environment.DirectionalShadowLight;
-import com.badlogic.gdx.graphics.g3d.environment.Environment;
 import com.badlogic.gdx.graphics.g3d.environment.PointLight;
 import com.badlogic.gdx.graphics.g3d.model.Animation;
 import com.badlogic.gdx.graphics.g3d.model.NodeAnimation;
index f2e7c99..48fc492 100644 (file)
@@ -11,15 +11,16 @@ import com.badlogic.gdx.files.FileHandle;
 import com.badlogic.gdx.graphics.Color;
 import com.badlogic.gdx.graphics.Cubemap;
 import com.badlogic.gdx.graphics.Cubemap.CubemapSide;
+import com.badlogic.gdx.graphics.g3d.Environment;
 import com.badlogic.gdx.graphics.g3d.Model;
 import com.badlogic.gdx.graphics.g3d.ModelBatch;
 import com.badlogic.gdx.graphics.g3d.ModelInstance;
 import com.badlogic.gdx.graphics.g3d.Renderable;
 import com.badlogic.gdx.graphics.g3d.Shader;
 import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute;
+import com.badlogic.gdx.graphics.g3d.attributes.CubemapAttribute;
 import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight;
 import com.badlogic.gdx.graphics.g3d.environment.DirectionalShadowLight;
-import com.badlogic.gdx.graphics.g3d.environment.Environment;
 import com.badlogic.gdx.graphics.g3d.environment.PointLight;
 import com.badlogic.gdx.graphics.g3d.model.Animation;
 import com.badlogic.gdx.graphics.g3d.shaders.BaseShader;
@@ -163,8 +164,8 @@ public class ShaderCollectionTest extends BaseG3dHudTest {
                        cubemap = null;
                }
                if (name.equals("<none>")) {
-                       if (lights.environmentCubemap != null) {
-                               lights.environmentCubemap = null;
+                       if (lights.has(CubemapAttribute.EnvironmentMap)) {
+                               lights.remove(CubemapAttribute.EnvironmentMap);
                                shaderProvider.clear();
                        }
                }
@@ -175,9 +176,9 @@ public class ShaderCollectionTest extends BaseG3dHudTest {
                                root.child(name+"_PZ.png"), root.child(name+"_NZ.png"), 
                                false); // FIXME mipmapping on desktop
                        cubemap.load(CubemapSide.NegativeX, root.child(name+"_NX.png"));
-                       if (lights.environmentCubemap == null)
+                       if (!lights.has(CubemapAttribute.EnvironmentMap))
                                shaderProvider.clear();
-                       lights.environmentCubemap = cubemap;
+                       lights.set(new CubemapAttribute(CubemapAttribute.EnvironmentMap, cubemap));
                }
        }
        
index 47ab968..80536fc 100644 (file)
@@ -7,6 +7,7 @@ import com.badlogic.gdx.graphics.GL10;
 import com.badlogic.gdx.graphics.PerspectiveCamera;
 import com.badlogic.gdx.graphics.VertexAttributes.Usage;
 import com.badlogic.gdx.graphics.g3d.Attribute;
+import com.badlogic.gdx.graphics.g3d.Environment;
 import com.badlogic.gdx.graphics.g3d.Material;
 import com.badlogic.gdx.graphics.g3d.Model;
 import com.badlogic.gdx.graphics.g3d.ModelBatch;
@@ -14,7 +15,6 @@ import com.badlogic.gdx.graphics.g3d.ModelInstance;
 import com.badlogic.gdx.graphics.g3d.Renderable;
 import com.badlogic.gdx.graphics.g3d.Shader;
 import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight;
-import com.badlogic.gdx.graphics.g3d.environment.Environment;
 import com.badlogic.gdx.graphics.g3d.shaders.BaseShader;
 import com.badlogic.gdx.graphics.g3d.utils.BaseShaderProvider;
 import com.badlogic.gdx.graphics.g3d.utils.CameraInputController;
index e5cdb64..66495a9 100644 (file)
@@ -12,13 +12,13 @@ import com.badlogic.gdx.graphics.VertexAttributes.Usage;
 import com.badlogic.gdx.graphics.g2d.BitmapFont;
 import com.badlogic.gdx.graphics.g2d.SpriteBatch;
 import com.badlogic.gdx.graphics.g2d.TextureRegion;
+import com.badlogic.gdx.graphics.g3d.Environment;
 import com.badlogic.gdx.graphics.g3d.Material;
 import com.badlogic.gdx.graphics.g3d.Model;
 import com.badlogic.gdx.graphics.g3d.ModelBatch;
 import com.badlogic.gdx.graphics.g3d.ModelInstance;
 import com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute;
 import com.badlogic.gdx.graphics.g3d.environment.DirectionalLight;
-import com.badlogic.gdx.graphics.g3d.environment.Environment;
 import com.badlogic.gdx.graphics.g3d.shaders.DefaultShader;
 import com.badlogic.gdx.graphics.g3d.shaders.GLES10Shader;
 import com.badlogic.gdx.graphics.g3d.utils.CameraInputController;