Go to the documentation of this file.
76 size_t n_vert =
mesh->numVertices();
77 size_t n_faces =
mesh->numFaces();
81 std::string header_info =
"Created by LVR";
83 std::strncpy(head,header_info.c_str(),
sizeof(head)-1);
84 char attribute[2] =
"0";
86 std::ofstream myfile(
filename.c_str());
88 myfile.write(head,
sizeof(head));
89 myfile.write((
char*)&n_faces,4);
93 for(
int i = 0; i < n_faces; i++)
95 int a = (int)indices[3 * i];
96 int b = (int)indices[3 * i + 1];
97 int c = (int)indices[3 * i + 2];
104 v1.
x = vertices[3 * a];
105 v1.
y = vertices[3 * a + 1];
106 v1.
z = vertices[3 * a + 2];
108 v2.
x = vertices[3 * b];
109 v2.
y = vertices[3 * b + 1];
110 v2.
z = vertices[3 * b + 2];
112 v3.
x = vertices[3 * c];
113 v3.
y = vertices[3 * c + 1];
114 v3.
z = vertices[3 * c + 2];
118 myfile.write( (
char*)&normal.x, 4);
119 myfile.write( (
char*)&normal.y, 4);
120 myfile.write( (
char*)&normal.z, 4);
122 myfile.write( (
char*)&v1.
x, 4);
123 myfile.write( (
char*)&v1.
y, 4);
124 myfile.write( (
char*)&v1.
z, 4);
126 myfile.write( (
char*)&v2.
x, 4);
127 myfile.write( (
char*)&v2.
y, 4);
128 myfile.write( (
char*)&v2.
z, 4);
130 myfile.write( (
char*)&v3.
x, 4);
131 myfile.write( (
char*)&v3.
y, 4);
132 myfile.write( (
char*)&v3.
z, 4);
135 myfile.write( (
char*)attribute, 2 );
140 cout <<
timestamp <<
"Could not open file " <<
filename <<
" for writing." << endl;
boost::shared_array< float > floatArr
boost::shared_array< unsigned int > indexArray
virtual void save(string filename)
static Timestamp timestamp
A global time stamp object for program runtime measurement.
__kf_hdevice__ float3 cross(const float3 &v1, const float3 &v2)
std::shared_ptr< Model > ModelPtr
std::shared_ptr< MeshBuffer > MeshBufferPtr
virtual ModelPtr read(string filename)
Parse the given file and load supported elements.
lvr2
Author(s): Thomas Wiemann
, Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Wed Mar 2 2022 00:37:25