World of Hello
Public Member Functions | List of all members
CreateMesh Class Reference

a 3D object. More...

Inheritance diagram for CreateMesh:
mesh

Public Member Functions

 CreateMesh (string serverMeshFile, float x=0, float y=0, float z=0, float scaleX=1, float scaleY=scaleX, float scaleZ=scaleY)
 create a mesh. More...
 
mesh setMesh (string serverMeshFile)
 sets the mesh file. More...
 
bool isLoaded ()
 checks if the mesh has loaded yet. More...
 
string getMesh ()
 gets the last set mesh file. More...
 
bool setImage (string filePath, int layer=0)
 sets the image texture of the mesh from a file path. More...
 
string getImage ()
 gets the last set image file. More...
 
mesh copyImageTo (string imagePath, int toX=0, int toY=0, int fromX=0, int fromY=0, int fromW=-1, int fromH=-1, int layer=0, string storeAs=getImage(), int totalW=-1, int totalH=-1)
 copy part of an image to this texture. More...
 
mesh setAnimation (int start, int end, int speed)
 sets the animation loop and speed. More...
 
mesh setChildAnimation (bool childAnimation=true)
 sets whether the child mesh bones should follow this mesh's animation. More...
 
bool hasCollisionWith (CreateMesh *m)
 checks if this mesh has collision with another mesh. More...
 
mesh setCollisionWith (CreateMesh *m)
 sets collision with another mesh. More...
 
bool collidesWith (CreateMesh *m)
 checks if this mesh is colliding with another mesh. More...
 
bool collides ()
 checks if this mesh is colliding with any mesh. More...
 
CreateMesh[] getColliders ()
 gets a table of mesh that this mesh has set collision with. More...
 
mesh setCastShadow (bool cast=true)
 Sets whether or not the mesh casts a shadow. More...
 
- Public Member Functions inherited from mesh
mesh addMesh (mesh *m)
 add a child mesh. More...
 
mesh getParent ()
 get the parent mesh. More...
 
string getType ()
 get the type of this mesh. More...
 
mesh setPosition (float X, float Y, float Z)
 sets the position of the mesh. More...
 
multiReturn< float, float, float > getPosition ()
 gets the position of the mesh. More...
 
mesh moveForward (float speed=1, float xRotation=0, float yRotation=0, float zRotation=0)
 moves the mesh forward or toward a direction. More...
 
mesh setX (float X)
 sets the X axis of the mesh. More...
 
mesh setY (float Y)
 sets the Y axis of the mesh. More...
 
mesh setZ (float Z)
 sets the Z axis of the mesh. More...
 
float getX ()
 gets the X axis of the mesh. More...
 
float getY ()
 gets the Y axis of the mesh. More...
 
float getZ ()
 gets the Z axis of the mesh. More...
 
mesh setRotation (float Rx, float Ry, float Rz)
 sets the X, Y, and Z rotation of the mesh. More...
 
multiReturn< float, float, float > getRotation ()
 gets the rotation of the mesh. More...
 
mesh setRx (float Rx)
 sets the X rotation of the mesh. More...
 
mesh setRy (float Ry)
 sets the Y rotation of the mesh. More...
 
mesh setRz (float Rz)
 sets the Z rotation of the mesh. More...
 
float getRx ()
 gets the X rotational axis of the mesh. More...
 
float getRy ()
 gets the Y rotational axis of the mesh. More...
 
float getRy ()
 gets the Y rotational axis of the mesh. More...
 
mesh hide ()
 hide the mesh. More...
 
mesh show ()
 shows the mesh. More...
 
mesh setVisible (bool visible=true)
 sets the visibility of the mesh. More...
 
bool isVisible ()
 gets the visibility of the mesh. More...
 
mesh setLighting (bool lit=true)
 sets whether the mesh is fully lit or needs a light source. More...
 
mesh setZBuffer (bool ZBuffer=true)
 sets whether the mesh has a ZBuffer or not. More...
 
mesh setScale (float X=-1, float Y=-1, float Z=-1)
 sets the X, Y, and Z scale. More...
 
multiReturn< float, float, float > getScale ()
 gets the X, Y and Z scale. More...
 
