Commits

Michael Ludwig  committed e0e7570

Update majority of components to use new entity framework pattern.

  • Participants
  • Parent commits 08d1a68

Comments (0)

Files changed (21)

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

 package com.ferox.scene;
 
-import com.ferox.math.MutableVector3f;
-import com.ferox.math.ReadOnlyVector3f;
-import com.ferox.math.Vector3f;
+import com.ferox.math.Const;
+import com.ferox.math.Vector3;
 import com.ferox.math.entreri.Vector3Property;
-import com.googlecode.entreri.EntitySystem;
-import com.googlecode.entreri.property.FloatProperty;
+import com.lhkbob.entreri.annot.DefaultValue;
+import com.lhkbob.entreri.annot.Unmanaged;
+import com.lhkbob.entreri.property.DoubleProperty;
 
 /**
  * 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> {
-    public static final ReadOnlyVector3f DEFAULT_POSITION = new Vector3f();
+    @DefaultValue(defaultDouble=-1.0)
+    private DoubleProperty falloffDistance;
     
-    private FloatProperty falloffDistance;
     private Vector3Property position;
+    
+    @Unmanaged
+    private final Vector3 posCache = new Vector3();
 
-    protected AbstractPlacedLight(EntitySystem system, int index) {
-        super(system, index);
-    }
-
-    @Override
-    protected void init(Object... initParams) {
-        setFalloffDistance(-1f);
-        setPosition(DEFAULT_POSITION);
-    }
+    protected AbstractPlacedLight() { }
 
     /**
      * Return the local position of this light with respect to the owning
      * entity's coordinate space. If the entity has no defined coordinate space,
-     * its in world space. The returned vector is a cached instance shared
-     * within the component's EntitySystem, so it should be cloned before
-     * accessing another component of this type.
+     * its in world space. The returned Vector3 instance
+     * is reused by this Light instance so it should be cloned before
+     * changing which Component is referenced
      * 
      * @return The position of the light
      */
