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

a 3D object. More...

#include <mesh.h>

Inheritance diagram for mesh:
Create3DImage Create3DLight Create3DParticle Create3DText CreateMesh

Public Member Functions

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.

    Mesh (such as CreateMesh or Create3DText) derive all of the functions in this class.\n
    This means that any mesh may use these by using something like "meshName:setX(10)".\n

Member Function Documentation

◆ addMesh()

mesh mesh::addMesh ( mesh m)

add a child mesh.

   Adds a child mesh. The child mesh will also have a position and rotation relative to this object's position.
Parameters
Themesh to add as a child.
Returns
Returns itself.

◆ clearProperties()

mesh mesh::clearProperties ( )

removes all properties from the object. See removeProperty()

Returns
Returns itself.

◆ doCommands()

mesh mesh::doCommands ( string  cmd)

creates the mesh from an object like a server command.

Todo:
mesh:doCommands() should do the commands.
   Uses the given comma-separated properties and creates the mesh like a command.
   You may get the object (see mesh:getObject()) and use this function to make the mesh
   load the same data as the given object.\n
   WARNING: children may also be created, if given.
Parameters
Theobject command.
Returns
Returns itself.

◆ getChildren()

mesh [] mesh::getChildren ( )

gets a list of added children.

   Gets all added children using mesh:addMesh().\n
   The returned list index starts at 0.
Returns
A list of all mesh attached to this one.

◆ getID()

string mesh::getID ( )

get the ID of the mesh.

Returns
The ID of the mesh.

◆ getObject()

string mesh::getObject ( bool  includeChildren = true)

get the mesh as a total object.

   Gets the mesh and all of it's set properties as a string object.
   Can be used to save the mesh into a data file.
Parameters
Whetheror not the children objects should also be returned.
Returns
The mesh as an object string, and it's children if necessary.

◆ getParent()

mesh mesh::getParent ( )

get the parent mesh.

   Gets the mesh who added this mesh (see mesh:addElement()), if any.
Returns
(1) The parent mesh who added this mesh. If no parent, then (2) This mesh itself.

◆ getPosition()

multiReturn<float, float, float> mesh::getPosition ( )

gets the position of the mesh.

   Gets the X, Y, and Z axis of the mesh.
Returns
The X, Y, and Z axis of the mesh.

◆ getProperties()

string [] mesh::getProperties ( )

gets all properties from the object.

Returns
All properties of the object.

◆ getProperty()

string mesh::getProperty ( string  property)

gets the value of a set property.

Parameters
Theproperty to get the value of.
Returns
The value of the given property.

◆ getRotation()

multiReturn<float, float, float> mesh::getRotation ( )

gets the rotation of the mesh.

   Gets the X, Y, and Z rotational axis of the mesh.
Returns
The X, Y, and Z rotational axis of the mesh.

◆ getRx()

float mesh::getRx ( )

gets the X rotational axis of the mesh.

Returns
The X rotational axis.

◆ getRy() [1/2]

float mesh::getRy ( )

gets the Y rotational axis of the mesh.

Returns
The Y rotational axis.

◆ getRy() [2/2]

float mesh::getRy ( )

gets the Y rotational axis of the mesh.

Returns
The Y rotational axis.

◆ getScale()

multiReturn<float, float, float> mesh::getScale ( )

gets the X, Y and Z scale.

   Gets the scale of the X axis, the Y axis, and the Z axis.
Returns
The scale of the X, Y, and Z axis.

◆ getType()

string mesh::getType ( )

get the type of this mesh.

   Gets the type of mesh. For example, if this is a mesh, the type is "CreateMesh".
Returns
The type of the mesh.

◆ getX()

float mesh::getX ( )

gets the X axis of the mesh.

Returns
The X axis.

◆ getY()

float mesh::getY ( )

gets the Y axis of the mesh.

Returns
The Y axis.

◆ getZ()

float mesh::getZ ( )

gets the Z axis of the mesh.

Returns
The Z axis.

◆ hide()

mesh mesh::hide ( )

