obj_loader.h
Go to the documentation of this file.
1 /*
2  * Copyright 2014 Google Inc. All Rights Reserved.
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 TANGO_GL_OBJ_LOADER_H
18 #define TANGO_GL_OBJ_LOADER_H
19 
20 #include <vector>
21 
22 #include "tango-gl/util.h"
23 
24 namespace tango_gl {
25 namespace obj_loader {
26 // Load standard .obj file into vertices, indices or normals vectors,
27 // OBJ file can be exported from 3D tools like 3ds Max or Blender.
28 // A readable file with only vertices should look like
29 // "v 1.00 2.00 3.00
30 // ...
31 // f 1 2 3
32 // f 1 2 3 4
33 // ..."
34 //
35 // If exported with normals, file should look like
36 // "v 1.00 2.00 3.00
37 // ...
38 // f 1//1 2//3 3//4
39 // f 1//1 2//3 3//4 4//6
40 // ...
41 // vn 1.00 2.00 3.00
42 // ..."
43 // this can be used with Mesh:
44 //
45 // std::vector<GLfloat> vertices;
46 // std::vector<GLushort> indices;
47 // std::vector<GLfloat> normals;
48 // tango_gl::obj_loader::LoadOBJData("/sdcard/model.obj", vertices, indices);
49 // mesh->SetVertices(vertices, indices);
50 // or
51 // tango_gl::obj_loader::LoadOBJData("/sdcard/model.obj", vertices, normals);
52 // mesh->SetVertices(vertices, normals);
53 
54 bool LoadOBJData(const char* path, std::vector<GLfloat>& vertices,
55  std::vector<GLushort>& indices);
56 
57 bool LoadOBJData(const char* path, std::vector<GLfloat>& vertices,
58  std::vector<GLfloat>& normals);
59 } // namespace obj_loader
60 } // namespace tango_gl
61 #endif // TANGO_GL_OBJ_LOADER
static const float vertices[]
Definition: quad.cpp:39
bool LoadOBJData(const char *path, std::vector< GLfloat > &vertices, std::vector< GLushort > &indices)
Definition: obj_loader.cpp:21


rtabmap
Author(s): Mathieu Labbe
autogenerated on Mon Dec 14 2020 03:34:59