Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/presentation/src/bullet/BulletCollision/CollisionShapes/btStridingMeshInterface.h @ 2691

Last change on this file since 2691 was 2459, checked in by rgrieder, 16 years ago

Merged physics_merge back to presentation branch.

  • Property svn:eol-style set to native
File size: 3.9 KB
Line 
1/*
2Bullet Continuous Collision Detection and Physics Library
3Copyright (c) 2003-2006 Erwin Coumans  http://continuousphysics.com/Bullet/
4
5This software is provided 'as-is', without any express or implied warranty.
6In no event will the authors be held liable for any damages arising from the use of this software.
7Permission is granted to anyone to use this software for any purpose,
8including commercial applications, and to alter it and redistribute it freely,
9subject to the following restrictions:
10
111. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
122. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
133. This notice may not be removed or altered from any source distribution.
14*/
15
16#ifndef STRIDING_MESHINTERFACE_H
17#define STRIDING_MESHINTERFACE_H
18
19#include "LinearMath/btVector3.h"
20#include "btTriangleCallback.h"
21#include "btConcaveShape.h"
22
23
24
25///     The btStridingMeshInterface is the interface class for high performance generic access to triangle meshes, used in combination with btBvhTriangleMeshShape and some other collision shapes.
26/// Using index striding of 3*sizeof(integer) it can use triangle arrays, using index striding of 1*sizeof(integer) it can handle triangle strips.
27/// It allows for sharing graphics and collision meshes. Also it provides locking/unlocking of graphics meshes that are in gpu memory.
28class  btStridingMeshInterface
29{
30        protected:
31       
32                btVector3 m_scaling;
33
34        public:
35                btStridingMeshInterface() :m_scaling(btScalar(1.),btScalar(1.),btScalar(1.))
36                {
37
38                }
39
40                virtual ~btStridingMeshInterface();
41
42
43
44                virtual void    InternalProcessAllTriangles(btInternalTriangleIndexCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax) const;
45
46                ///brute force method to calculate aabb
47                void    calculateAabbBruteForce(btVector3& aabbMin,btVector3& aabbMax);
48
49                /// get read and write access to a subpart of a triangle mesh
50                /// this subpart has a continuous array of vertices and indices
51                /// in this way the mesh can be handled as chunks of memory with striding
52                /// very similar to OpenGL vertexarray support
53                /// make a call to unLockVertexBase when the read and write access is finished 
54                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)=0;
55               
56                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=0;
57       
58                /// unLockVertexBase finishes the access to a subpart of the triangle mesh
59                /// make a call to unLockVertexBase when the read and write access (using getLockedVertexIndexBase) is finished
60                virtual void    unLockVertexBase(int subpart)=0;
61
62                virtual void    unLockReadOnlyVertexBase(int subpart) const=0;
63
64
65                /// getNumSubParts returns the number of seperate subparts
66                /// each subpart has a continuous array of vertices and indices
67                virtual int             getNumSubParts() const=0;
68
69                virtual void    preallocateVertices(int numverts)=0;
70                virtual void    preallocateIndices(int numindices)=0;
71
72                virtual bool    hasPremadeAabb() const { return false; }
73                virtual void    setPremadeAabb(const btVector3& aabbMin, const btVector3& aabbMax ) const
74                {
75                        (void) aabbMin;
76                        (void) aabbMax;
77                }
78                virtual void    getPremadeAabb(btVector3* aabbMin, btVector3* aabbMax ) const
79        {
80            (void) aabbMin;
81            (void) aabbMax;
82        }
83
84                const btVector3&        getScaling() const {
85                        return m_scaling;
86                }
87                void    setScaling(const btVector3& scaling)
88                {
89                        m_scaling = scaling;
90                }
91
92       
93
94};
95
96#endif //STRIDING_MESHINTERFACE_H
Note: See TracBrowser for help on using the repository browser.