hide the mesh.

   Hides the mesh and it's children (see mesh:addMesh()).
Returns
Returns itself.

◆ isVisible()

bool mesh::isVisible ( )

gets the visibility of the mesh.

   Gets whether the mesh was hidden or shown (see mesh:hide() and mesh:show()).
Returns
The visibility of the mesh.

◆ moveForward()

mesh mesh::moveForward ( float  speed = 1,
float  xRotation = 0,
float  yRotation = 0,
float  zRotation = 0 
)

moves the mesh forward or toward a direction.

   Moves the mesh forward or toward a direction using rotational axis.
   Does not rotate the mesh.\n
   WARNING: children (see mesh:addMesh()) maintain a position relative to this mesh.
Parameters
(optional)The speed to move the mesh.
(optional)The X rotational direction.
(optional)The Y rotational direction.
(optional)The Z rotational direction.
Returns
Returns itself.

◆ remove()

mesh mesh::remove ( )

removes the mesh.

   Destroys the mesh, removing it completely.
Returns
Returns itself.

◆ removeFromClients()

mesh mesh::removeFromClients ( )

removes the mesh from all online clients.

Todo:
mesh:removeFromClients() should take criteria for who to remove from.
   Removes the mesh from all online clients.\n
   WARNING: this does not remove the mesh from the user.\n
   WARNING: this removes the mesh entirely from the server.
Returns
Returns itself.

◆ removeProperty()

mesh mesh::removeProperty ( string  property)

removes a property from the object.

   Note that setting the property's value to an empty string will also call removeProperty().
Parameters
Theproperty to be removed.
Returns
Returns itself.

◆ sendToClients()

mesh mesh::sendToClients ( bool  removeOthers = false,
string  key = "",
string  keyAns = "" 
)

sends the mesh to all connected clients who meet the criteria.

   Sends the mesh to all clients who are connected to this world.\n
   When the mesh is received, it is caught as a command (see mesh:doCommands()).\n
   The mesh is then stored in the server based on it's ID (see mesh:setID()).
Parameters
(optional)Whether or not all of the object's properties are required to be sent.
(optional)The send key who all clients must have in order to get the object.
(optional)The send key value all clients must also have.
Returns
Returns itself.

◆ setColor()

mesh mesh::setColor ( int  r,
int  g,
int  b,
int  a = 255 
)

sets the color of the mesh.

Parameters
Theamount of red (0-255).
Theamount of green (0-255).
Theamount of blue (0-255).
(optional)The amount of alpha (transparency) (0-255).
Returns
Returns itself.

◆ setID()

bool mesh::setID ( string  ID)

set the ID of the mesh.

   Sets the ID of the mesh. By default, the mesh has a unique ID.\n
   WARNING: If the ID has a minus sign ("-") at the beginning of the new ID to be set,
   the ID will remain static, even for online objects when being sent. Otherwise if there is no minus sign,
   a unique ID will be generated for online objects, and the online object (if sent) will be removed by default on disconnect.\n
   For example, if you want to create an online object only one time total that all clients can see and modify (opposed to one online object per client),
   you may want to add a minus sign to the beginning of the ID. Used in the case of real-time editing game town elements.
Parameters
Thenew ID to be set.
Returnstrue if succeeded, otherwise false if there was an ID conflict.

◆ setLighting()

mesh mesh::setLighting ( bool  lit = true)

sets whether the mesh is fully lit or needs a light source.

Parameters
(optional)Whether or not the mesh is fully lit.
Returns
Returns itself.

◆ setPosition()

mesh mesh::setPosition ( float  X,
float  Y,
float  Z 
)

sets the position of the mesh.

   Sets the X, Y, and Z axis of the mesh.\n
   WARNING: the mesh does not warp through colliding mesh.\n
   WARNING: children (see mesh:addMesh()) maintain a position relative to this mesh.
Parameters
TheX axis.
TheY axis.
TheZ axis.
Returns
Returns itself.

◆ setProperty()

mesh mesh::setProperty ( string  property,
string  value 
)

