Kigs Framework  Doc version 0.8
Open source multi purpose Rapid Application Development framework
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
Mesh Class Referenceabstract

#include <KMesh.h>

Inheritance diagram for Mesh:
HDrawable Drawable SceneNode CoreModifiable GenericRefCountedBaseClass

Classes

class  OneColorTriangleStruct
 Triangle with a uniform color. More...
 
class  OneNormalTriangleStruct
 Triangle with a unique normal. More...
 
class  TexCoord
 Texture Coordinates structure. More...
 
class  TexturedTriangleStruct
 Textured triangle structure, with templated texture count parameter. More...
 
class  TexturedTriangleStructBase
 Textured triangle base structure. More...
 
class  ThreeColorTriangleStruct
 Triangle with a color at each vertex. More...
 
class  ThreeNormalTriangleStruct
 Triangle with normal at each vertex. More...
 
class  Triangle
 Triangle structure. More...
 

Public Member Functions

 Mesh (const kstl::string &name, DECLARE_CLASS_NAME_TREE_ARG)
 constructor More...
 
 Mesh (const Mesh &pMesh)
 constructor from a mesh More...
 
void DoPreDraw (TravState *) override
 pre draw method More...
 
int getVertexCount ()
 get the number of vertice More...
 
int getTriangleCount ()
 get the number of triangles More...
 
bool getVertex (unsigned int index, Point3D &Pt)
 get a vertex from its index More...
 
bool getTriangle (int index, int &a, int &b, int &c)
 get a triangle from its index More...
 
bool CopyVertexAndTriangle (int &VCount, int &TCount, Point3D *&VArray, int *&IndexArray)
 copy the triangle list and the vertice list More...
 
const Point3D & GetVertex (unsigned int index)
 get a vertex from its index More...
 
void SetVertex (unsigned int index, const Point3D &v)
 set a vertex to an index More...
 
const Vector4D & GetColor (unsigned int index)
 get a color from its index More...
 
void SetColor (unsigned int index, const Vector4D &v)
 set a color to an index More...
 
const Vector3D & GetNormal (unsigned int index)
 get a normal from its index More...
 
void SetNormal (unsigned int index, const Vector3D &v)
 set a normal to an index More...
 
const TexCoordGetTexCoord (unsigned int index)
 get a texCoord from its index More...
 
void SetTexCoord (unsigned int index, const TexCoord &v)
 set a texCoord to an index More...
 
void Set_VertexCount (unsigned int _value)
 Set number of vertice.
 
void Set_VertexArray (Point3D *_value)
 Set List of All Vertice.
 
void Set_NormalCount (unsigned int _value)
 Set number of normal.
 
void Set_NormalArray (Vector3D *_value)
 Set List of All normals.
 
void Set_TexCoordCount (unsigned int _value)
 Set number of Texture coords.
 
void Set_TexArray (TexCoord *_value)
 Set List of all Texture coords.
 
void Set_ColorCount (unsigned int _value)
 Set number of color.
 
void Set_ColorArray (Vector4D *_value)
 Set List of All colors.
 
- Public Member Functions inherited from HDrawable
 HDrawable (const kstl::string &name, DECLARE_CLASS_NAME_TREE_ARG)
 constructor More...
 
void DoDraw (TravState *travstate) override
 draw method More...
 
void DoPostDraw (TravState *travstate) override
 post draw method More...
 
- Public Member Functions inherited from Drawable
void CheckPostDraw (TravState *travstate)
 check before calling corresponding DoPredraw More...
 
virtual bool BBoxUpdate (kdouble time)
 update the bounding box More...
 
bool addItem (const CMSP &item, ItemPosition pos=Last) override
 add item in scene tree More...
 
bool removeItem (const CMSP &item) override
 remove item in scene tree More...
 
virtual void GetGlobalPosition (Matrix3x4 *pLocalToGlobal, kfloat &x, kfloat &y, kfloat &z)
 get the global position of the drawable More...
 
- Public Member Functions inherited from SceneNode
bool addItem (const CMSP &item, ItemPosition pos=Last DECLARE_DEFAULT_LINK_NAME) override
 add item at first or last position
 
- Public Member Functions inherited from CoreModifiable
void Init ()
 Modifiable managmenent.
 
void EmptyItemList ()
 remove all items (sons)
 
CMSP GetInstanceByPath (const std::string &path)
 return the instance corresponding to the given path in sons tree
 
std::string GetRuntimeID () const
 ID.
 
CoreModifiableAttributegetAttribute (KigsID labelid) const
 Attribute management.
 
u32 getNbArrayElements (KigsID attributeLabel) const
 return element count for an array type attribute
 
