Tinman  1.0
meshstrider.h
Go to the documentation of this file.
1 // -*- coding:utf-8; tab-width:4; mode:cpp -*-
2 //Taked from: http://www.ogre3d.org/tikiwiki/BulletMeshStrider
3 
4 #ifndef MeshStrider_h__
5 #define MeshStrider_h__
6 
7 #include <btBulletDynamicsCommon.h>
8 #include <OgreMesh.h>
9 #include <OgreSubMesh.h>
10 
12 class MeshStrider : public btStridingMeshInterface{
13 
14 public:
15  MeshStrider( Ogre::Mesh * m = 0 ):mMesh(m){}
16 
17  void set( Ogre::Mesh * m ) { mMesh = m; }
18  // inherited interface
19  virtual int getNumSubParts() const;
20 
21  virtual void getLockedVertexIndexBase(unsigned char **vertexbase, int& numverts,PHY_ScalarType& type, int& stride,unsigned char **indexbase,int & indexstride,int& numfaces,PHY_ScalarType& indicestype,int subpart=0);
22  virtual void getLockedReadOnlyVertexIndexBase(const unsigned char **vertexbase, int& numverts,PHY_ScalarType& type, int& stride,const unsigned char **indexbase,int & indexstride,int& numfaces,PHY_ScalarType& indicestype,int subpart=0) const;
23 
24  virtual void unLockVertexBase(int subpart);
25  virtual void unLockReadOnlyVertexBase(int subpart) const;
26 
27  virtual void preallocateVertices(int numverts);
28  virtual void preallocateIndices(int numindices);
29 
30  private:
31  Ogre::Mesh* mMesh;
32 };
33 
34 #endif // MeshStrider_h__
virtual void getLockedReadOnlyVertexIndexBase(const unsigned char **vertexbase, int &numverts, PHY_ScalarType &type, int &stride, const unsigned char **indexbase, int &indexstride, int &numfaces, PHY_ScalarType &indicestype, int subpart=0) const
Definition: meshstrider.cpp:11
virtual void preallocateVertices(int numverts)
Definition: meshstrider.cpp:100
virtual void unLockReadOnlyVertexBase(int subpart) const
Definition: meshstrider.cpp:77
void set(Ogre::Mesh *m)
Definition: meshstrider.h:17
Ogre::Mesh * mMesh
Definition: meshstrider.h:31
virtual void preallocateIndices(int numindices)
Definition: meshstrider.cpp:104
virtual void unLockVertexBase(int subpart)
Definition: meshstrider.cpp:96
Shares vertices/indexes between Ogre and Bullet.
Definition: meshstrider.h:12
virtual void getLockedVertexIndexBase(unsigned char **vertexbase, int &numverts, PHY_ScalarType &type, int &stride, unsigned char **indexbase, int &indexstride, int &numfaces, PHY_ScalarType &indicestype, int subpart=0)
Definition: meshstrider.cpp:73
virtual int getNumSubParts() const
Definition: meshstrider.cpp:6
MeshStrider(Ogre::Mesh *m=0)
Definition: meshstrider.h:15