-    public final ReadOnlyVector3f getPosition() {
-        return position.get(getIndex());
-    }
-
-    /**
-     * Return the local position of this light in <tt>store</tt>. If store is
-     * null, a new vector is created to hold the position and returned.
-     * 
-     * @param store The result vector to hold the position
-     * @return The local position in store, or a new vector if store was null
-     */
-    public final MutableVector3f getPosition(MutableVector3f store) {
-        return position.get(getIndex(), store);
+    public final @Const Vector3 getPosition() {
+        return posCache;
     }
 
     /**
      * @throws NullPointerException if pos is null
      */
     @SuppressWarnings("unchecked")
-    public final T setPosition(ReadOnlyVector3f pos) {
+    public final T setPosition(@Const Vector3 pos) {
         if (pos == null)
             throw new NullPointerException("Position cannot be null");
+        posCache.set(pos);
         position.set(pos, getIndex());
         return (T) this;
     }
      * @return This light for chaining purposes
      */
     @SuppressWarnings("unchecked")
-    public final T setFalloffDistance(float distance) {
+    public final T setFalloffDistance(double distance) {
         // No argument checking, a negative distance disables
         // light falloff so every value is supported
         falloffDistance.set(distance, getIndex(), 0);
      * 
      * @return The falloff distance
      */
-    public final float getFalloffDistance() {
+    public final double getFalloffDistance() {
         return falloffDistance.get(getIndex(), 0);
     }
+    
+    @Override
+    protected void onSet(int index) {
+        position.get(index, posCache);
+    }
 }

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

 package com.ferox.scene;
 
-import com.googlecode.entreri.Component;
-import com.googlecode.entreri.EntitySystem;
-import com.googlecode.entreri.TypedId;
+import com.lhkbob.entreri.TypeId;
 
 /**
  * AmbientLight represents a source of ambient light in a scene. Ambient lights
     /**
      * The shared TypedId representing AmbientLight.
      */
-    public static final TypedId<AmbientLight> ID = Component.getTypedId(AmbientLight.class);
+    public static final TypeId<AmbientLight> ID = TypeId.get(AmbientLight.class);
     
-    private AmbientLight(EntitySystem system, int index) {
-        super(system, index);
-    }
+    private AmbientLight() { }
 }

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

 package com.ferox.scene;
 
-import com.googlecode.entreri.Component;
-import com.googlecode.entreri.EntitySystem;
-import com.googlecode.entreri.TypedId;
-import com.googlecode.entreri.property.FloatProperty;
+import com.lhkbob.entreri.TypeId;
+import com.lhkbob.entreri.annot.DefaultValue;
+import com.lhkbob.entreri.property.DoubleProperty;
 
 /**
  * <p>
  * objects. This separation was done so that other lighting models can be added
  * but still enable the use of the color providing components.
  * </p>
- * <p>
- * BlinnPhongMaterial inherits Material's single initialization parameter of a
- * VertexAttribute for its normals.
- * </p>
  * 
  * @author Michael Ludwig
  */
     /**
      * The shared TypedId representing BlinnPhongMaterial.
      */
-    public static final TypedId<BlinnPhongMaterial> ID = Component.getTypedId(BlinnPhongMaterial.class);
+    public static final TypeId<BlinnPhongMaterial> ID = TypeId.get(BlinnPhongMaterial.class);
     
-    private FloatProperty shininess;
-
-    protected BlinnPhongMaterial(EntitySystem system, int index) {
-        super(system, index);
-    }
+    @DefaultValue(defaultDouble=1.0)
+    private DoubleProperty shininess;
     
-    @Override
-    protected void init(Object... initParams) {
-        super.init(initParams); // just pass as-is, since we don't define any more
-        setShininess(1f);
-    }
+    private BlinnPhongMaterial() { }
 
     /**
      * Set the shininess exponent to use with this material. The shininess
      * @param shiny The new shininess exponent
      * @throws IllegalArgumentException if shiny is less than 0
      */
-    public void setShininess(float shiny) {
+    public void setShininess(double shiny) {
         if (shiny < 0f)
             throw new IllegalArgumentException("Shininess must be positive, not: " + shiny);
         shininess.set(shiny, getIndex(), 0);
      * 
      * @return The shininess exponent, will be at least 0
      */
-    public float getShininess() {
+    public double getShininess() {
         return shininess.get(getIndex(), 0);
     }
 }

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

 package com.ferox.scene;
 
-import com.ferox.math.Color3f;
-import com.ferox.math.ReadOnlyColor3f;
+import com.ferox.math.ColorRGB;
+import com.ferox.math.Const;
 import com.ferox.math.entreri.ColorRGBProperty;
-import com.googlecode.entreri.Component;
-import com.googlecode.entreri.EntitySystem;
+import com.lhkbob.entreri.ComponentData;
+import com.lhkbob.entreri.annot.Unmanaged;
 
 /**
  * <p>
  * Entity's material, there will often be similar Components extending from
  * {@link TextureMap} that function the same, but can act on a per-pixel basis.
  * </p>
- * <p>
- * ColorComponent does not define any initialization parameters.
- * </p>
  * 
  * @author Michael Ludwig
  * @param <T> The concrete type of ColorComponent
  */
-public abstract class ColorComponent<T extends ColorComponent<T>> extends Component {
-    public static final ReadOnlyColor3f DEFAULT_COLOR = new Color3f(.5f, .5f, .5f);
+public abstract class ColorComponent<T extends ColorComponent<T>> extends ComponentData<T> {
+    private ColorRGBProperty color;
     
-    private ColorRGBProperty color;
+    @Unmanaged
+    private final ColorRGB cache = new ColorRGB();
 
-    protected ColorComponent(EntitySystem system, int index) {
-        super(system, index);
-    }
-    
-    @Override
-    protected void init(Object... initParams) {
-        setColor(DEFAULT_COLOR);
-    }
+    protected ColorComponent() { }
 
     /**
      * Return the color stored by this component. This color will be used for
      * 
      * @return This component's color
      */
-    public final ReadOnlyColor3f getColor() {
-        return color.get(getIndex());
-    }
-
-    /**
-     * Return the color of this component in <tt>store</tt>. If store is null, a
-     * new color is created to hold the position and returned.
-     * 
-     * @param store The result color to hold the color
-     * @return The color in store, or a new vector if store was null
-     */
-    public final Color3f getPosition(Color3f store) {
-        return color.get(getIndex(), store);
+    public final @Const ColorRGB getColor() {
+        return cache;
     }
 
     /**
      * @throws NullPointerException if color is null
      */
     @SuppressWarnings("unchecked")
-    public final T setColor(ReadOnlyColor3f color) {
+    public final T setColor(@Const ColorRGB color) {
         if (color == null)
             throw new NullPointerException("Color cannot be null");
+        cache.set(color);
         this.color.set(color, getIndex());
         return (T) this;
     }
+    
+    @Override
+    protected void onSet(int index) {
+        color.get(index, cache);
+    }
 }

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

 
 import com.ferox.resource.Texture;
 import com.ferox.resource.TextureFormat;
-import com.googlecode.entreri.Component;
-import com.googlecode.entreri.EntitySystem;
-import com.googlecode.entreri.TypedId;
+import com.lhkbob.entreri.TypeId;
 
 /**
  * <p>
  * format, then the depth values are packed into the range [0, 1] and are
  * converted to [-.5, .5] with <code>d - .5</code> when used in a shader.
  * </p>
- * <p>
- * DepthOffsetMap inherits TextureMap's two initialization parameters: a
- * Texture, and a VertexAttribute.
- * </p>
  * 
  * @author Michael Ludwig
  */
     /**
      * The shared TypedId representing DepthOffsetMap.
      */
-    public static final TypedId<DepthOffsetMap> ID = Component.getTypedId(DepthOffsetMap.class);
+    public static final TypeId<DepthOffsetMap> ID = TypeId.get(DepthOffsetMap.class);
     
-    private DepthOffsetMap(EntitySystem system, int index) {
-        super(system, index);
-    }
+    private DepthOffsetMap() { }
 
     @Override
     protected void validate(Texture tex) {

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

 package com.ferox.scene;
 
-import com.googlecode.entreri.Component;
-import com.googlecode.entreri.EntitySystem;
-import com.googlecode.entreri.TypedId;
+import com.lhkbob.entreri.TypeId;
 
 /**
  * <p>
  * lighting model, the diffuse color should be used to render the Entity as a
  * solid without lighting.
  * </p>
- * <p>
- * DiffuseColor does not have any initialization parameters.
- * </p>
  * 
  * @see DiffuseColorMap
  * @author Michael Ludwig
     /**
      * The shared TypedId representing DiffuseColor.
      */
-    public static final TypedId<DiffuseColor> ID = Component.getTypedId(DiffuseColor.class);
+    public static final TypeId<DiffuseColor> ID = TypeId.get(DiffuseColor.class);
     
-    private DiffuseColor(EntitySystem system, int index) {
-        super(system, index);
-    }
+    private DiffuseColor() { }
 }

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

 package com.ferox.scene;
 
 import com.ferox.resource.Texture;
-import com.googlecode.entreri.Component;
-import com.googlecode.entreri.EntitySystem;
-import com.googlecode.entreri.TypedId;
+import com.lhkbob.entreri.TypeId;
 
 /**
  * <p>
  * Entity is transparent, the opacity of the Transparent component and the
  * texture are multiplied together to get the final opacity for a pixel.
  * </p>
- * <p>
- * DiffuseColorMap inherits TextureMap's two initialization parameters: a
- * Texture, and a VertexAttribute.
- * </p>
  * 
  * @author Michael Ludwig
  */
     /**
      * The shared TypedId representing DiffuseColorMap.
      */
-    public static final TypedId<DiffuseColorMap> ID = Component.getTypedId(DiffuseColorMap.class);
+    public static final TypeId<DiffuseColorMap> ID = TypeId.get(DiffuseColorMap.class);
 
-    private DiffuseColorMap(EntitySystem system, int index) {
-        super(system, index);
-    }
+    private DiffuseColorMap() { }
 
     @Override
     protected void validate(Texture tex) {

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

 package com.ferox.scene;
 
-import com.ferox.math.MutableVector3f;
-import com.ferox.math.ReadOnlyVector3f;
-import com.ferox.math.Vector3f;
+import com.ferox.math.Const;
+import com.ferox.math.Vector3;
 import com.ferox.math.entreri.Vector3Property;
-import com.googlecode.entreri.Component;
-import com.googlecode.entreri.EntitySystem;
-import com.googlecode.entreri.TypedId;
+import com.lhkbob.entreri.TypeId;
+import com.lhkbob.entreri.annot.Factory;
+import com.lhkbob.entreri.annot.Unmanaged;
+import com.lhkbob.entreri.property.AbstractPropertyFactory;
 
 /**
  * <p>
  * influence, but this all depends on the components used and the controller
  * implementations.
  * </p>
- * <p>
- * DirectionLight does not have any initialization parameters.
- * </p>
  * 
  * @author Michael Ludwig
  */
     /**
      * The shared TypedId representing DirectionLight.
      */
-    public static final TypedId<DirectionLight> ID = Component.getTypedId(DirectionLight.class);
+    public static final TypeId<DirectionLight> ID = TypeId.get(DirectionLight.class);
     
-    public static final ReadOnlyVector3f DEFAULT_DIRECTION = new Vector3f(0f, 0f, 1f);
+    @Factory(DefaultDirectionFactory.class)
+    private Vector3Property direction;
     
-    private Vector3Property direction;
+    @Unmanaged
+    private final Vector3 dirCache = new Vector3();
 
-    private DirectionLight(EntitySystem system, int index) {
-        super(system, index);
-    }
+    private DirectionLight() { }
     
-    @Override
-    protected void init(Object... initParams) {
-        super.init(initParams);
-        setDirection(DEFAULT_DIRECTION);
-    }
-
     /**
      * Set the direction of this light. This copies <tt>dir</tt>, so any future
      * changes to the input vector will not affect this DirectionLight. If this
      * @throws NullPointerException if dir is null
      * @throws ArithmeticException if dir cannot be normalized
      */
-    public DirectionLight setDirection(ReadOnlyVector3f dir) {
+    public DirectionLight setDirection(@Const Vector3 dir) {
         if (dir == null)
             throw new NullPointerException("Direction vector cannot be null");
+        dirCache.set(dir);
         direction.set(dir.normalize(null), getIndex());
         return this;
     }
      * Get the normalized direction vector for this light. If this
      * DirectionLight is combined with another transform, this vector should be
      * transformed by it before used in lighting calculations. The returned
-     * vector is a cached instance shared within the component's EntitySystem,
-     * so it should be cloned before accessing another component of this type.
+     * Vector3 instance is reused by this Light instance so it should be cloned
+     * before changing which Component is referenced.
      * 
      * @return The normalized direction vector
      */
-    public ReadOnlyVector3f getDirection() {
-        return direction.get(getIndex());
+    public @Const Vector3 getDirection() {
+        return dirCache;
     }
     
-    /**
-     * Return the local direction of this light in <tt>store</tt>. If store is
-     * null, a new vector is created to hold the direction and returned.
-     * 
-     * @param store The result vector to hold the direction
-     * @return The local direction in store, or a new vector if store was null
-     */
-    public final MutableVector3f getDirection(MutableVector3f store) {
-        return direction.get(getIndex(), store);
+    @Override
+    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/EmittedColor.java

 package com.ferox.scene;
 
-import com.googlecode.entreri.Component;
-import com.googlecode.entreri.EntitySystem;
-import com.googlecode.entreri.TypedId;
+import com.lhkbob.entreri.TypeId;
 
 /**
  * <p>
  * material. The color stored in this EmittedColor should be considered to have
  * HDR color values when relevant.
  * </p>
- * <p>
- * EmittedColor does not have any initialization parameters.
- * </p>
  * 
  * @see EmittedColorMap
  * @author Michael Ludwig
     /**
      * The shared TypedId representing EmittedColor.
      */
-    public static final TypedId<EmittedColor> ID = Component.getTypedId(EmittedColor.class);
+    public static final TypeId<EmittedColor> ID = TypeId.get(EmittedColor.class);
     
-    private EmittedColor(EntitySystem system, int index) {
-        super(system, index);
-    }
+    private EmittedColor() { }
 }

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

 package com.ferox.scene;
 
 import com.ferox.resource.Texture;
-import com.googlecode.entreri.Component;
-import com.googlecode.entreri.EntitySystem;
-import com.googlecode.entreri.TypedId;
+import com.lhkbob.entreri.TypeId;
 
 /**
  * <p>
  * texture mapping should likely match the texture mapping used for a
  * {@link DiffuseColorMap}.
  * </p>
- * <p>
- * EmittedColorMap inherits TextureMap's two initialization parameters: a
- * Texture, and a VertexAttribute.
- * </p>
  * 
  * @author Michael Ludwig
  */
     /**
      * The shared TypedId representing DepthOffsetMap.
      */
-    public static final TypedId<EmittedColorMap> ID = Component.getTypedId(EmittedColorMap.class);
+    public static final TypeId<EmittedColorMap> ID = TypeId.get(EmittedColorMap.class);
 
-    private EmittedColorMap(EntitySystem system, int index) {
-        super(system, index);
-    }
+    private EmittedColorMap() { }
 
     @Override
     protected void validate(Texture tex) {

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

  * 
  * @author Michael Ludwig
  */
+// FIXME: Rename AtmosphericFog
 public final class Fog extends TypedComponent<Fog> {
     /**
      * The shared TypedId representing Fog.

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

 package com.ferox.scene;
 
-import com.ferox.math.Color3f;
-import com.ferox.math.ReadOnlyColor3f;
+import com.ferox.math.ColorRGB;
+import com.ferox.math.Const;
 import com.ferox.math.entreri.ColorRGBProperty;
-import com.googlecode.entreri.Component;
-import com.googlecode.entreri.EntitySystem;
+import com.lhkbob.entreri.ComponentData;
+import com.lhkbob.entreri.annot.Factory;
+import com.lhkbob.entreri.annot.Unmanaged;
+import com.lhkbob.entreri.property.AbstractPropertyFactory;
 
 /**
  * <p>
  * @author Michael Ludwig
  * @param <T> The concrete type of light
  */
-public abstract class Light<T extends Light<T>> extends Component {
-    public static final ReadOnlyColor3f DEFAULT_COLOR = new Color3f(.2f, .2f, .2f);
+public abstract class Light<T extends Light<T>> extends ComponentData<T> {
+    // FIXME: improve default value support for matrix types
+    @Factory(DefaultColorFactory.class)
+    private ColorRGBProperty color;
+    
+    @Unmanaged
+    private final ColorRGB cache = new ColorRGB();
 
-    private ColorRGBProperty color;
-
-    protected Light(EntitySystem system, int index) {
-        super(system, index);
-    }
+    protected Light() { }
     
-    
-    @Override
-    protected void init(Object... initParams) {
-        setColor(DEFAULT_COLOR);
-    }
-
     /**
-     * Return the color of this Light. The returned color is a cached instance
-     * shared within the component's EntitySystem, so it should be cloned before
-     * accessing another component of this type.
+     * Return the color of this Light. The returned ColorRGB instance is reused
+     * by this Light instance so it should be cloned before changing which
+     * Component is referenced.
      * 
      * @return The color of this Light
      */
-    public final ReadOnlyColor3f getColor() {
-        return color.get(getIndex());
+    public final @Const ColorRGB getColor() {
+        return cache;
     }
     
     /**
-     * Return the color of this light in <tt>store</tt>. If store is
-     * null, a new ColorRGB is created to hold the color and returned.
-     * 
-     * @param store The result ColorRGB to hold the color
-     * @return The color in store, or a new vector if store was null
-     */
-    public final Color3f getPosition(Color3f store) {
-        return color.get(getIndex(), store);
-    }
-
-    /**
      * Set the color of this Light. The color values in <tt>color</tt> are
      * copied into an internal instance, so any future changes to <tt>color</tt>
      * will not affect this Component.
      * @throws NullPointerException if color is null
      */
     @SuppressWarnings("unchecked")
-    public final T setColor(ReadOnlyColor3f color) {
+    public final T setColor(@Const ColorRGB color) {
         if (color == null)
             throw new NullPointerException("Color cannot be null");
+        cache.set(color);
         this.color.set(color, getIndex());
         return (T) this;
     }
+    
+    @Override
+    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/Material.java

 
 import com.ferox.resource.BufferData.DataType;
 import com.ferox.resource.VertexAttribute;
-import com.googlecode.entreri.Controller;
-import com.googlecode.entreri.Entity;
-import com.googlecode.entreri.EntitySystem;
-import com.googlecode.entreri.InitParams;
-import com.googlecode.entreri.property.ObjectProperty;
+import com.lhkbob.entreri.Controller;
+import com.lhkbob.entreri.Entity;
+import com.lhkbob.entreri.property.ObjectProperty;
 
 /**
  * <p>
  * rendered without any light shading. It is undefined what it means to have an
  * entity with multiple lighting models.
  * </p>
- * <p>
- * Material defines one initialization parameter, a VertexAttribute, that will
- * be passed to {@link #setNormals(VertexAttribute)}.
- * </p>
  * 
  * @author Michael Ludwig
  * @param <T> The concrete type of Material
  */
-// FIXME: this init param might not be needed, since a null normal vector set
-// can be replaced by an object-space normal map
-@InitParams(VertexAttribute.class)
-public abstract class Material<T extends Material<T>> extends EntitySetComponent {
+public abstract class Material<T extends Material<T>> extends EntitySetComponent<T> {
     private ObjectProperty<VertexAttribute> normals;
 
-    protected Material(EntitySystem system, int index) {
-        super(system, index);
-    }
+    protected Material() { }
     
-    @Override
-    protected void init(Object... initParams) {
-        super.init();
-        setNormals((VertexAttribute) initParams[0]);
-    }
-
     /**
      * Set the normal vectors store per-vertex normal data used when computing
      * lighting. Normals are used when rendering an entity that is a

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

 import com.ferox.resource.Texture;
 import com.ferox.resource.TextureFormat;
 import com.ferox.resource.VertexAttribute;
-import com.googlecode.entreri.Component;
-import com.googlecode.entreri.EntitySystem;
-import com.googlecode.entreri.InitParams;
-import com.googlecode.entreri.TypedId;
-import com.googlecode.entreri.property.ObjectProperty;
+import com.lhkbob.entreri.TypeId;
+import com.lhkbob.entreri.property.ObjectProperty;
 
 /**
  * <p>
  * triangle. These attributes must be provided or configured else where because
  * it is likely to depend on the controllers actually rendering the Entities.
  * </p>
- * <p>
- * NormalMap defines three initialization parameters: a Texture, a
- * VertexAttribute for texture coordinate access, and a VertexAttribute
- * representing tangent vectors for each vertex. The tangent vector parameter
- * can be null.
- * </p>
  * 
  * @author Michael Ludwig
  */
-@InitParams({Texture.class, VertexAttribute.class, VertexAttribute.class})
 public final class NormalMap extends TextureMap<NormalMap> {
     /**
      * The shared TypedId representing NormalMap.
      */
-    public static final TypedId<NormalMap> ID = Component.getTypedId(NormalMap.class);
+    public static final TypeId<NormalMap> ID = TypeId.get(NormalMap.class);
     
     private ObjectProperty<VertexAttribute> tangentVectors;
 
-    private NormalMap(EntitySystem system, int index) {
-        super(system, index);
-    }
+    private NormalMap() { }
     
-    @Override
-    protected void init(Object... initParams) {
-        super.init(initParams[0], initParams[1]);
-        setTangents((VertexAttribute) initParams[2]);
-    }
-
     /**
      * Return whether or not the normal vectors are in object space or tangent
      * space. See {@link #setTangents(boolean)} for details.

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

 package com.ferox.scene;
 
-import com.googlecode.entreri.Component;
-import com.googlecode.entreri.EntitySystem;
-import com.googlecode.entreri.TypedId;
+import com.lhkbob.entreri.TypeId;
 
 /**
  * <p>
  * identically to how SpotLight and DirectionLight can be modified by a
  * transform to position them within a scene.
  * </p>
- * <p>
- * PointLight defines no initialization parameters.
- * </p>
  * 
  * @author Michael Ludwig
  */
     /**
      * The shared TypedId representing PointLight.
      */
-    public static final TypedId<PointLight> ID = Component.getTypedId(PointLight.class);
+    public static final TypeId<PointLight> ID = TypeId.get(PointLight.class);
     
-    private PointLight(EntitySystem system, int index) {
-        super(system, index);
-    }
+    private PointLight() { }
 }

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

 package com.ferox.scene;
 
-import com.googlecode.entreri.Component;
-import com.googlecode.entreri.EntitySystem;
-import com.googlecode.entreri.TypedId;
+import com.lhkbob.entreri.TypeId;
 
 /**
  * <p>
  * fractions of light that are reflected so the only meaningful values are in
  * the range [0, 1]. HDR color values are not used.
  * </p>
- * <p>
- * SpecularColor does not define any initialization parameters.
- * </p>
  * 
  * @see SpecularColorMap
  * @author Michael Ludwig
     /**
      * The shared TypedId representing SpecularColor.
      */
-    public static final TypedId<SpecularColor> ID = Component.getTypedId(SpecularColor.class);
+    public static final TypeId<SpecularColor> ID = TypeId.get(SpecularColor.class);
     
-    private SpecularColor(EntitySystem system, int index) {
-        super(system, index);
-    }
+    private SpecularColor() { }
 }

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

 package com.ferox.scene;
 
 import com.ferox.resource.Texture;
-import com.googlecode.entreri.Component;
-import com.googlecode.entreri.EntitySystem;
-import com.googlecode.entreri.TypedId;
+import com.lhkbob.entreri.TypeId;
 
 /**
  * <p>
  * texture mapping should likely match the texture mapping used for a
  * {@link DiffuseColorMap}.
  * </p>
- * <p>
- * SpecularColorMap inherits TextureMap's two initialization parameters: a
- * Texture, and a VertexAttribute.
- * </p>
  * 
  * @author Michael Ludwig
  */
     /**
      * The shared TypedId representing DepthOffsetMap.
      */
-    public static final TypedId<SpecularColorMap> ID = Component.getTypedId(SpecularColorMap.class);
+    public static final TypeId<SpecularColorMap> ID = TypeId.get(SpecularColorMap.class);
     
-    private SpecularColorMap(EntitySystem system, int index) {
-        super(system, index);
-    }
+    private SpecularColorMap() { }
 
     @Override
     protected void validate(Texture tex) {

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

 package com.ferox.scene;
 
-import com.ferox.math.MutableVector3f;
-import com.ferox.math.ReadOnlyVector3f;
-import com.ferox.math.Vector3f;
+import com.ferox.math.Const;
+import com.ferox.math.Vector3;
 import com.ferox.math.entreri.Vector3Property;
-import com.googlecode.entreri.Component;
-import com.googlecode.entreri.EntitySystem;
-import com.googlecode.entreri.TypedId;
-import com.googlecode.entreri.property.FloatProperty;
+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.property.DoubleProperty;
 
 /**
  * <p>
  * direction before being transformed by any transform component. This is
  * provided to make it easier to manipulate the direction of the light.
  * </p>
- * <p>
- * SpotLight does not define any initialization parameters.
- * </p>
  * 
  * @author Michael Ludwig
  */
     /**
      * The shared TypedId representing SpotLight.
      */
-    public static final TypedId<SpotLight> ID = Component.getTypedId(SpotLight.class);
+    public static final TypeId<SpotLight> ID = TypeId.get(SpotLight.class);
     
-    public static final ReadOnlyVector3f DEFAULT_DIRECTION = new Vector3f(0f, 0f, 1f);
+    @Factory(DefaultDirectionFactory.class)
+    private Vector3Property direction;
     
-    private Vector3Property direction;
-    private FloatProperty cutoffAngle;
+    @DefaultValue(defaultDouble=30.0)
+    private DoubleProperty cutoffAngle;
+    
+    @Unmanaged
+    private final Vector3 dirCache = new Vector3();
 
-    private SpotLight(EntitySystem system, int index) {
-        super(system, index);
-    }
+    private SpotLight() { }
     
-    @Override
-    protected void init(Object... initParams) {
-        super.init(initParams);
-        setDirection(DEFAULT_DIRECTION);
-        setCutoffAngle(30f);
-    }
-
     /**
      * Return the cutoff angle, in degrees, representing the maximum angle light
      * will spread from the {@link #getDirection() direction vector}. This
      * 
      * @return The cutoff angle in degrees, will be in [0, 90]
      */
-    public float getCutoffAngle() {
+    public double getCutoffAngle() {
         return cutoffAngle.get(getIndex(), 0);
     }
 
      * @return This light for chaining purposes
      * @throws IllegalArgumentException if angle is not between 0 and 90
      */
-    public SpotLight setCutoffAngle(float angle) {
+    public SpotLight setCutoffAngle(double angle) {
         if (angle < 0 || angle > 90)
             throw new IllegalArgumentException("Illegal cutoff angle, must be in [0, 90], not: " + angle);
         cutoffAngle.set(angle, getIndex(), 0);
      * @throws NullPointerException if dir is null
      * @throws ArithmeticException if dir cannot be normalized
      */
-    public SpotLight setDirection(ReadOnlyVector3f dir) {
+    public SpotLight setDirection(@Const Vector3 dir) {
         if (dir == null)
             throw new NullPointerException("Direction vector cannot be null");
+        dirCache.set(dir);
         direction.set(dir.normalize(null), getIndex());
         return this;
     }
      * 
      * @return The normalized direction vector
      */
-    public ReadOnlyVector3f getDirection() {
-        return direction.get(getIndex());
+    public @Const Vector3 getDirection() {
+        return dirCache;
     }
+    
+    @Override
+    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();
+        }
 
-    /**
-     * Return the local direction of this light in <tt>store</tt>. If store is
-     * null, a new vector is created to hold the direction and returned.
-     * 
-     * @param store The result vector to hold the direction
-     * @return The local direction in store, or a new vector if store was null
-     */
-    public final MutableVector3f getDirection(MutableVector3f store) {
-        return direction.get(getIndex(), store);
+        @Override
+        public void setDefaultValue(Vector3Property property, int index) {
+            property.set(DEFAULT_DIR, index);
+        }
     }
 }
 

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

 import com.ferox.resource.BufferData.DataType;
 import com.ferox.resource.Texture;
 import com.ferox.resource.VertexAttribute;
-import com.googlecode.entreri.Component;
-import com.googlecode.entreri.EntitySystem;
-import com.googlecode.entreri.InitParams;
-import com.googlecode.entreri.property.ObjectProperty;
+import com.lhkbob.entreri.ComponentData;
+import com.lhkbob.entreri.property.ObjectProperty;
 
 /**
  * <p>
  * that store a single Texture, such as {@link NormalMap},
  * {@link DepthOffsetMap} and {@link DiffuseMap}.
  * </p>
- * <p>
- * TextureMap defines two initialization parameters, the starting Texture and
- * VertexAttribute representing the texture coordinates. They cannot be null.
- * </p>
  * 
  * @author Michael Ludwig
  * @param <T> Concrete TextureMap type
  */
-// FIXME: Do we require texture coordinates? How can we support texture generation modes?
-// I don't know, is it necessary to? Or can they be from specialized components only like
-// a shadow map or reflection?
-// FIXME: should I add ShadowMap as a component where it's required to provide the texture
-// to use? No because they could just have the texture be a regular one and not one attached
-// to a TextureSurface -> although that would technically allow for static/CPU computed shadow
-// maps with a higher resolution.
-// - However, it might not properly support cascade or other algorithms as well that require
-//   multiple textures.
-@InitParams({Texture.class, VertexAttribute.class})
-public abstract class TextureMap<T extends TextureMap<T>> extends Component {
+public abstract class TextureMap<T extends TextureMap<T>> extends ComponentData<T> {
     private ObjectProperty<Texture> texture;
     private ObjectProperty<VertexAttribute> textureCoordinates;
 
-    protected TextureMap(EntitySystem system, int index) {
-        super(system, index);
-    }
-    
-    @Override
-    protected void init(Object... initParams) {
-        setTexture((Texture) initParams[0]);
-        setTextureCoordinates((VertexAttribute) initParams[1]);
-    }
+    protected TextureMap() { }
     
     /**
      * @return The texture coordinates used to access this TextureMap's texture

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

  * a system (i.e. the world). This can be used to place lights, physics objects,
  * or objects to be rendered.
  * </p>
- * <p>
- * Transform does not define any initialization parameters.
- * </p>
  * 
  * @author Michael Ludwig
  */

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

  * (such as a particle system). This behavior also depends on the controllers
  * used to process the scene.
  * </p>
- * <p>
- * Transparent does not define any initialization parameters.
- * </p>
  * 
  * @author Michael Ludwig
  */