template<typename attribute_type , typename value_type >
attribute_type * AddDynamicAttribute (KigsID ID, const value_type &value)
 Dynamic attribute management.
 
const kigs::unordered_map< KigsID, ModifiableMethodStruct > * GetMethods ()
 Method management.
 
bool aggregateWith (CMSP &item, ItemPosition pos=Last)
 Aggregate management.
 
void flagAsNotificationCenterRegistered ()
 Flags.
 
void InitParametersFromList (const std::vector< CoreModifiableAttribute * > *params)
 Utility. More...
 
virtual void UninitModifiable ()
 called when InitModifiable has failled : reset read/write flag on all init params More...
 
virtual void ProtectedDestroy ()
 Destroy method decrement refcounter and delete instance if no more used. More...
 
virtual void addUser (CoreModifiable *user)
 add the given parent to list
 
virtual void removeUser (CoreModifiable *user)
 remove user (parent)
 

Protected Member Functions

 DECLARE_METHOD (GetColorPointer)
 link to getColor method
 
 DECLARE_METHOD (GetNormalPointer)
 link to getNormal method
 
 DECLARE_METHOD (GetTexCoordPointer)
 link to getTexCoord method
 
virtual void UpdateMesh ()
 update the mesh if one of its componants has changed
 
virtual void ProtectedInit ()=0
 protected initialization modifiable
 
void InitModifiable () override
 initialize modifiable
 
virtual ~Mesh ()
 destructor
 
virtual void InitBoundingBox ()
 bounding box initialization
 
- Protected Member Functions inherited from HDrawable
virtual ~HDrawable ()
 destructor
 
- Protected Member Functions inherited from Drawable
virtual bool PreDraw (TravState *)
 initialise pre draw method More...
 
virtual bool Draw (TravState *)
 initialise draw method More...
 
virtual bool PostDraw (TravState *)
 initialise PostDraw method More...
 
virtual void FatherNode3DNeedBoundingBoxUpdate ()
 update the father node bounding box
 
- Protected Member Functions inherited from CoreModifiable
void UpdateAggregates (const Timer &timer, void *addParam)
 Internals.
 
void Export (std::vector< CoreModifiable * > &savedList, XMLNode *currentNode, bool recursive, ExportSettings *settings)
 Export. More...
 
CoreModifiableAttributeGenericCreateDynamicAttribute (CoreModifiable::ATTRIBUTE_TYPE type, KigsID ID)
 create and add dynamic attribute except arrays
 

Protected Attributes

maBool mVertexNeedUpdate
 TRUE if myVertex need to be updated.
 
maBool mColorNeedUpdate
 TRUE if mColor need to be updated.
 
maBool mTexCoordNeedUpdate
 TRUE if myTexCoord need to be updated.
 
maBool mNormalNeedUpdate
 TRUE if myNormal need to be updated.
 
maBool mShareMaterial
 ?
 
maString mFileName
 name of the file to read in load method
 
unsigned int mVertexCount
 number of vertice
 
Point3D * mVertexArray
 List of All Vertice.
 
unsigned int mNormalCount
 number of normal
 
Vector3D * mNormalArray
 List of All normals.
 
unsigned int mTexCoordCount
 number of Texture coords
 
TexCoordmTexArray
 List of all Texture coords.
 
unsigned int mColorCount
 number of color
 
Vector4D * mColorArray
 List of All colors.
 
BBox mBoundingBox
 link to the bounding box
 

Friends

class ASEMeshLoader
 
class BinMeshLoader
 
class STLMeshLoader
 
class AABBTreeNode
 
class Collision
 
class Distance
 

Additional Inherited Members

- Static Public Member Functions inherited from CoreModifiable
static std::vector< CMSP > GetRootInstances (const KigsID &cid, bool exactTypeOnly=false)
 static method : return the set of all root instances of the given type
 
static void Append (std::string &XMLString, const std::list< CoreModifiable * > &toexport, bool recursive, ExportSettings *settings=nullptr)
 static method to export the several CoreModifiable to an XML file. if recursive flag is set to true, export also all sons tree More...
 
static void Export (const std::string &filename, CoreModifiable *toexport, bool recursive=false, ExportSettings *settings=nullptr)
 static method to export the given CoreModifiable to an XML file. if recursive flag is set to true, export also all sons tree More...
 
static XMLNodeExportToXMLNode (CoreModifiable *toexport, XML *owner_xml_file, bool recursive, ExportSettings *settings=nullptr)
 static method to export the given CoreModifiable to an XML Node. if recursive flag is set to true, export also all sons tree More...
 
static std::string ExportToXMLString (CoreModifiable *toexport, bool recursive, ExportSettings *settings=nullptr)
 static method to export the given CoreModifiable to an XML file. if recursive flag is set to true, export also all sons tree More...
 
