glc_mesh.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 
00003  This file is part of the GLC-lib library.
00004  Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
00005  Version 2.0.0 Beta 1, packaged on April 2010.
00006 
00007  http://glc-lib.sourceforge.net
00008 
00009  GLC-lib is free software; you can redistribute it and/or modify
00010  it under the terms of the GNU General Public License as published by
00011  the Free Software Foundation; either version 2 of the License, or
00012  (at your option) any later version.
00013 
00014  GLC-lib is distributed in the hope that it will be useful,
00015  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  GNU General Public License for more details.
00018 
00019  You should have received a copy of the GNU General Public License
00020  along with GLC-lib; if not, write to the Free Software
00021  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00022 
00023 *****************************************************************************/
00024 
00026 
00027 #ifndef GLC_MESH_H_
00028 #define GLC_MESH_H_
00029 
00030 #include <QHash>
00031 #include <QList>
00032 #include "../maths/glc_vector2df.h"
00033 #include "../maths/glc_vector3df.h"
00034 #include "../glc_global.h"
00035 #include "../shading/glc_material.h"
00036 #include "glc_meshdata.h"
00037 #include "glc_geometry.h"
00038 #include "glc_primitivegroup.h"
00039 #include "../glc_state.h"
00040 #include "../shading/glc_selectionmaterial.h"
00041 
00042 #include "../glc_config.h"
00043 
00046 
00050 
00051 class GLC_LIB_EXPORT GLC_Mesh : public GLC_Geometry
00052 {
00053         friend QDataStream &operator<<(QDataStream &, const GLC_Mesh &);
00054         friend QDataStream &operator>>(QDataStream &, GLC_Mesh &);
00055 
00056 public:
00057         typedef QHash<GLC_uint, GLC_PrimitiveGroup*> LodPrimitiveGroups;
00058         typedef QHash<const int, LodPrimitiveGroups*> PrimitiveGroupsHash;
00059 
00061 
00063 
00064 public:
00066         GLC_Mesh();
00067 
00069         GLC_Mesh(const GLC_Mesh&);
00070 
00072         GLC_Mesh& operator=(const GLC_Mesh&);
00073 
00075         virtual ~GLC_Mesh();
00077 
00078 
00080 
00081 public:
00083         static quint32 chunckID();
00084 
00086         virtual unsigned int faceCount() const;
00087 
00089         virtual unsigned int VertexCount() const;
00090 
00092         inline unsigned int numberOfNormals() const
00093         { return m_NumberOfNormals;}
00094 
00096         virtual const GLC_BoundingBox& boundingBox(void);
00097 
00099         virtual GLC_Geometry* clone() const;
00100 
00102         inline bool ColorPearVertexIsAcivated() const
00103         {return m_ColorPearVertex;}
00104 
00106         inline int lodCount() const
00107         {return m_MeshData.lodCount();}
00108 
00110         inline GLfloatVector positionVector() const
00111         {return m_MeshData.positionVector();}
00112 
00114         inline GLfloatVector normalVector() const
00115         {return m_MeshData.normalVector();}
00116 
00118         inline GLfloatVector texelVector() const
00119         {return m_MeshData.texelVector();}
00120 
00122         bool containsTriangles(int lod, GLC_uint materialId) const;
00123 
00125 
00126         QVector<GLuint> getTrianglesIndex(int lod, GLC_uint materialId) const;
00127 
00129         int numberOfTriangles(int lod, GLC_uint materialId) const;
00130 
00132         bool containsStrips(int lod, GLC_uint materialId) const;
00133 
00135 
00136         QList<QVector<GLuint> > getStripsIndex(int lod, GLC_uint materialId) const;
00137 
00139         int numberOfStrips(int lod, GLC_uint materialId) const;
00140 
00142         bool containsFans(int lod, GLC_uint materialId) const;
00143 
00145 
00146         QList<QVector<GLuint> > getFansIndex(int lod, GLC_uint materialId) const;
00147 
00149         int numberOfFans(int lod, GLC_uint materialId) const;
00150 
00152         inline bool containsLod(int lod) const
00153         {return (NULL != m_MeshData.getLod(lod));}
00154 
00156         inline bool lodContainsMaterial(int lod, GLC_uint materialId) const
00157         {
00158                 if (!m_PrimitiveGroups.contains(lod))return false;
00159                 else return m_PrimitiveGroups.value(lod)->contains(materialId);
00160         }
00161 
00163 
00164         inline double getLodAccuracy(int lod) const
00165         {
00166                 Q_ASSERT(containsLod(lod));
00167                 return m_MeshData.getLod(lod)->accuracy();
00168         }
00169 
00171         inline GLC_uint nextPrimitiveLocalId() const
00172         {return m_NextPrimitiveLocalId;}
00173 
00175         inline bool isEmpty() const
00176         {return m_MeshData.isEmpty();}
00177 
00179         inline QColor wireColor() const
00180         {return m_WireColor;}
00181 
00182 
00184 
00185 
00187 
00188 public:
00189 
00191         virtual void clear();
00192 
00194         void clearMeshWireAndBoundingBox();
00195 
00197         inline void addVertice(const GLfloatVector& vertices)
00198         {
00199                 *(m_MeshData.positionVectorHandle())+= vertices;
00200                 m_NumberOfVertice+= vertices.size() / 3;
00201         }
00202 
00204         inline void addNormals(const GLfloatVector& normals)
00205         {
00206                 *(m_MeshData.normalVectorHandle())+= normals;
00207                 m_NumberOfNormals+= normals.size() / 3;
00208         }
00209 
00211         inline void addTexels(const GLfloatVector& texels)
00212         {*(m_MeshData.texelVectorHandle())+= texels;}
00213 
00215         inline void addColors(const GLfloatVector& colors)
00216         {*(m_MeshData.colorVectorHandle())+= colors;}
00217 
00219         GLC_uint addTriangles(GLC_Material*, const IndexList&, const int lod= 0, double accuracy= 0.0);
00220 
00222         GLC_uint addTrianglesStrip(GLC_Material*, const IndexList&, const int lod= 0, double accuracy= 0.0);
00223 
00225         GLC_uint addTrianglesFan(GLC_Material*, const IndexList&, const int lod= 0, double accuracy= 0.0);
00226 
00228         void reverseNormals();
00229 
00231         inline void setColorPearVertex(bool flag)
00232         {m_ColorPearVertex= flag;}
00233 
00235         void finish();
00236 
00238         virtual void setCurrentLod(const int);
00239 
00241         virtual void replaceMasterMaterial(GLC_Material*);
00242 
00244         void replaceMaterial(const GLC_uint, GLC_Material*);
00245 
00247         inline void setNextPrimitiveLocalId(GLC_uint id)
00248         {m_NextPrimitiveLocalId= id;}
00249 
00251         inline void setWireColor(const QColor& color)
00252         {m_WireColor= color;}
00253 
00255 
00257 
00259 
00260 public:
00262 
00266         void loadFromDataStream(QDataStream&, const MaterialHash&, const QHash<GLC_uint, GLC_uint>&);
00267 
00269         void saveToDataStream(QDataStream&) const;
00270 
00272 
00273 
00275 
00276 protected:
00277 
00279 
00280         virtual void glDraw(const GLC_RenderProperties&);
00281 
00283 
00285 
00287 
00288 private:
00290         GLC_uint setCurrentMaterial(GLC_Material*, const int, double);
00291 
00293         void fillVbosAndIbos();
00294 
00296         void finishSerialized();
00297 
00299         void finishVbo();
00300 
00302         void finishNonVbo();
00303 
00305         inline void vboDrawPrimitivesOf(GLC_PrimitiveGroup*);
00306 
00308         inline void vertexArrayDrawPrimitivesOf(GLC_PrimitiveGroup*);
00309 
00311         inline void vboDrawInSelectionModePrimitivesOf(GLC_PrimitiveGroup*);
00312 
00314         inline void vertexArrayDrawInSelectionModePrimitivesOf(GLC_PrimitiveGroup*);
00315 
00317         inline void vboDrawPrimitivesGroupOf(GLC_PrimitiveGroup*, GLC_Material*, bool, bool, QHash<GLC_uint, GLC_Material*>*);
00318 
00320         inline void vertexArrayDrawPrimitivesGroupOf(GLC_PrimitiveGroup*, GLC_Material*, bool, bool, QHash<GLC_uint, GLC_Material*>*);
00321 
00323         inline void vboDrawSelectedPrimitivesGroupOf(GLC_PrimitiveGroup*, GLC_Material*, bool, bool, const GLC_RenderProperties&);
00324 
00326         inline void vertexArrayDrawSelectedPrimitivesGroupOf(GLC_PrimitiveGroup*, GLC_Material*, bool, bool, const GLC_RenderProperties&);
00327 
00329         inline void activateVboAndIbo();
00330 
00332         inline void activateVertexArray();
00333 
00335         void normalRenderLoop(const GLC_RenderProperties&, bool);
00336 
00338         void OverwriteMaterialRenderLoop(const GLC_RenderProperties&, bool);
00339 
00341         void OverwriteTransparencyRenderLoop(const GLC_RenderProperties&, bool);
00342 
00344         void bodySelectionRenderLoop(bool);
00345 
00347         void primitiveSelectionRenderLoop(bool);
00348 
00350         void primitiveRenderLoop(const GLC_RenderProperties&, bool);
00351 
00353         void primitiveSelectedRenderLoop(const GLC_RenderProperties&, bool);
00354 
00356 
00357 
00359 // Private members
00361 private:
00363         GLC_uint m_NextPrimitiveLocalId;
00364 
00366         PrimitiveGroupsHash m_PrimitiveGroups;
00367 
00369         GLC_uint m_DefaultMaterialId;
00370 
00372         unsigned int m_NumberOfFaces;
00373 
00375         unsigned int m_NumberOfVertice;
00376 
00378         unsigned int m_NumberOfNormals;
00379 
00381         bool m_ColorPearVertex;
00382 
00384         GLC_MeshData m_MeshData;
00385 
00387         int m_CurrentLod;
00388 
00390         static quint32 m_ChunkId;
00391 
00392 };
00393 
00394 // Inline functions
00395 
00396 // Use VBO to Draw triangles from the specified GLC_PrimitiveGroup
00397 void GLC_Mesh::vboDrawPrimitivesOf(GLC_PrimitiveGroup* pCurrentGroup)
00398 {
00399         // Draw triangles
00400         if (pCurrentGroup->containsTriangles())
00401         {
00402                 glDrawElements(GL_TRIANGLES, pCurrentGroup->trianglesIndexSize(), GL_UNSIGNED_INT, pCurrentGroup->trianglesIndexOffset());
00403         }
00404 
00405         // Draw Triangles strip
00406         if (pCurrentGroup->containsStrip())
00407         {
00408                 const GLsizei stripsCount= static_cast<GLsizei>(pCurrentGroup->stripsOffset().size());
00409                 for (GLint i= 0; i < stripsCount; ++i)
00410                 {
00411                         glDrawElements(GL_TRIANGLE_STRIP, pCurrentGroup->stripsSizes().at(i), GL_UNSIGNED_INT, pCurrentGroup->stripsOffset().at(i));
00412                 }
00413         }
00414 
00415         // Draw Triangles fan
00416         if (pCurrentGroup->containsFan())
00417         {
00418                 const GLsizei fansCount= static_cast<GLsizei>(pCurrentGroup->fansOffset().size());
00419                 for (GLint i= 0; i < fansCount; ++i)
00420                 {
00421                         glDrawElements(GL_TRIANGLE_FAN, pCurrentGroup->fansSizes().at(i), GL_UNSIGNED_INT, pCurrentGroup->fansOffset().at(i));
00422                 }
00423         }
00424 }
00425 // Use Vertex Array to Draw triangles from the specified GLC_PrimitiveGroup
00426 void GLC_Mesh::vertexArrayDrawPrimitivesOf(GLC_PrimitiveGroup* pCurrentGroup)
00427 {
00428         // Draw triangles
00429         if (pCurrentGroup->containsTriangles())
00430         {
00431                 GLvoid* pOffset= &(m_MeshData.indexVectorHandle(m_CurrentLod)->data()[pCurrentGroup->trianglesIndexOffseti()]);
00432                 glDrawElements(GL_TRIANGLES, pCurrentGroup->trianglesIndexSize(), GL_UNSIGNED_INT, pOffset);
00433         }
00434 
00435         // Draw Triangles strip
00436         if (pCurrentGroup->containsStrip())
00437         {
00438                 const GLsizei stripsCount= static_cast<GLsizei>(pCurrentGroup->stripsOffseti().size());
00439                 for (GLint i= 0; i < stripsCount; ++i)
00440                 {
00441                         GLvoid* pOffset= &m_MeshData.indexVectorHandle(m_CurrentLod)->data()[pCurrentGroup->stripsOffseti().at(i)];
00442                         glDrawElements(GL_TRIANGLE_STRIP, pCurrentGroup->stripsSizes().at(i), GL_UNSIGNED_INT, pOffset);
00443                 }
00444         }
00445 
00446         // Draw Triangles fan
00447         if (pCurrentGroup->containsFan())
00448         {
00449                 const GLsizei fansCount= static_cast<GLsizei>(pCurrentGroup->fansOffseti().size());
00450                 for (GLint i= 0; i < fansCount; ++i)
00451                 {
00452                         GLvoid* pOffset= &m_MeshData.indexVectorHandle(m_CurrentLod)->data()[pCurrentGroup->fansOffseti().at(i)];
00453                         glDrawElements(GL_TRIANGLE_FAN, pCurrentGroup->fansSizes().at(i), GL_UNSIGNED_INT, pOffset);
00454                 }
00455         }
00456 }
00457 
00458 // Use VBO to Draw primitives in selection mode from the specified GLC_PrimitiveGroup
00459 void GLC_Mesh::vboDrawInSelectionModePrimitivesOf(GLC_PrimitiveGroup* pCurrentGroup)
00460 {
00461         GLubyte colorId[4];
00462         // Draw triangles
00463         if (pCurrentGroup->containsTrianglesGroupId())
00464         {
00465                 const GLsizei trianglesGroupCount= static_cast<GLsizei>(pCurrentGroup->trianglesGroupOffset().size());
00466                 for (GLint i= 0; i < trianglesGroupCount; ++i)
00467                 {
00468                         glc::encodeRgbId(pCurrentGroup->triangleGroupId(i), colorId);
00469                         glColor3ubv(colorId);
00470                         glDrawElements(GL_TRIANGLES, pCurrentGroup->trianglesIndexSizes().at(i), GL_UNSIGNED_INT, pCurrentGroup->trianglesGroupOffset().at(i));
00471                 }
00472         }
00473 
00474         // Draw Triangles strip
00475         if (pCurrentGroup->containsStripGroupId())
00476         {
00477                 const GLsizei stripsCount= static_cast<GLsizei>(pCurrentGroup->stripsOffset().size());
00478                 for (GLint i= 0; i < stripsCount; ++i)
00479                 {
00480                         glc::encodeRgbId(pCurrentGroup->stripGroupId(i), colorId);
00481                         glColor3ubv(colorId);
00482                         glDrawElements(GL_TRIANGLE_STRIP, pCurrentGroup->stripsSizes().at(i), GL_UNSIGNED_INT, pCurrentGroup->stripsOffset().at(i));
00483                 }
00484         }
00485 
00486         // Draw Triangles fan
00487         if (pCurrentGroup->containsFanGroupId())
00488         {
00489                 const GLsizei fansCount= static_cast<GLsizei>(pCurrentGroup->fansOffset().size());
00490                 for (GLint i= 0; i < fansCount; ++i)
00491                 {
00492                         glc::encodeRgbId(pCurrentGroup->fanGroupId(i), colorId);
00493                         glColor3ubv(colorId);
00494 
00495                         glDrawElements(GL_TRIANGLE_FAN, pCurrentGroup->fansSizes().at(i), GL_UNSIGNED_INT, pCurrentGroup->fansOffset().at(i));
00496                 }
00497         }
00498 
00499 }
00500 
00501 // Use Vertex Array to Draw primitives in selection mode from the specified GLC_PrimitiveGroup
00502 void GLC_Mesh::vertexArrayDrawInSelectionModePrimitivesOf(GLC_PrimitiveGroup* pCurrentGroup)
00503 {
00504         GLubyte colorId[4];
00505         // Draw triangles
00506         if (pCurrentGroup->containsTrianglesGroupId())
00507         {
00508                 const GLsizei trianglesGroupCount= static_cast<GLsizei>(pCurrentGroup->trianglesGroupOffseti().size());
00509                 for (GLint i= 0; i < trianglesGroupCount; ++i)
00510                 {
00511                         glc::encodeRgbId(pCurrentGroup->triangleGroupId(i), colorId);
00512                         glColor3ubv(colorId);
00513 
00514                         GLvoid* pOffset= &m_MeshData.indexVectorHandle(m_CurrentLod)->data()[pCurrentGroup->trianglesGroupOffseti().at(i)];
00515                         glDrawElements(GL_TRIANGLES, pCurrentGroup->trianglesIndexSizes().at(i), GL_UNSIGNED_INT, pOffset);
00516                 }
00517 
00518                 GLvoid* pOffset= &(m_MeshData.indexVectorHandle(m_CurrentLod)->data()[pCurrentGroup->trianglesIndexOffseti()]);
00519                 glDrawElements(GL_TRIANGLES, pCurrentGroup->trianglesIndexSize(), GL_UNSIGNED_INT, pOffset);
00520         }
00521 
00522         // Draw Triangles strip
00523         if (pCurrentGroup->containsStripGroupId())
00524         {
00525                 const GLsizei stripsCount= static_cast<GLsizei>(pCurrentGroup->stripsOffseti().size());
00526                 for (GLint i= 0; i < stripsCount; ++i)
00527                 {
00528                         glc::encodeRgbId(pCurrentGroup->stripGroupId(i), colorId);
00529                         glColor3ubv(colorId);
00530 
00531                         GLvoid* pOffset= &m_MeshData.indexVectorHandle(m_CurrentLod)->data()[pCurrentGroup->stripsOffseti().at(i)];
00532                         glDrawElements(GL_TRIANGLE_STRIP, pCurrentGroup->stripsSizes().at(i), GL_UNSIGNED_INT, pOffset);
00533                 }
00534         }
00535 
00536         // Draw Triangles fan
00537         if (pCurrentGroup->containsFanGroupId())
00538         {
00539                 const GLsizei fansCount= static_cast<GLsizei>(pCurrentGroup->fansOffseti().size());
00540                 for (GLint i= 0; i < fansCount; ++i)
00541                 {
00542                         glc::encodeRgbId(pCurrentGroup->fanGroupId(i), colorId);
00543                         glColor3ubv(colorId);
00544 
00545                         GLvoid* pOffset= &m_MeshData.indexVectorHandle(m_CurrentLod)->data()[pCurrentGroup->fansOffseti().at(i)];
00546                         glDrawElements(GL_TRIANGLE_FAN, pCurrentGroup->fansSizes().at(i), GL_UNSIGNED_INT, pOffset);
00547                 }
00548         }
00549 }
00550 
00551 // Use VBO to Draw primitives with specific materials from the specified GLC_PrimitiveGroup
00552 void GLC_Mesh::vboDrawPrimitivesGroupOf(GLC_PrimitiveGroup* pCurrentGroup, GLC_Material* pCurrentMaterial, bool materialIsRenderable
00553                 , bool isTransparent,  QHash<GLC_uint, GLC_Material*>* pMaterialHash)
00554 {
00555         GLC_Material* pCurrentLocalMaterial= pCurrentMaterial;
00556         // Draw triangles
00557         if (pCurrentGroup->containsTriangles())
00558         {
00559                 Q_ASSERT(pCurrentGroup->containsTrianglesGroupId());
00560                 const GLsizei trianglesGroupCount= static_cast<GLsizei>(pCurrentGroup->trianglesGroupOffset().size());
00561                 for (GLint i= 0; i < trianglesGroupCount; ++i)
00562                 {
00563                         GLC_uint currentPrimitiveId= pCurrentGroup->triangleGroupId(i);
00564                         if (pMaterialHash->contains(currentPrimitiveId))
00565                         {
00566                                 if (pCurrentLocalMaterial != pMaterialHash->value(currentPrimitiveId))
00567                                 {
00568                                         pCurrentLocalMaterial= pMaterialHash->value(currentPrimitiveId);
00569                                         if (pCurrentLocalMaterial->isTransparent() == isTransparent) pCurrentLocalMaterial->glExecute();
00570                                 }
00571                         }
00572                         else if (pCurrentLocalMaterial != pCurrentMaterial)
00573                         {
00574                                 pCurrentLocalMaterial= pCurrentMaterial;
00575                                 if (materialIsRenderable) pCurrentLocalMaterial->glExecute();
00576                         }
00577                         if (pCurrentLocalMaterial->isTransparent() == isTransparent)
00578                         {
00579                                 glDrawElements(GL_TRIANGLES, pCurrentGroup->trianglesIndexSizes().at(i), GL_UNSIGNED_INT, pCurrentGroup->trianglesGroupOffset().at(i));
00580                         }
00581                 }
00582         }
00583 
00584         // Draw Triangles strip
00585         if (pCurrentGroup->containsStrip())
00586         {
00587                 Q_ASSERT(pCurrentGroup->containsStripGroupId());
00588                 const GLsizei stripsCount= static_cast<GLsizei>(pCurrentGroup->stripsOffset().size());
00589                 for (GLint i= 0; i < stripsCount; ++i)
00590                 {
00591                         GLC_uint currentPrimitiveId= pCurrentGroup->stripGroupId(i);
00592                         if (pMaterialHash->contains(currentPrimitiveId))
00593                         {
00594                                 if (pCurrentLocalMaterial != pMaterialHash->value(currentPrimitiveId))
00595                                 {
00596                                         pCurrentLocalMaterial= pMaterialHash->value(currentPrimitiveId);
00597                                         if (pCurrentLocalMaterial->isTransparent() == isTransparent) pCurrentLocalMaterial->glExecute();
00598                                 }
00599                         }
00600                         else if (pCurrentLocalMaterial != pCurrentMaterial)
00601                         {
00602                                 pCurrentLocalMaterial= pCurrentMaterial;
00603                                 if (materialIsRenderable) pCurrentLocalMaterial->glExecute();
00604                         }
00605                         if (pCurrentLocalMaterial->isTransparent() == isTransparent)
00606                         {
00607                                 glDrawElements(GL_TRIANGLE_STRIP, pCurrentGroup->stripsSizes().at(i), GL_UNSIGNED_INT, pCurrentGroup->stripsOffset().at(i));
00608                         }
00609                 }
00610         }
00611 
00612         // Draw Triangles fan
00613         if (pCurrentGroup->containsFan())
00614         {
00615                 Q_ASSERT(pCurrentGroup->containsFanGroupId());
00616                 const GLsizei fansCount= static_cast<GLsizei>(pCurrentGroup->fansOffset().size());
00617                 for (GLint i= 0; i < fansCount; ++i)
00618                 {
00619                         GLC_uint currentPrimitiveId= pCurrentGroup->fanGroupId(i);
00620                         if (pMaterialHash->contains(currentPrimitiveId))
00621                         {
00622                                 if (pCurrentLocalMaterial != pMaterialHash->value(currentPrimitiveId))
00623                                 {
00624                                         pCurrentLocalMaterial= pMaterialHash->value(currentPrimitiveId);
00625                                         if (pCurrentLocalMaterial->isTransparent() == isTransparent) pCurrentLocalMaterial->glExecute();
00626                                 }
00627                         }
00628                         else if (pCurrentLocalMaterial != pCurrentMaterial)
00629                         {
00630                                 pCurrentLocalMaterial= pCurrentMaterial;
00631                                 if (materialIsRenderable) pCurrentLocalMaterial->glExecute();
00632                         }
00633                         if (pCurrentLocalMaterial->isTransparent() == isTransparent)
00634                         {
00635                                 glDrawElements(GL_TRIANGLE_FAN, pCurrentGroup->fansSizes().at(i), GL_UNSIGNED_INT, pCurrentGroup->fansOffset().at(i));
00636                         }
00637                 }
00638         }
00639 
00640 }
00641 
00642 // Use Vertex Array to Draw primitives with specific materials from the specified GLC_PrimitiveGroup
00643 void GLC_Mesh::vertexArrayDrawPrimitivesGroupOf(GLC_PrimitiveGroup* pCurrentGroup, GLC_Material* pCurrentMaterial, bool materialIsRenderable
00644                 , bool isTransparent, QHash<GLC_uint, GLC_Material*>* pMaterialHash)
00645 {
00646         GLC_Material* pCurrentLocalMaterial= pCurrentMaterial;
00647         // Draw triangles
00648         if (pCurrentGroup->containsTriangles())
00649         {
00650                 Q_ASSERT(pCurrentGroup->containsTrianglesGroupId());
00651                 const GLsizei trianglesGroupCount= static_cast<GLsizei>(pCurrentGroup->trianglesGroupOffseti().size());
00652                 for (GLint i= 0; i < trianglesGroupCount; ++i)
00653                 {
00654                         GLC_uint currentPrimitiveId= pCurrentGroup->triangleGroupId(i);
00655                         if (pMaterialHash->contains(currentPrimitiveId))
00656                         {
00657                                 if (pCurrentLocalMaterial != pMaterialHash->value(currentPrimitiveId))
00658                                 {
00659                                         pCurrentLocalMaterial= pMaterialHash->value(currentPrimitiveId);
00660                                         if (pCurrentLocalMaterial->isTransparent() == isTransparent) pCurrentLocalMaterial->glExecute();
00661                                 }
00662                         }
00663                         else if (pCurrentLocalMaterial != pCurrentMaterial)
00664                         {
00665                                 pCurrentLocalMaterial= pCurrentMaterial;
00666                                 if (materialIsRenderable) pCurrentLocalMaterial->glExecute();
00667                         }
00668                         if (pCurrentLocalMaterial->isTransparent() == isTransparent)
00669                         {
00670                                 GLvoid* pOffset= &m_MeshData.indexVectorHandle(m_CurrentLod)->data()[pCurrentGroup->trianglesGroupOffseti().at(i)];
00671                                 glDrawElements(GL_TRIANGLES, pCurrentGroup->trianglesIndexSizes().at(i), GL_UNSIGNED_INT, pOffset);
00672                         }
00673                 }
00674         }
00675 
00676         // Draw Triangles strip
00677         if (pCurrentGroup->containsStrip())
00678         {
00679                 Q_ASSERT(pCurrentGroup->containsStripGroupId());
00680                 const GLsizei stripsCount= static_cast<GLsizei>(pCurrentGroup->stripsOffseti().size());
00681                 for (GLint i= 0; i < stripsCount; ++i)
00682                 {
00683                         GLC_uint currentPrimitiveId= pCurrentGroup->stripGroupId(i);
00684                         if (pMaterialHash->contains(currentPrimitiveId))
00685                         {
00686                                 if (pCurrentLocalMaterial != pMaterialHash->value(currentPrimitiveId))
00687                                 {
00688                                         pCurrentLocalMaterial= pMaterialHash->value(currentPrimitiveId);
00689                                         if (pCurrentLocalMaterial->isTransparent() == isTransparent) pCurrentLocalMaterial->glExecute();
00690                                 }
00691                         }
00692                         else if (pCurrentLocalMaterial != pCurrentMaterial)
00693                         {
00694                                 pCurrentLocalMaterial= pCurrentMaterial;
00695                                 if (materialIsRenderable) pCurrentLocalMaterial->glExecute();
00696                         }
00697                         if (pCurrentLocalMaterial->isTransparent() == isTransparent)
00698                         {
00699                                 GLvoid* pOffset= &m_MeshData.indexVectorHandle(m_CurrentLod)->data()[pCurrentGroup->stripsOffseti().at(i)];
00700                                 glDrawElements(GL_TRIANGLE_STRIP, pCurrentGroup->stripsSizes().at(i), GL_UNSIGNED_INT, pOffset);
00701                         }
00702                 }
00703         }
00704 
00705         // Draw Triangles fan
00706         if (pCurrentGroup->containsFan())
00707         {
00708                 Q_ASSERT(pCurrentGroup->containsFanGroupId());
00709                 const GLsizei fansCount= static_cast<GLsizei>(pCurrentGroup->fansOffseti().size());
00710                 for (GLint i= 0; i < fansCount; ++i)
00711                 {
00712                         GLC_uint currentPrimitiveId= pCurrentGroup->fanGroupId(i);
00713                         if (pMaterialHash->contains(currentPrimitiveId))
00714                         {
00715                                 if (pCurrentLocalMaterial != pMaterialHash->value(currentPrimitiveId))
00716                                 {
00717                                         pCurrentLocalMaterial= pMaterialHash->value(currentPrimitiveId);
00718                                         if (pCurrentLocalMaterial->isTransparent() == isTransparent) pCurrentLocalMaterial->glExecute();
00719                                 }
00720                         }
00721                         else if (pCurrentLocalMaterial != pCurrentMaterial)
00722                         {
00723                                 pCurrentLocalMaterial= pCurrentMaterial;
00724                                 if (materialIsRenderable) pCurrentLocalMaterial->glExecute();
00725                         }
00726                         if (pCurrentLocalMaterial->isTransparent() == isTransparent)
00727                         {
00728                                 GLvoid* pOffset= &m_MeshData.indexVectorHandle(m_CurrentLod)->data()[pCurrentGroup->fansOffseti().at(i)];
00729                                 glDrawElements(GL_TRIANGLE_FAN, pCurrentGroup->fansSizes().at(i), GL_UNSIGNED_INT, pOffset);
00730                         }
00731                 }
00732         }
00733 
00734 }
00735 
00736 // Use VBO to Draw primitives with specific materials from the specified GLC_PrimitiveGroup
00737 void GLC_Mesh::vboDrawSelectedPrimitivesGroupOf(GLC_PrimitiveGroup* pCurrentGroup, GLC_Material* pCurrentMaterial, bool materialIsRenderable
00738                 , bool isTransparent, const GLC_RenderProperties& renderProperties)
00739 {
00740         QSet<GLC_uint>* pSelectedPrimitive= renderProperties.setOfSelectedPrimitivesId();
00741         Q_ASSERT(NULL != pSelectedPrimitive);
00742 
00743         QHash<GLC_uint, GLC_Material*>* pMaterialHash= NULL;
00744         if (!renderProperties.hashOfOverwritePrimitiveMaterialsIsEmpty())
00745         {
00746                 pMaterialHash= renderProperties.hashOfOverwritePrimitiveMaterials();
00747         }
00748 
00749         GLC_Material* pCurrentLocalMaterial= pCurrentMaterial;
00750         // Draw triangles
00751         if (pCurrentGroup->containsTriangles())
00752         {
00753                 Q_ASSERT(pCurrentGroup->containsTrianglesGroupId());
00754                 const GLsizei trianglesGroupCount= static_cast<GLsizei>(pCurrentGroup->trianglesGroupOffset().size());
00755                 for (GLint i= 0; i < trianglesGroupCount; ++i)
00756                 {
00757                         GLC_uint currentPrimitiveId= pCurrentGroup->triangleGroupId(i);
00758                         if (pSelectedPrimitive->contains(currentPrimitiveId))
00759                         {
00760                                 if (!isTransparent)
00761                                 {
00762                                         GLC_SelectionMaterial::glExecute();
00763                                         pCurrentLocalMaterial= NULL;
00764                                         glDrawElements(GL_TRIANGLES, pCurrentGroup->trianglesIndexSizes().at(i), GL_UNSIGNED_INT, pCurrentGroup->trianglesGroupOffset().at(i));
00765                                 }
00766                         }
00767                         else if ((NULL != pMaterialHash) && pMaterialHash->contains(currentPrimitiveId))
00768                         {
00769                                 if (pMaterialHash->value(currentPrimitiveId)->isTransparent() == isTransparent)
00770                                 {
00771                                         GLC_Material* pMat= pMaterialHash->value(currentPrimitiveId);
00772                                         if (pMat != pCurrentLocalMaterial)
00773                                         {
00774                                                 pCurrentLocalMaterial= pMat;
00775                                                 pCurrentLocalMaterial->glExecute();
00776                                         }
00777                                         glDrawElements(GL_TRIANGLES, pCurrentGroup->trianglesIndexSizes().at(i), GL_UNSIGNED_INT, pCurrentGroup->trianglesGroupOffset().at(i));
00778                                 }
00779 
00780                         }
00781                         else if (materialIsRenderable)
00782                         {
00783                                 if (pCurrentLocalMaterial != pCurrentMaterial)
00784                                 {
00785                                         pCurrentLocalMaterial= pCurrentMaterial;
00786                                         pCurrentLocalMaterial->glExecute();
00787                                 }
00788                                 glDrawElements(GL_TRIANGLES, pCurrentGroup->trianglesIndexSizes().at(i), GL_UNSIGNED_INT, pCurrentGroup->trianglesGroupOffset().at(i));
00789                         }
00790                 }
00791         }
00792 
00793         // Draw Triangles strip
00794         if (pCurrentGroup->containsStrip())
00795         {
00796                 Q_ASSERT(pCurrentGroup->containsStripGroupId());
00797                 const GLsizei stripsCount= static_cast<GLsizei>(pCurrentGroup->stripsOffset().size());
00798                 for (GLint i= 0; i < stripsCount; ++i)
00799                 {
00800                         GLC_uint currentPrimitiveId= pCurrentGroup->stripGroupId(i);
00801                         if (pSelectedPrimitive->contains(currentPrimitiveId))
00802                         {
00803                                 if (!isTransparent)
00804                                 {
00805                                         GLC_SelectionMaterial::glExecute();
00806                                         pCurrentLocalMaterial= NULL;
00807                                         glDrawElements(GL_TRIANGLE_STRIP, pCurrentGroup->stripsSizes().at(i), GL_UNSIGNED_INT, pCurrentGroup->stripsOffset().at(i));
00808                                 }
00809                         }
00810                         else if ((NULL != pMaterialHash) && pMaterialHash->contains(currentPrimitiveId))
00811                         {
00812                                 if (pMaterialHash->value(currentPrimitiveId)->isTransparent() == isTransparent)
00813                                 {
00814                                         GLC_Material* pMat= pMaterialHash->value(currentPrimitiveId);
00815                                         if (pMat != pCurrentLocalMaterial)
00816                                         {
00817                                                 pCurrentLocalMaterial= pMat;
00818                                                 pCurrentLocalMaterial->glExecute();
00819                                         }
00820                                         glDrawElements(GL_TRIANGLE_STRIP, pCurrentGroup->stripsSizes().at(i), GL_UNSIGNED_INT, pCurrentGroup->stripsOffset().at(i));
00821                                 }
00822 
00823                         }
00824                         else if (materialIsRenderable)
00825                         {
00826                                 if (pCurrentLocalMaterial != pCurrentMaterial)
00827                                 {
00828                                         pCurrentLocalMaterial= pCurrentMaterial;
00829                                         pCurrentLocalMaterial->glExecute();
00830                                 }
00831                                 glDrawElements(GL_TRIANGLE_STRIP, pCurrentGroup->stripsSizes().at(i), GL_UNSIGNED_INT, pCurrentGroup->stripsOffset().at(i));
00832                         }
00833                 }
00834         }
00835 
00836         // Draw Triangles fan
00837         if (pCurrentGroup->containsFan())
00838         {
00839                 Q_ASSERT(pCurrentGroup->containsFanGroupId());
00840                 const GLsizei fansCount= static_cast<GLsizei>(pCurrentGroup->fansOffset().size());
00841                 for (GLint i= 0; i < fansCount; ++i)
00842                 {
00843                         GLC_uint currentPrimitiveId= pCurrentGroup->fanGroupId(i);
00844                         if (pSelectedPrimitive->contains(currentPrimitiveId))
00845                         {
00846                                 if (!isTransparent)
00847                                 {
00848                                         GLC_SelectionMaterial::glExecute();
00849                                         pCurrentLocalMaterial= NULL;
00850                                         glDrawElements(GL_TRIANGLE_FAN, pCurrentGroup->fansSizes().at(i), GL_UNSIGNED_INT, pCurrentGroup->fansOffset().at(i));
00851                                 }
00852                         }
00853                         else if ((NULL != pMaterialHash) && pMaterialHash->contains(currentPrimitiveId))
00854                         {
00855                                 if (pMaterialHash->value(currentPrimitiveId)->isTransparent() == isTransparent)
00856                                 {
00857                                         GLC_Material* pMat= pMaterialHash->value(currentPrimitiveId);
00858                                         if (pMat != pCurrentLocalMaterial)
00859                                         {
00860                                                 pCurrentLocalMaterial= pMat;
00861                                                 pCurrentLocalMaterial->glExecute();
00862                                         }
00863                                         glDrawElements(GL_TRIANGLE_FAN, pCurrentGroup->fansSizes().at(i), GL_UNSIGNED_INT, pCurrentGroup->fansOffset().at(i));
00864                                 }
00865 
00866                         }
00867                         else if (materialIsRenderable)
00868                         {
00869                                 if (pCurrentLocalMaterial != pCurrentMaterial)
00870                                 {
00871                                         pCurrentLocalMaterial= pCurrentMaterial;
00872                                         pCurrentLocalMaterial->glExecute();
00873                                 }
00874                                 glDrawElements(GL_TRIANGLE_FAN, pCurrentGroup->fansSizes().at(i), GL_UNSIGNED_INT, pCurrentGroup->fansOffset().at(i));
00875                         }
00876                 }
00877         }
00878 
00879 }
00880 
00881 // Use Vertex Array to Draw primitives with specific materials from the specified GLC_PrimitiveGroup
00882 void GLC_Mesh::vertexArrayDrawSelectedPrimitivesGroupOf(GLC_PrimitiveGroup* pCurrentGroup, GLC_Material* pCurrentMaterial, bool materialIsRenderable
00883                 , bool isTransparent, const GLC_RenderProperties& renderProperties)
00884 {
00885         QSet<GLC_uint>* pSelectedPrimitive= renderProperties.setOfSelectedPrimitivesId();
00886         Q_ASSERT(NULL != pSelectedPrimitive);
00887 
00888         QHash<GLC_uint, GLC_Material*>* pMaterialHash= NULL;
00889         if (!renderProperties.hashOfOverwritePrimitiveMaterialsIsEmpty())
00890         {
00891                 pMaterialHash= renderProperties.hashOfOverwritePrimitiveMaterials();
00892         }
00893 
00894         GLC_Material* pCurrentLocalMaterial= pCurrentMaterial;
00895         // Draw triangles
00896         if (pCurrentGroup->containsTriangles())
00897         {
00898                 Q_ASSERT(pCurrentGroup->containsTrianglesGroupId());
00899                 const GLsizei trianglesGroupCount= static_cast<GLsizei>(pCurrentGroup->trianglesGroupOffseti().size());
00900                 for (GLint i= 0; i < trianglesGroupCount; ++i)
00901                 {
00902                         GLC_uint currentPrimitiveId= pCurrentGroup->triangleGroupId(i);
00903                         if (pSelectedPrimitive->contains(currentPrimitiveId))
00904                         {
00905                                 if (!isTransparent)
00906                                 {
00907                                         GLC_SelectionMaterial::glExecute();
00908                                         pCurrentLocalMaterial= NULL;
00909                                         GLvoid* pOffset= &m_MeshData.indexVectorHandle(m_CurrentLod)->data()[pCurrentGroup->trianglesGroupOffseti().at(i)];
00910                                         glDrawElements(GL_TRIANGLES, pCurrentGroup->trianglesIndexSizes().at(i), GL_UNSIGNED_INT, pOffset);
00911                                 }
00912                         }
00913                         else if ((NULL != pMaterialHash) && pMaterialHash->contains(currentPrimitiveId))
00914                         {
00915                                 if (pMaterialHash->value(currentPrimitiveId)->isTransparent() == isTransparent)
00916                                 {
00917                                         GLC_Material* pMat= pMaterialHash->value(currentPrimitiveId);
00918                                         if (pMat != pCurrentLocalMaterial)
00919                                         {
00920                                                 pCurrentLocalMaterial= pMat;
00921                                                 pCurrentLocalMaterial->glExecute();
00922                                         }
00923                                         GLvoid* pOffset= &m_MeshData.indexVectorHandle(m_CurrentLod)->data()[pCurrentGroup->trianglesGroupOffseti().at(i)];
00924                                         glDrawElements(GL_TRIANGLES, pCurrentGroup->trianglesIndexSizes().at(i), GL_UNSIGNED_INT, pOffset);
00925                                 }
00926 
00927                         }
00928                         else if (materialIsRenderable)
00929                         {
00930                                 if (pCurrentLocalMaterial != pCurrentMaterial)
00931                                 {
00932                                         pCurrentLocalMaterial= pCurrentMaterial;
00933                                         pCurrentLocalMaterial->glExecute();
00934                                 }
00935                                 GLvoid* pOffset= &m_MeshData.indexVectorHandle(m_CurrentLod)->data()[pCurrentGroup->trianglesGroupOffseti().at(i)];
00936                                 glDrawElements(GL_TRIANGLES, pCurrentGroup->trianglesIndexSizes().at(i), GL_UNSIGNED_INT, pOffset);
00937                         }
00938                 }
00939         }
00940 
00941         // Draw Triangles strip
00942         if (pCurrentGroup->containsStrip())
00943         {
00944                 Q_ASSERT(pCurrentGroup->containsStripGroupId());
00945                 const GLsizei stripsCount= static_cast<GLsizei>(pCurrentGroup->stripsOffseti().size());
00946                 for (GLint i= 0; i < stripsCount; ++i)
00947                 {
00948                         GLC_uint currentPrimitiveId= pCurrentGroup->stripGroupId(i);
00949                         if (pSelectedPrimitive->contains(currentPrimitiveId))
00950                         {
00951                                 if (!isTransparent)
00952                                 {
00953                                         GLC_SelectionMaterial::glExecute();
00954                                         pCurrentLocalMaterial= NULL;
00955                                         GLvoid* pOffset= &m_MeshData.indexVectorHandle(m_CurrentLod)->data()[pCurrentGroup->stripsOffseti().at(i)];
00956                                         glDrawElements(GL_TRIANGLE_STRIP, pCurrentGroup->stripsSizes().at(i), GL_UNSIGNED_INT, pOffset);
00957                                 }
00958                         }
00959                         else if ((NULL != pMaterialHash) && pMaterialHash->contains(currentPrimitiveId))
00960                         {
00961                                 if (pMaterialHash->value(currentPrimitiveId)->isTransparent() == isTransparent)
00962                                 {
00963                                         GLC_Material* pMat= pMaterialHash->value(currentPrimitiveId);
00964                                         if (pMat != pCurrentLocalMaterial)
00965                                         {
00966                                                 pCurrentLocalMaterial= pMat;
00967                                                 pCurrentLocalMaterial->glExecute();
00968                                         }
00969                                         GLvoid* pOffset= &m_MeshData.indexVectorHandle(m_CurrentLod)->data()[pCurrentGroup->stripsOffseti().at(i)];
00970                                         glDrawElements(GL_TRIANGLE_STRIP, pCurrentGroup->stripsSizes().at(i), GL_UNSIGNED_INT, pOffset);
00971                                 }
00972 
00973                         }
00974                         else if (materialIsRenderable)
00975                         {
00976                                 if (pCurrentLocalMaterial != pCurrentMaterial)
00977                                 {
00978                                         pCurrentLocalMaterial= pCurrentMaterial;
00979                                         pCurrentLocalMaterial->glExecute();
00980                                 }
00981                                 GLvoid* pOffset= &m_MeshData.indexVectorHandle(m_CurrentLod)->data()[pCurrentGroup->stripsOffseti().at(i)];
00982                                 glDrawElements(GL_TRIANGLE_STRIP, pCurrentGroup->stripsSizes().at(i), GL_UNSIGNED_INT, pOffset);
00983                         }
00984                 }
00985         }
00986 
00987         // Draw Triangles fan
00988         if (pCurrentGroup->containsFan())
00989         {
00990                 Q_ASSERT(pCurrentGroup->containsFanGroupId());
00991                 const GLsizei fansCount= static_cast<GLsizei>(pCurrentGroup->fansOffseti().size());
00992                 for (GLint i= 0; i < fansCount; ++i)
00993                 {
00994                         GLC_uint currentPrimitiveId= pCurrentGroup->fanGroupId(i);
00995                         if (pSelectedPrimitive->contains(currentPrimitiveId))
00996                         {
00997                                 if (!isTransparent)
00998                                 {
00999                                         GLC_SelectionMaterial::glExecute();
01000                                         pCurrentLocalMaterial= NULL;
01001                                         GLvoid* pOffset= &m_MeshData.indexVectorHandle(m_CurrentLod)->data()[pCurrentGroup->fansOffseti().at(i)];
01002                                         glDrawElements(GL_TRIANGLE_FAN, pCurrentGroup->fansSizes().at(i), GL_UNSIGNED_INT, pOffset);
01003                                 }
01004                         }
01005                         else if ((NULL != pMaterialHash) && pMaterialHash->contains(currentPrimitiveId))
01006                         {
01007                                 if (pMaterialHash->value(currentPrimitiveId)->isTransparent() == isTransparent)
01008                                 {
01009                                         GLC_Material* pMat= pMaterialHash->value(currentPrimitiveId);
01010                                         if (pMat != pCurrentLocalMaterial)
01011                                         {
01012                                                 pCurrentLocalMaterial= pMat;
01013                                                 pCurrentLocalMaterial->glExecute();
01014                                         }
01015                                         GLvoid* pOffset= &m_MeshData.indexVectorHandle(m_CurrentLod)->data()[pCurrentGroup->fansOffseti().at(i)];
01016                                         glDrawElements(GL_TRIANGLE_FAN, pCurrentGroup->fansSizes().at(i), GL_UNSIGNED_INT, pOffset);
01017                                 }
01018 
01019                         }
01020                         else if (materialIsRenderable)
01021                         {
01022                                 if (pCurrentLocalMaterial != pCurrentMaterial)
01023                                 {
01024                                         pCurrentLocalMaterial= pCurrentMaterial;
01025                                         pCurrentLocalMaterial->glExecute();
01026                                 }
01027                                 GLvoid* pOffset= &m_MeshData.indexVectorHandle(m_CurrentLod)->data()[pCurrentGroup->fansOffseti().at(i)];
01028                                 glDrawElements(GL_TRIANGLE_FAN, pCurrentGroup->fansSizes().at(i), GL_UNSIGNED_INT, pOffset);
01029                         }
01030                 }
01031         }
01032 
01033 }
01034 
01035 // Activate mesh VBOs and IBO of the current LOD
01036 void GLC_Mesh::activateVboAndIbo()
01037 {
01038         // Activate Vertices VBO
01039         m_MeshData.useVBO(true, GLC_MeshData::GLC_Vertex);
01040         glVertexPointer(3, GL_FLOAT, 0, 0);
01041         glEnableClientState(GL_VERTEX_ARRAY);
01042 
01043         // Activate Normals VBO
01044         m_MeshData.useVBO(true, GLC_MeshData::GLC_Normal);
01045         glNormalPointer(GL_FLOAT, 0, 0);
01046         glEnableClientState(GL_NORMAL_ARRAY);
01047 
01048         // Activate texel VBO if needed
01049         if (m_MeshData.useVBO(true, GLC_MeshData::GLC_Texel))
01050         {
01051                 glTexCoordPointer(2, GL_FLOAT, 0, 0);
01052                 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
01053         }
01054 
01055         // Activate Color VBO if needed
01056         if ((m_ColorPearVertex && !m_IsSelected && !GLC_State::isInSelectionMode()) && m_MeshData.useVBO(true, GLC_MeshData::GLC_Color))
01057         {
01058                 glEnable(GL_COLOR_MATERIAL);
01059                 glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
01060                 glColorPointer(4, GL_FLOAT, 0, 0);
01061                 glEnableClientState(GL_COLOR_ARRAY);
01062         }
01063 
01064         m_MeshData.useIBO(true, m_CurrentLod);
01065 }
01066 
01067 // Activate vertex Array
01068 void GLC_Mesh::activateVertexArray()
01069 {
01070         // Use Vertex Array
01071         glVertexPointer(3, GL_FLOAT, 0, m_MeshData.positionVectorHandle()->data());
01072         glEnableClientState(GL_VERTEX_ARRAY);
01073 
01074         glNormalPointer(GL_FLOAT, 0, m_MeshData.normalVectorHandle()->data());
01075         glEnableClientState(GL_NORMAL_ARRAY);
01076 
01077         // Activate texel if needed
01078         if (!m_MeshData.texelVectorHandle()->isEmpty())
01079         {
01080                 glTexCoordPointer(2, GL_FLOAT, 0, m_MeshData.texelVectorHandle()->data());
01081                 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
01082         }
01083 
01084         // Activate Color VBO if needed
01085         if ((m_ColorPearVertex && !m_IsSelected && !GLC_State::isInSelectionMode()) && !m_MeshData.colorVectorHandle()->isEmpty())
01086         {
01087                 glEnable(GL_COLOR_MATERIAL);
01088                 glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
01089                 glColorPointer(4, GL_FLOAT, 0, m_MeshData.colorVectorHandle()->data());
01090                 glEnableClientState(GL_COLOR_ARRAY);
01091         }
01092 }
01093 
01094 
01095 
01096 #endif /* GLC_MESH_H_ */

SourceForge.net Logo

©2005 Laurent Ribon