Changeset 509 for trunk/src/engine
- Timestamp:
- 07/26/16 20:24:02 (9 years ago)
- Location:
- trunk/src/engine
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/engine/animation.cc
r508 r509 34 34 35 35 nv::animator_data* animator = new nv::animator_data; 36 animator->id = table.get_string64( "id" ); 36 37 animator->poses = poses; 37 38 if ( poses == nullptr ) -
trunk/src/engine/default_resource_manager.cc
r508 r509 9 9 using namespace nv; 10 10 11 default_resource_manager::default_resource_manager( context* context )11 default_resource_manager::default_resource_manager( context* context, bool clear_material_paths ) 12 12 { 13 13 m_images = register_resource_handler< image_data >( new image_manager ); … … 15 15 m_binds = register_resource_handler< animator_bind_data >( new animator_bind_manager ); 16 16 m_animators = register_resource_handler< animator_data >( new animator_manager ); 17 m_materials = register_resource_handler< material >( new material_manager );17 m_materials = register_resource_handler< material >( new material_manager( clear_material_paths ) ); 18 18 m_programs = register_resource_handler< program >( new program_manager( context ) ); 19 19 m_gpu_meshes = register_resource_handler< gpu_mesh >( new gpu_mesh_manager( context, m_meshes ) ); … … 27 27 m_lua = lua; 28 28 29 m_lua->register_enum( "RND_LINEAR", static_cast<int>( random_dist::LINEAR ) ); 30 m_lua->register_enum( "RND_GAUSSIAN", static_cast<int>( random_dist::GAUSSIAN ) ); 31 m_lua->register_enum( "RND_RGAUSSIAN", static_cast<int>( random_dist::RGAUSSIAN ) ); 32 m_lua->register_enum( "RND_STEP_1", static_cast<int>( random_dist::STEP_1 ) ); 33 m_lua->register_enum( "RND_STEP_2", static_cast<int>( random_dist::STEP_2 ) ); 34 m_lua->register_enum( "RND_STEP_3", static_cast<int>( random_dist::STEP_3 ) ); 35 m_lua->register_enum( "RND_STEP_4", static_cast<int>( random_dist::STEP_4 ) ); 36 m_lua->register_enum( "RND_LINEAR", static_cast<int>( random_dist::LINEAR ) ); 37 m_lua->register_enum( "RND_MGAUSSIAN", static_cast<int>( random_dist::MGAUSSIAN ) ); 38 m_lua->register_enum( "RND_MRGAUSSIAN", static_cast<int>( random_dist::MRGAUSSIAN ) ); 39 m_lua->register_enum( "RND_MSTEP_1", static_cast<int>( random_dist::MSTEP_1 ) ); 40 m_lua->register_enum( "RND_MSTEP_2", static_cast<int>( random_dist::MSTEP_2 ) ); 41 m_lua->register_enum( "RND_MSTEP_3", static_cast<int>( random_dist::MSTEP_3 ) ); 42 m_lua->register_enum( "RND_MSTEP_4", static_cast<int>( random_dist::MSTEP_4 ) ); 43 29 44 m_lua->register_enum( "INT_NONE", static_cast<int>( interpolation::NONE ) ); 30 45 m_lua->register_enum( "INT_LINEAR", static_cast<int>( interpolation::LINEAR ) ); -
trunk/src/engine/material_manager.cc
r508 r509 63 63 if ( table.is_string( "path" ) ) 64 64 { 65 m->id = table.get_string128( "id" ); 65 66 string128 path = table.get_string128( "path" ); 66 67 for ( uint32 i = 0; i < 5; ++i ) … … 77 78 if ( i != TEX_EMISSIVE ) 78 79 NV_LOG_ERROR( "Texture file not found! : ", m->paths[i] ); 79 //m->paths[i].clear(); 80 if ( m_clear_paths ) 81 m->paths[i].clear(); 80 82 } 81 83 } -
trunk/src/engine/mesh_manager.cc
r508 r509 114 114 result->node_names[(*nd)[i].name] = i; 115 115 } 116 117 resource< mesh_data > rmesh = add( id, result ); 118 116 119 for ( uint32 i = 0; i < loader->get_mesh_count(); ++i ) 117 120 { … … 122 125 auto mesh = m_mesh_manager->add( shash64( id.get_hash() + i ), data ); 123 126 result->meshes.push_back( mesh ); 127 m_source_map[mesh.id()] = mesh_source{ rmesh, i }; 124 128 } 129 result->path.assign( id ); 125 130 delete loader; 126 if ( result )127 add( id, result );128 131 return result != nullptr; 129 132 } -
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.