blob: e56c7c293b2dcb77e82566123d070cfe9c673368 [file] [log] [blame]
Jason Sams326e0dd2009-05-22 14:03:28 -07001/*
2 * Copyright (C) 2009 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ANDROID_RS_TRIANGLE_MESH_H
18#define ANDROID_RS_TRIANGLE_MESH_H
19
Jason Sams326e0dd2009-05-22 14:03:28 -070020
21#include "RenderScript.h"
22
23// ---------------------------------------------------------------------------
24namespace android {
25namespace renderscript {
26
27
28// An element is a group of Components that occupies one cell in a structure.
Jason Sams2a1cc8f2009-06-15 19:04:56 -070029class TriangleMesh : public ObjectBase
Jason Sams326e0dd2009-05-22 14:03:28 -070030{
31public:
32 TriangleMesh();
33 ~TriangleMesh();
34
35 const Element * mVertexElement;
36 const Element * mIndexElement;
37
38 void * mVertexData;
39 void * mIndexData;
40
41 size_t mVertexDataSize;
42 size_t mIndexDataSize;
43 uint32_t mTriangleCount;
44
45 size_t mOffsetCoord;
46 size_t mOffsetTex;
47 size_t mOffsetNorm;
48
49 size_t mSizeCoord;
50 size_t mSizeTex;
51 size_t mSizeNorm;
52
53 // GL buffer info
Jason Sams1aa5a4e2009-06-22 17:15:15 -070054 uint32_t mBufferObjects[2];
Jason Sams326e0dd2009-05-22 14:03:28 -070055
56 void analyzeElement();
57protected:
58};
59
60class TriangleMeshContext
61{
62public:
63 TriangleMeshContext();
64 ~TriangleMeshContext();
65
66 const Element * mVertexElement;
67 const Element * mIndexElement;
68 size_t mVertexSizeBits;
69 size_t mIndexSizeBits;
70
71 Vector<uint8_t> mVertexData;
72 Vector<uint16_t> mIndexData;
73
74 uint32_t mTriangleCount;
75
76 void clear();
77};
78
79
80}
81}
82#endif //ANDROID_RS_TRIANGLE_MESH_H
83