blob: 8c7e8a4427c67227b767f9680b8e3abfaf69f2a3 [file] [log] [blame]
Jason Samsa89371c2009-06-30 14:13:04 -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_MESH_H
18#define ANDROID_RS_MESH_H
19
20
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.
29class Mesh : public ObjectBase
30{
31public:
Jason Samse514b452009-09-25 14:51:22 -070032 Mesh(Context *);
Jason Samsa89371c2009-06-30 14:13:04 -070033 ~Mesh();
34
Jason Samsa5597fc2009-07-08 18:01:53 -070035 struct Verticies_t
Jason Samsa89371c2009-06-30 14:13:04 -070036 {
Jason Samsa5597fc2009-07-08 18:01:53 -070037 Allocation ** mAllocations;
38 uint32_t mAllocationCount;
39
Jason Samsa89371c2009-06-30 14:13:04 -070040 size_t mVertexDataSize;
41
42 size_t mOffsetCoord;
43 size_t mOffsetTex;
44 size_t mOffsetNorm;
Jason Samse514b452009-09-25 14:51:22 -070045
Jason Samsa89371c2009-06-30 14:13:04 -070046 size_t mSizeCoord;
47 size_t mSizeTex;
48 size_t mSizeNorm;
49
50 uint32_t mBufferObject;
51 };
52
53 struct Primitive_t
54 {
55 RsPrimitive mType;
Jason Samsa5597fc2009-07-08 18:01:53 -070056 Verticies_t *mVerticies;
Jason Samsa89371c2009-06-30 14:13:04 -070057
Jason Samsa5597fc2009-07-08 18:01:53 -070058 uint32_t mIndexCount;
59 uint16_t *mIndicies;
Jason Samsb80dfa72009-07-10 17:32:40 -070060
61 uint32_t mRestartCounts;
62 uint16_t *mRestarts;
Jason Samsa89371c2009-06-30 14:13:04 -070063 };
64
Alex Sakhartchoukfb6b6142010-05-21 12:53:13 -070065 Verticies_t ** mVerticies;
Jason Samsa5597fc2009-07-08 18:01:53 -070066 uint32_t mVerticiesCount;
67
68 Primitive_t ** mPrimitives;
69 uint32_t mPrimitivesCount;
70
Jason Samsa89371c2009-06-30 14:13:04 -070071 void analyzeElement();
Alex Sakhartchoukfb6b6142010-05-21 12:53:13 -070072 virtual void serialize(OStream *stream) const;
Alex Sakhartchoukb825f672010-06-04 10:06:50 -070073 virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_MESH; }
Alex Sakhartchoukfb6b6142010-05-21 12:53:13 -070074 static Mesh *createFromStream(Context *rsc, IStream *stream);
Alex Sakhartchoukb825f672010-06-04 10:06:50 -070075
Jason Samsa89371c2009-06-30 14:13:04 -070076protected:
77};
78
79class MeshContext
80{
81public:
82 MeshContext();
83 ~MeshContext();
84
85};
86
87
88}
89}
90#endif //ANDROID_RS_TRIANGLE_MESH_H
91
92