12月 222021
 
  • Constructor Detail

    • Object3D

      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 arrays
      textureId – the texture id. If not known, just use TextureManager.TEXTURE_NOTFOUND
    • Object3D

      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 arrays
      textureId – the texture id. If not known, just use TextureManager.TEXTURE_NOTFOUND
    • Object3D

      创建一个新的Object3D对象实例。通常,创建一个对象是为了添加到world实例中。你也可以创建假的Object3D实例,只是为了带着他的一些子对象进行一个移动或者旋转等做变换,这种作方也可以通过createDummyObj()方法来实现。
      参数:
      maxTriangles – 此对象可包含的最大的三角形的数量(超出数量会提示ERROR: Polygon index out of range – object is too large!).
    • Object3D

      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

      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
      reuseMesh – if true, the new object will use the same mesh

  • Method Detail

    • createDummyObj

      相当于new Object3D(0);创建一个假的Object3D对象。这个仿制品是一个空白的3d对象。此方法用于创建的对象一般不会被添加到world实例,通常作为一个child对象与另外一个3D对象关联。这对增加对象绑定的稳定性很有用(比如月亮围着一个行星旋转,通过在行星中心放一个假的对象并与月亮对象进行关联很有用。这样可以同时实现行星的自转和月亮对行星的公转?)通过没有必要也没用将此对象添加到world中的应用场景。
      Returns:
      a dummy Object3D
    • setVirtualizer

      Sets a virtualizer for this object’s geometry. By default, none is set.
      Parameters:
      virtualizer – the virtualizer
    • getVirtualizer

      Returns the current Virtualizer. By default, none is set.
      Returns:
      the virtualizer or null
    • setUserObject

      当你不想(或者不能)对Object3D对象做一些扩展的时候,这是一个给Object3D添加额外信息的变通的方法。
      Parameters:
      obj – Object whatever you like…
    • setSortOffset

      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

      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 merge
      second – the second object to merge
      Returns:
      the merged object
    • mergeAll

      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

      Resets the internal object-counter.
    • 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

      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

      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

      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

      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

      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

      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

      移除一些不再需要使用的数据以节省一些内存。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

      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

      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:
      AnimationgetMesh()
    • clearAnimation

      清除对象的动画,Its mesh data will be that of the last frame interpolation.
    • getAnimationSequence

      Returns the animation sequence.
      Returns:
      the Animation sequence or null if none has been defined
    • animate

      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 animation
      seq – the number of the sub.sequence (sub-sequence start at 1, 0 stands for the animation as a whole)
    • animate

      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

      设置碰撞检测模式. 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_NONECOLLISION_CHECK_OTHERSCOLLISION_CHECK_SELF
    • setCollisionOptimization

      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_OPTIMIZEDCOLLISION_DETECTION_NOT_OPTIMIZED
    • setVisibility

      设置3D对象是否可见。
      Parameters:
      mode – visible or not
      See Also:
      OBJ_VISIBLEOBJ_INVISIBLE
    • 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

      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

      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

      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

      测试某个对象是不是此对象的子对象。
    • hasParent

      测试此对象是不是某对象的子对象。
    • addChild

      将一个对象添加为此对象的子对象。子对象将继承此对象的旋转、缩放等变换操作。
       注意:需要使用world.addObject()才能将子对象渲染在界面中
    • removeChild

      删除一个子对象。
    • removeParent

      Removes an object from the parent-collection of this. The object itself won’t be removed.
      Parameters:
      obj – the Object3D to remove
    • addParent

      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

      返回此对象的所有parents对象。
    • 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)
    • getName

      返回对象的名字,对象的默认的名字为”object” + 内部ID,可以使用setName对此属性进行赋值。
    • setName

      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

      返回对象在最后一帧的时候是否可见。 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

      允许或者禁止此对象的背面渲染? 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.
    • getCulling

      返回当前的背面渲染是允许还是禁止的。
    • setShadingMode

      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_GOURAUDSHADING_FAKED_FLAT
    • setLighting

      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_ENABLEDLIGHTING_NO_LIGHTS
    • getLighting

      Gets the lighting mode.
      See Also:
      LIGHTING_ALL_ENABLEDLIGHTING_NO_LIGHTS
    • setMaxLights

      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

      Returns the maximum number of lights that should have an influence on this object. Default is 8.
      Returns:
      the number of lights
    • setSpecularLighting

      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_ENABLEDSPECULAR_DISABLED
    • getSpecularLighting

      Returns the state of specular lighting.
      Returns:
      the specular mode
      See Also:
      SPECULAR_ENABLEDSPECULAR_DISABLED
    • setTransparency

      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

      Sets a shader other than the default shader set. This is only valid when using OpenGL ES 2.0.
      Parameters:
      shader – the shader
    • 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

      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

      Removes a shader and reverts to the default shader set. This is only valid when using OpenGL ES 2.0.
    • getTransparency

      Returns the current tranparency setting.
      Returns:
      int the transparency level
    • isTransparent

      Returns if the object is transparent of not.
      Returns:
      is it?
    • setTransparencyMode

      Sets the transparency (blending) mode.
      Parameters:
      mode – the mode
      See Also:
      TRANSPARENCY_MODE_DEFAULTTRANSPARENCY_MODE_ADD
    • getTransparencyMode

      Returns the current transparency mode.
      Returns:
      int the mode
      See Also:
      TRANSPARENCY_MODE_DEFAULTTRANSPARENCY_MODE_ADD
    • hasVertexAlpha

      Returns true, if this object uses vertex alpha values. False, if it doesn’t, which is default.
      Returns:
      does it?
    • setAlphaWrites

      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

      Should alpha writes be used?
      Returns:
      should it?
    • setAdditionalColor

      设置了一下,没见到什么效果。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

      设置了一下,没见到什么效果。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

      Returns the additional color.
      Returns:
      the color
    • clearAdditionalColor

      Removes additional color information form the object. Calling this method is equal to call setAdditionalColor(Color.black).
    • 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

      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

      允许或者禁止此对象的公告板模式。告示板对象将忽略自身的旋转(子对象可以旋转)矩阵并且一直面向camera。
    • isEnvmapped

      返回3D对象是否使用的环境映射(environment mapping)
      Returns:
      used…or not…
      See Also:
      ENVMAP_ENABLEDENVMAP_DISABLED
    • setEnvmapped

      设置3d对象是否使用环境映射(environment mapping). 如果允许,设置给3d对象的纹理图(texturemap)将使用球形环境映射,默认为false.
    • 环境映射是一种用来模拟光滑表面对周围环境的反射的技术,常见的如镜子、光亮漆面的金属等等。
      这种技术的实现主要通过将一张带有周围环境的贴图附在所需要表现的多边形表面来实现的。在实时3D游戏画面渲染中经常使用的有两种环境映射。
      球形环境映射是模拟在球体表面产生环境映射的技术,通过对普通贴图的UV坐标进行调整计算来产生在球体表面应产生的扭曲。
      UV的计算利用球体表面的法线来计算。
    •  
      Parameters:
      mode – the environment mapping mode
      See Also:
      ENVMAP_ENABLEDENVMAP_DISABLED
    • setFixedPointMode

      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

      围绕x轴旋转对象的旋转矩阵,旋转效果将在下次渲染时生效。
      Parameters:
      w – 旋转角度,弧度值,逆时针为正,顺时针为负。一周的弧度数为2πr/r=2π,360°角=2π弧度,因此,1弧度约为57.3°,即57°17’44.806”
    • rotateY

      围绕y轴旋转对象的旋转矩阵,旋转效果将在下次渲染时生效。
      Parameters:
      w – 旋转角度,弧度值,逆时针为正,顺时针为负。一周的弧度数为2πr/r=2π,360°角=2π弧度,因此,1弧度约为57.3°,即57°17’44.806”
    • rotateZ

      围绕z轴旋转对象的旋转矩阵,旋转效果将在下次渲染时生效。
      Parameters:
      w – 旋转角度,弧度值,逆时针为正,顺时针为负。一周的弧度数为2πr/r=2π,360°角=2π弧度,因此,1弧度约为57.3°,即57°17’44.806”
    • rotateAxis

      围绕任意一个轴进行旋转。 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 vector
      angle – the angle of the rotation
    • 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

      移动对象。
      Parameters:
      trans – the translation vector
    • translate

      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 axis
      y – the number of units the object should be translated parallel to the y axis
      z – the number of units the object should be translated parallel to the z axis
    • align

      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

      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

      Sets the orientation of this object by giving a direction and an up-vector.
      Parameters:
      dir – the direction
      up – the up-vector
    • 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

      Disables “lazy transformations”. This is the default setting for every new object.
      See Also:
      enableLazyTransformations()
    • 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

      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

      Returns the cumulated scale value for this object.
      Returns:
      the current scaling
    • getTranslation

      返回对象的位置移动信息(从origin位置到当前位置)。
      Returns:
      the translation
    • getTranslation

      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

      返回origin对应的坐标。
      Returns:
      the oring
    • 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

      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

      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

      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

      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

      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

      Returns the object’s current rotation matrix.
      Returns:
      the rotation matrix of this object
    • getTranslationMatrix

      Returns the object’s current translation matrix.
      Returns:
      the translation matrix of this object
    • 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

      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

      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

      Resets the current rotation to the initial value, i.e. no rotation at all. This will also reset the scale.
    • clearTranslation

      Resets the current translation to the initial value, i.e. no translation at all.
    • setTextureMatrix

      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

      Returns the current texture matrix of null if none is set.
      Returns:
      the texture matrix
    • 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

      Sets the translation matrix for the object. Usually, this is not required as long as the translate() method is satisfying your needs.
    • setMesh

      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

      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:
      AnimationMesh.cloneMesh(boolean)setMesh(com.threed.jpct.Mesh)
    • 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

      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 AABB
      maxx – the highest x-value of the AABB
      miny – the lowest y-value of the AABB
      maxy – the highest y-value of the AABB
      minz – the lowest z-value of the AABB
      maxz – the highest z-value of the AABB
      See Also:
      build()calcBoundingBox()
    • 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

      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

      给对象添加一个碰撞监听器。当对象有碰撞发生时,会通过监听器进行回调通知。
    • removeCollisionListener

      移除碰撞监听器。
    • disableCollisionListeners

      禁止对象的所有碰撞监听器。
    • enableCollisionListeners

      启用对象的碰撞监听器。
    • getCollisionListeners

      返回对象碰撞监听器的迭代器。
    • setRenderHook

      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

      Returns the render hook or null, if none has been set.
      Returns:
      the hook or null
    • addSpecificLight

      将一个Light对象添加到对象的light列表中。 如果对象的light列表是空的,当渲染对象时世界中的所有对象都会影响到3d对象,如果light列表中有light对象,则只有这些light对象用来给3d对象打光。light对象必须添加到对象所在的world对象中。
    • removeSpecificLight

      在对象的light列表中移除一个light对象。
    • clearSpecificLights

      清空对象的light列表。
    • checkForCollision

      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

      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 perform
      radius – 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

      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 perform
      ellipsoid – the radius of the epplisoid in x,y and z direction
      recursionDepth – 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

      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_ALIGNEDELLIPSOID_TRANSFORMED
    • getEllipsoidMode

      Returns the current ellipsoid mode.
      See Also:
      ELLIPSOID_ALIGNEDELLIPSOID_TRANSFORMED
    • 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

      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

      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 vector
      dr – 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

      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 vector
      dr – a SimpleVector containing the direction vector
      ignoreIfLarger – 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

      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

      返回对象的中心坐标(相对于对象本身的)
    • getTransformedCenter

      返回对象在世界的中心坐标。
    • getTransformedCenter

      返回对象在世界的中心点坐标。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

      设置对象的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

      返回对象rotation pivot(旋转支点)的信息
    • calcCenter

      使用mesh data尝试计算3D对象的中心点。这是一个非常不精确的方法,但是在大部分对象上工作的很好,在其他上面也可能失败。这个方法设置对象的center(中心)和rotation pivot(旋转支点)。对象的build()方法会调用这个方法。
      See Also:
      setCenter(com.threed.jpct.SimpleVector)setRotationPivot(com.threed.jpct.SimpleVector)build()
    • setOcTree

      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

      返回赋给这个3D对象的OcTree(八叉树)对象,如果没有返回null.
    • setOrigin

      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

      按字面意思是反转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

      Inverts culling order if set to true. This affects culling only, not the mesh itself (unlike invert()).
      Parameters:
      inv – invert the culling?
    • cullingIsInverted

      Returns true, if inverted culling is used on this object. False otherwise.
      Returns:
      is it?
    • 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

      给3D对象贴上纹理(具体在什么位置什么角度贴不太确定,适合单色的或者贴图不需要对准位置的情况)。这样贴上去的纹理可能在每个对象看着不太正确,但是这是给没有纹理的3d对象贴图的最快的方式了。这是一种最基本的静态环境映射的贴图。
      See Also:
      calcTextureWrapSpherical()
    • 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

      通过Texture名称设置纹理,需要提前通过TextureManager.getInstance().addTexture添加到TextureManager中。
      Parameters:
      texname – 通过TextureManager.addTexture()方法添加的纹理名称
    • setTexture

      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

      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

      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 ray
      dr – the direction vector of the ray
      isNormalized – 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

      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 ray
      dr – 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

      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

    • sphereIntersectsAABB

      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

      在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 vertex
      vert2 – the second vertex
      vert3 – the third vertex
      Returns:
      添加的三角形的数量
    • addTriangle

      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 vertex
      u – the u component of the texture position at the first vertex
      v – the v component of the texture position at the first vertex
      vert2 – the second vertex
      u2 – the u component of the texture position at the second vertex
      v2 – the v component of the texture position at the second vertex
      vert3 – the third vertex
      u3 – the u component of the texture position at the third vertex
      v3 – the v component of the texture position at the third vertex
      Returns:
      the number of the added triangle
      See Also:
      invert()
    • addTriangle

      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 vertex
      u – the u component of the texture position at the first vertex
      v – the v component of the texture position at the first vertex
      vert2 – the second vertex
      u2 – the u component of the texture position at the second vertex
      v2 – the v component of the texture position at the second vertex
      vert3 – the third vertex
      u3 – the u component of the texture position at the third vertex
      v3 – the v component of the texture position at the third vertex
      textureID – 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

      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 vertex
      u – the u component of the texture position at the first vertex
      v – the v component of the texture position at the first vertex
      vert2 – the second vertex
      u2 – the u component of the texture position at the second vertex
      v2 – the v component of the texture position at the second vertex
      vert3 – the third vertex
      u3 – the u component of the texture position at the third vertex
      v3 – the v component of the texture position at the third vertex
      textureID – 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

      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 vertex
      vert2 – the second vertex
      vert3 – the third vertex
      tInf – the TextureInfo
      Returns:
      the number of the added triangle
      See Also:
      TextureManager.getTextureID(java.lang.String)TextureInfoinvert()
    • getInverseWorldTransformation

    • getInverseWorldTransformation

打赏
 Posted by on 2021-12-22

Sorry, the comment form is closed at this time.