diff options
author | David Walter Seikel | 2013-01-20 08:02:11 +1000 |
---|---|---|
committer | David Walter Seikel | 2013-01-20 08:02:11 +1000 |
commit | 7af16a96595ad48fc5f565dfe450d0ed9c79626e (patch) | |
tree | 8e8b4b8a1a19a4874d2a5be022c3b3fbccc6453e /ClientHamr | |
parent | Much better camera path. (diff) | |
download | SledjHamr-7af16a96595ad48fc5f565dfe450d0ed9c79626e.zip SledjHamr-7af16a96595ad48fc5f565dfe450d0ed9c79626e.tar.gz SledjHamr-7af16a96595ad48fc5f565dfe450d0ed9c79626e.tar.bz2 SledjHamr-7af16a96595ad48fc5f565dfe450d0ed9c79626e.tar.xz |
Whitespace clean up.
Diffstat (limited to 'ClientHamr')
-rw-r--r-- | ClientHamr/extantz/CDemo.cpp | 134 |
1 files changed, 51 insertions, 83 deletions
diff --git a/ClientHamr/extantz/CDemo.cpp b/ClientHamr/extantz/CDemo.cpp index 5ecce45..5f67928 100644 --- a/ClientHamr/extantz/CDemo.cpp +++ b/ClientHamr/extantz/CDemo.cpp | |||
@@ -51,7 +51,7 @@ void CDemo::setup(GLData *gld) | |||
51 | 51 | ||
52 | void CDemo::preDraw(GLData *gld, u32 now) | 52 | void CDemo::preDraw(GLData *gld, u32 now) |
53 | { | 53 | { |
54 | if (now - sceneStartTime > timeForThisScene && timeForThisScene!=-1) | 54 | if (((now - sceneStartTime) > timeForThisScene) && (timeForThisScene != -1)) |
55 | switchToNextScene(); | 55 | switchToNextScene(); |
56 | 56 | ||
57 | createParticleImpacts(); | 57 | createParticleImpacts(); |
@@ -63,14 +63,9 @@ bool CDemo::OnEvent(const SEvent& event) | |||
63 | if (!device) | 63 | if (!device) |
64 | return false; | 64 | return false; |
65 | 65 | ||
66 | if (((event.EventType == EET_KEY_INPUT_EVENT && | 66 | if (( ((event.EventType == EET_KEY_INPUT_EVENT) && (event.KeyInput.Key == KEY_SPACE) && (event.KeyInput.PressedDown == false)) || |
67 | event.KeyInput.Key == KEY_SPACE && | 67 | ((event.EventType == EET_MOUSE_INPUT_EVENT) && (event.MouseInput.Event == EMIE_LMOUSE_LEFT_UP)) ) && (currentScene == 3)) |
68 | event.KeyInput.PressedDown == false) || | ||
69 | (event.EventType == EET_MOUSE_INPUT_EVENT && | ||
70 | event.MouseInput.Event == EMIE_LMOUSE_LEFT_UP)) && | ||
71 | currentScene == 3) | ||
72 | { | 68 | { |
73 | // shoot | ||
74 | shoot(); | 69 | shoot(); |
75 | } | 70 | } |
76 | else | 71 | else |
@@ -179,7 +174,6 @@ void CDemo::switchToNextScene() | |||
179 | points.push_back(core::vector3df(150.0f, 170.0f, -160.0f)); | 174 | points.push_back(core::vector3df(150.0f, 170.0f, -160.0f)); |
180 | points.push_back(core::vector3df(150.0f, 170.0f, -160.0f)); | 175 | points.push_back(core::vector3df(150.0f, 170.0f, -160.0f)); |
181 | timeForThisScene = (points.size() - 2) * 1000; | 176 | timeForThisScene = (points.size() - 2) * 1000; |
182 | // camera = sm->addCameraSceneNode(0, points[0], core::vector3df(108, 90, -140)); | ||
183 | sa = sm->createFollowSplineAnimator(device->getTimer()->getTime(), points, 1.0f, 0.6f, false, false); | 177 | sa = sm->createFollowSplineAnimator(device->getTimer()->getTime(), points, 1.0f, 0.6f, false, false); |
184 | camera->addAnimator(sa); | 178 | camera->addAnimator(sa); |
185 | sa->drop(); | 179 | sa->drop(); |
@@ -256,23 +250,21 @@ void CDemo::loadSceneData() | |||
256 | core::matrix4 m; | 250 | core::matrix4 m; |
257 | m.setTranslation(core::vector3df(-1300,-70,-1249)); | 251 | m.setTranslation(core::vector3df(-1300,-70,-1249)); |
258 | 252 | ||
259 | for ( i = 0; i != scene::quake3::E_Q3_MESH_SIZE; ++i ) | 253 | for (i = 0; i != scene::quake3::E_Q3_MESH_SIZE; ++i) |
260 | sm->getMeshManipulator()->transform(quakeLevelMesh->getMesh(i), m); | 254 | sm->getMeshManipulator()->transform(quakeLevelMesh->getMesh(i), m); |
261 | 255 | ||
262 | quakeLevelNode = sm->addOctreeSceneNode( | 256 | quakeLevelNode = sm->addOctreeSceneNode(quakeLevelMesh->getMesh( scene::quake3::E_Q3_MESH_GEOMETRY)); |
263 | quakeLevelMesh->getMesh( scene::quake3::E_Q3_MESH_GEOMETRY)); | ||
264 | if (quakeLevelNode) | 257 | if (quakeLevelNode) |
265 | { | 258 | { |
266 | //quakeLevelNode->setPosition(core::vector3df(-1300,-70,-1249)); | 259 | //quakeLevelNode->setPosition(core::vector3df(-1300, -70, -1249)); |
267 | quakeLevelNode->setVisible(true); | 260 | quakeLevelNode->setVisible(true); |
268 | 261 | ||
269 | // create map triangle selector | 262 | // create map triangle selector |
270 | mapSelector = sm->createOctreeTriangleSelector(quakeLevelMesh->getMesh(0), | 263 | mapSelector = sm->createOctreeTriangleSelector(quakeLevelMesh->getMesh(0), quakeLevelNode, 128); |
271 | quakeLevelNode, 128); | ||
272 | 264 | ||
273 | // if not using shader and no gamma it's better to use more lighting, because | 265 | // if not using shader and no gamma it's better to use more lighting, because |
274 | // quake3 level are usually dark | 266 | // quake3 level are usually dark |
275 | quakeLevelNode->setMaterialType ( video::EMT_LIGHTMAP_M4 ); | 267 | quakeLevelNode->setMaterialType(video::EMT_LIGHTMAP_M4); |
276 | 268 | ||
277 | // set additive blending if wanted | 269 | // set additive blending if wanted |
278 | if (additive) | 270 | if (additive) |
@@ -280,30 +272,30 @@ void CDemo::loadSceneData() | |||
280 | } | 272 | } |
281 | 273 | ||
282 | // the additional mesh can be quite huge and is unoptimized | 274 | // the additional mesh can be quite huge and is unoptimized |
283 | scene::IMesh * additional_mesh = quakeLevelMesh->getMesh ( scene::quake3::E_Q3_MESH_ITEMS ); | 275 | scene::IMesh *additional_mesh = quakeLevelMesh->getMesh(scene::quake3::E_Q3_MESH_ITEMS); |
284 | 276 | ||
285 | for ( i = 0; i!= additional_mesh->getMeshBufferCount (); ++i ) | 277 | for (i = 0; i != additional_mesh->getMeshBufferCount(); ++i) |
286 | { | 278 | { |
287 | scene::IMeshBuffer *meshBuffer = additional_mesh->getMeshBuffer ( i ); | 279 | scene::IMeshBuffer *meshBuffer = additional_mesh->getMeshBuffer(i); |
288 | const video::SMaterial &material = meshBuffer->getMaterial(); | 280 | const video::SMaterial &material = meshBuffer->getMaterial(); |
289 | 281 | ||
290 | //! The ShaderIndex is stored in the material parameter | 282 | //! The ShaderIndex is stored in the material parameter |
291 | s32 shaderIndex = (s32) material.MaterialTypeParam2; | 283 | s32 shaderIndex = (s32) material.MaterialTypeParam2; |
292 | 284 | ||
293 | // the meshbuffer can be rendered without additional support, or it has no shader | 285 | // the meshbuffer can be rendered without additional support, or it has no shader |
294 | const scene::quake3::IShader *shader = quakeLevelMesh->getShader ( shaderIndex ); | 286 | const scene::quake3::IShader *shader = quakeLevelMesh->getShader(shaderIndex); |
295 | if ( 0 == shader ) | 287 | if (0 == shader) |
296 | { | 288 | { |
297 | continue; | 289 | continue; |
298 | } | 290 | } |
299 | // Now add the MeshBuffer(s) with the current Shader to the Manager | 291 | // Now add the MeshBuffer(s) with the current Shader to the Manager |
300 | sm->addQuake3SceneNode ( meshBuffer, shader ); | 292 | sm->addQuake3SceneNode(meshBuffer, shader); |
301 | } | 293 | } |
302 | } | 294 | } |
303 | 295 | ||
304 | // load sydney model and create 2 instances | 296 | // load sydney model and create 2 instances |
305 | 297 | ||
306 | scene::IAnimatedMesh* mesh = 0; | 298 | scene::IAnimatedMesh *mesh = 0; |
307 | mesh = sm->getMesh("media/sydney.md2"); | 299 | mesh = sm->getMesh("media/sydney.md2"); |
308 | if (mesh) | 300 | if (mesh) |
309 | { | 301 | { |
@@ -311,8 +303,8 @@ void CDemo::loadSceneData() | |||
311 | if (model1) | 303 | if (model1) |
312 | { | 304 | { |
313 | model1->setMaterialTexture(0, driver->getTexture("media/sydney.bmp")); | 305 | model1->setMaterialTexture(0, driver->getTexture("media/sydney.bmp")); |
314 | model1->setPosition(core::vector3df(100,40,-80)); | 306 | model1->setPosition(core::vector3df(100, 40, -80)); |
315 | model1->setScale(core::vector3df(2,2,2)); | 307 | model1->setScale(core::vector3df(2, 2, 2)); |
316 | model1->setMD2Animation(scene::EMAT_STAND); | 308 | model1->setMD2Animation(scene::EMAT_STAND); |
317 | model1->setMaterialFlag(video::EMF_LIGHTING, true); | 309 | model1->setMaterialFlag(video::EMF_LIGHTING, true); |
318 | model1->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, true); | 310 | model1->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, true); |
@@ -323,8 +315,8 @@ void CDemo::loadSceneData() | |||
323 | if (model2) | 315 | if (model2) |
324 | { | 316 | { |
325 | model2->setMaterialTexture(0, driver->getTexture("media/spheremap.jpg")); | 317 | model2->setMaterialTexture(0, driver->getTexture("media/spheremap.jpg")); |
326 | model2->setPosition(core::vector3df(180,15,-60)); | 318 | model2->setPosition(core::vector3df(180, 15, -60)); |
327 | model2->setScale(core::vector3df(2,2,2)); | 319 | model2->setScale(core::vector3df(2, 2, 2)); |
328 | model2->setMD2Animation(scene::EMAT_RUN); | 320 | model2->setMD2Animation(scene::EMAT_RUN); |
329 | model2->setMaterialFlag(video::EMF_LIGHTING, false); | 321 | model2->setMaterialFlag(video::EMF_LIGHTING, false); |
330 | model2->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, true); | 322 | model2->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, true); |
@@ -333,7 +325,7 @@ void CDemo::loadSceneData() | |||
333 | } | 325 | } |
334 | } | 326 | } |
335 | 327 | ||
336 | scene::ISceneNodeAnimator* anim = 0; | 328 | scene::ISceneNodeAnimator *anim = 0; |
337 | 329 | ||
338 | // create sky box | 330 | // create sky box |
339 | driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, false); | 331 | driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, false); |
@@ -347,41 +339,35 @@ void CDemo::loadSceneData() | |||
347 | driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, true); | 339 | driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, true); |
348 | 340 | ||
349 | // create walk-between-portals animation | 341 | // create walk-between-portals animation |
350 | |||
351 | core::vector3df waypoint[2]; | 342 | core::vector3df waypoint[2]; |
352 | waypoint[0].set(-150,40,100); | 343 | waypoint[0].set(-150, 40, 100); |
353 | waypoint[1].set(350,40,100); | 344 | waypoint[1].set(350, 40, 100); |
354 | 345 | ||
355 | if (model2) | 346 | if (model2) |
356 | { | 347 | { |
357 | anim = device->getSceneManager()->createFlyStraightAnimator( | 348 | anim = device->getSceneManager()->createFlyStraightAnimator(waypoint[0], waypoint[1], 2000, true); |
358 | waypoint[0], waypoint[1], 2000, true); | ||
359 | model2->addAnimator(anim); | 349 | model2->addAnimator(anim); |
360 | anim->drop(); | 350 | anim->drop(); |
361 | } | 351 | } |
362 | 352 | ||
363 | // create animation for portals; | 353 | // create animation for portals; |
364 | |||
365 | core::array<video::ITexture*> textures; | 354 | core::array<video::ITexture*> textures; |
366 | for (s32 g=1; g<8; ++g) | 355 | for (s32 g=1; g<8; ++g) |
367 | { | 356 | { |
368 | core::stringc tmp("media/portal"); | 357 | core::stringc tmp("media/portal"); |
369 | tmp += g; | 358 | tmp += g; |
370 | tmp += ".bmp"; | 359 | tmp += ".bmp"; |
371 | video::ITexture* t = driver->getTexture( tmp ); | 360 | video::ITexture* t = driver->getTexture(tmp); |
372 | textures.push_back(t); | 361 | textures.push_back(t); |
373 | } | 362 | } |
374 | 363 | ||
375 | anim = sm->createTextureAnimator(textures, 100); | 364 | anim = sm->createTextureAnimator(textures, 100); |
376 | 365 | ||
377 | // create portals | 366 | // create portals |
378 | |||
379 | scene::IBillboardSceneNode* bill = 0; | 367 | scene::IBillboardSceneNode* bill = 0; |
380 | 368 | for (int r = 0; r < 2; ++r) | |
381 | for (int r=0; r<2; ++r) | ||
382 | { | 369 | { |
383 | bill = sm->addBillboardSceneNode(0, core::dimension2d<f32>(100,100), | 370 | bill = sm->addBillboardSceneNode(0, core::dimension2d<f32>(100, 100), waypoint[r]+ core::vector3df(0, 20, 0)); |
384 | waypoint[r]+ core::vector3df(0,20,0)); | ||
385 | bill->setMaterialFlag(video::EMF_LIGHTING, false); | 371 | bill->setMaterialFlag(video::EMF_LIGHTING, false); |
386 | bill->setMaterialTexture(0, driver->getTexture("media/portal1.bmp")); | 372 | bill->setMaterialTexture(0, driver->getTexture("media/portal1.bmp")); |
387 | bill->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR); | 373 | bill->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR); |
@@ -390,21 +376,16 @@ void CDemo::loadSceneData() | |||
390 | 376 | ||
391 | anim->drop(); | 377 | anim->drop(); |
392 | 378 | ||
393 | // create cirlce flying dynamic light with transparent billboard attached | 379 | // create circle flying dynamic light with transparent billboard attached |
380 | scene::ILightSceneNode *light = 0; | ||
394 | 381 | ||
395 | scene::ILightSceneNode* light = 0; | 382 | light = sm->addLightSceneNode(0, core::vector3df(0, 0, 0), video::SColorf(1.0f, 1.0f, 1.f, 1.0f), 500.f); |
396 | 383 | anim = sm->createFlyCircleAnimator(core::vector3df(100, 150, 80), 80.0f, 0.0005f); | |
397 | light = sm->addLightSceneNode(0, | ||
398 | core::vector3df(0,0,0), video::SColorf(1.0f, 1.0f, 1.f, 1.0f), 500.f); | ||
399 | |||
400 | anim = sm->createFlyCircleAnimator( | ||
401 | core::vector3df(100,150,80), 80.0f, 0.0005f); | ||
402 | 384 | ||
403 | light->addAnimator(anim); | 385 | light->addAnimator(anim); |
404 | anim->drop(); | 386 | anim->drop(); |
405 | 387 | ||
406 | bill = device->getSceneManager()->addBillboardSceneNode( | 388 | bill = device->getSceneManager()->addBillboardSceneNode(light, core::dimension2d<f32>(40, 40)); |
407 | light, core::dimension2d<f32>(40,40)); | ||
408 | bill->setMaterialFlag(video::EMF_LIGHTING, false); | 389 | bill->setMaterialFlag(video::EMF_LIGHTING, false); |
409 | bill->setMaterialTexture(0, driver->getTexture("media/particlewhite.bmp")); | 390 | bill->setMaterialTexture(0, driver->getTexture("media/particlewhite.bmp")); |
410 | bill->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR); | 391 | bill->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR); |
@@ -414,22 +395,17 @@ void CDemo::loadSceneData() | |||
414 | metaSelector->addTriangleSelector(mapSelector); | 395 | metaSelector->addTriangleSelector(mapSelector); |
415 | 396 | ||
416 | // create camp fire | 397 | // create camp fire |
417 | |||
418 | campFire = sm->addParticleSystemSceneNode(false); | 398 | campFire = sm->addParticleSystemSceneNode(false); |
419 | campFire->setPosition(core::vector3df(100,120,600)); | 399 | campFire->setPosition(core::vector3df(100, 120, 600)); |
420 | campFire->setScale(core::vector3df(2,2,2)); | 400 | campFire->setScale(core::vector3df(2, 2, 2)); |
421 | |||
422 | scene::IParticleEmitter* em = campFire->createBoxEmitter( | ||
423 | core::aabbox3d<f32>(-7,0,-7,7,1,7), | ||
424 | core::vector3df(0.0f,0.06f,0.0f), | ||
425 | 80,100, video::SColor(1,255,255,255),video::SColor(1,255,255,255), 800,2000); | ||
426 | 401 | ||
402 | scene::IParticleEmitter *em = campFire->createBoxEmitter(core::aabbox3d<f32>(-7, 0, -7, 7, 1, 7), core::vector3df(0.0f, 0.06f, 0.0f), 80, 100, video::SColor(1, 255, 255, 255), video::SColor(1, 255, 255, 255), 800, 2000); | ||
427 | em->setMinStartSize(core::dimension2d<f32>(20.0f, 10.0f)); | 403 | em->setMinStartSize(core::dimension2d<f32>(20.0f, 10.0f)); |
428 | em->setMaxStartSize(core::dimension2d<f32>(20.0f, 10.0f)); | 404 | em->setMaxStartSize(core::dimension2d<f32>(20.0f, 10.0f)); |
429 | campFire->setEmitter(em); | 405 | campFire->setEmitter(em); |
430 | em->drop(); | 406 | em->drop(); |
431 | 407 | ||
432 | scene::IParticleAffector* paf = campFire->createFadeOutParticleAffector(); | 408 | scene::IParticleAffector *paf = campFire->createFadeOutParticleAffector(); |
433 | campFire->addAffector(paf); | 409 | campFire->addAffector(paf); |
434 | paf->drop(); | 410 | paf->drop(); |
435 | 411 | ||
@@ -442,21 +418,20 @@ void CDemo::loadSceneData() | |||
442 | 418 | ||
443 | void CDemo::shoot() | 419 | void CDemo::shoot() |
444 | { | 420 | { |
445 | scene::ISceneManager* sm = device->getSceneManager(); | 421 | scene::ISceneManager *sm = device->getSceneManager(); |
446 | scene::ICameraSceneNode* camera = sm->getActiveCamera(); | 422 | scene::ICameraSceneNode *camera = sm->getActiveCamera(); |
447 | 423 | ||
448 | if (!camera || !mapSelector) | 424 | if ((!camera) || (!mapSelector)) |
449 | return; | 425 | return; |
450 | 426 | ||
451 | SParticleImpact imp; | 427 | SParticleImpact imp; |
452 | imp.when = 0; | 428 | imp.when = 0; |
453 | 429 | ||
454 | // get line of camera | 430 | // get line of camera |
455 | |||
456 | core::vector3df start = camera->getPosition(); | 431 | core::vector3df start = camera->getPosition(); |
457 | core::vector3df end = (camera->getTarget() - start); | 432 | core::vector3df end = (camera->getTarget() - start); |
458 | end.normalize(); | 433 | end.normalize(); |
459 | start += end*8.0f; | 434 | start += end * 8.0f; |
460 | end = start + (end * camera->getFarValue()); | 435 | end = start + (end * camera->getFarValue()); |
461 | 436 | ||
462 | core::triangle3df triangle; | 437 | core::triangle3df triangle; |
@@ -465,8 +440,7 @@ void CDemo::shoot() | |||
465 | 440 | ||
466 | // get intersection point with map | 441 | // get intersection point with map |
467 | scene::ISceneNode* hitNode; | 442 | scene::ISceneNode* hitNode; |
468 | if (sm->getSceneCollisionManager()->getCollisionPoint( | 443 | if (sm->getSceneCollisionManager()->getCollisionPoint(line, mapSelector, end, triangle, hitNode)) |
469 | line, mapSelector, end, triangle, hitNode)) | ||
470 | { | 444 | { |
471 | // collides with wall | 445 | // collides with wall |
472 | core::vector3df out = triangle.getNormal(); | 446 | core::vector3df out = triangle.getNormal(); |
@@ -482,14 +456,13 @@ void CDemo::shoot() | |||
482 | core::vector3df start = camera->getPosition(); | 456 | core::vector3df start = camera->getPosition(); |
483 | core::vector3df end = (camera->getTarget() - start); | 457 | core::vector3df end = (camera->getTarget() - start); |
484 | end.normalize(); | 458 | end.normalize(); |
485 | start += end*8.0f; | 459 | start += end * 8.0f; |
486 | end = start + (end * camera->getFarValue()); | 460 | end = start + (end * camera->getFarValue()); |
487 | } | 461 | } |
488 | 462 | ||
489 | // create fire ball | 463 | // create fire ball |
490 | scene::ISceneNode* node = 0; | 464 | scene::ISceneNode *node = 0; |
491 | node = sm->addBillboardSceneNode(0, | 465 | node = sm->addBillboardSceneNode(0, core::dimension2d<f32>(25, 25), start); |
492 | core::dimension2d<f32>(25,25), start); | ||
493 | 466 | ||
494 | node->setMaterialFlag(video::EMF_LIGHTING, false); | 467 | node->setMaterialFlag(video::EMF_LIGHTING, false); |
495 | node->setMaterialTexture(0, device->getVideoDriver()->getTexture("media/fireball.bmp")); | 468 | node->setMaterialTexture(0, device->getVideoDriver()->getTexture("media/fireball.bmp")); |
@@ -497,12 +470,11 @@ void CDemo::shoot() | |||
497 | 470 | ||
498 | f32 length = (f32)(end - start).getLength(); | 471 | f32 length = (f32)(end - start).getLength(); |
499 | const f32 speed = 0.6f; | 472 | const f32 speed = 0.6f; |
500 | u32 time = (u32)(length / speed); | 473 | u32 time = (u32) (length / speed); |
501 | 474 | ||
502 | scene::ISceneNodeAnimator* anim = 0; | 475 | scene::ISceneNodeAnimator *anim = 0; |
503 | 476 | ||
504 | // set flight line | 477 | // set flight line |
505 | |||
506 | anim = sm->createFlyStraightAnimator(start, end, time); | 478 | anim = sm->createFlyStraightAnimator(start, end, time); |
507 | node->addAnimator(anim); | 479 | node->addAnimator(anim); |
508 | anim->drop(); | 480 | anim->drop(); |
@@ -523,27 +495,23 @@ void CDemo::shoot() | |||
523 | void CDemo::createParticleImpacts() | 495 | void CDemo::createParticleImpacts() |
524 | { | 496 | { |
525 | u32 now = device->getTimer()->getTime(); | 497 | u32 now = device->getTimer()->getTime(); |
526 | scene::ISceneManager* sm = device->getSceneManager(); | 498 | scene::ISceneManager *sm = device->getSceneManager(); |
527 | 499 | ||
528 | for (s32 i=0; i<(s32)Impacts.size(); ++i) | 500 | for (s32 i = 0; i < (s32) Impacts.size(); ++i) |
529 | if (now > Impacts[i].when) | 501 | if (now > Impacts[i].when) |
530 | { | 502 | { |
531 | // create smoke particle system | 503 | // create smoke particle system |
532 | scene::IParticleSystemSceneNode* pas = 0; | 504 | scene::IParticleSystemSceneNode *pas = 0; |
533 | 505 | ||
534 | pas = sm->addParticleSystemSceneNode(false, 0, -1, Impacts[i].pos); | 506 | pas = sm->addParticleSystemSceneNode(false, 0, -1, Impacts[i].pos); |
535 | 507 | ||
536 | pas->setParticleSize(core::dimension2d<f32>(10.0f, 10.0f)); | 508 | pas->setParticleSize(core::dimension2d<f32>(10.0f, 10.0f)); |
537 | 509 | ||
538 | scene::IParticleEmitter* em = pas->createBoxEmitter( | 510 | scene::IParticleEmitter* em = pas->createBoxEmitter(core::aabbox3d<f32>(-5, -5, -5, 5, 5, 5), Impacts[i].outVector, 20, 40, video::SColor(50, 255, 255, 255), video::SColor(50, 255, 255, 255), 1200, 1600, 20); |
539 | core::aabbox3d<f32>(-5,-5,-5,5,5,5), | ||
540 | Impacts[i].outVector, 20,40, video::SColor(50,255,255,255),video::SColor(50,255,255,255), | ||
541 | 1200,1600, 20); | ||
542 | |||
543 | pas->setEmitter(em); | 511 | pas->setEmitter(em); |
544 | em->drop(); | 512 | em->drop(); |
545 | 513 | ||
546 | scene::IParticleAffector* paf = campFire->createFadeOutParticleAffector(); | 514 | scene::IParticleAffector *paf = campFire->createFadeOutParticleAffector(); |
547 | pas->addAffector(paf); | 515 | pas->addAffector(paf); |
548 | paf->drop(); | 516 | paf->drop(); |
549 | 517 | ||
@@ -552,7 +520,7 @@ void CDemo::createParticleImpacts() | |||
552 | pas->setMaterialTexture(0, device->getVideoDriver()->getTexture("media/smoke.bmp")); | 520 | pas->setMaterialTexture(0, device->getVideoDriver()->getTexture("media/smoke.bmp")); |
553 | pas->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR); | 521 | pas->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR); |
554 | 522 | ||
555 | scene::ISceneNodeAnimator* anim = sm->createDeleteAnimator(2000); | 523 | scene::ISceneNodeAnimator *anim = sm->createDeleteAnimator(2000); |
556 | pas->addAnimator(anim); | 524 | pas->addAnimator(anim); |
557 | anim->drop(); | 525 | anim->drop(); |
558 | 526 | ||