Bullet Collision Detection & Physics Library: bDNA.h Source File

Bullet Collision Detection & Physics Library

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

bDNA.h
Go to the documentation of this file.
1/*
2bParse
3Copyright (c) 2006-2009 Charlie C & Erwin Coumans http://gamekit.googlecode.com
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 __BDNA_H__
17#define __BDNA_H__
18
19#include "bCommon.h"
20
21namespace bParse
22{
23 struct bNameInfo
24{
25 char *m_name;
26 bool m_isPointer;
27 int m_dim0;
28 int m_dim1;
29};
30
31 class bDNA
32{
33public:
34 bDNA();
35 ~bDNA();
36
37 void init(char *data, int len, bool swap = false);
38
39 int getArraySize(char *str);
40 int getArraySizeNew(short name)
41 {
42 const bNameInfo &nameInfo = m_Names[name];
43 return nameInfo.m_dim0 * nameInfo.m_dim1;
44 }
45 int getElementSize(short type, short name)
46 {
47 const bNameInfo &nameInfo = m_Names[name];
48 int size = nameInfo.m_isPointer ? mPtrLen * nameInfo.m_dim0 * nameInfo.m_dim1 : mTlens[type] * nameInfo.m_dim0 * nameInfo.m_dim1;
49 return size;
50 }
51
52 int getNumNames() const
53 {
54 return m_Names.size();
55 }
56
57 char *getName(int ind);
58 char *getType(int ind);
59 short *getStruct(int ind);
60 short getLength(int ind);
61 int getReverseType(short type);
62 int getReverseType(const char *type);
63
64 int getNumStructs();
65
66 //
67 bool lessThan(bDNA *other);
68
69 void initCmpFlags(bDNA *memDNA);
70 bool flagNotEqual(int dna_nr);
71 bool flagEqual(int dna_nr);
72 bool flagNone(int dna_nr);
73
74 int getPointerSize();
75
76 void dumpTypeDefinitions();
77
78private:
79 enum FileDNAFlags
80 {
81 FDF_NONE = 0,
82 FDF_STRUCT_NEQU,
83 FDF_STRUCT_EQU
84 };
85
86 void initRecurseCmpFlags(int i);
87
88 btAlignedObjectArray<int> mCMPFlags;
89
90 btAlignedObjectArray<bNameInfo> m_Names;
91 btAlignedObjectArray<char *> mTypes;
92 btAlignedObjectArray<short *> mStructs;
93 btAlignedObjectArray<short> mTlens;
94 btHashMap<btHashInt, int> mStructReverse;
95 btHashMap<btHashString, int> mTypeLookup;
96
97 int mPtrLen;
98};
99} // namespace bParse
100
101#endif //__BDNA_H__
bCommon.h
size
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
bParse::bDNA
Definition: bDNA.h:32
bParse::bDNA::getArraySizeNew
int getArraySizeNew(short name)
Definition: bDNA.h:40
bParse::bDNA::mCMPFlags
btAlignedObjectArray< int > mCMPFlags
Definition: bDNA.h:88
bParse::bDNA::mStructs
btAlignedObjectArray< short * > mStructs
Definition: bDNA.h:92
bParse::bDNA::bDNA
bDNA()
Definition: bDNA.cpp:29
bParse::bDNA::getPointerSize
int getPointerSize()
Definition: bDNA.cpp:125
bParse::bDNA::flagNone
bool flagNone(int dna_nr)
Definition: bDNA.cpp:118
bParse::bDNA::getLength
short getLength(int ind)
Definition: bDNA.cpp:69
bParse::bDNA::mPtrLen
int mPtrLen
Definition: bDNA.h:97
bParse::bDNA::initCmpFlags
void initCmpFlags(bDNA *memDNA)
Definition: bDNA.cpp:164
bParse::bDNA::FileDNAFlags
FileDNAFlags
Definition: bDNA.h:80
bParse::bDNA::FDF_STRUCT_EQU
@ FDF_STRUCT_EQU
Definition: bDNA.h:83
bParse::bDNA::FDF_NONE
@ FDF_NONE
Definition: bDNA.h:81
bParse::bDNA::FDF_STRUCT_NEQU
@ FDF_STRUCT_NEQU
Definition: bDNA.h:82
bParse::bDNA::init
void init(char *data, int len, bool swap=false)
Definition: bDNA.cpp:345
bParse::bDNA::initRecurseCmpFlags
void initRecurseCmpFlags(int i)
Definition: bDNA.cpp:131
bParse::bDNA::flagEqual
bool flagEqual(int dna_nr)
Definition: bDNA.cpp:110
bParse::bDNA::getNumStructs
int getNumStructs()
Definition: bDNA.cpp:97
bParse::bDNA::mStructReverse
btHashMap< btHashInt, int > mStructReverse
Definition: bDNA.h:94
bParse::bDNA::flagNotEqual
bool flagNotEqual(int dna_nr)
Definition: bDNA.cpp:103
bParse::bDNA::m_Names
btAlignedObjectArray< bNameInfo > m_Names
Definition: bDNA.h:90
bParse::bDNA::getName
char * getName(int ind)
Definition: bDNA.cpp:48
bParse::bDNA::getNumNames
int getNumNames() const
Definition: bDNA.h:52
bParse::bDNA::mTypes
btAlignedObjectArray< char * > mTypes
Definition: bDNA.h:91
bParse::bDNA::dumpTypeDefinitions
void dumpTypeDefinitions()
Definition: bDNA.cpp:524
bParse::bDNA::~bDNA
~bDNA()
Definition: bDNA.cpp:36
bParse::bDNA::lessThan
bool lessThan(bDNA *other)
Definition: bDNA.cpp:42
bParse::bDNA::getReverseType
int getReverseType(short type)
Definition: bDNA.cpp:76
bParse::bDNA::mTlens
btAlignedObjectArray< short > mTlens
Definition: bDNA.h:93
bParse::bDNA::getStruct
short * getStruct(int ind)
Definition: bDNA.cpp:62
bParse::bDNA::getArraySize
int getArraySize(char *str)
Definition: bDNA.cpp:503
bParse::bDNA::getElementSize
int getElementSize(short type, short name)
Definition: bDNA.h:45
bParse::bDNA::mTypeLookup
btHashMap< btHashString, int > mTypeLookup
Definition: bDNA.h:95
bParse::bDNA::getType
char * getType(int ind)
Definition: bDNA.cpp:55
btAlignedObjectArray
The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods It...
Definition: btAlignedObjectArray.h:46
btHashMap
The btHashMap template class implements a generic and lightweight hashmap.
Definition: btHashMap.h:220
bParse
Definition: btBulletWorldImporter.h:24
bParse::bNameInfo
Definition: bDNA.h:24
bParse::bNameInfo::m_name
char * m_name
Definition: bDNA.h:25
bParse::bNameInfo::m_dim1
int m_dim1
Definition: bDNA.h:28
bParse::bNameInfo::m_isPointer
bool m_isPointer
Definition: bDNA.h:26
bParse::bNameInfo::m_dim0
int m_dim0
Definition: bDNA.h:27