Jason Sams | e5ffb87 | 2009-08-09 17:01:55 -0700 | [diff] [blame] | 1 | /* |
| 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 | // --------------------------------------------------------------------------- |
| 24 | namespace android { |
| 25 | namespace renderscript { |
| 26 | |
| 27 | |
| 28 | // An element is a group of Components that occupies one cell in a structure. |
| 29 | class SimpleMesh : public ObjectBase |
| 30 | { |
| 31 | public: |
Jason Sams | e514b45 | 2009-09-25 14:51:22 -0700 | [diff] [blame] | 32 | SimpleMesh(Context *); |
Jason Sams | e5ffb87 | 2009-08-09 17:01:55 -0700 | [diff] [blame] | 33 | ~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 Sams | c460e55 | 2009-11-25 13:22:07 -0800 | [diff] [blame] | 48 | void render(Context *) const; |
| 49 | void renderRange(Context *, uint32_t start, uint32_t len) const; |
| 50 | void uploadAll(Context *); |
Alex Sakhartchouk | fb6b614 | 2010-05-21 12:53:13 -0700 | [diff] [blame] | 51 | void updateGLPrimitive(); |
Alex Sakhartchouk | b825f67 | 2010-06-04 10:06:50 -0700 | [diff] [blame^] | 52 | |
Alex Sakhartchouk | fb6b614 | 2010-05-21 12:53:13 -0700 | [diff] [blame] | 53 | virtual void serialize(OStream *stream) const; |
Alex Sakhartchouk | b825f67 | 2010-06-04 10:06:50 -0700 | [diff] [blame^] | 54 | virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_SIMPLE_MESH; } |
Alex Sakhartchouk | fb6b614 | 2010-05-21 12:53:13 -0700 | [diff] [blame] | 55 | static SimpleMesh *createFromStream(Context *rsc, IStream *stream); |
Jason Sams | e5ffb87 | 2009-08-09 17:01:55 -0700 | [diff] [blame] | 56 | |
| 57 | protected: |
| 58 | }; |
| 59 | |
| 60 | class SimpleMeshContext |
| 61 | { |
| 62 | public: |
| 63 | SimpleMeshContext(); |
| 64 | ~SimpleMeshContext(); |
| 65 | |
| 66 | |
| 67 | }; |
| 68 | |
| 69 | |
| 70 | } |
| 71 | } |
| 72 | #endif //ANDROID_RS_SIMPLE_MESH_H |
| 73 | |