blob: 599a15066c698478273235275a36813f7acf831c [file] [log] [blame]
Mathias Agopian3f844832013-08-07 21:24:32 -07001/*
2 * Copyright 2013 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 SF_RENDER_ENGINE_MESH_H
18#define SF_RENDER_ENGINE_MESH_H
19
20#include <stdint.h>
21
22namespace android {
23
24class Mesh {
25public:
26 enum Primitive {
27 TRIANGLES = 0x0004,
28 TRIANGLE_STRIP = 0x0005,
29 TRIANGLE_FAN = 0x0006
30 };
31
32 Mesh(Primitive primitive, size_t vertexCount, size_t vertexSize, size_t texCoordsSize = 0);
33 ~Mesh();
34
35 float const* operator[](size_t index) const;
36 float* operator[](size_t index);
37
38
39 Primitive getPrimitive() const;
40
41 float const* getVertices() const;
42 float* getVertices();
43
44 float const* getTexCoords() const;
45 float* getTexCoords();
46
47 size_t getVertexCount() const;
48 size_t getVertexSize() const;
49 size_t getTexCoordsSize() const;
50
51 size_t getByteStride() const;
52 size_t getStride() const;
53
54private:
55 float* mVertices;
56 size_t mVertexCount;
57 size_t mVertexSize;
58 size_t mTexCoordsSize;
59 size_t mStride;
60 Primitive mPrimitive;
61};
62
63
64} /* namespace android */
65#endif /* SF_RENDER_ENGINE_MESH_H */