blob: 58eb1aefccd497169643d314d6e9409b5372855f [file] [log] [blame]
Alex Sakhartchouka04e30d2011-04-29 16:49:08 -07001/*
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
Alex Sakhartchoukc0a65422012-01-05 14:55:11 -080040 void renderPrimitiveRange(const android::renderscript::Context *,
Tim Murraye195a3f2014-03-13 15:04:58 -070041 uint32_t primIndex, size_t start, uint32_t len) const;
Alex Sakhartchouka04e30d2011-04-29 16:49:08 -070042
Alex Sakhartchoukc0a65422012-01-05 14:55:11 -080043 bool init(const android::renderscript::Context *rsc);
Alex Sakhartchouka04e30d2011-04-29 16:49:08 -070044
45protected:
46 const android::renderscript::Mesh *mRSMesh;
47
48 uint32_t *mGLPrimitives;
Alex Sakhartchoukc0a65422012-01-05 14:55:11 -080049 void updateGLPrimitives(const android::renderscript::Context *rsc);
Alex Sakhartchouka04e30d2011-04-29 16:49:08 -070050
51 bool isValidGLComponent(const android::renderscript::Element *elem, uint32_t fieldIdx);
52 // Attribues that allow us to map to GL
53 RsdVertexArray::Attrib *mAttribs;
54 // This allows us to figure out which allocation the attribute
55 // belongs to. In the event the allocation is uploaded to GL
56 // buffer, it lets us properly map it
57 uint32_t *mAttribAllocationIndex;
58 uint32_t mAttribCount;
59};
60
61#endif //ANDROID_RSD_MESH_OBJ_H
62
63
64