Changeset 509 for trunk/src/engine/model_manager.cc
- Timestamp:
- 07/26/16 20:24:02 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/engine/model_manager.cc
r508 r509 13 13 bool nv::model_manager::load_resource( lua::table_guard& table, shash64 id ) 14 14 { 15 auto vec4_to_quat = [] ( const vec4& v ) { return quat( v.w, v.x, v.y, v.z ); }; 16 15 17 model* gm = new model; 16 18 gm->attach = table.get_string_hash_64( "attach" ); 17 gm->root = transform( table.get<vec3>( "position", vec3() ) ); 18 19 gm->root.set_position( table.get<vec3>( "root_position", vec3() ) ); 20 gm->root.set_orientation( vec4_to_quat( table.get<vec4>( "root_orientation", vec4(0.0f,0.0f,0.0f,1.0f) ) ) ); 21 19 22 resource< mesh_data > def_data; 20 23 if ( table.is_string( "path" ) ) … … 45 48 void nv::model_manager::read_model_node( lua::table_guard& table, model_node* node, resource< mesh_data > def_data ) 46 49 { 50 auto vec4_to_quat = [] ( const vec4& v ) { return quat( v.w, v.x, v.y, v.z ); }; 51 47 52 resource< data_channel_set > cmesh; 48 53 resource< material > cmaterial; … … 59 64 attach_id = info.parent_id; 60 65 } 66 67 if ( table.has_field( "local_position" ) ) 68 node->local.set_position( table.get<vec3>( "local_position", vec3() ) ); 69 if ( table.has_field( "local_orientation" ) ) 70 node->local.set_orientation( vec4_to_quat( table.get<vec4>( "local_orientation", vec4( 0.0f, 0.0f, 0.0f, 1.0f ) ) ) ); 71 72 if ( table.has_field( "position" ) ) 73 { 74 node->position.min = table.get<vec3>( "position", vec3() ); 75 node->position.max = node->position.min; 76 } 77 if ( table.has_field( "rotation" ) ) 78 { 79 node->rotation.min = table.get<vec3>( "rotation", vec3() ); 80 node->rotation.max = node->rotation.min; 81 } 82 if ( table.has_field( "position_min" ) ) node->position.min = table.get<vec3>( "position_min", vec3() ); 83 if ( table.has_field( "position_max" ) ) node->position.max = table.get<vec3>( "position_max", vec3() ); 84 if ( table.has_field( "position_dist" ) ) node->position.dist = random_dist( table.get_unsigned( "position_dist", 0 ) ); 85 if ( table.has_field( "rotation_min" ) ) node->rotation.min = table.get<vec3>( "rotation_min", vec3() ); 86 if ( table.has_field( "rotation_max" ) ) node->rotation.max = table.get<vec3>( "rotation_max", vec3() ); 87 if ( table.has_field( "rotation_dist" ) ) node->rotation.dist = random_dist( table.get_unsigned( "rotation_dist", 0 ) ); 61 88 62 89 if ( table.has_field( "attach" ) ) … … 76 103 } 77 104 78 node->force = table.get_boolean( "force", false );79 node->ch ance = table.get_float( "chance", 1.0f);80 node-> random_rotate_y = table.get_boolean( "random_rotate", false);81 82 node->mesh = cmesh;105 node->force = table.get_boolean( "force", false ); 106 node->choice = table.get_boolean( "choice", false ); 107 node->chance = table.get_float( "chance", 1.0f ); 108 node->weight = table.get_unsigned( "weight", 1 ); 109 node->mesh = cmesh; 83 110 node->attach_id = attach_id; 84 node->material = cmaterial;111 node->material = cmaterial; 85 112 86 113 for ( uint32 i = 1; i <= table.get_size(); ++i )
Note: See TracChangeset
for help on using the changeset viewer.