Commits

Michael Ludwig  committed 34cbd92

Update Component definitions to use entreri-1.5.2 and the new default annotations from ferox-math.

  • Participants
  • Parent commits 712cb81

Comments (0)

Files changed (14)

File ferox-scene/pom.xml

         <dependency>
             <groupId>com.lhkbob.entreri</groupId>
             <artifactId>entreri</artifactId>
-            <version>1.5.1</version>
-            <scope>compile</scope>
+            <version>1.5.2</version>
         </dependency>
     </dependencies>
 </project>

File ferox-scene/src/main/java/com/ferox/scene/AbstractPlacedLight.java

 import com.ferox.math.Const;
 import com.ferox.math.Vector3;
 import com.ferox.math.entreri.Vector3Property;
-import com.lhkbob.entreri.annot.DefaultValue;
-import com.lhkbob.entreri.annot.Unmanaged;
+import com.lhkbob.entreri.Unmanaged;
 import com.lhkbob.entreri.property.DoubleProperty;
+import com.lhkbob.entreri.property.DoubleProperty.DefaultDouble;
 
 /**
  * An intermediate light type that is shared by {@link PointLight} and
  * @param <T> The component light type
  */
 public abstract class AbstractPlacedLight<T extends AbstractPlacedLight<T>> extends Light<T> {
-    @DefaultValue(defaultDouble=-1.0)
+    @DefaultDouble(-1.0)
     private DoubleProperty falloffDistance;
     
     private Vector3Property position;

File ferox-scene/src/main/java/com/ferox/scene/AtmosphericFog.java

 import com.ferox.math.entreri.ColorRGBProperty;
 import com.lhkbob.entreri.ComponentData;
 import com.lhkbob.entreri.TypeId;
-import com.lhkbob.entreri.annot.DefaultValue;
-import com.lhkbob.entreri.annot.Unmanaged;
+import com.lhkbob.entreri.Unmanaged;
 import com.lhkbob.entreri.property.DoubleProperty;
+import com.lhkbob.entreri.property.DoubleProperty.DefaultDouble;
 import com.lhkbob.entreri.property.ObjectProperty;
 
 /**
     
     private ColorRGBProperty color;
     
-    @DefaultValue(defaultDouble=10)
+    @DefaultDouble(10)
     private DoubleProperty distanceToOpaque;
     
     private ObjectProperty<Falloff> falloff;

File ferox-scene/src/main/java/com/ferox/scene/BlinnPhongMaterial.java

 package com.ferox.scene;
 
 import com.lhkbob.entreri.TypeId;
-import com.lhkbob.entreri.annot.DefaultValue;
 import com.lhkbob.entreri.property.DoubleProperty;
+import com.lhkbob.entreri.property.DoubleProperty.DefaultDouble;
 
 /**
  * <p>
      */
     public static final TypeId<BlinnPhongMaterial> ID = TypeId.get(BlinnPhongMaterial.class);
     
-    @DefaultValue(defaultDouble=1.0)
+    @DefaultDouble(1.0)
     private DoubleProperty shininess;
     
     private BlinnPhongMaterial() { }

File ferox-scene/src/main/java/com/ferox/scene/Camera.java

 import com.ferox.renderer.Surface;
 import com.lhkbob.entreri.ComponentData;
 import com.lhkbob.entreri.TypeId;
-import com.lhkbob.entreri.annot.DefaultValue;
 import com.lhkbob.entreri.property.DoubleProperty;
+import com.lhkbob.entreri.property.DoubleProperty.DefaultDouble;
 import com.lhkbob.entreri.property.ObjectProperty;
 
 /**
     
     private ObjectProperty<Surface> surface;
     
-    @DefaultValue(defaultDouble=60.0)
+    @DefaultDouble(60.0)
     private DoubleProperty fov;
     
-    @DefaultValue(defaultDouble=0.01)
+    @DefaultDouble(0.01)
     private DoubleProperty znear;
     
-    @DefaultValue(defaultDouble=100.0)
+    @DefaultDouble(100.0)
     private DoubleProperty zfar;
     
     private Camera() { }

File ferox-scene/src/main/java/com/ferox/scene/ColorComponent.java

 import com.ferox.math.Const;
 import com.ferox.math.entreri.ColorRGBProperty;
 import com.lhkbob.entreri.ComponentData;
-import com.lhkbob.entreri.annot.Unmanaged;
+import com.lhkbob.entreri.Unmanaged;
 
 /**
  * <p>

File ferox-scene/src/main/java/com/ferox/scene/DirectionLight.java

 import com.ferox.math.Const;
 import com.ferox.math.Vector3;
 import com.ferox.math.entreri.Vector3Property;
+import com.ferox.math.entreri.Vector3Property.DefaultVector3;
 import com.lhkbob.entreri.TypeId;
-import com.lhkbob.entreri.annot.Factory;
-import com.lhkbob.entreri.annot.Unmanaged;
-import com.lhkbob.entreri.property.AbstractPropertyFactory;
+import com.lhkbob.entreri.Unmanaged;
 
 /**
  * <p>
      */
     public static final TypeId<DirectionLight> ID = TypeId.get(DirectionLight.class);
     
-    @Factory(DefaultDirectionFactory.class)
+    @DefaultVector3(x=0.0, y=0.0, z=1.0)
     private Vector3Property direction;
     
     @Unmanaged
     protected void onSet(int index) {
         direction.get(index, dirCache);
     }
-    
-    private static class DefaultDirectionFactory extends AbstractPropertyFactory<Vector3Property> {
-        public static final Vector3 DEFAULT_DIR = new Vector3(0, 0, 1);
-        
-        @Override
-        public Vector3Property create() {
-            return new Vector3Property();
-        }
-
-        @Override
-        public void setDefaultValue(Vector3Property property, int index) {
-            property.set(DEFAULT_DIR, index);
-        }
-    }
 }

