- Timestamp:
- 11/03/16 00:51:07 (9 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nv/bullet/bullet_world.hh
r525 r527 27 27 virtual collision_shape create_sphere( float radius ); 28 28 virtual collision_shape create_capsule( float radius, float height ); 29 virtual collision_shape create_cylinder( const vec3& half_extents ); 29 30 virtual collision_shape create_box( const vec3& half_extens ); 30 31 virtual collision_shape create_static_plane( const vec3& norm, float cst ); -
trunk/nv/engine/model_manager.hh
r525 r527 39 39 MNF_STATIC, 40 40 }; 41 42 enum class phx_shape 43 { 44 BOX, 45 CYLINDER, 46 }; 47 41 48 42 49 struct model; … … 57 64 float chance = 1.0f; 58 65 flags<16,uint16> nflags; 66 vec3 phx_hextents; 67 vec3 phx_offset; 68 float phx_mass = 0.0f; 69 phx_shape phx_shape = phx_shape::BOX; 59 70 model_node_choice choice = model_node_choice::ALL; 60 71 … … 68 79 target->position = position; 69 80 81 target->phx_hextents = phx_hextents; 82 target->phx_offset = phx_offset; 83 target->phx_mass = phx_mass; 84 target->phx_shape = phx_shape; 70 85 target->attach_id = attach_id; 71 86 target->weight = weight; … … 101 116 sint16 parent_id; 102 117 transform local; 118 vec3 phx_hextents; 119 vec3 phx_offset; 120 float phx_mass; 121 phx_shape phx_shape; 103 122 uint32 gflags; 104 123 }; … … 117 136 NV_RTTI_DECLARE_NAME( model_node_flags, "model_node_flags" ) 118 137 NV_RTTI_DECLARE_NAME( model, "model" ) 138 NV_RTTI_DECLARE_NAME( phx_shape, "phx_shape" ) 119 139 120 140 enum flat_model_flags … … 163 183 result.count = 0; 164 184 result.phx_mesh = m->phx_mesh; 165 flatten( result, m, rng, control, transform(), -1, map, gen_flags, 0, select );185 flatten( result, m, rng, control, transform(), transform(), -1, map, gen_flags, 0, select ); 166 186 return result; 167 187 } … … 173 193 ivec2 control, 174 194 const transform& ptr, 175 sint16 parent_id, 195 const transform& fptr, 196 sint16 parent_id, 176 197 vector< const model_node* >* map, 177 198 uint32 gen_flags, … … 188 209 return; 189 210 } 190 transform tr = m->local; 211 212 bool skip_static = ( gen_flags & FF_GENERATE_NSTATIC ) && m->nflags[MNF_STATIC]; 213 bool parse_mesh = ( ( m->mesh || !m->tag.empty() ) && !skip_static ) || ( m->nflags[MNF_FORCE] ); 214 215 transform tr = fptr * m->local; 191 216 if ( !(gen_flags & FF_GENERATE_NLOCAL) ) 192 217 tr = ptr * tr; 218 219 193 220 vec3 position = rng.eval( m->position ); 194 221 vec3 rotation = rng.eval( m->rotation ); … … 202 229 return; 203 230 204 bool skip_static = ( gen_flags & FF_GENERATE_NSTATIC ) && m->nflags[MNF_STATIC]; 205 206 if ( ( ( m->mesh || !m->tag.empty() ) && !skip_static ) || ( m->nflags[MNF_FORCE] ) ) 231 transform ftr; 232 if ( !parse_mesh && ( gen_flags & FF_GENERATE_NLOCAL ) ) 233 { 234 ftr = tr; 235 } 236 237 238 if ( parse_mesh ) 207 239 { 208 240 uint32 id = result.count++; … … 215 247 re.attach_id = m->attach_id; 216 248 re.gflags = parent_flags; 249 re.phx_hextents = m->phx_hextents; 250 re.phx_offset = m->phx_offset; 251 re.phx_mass = m->phx_mass; 252 re.phx_shape = m->phx_shape; 253 217 254 if ( map ) map->push_back( m ); 218 255 parent_id = sint16(id); … … 273 310 uint32 flags = parent_flags; 274 311 if ( c != pick ) flags |= FMF_FAIL_CHOICE; 275 flatten( result, c, rng, control, tr, parent_id, map, gen_flags, flags, selected );312 flatten( result, c, rng, control, tr, ftr, parent_id, map, gen_flags, flags, selected ); 276 313 } 277 314 else 278 flatten( result, pick, rng, control, tr, parent_id, map, gen_flags, parent_flags, selected );315 flatten( result, pick, rng, control, tr, ftr, parent_id, map, gen_flags, parent_flags, selected ); 279 316 } 280 317 else 281 318 for ( auto c : m->children ) 282 319 { 283 flatten( result, c, rng, control, tr, parent_id, map, gen_flags, parent_flags, selected );320 flatten( result, c, rng, control, tr, ftr, parent_id, map, gen_flags, parent_flags, selected ); 284 321 } 285 322 } -
trunk/nv/interface/physics_world.hh
r525 r527 71 71 virtual collision_shape create_sphere( float radius ) = 0; 72 72 virtual collision_shape create_capsule( float radius, float height ) = 0; 73 virtual collision_shape create_cylinder( const vec3& half_extens ) = 0; 73 74 virtual collision_shape create_box( const vec3& half_extens ) = 0; 74 75 virtual collision_shape create_static_plane( const vec3& norm, float cst ) = 0; -
trunk/src/bullet/bullet_world.cc
r525 r527 88 88 { 89 89 return collision_shape{ ( void* )new btCapsuleShape( radius, height ) }; 90 } 91 92 nv::collision_shape nv::bullet_world::create_cylinder( const vec3& half_extents ) 93 { 94 return collision_shape{ ( void* )new btCylinderShape( n2b( half_extents ) ) }; 90 95 } 91 96 -
trunk/src/engine/model_manager.cc
r526 r527 85 85 } 86 86 87 if ( table.has_field( "phx_hextents" ) ) 88 node->phx_hextents = table.get<vec3>( "phx_hextents", vec3() ); 89 if ( table.has_field( "phx_offset" ) ) 90 node->phx_offset = table.get<vec3>( "phx_offset", vec3() ); 91 if ( table.has_field( "phx_mass" ) ) 92 node->phx_mass = table.get<float>( "phx_mass", 0.0f); 93 if ( table.has_field( "phx_mass" ) ) 94 node->phx_shape = nv::phx_shape( table.get<int>( "phx_shape", 0 ) ); 95 87 96 if ( table.has_field( "local_position" ) ) 88 97 node->local.set_position( table.get<vec3>( "local_position", vec3() ) );
Note: See TracChangeset
for help on using the changeset viewer.