mesh setColor (int r, int g, int b, int a=255)
 sets the color of the mesh. More...
 
mesh remove ()
 removes the mesh. More...
 
mesh setProperty (string property, string value)
 sets a property of the mesh. More...
 
string getProperty (string property)
 gets the value of a set property. More...
 
string[] getProperties ()
 gets all properties from the object. More...
 
mesh removeProperty (string property)
 removes a property from the object. More...
 
mesh clearProperties ()
 removes all properties from the object. See removeProperty() More...
 
mesh doCommands (string cmd)
 creates the mesh from an object like a server command. More...
 
mesh[] getChildren ()
 gets a list of added children. More...
 
string getObject (bool includeChildren=true)
 get the mesh as a total object. More...
 
mesh sendToClients (bool removeOthers=false, string key="", string keyAns="")
 sends the mesh to all connected clients who meet the criteria. More...
 
mesh removeFromClients ()
 removes the mesh from all online clients. More...
 
bool setID (string ID)
 set the ID of the mesh. More...
 
string getID ()
 get the ID of the mesh. More...
 

Detailed Description

a 3D object.

Constructor & Destructor Documentation

◆ CreateMesh()

CreateMesh::CreateMesh ( string  serverMeshFile,
float  x = 0,
float  y = 0,
float  z = 0,
float  scaleX = 1,
float  scaleY = scaleX,
float  scaleZ = scaleY 
)

create a mesh.

   Create a 3D object. If the mesh file does not exist,
   gets it from the server if it exists on the server. If the file
   is out of date from the server's file, it will be replaced.
   If the server mesh file and the local file does not exist, it does not appear but is still created.\n
   Derives all mesh functions.\n
   There are also pre-defined mesh that can be created. Set the serverMeshFile to:\n
   \t"plane"\t->\tCreates a plane mesh.
Parameters
The3D mesh's server file.
(optional)The X axis of the mesh.
(optional)The Y (up/down) axis of the mesh.
(optional)The Z axis of the mesh.
(optional)The scale of the mesh along the X axis.
(optional)The scale of the mesh along the Y axis.
(optional)The scale of the mesh along the Z axis.

Member Function Documentation

◆ collides()

bool CreateMesh::collides ( )

checks if this mesh is colliding with any mesh.

   Checks if this mesh is colliding with any mesh set with mesh:setCollisionWith().
Returns
Whether or not this mesh is colliding with any collision mesh.

◆ collidesWith()

bool CreateMesh::collidesWith ( CreateMesh m)

checks if this mesh is colliding with another mesh.

   Checks if this mesh is touching the given mesh.
Parameters
Themesh to check collision against.
Returns
Whether or not this mesh and the given mesh are currently colliding.

◆ copyImageTo()

mesh CreateMesh::copyImageTo ( string  imagePath,
int  toX = 0,
int  toY = 0,
int  fromX = 0,
int  fromY = 0,
int  fromW = -1,
int  fromH = -1,
int  layer = 0,
string  storeAs = getImage(),
int  totalW = -1,
int  totalH = -1 
)

copy part of an image to this texture.

   Copies part, or the whole, image to this mesh's texture.\n
   If this mesh does not have a texture, one will be created; see totalW and totalH for determining the size of the texture created.\n
   The new texture can also be stored into the driver and later set by another mesh; see storeAs.
Parameters
Theimage file to copy onto this mesh's texture.
(optional)The X axis of the texture to place the image at.
(optional)The Y axis of the texture to place the image at.
(optional)The X source of the image to start copying to the mesh's texture.
(optional)The Y source of the image to start copying to the mesh's texture.
(optional)The width of the image to copy to the mesh's texture. If negative, it is the whole image's width.
(optional)The height of the image to copy to the mesh's texture. If negative, it is the whole image's height.
(optional)The layer of the mesh's texture to copy to. If the layer doesn't exist, one will be created.
(optional)The name of the new texture to be stored in the driver.
(optional)The total width of the new texture. If negative and a texture has been set, then uses the texture's width. If negative and no texture set, then uses the mesh's X scale.
(optional)The total height of the new texture. If negative and a texture has been set, then uses the texture's height. If negative and no texture set, then uses the mesh's Y scale.
Returns
Returns itself.

