jPCT-AE Object3D对象属性方法详解
分类:Android, Java, Uncategorized
阅读 (1,263)
12月 222021
-
Constructor Detail
-
Object3D
1234public Object3D(float[] coordinates,float[] uvs,int[] indices,int textureId)Constructor for creating an Object3D out of indexed geometry in bulk form. This can be useful to create an Object3D at once from data loaded by one’s own file loader.- Parameters:
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_NOTFOUND
-
Object3D
12345public Object3D(float[] coordinates,float[] normals,float[] uvs,int[] indices,int textureId)Constructor for creating an Object3D out of indexed geometry in bulk form. This can be useful to create an Object3D at once from data loaded by one’s own file loader.- Parameters:
coordinates
– the coordinates [x1,y1,z1,x2,y2,z2,…]normals
– the vertex normals [nx1,ny1,nz1,nx2,ny2,nz2,…]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_NOTFOUND
-
Object3D
1public Object3D(int maxTriangles)创建一个新的Object3D对象实例。通常,创建一个对象是为了添加到world实例中。你也可以创建假的Object3D实例,只是为了带着他的一些子对象进行一个移动或者旋转等做变换,这种作方也可以通过createDummyObj()方法来实现。
-
Object3D
1public 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. Consider this to be a kind of “workaround” for the fact that you can’t extend a loaded (by Loader) or created (by Primitives) Object3D directly. Please note that this doesn’t work on stripped objects until you set their meshes to locked.- Parameters:
obj
– the Object3D to construct this Object3D from
-
Object3D
12public 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. Consider this to be a kind of “workaround” for the fact that you can’t extend a loaded (by Loader) or created (by Primitives) Object3D directly.Please note that this doesn’t work on stripped objects until you set their meshes to locked.- Parameters:
obj
– the Object3D to construct this Object3D fromreuseMesh
– if true, the new object will use the same mesh
-
Method Detail
-
createDummyObj
1public static Object3D createDummyObj()相当于new Object3D(0);创建一个假的Object3D对象。这个仿制品是一个空白的3d对象。此方法用于创建的对象一般不会被添加到world实例,通常作为一个child对象与另外一个3D对象关联。这对增加对象绑定的稳定性很有用(比如月亮围着一个行星旋转,通过在行星中心放一个假的对象并与月亮对象进行关联很有用。这样可以同时实现行星的自转和月亮对行星的公转?)通过没有必要也没用将此对象添加到world中的应用场景。
-
setVirtualizer
1public void setVirtualizer(Virtualizer virtualizer)Sets a virtualizer for this object’s geometry. By default, none is set.- Parameters:
virtualizer
– the virtualizer
-
getVirtualizer
1public Virtualizer getVirtualizer()Returns the current Virtualizer. By default, none is set.- Returns:
- the virtualizer or null
-
setUserObject
1public void setUserObject(java.lang.Object obj)当你不想(或者不能)对Object3D对象做一些扩展的时候,这是一个给Object3D添加额外信息的变通的方法。- Parameters:
obj
– Object whatever you like…
-
setSortOffset
1public void setSortOffset(float offset)Sets on offset for the z-Sorting. Usually this is not needed, but it could be helpful for transparent objects that are sorted incorrectly otherwise.- Parameters:
offset
– the offset
-
mergeObjects
12public static Object3D mergeObjects(Object3D first,Object3D second)Static method that merges two objects into a third one. This should be done before calling build() on any of these objects and it does not copy other properties of the object (like rendering modes etc…).
Merging objects is quite expensive in terms of memory usage. Merged objects are not compressed by default.- Parameters:
first
– the first object to mergesecond
– the second object to merge- Returns:
- the merged object
-
mergeAll
1public static Object3D mergeAll(Object3D... objs)Merges all objects in the array into one large object. The array will be empty afterwards.- Parameters:
objs
– the objects- Returns:
- the merged result
-
resetNextID
1public static void resetNextID()Resets the internal object-counter.
-
getNextID
1public static int getNextID()Static method that returns the ID the next object will get. This is useful to know if (and only if) you want to serialize your world, because this value isn’t serialized by default.- Returns:
- the ID
-
setNextID
1public static void setNextID(int next)Sets the ID the next object will get. It has to be higher than the current one. This method can be used to deserialize a world. Be careful when using this method, because screwing up the IDs will most likely screw up everything else.- Parameters:
next
– the next ID
-
compile
1public void compile()Mainly needed to ease porting from the desktop version of jPCT. By default, jPCT-AE does this call automatically, so usually there’s no need to call this method directly.
-
compile
1public void compile(boolean dynamic)Mainly needed to ease porting from the desktop version of jPCT. By default, jPCT-AE does this call automatically, so usually there’s no need to call this method directly.- Parameters:
dynamic
– if the mesh dynamic?
-
compile
12public void compile(boolean dynamic,boolean staticUV)Mainly needed to ease porting from the desktop version of jPCT. By default, jPCT-AE does this call automatically, so usually there’s no need to call this method directly.- Parameters:
dynamic
– if the mesh dynamic?staticUV
– does it use static uv-coordinates
-
shareCompiledData
1public void shareCompiledData(<a title="class in com.threed.jpct" href="https://www.jpct.net/jpct-ae/doc/com/threed/jpct/Object3D.html">Object3D</a> withObj)Enables a compiled object to share data with another compiled one. This helps to save system or GPU memory, depending on the used mode for compilation.
The object you would like to share data with must not share data itself with some other, it must not use an octree. Furthermore, both objects have to use the same mesh (not just the same data but the exact same instance), this object must not share data with some other.
This object will inherit all texture coordinates and vertex alpha values from the source object no matter what may have been assigned to it.- Parameters:
withObj
– the object to share data with
-
touch
1public void touch()Touches an object. This has a meaning for dynamically compiled objects and for objects that use lazy transformations. If touched, changes in vertices (and u/v-coordinates if supported) will be retransfered to the graphics card and the transformation matrices of objects using lazy transformations will be recalculated.
-
strip
1public 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.
-
forceGeometryIndices
1public void forceGeometryIndices(boolean force)Forces the object to be compiled to indexed geometry no matter what. Default is false and jPCT will try to figure out, what is best for an object. If this is true, it will override this detection. Compiling to indexed geometry is more expensive, the result might be smaller in memory and depending on the device, it will be rendered faster or slower…
This has to be set before calling build() to have an effect.- Parameters:
force
– should we?
-
setAnimationSequence
1public void setAnimationSequence(Animation anim)Sets the keyframe animation sequence that should be used for this object. It is required that the object is already initialized with a frame (usually the first) of the animation including texture-coords, -data and mesh information. The keyframes of an animation only contain the raw mesh data (like getMesh() would return it). Everything else needs to be taken from the object itself.- Parameters:
anim
– the animation sequence- See Also:
Animation
,getMesh()
-
clearAnimation
1public void clearAnimation()清除对象的动画,Its mesh data will be that of the last frame interpolation.
-
getAnimationSequence
1public Animation getAnimationSequence()Returns the animation sequence.- Returns:
- the Animation sequence or null if none has been defined
-
animate
12public 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). If seq is zero, the whole animation will be treated as a sub-sequence.- Parameters:
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)
-
animate
1public 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. Because no sub-sequence is indicated, the complete animation will be used.- Parameters:
index
– the “time-index” into the animation
-
setCollisionMode
1public void setCollisionMode(int mode)设置碰撞检测模式. Setting mode to COLLISION_CHECK_NONE (which is default) means, that the object can’t be partner in a collision with other objects. Setting it to COLLISION_CHECK_OTHERS means that other objects may collide with this object and setting it to COLLISION_CHECK_SELF means, that the object itself may collide with other objects. The modes may be combined by using the or-operator | .- Parameters:
mode
– The desired mode (COLLISION_CHECK_NONE, COLLISION_CHECK_OTHERS, COLLISION_CHECK_SELF or combinations)- See Also:
COLLISION_CHECK_NONE
,COLLISION_CHECK_OTHERS
,COLLISION_CHECK_SELF
-
setCollisionOptimization
1public void setCollisionOptimization(boolean optimized)Sets an optimization for collision detection to be used/not used. This optimization may cause problems on dynamically updated geometry from an animation or an IVertexController. Therefor, it’s disabled by default. Couldn’t hurt to try it anyway…:-)
This optimization affects collisions WITH this object, not OF this object.- Parameters:
optimized
– should the collision detection be optimized or not- See Also:
COLLISION_DETECTION_OPTIMIZED
,COLLISION_DETECTION_NOT_OPTIMIZED
-
setVisibility
1public void setVisibility(boolean mode)设置3D对象是否可见。- Parameters:
mode
– visible or not- See Also:
OBJ_VISIBLE
,OBJ_INVISIBLE
-
calcBoundingBox
1public void calcBoundingBox()Calculates an AABB (Axis Aligned Bounding Box) for this object in object-space. The box will then be transformed together with the object so that it becomes an OBB (oriented bounding box) when the object will be transformed. Normally, there is no need to call this method directly, because it will already be called from the build() method. Exceptions could be the use of objects meshes for animation and similar tasks.- See Also:
build()
-
build
1public 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).- See Also:
World.buildAllObjects()
-
build
1public 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).
This method is a special purpose method that has to be used if the UV-coordinates are supposed to be modified.- See Also:
build()
-
disableVertexSharing
1public void disableVertexSharing()Disables the automatic vertex sharing that jPCT does for triangles added by addTriangle. This can be useful if single polygons of the object are supposed to change their positions independantly from the others (by using an IVertexController for example). It will hurt performance though.
-
hasChild
1public boolean hasChild(Object3D obj)
-
hasParent
1public boolean hasParent(Object3D obj)
-
addChild
1public void addChild(Object3D obj)将一个对象添加为此对象的子对象。子对象将继承此对象的旋转、缩放等变换操作。
注意:需要使用world.addObject()才能将子对象渲染在界面中
-
removeChild
1public void removeChild(Object3D obj)删除一个子对象。
-
removeParent
1public void removeParent(Object3D obj)Removes an object from the parent-collection of this. The object itself won’t be removed.- Parameters:
obj
– the Object3D to remove
-
addParent
1public void addParent(Object3D obj)Defines an object as a parent of this. this will inherit all transformations from its parent and no other attributes. Defining child and parent object is basically the same. Child object of A will internally be stored by assigning A as their parent. It’s a matter of taste which kind of logic one may use. Therefor, both are supported but the parent-logic is closer to the implementation…then again: Who cares?- Parameters:
obj
– the object that should become a parent of this.
-
getParents
1public Object3D[] getParents()返回此对象的所有parents对象。
-
getID
1public int getID()Returns the object’s ID. The ID is automatically generated and set in the constructor. This ID is used to manage the object once it has been added to an instance of World. In some cases, it could be necessary to reset the ID.- Returns:
- the internal ID of the object
- See Also:
resetNextID()
,World.addObject(com.threed.jpct.Object3D)
-
setName
1public void setName(java.lang.String n)Sets the name of the object to a name other than the default one. The name may be used to identify the object in the world’s collection of objects. 名字必须唯一。
-
wasVisible
1public boolean wasVisible()返回对象在最后一帧的时候是否可见。 This can be useful for some rough optimizations on the application level, but beware of assuming too much frame coherence. The method doesn’t take overdraw into account.- Returns:
- true if it was visible
-
setCulling
1public void setCulling(boolean mode)允许或者禁止此对象的背面渲染? Backface culling is applied to all objects by default. Anyway, some objects may require it to be disabled because of the way they are build. Disabling backface culling for any object usually double the amount of rendered polygons for this object.
-
setShadingMode
1public void setShadingMode(int mode)jPCT always uses gouraud shading and that can’t be disabled. Anyway, with this method it’s possible to enable a kind of faked flat shading. It will look like flat shading, but it isn’t any faster than gouraud. It may even be slower, because triangle strips and some other optimizations jPCT can apply are disabled when using faked flat shading.- Parameters:
mode
– the shading mode- See Also:
SHADING_GOURAUD
,SHADING_FAKED_FLAT
-
setLighting
1public void setLighting(int mode)Sets the lighting mode. Default is, that all kinds of light jPCT knows of will influence the final lighting of the object.- Parameters:
mode
– the lighting mode- See Also:
LIGHTING_ALL_ENABLED
,LIGHTING_NO_LIGHTS
-
getLighting
1public int getLighting()Gets the lighting mode.- See Also:
LIGHTING_ALL_ENABLED
,LIGHTING_NO_LIGHTS
-
setMaxLights
1public void setMaxLights(int lightCount)Sets the maximum number of lights that should have an influence on this object. This value affects compiled objects only. Default and global max. value is 8.- Parameters:
lightCount
– a value between 0 and 8
-
getMaxLights
1public int getMaxLights()Returns the maximum number of lights that should have an influence on this object. Default is 8.- Returns:
- the number of lights
-
setSpecularLighting
1public void setSpecularLighting(boolean mode)Enables/Disables specular lighting for the object. The specular lighting pass is applied in addition to ambient and diffuse lighting. Specular lighting may cause objects to look more reflective and realistic. It requires some extra processing but usually it’s just a matter of taste if it will be used on a particular object or not. Specular lighting is disabled by default.- Parameters:
mode
– the specular mode- See Also:
SPECULAR_ENABLED
,SPECULAR_DISABLED
-
getSpecularLighting
1public boolean getSpecularLighting()Returns the state of specular lighting.- Returns:
- the specular mode
- See Also:
SPECULAR_ENABLED
,SPECULAR_DISABLED
-
setTransparency
1public void setTransparency(int trans)Sets the object to be transparent using the given level of transparency. In addition to the global transparency of the whole object, every pixel with a color of #000000 will be completely transparent (if you don’t supply an alpha channel with the texture). Note: The current implementation doesn’t use #000000 but #0f0f0f due to accuracy issues with JPEG-compression.- Parameters:
trans
– the tranparency level. 0 is the highest possible transparency, a value below 0 will disable tranparency for this object
-
setShader
1public void setShader(GLSLShader shader)Sets a shader other than the default shader set. This is only valid when using OpenGL ES 2.0.- Parameters:
shader
– the shader
-
getShader
1public GLSLShader getShader()Returns the shader, if another one than the default shader is set. This is only valid when using OpenGL ES 2.0.- Returns:
- the shader or null if none is set
-
calcTangentVectors
1public void calcTangentVectors()Tangent vectors are needed for some calculation in shaders. If you are using shaders (i.e. OpenGL ES 2.0) and your shader needs these vectors and jPCT-AE wasn’t able to detect this (by searching for “attribute vec4 tangent” in the vertex shader, you might want to trigger this calculation manually. By default, the calculation happens automatically during build() if the need has been detected.
-
clearShader
1public void clearShader()Removes a shader and reverts to the default shader set. This is only valid when using OpenGL ES 2.0.
-
getTransparency
1public int getTransparency()Returns the current tranparency setting.- Returns:
- int the transparency level
-
isTransparent
1public boolean isTransparent()Returns if the object is transparent of not.- Returns:
- is it?
-
setTransparencyMode
1public void setTransparencyMode(int mode)Sets the transparency (blending) mode.- Parameters:
mode
– the mode- See Also:
TRANSPARENCY_MODE_DEFAULT
,TRANSPARENCY_MODE_ADD
-
getTransparencyMode
1public int getTransparencyMode()Returns the current transparency mode.- Returns:
- int the mode
- See Also:
TRANSPARENCY_MODE_DEFAULT
,TRANSPARENCY_MODE_ADD
-
hasVertexAlpha
1public boolean hasVertexAlpha()Returns true, if this object uses vertex alpha values. False, if it doesn’t, which is default.- Returns:
- does it?
-
setAlphaWrites
1public void setAlphaWrites(boolean alphaWrites)Enabled/Disables alpha writes by this object into the framebuffer. This applies to transparent object on transparent framebuffers only. Default is true.- Parameters:
alphaWrites
– do alpha writes or not
-
isAlphaWrites
1public boolean isAlphaWrites()Should alpha writes be used?- Returns:
- should it?
-
setAdditionalColor
1public void setAdditionalColor(RGBColor col)设置了一下,没见到什么效果。Sets the additional color for this object. This color will be added to the regular color of each vertex (given by ambient, diffuse and specular lighting). This can be used to highlight particular objects on purpose. The limitation to the range of the AWT’s Color doesn’t matter here, because adding a color brighter than (255,255,255) (jPCT supports this overbright lighting) can be useful for lightsources but not for setting a color value that isn’t processed any further. It simply doesn’t get whiter than white…:-)- Parameters:
col
– the color
-
setAdditionalColor
123public void setAdditionalColor(int red,int green,int blue)设置了一下,没见到什么效果。Sets the additional color for this object. This color will be added to the regular color of each vertex (given by ambient, diffuse and specular lighting). This can be used to highlight particular objects on purpose.- Parameters:
red
– the red component (0..255)green
– the green component (0..255)blue
– the blue component (0..255)
-
getAdditionalColor
1public RGBColor getAdditionalColor()Returns the additional color.- Returns:
- the color
-
clearAdditionalColor
1public void clearAdditionalColor()Removes additional color information form the object. Calling this method is equal to call setAdditionalColor(Color.black).
-
clearObject
1public void clearObject()Clears the object by removing all vertex/mesh information from it. This also affects objects that have been cloned from this object, because they will lose their mesh-data too. Every other property of the object stays intact.- See Also:
cloneObject()
,decoupleMesh()
-
decoupleMesh
1public void decoupleMesh()Decouples the current mesh from the object. This may be useful to assign another mesh to the object without affecting cloned objects (from this object). Without the use of cloned objects, the results of clearObject() and decoupleMesh() are the same (= an empty object).- See Also:
cloneObject()
,clearObject()
-
setBillboarding
1public void setBillboarding(boolean mode)允许或者禁止此对象的公告板模式。告示板对象将忽略自身的旋转(子对象可以旋转)矩阵并且一直面向camera。
-
isEnvmapped
1public boolean isEnvmapped()返回3D对象是否使用的环境映射(environment mapping)- Returns:
- used…or not…
- See Also:
ENVMAP_ENABLED
,ENVMAP_DISABLED
-
setEnvmapped
1public void setEnvmapped(boolean mode)设置3d对象是否使用环境映射(environment mapping). 如果允许,设置给3d对象的纹理图(texturemap)将使用球形环境映射,默认为false. - 环境映射是一种用来模拟光滑表面对周围环境的反射的技术,常见的如镜子、光亮漆面的金属等等。
这种技术的实现主要通过将一张带有周围环境的贴图附在所需要表现的多边形表面来实现的。在实时3D游戏画面渲染中经常使用的有两种环境映射。
球形环境映射是模拟在球体表面产生环境映射的技术,通过对普通贴图的UV坐标进行调整计算来产生在球体表面应产生的扭曲。
UV的计算利用球体表面的法线来计算。 -
- Parameters:
mode
– the environment mapping mode- See Also:
ENVMAP_ENABLED
,ENVMAP_DISABLED
-
setFixedPointMode
1public void setFixedPointMode(boolean useFixedPoint)If set to true, some operations will be using fixed point instead of floating point. This is less accurate and may cause problems with large coordinates, but is usually faster. Default is true.- Parameters:
useFixedPoint
– use it?
-
rotateX
1public void rotateX(float w)围绕x轴旋转对象的旋转矩阵,旋转效果将在下次渲染时生效。- Parameters:
w
– 旋转角度,弧度值,逆时针为正,顺时针为负。一周的弧度数为2πr/r=2π,360°角=2π弧度,因此,1弧度约为57.3°,即57°17’44.806”
-
rotateY
1public void rotateY(float w)围绕y轴旋转对象的旋转矩阵,旋转效果将在下次渲染时生效。- Parameters:
w
– 旋转角度,弧度值,逆时针为正,顺时针为负。一周的弧度数为2πr/r=2π,360°角=2π弧度,因此,1弧度约为57.3°,即57°17’44.806”
-
rotateZ
1public void rotateZ(float w)围绕z轴旋转对象的旋转矩阵,旋转效果将在下次渲染时生效。- Parameters:
w
– 旋转角度,弧度值,逆时针为正,顺时针为负。一周的弧度数为2πr/r=2π,360°角=2π弧度,因此,1弧度约为57.3°,即57°17’44.806”
-
rotateAxis
12public void rotateAxis(SimpleVector axis,float angle)围绕任意一个轴进行旋转。 The method is more powerful than the normal rotate-around-an-axis methods, but also a bit slower. The resulting matrix will be orthonormalized to ensure numerical stability.- Parameters:
axis
– a direction-vector pointing into the axis direction with the object’s rotation pivot as position vectorangle
– the angle of the rotation
-
translateMesh
1public void translateMesh()Translates the raw mesh data using the translation and the origin matrix of this object. This translation is applied directly onto the mesh and therefor it’s permanent. This could be useful for defining animation keyframes via object meshes or for altering objects in objectspace. Translating a mesh forces the object’s bounding box to be recalculated afterwards (automatically done).
-
translate
1public void translate(SimpleVector trans)移动对象。- Parameters:
trans
– the translation vector
-
translate
123public void translate(float x,float y,float z)Translates (“moves”) the object in worldspace by modifying the translation matrix. The translation will be applied the next time the object is rendered.- Parameters:
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 axis
-
align
1public void align(Camera camera)Aligns this object with a Camera using the camera’s backbuffer matrix. This means that the object (i.e. its positive z-axis) will face into the same direction as the camera does. Calling this method modifies the object’s rotation matrix, but not its translation or origin matrix, i.e. the object is facing into the camera’s direction but it’s not automatically placed at the camera’s position. This has to be done “by hand” if required. Keep in mind that the rotation pivot of this object influences the outcome too.- Parameters:
camera
– the Camera the Object3D should be aligned with
-
align
1public void align(Object3D object)Aligns this object with another Object3D. This basically means that both objects will face into the same direction after calling this method. Keep in mind that the rotation pivot influences the outcome too. This method works on the object’s own rotation matrix only. It doesn’t take transformations of parent objects into account.- Parameters:
object
– the object this object should be aligned with
-
setOrientation
12public void setOrientation(SimpleVector dir,SimpleVector up)Sets the orientation of this object by giving a direction and an up-vector.- Parameters:
dir
– the directionup
– the up-vector
-
enableLazyTransformations
1public void enableLazyTransformations()Enables “lazy transformations”. When lazy transformations are being used, the world-transformation matrix (as well as its inverse if needed) is calculated only once and used from there on until lazy transformations are being disabled again. This helps to improve performance for static objects and it can be VERY helpful to speed-up collision detection with such objects. It may also be used on none-static objects if they aren’t moving/rotating for some time (for example: if a lot of objects should be checked for collision, it could be helpful to enable lazy transformations before doing this and disabling it right after the tests).
Enabling this again after it already has been clears the stored values, i.e. you can use this to update the calculated matrix inbetween without disabling the mode entirely.- See Also:
disableLazyTransformations()
-
disableLazyTransformations
1public void disableLazyTransformations()Disables “lazy transformations”. This is the default setting for every new object.- See Also:
enableLazyTransformations()
-
scale
1public void scale(float scale)Scales the object. A scale-value greater than 1 will result in the object to get bigger, while a value lower than 1 causes the object to shrink (when transformed…the Mesh won’t be touched). Remember that the scales (as well as rotations and translations) are cumulative.
Please note that setting or clearing the rotation matrix will reset this value. You are supposed to reset the scaling to 1 before doing so.- Parameters:
scale
– the new scale- See Also:
setScale(float)
-
setScale
1public void setScale(float absScale)Sets an absolute value for the object’s scaling. Useful, if the cumulative scaling of scale() isn’t what one wants.
Please note that setting or clearing the rotation matrix will reset this value. You are supposed to reset the scaling to 1 before doing so.- Parameters:
absScale
– the new (absolute) scale- See Also:
scale(float)
-
getScale
1public float getScale()Returns the cumulated scale value for this object.- Returns:
- the current scaling
-
getTranslation
1public SimpleVector getTranslation()返回对象的位置移动信息(从origin位置到当前位置)。- Returns:
- the translation
-
getTranslation
1public SimpleVector getTranslation(SimpleVector trns)Returns the translation of the object. The returned SimpleVector is the same one as the one given as parameter. This is useful to save the creation of an additional object. If null is given, a new one will be created.- Parameters:
trns
– the SimpleVector to fill and return- Returns:
- the translation
-
getOrigin
1public SimpleVector getOrigin()返回origin对应的坐标。- Returns:
- the oring
-
getXAxis
1public SimpleVector getXAxis()Returns the x-axis of the object. This is an imaginary axis useful for movement und rotations relative to the object. This is based on the rotation matrix only. It doesn’t take any parent objects into account.- Returns:
- the x-axis
-
getYAxis
1public SimpleVector getYAxis()Returns the y-axis of the object. This is an imaginary axis useful for movement und rotations relative to the object. This is based on the rotation matrix only. It doesn’t take any parent objects into account.- Returns:
- the y-axis
-
getZAxis
1public SimpleVector getZAxis()Returns the z-axis of the object. This is an imaginary axis useful for movement und rotations relative to the object. This is based on the rotation matrix only. It doesn’t take any parent objects into account.- Returns:
- the z-axis
-
getXAxis
1public SimpleVector getXAxis(SimpleVector toFill)Returns the x-axis of the object. This is an imaginary axis useful for movement und rotations relative to the object. This is based on the rotation matrix only. It doesn’t take any parent objects into account. This method fills the given SimpleVector in addition to returning it.- Parameters:
toFill
– the vector to fill- Returns:
- the x-axis
-
getYAxis
1public SimpleVector getYAxis(SimpleVector toFill)Returns the y-axis of the object. This is an imaginary axis useful for movement und rotations relative to the object. This is based on the rotation matrix only. It doesn’t take any parent objects into account. This method fills the given SimpleVector in addition to returning it.- Parameters:
toFill
– the vector to fill- Returns:
- the y-axis
-
getZAxis
1public SimpleVector getZAxis(SimpleVector toFill)Returns the z-axis of the object. This is an imaginary axis useful for movement und rotations relative to the object. This is based on the rotation matrix only. It doesn’t take any parent objects into account. This method fills the given SimpleVector in addition to returning it.- Parameters:
toFill
– the vector to fill- Returns:
- the z-axis
-
getRotationMatrix
1public Matrix getRotationMatrix()Returns the object’s current rotation matrix.- Returns:
- the rotation matrix of this object
-
getTranslationMatrix
1public Matrix getTranslationMatrix()Returns the object’s current translation matrix.- Returns:
- the translation matrix of this object
-
getOriginMatrix
1public Matrix getOriginMatrix()Returns the object’s origin-translation matrix. This matrix is a kind of static translation matrix for the object used to initially place the object into worldspace. Without using child/parent-objects, there is no difference between using the translation and the origin matrix, but only the former will be applied to child objects of this object. It is advised to use the origin matrix to place the object into worldspace once and to execute all further translations by using the translation matrix (or by using the translate()-method which already does this for you).- Returns:
- the origin-translation matrix of this object
- See Also:
translate(float,float,float)
,setOrigin(com.threed.jpct.SimpleVector)
-
getLightCount
1public int getLightCount()Returns the number of lights that have an influence on this object. This is only valid during rendering, i.e. only when called from within an IRenderHook.- Returns:
- the number of used lights
-
setRotationMatrix
1public void setRotationMatrix(Matrix mat)Sets the rotation matrix for the object. Usually, this is not required as long as the rotateX/Y/Z() methods are satisfying your needs. If you do this, make sure to reset the scale by calling setScale(1f) if you previously modified it.- Parameters:
mat
– the new rotation matrix- See Also:
rotateX(float)
,rotateY(float)
,rotateZ(float)
-
clearRotation
1public void clearRotation()Resets the current rotation to the initial value, i.e. no rotation at all. This will also reset the scale.
-
clearTranslation
1public void clearTranslation()Resets the current translation to the initial value, i.e. no translation at all.
-
setTextureMatrix
1public void setTextureMatrix(Matrix mat)Sets a matrix that is applied to transform the texture in stage 0. If no transformation is needed, null should be set instead of an empty matrix.
Note: This doesn’t work on all phones. On a Samsung Galaxy with Android 1.5 for example, changing the texture matrix has no effect!?- Parameters:
mat
– the matrix
-
getTextureMatrix
1public Matrix getTextureMatrix()Returns the current texture matrix of null if none is set.- Returns:
- the texture matrix
-
rotateMesh
1public void rotateMesh()Rotates the raw mesh data using the rotation matrix specified for this object. This rotation is applied directly onto the mesh and therefor it’s permanent. This could be useful for defining animation keyframes via object meshes or for altering objects in objectspace. Rotating a mesh forces the object’s bounding box to be recalculated afterwards (automatically done). The rotation matrix of the object won’t be reset by this method.
-
setTranslationMatrix
1public void setTranslationMatrix(Matrix mat)Sets the translation matrix for the object. Usually, this is not required as long as the translate() method is satisfying your needs.
-
setMesh
1public void setMesh(<a title="class in com.threed.jpct" href="https://www.jpct.net/jpct-ae/doc/com/threed/jpct/Mesh.html">Mesh</a> mesh)Sets an object’s mesh to another one. Shouldn’t be required in normal applications.- Parameters:
mesh
– the new mesh of the object- See Also:
getMesh()
,calcBoundingBox()
-
getMesh
1public Mesh getMesh()Returns the current mesh of the object. This is useful for using an object’s mesh data as keyframes for an animation. The returned mesh can also be added to another object by using setMesh(). If you do so, both objects will share the same instance of mesh. That isn’t a problem as long as you don’t want to modify the mesh of one object without changing the other’s. In this case, you should better use a copy of the mesh obtained from Mesh.cloneMesh().- Returns:
- the object’s mesh
- See Also:
Animation
,Mesh.cloneMesh(boolean)
,setMesh(com.threed.jpct.Mesh)
-
getPolygonManager
1public PolygonManager getPolygonManager()Returns the PolygonManager for this object. A PolygonManager can be used to access an object’s polygons. While you can obtain a PolygonManager from a stripped object, you can’t safely modify the object.- Returns:
- the manager
- See Also:
strip()
-
setBoundingBox
123456public void setBoundingBox(float minx,float maxx,float miny,float maxy,float minz,float maxz)Sets a new AABB for the object. Usually, this shouldn’t be required as it is automatically done by the build()-method.- Parameters:
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 AABB- See Also:
build()
,calcBoundingBox()
-
cloneObject
1public Object3D cloneObject()Clones the current object. A cloned object A’ of an object A is a copy of A at the point when the cloning takes places. This means that A’ inherits all rotations, translations and rendering properties from A. However, A’ and A are sharing the same mesh data (to save memory). This will cause A’ to inherit all keyframe animations from A and vice versa. Keep this in mind when cloning animated objects. Cloning an object is a costly operation that should only be done when needed. If multiple copies of an object are required during runtime, it may be helpful to create them at startup. This method also copies properties like lazy transformation settings and similar, so take care to adjust afterwards on the cloned object if needed. Cloning doesn’t clone collision modes. Please note that this doesn’t work on stripped objects until you set their meshes to locked.- Returns:
- the cloned object
-
getWorldTransformation
1public Matrix getWorldTransformation()Returns the transformation matrix used to transform the object from objectspace into worldspace. Could be useful for debugging purposes, but usually this information shouldn’t be needed.- Returns:
- the transformation matrix
-
addCollisionListener
1public void addCollisionListener(CollisionListener listener)给对象添加一个碰撞监听器。当对象有碰撞发生时,会通过监听器进行回调通知。
-
removeCollisionListener
1public void removeCollisionListener(CollisionListener listener)移除碰撞监听器。
-
disableCollisionListeners
1public void disableCollisionListeners()禁止对象的所有碰撞监听器。
-
enableCollisionListeners
1public void enableCollisionListeners()启用对象的碰撞监听器。
-
getCollisionListeners
1public java.util.Iterator<CollisionListener> getCollisionListeners()返回对象碰撞监听器的迭代器。
-
setRenderHook
1public void setRenderHook(IRenderHook hook)Sets a new hook into the rendering pipeline. This is only valid for compiled objects. Any other object will never access this hook. The hook won’t be serialized if the Object3D is.- Parameters:
hook
– the hook into the rendering pipeline- See Also:
IRenderHook
-
getRenderHook
1public IRenderHook getRenderHook()Returns the render hook or null, if none has been set.- Returns:
- the hook or null
-
addSpecificLight
1public void addSpecificLight(Light light)将一个Light对象添加到对象的light列表中。 如果对象的light列表是空的,当渲染对象时世界中的所有对象都会影响到3d对象,如果light列表中有light对象,则只有这些light对象用来给3d对象打光。light对象必须添加到对象所在的world对象中。
-
removeSpecificLight
1public void removeSpecificLight(Light light)在对象的light列表中移除一个light对象。
-
clearSpecificLights
1public void clearSpecificLights()清空对象的light列表。
-
checkForCollision
12public int checkForCollision(SimpleVector dirVec,float step)Checks if the current object collides with something when moving into a particular direction. This is just a check, so no translations are being performed. A collision can only be detected with objects that are set to COLLISION_CHECK_OTHERS. This method uses a ray-polygon collision detection.- Parameters:
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)- Returns:
- the ID of the Object3D if there is a collision, otherwise NO_OBJECT
- See Also:
setCenter(com.threed.jpct.SimpleVector)
,setCollisionMode(int)
,getID()
,NO_OBJECT
-
checkForCollisionSpherical
12public SimpleVector checkForCollisionSpherical(SimpleVector translation,float radius)Checks if the current object collides with something when moving into a particular direction. This is just a check, so no translations are being performed. A collision can only be detected with objects that are set to COLLISION_CHECK_OTHERS. This method uses a sphere-polygon collision detection.- Parameters:
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)- Returns:
- a SimpleVector containing a corrected translation vector. This vector represents the translation that should be applied to the object to avoid a collision. If no collision takes place, the translation won’t be corrected though (i.e. no collision means returned SimpleVector.equals(translation))
- See Also:
setCenter(com.threed.jpct.SimpleVector)
,setCollisionMode(int)
-
checkForCollisionEllipsoid
123public SimpleVector checkForCollisionEllipsoid(SimpleVector translation,SimpleVector ellipsoid,int recursionDepth)Checks if the current object collides with something when moving into a particular direction. This is just a check, so no translations are being performed. A collision can only be detected with objects that are set to COLLISION_CHECK_OTHERS. This method uses a (swept)ellipsoid-polygon collision detection.- Parameters:
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.- Returns:
- a SimpleVector containing a corrected translation vector. This vector represents the translation that should be applied to the object to avoid a collision. If no collision takes place, the translation won’t be corrected though (i.e. no collision means returned SimpleVector.equals(translation))
- See Also:
setCenter(com.threed.jpct.SimpleVector)
,setCollisionMode(int)
-
setEllipsoidMode
1public 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. “axis aligned”).
The later is faster, but not suitable for all kinds of ellipsoids.- Parameters:
mode
– int the mode- See Also:
ELLIPSOID_ALIGNED
,ELLIPSOID_TRANSFORMED
-
getEllipsoidMode
1public int getEllipsoidMode()Returns the current ellipsoid mode.- See Also:
ELLIPSOID_ALIGNED
,ELLIPSOID_TRANSFORMED
-
wasTargetOfLastCollision
1public boolean wasTargetOfLastCollision()True, if this object was a target of the last collision detection that took place (regardless of what kind it was). Otherwise false. “A target” in this context means, that something has collided with this object, i.e. if one checks object A for collision with other objects and it collides with an object B, B is the target and A is the source. A collision is not automatically detected. One has to use one of the various ways jPCT offers for collision detection to detect it.- Returns:
- was this object a target of the last detected collision?
- See Also:
resetCollisionStatus()
-
resetCollisionStatus
1public 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. This is done automatically the next time a collision detection method is being called.- See Also:
wasTargetOfLastCollision()
-
calcMinDistance
12public 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.- Parameters:
org
– a SimpleVector containing the position vectordr
– a SimpleVector containing the direction vector- Returns:
- the minimal distance to some polygon (= how far can one move into this direction until something will be hit). If there is no such polygon, COLLISION_NONE will be returned.
- See Also:
COLLISION_NONE
-
calcMinDistance
123public 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. This version is a special purpose version of calcMinDistance() which only takes polygons into consideration that have at least one vertex that is closer than ignoreIfLarger units to the position vector. Can be useful to optimize calculations in situations where it is known how far away the polygon with the minimal distance can be at max.- Parameters:
org
– a SimpleVector containing the position vectordr
– a SimpleVector containing the direction vectorignoreIfLarger
– only polygons within this range will be taken into account- Returns:
- the minimal distance to some polygon (= how far can one move into this direction until something will be hit). If there is no such polygon, COLLISION_NONE will be returned.
- See Also:
COLLISION_NONE
-
setCenter
1public void setCenter(SimpleVector center)Sets the center of the object (in object-space). This “center” doesn’t has to be the real center of the object but it’s the point in objectspace which will be used for collision detection. This means that if one tests if the object may move A units into (x,y,z)-direction, actually it’s tested if this point (transformed into world-space) may move A units into (x,y,z)-direction. Calling build() resets this value to a calculated center, so this method should be called after calling build(). - 调用calcTextureWrapSpherical函数会, 这个设置中心点会丢失?
-
- Parameters:
center
– the center- See Also:
build()
-
getCenter
1public SimpleVector getCenter()返回对象的中心坐标(相对于对象本身的)
-
getTransformedCenter
1public SimpleVector getTransformedCenter()返回对象在世界的中心坐标。
-
getTransformedCenter
1public SimpleVector getTransformedCenter(SimpleVector toFill)返回对象在世界的中心点坐标。The returned SimpleVector is the same one as the one given as parameter. This is useful to save the creation of an additional object. If null is given, a new one will be created.
-
setRotationPivot
1public void setRotationPivot(SimpleVector pivot)设置对象的rotation pivot(旋转支点). 未测试出此旋转支点影响哪个旋转函数,对于rotateX, rotateY, rotateZ好像没什么影响。The rotation pivot is the point in objectspace around which the object will be rotated using its rotation matrix. Calling build() resets this value to a calculated rotation pivot, so this method should be called after calling build(). - 调用calcTextureWrapSpherical函数后,这个函数设置的RotationPivot会丢失?
-
- Parameters:
pivot
– the rotation pivot
-
getRotationPivot
1public SimpleVector getRotationPivot()返回对象rotation pivot(旋转支点)的信息
-
calcCenter
1public void calcCenter()使用mesh data尝试计算3D对象的中心点。这是一个非常不精确的方法,但是在大部分对象上工作的很好,在其他上面也可能失败。这个方法设置对象的center(中心)和rotation pivot(旋转支点)。对象的build()方法会调用这个方法。- See Also:
setCenter(com.threed.jpct.SimpleVector)
,setRotationPivot(com.threed.jpct.SimpleVector)
,build()
-
setOcTree
1public void setOcTree(OcTree ocTree)Assigns an octree to the object. An octree may help to increase performance for some kind of objects (like large landscapes). It’s not possible to combine portals and octrees (at least not in jPCT), so setting the octree will be ignored if portal rendering is enabled. In every other case, the object will be rendered using the octree as soon as it’s assigned to it.
Please keep in mind that calculating triangle strips has to be done before building/assigning the tree, because it will destroy the tree.- Parameters:
ocTree
– the octree that subdivides this object
-
getOcTree
1public OcTree getOcTree()返回赋给这个3D对象的OcTree(八叉树)对象,如果没有返回null.
-
setOrigin
1public void setOrigin(SimpleVector origin)Sets the origin of the object. The origin is a position in worldspace at which the object will be placed before performing any other translations. The difference between the origin and a normal translation is, that the normal translation affects the child objects (if any) while the translation to the origin doesn’t.- Parameters:
origin
– the origin- See Also:
translate(float, float, float)
-
invert
1public void invert()按字面意思是反转3D对象,但是代码测试了一下,没看到反转的效果。Physically “inverts” the object, which means that the backface culling works the other way round. This could be used for example on a cube that is usually viewed from outside to make it possible to view it from the inside (and still use backface culling on it). Inverting an object is a costly operation.
-
invertCulling
1public void invertCulling(boolean inv)Inverts culling order if set to true. This affects culling only, not the mesh itself (unlike invert()).- Parameters:
inv
– invert the culling?
-
cullingIsInverted
1public boolean cullingIsInverted()Returns true, if inverted culling is used on this object. False otherwise.- Returns:
- is it?
-
calcNormals
1public void calcNormals()Calculates the object’s vertex normals by calculating the face normals of the adjacent polygons of each vertex and averaging them. The normals are required for lighting and mapping, so they need to be calculated for every object. Usually, this is already done by calling the object’s build() method. (Respective by the loader for MD2-files).- See Also:
build()
-
calcTextureWrap
1public void calcTextureWrap()给3D对象贴上纹理(具体在什么位置什么角度贴不太确定,适合单色的或者贴图不需要对准位置的情况)。这样贴上去的纹理可能在每个对象看着不太正确,但是这是给没有纹理的3d对象贴图的最快的方式了。这是一种最基本的静态环境映射的贴图。- See Also:
calcTextureWrapSpherical()
-
calcTextureWrapSpherical
1public void calcTextureWrapSpherical()以一种球形的方式给3d对象贴图。通常情况下,这个方法比calcTextureWrap函数产生一个更好的贴图效果,当然这个取决于3d对象。This method is well suited to assign texture-coordinates to objects that were generated using the Primitives class.这个方法将会重新计算3d对象的中心点,所以所有对3d对象中心或者rotation-pivot的修改在这个方法调用后都将会丢失。- See Also:
calcTextureWrap()
,Primitives
-
setTexture
1public void setTexture(java.lang.String texname)通过Texture名称设置纹理,需要提前通过TextureManager.getInstance().addTexture添加到TextureManager中。- Parameters:
texname
– 通过TextureManager.addTexture()方法添加的纹理名称
-
setTexture
1public void setTexture(TextureInfo tInf)Sets the texture for the object via an instance of TextureInfo.
Texture coordinates for all layers are taken from the coordinates defined for the base layer of the Object3D, i.e. u/v coordinates given to this TextureInfo will be ignored.- Parameters:
tInf
– the TextureInfo- See Also:
TextureInfo
-
shareTextureData
1public void shareTextureData(Object3D source)In addition to sharing the actual mesh data, you can also make objects share the same texturing information (the actual textures, not the uv-coordinates). If you do this, changing the texture on one object will change it on all sharing objects too.
This helps to save some memory, especially on objects that use multiple textures.- Parameters:
source
– the source of the texturing information
-
rayIntersectsAABB
123public 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. This can be useful to speed up some calculations. jPCT is using this method for faster collision detection.
If the object doesn’t have a bounding box for whatever reason, RAY_MISSES_BOX will be returned.- Parameters:
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.- Returns:
- the distance between the starting point of the ray and the nearest plane of the box. If the ray doesn’t intersect the box, RAY_MISSES_BOX will be returned
- See Also:
RAY_MISSES_BOX
-
rayIntersectsAABB
12public float rayIntersectsAABB(SimpleVector org,SimpleVector dr)Checks if a given ray intersects with the axis aligned bounding box (in object-space) of this object. This can be useful to speed up some calculations. jPCT is using this method for faster collision detection.
If the object doesn’t have a bounding box for whatever reason, RAY_MISSES_BOX will be returned.- Parameters:
org
– the position vector of the raydr
– the direction vector of the ray- Returns:
- the distance between the starting point of the ray and the nearest plane of the box. If the ray doesn’t intersect the box, RAY_MISSES_BOX will be returned
- See Also:
RAY_MISSES_BOX
-
ellipsoidIntersectsAABB
12public boolean ellipsoidIntersectsAABB(SimpleVector org,SimpleVector ellipsoid)Checks if a given ellipsoid intersects the axis aligned bounding box (in object-space) of this object. This can be useful to speed up some calculations. jPCT is using this method for faster collision detection. “Intersection” means everything from touching it to being completely covered by it in this case.
If the object doesn’t have a bounding box for whatever reason, false will be returned.- Parameters:
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- Returns:
- true if there is an intersection, otherwise false
-
ellipsoidIntersectsAABB
1234public boolean ellipsoidIntersectsAABB(float orgx,float orgy,float orgz,SimpleVector ellipsoid)
-
sphereIntersectsAABB
12public boolean sphereIntersectsAABB(SimpleVector org,float radius)Checks if a given sphere intersects the axis aligned bounding box (in object-space) of this object. This can be useful to speed up some calculations. jPCT is using this method for faster collision detection. “Intersection” means everything from touching it to being completely covered by it in this case.
If the object doesn’t have a bounding box for whatever reason, false will be returned.- Parameters:
org
– the position vector of the sphere (the sphere’s center)radius
– the radius of the sphere- Returns:
- true if there is an intersection, otherwise false
-
addTriangle
123public int addTriangle(SimpleVector vert1,SimpleVector vert2,SimpleVector vert3)在3d对象上添加一个三角形。 Using the method, the texture of the object won’t be set and the sector will be set to undefined. Texture coordinates won’t be set (= set to (0,0) for all vertices).可以使用带TextureInfo参数的addTriangle函数来给他赋Texture。 三角形顶点需要逆时针定义因为because jPCT backface culls them by default. 你也可以顺时针定义顶点然后调用invert()函数来反转顺序。- Parameters:
vert1
– the first vertexvert2
– the second vertexvert3
– the third vertex- Returns:
- 添加的三角形的数量
-
addTriangle
123456789public 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. Using the method, the texture of the object won’t be set and the sector will be set to undefined. The vertices have to be defined counter-clockwise because jPCT backface culls them by default. One may also add them clockwise and call invert() afterwards to “invert” the order.- Parameters:
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- Returns:
- the number of the added triangle
- See Also:
invert()
-
addTriangle
12345678910public 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. Using the method, the sector will be set to undefined. The vertices have to be defined counter-clockwise because jPCT backface culls them by default. One may also add them clockwise and call invert() afterwards to “invert” the order.- Parameters:
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()- Returns:
- the number of the added triangle
- See Also:
TextureManager.getTextureID(java.lang.String)
,invert()
-
addTriangle
1234567891011public 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. The vertices have to be defined counter-clockwise because jPCT backface culls them by default. One may also add them clockwise and call invert() afterwards to “invert” the order.- Parameters:
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()- Returns:
- the number of the added triangle
- See Also:
TextureManager.getTextureID(java.lang.String)
,invert()
-
addTriangle
1234public int addTriangle(SimpleVector vert1,SimpleVector vert2,SimpleVector vert3,TextureInfo tInf)Adds a triangle to the object. The vertices have to be defined counter-clockwise because jPCT backface culls them by default. One may also add them clockwise and call invert() afterwards to “invert” the order.
This method takes a TextureInfo instead of the discrete u/v-coordinates and the textureID.- Parameters:
vert1
– the first vertexvert2
– the second vertexvert3
– the third vertextInf
– the TextureInfo- Returns:
- the number of the added triangle
- See Also:
TextureManager.getTextureID(java.lang.String)
,TextureInfo
,invert()
-
getInverseWorldTransformation
1public Matrix getInverseWorldTransformation()
-
getInverseWorldTransformation
1public Matrix getInverseWorldTransformation(Matrix mat)
-
Sorry, the comment form is closed at this time.