Node-Related Classes
New classes in this section:
Node Class
UNIGINE | UNIGINE 2 |
---|---|
NODE_OBJECT_MESH | NODE_OBJECT_MESH_STATIC |
NODE_WORLD_TRANSFORM | NODE_WORLD_TRANSFORM_PATH |
NODE_WORLD_SPACER | - |
NODE_LIGHT_CUBE | - |
NODE_LIGHT_PROB | - |
NODE_LIGHT_SPOT | - |
NODE_DECAL_OBJECT_OMNI | - |
NODE_DECAL_OBJECT_PROJ NODE_DECAL_TERRAIN_PROJ NODE_DECAL_DEFERRED_PROJ |
NODE_DECAL_PROJ |
NODE_DECAL_OBJECT_ORTHO NODE_DECAL_TERRAIN_ORTHO NODE_DECAL_DEFERRED_ORTHO | NODE_DECAL_ORTHO |
NODE_DECAL_DEFERRED_MESH | NODE_DECAL_MESH |
NODE_OBJECT_BILLBOARD | - |
NODE_WORLD_REVERB | - |
NODE_WORLD_SOURCE | - |
vec3 getBoundMax() | BoundBox getBoundBox() See details below. |
vec3 getBoundMax() | BoundBox getBoundBox() See details below. |
vec3 getBoundCenter() | BoundSphere getBoundSphere() See details below. |
float getBoundRadius() | BoundSphere getBoundSphere() See details below. |
vec3 getWorldBoundMax() | BoundBox getWorldBoundBox() See details below. |
vec3 getWorldBoundMin() | BoundBox getWorldBoundBox() See details below. |
vec3 getWorldBoundCenter() | BoundSphere getWorldBoundSphere() See details below. |
float getWorldBoundRadius() | BoundSphere getWorldBoundSphere() See details below. |
int getNumChilds() | int getNumChildren() See details below. |
void setDirection(vec3 dir, vec3 up) | - |
void setWorldDirection(vec3 dir, vec3 up) | - |
int isImmovable() | - |
void setImmovable(int mode) | - |
Remarks:
- The int getNumChilds() function is depricated. It is provided to keep your code working until the next release. Please, replace it with int getNumChildren().
New Functions and Variables
NodeReference Class
UNIGINE | UNIGINE 2.0 |
---|---|
int setNodeName (string name) | int setNodeName (string name, int addToWorld = 0) |
Changes in Mesh-Related Classes
In UNIGINE 2.0, you can create a mesh via the Mesh class, add geometry to it, add animations and bones and then use it to create the following objects:
- ObjectMeshStatic (former ObjectMesh)
- ObjectMeshSkinned
- ObjectMeshDynamic
- ObjectGuiMesh
- DecalDefferredMesh
Each mesh-related node has the MeshName parameter that stores the internal mesh name. The mesh-related node loads its mesh from the file, specified in the MeshName parameter (if it is not empty).
If you change the mesh name via the setMeshName() function and save the *.world file, a new mesh will be loaded when you load the world the next time. You should also call the setMeshName() function after loading the new mesh via loadMesh() as it doesn't change the mesh name, for example:
// create the ObjectMeshStatic node with the "mesh_1.mesh" mesh name
ObjectMeshStatic mesh = new ObjectMeshStatic("mesh_1.mesh",0);
// load the new mesh from the file;
// the new "mesh_2.mesh" will be rendered, but the mesh name remains "mesh_1.mesh"
mesh.loadMesh("mesh_2.mesh");
// change the mesh name to "mesh_2.mesh";
// the mesh name will be updated in the *.world file and the "mesh_2.mesh" will be loaded the next time
mesh.setMeshName("mesh_2.mesh");
New Bounds-Related Classes
New BoundBox, BoundSphere and BoundFrustum classes have been added to the UnigineScript library. So, now you can operate with instances of these classes rather than dimensions of bounding box/sphere/frustum.
For example, you can get the bounding box of the object instead of getting its minimum and maximum.
- In UNIGINE, you copy the bounding box of a static mesh by using 2 functions:
ObjectDynamic dynamic = new ObjectDynamic(); ObjectMesh mesh = new ObjectMesh("samples/shaders/meshes/palm.mesh"); // copy bounding box dynamic.setBoundBox(mesh.getBoundMin(0),mesh.getBoundMax(0));
- In UNIGINE 2.0, you can copy it by using a single function:
ObjectDynamic dynamic = new ObjectDynamic(); ObjectMesh mesh = new ObjectMesh("samples/shaders/meshes/palm.mesh"); // copy bounding box dynamic.setBoundBox(mesh.getBoundBox());
In case of double precision coordinates, the bounds are constructed by using the following classes:
- WorldBoundBox for the bounding box
- WorldBoundSphere for the bounding sphere
- WorldBoundFrustum for the bounding frustum
If you want to support both single and double precision builds, you can use the WorldBoundBox/Sphere/Frustum classes only.