public final class Primitive
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
RELATIVE_OFFSET_SHAPE_OFFSET
The relative offset of the Shape Offset parameter in the
float array. |
static int |
RELATIVE_OFFSET_SHAPE_TYPE
The relative offset of the Shape Type parameter in the
float array. |
static int |
RELATIVE_OFFSET_SURFACE_OFFSET
The relative offset of the Surface Offset parameter in the
float array. |
static int |
SIZE
The size of a
Primitive in the float array. |
Constructor and Description |
---|
Primitive(Shape shape,
Surface surface)
Constructs a new
Primitive instance. |
Primitive(Shape shape,
Surface surface,
Matrix44F objectToWorld)
Constructs a new
Primitive instance. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object object)
Compares
object to this Primitive instance for equality. |
Matrix44F |
getObjectToWorld()
Returns the
Matrix44F to transform from object-space to world-space. |
Shape |
getShape()
Returns the
Shape assigned to this Primitive instance. |
Surface |
getSurface()
Returns the
Surface assigned to this Primitive instance. |
Matrix44F |
getWorldToObject()
Returns the
Matrix44F to transform from world-space to object-space. |
int |
hashCode()
Returns a hash code for this
Primitive instance. |
void |
setObjectToWorld(Matrix44F objectToWorld)
Sets the
Matrix44F to transform from object-space to world-space and updates the Matrix44F to transform from world-space to object-space. |
void |
setShape(Shape shape)
Sets the
Shape for this Primitive instance. |
void |
setSurface(Surface surface)
Sets the
Surface for this Primitive instance. |
void |
setWorldToObject(Matrix44F worldToObject)
Sets the
Matrix44F to transform from world-space to object-space and updates the Matrix44F to transform from object-space to world-space. |
java.lang.String |
toString()
Returns a
String representation of this Primitive instance. |
public static final int RELATIVE_OFFSET_SHAPE_OFFSET
float
array. The value is 1
.public static final int RELATIVE_OFFSET_SHAPE_TYPE
float
array. The value is 1
.public static final int RELATIVE_OFFSET_SURFACE_OFFSET
float
array. The value is 2
.public static final int SIZE
Primitive
in the float
array. The size is 3
.public Primitive(Shape shape, Surface surface)
Primitive
instance.
If either shape
or surface
are null
, a NullPointerException
will be thrown.
public Primitive(Shape shape, Surface surface, Matrix44F objectToWorld)
Primitive
instance.
If either shape
, surface
or objectToWorld
are null
, a NullPointerException
will be thrown.
If objectToWorld
cannot be inversed, an IllegalStateException
will be thrown.
shape
- the Shape
to usesurface
- the Surface
to useobjectToWorld
- the Matrix44F
to transform from object-space to world-spacejava.lang.IllegalStateException
- thrown if, and only if, objectToWorld
cannot be inversedjava.lang.NullPointerException
- thrown if, and only if, either shape
, surface
or objectToWorld
are null
public Matrix44F getObjectToWorld()
Matrix44F
to transform from object-space to world-space.Matrix44F
to transform from object-space to world-spacepublic Matrix44F getWorldToObject()
Matrix44F
to transform from world-space to object-space.Matrix44F
to transform from world-space to object-spacepublic Shape getShape()
Shape
assigned to this Primitive
instance.Shape
assigned to this Primitive
instancepublic java.lang.String toString()
String
representation of this Primitive
instance.toString
in class java.lang.Object
String
representation of this Primitive
instancepublic Surface getSurface()
Surface
assigned to this Primitive
instance.Surface
assigned to this Primitive
instancepublic boolean equals(java.lang.Object object)
object
to this Primitive
instance for equality.
Returns true
if, and only if, object
is an instance of Primitive
, and their respective values are equal, false
otherwise.
equals
in class java.lang.Object
object
- the Object
to compare to this Primitive
instance for equalitytrue
if, and only if, object
is an instance of Primitive
, and their respective values are equal, false
otherwisepublic int hashCode()
Primitive
instance.hashCode
in class java.lang.Object
Primitive
instancepublic void setObjectToWorld(Matrix44F objectToWorld)
Matrix44F
to transform from object-space to world-space and updates the Matrix44F
to transform from world-space to object-space.
If objectToWorld
is null
, a NullPointerException
will be thrown.
If objectToWorld
cannot be inversed, an IllegalStateException
will be thrown.
objectToWorld
- the new Matrix44F
to transform from object-space to world-spacejava.lang.IllegalStateException
- thrown if, and only if, objectToWorld
cannot be inversedjava.lang.NullPointerException
- thrown if, and only if, objectToWorld
is null
public void setShape(Shape shape)
Shape
for this Primitive
instance.
If shape
is null
, a NullPointerException
will be thrown.
shape
- the new Shape
java.lang.NullPointerException
- thrown if, and only if, shape
is null
public void setSurface(Surface surface)
Surface
for this Primitive
instance.
If surface
is null
, a NullPointerException
will be thrown.
surface
- the new Surface
java.lang.NullPointerException
- thrown if, and only if, surface
is null
public void setWorldToObject(Matrix44F worldToObject)
Matrix44F
to transform from world-space to object-space and updates the Matrix44F
to transform from object-space to world-space.
If worldToObject
is null
, a NullPointerException
will be thrown.
If worldToObject
cannot be inversed, an IllegalStateException
will be thrown.
worldToObject
- the new Matrix44F
to transform from world-space to object-spacejava.lang.IllegalStateException
- thrown if, and only if, worldToObject
cannot be inversedjava.lang.NullPointerException
- thrown if, and only if, worldToObject
is null