static void Export (std::string &XMLString, const std::list< CoreModifiable * > &toexport, bool recursive, ExportSettings *settings=nullptr)
 static method to export the several CoreModifiable to an XML file. if recursive flag is set to true, export also all sons tree More...
 
static CMSP Import (const std::string &filename, bool noInit=false, bool keepImportFileName=false, ImportState *state=nullptr, const std::string &override_name="")
 return an new CoreModifiable instance using the description found in XML file given by name
 
static CMSP GetInstanceByGlobalPath (const std::string &path)
 static method : return the instance corresponding to the given path, and given search start
 
static void debugPrintfFullTree (int maxindent=3)
 Editor. More...
 
- Static Protected Member Functions inherited from CoreModifiable
template<typename StringType >
static CMSP Import (XMLNodeTemplate< StringType > *currentNode, CoreModifiable *currentModifiable, ImportState &importState)
 recusrive method to add sons and attributes found in the XML file
 

Detailed Description

Old style Mesh.

Obsolete

Constructor & Destructor Documentation

◆ Mesh() [1/2]

Mesh::Mesh ( const kstl::string &  name,
DECLARE_CLASS_NAME_TREE_ARG   
)

constructor

Parameters
name: instance name
DECLARE_CLASS_NAME_TREE_ARG: list of arguments

◆ Mesh() [2/2]

Mesh::Mesh ( const Mesh pMesh)

constructor from a mesh

Parameters
pMesh: mesh to copy

Member Function Documentation

◆ CopyVertexAndTriangle()

bool Mesh::CopyVertexAndTriangle ( int &  VCount,
int &  TCount,
Point3D *&  VArray,
int *&  IndexArray 
)

copy the triangle list and the vertice list

Parameters
VCount: number of vertice (in/out param)
TCount: number of triangles (in/out param)
VArray: list of vertice (in/out param)
IndexArray: list of triangle's vertice index (in/out param)
Returns
TRUE if the copy has been done, FALSE otherwise

◆ DoPreDraw()

void Mesh::DoPreDraw ( TravState state)
overridevirtual

pre draw method

Parameters
TravState: camera state

Reimplemented from HDrawable.

◆ GetColor()

const Vector4D & Mesh::GetColor ( unsigned int  index)
inline

get a color from its index

Parameters
index: index asked
Returns
color asked (in/out param)

◆ GetNormal()

const Vector3D & Mesh::GetNormal ( unsigned int  index)
inline

get a normal from its index

Parameters
index: index asked
Returns
normal asked (in/out param)

◆ GetTexCoord()

const TexCoord & Mesh::GetTexCoord ( unsigned int  index)
inline

get a texCoord from its index

Parameters
index: index asked
Returns
texCoord asked (in/out param)

◆ getTriangle()

bool Mesh::getTriangle ( int  index,
int &  a,
int &  b,
int &  c 
)

get a triangle from its index

Parameters
index: index of the vertex to get
a: first vertex's indice of the asked triangle (in/out param)
b: second vertex's indice of the asked triangle (in/out param)
c: third vertex's indice of the asked triangle (in/out param)
Returns
TRUE if the triangle exist, FALSE otherwise

◆ getTriangleCount()

int Mesh::getTriangleCount ( )

get the number of triangles

Returns
the number of triangles

◆ GetVertex()

const Point3D & Mesh::GetVertex ( unsigned int  index)
inline

get a vertex from its index

Parameters
index: index asked
Returns
vertex asked (in/out param)

◆ getVertex()

bool Mesh::getVertex ( unsigned int  index,
Point3D &  Pt 
)

get a vertex from its index

Parameters
index: index of the vertex to get
Pt: the asked vertex (in/out param)
Returns
TRUE if the vertex exist, FALSE otherwise

◆ getVertexCount()

int Mesh::getVertexCount ( )

get the number of vertice

Returns
the number of vertice

◆ SetColor()

void Mesh::SetColor ( unsigned int  index,
const Vector4D &  v 
)

set a color to an index

Parameters
index: new color index
v: new color

◆ SetNormal()

void Mesh::SetNormal ( unsigned int  index,
const Vector3D &  v 
)

set a normal to an index

Parameters
index: new normal index
v: new normal

◆ SetTexCoord()

void Mesh::SetTexCoord ( unsigned int  index,
const TexCoord v 
)

set a texCoord to an index

Parameters
index: new texCoord index
v: new texCoord

◆ SetVertex()

void Mesh::SetVertex ( unsigned int  index,
const Point3D &  v 
)

set a vertex to an index

Parameters
index: new vertex index
v: new vertex

The documentation for this class was generated from the following files: