1/*
2 * Copyright (C) 2012 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/** @file rs_mesh.rsh
18 *  \brief Mesh routines
19 *
20 *
21 */
22
23#ifndef __RS_MESH_RSH__
24#define __RS_MESH_RSH__
25
26// New API's
27#if (defined(RS_VERSION) && (RS_VERSION >= 16))
28
29/**
30 * Returns the number of allocations in the mesh that contain
31 * vertex data
32 *
33 * @param m mesh to get data from
34 * @return number of allocations in the mesh that contain vertex
35 *         data
36 */
37extern uint32_t __attribute__((overloadable))
38    rsgMeshGetVertexAllocationCount(rs_mesh m);
39
40/**
41 * Meshes could have multiple index sets, this function returns
42 * the number.
43 *
44 * @param m mesh to get data from
45 * @return number of primitive groups in the mesh. This would
46 *         include simple primitives as well as allocations
47 *         containing index data
48 */
49extern uint32_t __attribute__((overloadable))
50    rsgMeshGetPrimitiveCount(rs_mesh m);
51
52/**
53 * Returns an allocation that is part of the mesh and contains
54 * vertex data, e.g. positions, normals, texcoords
55 *
56 * @param m mesh to get data from
57 * @param index index of the vertex allocation
58 * @return allocation containing vertex data
59 */
60extern rs_allocation __attribute__((overloadable))
61    rsgMeshGetVertexAllocation(rs_mesh m, uint32_t index);
62
63/**
64 * Returns an allocation containing index data or a null
65 * allocation if only the primitive is specified
66 *
67 * @param m mesh to get data from
68 * @param index index of the index allocation
69 * @return allocation containing index data
70 */
71extern rs_allocation __attribute__((overloadable))
72    rsgMeshGetIndexAllocation(rs_mesh m, uint32_t index);
73
74/**
75 * Returns the primitive describing how a part of the mesh is
76 * rendered
77 *
78 * @param m mesh to get data from
79 * @param index index of the primitive
80 * @return primitive describing how the mesh is rendered
81 */
82extern rs_primitive __attribute__((overloadable))
83    rsgMeshGetPrimitive(rs_mesh m, uint32_t index);
84
85#endif // (defined(RS_VERSION) && (RS_VERSION >= 16))
86
87#endif // __RS_MESH_RSH__
88
89