blob: 362c7fbac2d4ce2dbf89dafa155bb5f84b50d904 [file] [log] [blame]
Jason Samse5ffb872009-08-09 17:01:55 -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_SIMPLE_MESH_H
18#define ANDROID_RS_SIMPLE_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 SimpleMesh : public ObjectBase
30{
31public:
Jason Samse514b452009-09-25 14:51:22 -070032 SimpleMesh(Context *);
Jason Samse5ffb872009-08-09 17:01:55 -070033 ~SimpleMesh();
34
35 ObjectBaseRef<const Type> mIndexType;
36 ObjectBaseRef<const Type> mPrimitiveType;
37 ObjectBaseRef<const Type> *mVertexTypes;
38 uint32_t mVertexTypeCount;
39
40 ObjectBaseRef<Allocation> mIndexBuffer;
41 ObjectBaseRef<Allocation> mPrimitiveBuffer;
42 ObjectBaseRef<Allocation> *mVertexBuffers;
43
44 RsPrimitive mPrimitive;
45 uint32_t mGLPrimitive;
46
47
Jason Samsc460e552009-11-25 13:22:07 -080048 void render(Context *) const;
49 void renderRange(Context *, uint32_t start, uint32_t len) const;
50 void uploadAll(Context *);
Alex Sakhartchoukfb6b6142010-05-21 12:53:13 -070051 void updateGLPrimitive();
Alex Sakhartchoukb825f672010-06-04 10:06:50 -070052
Alex Sakhartchoukfb6b6142010-05-21 12:53:13 -070053 virtual void serialize(OStream *stream) const;
Alex Sakhartchoukb825f672010-06-04 10:06:50 -070054 virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_SIMPLE_MESH; }
Alex Sakhartchoukfb6b6142010-05-21 12:53:13 -070055 static SimpleMesh *createFromStream(Context *rsc, IStream *stream);
Jason Samse5ffb872009-08-09 17:01:55 -070056
57protected:
58};
59
60class SimpleMeshContext
61{
62public:
63 SimpleMeshContext();
64 ~SimpleMeshContext();
65
66
67};
68
69
70}
71}
72#endif //ANDROID_RS_SIMPLE_MESH_H
73