• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2014 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 // geometry_utils:
7 //   Helper library for generating certain sets of geometry.
8 //
9 
10 #ifndef UTIL_GEOMETRY_UTILS_H
11 #define UTIL_GEOMETRY_UTILS_H
12 
13 #include <cstddef>
14 #include <vector>
15 
16 #include <GLES2/gl2.h>
17 
18 #include "common/vector_utils.h"
19 #include "util/util_export.h"
20 
21 struct ANGLE_UTIL_EXPORT SphereGeometry
22 {
23     SphereGeometry();
24     ~SphereGeometry();
25 
26     std::vector<angle::Vector3> positions;
27     std::vector<angle::Vector3> normals;
28     std::vector<GLushort> indices;
29 };
30 
31 ANGLE_UTIL_EXPORT void CreateSphereGeometry(size_t sliceCount,
32                                             float radius,
33                                             SphereGeometry *result);
34 
35 struct ANGLE_UTIL_EXPORT CubeGeometry
36 {
37     CubeGeometry();
38     ~CubeGeometry();
39 
40     std::vector<angle::Vector3> positions;
41     std::vector<angle::Vector3> normals;
42     std::vector<angle::Vector2> texcoords;
43     std::vector<GLushort> indices;
44 };
45 
46 ANGLE_UTIL_EXPORT void GenerateCubeGeometry(float radius, CubeGeometry *result);
47 
48 #endif  // UTIL_GEOMETRY_UTILS_H
49