class M_Mesh3D

The M_Mesh3D class represents a 3D object in a Mesh3DLayer.

Member Functions

void Clear()

Completely empties the mesh of all points, faces, materials, etc.

Return value: none

void SetDefaultColor(col)

Set the default color for faces with no assigned material.

Return value: none
col (rgb_color): default face color

rgb_color DefaultColor()

Get the default color for faces with no assigned material.

Return value (rgb_color): default face color

void SetEdgeColor()

Set the edge color.

Return value: none
col (rgb_color): edge color

rgb_color EdgeColor()

Get the edge color.

Return value (rgb_color): edge color

void SetClockwise()

Set whether front-facing 3D faces are aligned clockwise or counter-clockwise.

Return value: none
b (bool): true for clockwise, false for counter-clockwise

bool Clockwise()

Test whether front-facing 3D faces are aligned clockwise or counter-clockwise.

Return value (bool): true for clockwise, false for counter-clockwise

int CountPoints()

Returns the number of points in the mesh.

Return value (int): number of points

LM_Vector3 Point(id)

Get the position of a point in the mesh.

Return value (LM_Vector3): point location
id (int): point identifier

void AddPoint(vec)

Add a new point to the mesh.

Return value: none
vec (LM_Vector3): point location

void RemovePoint(id)

Remove a point from the mesh.

Return value: none
id (int): point identifier

void SetPoint(id, vec)

Change an existing point's position.

Return value: none
id (int): point identifier
vec (LM_Vector3): new position

int CountTexturePoints()

Return the number of texture coordinates.

Return value (int): the number of texture coordinates

LM_Vector2 TexturePoint(id)

Get the value of a texture coordinate.

Return value (LM_Vector2): the value of a texture coordinate
id (int): texture coordinate identifier

void AddTexturePoint(vec)

Add a new texture coordinate.

Return value: none
vec (LM_Vector2): the value of the new texture coordinate

void RemoveTexturePoint(id)

Remove a texture coordinate from the mesh.

Return value: none
id (int): texture coordinate identifier

int CountFaces()

Return the number of faces in the 3D mesh.

Return value (int): the number of faces

M_Face3D Face(id)

Get the properties of a particular face in the mesh.

Return value (M_Face3D): a face in the mesh
id (int): face identifier

void AddFace(p1, p2, p3)

Add a new three-sided face to the mesh.

Return value: none
p1 (int): first corner point
p2 (int): second corner point
p3 (int): third corner point

void AddFace(p1, p2, p3, p4)

Add a new four-sided face to the mesh.

Return value: none
p1 (int): first corner point
p2 (int): second corner point
p3 (int): third corner point
p4 (int): fourth corner point

void RemoveFace(id)

Delete a face from the mesh.

Return value: none
id (int): face identifier

int CountMaterials()

Returns the number of materials in the mesh.

Return value (int): number of materials

M_Material3D Material(id)

Gets the properties for a given material.

Return value (M_Material3D): a material in the mesh
id (int): material identifier

M_Material3D CreateNewMaterial()

Creates a new material in the mesh.

Return value (M_Material3D): the properties of the new material

void AddMaterial(m)

Adds a material to the mesh.

Return value: none
m (M_Material3D): material to add

void RemoveMaterial(id)

Deletes a material from the mesh.

Return value: none
id (int): material identifier

void ScaleToRadius(r)

Scale an entire mesh to fit a given radius. The larger dimension in X, Y, or Z will be scaled to fit this radius, and the other dimensions will scale to maintain the correct proportions. Scaling to a radius of 1.0 is a quick way to make sure that very large or very small 3D models fit the Moho workspace in a reasonable way.

Return value: none
r (float): radius to scale to
class M_Mesh3D {
  void Empty @ Clear();
 
  void SetDefaultColor(rgb_color col);
  rgb_color DefaultColor();
  void SetDefaultEdgeColor(rgb_color col);
  rgb_color DefaultEdgeColor();
  void SetDefaultEdgeWidth(real width);
  real DefaultEdgeWidth();
 
  void SetClockwise(bool b);
  bool Clockwise();
 
  int32 CountPoints();
  LM_Vector3 Point(int32 id);
  int32 AddPoint(LM_Vector3 &vec);
  int32 AddUniquePoint(LM_Vector3 &vec);
  void RemovePoint(int32 id);
  void SetPoint(int32 id, LM_Vector3 &vec);
 
  int32 CountNormals();
  LM_Vector3 Normal(int32 id);
  void AddNormal(LM_Vector3 &vec);
  void RemoveNormal(int32 id);
  void SetNormal(int32 id, LM_Vector3 &vec);
  void RebuildNormals(bool overrideExisting);
 
  int32 CountTexturePoints();
  LM_Vector2 TexturePoint(int32 id);
  void AddTexturePoint(LM_Vector2 &vec);
  void RemoveTexturePoint(int32 id);
 
  int32 CountFaces();
  M_Face3D *Face(int32 id);
  void AddFace(int32 p1, int32 p2, int32 p3);
  void AddFace(int32 p1, int32 p2, int32 p3, int32 p4);
  void RemoveFace(int32 id);
 
  int32 CountMaterials();
  M_Material3D *Material(int32 id);
  M_Material3D *CreateNewMaterial(const char *name=NULL);
  void AddMaterial(M_Material3D *m);
  void RemoveMaterial(int32 id);
  void SetCurMaterial(int32 id);
 
  void RebuildEdgeList();
 
  void ScaleToRadius(real r);
};