sets a property of the mesh.

   Sets a property of the mesh.\n
   The property is then sent to clients who meet the given criteria (see mesh:sendToClients()) and can be caught as a command.
   WARNING: Setting the value to an empty string removes the property.
Parameters
Theproperty to be set.
Thevalue of the property.
Returns
Returns itself.

◆ setRotation()

mesh mesh::setRotation ( float  Rx,
float  Ry,
float  Rz 
)

sets the X, Y, and Z rotation of the mesh.

   Sets the X, Y, and Z rotational axis of the mesh.
   WARNING: children (see mesh:addMesh()) maintain a rotation relative to this mesh.
Parameters
TheX rotational axis.
TheY rotational axis.
TheZ rotational axis.
Returns
Returns itself.

◆ setRx()

mesh mesh::setRx ( float  Rx)

sets the X rotation of the mesh.

   Sets the X rotational axis of the mesh.
   WARNING: children (see mesh:addMesh()) maintain a position relative to this mesh.
Parameters
TheX rotational axis.
Returns
Returns itself.

◆ setRy()

mesh mesh::setRy ( float  Ry)

sets the Y rotation of the mesh.

   Sets the Y rotational axis of the mesh.
   WARNING: children (see mesh:addMesh()) maintain a position relative to this mesh.
Parameters
TheY rotational axis.
Returns
Returns itself.

◆ setRz()

mesh mesh::setRz ( float  Rz)

sets the Z rotation of the mesh.

   Sets the Z rotational axis of the mesh.
   WARNING: children (see mesh:addMesh()) maintain a position relative to this mesh.
Parameters
TheZ rotational axis.
Returns
Returns itself.

◆ setScale()

mesh mesh::setScale ( float  X = -1,
float  Y = -1,
float  Z = -1 
)

sets the X, Y, and Z scale.

   Sets the scale of the X axis, the Y axis, and the Z axis.\n
   If X is negative, sets to 1. If Y or Z is negative, sets to X or Y respectively.
Parameters
(optional)The X axis scale.
(optional)The Y axis scale.
(optional)The Z axis scale.
Returns
Returns itself.

◆ setVisible()

mesh mesh::setVisible ( bool  visible = true)

sets the visibility of the mesh.

   Sets the mesh and it's children to visible or invisible (see mesh:hide() and mesh:show()).
Parameters
Thevisibility of the mesh.
Returns
Returns itself.

◆ setX()

mesh mesh::setX ( float  X)

sets the X axis of the mesh.

   Sets the X axis of the mesh.\n
   WARNING: the mesh does not warp through colliding mesh.
   WARNING: children (see mesh:addMesh()) maintain a position relative to this mesh.
Parameters
Thenew X axis.
Returns
Returns itself.

◆ setY()

mesh mesh::setY ( float  Y)

sets the Y axis of the mesh.

   Sets the Y axis of the mesh.\n
   WARNING: the mesh does not warp through colliding mesh.\n
   WARNING: children (see mesh:addMesh()) maintain a position relative to this mesh.
Parameters
Thenew Y axis.
Returns
Returns itself.

◆ setZ()

mesh mesh::setZ ( float  Z)

sets the Z axis of the mesh.

   Sets the Z axis of the mesh.\n
   WARNING: the mesh does not warp through colliding mesh.\n
   WARNING: children (see mesh:addMesh()) maintain a position relative to this mesh.
Parameters
Thenew Z axis.
Returns
Returns itself.

◆ setZBuffer()

mesh mesh::setZBuffer ( bool  ZBuffer = true)

sets whether the mesh has a ZBuffer or not.

   Sets if the mesh should have a ZBuffer. If the ZBuffer is set to false, then the mesh will be drawn on the screen above all mesh that have a ZBuffer.\n
   For example, a mesh without a ZBuffer can be seen through walls and through other objects.
Parameters
(optional)Whether or not the mesh has a ZBuffer.
Returns
Returns itself.

◆ show()

mesh mesh::show ( )

shows the mesh.

   Shows the mesh and it's children if it was hidden (see mesh:hide() and mesh:setVisible()).
Returns
Returns itself.