|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.threed.jpct.Object3D
public class Object3D
Object3D is a class for 3-dimensional objects. Don't let yourself fool by the similarity of the name to java.lang.Object. A 3-dimensional object as constructed by this class is usually added to an instance of World for rendering. One object should be added to only one instance of World at a time. Objects may be connected by defining them as childs/parents to build hierarchies among them. Dummy objects are also possible. They are usually not added to a World instance but binded to other objects (dummy or none-dummy). Some methods in this class require the instance to be added to an instance of World (using World.addObject()).
World
,
Serialized FormField Summary | |
---|---|
static boolean |
BILLBOARDING_DISABLED
The object won't use billboarding (default) |
static boolean |
BILLBOARDING_ENABLED
The object will use billboarding (i.e. it always faces the camera) |
static int |
COLLISION_CHECK_NONE
Don't perform any kind of collision detection for this object |
static int |
COLLISION_CHECK_OTHERS
Other Object3Ds/rays/spheres/ellipsoids may collide with this object |
static int |
COLLISION_CHECK_SELF
This Object3D may collide with other objects |
static boolean |
COLLISION_DETECTION_NOT_OPTIMIZED
Disables (default) an automated optimization for collision detection in case of problems with this optimization. |
static boolean |
COLLISION_DETECTION_OPTIMIZED
Enables an automated optimization for speeding up collision detection in some case. |
static float |
COLLISION_NONE
Signals that no collision has been detected for this object |
static boolean |
CULLING_DISABLED
Backface culling won't be applied to this object |
static boolean |
CULLING_ENABLED
Backface culling will be applied to this object before rendering |
static int |
ELLIPSOID_ALIGNED
The object's ellipsoid won't be transformed when performing collision detection (default). |
static int |
ELLIPSOID_TRANSFORMED
The object's ellipsoid will be transformed when performing collision detection. |
static boolean |
ENVMAP_DISABLED
Environment mapping is disabled |
static boolean |
ENVMAP_ENABLED
Environment mapping is enabled |
static int |
LIGHTING_ALL_ENABLED
Indicates that all kinds of light (lightsources, ambient and additional color) will be used on this object. |
static int |
LIGHTING_NO_LIGHTS
Indicates that no lightsources will be taken into account to calculate an object's lighting. |
static int |
NO_OBJECT
The "ID" of an Object3D that doesn't exist. |
static boolean |
OBJ_INVISIBLE
The object is invisible and won't be processed, rendered...nothing... |
static boolean |
OBJ_VISIBLE
The object is visible |
static float |
RAY_MISSES_BOX
Signals that a ray/box-intersection test has failed (the ray doesn't intersect with the box) |
static int |
SHADING_FAKED_FLAT
Indicates that (faked) flat shading should be used. |
static int |
SHADING_GOURAUD
Indicates that gouraud shading should be used (default) |
static boolean |
SPECULAR_DISABLED
Specular highLights won't be calculated |
static boolean |
SPECULAR_ENABLED
Specular highLights will be calculated |
static int |
TRANSPARENCY_MODE_ADD
An alternative transparency mode for additive blending. |
static int |
TRANSPARENCY_MODE_DEFAULT
The default transparency mode. |
static int |
UNKNOWN_OBJECTSIZE
The object is empty |
Constructor Summary | |
---|---|
Object3D(float[] coordinates,
float[] uvs,
int[] indices,
int textureId)
Constructor for creating an Object3D out of indexed geometry in bulk form. |
|
Object3D(int maxTriangles)
Creates a new instance of Object3D. |
|
Object3D(Object3D obj)
This constructor works similar to cloneObject() but it allows to extend Object3D and still use the static methods from Loader/Primitives by adding a call to super(Object3D) in the constructor of your class. |
|
Object3D(Object3D obj,
boolean reuseMesh)
This constructor works similar to cloneObject() but it allows to extend Object3D and still use the static methods from Loader/Primitives by adding a call to super(Object3D) in the constructor of your class. |
Method Summary | |
---|---|
void |
addChild(Object3D obj)
Defines an object as a child of this. |
void |
addCollisionListener(CollisionListener listener)
Adds a collision listener to this object. |
void |
addParent(Object3D obj)
Defines an object as a parent of this. this will inherit all transformations from its parent. |
int |
addTriangle(SimpleVector vert1,
float u,
float v,
SimpleVector vert2,
float u2,
float v2,
SimpleVector vert3,
float u3,
float v3)
Adds a triangle to the object. |
int |
addTriangle(SimpleVector vert1,
float u,
float v,
SimpleVector vert2,
float u2,
float v2,
SimpleVector vert3,
float u3,
float v3,
int textureID)
Adds a triangle to the object. |
int |
addTriangle(SimpleVector vert1,
float u,
float v,
SimpleVector vert2,
float u2,
float v2,
SimpleVector vert3,
float u3,
float v3,
int textureID,
int sec)
Adds a triangle to the object. |
int |
addTriangle(SimpleVector vert1,
SimpleVector vert2,
SimpleVector vert3)
Adds a triangle to the object. |
int |
addTriangle(SimpleVector vert1,
SimpleVector vert2,
SimpleVector vert3,
TextureInfo tInf)
Adds a triangle to the object. |
void |
align(Camera camera)
Aligns this object with a Camera using the camera's backbuffer matrix. |
void |
align(Object3D object)
Aligns this object with another Object3D. |
void |
animate(float index)
Calculates a new mesh for this object based on the keyframes of its animation sequence and "index". index is a value between 0 and 1 where 0 is the first keyframe and 1 the last. |
void |
animate(float index,
int seq)
Calculates a new mesh for this object based on the keyframes of its animation sub-sequence and "index". index is a value between 0 and 1 where 0 is the first keyframe and 1 the last (of the sub-sequence). |
void |
build()
Initializes some basic object properties that are needed for almost all further processing. build() has to be called if the object is "ready to render" (loaded, Textures assigned, placed, rendering modes set, animations and vertex controllers assigned). |
void |
build(boolean staticUV)
Initializes some basic object properties that are needed for almost all further processing. build() has to be called if the object is "ready to render" (loaded, Textures assigned, placed, rendering modes set, animations and vertex controllers assigned). |
void |
calcBoundingBox()
Calculates an AABB (Axis Aligned Bounding Box) for this object in object-space. |
void |
calcCenter()
Tries to calculate the center of the object using its mesh data. |
float |
calcMinDistance(SimpleVector org,
SimpleVector dr)
Returns the minimal distance to some polygon of the object from a particular position vector looking into a specific direction. |
float |
calcMinDistance(SimpleVector org,
SimpleVector dr,
float ignoreIfLarger)
Returns the minimal distance to some polygon of the object from a particular position vector looking into a specific direction. |
void |
calcNormals()
Calculates the object's vertex normals by calculating the face normals of the adjacent polygons of each vertex and averaging them. |
void |
calcTextureWrap()
"Wraps" a texture around the object. |
void |
calcTextureWrapSpherical()
"Wraps" a texture around the object in a spherical way. |
int |
checkForCollision(SimpleVector dirVec,
float step)
Checks if the current object collides with something when moving into a particular direction. |
SimpleVector |
checkForCollisionEllipsoid(SimpleVector translation,
SimpleVector ellipsoid,
int recursionDepth)
Checks if the current object collides with something when moving into a particular direction. |
SimpleVector |
checkForCollisionSpherical(SimpleVector translation,
float radius)
Checks if the current object collides with something when moving into a particular direction. |
void |
clearAdditionalColor()
Removes additional color information form the object. |
void |
clearAnimation()
Clears the animation for this object. |
void |
clearObject()
Clears the object by removing all vertex/mesh information from it. |
void |
clearRotation()
Resets the current rotation to the initial value, i.e. no rotation at all. |
void |
clearTranslation()
Resets the current translation to the initial value, i.e. no translation at all. |
Object3D |
cloneObject()
Clones the current object. |
void |
compile()
Mainly needed to ease porting from the desktop version of jPCT. |
void |
compile(boolean dynamic,
boolean staticUV)
Mainly needed to ease porting from the desktop version of jPCT. |
static Object3D |
createDummyObj()
Static method that creates a dummy Object3D. |
boolean |
cullingIsInverted()
Returns true, if inverted culling is used on this object. |
void |
decoupleMesh()
Decouples the current mesh from the object. |
void |
disableCollisionListeners()
Disables all collision listeners of this object, so that none of them will be notified in case of a collision. |
void |
disableLazyTransformations()
Disables "lazy transformations". |
void |
disableVertexSharing()
Disables the automatic vertex sharing that jPCT does for triangles added by addTriangle. |
boolean |
ellipsoidIntersectsAABB(SimpleVector org,
SimpleVector ellipsoid)
Checks if a given ellipsoid intersects the axis aligned bounding box (in object-space) of this object. |
void |
enableCollisionListeners()
(Re-)enables all collision listerner of this object. |
void |
enableLazyTransformations()
Enables "lazy transformations". |
void |
forceGeometryIndices(boolean force)
Forces the object to be compiled to indexed geometry no matter what. |
RGBColor |
getAdditionalColor()
Returns the additional color. |
Animation |
getAnimationSequence()
Returns the animation sequence. |
SimpleVector |
getCenter()
Returns the center of the object (in object-space, i.e. unaffected by any transformation). |
java.util.Iterator<CollisionListener> |
getCollisionListeners()
Returns the collision listeners of this object as an enumeration. |
boolean |
getCulling()
Returns the current culling mode. |
int |
getEllipsoidMode()
Returns the current ellipsoid mode. |
int |
getID()
Returns the object's ID. |
Matrix |
getInverseWorldTransformation()
|
Matrix |
getInverseWorldTransformation(Matrix mat)
|
int |
getLighting()
Gets the lighting mode. |
Mesh |
getMesh()
Returns the current mesh of the object. |
java.lang.String |
getName()
Returns the name of the object. |
static int |
getNextID()
Static method that returns the ID the next object will get. |
OcTree |
getOcTree()
Returns the OcTree assigned to this object or null, if none has been assigned. |
SimpleVector |
getOrigin()
Returns the origin of the object (as set by setOrigin()). |
Matrix |
getOriginMatrix()
Returns the object's origin-translation matrix. |
Object3D[] |
getParents()
Returns all parents of this Object3D in an array. |
PolygonManager |
getPolygonManager()
Returns the PolygonManager for this object. |
Matrix |
getRotationMatrix()
Returns the object's current rotation matrix. |
SimpleVector |
getRotationPivot()
Returns the rotation pivot of the object |
float |
getScale()
Returns the cumulated scale value for this object. |
Matrix |
getTextureMatrix()
Returns the current texture matrix of null if none is set. |
SimpleVector |
getTransformedCenter()
Returns the center of the object in worldspace, i.e. after the object's current transformations have been applied to it. |
SimpleVector |
getTransformedCenter(SimpleVector toFill)
Returns the center of the object in worldspace, i.e. after the object's current transformations have been applied to it. |
SimpleVector |
getTranslation()
Returns the translation of the object (from its origin to its current position) |
SimpleVector |
getTranslation(SimpleVector trns)
Returns the translation of the object. |
Matrix |
getTranslationMatrix()
Returns the object's current translation matrix. |
int |
getTransparency()
Returns the current tranparency setting. |
int |
getTransparencyMode()
Returns the current transparency mode. |
java.lang.Object |
getUserObject()
Return the user defined object. |
boolean |
getVisibility()
Returns the current visibility state of the object. |
Matrix |
getWorldTransformation()
Returns the transformation matrix used to transform the object from objectspace into worldspace. |
Matrix |
getWorldTransformation(Matrix mat)
Variant of getWorldTransformation() to avoid the creation of an additional matrix where not needed. |
SimpleVector |
getXAxis()
Returns the x-axis of the object. |
SimpleVector |
getYAxis()
Returns the y-axis of the object. |
SimpleVector |
getZAxis()
Returns the z-axis of the object. |
boolean |
hasChild(Object3D obj)
Tests an object for being a child object of the current object. |
boolean |
hasParent(Object3D obj)
Tests an object for being a parent object of the current object. |
boolean |
hasVertexAlpha()
Returns true, if this object uses vertex alpha values. |
void |
invert()
Physically "inverts" the object, which means that the backface culling works the other way round. |
void |
invertCulling(boolean inv)
Inverts culling order if set to true. |
boolean |
isEnvmapped()
Returns if environment mapping is used or not. |
boolean |
isTransparent()
Returns if the object is transparent of not. |
static Object3D |
mergeAll(Object3D[] objs)
Merges all objects in the array into one large object. |
static Object3D |
mergeObjects(Object3D first,
Object3D second)
Static method that merges two objects into a third one. |
float |
rayIntersectsAABB(SimpleVector org,
SimpleVector dr)
Checks if a given ray intersects with the axis aligned bounding box (in object-space) of this object. |
float |
rayIntersectsAABB(SimpleVector org,
SimpleVector dr,
boolean isNormalized)
Checks if a given ray intersects with the axis aligned bounding box (in object-space) of this object. |
void |
removeChild(Object3D obj)
Removes an object from the child-collection of this. |
void |
removeCollisionListener(CollisionListener listener)
Removes a collision listener from the list of listeners. |
void |
removeParent(Object3D obj)
Removes an object from the parent-collection of this. |
void |
resetCollisionStatus()
Sets the indicator that the object was a target of the last collision detection to false, i.e. the object won't be recognized any longer as part of the collision. |
static void |
resetNextID()
Resets the internal object-counter. |
void |
rotateAxis(SimpleVector axis,
float angle)
Rotates the object's rotation matrix around an arbitrary axis. |
void |
rotateMesh()
Rotates the raw mesh data using the rotation matrix specified for this object. |
void |
rotateX(float w)
Rotates the object's rotation matrix around the x-axis by the given angle w (radian, counter clockwise for positive values). |
void |
rotateY(float w)
Rotates the object's rotation matrix around the y-axis by the given angle w (radian, clockwise for positive values). |
void |
rotateZ(float w)
Rotates the object's rotation matrix around the z-axis by the given angle w (radian, counter clockwise for positive values). |
void |
scale(float scale)
Scales the object. |
void |
setAdditionalColor(RGBColor col)
Sets the additional color for this object. |
void |
setAnimationSequence(Animation anim)
Sets the keyframe animation sequence that should be used for this object. |
void |
setBillboarding(boolean mode)
Enables/disables billboarding for this object. |
void |
setBoundingBox(float minx,
float maxx,
float miny,
float maxy,
float minz,
float maxz)
Sets a new AABB for the object. |
void |
setCenter(SimpleVector center)
Sets the center of the object (in object-space). |
void |
setCollisionMode(int mode)
Sets if and how the object will respond to collisions. |
void |
setCollisionOptimization(boolean optimized)
Sets an optimization for collision detection to be used/not used. |
void |
setCulling(boolean mode)
Enables/Disables backface culling for the current object. |
void |
setEllipsoidMode(int mode)
When doing ellipsoid collision detection with this object, the ellipsoid can be transformed according to the objects's transformation and in the source's object space or it remains static in the target's object space (i.e. |
void |
setEnvmapped(boolean mode)
Enables/Disables environment mapping for the object. |
void |
setFixedPointMode(boolean useFixedPoint)
If set to true, some operations will be using fixed point instead of floating point. |
void |
setLighting(int mode)
Sets the lighting mode. |
void |
setMesh(Mesh mesh)
Sets an object's mesh to another one. |
void |
setName(java.lang.String n)
Sets the name of the object to a name other than the default one. |
static void |
setNextID(int next)
Sets the ID the next object will get. |
void |
setOcTree(OcTree ocTree)
Assigns an octree to the object. |
void |
setOrientation(SimpleVector dir,
SimpleVector up)
Sets the orientation of this object by giving a direction and an up-vector. |
void |
setOrigin(SimpleVector origin)
Sets the origin of the object. |
void |
setRenderHook(IRenderHook hook)
Sets a new hook into the rendering pipeline. |
void |
setRotationMatrix(Matrix mat)
Sets the rotation matrix for the object. |
void |
setRotationPivot(SimpleVector pivot)
Sets the rotation pivot of the object. |
void |
setScale(float absScale)
Sets an absolute value for the object's scaling. |
void |
setShadingMode(int mode)
jPCT always uses gouraud shading and that can't be disabled. |
void |
setSortOffset(float offset)
Sets on offset for the z-Sorting. |
void |
setSpecularLighting(boolean mode)
Enables/Disables specular lighting for the object. |
void |
setTexture(java.lang.String texname)
Sets the texture for the object. |
void |
setTexture(TextureInfo tInf)
Sets the texture for the object via an instance of TextureInfo. |
void |
setTextureMatrix(Matrix mat)
Sets a matrix that is applied to transform the texture in stage 0. |
void |
setTranslationMatrix(Matrix mat)
Sets the translation matrix for the object. |
void |
setTransparency(int trans)
Sets the object to be transparent using the given level of transparency. |
void |
setTransparencyMode(int mode)
Sets the transparency (blending) mode. |
void |
setUserObject(java.lang.Object obj)
This method is a "workaround" in case you want to give additional information to an Object3D but don't want to (or can't) extend Object3D itself. |
void |
setVisibility(boolean mode)
Sets the object to visible/invisible. |
void |
shareCompiledData(Object3D withObj)
Enables a compiled object to share data with another compiled one. |
boolean |
sphereIntersectsAABB(SimpleVector org,
float radius)
Checks if a given sphere intersects the axis aligned bounding box (in object-space) of this object. |
void |
strip()
Frees some memory by stripping some data that isn't needed anymore unless you want to modify the object afterwards by using a PolygonManager. |
void |
touch()
Touches an object. |
void |
translate(float x,
float y,
float z)
Translates ("moves") the object in worldspace by modifying the translation matrix. |
void |
translate(SimpleVector trans)
Translates ("moves") the object in worldspace by modifying the translation matrix. |
void |
translateMesh()
Translates the raw mesh data using the translation and the origin matrix of this object. |
boolean |
wasTargetOfLastCollision()
True, if this object was a target of the last collision detection that took place (regardless of what kind it was). |
boolean |
wasVisible()
Returns if the object was visible (or at least supposed to be) in the last frame. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final boolean ENVMAP_ENABLED
public static final boolean ENVMAP_DISABLED
public static final int TRANSPARENCY_MODE_DEFAULT
public static final int TRANSPARENCY_MODE_ADD
public static final boolean BILLBOARDING_ENABLED
public static final boolean BILLBOARDING_DISABLED
public static final boolean CULLING_ENABLED
public static final boolean CULLING_DISABLED
public static final boolean SPECULAR_ENABLED
public static final boolean SPECULAR_DISABLED
public static final boolean OBJ_VISIBLE
public static final boolean OBJ_INVISIBLE
public static final int COLLISION_CHECK_NONE
public static final int COLLISION_CHECK_OTHERS
public static final int COLLISION_CHECK_SELF
public static final float COLLISION_NONE
public static final float RAY_MISSES_BOX
public static final boolean COLLISION_DETECTION_OPTIMIZED
public static final boolean COLLISION_DETECTION_NOT_OPTIMIZED
public static final int SHADING_GOURAUD
public static final int SHADING_FAKED_FLAT
public static final int LIGHTING_ALL_ENABLED
public static final int LIGHTING_NO_LIGHTS
public static final int ELLIPSOID_ALIGNED
public static final int ELLIPSOID_TRANSFORMED
public static final int UNKNOWN_OBJECTSIZE
public static final int NO_OBJECT
Constructor Detail |
---|
public Object3D(float[] coordinates, float[] uvs, int[] indices, int textureId)
coordinates
- the coordinates [x1,y1,z1,x2,y2,z2,...]uvs
- the texture coordinates [u1,v1,u2,v2,...]indices
- the indices indexing the tuples/triples in the coordinate
arraystextureId
- the texture id. If not known, just use
TextureManager.TEXTURE_NOTFOUNDpublic Object3D(int maxTriangles)
maxTriangles
- the maximum number of triangles for this object.createDummyObj()
public Object3D(Object3D obj)
obj
- the Object3D to construct this Object3D frompublic Object3D(Object3D obj, boolean reuseMesh)
obj
- the Object3D to construct this Object3D fromreuseMesh
- if true, the new object will use the same meshMethod Detail |
---|
public static Object3D createDummyObj()
World.addObject(com.threed.jpct.Object3D)
public void setUserObject(java.lang.Object obj)
obj
- Object whatever you like...public java.lang.Object getUserObject()
public void setSortOffset(float offset)
offset
- the offsetpublic static Object3D mergeObjects(Object3D first, Object3D second)
first
- the first object to mergesecond
- the second object to merge
public static Object3D mergeAll(Object3D[] objs)
objs
- the objects
public static void resetNextID()
public static int getNextID()
public static void setNextID(int next)
next
- the next IDpublic void compile()
public void compile(boolean dynamic, boolean staticUV)
dynamic
- if the mesh dynamic?staticUV
- does it use static uv-coordinatespublic void shareCompiledData(Object3D withObj)
withObj
- the object to share data withpublic void touch()
public void strip()
public void forceGeometryIndices(boolean force)
force
- public void setAnimationSequence(Animation anim)
anim
- the animation sequenceAnimation
,
getMesh()
public void clearAnimation()
public Animation getAnimationSequence()
public void animate(float index, int seq)
index
- the "time-index" into the sub-sequence of the animationseq
- the number of the sub.sequence (sub-sequence start at 1, 0
stands for the animation as a whole)public void animate(float index)
index
- the "time-index" into the animationpublic void setCollisionMode(int mode)
mode
- The desired mode (COLLISION_CHECK_NONE,
COLLISION_CHECK_OTHERS, COLLISION_CHECK_SELF or combinations)COLLISION_CHECK_NONE
,
COLLISION_CHECK_OTHERS
,
COLLISION_CHECK_SELF
public void setCollisionOptimization(boolean optimized)
optimized
- should the collision detection be optimized or notCOLLISION_DETECTION_OPTIMIZED
,
COLLISION_DETECTION_NOT_OPTIMIZED
public void setVisibility(boolean mode)
mode
- visible or notOBJ_VISIBLE
,
OBJ_INVISIBLE
public boolean getVisibility()
OBJ_VISIBLE
,
OBJ_INVISIBLE
public void calcBoundingBox()
build()
public void build()
World.buildAllObjects()
public void build(boolean staticUV)
build()
public void disableVertexSharing()
public boolean hasChild(Object3D obj)
obj
- the object that should be tested for being a child of this
hasParent(com.threed.jpct.Object3D)
public boolean hasParent(Object3D obj)
obj
- the object that should be tested for being a parent of this
hasChild(com.threed.jpct.Object3D)
public void addChild(Object3D obj)
obj
- the object that should become a child of this.public void removeChild(Object3D obj)
obj
- the Object3D to removepublic void removeParent(Object3D obj)
obj
- the Object3D to removepublic void addParent(Object3D obj)
obj
- the object that should become a parent of this.public Object3D[] getParents()
public int getID()
resetNextID()
,
World.addObject(com.threed.jpct.Object3D)
public java.lang.String getName()
setName(java.lang.String)
public void setName(java.lang.String n)
n
- the new name of the objectWorld.getObjectByName(java.lang.String)
public boolean wasVisible()
public void setCulling(boolean mode)
mode
- the culling modeCULLING_ENABLED
,
CULLING_DISABLED
public boolean getCulling()
CULLING_ENABLED
,
CULLING_DISABLED
public void setShadingMode(int mode)
mode
- the shading modeSHADING_GOURAUD
,
SHADING_FAKED_FLAT
public void setLighting(int mode)
mode
- the lighting modeLIGHTING_ALL_ENABLED
,
LIGHTING_NO_LIGHTS
public int getLighting()
LIGHTING_ALL_ENABLED
,
LIGHTING_NO_LIGHTS
public void setSpecularLighting(boolean mode)
mode
- the specular modeSPECULAR_ENABLED
,
SPECULAR_DISABLED
public void setTransparency(int trans)
trans
- the tranparency level. 0 is the highest possible transparency,
a value below 0 will disable tranparency for this objectpublic int getTransparency()
public boolean isTransparent()
public void setTransparencyMode(int mode)
mode
- the modeTRANSPARENCY_MODE_DEFAULT
,
TRANSPARENCY_MODE_ADD
public int getTransparencyMode()
TRANSPARENCY_MODE_DEFAULT
,
TRANSPARENCY_MODE_ADD
public boolean hasVertexAlpha()
public void setAdditionalColor(RGBColor col)
col
- the colorpublic RGBColor getAdditionalColor()
public void clearAdditionalColor()
public void clearObject()
cloneObject()
,
decoupleMesh()
public void decoupleMesh()
cloneObject()
,
clearObject()
public void setBillboarding(boolean mode)
mode
- the billboarding modeBILLBOARDING_ENABLED
,
BILLBOARDING_DISABLED
public boolean isEnvmapped()
ENVMAP_ENABLED
,
ENVMAP_DISABLED
public void setEnvmapped(boolean mode)
mode
- the environment mapping modeENVMAP_ENABLED
,
ENVMAP_DISABLED
public void setFixedPointMode(boolean useFixedPoint)
useFixedPoint
- use it?public void rotateX(float w)
w
- the angle by which should be rotatedpublic void rotateY(float w)
w
- the angle by which should be rotatedpublic void rotateZ(float w)
w
- the angle by which should be rotatedpublic void rotateAxis(SimpleVector axis, float angle)
axis
- a direction-vector pointing into the axis direction with the
object's rotation pivot as position vectorangle
- the angle of the rotationpublic void translateMesh()
public void translate(SimpleVector trans)
trans
- the translation vectorpublic void translate(float x, float y, float z)
x
- the number of units the object should be translated parallel
to the x axisy
- the number of units the object should be translated parallel
to the y axisz
- the number of units the object should be translated parallel
to the z axispublic void align(Camera camera)
camera
- the Camera the Object3D should be aligned withpublic void align(Object3D object)
object
- the object this object should be aligned withpublic void setOrientation(SimpleVector dir, SimpleVector up)
dir
- the directionup
- the up-vectorpublic void enableLazyTransformations()
disableLazyTransformations()
public void disableLazyTransformations()
enableLazyTransformations()
public void scale(float scale)
scale
- the new scalesetScale(float)
public void setScale(float absScale)
absScale
- the new (absolute) scalescale(float)
public float getScale()
public SimpleVector getTranslation()
public SimpleVector getTranslation(SimpleVector trns)
trns
- the SimpleVector to fill and return
public SimpleVector getOrigin()
public SimpleVector getXAxis()
public SimpleVector getYAxis()
public SimpleVector getZAxis()
public Matrix getRotationMatrix()
public Matrix getTranslationMatrix()
public Matrix getOriginMatrix()
translate(float,float,float)
,
setOrigin(com.threed.jpct.SimpleVector)
public void setRotationMatrix(Matrix mat)
mat
- the new rotation matrixrotateX(float)
,
rotateY(float)
,
rotateZ(float)
public void clearRotation()
public void clearTranslation()
public void setTextureMatrix(Matrix mat)
mat
- the matrixpublic Matrix getTextureMatrix()
public void rotateMesh()
public void setTranslationMatrix(Matrix mat)
mat
- the new translation matrixtranslate(float,float,float)
public void setMesh(Mesh mesh)
mesh
- the new mesh of the objectgetMesh()
,
calcBoundingBox()
public Mesh getMesh()
Animation
,
Mesh.cloneMesh(boolean)
,
setMesh(com.threed.jpct.Mesh)
public PolygonManager getPolygonManager()
strip()
public void setBoundingBox(float minx, float maxx, float miny, float maxy, float minz, float maxz)
minx
- the lowest x-value of the AABBmaxx
- the highest x-value of the AABBminy
- the lowest y-value of the AABBmaxy
- the highest y-value of the AABBminz
- the lowest z-value of the AABBmaxz
- the highest z-value of the AABBbuild()
,
calcBoundingBox()
public Object3D cloneObject()
public Matrix getWorldTransformation()
public Matrix getWorldTransformation(Matrix mat)
mat
- the matrix to be filled
public void addCollisionListener(CollisionListener listener)
listener
- the listenerCollisionListener
public void removeCollisionListener(CollisionListener listener)
listener
- the listener to removepublic void disableCollisionListeners()
public void enableCollisionListeners()
public java.util.Iterator<CollisionListener> getCollisionListeners()
public void setRenderHook(IRenderHook hook)
hook
- the hook into the rendering pipelineIRenderHook
public int checkForCollision(SimpleVector dirVec, float step)
dirVec
- the direction vector (a unit vector)step
- the length of the casted ray (a collision will only be
detected of it takes place within this range)
setCenter(com.threed.jpct.SimpleVector)
,
setCollisionMode(int)
,
getID()
,
NO_OBJECT
public SimpleVector checkForCollisionSpherical(SimpleVector translation, float radius)
translation
- the translation the object should performradius
- the radius of the sphere (a collision will only be detected of
it takes place within this radius)
setCenter(com.threed.jpct.SimpleVector)
,
setCollisionMode(int)
public SimpleVector checkForCollisionEllipsoid(SimpleVector translation, SimpleVector ellipsoid, int recursionDepth)
translation
- the translation the object should performellipsoid
- the radius of the epplisoid in x,y and z directionrecursionDepth
- the max. recursion depth of the collision detection. A higher
value will improve the accuracy of the collision detection but
reduce performance. Reasonable values lie between 1 and 5.
setCenter(com.threed.jpct.SimpleVector)
,
setCollisionMode(int)
public void setEllipsoidMode(int mode)
mode
- int the modeELLIPSOID_ALIGNED
,
ELLIPSOID_TRANSFORMED
public int getEllipsoidMode()
ELLIPSOID_ALIGNED
,
ELLIPSOID_TRANSFORMED
public boolean wasTargetOfLastCollision()
resetCollisionStatus()
public void resetCollisionStatus()
wasTargetOfLastCollision()
public float calcMinDistance(SimpleVector org, SimpleVector dr)
org
- a SimpleVector containing the position vectordr
- a SimpleVector containing the direction vector
COLLISION_NONE
public float calcMinDistance(SimpleVector org, SimpleVector dr, float ignoreIfLarger)
org
- a SimpleVector containing the position vectordr
- a SimpleVector containing the direction vectorignoreIfLarger
- only polygons within this range will be taken into account
COLLISION_NONE
public void setCenter(SimpleVector center)
center
- the centerbuild()
public SimpleVector getCenter()
public SimpleVector getTransformedCenter()
public SimpleVector getTransformedCenter(SimpleVector toFill)
public void setRotationPivot(SimpleVector pivot)
pivot
- the rotation pivotbuild()
public SimpleVector getRotationPivot()
public void calcCenter()
setCenter(com.threed.jpct.SimpleVector)
,
setRotationPivot(com.threed.jpct.SimpleVector)
,
build()
public void setOcTree(OcTree ocTree)
ocTree
- the octree that subdivides this objectOcTree
public OcTree getOcTree()
public void setOrigin(SimpleVector origin)
origin
- the origintranslate(float, float, float)
public void invert()
public void invertCulling(boolean inv)
inv
- invert the culling?public boolean cullingIsInverted()
public void calcNormals()
build()
public void calcTextureWrap()
calcTextureWrapSpherical()
public void calcTextureWrapSpherical()
calcTextureWrap()
,
Primitives
public void setTexture(java.lang.String texname)
texname
- the name of the texture as set in the
TextureManager.addTexture()-methodpublic void setTexture(TextureInfo tInf)
tInf
- the TextureInfoTextureInfo
public float rayIntersectsAABB(SimpleVector org, SimpleVector dr, boolean isNormalized)
org
- the position vector of the raydr
- the direction vector of the rayisNormalized
- indicates, that dr is already normalized. So the method can
spare another normalization.
RAY_MISSES_BOX
public float rayIntersectsAABB(SimpleVector org, SimpleVector dr)
org
- the position vector of the raydr
- the direction vector of the ray
RAY_MISSES_BOX
public boolean ellipsoidIntersectsAABB(SimpleVector org, SimpleVector ellipsoid)
org
- the position vector of the ellipsoid (the ellipsoid's center)ellipsoid
- the radius of the ellipsoid in x,y and z-direction as a
SimpleVector
public boolean sphereIntersectsAABB(SimpleVector org, float radius)
org
- the position vector of the sphere (the sphere's center)radius
- the radius of the sphere
public int addTriangle(SimpleVector vert1, SimpleVector vert2, SimpleVector vert3)
vert1
- the first vertexvert2
- the second vertexvert3
- the third vertex
invert()
public int addTriangle(SimpleVector vert1, float u, float v, SimpleVector vert2, float u2, float v2, SimpleVector vert3, float u3, float v3)
vert1
- the first vertexu
- the u component of the texture position at the first vertexv
- the v component of the texture position at the first vertexvert2
- the second vertexu2
- the u component of the texture position at the second vertexv2
- the v component of the texture position at the second vertexvert3
- the third vertexu3
- the u component of the texture position at the third vertexv3
- the v component of the texture position at the third vertex
invert()
public int addTriangle(SimpleVector vert1, float u, float v, SimpleVector vert2, float u2, float v2, SimpleVector vert3, float u3, float v3, int textureID)
vert1
- the first vertexu
- the u component of the texture position at the first vertexv
- the v component of the texture position at the first vertexvert2
- the second vertexu2
- the u component of the texture position at the second vertexv2
- the v component of the texture position at the second vertexvert3
- the third vertexu3
- the u component of the texture position at the third vertexv3
- the v component of the texture position at the third vertextextureID
- the ID of the texture as returned by
TextureManager.getTextureID()
TextureManager.getTextureID(java.lang.String)
,
invert()
public int addTriangle(SimpleVector vert1, float u, float v, SimpleVector vert2, float u2, float v2, SimpleVector vert3, float u3, float v3, int textureID, int sec)
vert1
- the first vertexu
- the u component of the texture position at the first vertexv
- the v component of the texture position at the first vertexvert2
- the second vertexu2
- the u component of the texture position at the second vertexv2
- the v component of the texture position at the second vertexvert3
- the third vertexu3
- the u component of the texture position at the third vertexv3
- the v component of the texture position at the third vertextextureID
- the ID of the texture as returned by
TextureManager.getTextureID()
TextureManager.getTextureID(java.lang.String)
,
invert()
public int addTriangle(SimpleVector vert1, SimpleVector vert2, SimpleVector vert3, TextureInfo tInf)
vert1
- the first vertexvert2
- the second vertexvert3
- the third vertextInf
- the TextureInfo
TextureManager.getTextureID(java.lang.String)
,
TextureInfo
,
invert()
public Matrix getInverseWorldTransformation()
public Matrix getInverseWorldTransformation(Matrix mat)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |