From 8ce97b9929d2996ad53b28ed164f6c5a07e95484 Mon Sep 17 00:00:00 2001 From: Xoppa Date: Sun, 7 Apr 2013 21:25:26 +0200 Subject: [PATCH] remove attribute#set --- gdx/src/com/badlogic/gdx/graphics/g3d/Renderable.java | 2 ++ .../gdx/graphics/g3d/materials/BlendingAttribute.java | 9 --------- .../gdx/graphics/g3d/materials/ColorAttribute.java | 8 -------- .../gdx/graphics/g3d/materials/FloatAttribute.java | 8 -------- .../badlogic/gdx/graphics/g3d/materials/Material.java | 2 -- .../gdx/graphics/g3d/materials/TextureAttribute.java | 8 -------- .../gdx/graphics/g3d/shaders/DefaultShader.java | 11 ++++------- .../gdx/graphics/g3d/shaders/default.fragment.glsl | 9 --------- .../graphics/g3d/utils/DefaultRenderableSorter.java | 18 +++++++++++++++--- .../gdx/graphics/g3d/utils/RenderableSorter.java | 3 ++- 10 files changed, 23 insertions(+), 55 deletions(-) diff --git a/gdx/src/com/badlogic/gdx/graphics/g3d/Renderable.java b/gdx/src/com/badlogic/gdx/graphics/g3d/Renderable.java index 814162665..1afe8862e 100644 --- a/gdx/src/com/badlogic/gdx/graphics/g3d/Renderable.java +++ b/gdx/src/com/badlogic/gdx/graphics/g3d/Renderable.java @@ -34,4 +34,6 @@ public class Renderable { public Light[] lights; /** the Shader to be used to render this Renderable, may be null **/ public Shader shader; + /** user definable value. */ + public Object userData; } \ No newline at end of file diff --git a/gdx/src/com/badlogic/gdx/graphics/g3d/materials/BlendingAttribute.java b/gdx/src/com/badlogic/gdx/graphics/g3d/materials/BlendingAttribute.java index 6de288a24..318091587 100644 --- a/gdx/src/com/badlogic/gdx/graphics/g3d/materials/BlendingAttribute.java +++ b/gdx/src/com/badlogic/gdx/graphics/g3d/materials/BlendingAttribute.java @@ -38,13 +38,4 @@ public class BlendingAttribute extends Material.Attribute { return ((BlendingAttribute)other).sourceFunction == sourceFunction && ((BlendingAttribute)other).destFunction == destFunction; } - - @Override - public void set (Attribute other) { - if (other == null || other.type != type || !(other instanceof BlendingAttribute)) - throw new GdxRuntimeException("Cannot set this attribute to an attribute of another type"); - final BlendingAttribute o = (BlendingAttribute)other; - sourceFunction = o.sourceFunction; - destFunction = o.destFunction; - } } \ No newline at end of file diff --git a/gdx/src/com/badlogic/gdx/graphics/g3d/materials/ColorAttribute.java b/gdx/src/com/badlogic/gdx/graphics/g3d/materials/ColorAttribute.java index 7281e8272..ea7c3233b 100644 --- a/gdx/src/com/badlogic/gdx/graphics/g3d/materials/ColorAttribute.java +++ b/gdx/src/com/badlogic/gdx/graphics/g3d/materials/ColorAttribute.java @@ -68,12 +68,4 @@ public class ColorAttribute extends Material.Attribute { protected boolean equals (Attribute other) { return ((ColorAttribute)other).color.equals(color); } - - @Override - public void set (Attribute other) { - if (other == null || other.type != type || !(other instanceof ColorAttribute)) - throw new GdxRuntimeException("Cannot set this attribute to an attribute of another type"); - final ColorAttribute o = (ColorAttribute)other; - color.set(o.color); - } } \ No newline at end of file diff --git a/gdx/src/com/badlogic/gdx/graphics/g3d/materials/FloatAttribute.java b/gdx/src/com/badlogic/gdx/graphics/g3d/materials/FloatAttribute.java index 3109fbab0..89a6b6252 100644 --- a/gdx/src/com/badlogic/gdx/graphics/g3d/materials/FloatAttribute.java +++ b/gdx/src/com/badlogic/gdx/graphics/g3d/materials/FloatAttribute.java @@ -32,12 +32,4 @@ public class FloatAttribute extends Material.Attribute { // FIXME use epsilon? return ((FloatAttribute)other).value == value; } - - @Override - public void set (Attribute other) { - if (other == null || other.type != type || !(other instanceof FloatAttribute)) - throw new GdxRuntimeException("Cannot set this attribute to an attribute of another type"); - final FloatAttribute o = (FloatAttribute)other; - value = o.value; - } } diff --git a/gdx/src/com/badlogic/gdx/graphics/g3d/materials/Material.java b/gdx/src/com/badlogic/gdx/graphics/g3d/materials/Material.java index 07032be6f..5995f7f0e 100644 --- a/gdx/src/com/badlogic/gdx/graphics/g3d/materials/Material.java +++ b/gdx/src/com/badlogic/gdx/graphics/g3d/materials/Material.java @@ -37,8 +37,6 @@ public class Material implements Iterable, Comparator 0) -struct Light -{ - vec4 color; - vec3 position; - float power; -}; -uniform Light lights[NUM_LIGHTS]; -#endif */ #endif void main() { diff --git a/gdx/src/com/badlogic/gdx/graphics/g3d/utils/DefaultRenderableSorter.java b/gdx/src/com/badlogic/gdx/graphics/g3d/utils/DefaultRenderableSorter.java index ad6aaedc3..d347fbe66 100644 --- a/gdx/src/com/badlogic/gdx/graphics/g3d/utils/DefaultRenderableSorter.java +++ b/gdx/src/com/badlogic/gdx/graphics/g3d/utils/DefaultRenderableSorter.java @@ -2,13 +2,20 @@ package com.badlogic.gdx.graphics.g3d.utils; import java.util.Comparator; +import com.badlogic.gdx.graphics.Camera; import com.badlogic.gdx.graphics.g3d.Renderable; import com.badlogic.gdx.graphics.g3d.materials.BlendingAttribute; +import com.badlogic.gdx.math.Vector3; import com.badlogic.gdx.utils.Array; public class DefaultRenderableSorter implements RenderableSorter, Comparator { + private Camera camera; + private final Vector3 tmpV1 = new Vector3(); + private final Vector3 tmpV2 = new Vector3(); + @Override - public void sort (Array renderables) { + public void sort (final Camera camera, final Array renderables) { + this.camera = camera; renderables.sort(this); } @@ -18,7 +25,12 @@ public class DefaultRenderableSorter implements RenderableSorter, Comparator 0f ? 1 : 0); } } diff --git a/gdx/src/com/badlogic/gdx/graphics/g3d/utils/RenderableSorter.java b/gdx/src/com/badlogic/gdx/graphics/g3d/utils/RenderableSorter.java index 69fee4235..d3eb5727a 100644 --- a/gdx/src/com/badlogic/gdx/graphics/g3d/utils/RenderableSorter.java +++ b/gdx/src/com/badlogic/gdx/graphics/g3d/utils/RenderableSorter.java @@ -1,5 +1,6 @@ package com.badlogic.gdx.graphics.g3d.utils; +import com.badlogic.gdx.graphics.Camera; import com.badlogic.gdx.graphics.g3d.Renderable; import com.badlogic.gdx.utils.Array; @@ -14,5 +15,5 @@ public interface RenderableSorter { * e.g. material, distance to camera etc. * @param renderables the array of renderables to be sorted */ - public void sort(Array renderables); + public void sort(Camera camera, Array renderables); } -- 2.11.0