File ferox-scene/src/main/java/com/ferox/scene/EntitySetComponent.java

 import java.util.Arrays;
 
 import com.lhkbob.entreri.ComponentData;
-import com.lhkbob.entreri.annot.ElementSize;
-import com.lhkbob.entreri.annot.Factory;
+import com.lhkbob.entreri.Factory;
+import com.lhkbob.entreri.PropertyFactory;
+import com.lhkbob.entreri.property.ElementSize;
 import com.lhkbob.entreri.property.IntProperty;
 import com.lhkbob.entreri.property.ObjectProperty;
-import com.lhkbob.entreri.property.PropertyFactory;
 
 public abstract class EntitySetComponent<T extends EntitySetComponent<T>> extends ComponentData<T> {
     // FIXME add iterator capabilities and document

File ferox-scene/src/main/java/com/ferox/scene/Light.java

 import com.ferox.math.ColorRGB;
 import com.ferox.math.Const;
 import com.ferox.math.entreri.ColorRGBProperty;
+import com.ferox.math.entreri.ColorRGBProperty.DefaultColor;
 import com.lhkbob.entreri.ComponentData;
-import com.lhkbob.entreri.annot.Factory;
-import com.lhkbob.entreri.annot.Unmanaged;
-import com.lhkbob.entreri.property.AbstractPropertyFactory;
+import com.lhkbob.entreri.Unmanaged;
 
 /**
  * <p>
  * @param <T> The concrete type of light
  */
 public abstract class Light<T extends Light<T>> extends ComponentData<T> {
-    // FIXME: improve default value support for matrix types
-    @Factory(DefaultColorFactory.class)
+    @DefaultColor(red=0.2, green=0.2, blue=0.2)
     private ColorRGBProperty color;
     
     @Unmanaged
     protected void onSet(int index) {
         color.get(index, cache);
     }
-    
-    private static class DefaultColorFactory extends AbstractPropertyFactory<ColorRGBProperty> {
-        public static final ColorRGB DEFAULT_COLOR = new ColorRGB(.2, .2, .2);
-        
-        @Override
-        public ColorRGBProperty create() {
-            return new ColorRGBProperty();
-        }
-
-        @Override
-        public void setDefaultValue(ColorRGBProperty property, int index) {
-            property.set(DEFAULT_COLOR, index);
-        }
-    }
 }

File ferox-scene/src/main/java/com/ferox/scene/Renderable.java

 import com.lhkbob.entreri.Controller;
 import com.lhkbob.entreri.Entity;
 import com.lhkbob.entreri.TypeId;
-import com.lhkbob.entreri.annot.ElementSize;
-import com.lhkbob.entreri.annot.Unmanaged;
+import com.lhkbob.entreri.Unmanaged;
+import com.lhkbob.entreri.property.ElementSize;
 import com.lhkbob.entreri.property.IntProperty;
 import com.lhkbob.entreri.property.ObjectProperty;
 

File ferox-scene/src/main/java/com/ferox/scene/SpotLight.java

 import com.ferox.math.Const;
 import com.ferox.math.Vector3;
 import com.ferox.math.entreri.Vector3Property;
+import com.ferox.math.entreri.Vector3Property.DefaultVector3;
 import com.lhkbob.entreri.TypeId;
-import com.lhkbob.entreri.annot.DefaultValue;
-import com.lhkbob.entreri.annot.Factory;
-import com.lhkbob.entreri.annot.Unmanaged;
-import com.lhkbob.entreri.property.AbstractPropertyFactory;
+import com.lhkbob.entreri.Unmanaged;
 import com.lhkbob.entreri.property.DoubleProperty;
+import com.lhkbob.entreri.property.DoubleProperty.DefaultDouble;
 
 /**
  * <p>
      */
     public static final TypeId<SpotLight> ID = TypeId.get(SpotLight.class);
     
-    @Factory(DefaultDirectionFactory.class)
+    @DefaultVector3(x=0.0, y=0.0, z=1.0)
     private Vector3Property direction;
     
-    @DefaultValue(defaultDouble=30.0)
+    @DefaultDouble(30.0)
     private DoubleProperty cutoffAngle;
     
     @Unmanaged
     protected void onSet(int index) {
         direction.get(index, dirCache);
     }
-    
-    private static class DefaultDirectionFactory extends AbstractPropertyFactory<Vector3Property> {
-        public static final Vector3 DEFAULT_DIR = new Vector3(0, 0, 1);
-        
-        @Override
-        public Vector3Property create() {
-            return new Vector3Property();
-        }
-
-        @Override
-        public void setDefaultValue(Vector3Property property, int index) {
-            property.set(DEFAULT_DIR, index);
-        }
-    }
 }
 

