public class World extends java.lang.Object
ViewPoint3D) is
specified externally. Objects in the world are assigned to a partition,
providing the ability to group objects.| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_PARTITION_KEY
The default partition key.
|
| Constructor and Description |
|---|
World()
Creates a new empty world.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(Object3D object)
Adds an object to the world in the default partition.
|
void |
add(java.lang.String partition,
Object3D object)
Adds an object to a specific partition.
|
void |
addAll(java.util.Collection<Object3D> objects)
Adds a collection of objects to the world (in the default
partition).
|
Point3D[] |
calculateEyeCoordinates(ViewPoint3D vp)
Returns an array containing the vertices for all objects in this
world, transformed to eye coordinates.
|
java.awt.geom.Point2D[] |
calculateProjectedPoints(ViewPoint3D vp,
double d)
Calculates the projected points in 2D-space for all the vertices of the
objects in the world.
|
void |
clear(java.lang.String partitionKey)
Clears any objects belonging to the specified partition.
|
java.util.List<Face> |
getFaces()
Fetches the faces for all the objects in this world, updating the
offset to match the current position.
|
java.util.List<Object3D> |
getObjects()
Returns a newly created list containing all the objects in the world
model.
|
double |
getSunX()
Returns the x-component of the sunlight vector.
|
double |
getSunY()
Returns the y-component of the sunlight vector.
|
double |
getSunZ()
Returns the z-component of the sunlight vector.
|
int |
getVertexCount()
Returns the total number of vertices for all objects in this world.
|
void |
setSunSource(double x,
double y,
double z)
Sets the light source point.
|
void |
setSunSource(Point3D p)
Sets the light source point.
|
public static final java.lang.String DEFAULT_PARTITION_KEY
public World()
public double getSunX()
public double getSunY()
public double getSunZ()
public final void setSunSource(double x, double y, double z)
x - the x-coordinate.y - the y-coordinate.z - the z-coordinate.public final void setSunSource(Point3D p)
p - the point (null not permitted).public void add(Object3D object)
object - the object (null not permitted).public void add(java.lang.String partition, Object3D object)
partition - the partition (null not permitted).object - the object (null not permitted).public void addAll(java.util.Collection<Object3D> objects)
objects - the objects (null not permitted).public void clear(java.lang.String partitionKey)
partitionKey - the partition key (null not permitted).public int getVertexCount()
public Point3D[] calculateEyeCoordinates(ViewPoint3D vp)
vp - the view point (null not permitted).public java.awt.geom.Point2D[] calculateProjectedPoints(ViewPoint3D vp, double d)
vp - the view point (null not permitted).d - the distance.public java.util.List<Face> getFaces()
public java.util.List<Object3D> getObjects()