◆ getColliders()

CreateMesh [] CreateMesh::getColliders ( )

gets a table of mesh that this mesh has set collision with.

Todo:
CreateMesh:getColliders() should return a list of colliders.
   Gets a list of mesh that this mesh has set collision with (see mesh:setCollisionWith()).
Returns
A table of mesh this mesh has a set collision with.

◆ getImage()

string CreateMesh::getImage ( )

gets the last set image file.

   Gets the last set image file.\n
   WARNING: gets the last set image file, NOT the current image file. This means that if you load an image file that doesn't exist, it returns the file that doesn't exist.
Returns
The last set image file.

◆ getMesh()

string CreateMesh::getMesh ( )

gets the last set mesh file.

Todo:
CreateMesh:getMesh() should also be able to return the absolute mesh.
   Gets the last set mesh file.\n
   WARNING: gets the last set mesh file, NOT the current mesh file. This means that if you load a mesh file that doesn't exist, it returns the file that doesn't exist.
Returns
The last set mesh file.

◆ hasCollisionWith()

bool CreateMesh::hasCollisionWith ( CreateMesh m)

checks if this mesh has collision with another mesh.

   Checks if this mesh has collision with another mesh.\n
   This is not checking the collision against the mesh (see mesh:collidesWith() for that),
   but rather if this mesh has set a collision with another mesh (see mesh:setCollisionWith()).
Parameters
Themesh to check collision against.
Returns
Whether or not this mesh has collision detection with the given mesh.

◆ isLoaded()

bool CreateMesh::isLoaded ( )

checks if the mesh has loaded yet.

   Checks if the mesh successfully loaded the mesh file.
Returns
Whether or not the mesh file loaded successfully.

◆ setAnimation()

mesh CreateMesh::setAnimation ( int  start,
int  end,
int  speed 
)

sets the animation loop and speed.

   Sets the animation loop and speed.\n
   The animation speed is in delta time, so you don't have to worry about slow animations due to FPS.
Parameters
Thestart frame of the loop.
Theend frame of the loop.
Thespeed of the loop.
Returns
Returns itself.

◆ setCastShadow()

mesh CreateMesh::setCastShadow ( bool  cast = true)

Sets whether or not the mesh casts a shadow.

   Casts a shadow of the mesh, drawn from a light source that casts shadows with Create3DLight:setCastShadows().\n
Parameters
(optional)Whether or not the mesh casts a shadow.
Returns
Returns itself.

◆ setChildAnimation()

mesh CreateMesh::setChildAnimation ( bool  childAnimation = true)

sets whether the child mesh bones should follow this mesh's animation.

   Sets whether or not the child mesh (see mesh:addMesh()) bones should follow this mesh's bones during animation.\n
   In order for the child's bone to follow this mesh's bone, the bones must both have the same name.
   The bone names can be modified in your 3D modeling program.
Parameters
(optional)Whether or not the child bones should follow the mesh's bones.
Returns
Returns itself.

◆ setCollisionWith()

mesh CreateMesh::setCollisionWith ( CreateMesh m)

sets collision with another mesh.

Parameters
Themesh to set collision with.
Returns
Returns itself.

◆ setImage()

bool CreateMesh::setImage ( string  filePath,
int  layer = 0 
)

sets the image texture of the mesh from a file path.

   Sets the image file of the mesh.\n
   If the image file does not exist,
   gets it from the server if it exists on the server. If the file
   is out of date from the server's file, it will be replaced.
   If the server image file and the local file does not exist, it does not change.\n
   If a texture has been created and stored in the driver, and all of the above have not occurred, uses the texture stored in the driver.\n
Parameters
Theimage file path.
(optional)The layer to set as the texture.
Returns
Whether or not the setImage was successful. Note that this returns false if the image is still being downloaded from the server.

◆ setMesh()

mesh CreateMesh::setMesh ( string  serverMeshFile)

sets the mesh file.

   Sets the mesh to be displayed.\n
   If the mesh file does not exist,
   gets it from the server if it exists on the server. If the file
   is out of date from the server's file, it will be replaced.
   If the server mesh file and the local file does not exist, it does not change.\n
Parameters
The3D mesh's server file.
Returns
Returns itself.