File ferox-scene/src/main/java/com/ferox/scene/Transform.java

 import com.ferox.math.Const;
 import com.ferox.math.Matrix4;
 import com.ferox.math.entreri.Matrix4Property;
+import com.ferox.math.entreri.Matrix4Property.DefaultMatrix4;
 import com.lhkbob.entreri.ComponentData;
 import com.lhkbob.entreri.TypeId;
-import com.lhkbob.entreri.annot.Factory;
-import com.lhkbob.entreri.annot.Unmanaged;
-import com.lhkbob.entreri.property.AbstractPropertyFactory;
+import com.lhkbob.entreri.Unmanaged;
 
 /**
  * <p>
      */
     public static final TypeId<Transform> ID = TypeId.get(Transform.class);
     
-    @Factory(IdentityPropertyFactory.class)
+    // the identity matrix
+    @DefaultMatrix4(m00=1.0, m01=0.0, m02=0.0, m03=0.0,
+                    m10=0.0, m11=1.0, m12=0.0, m13=0.0,
+                    m20=0.0, m21=0.0, m22=1.0, m23=0.0,
+                    m30=0.0, m31=0.0, m32=0.0, m33=1.0)
     private Matrix4Property matrix;
     
     @Unmanaged
     protected void onSet(int index) {
         matrix.get(index, cache);
     }
-    
-    private static class IdentityPropertyFactory extends AbstractPropertyFactory<Matrix4Property> {
-        private static final Matrix4 IDENTITY = new Matrix4().setIdentity();
-        
-        @Override
-        public Matrix4Property create() {
-            return new Matrix4Property();
-        }
-
-        @Override
-        public void setDefaultValue(Matrix4Property property, int index) {
-            property.set(IDENTITY, index);
-        }
-    }
 }

File ferox-scene/src/main/java/com/ferox/scene/Transparent.java

 
 import com.lhkbob.entreri.ComponentData;
 import com.lhkbob.entreri.TypeId;
-import com.lhkbob.entreri.annot.DefaultValue;
 import com.lhkbob.entreri.property.DoubleProperty;
+import com.lhkbob.entreri.property.DoubleProperty.DefaultDouble;
 
 /**
  * <p>
      */
     public static final TypeId<Transparent> ID = TypeId.get(Transparent.class);
     
-    @DefaultValue(defaultDouble=0.5)
+    @DefaultDouble(0.5)
     private DoubleProperty opacity;
 
     private Transparent() { }

File ferox-scene/src/main/java/com/ferox/scene/controller/ffp/RenderConnection.java

 import com.ferox.math.bounds.Frustum;
 import com.ferox.renderer.Surface;
 import com.ferox.scene.BlinnPhongMaterial;
-import com.ferox.scene.Fog;
+import com.ferox.scene.AtmosphericFog;
 import com.ferox.scene.TexturedMaterial;
 import com.ferox.scene.Camera;
 import com.ferox.util.Bag;
     }
 
     /**
-     * Add the given Fog to the scene. The densest fog that influences the
+     * Add the given AtmosphericFog to the scene. The densest fog that influences the
      * viewing location will be used to apply OpenGL eye-space fog to the
      * rendered scene.
      * 
-     * @param fog The Fog to add
+     * @param atmosphericFog The AtmosphericFog to add
      * @throws NullPointerException if fog is null
      */
-    public void addFog(Fog fog) {
+    public void addFog(AtmosphericFog atmosphericFog) {
         throw new UnsupportedOperationException();
     }