rsdMeshObj.h revision a04e30dbb5ab11592b03666bb3d102070759c58e
1/* 2 * Copyright (C) 2011 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_RSD_MESH_OBJ_H 18#define ANDROID_RSD_MESH_OBJ_H 19 20// --------------------------------------------------------------------------- 21namespace android { 22namespace renderscript { 23 24 class Context; 25 class Mesh; 26 class Element; 27 28} 29} 30 31#include "driver/rsdVertexArray.h" 32 33// An element is a group of Components that occupies one cell in a structure. 34class RsdMeshObj { 35public: 36 RsdMeshObj(const android::renderscript::Context *, 37 const android::renderscript::Mesh *); 38 ~RsdMeshObj(); 39 40 void renderPrimitiveRange(const android::renderscript::Context *, uint32_t primIndex, uint32_t start, uint32_t len) const; 41 42 bool init(); 43 44protected: 45 const android::renderscript::Mesh *mRSMesh; 46 47 uint32_t *mGLPrimitives; 48 void updateGLPrimitives(); 49 50 bool isValidGLComponent(const android::renderscript::Element *elem, uint32_t fieldIdx); 51 // Attribues that allow us to map to GL 52 RsdVertexArray::Attrib *mAttribs; 53 // This allows us to figure out which allocation the attribute 54 // belongs to. In the event the allocation is uploaded to GL 55 // buffer, it lets us properly map it 56 uint32_t *mAttribAllocationIndex; 57 uint32_t mAttribCount; 58}; 59 60#endif //ANDROID_RSD_MESH_OBJ_H 61 62 63 64