Revision 138,
1000 bytes
checked in by hidalgo, 19 years ago
(diff) |
Uploaded WP4 Dummy code(Geometry)
|
Line | |
---|
1 | #include "GeoSubMesh.h"
|
---|
2 |
|
---|
3 | using namespace Geometry;
|
---|
4 |
|
---|
5 | SubMesh::SubMesh():
|
---|
6 | mIndex(0), mVertexBuffer(0), mIndexCount(0),mSharedVertexBuffer(false), mStrip(0), mStripCount(0)
|
---|
7 | {
|
---|
8 | }
|
---|
9 |
|
---|
10 | SubMesh::~SubMesh()
|
---|
11 | {
|
---|
12 | delete[] mIndex;
|
---|
13 | if (!mSharedVertexBuffer) delete mVertexBuffer;
|
---|
14 | }
|
---|
15 |
|
---|
16 | void SubMesh::Load(Serializer &s)
|
---|
17 | {
|
---|
18 | //Clear Data:
|
---|
19 | delete[] mIndex; mIndex = 0;
|
---|
20 | if (!mSharedVertexBuffer)
|
---|
21 | {
|
---|
22 | delete mVertexBuffer;
|
---|
23 | mVertexBuffer = 0;
|
---|
24 | }
|
---|
25 | mIndexCount = 0;
|
---|
26 |
|
---|
27 | //Load Data from Serializer
|
---|
28 | s.ReadArray(&mSharedVertexBuffer,1);
|
---|
29 | if (mSharedVertexBuffer)
|
---|
30 | {
|
---|
31 | mVertexBuffer = 0;
|
---|
32 | }
|
---|
33 | else
|
---|
34 | {
|
---|
35 | mVertexBuffer = new VertexBuffer();
|
---|
36 | mVertexBuffer->Load(s);
|
---|
37 | };
|
---|
38 |
|
---|
39 | s.ReadArray(&mIndexCount,1);
|
---|
40 | mIndex = new Index[mIndexCount];
|
---|
41 | s.ReadArray(mIndex,mIndexCount);
|
---|
42 | }
|
---|
43 |
|
---|
44 | void SubMesh::Save(Serializer &s)
|
---|
45 | {
|
---|
46 | s.WriteArray(&mSharedVertexBuffer,1);
|
---|
47 | if (!mSharedVertexBuffer)
|
---|
48 | {
|
---|
49 | mVertexBuffer->Save(s);
|
---|
50 | }
|
---|
51 | s.WriteArray(&mIndexCount,1);
|
---|
52 | s.WriteArray(mIndex,mIndexCount);
|
---|
53 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.