Merge branch 'tmj-dev' into lua

This commit is contained in:
milek7
2017-10-31 21:54:16 +01:00
6 changed files with 84 additions and 23 deletions

View File

@@ -77,7 +77,11 @@ shape_node::shapenode_data::serialize( std::ostream &Output ) const {
// vertex count, followed by vertex data
sn_utils::ls_uint32( Output, vertices.size() );
for( auto const &vertex : vertices ) {
vertex.serialize( Output );
basic_vertex(
glm::vec3{ vertex.position - origin },
vertex.normal,
vertex.texture )
.serialize( Output );
}
}
@@ -102,8 +106,12 @@ shape_node::shapenode_data::deserialize( std::istream &Input ) {
// NOTE: geometry handle is acquired during geometry creation
// vertex data
vertices.resize( sn_utils::ld_uint32( Input ) );
basic_vertex localvertex;
for( auto &vertex : vertices ) {
vertex.deserialize( Input );
localvertex.deserialize( Input );
vertex.position = origin + glm::dvec3{ localvertex.position };
vertex.normal = localvertex.normal;
vertex.texture = localvertex.texture;
}
}
@@ -453,7 +461,11 @@ lines_node::linesnode_data::serialize( std::ostream &Output ) const {
// vertex count, followed by vertex data
sn_utils::ls_uint32( Output, vertices.size() );
for( auto const &vertex : vertices ) {
vertex.serialize( Output );
basic_vertex(
glm::vec3{ vertex.position - origin },
vertex.normal,
vertex.texture )
.serialize( Output );
}
}
@@ -474,8 +486,12 @@ lines_node::linesnode_data::deserialize( std::istream &Input ) {
// NOTE: geometry handle is acquired during geometry creation
// vertex data
vertices.resize( sn_utils::ld_uint32( Input ) );
basic_vertex localvertex;
for( auto &vertex : vertices ) {
vertex.deserialize( Input );
localvertex.deserialize( Input );
vertex.position = origin + glm::dvec3{ localvertex.position };
vertex.normal = localvertex.normal;
vertex.texture = localvertex.texture;
}
}