Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 990 vs 992 for /trunk/Source Code/Scenes/WarScene/WarScene.cpp

Diff revisions: vs.
  @@ -174,7 +174,7 @@
174 174 -cosf(g_sunAngle.y),
175 175 -sinf(g_sunAngle.x) * sinf(g_sunAngle.y));
176 176
177 - _sun.lock()->get<PhysicsComponent>()->setPosition(sunVector);
177 + _sun.lock()->get<TransformComponent>()->setPosition(sunVector);
178 178 vec4<F32> sunColour = vec4<F32>(1.0f, 1.0f, 0.2f, 1.0f);
179 179
180 180 _sun.lock()->getNode<Light>()->setDiffuseColour(sunColour);
  @@ -205,10 +205,10 @@
205 205
206 206 if (!initPosSetLight) {
207 207 for (U8 i = 0; i < 16; ++i) {
208 - initPosLight[i].set(_lightNodes[i].lock()->get<PhysicsComponent>()->getPosition());
208 + initPosLight[i].set(_lightNodes[i].lock()->get<TransformComponent>()->getPosition());
209 209 }
210 210 for (U8 i = 0; i < 80; ++i) {
211 - initPosLight2[i].set(_lightNodes2[i].first.lock()->get<PhysicsComponent>()->getPosition());
211 + initPosLight2[i].set(_lightNodes2[i].first.lock()->get<TransformComponent>()->getPosition());
212 212 }
213 213 initPosSetLight = true;
214 214 }
  @@ -228,25 +228,25 @@
228 228 F32 c = i % 2 == 0 ? c1 : c2;
229 229 F32 s = i % 2 == 0 ? s1 : s2;
230 230 SceneGraphNode_ptr light = _lightNodes[i].lock();
231 - PhysicsComponent* pComp = light->get<PhysicsComponent>();
232 - pComp->setPositionX(radius * c + initPosLight[i].x);
233 - pComp->setPositionZ(radius * s + initPosLight[i].z);
234 - pComp->setPositionY((radius * 0.5f) * s + initPosLight[i].y);
231 + TransformComponent* tComp = light->get<TransformComponent>();
232 + tComp->setPositionX(radius * c + initPosLight[i].x);
233 + tComp->setPositionZ(radius * s + initPosLight[i].z);
234 + tComp->setPositionY((radius * 0.5f) * s + initPosLight[i].y);
235 235 }
236 236
237 237 for (U8 i = 0; i < 80; ++i) {
238 238 SceneGraphNode_ptr light = _lightNodes2[i].first.lock();
239 - PhysicsComponent* pComp = light->get<PhysicsComponent>();
239 + TransformComponent* tComp = light->get<TransformComponent>();
240 240 F32 angle = _lightNodes2[i].second ? std::fmod(phiLight + 45.0f, 360.0f) : phiLight;
241 241 vec2<F32> position(rotatePoint(vec2<F32>(0.0f), angle, initPosLight2[i].xz()));
242 - pComp->setPositionX(position.x);
243 - pComp->setPositionZ(position.y);
242 + tComp->setPositionX(position.x);
243 + tComp->setPositionZ(position.y);
244 244 }
245 245
246 246 for (U8 i = 0; i < 40; ++i) {
247 247 SceneGraphNode_ptr light = _lightNodes3[i].lock();
248 - PhysicsComponent* pComp = light->get<PhysicsComponent>();
249 - pComp->rotateY(phiLight);
248 + TransformComponent* tComp = light->get<TransformComponent>();
249 + tComp->rotateY(phiLight);
250 250 }
251 251 _taskTimers[3] = 0.0;
252 252 }
  @@ -281,16 +281,16 @@
281 281 phi = 0.0f;
282 282 }
283 283
284 - PhysicsComponent* pComp = particles->get<PhysicsComponent>();
284 + TransformComponent* tComp = particles->get<TransformComponent>();
285 285 if (!initPosSet) {
286 - initPos.set(pComp->getPosition());
286 + initPos.set(tComp->getPosition());
287 287 initPosSet = true;
288 288 }
289 289
290 - /*pComp->setPositionX(radius * std::cos(phi) + initPos.x);
291 - pComp->setPositionZ(radius * std::sin(phi) + initPos.z);
292 - pComp->setPositionY((radius * 0.5f) * std::sin(phi) + initPos.y);
293 - pComp->rotateY(phi);*/
290 + /*tComp->setPositionX(radius * std::cos(phi) + initPos.x);
291 + tComp->setPositionZ(radius * std::sin(phi) + initPos.z);
292 + tComp->setPositionY((radius * 0.5f) * std::sin(phi) + initPos.y);
293 + tComp->rotateY(phi);*/
294 294 }
295 295
296 296 if (!_aiManager->getNavMesh(_armyNPCs[0][0].lock()->get<UnitComponent>()->getUnit<NPC>()->getAIEntity()->getAgentRadiusCategory())) {
  @@ -328,11 +328,12 @@
328 328 }
329 329
330 330 bool WarScene::load(const stringImpl& name) {
331 - static const U32 lightMask = to_base(SGNComponent::ComponentType::PHYSICS) |
331 + static const U32 lightMask = to_base(SGNComponent::ComponentType::TRANSFORM) |
332 332 to_base(SGNComponent::ComponentType::BOUNDS) |
333 333 to_base(SGNComponent::ComponentType::RENDERING);
334 334
335 335 static const U32 normalMask = lightMask |
336 + to_base(SGNComponent::ComponentType::RIGID_BODY) |
336 337 to_base(SGNComponent::ComponentType::NAVIGATION) |
337 338 to_base(SGNComponent::ComponentType::NETWORKING);
338 339
  @@ -411,10 +412,10 @@
411 412 locationFlag = 3;
412 413 }
413 414
414 - SceneGraphNode_ptr crtNode = _sceneGraph->getRoot().addNode(currentMesh, normalMask, baseNode->get<PhysicsComponent>()->physicsGroup(), currentName);
415 + SceneGraphNode_ptr crtNode = _sceneGraph->getRoot().addNode(currentMesh, normalMask, baseNode->get<RigidBodyComponent>()->physicsGroup(), currentName);
415 416 crtNode->setSelectable(true);
416 417 crtNode->usageContext(baseNode->usageContext());
417 - PhysicsComponent* pComp = crtNode->get<PhysicsComponent>();
418 + TransformComponent* tComp = crtNode->get<TransformComponent>();
418 419 NavigationComponent* nComp = crtNode->get<NavigationComponent>();
419 420 nComp->navigationContext(
420 421 baseNode->get<NavigationComponent>()->navigationContext());
  @@ -423,8 +424,8 @@
423 424 ->navMeshDetailOverride());
424 425
425 426 vec3<F32> position(to_F32(currentPos.first), -0.01f, to_F32(currentPos.second));
426 - pComp->setScale(baseNode->get<PhysicsComponent>()->getScale());
427 - pComp->setPosition(position);
427 + tComp->setScale(baseNode->get<TransformComponent>()->getScale());
428 + tComp->setPosition(position);
428 429
429 430 {
430 431 ResourceDescriptor tempLight(Util::StringFormat("Light_point_%s_1", currentName.c_str()));
  @@ -437,7 +438,7 @@
437 438 light->setCastShadows(false);
438 439 light->setDiffuseColour(DefaultColours::RANDOM());
439 440 SceneGraphNode_ptr lightSGN = _sceneGraph->getRoot().addNode(light, lightMask, PhysicsGroup::GROUP_IGNORE);
440 - lightSGN->get<PhysicsComponent>()->setPosition(position + vec3<F32>(0.0f, 8.0f, 0.0f));
441 + lightSGN->get<TransformComponent>()->setPosition(position + vec3<F32>(0.0f, 8.0f, 0.0f));
441 442 _lightNodes2.push_back(std::make_pair(lightSGN, false));
442 443 }
443 444 {
  @@ -450,7 +451,7 @@
450 451 light->setCastShadows(false);
451 452 light->setDiffuseColour(DefaultColours::RANDOM());
452 453 SceneGraphNode_ptr lightSGN = _sceneGraph->getRoot().addNode(light, lightMask, PhysicsGroup::GROUP_IGNORE);
453 - lightSGN->get<PhysicsComponent>()->setPosition(position + vec3<F32>(0.0f, 8.0f, 0.0f));
454 + lightSGN->get<TransformComponent>()->setPosition(position + vec3<F32>(0.0f, 8.0f, 0.0f));
454 455 _lightNodes2.push_back(std::make_pair(lightSGN, true));
455 456 }
456 457 {
  @@ -464,8 +465,8 @@
464 465 light->setCastShadows(false);
465 466 light->setDiffuseColour(DefaultColours::RANDOM());
466 467 SceneGraphNode_ptr lightSGN = _sceneGraph->getRoot().addNode(light, lightMask, PhysicsGroup::GROUP_IGNORE);
467 - lightSGN->get<PhysicsComponent>()->setPosition(position + vec3<F32>(0.0f, 10.0f, 0.0f));
468 - lightSGN->get<PhysicsComponent>()->rotateX(-20);
468 + lightSGN->get<TransformComponent>()->setPosition(position + vec3<F32>(0.0f, 10.0f, 0.0f));
469 + lightSGN->get<TransformComponent>()->rotateX(-20);
469 470 _lightNodes3.push_back(lightSGN);
470 471 }
471 472 }
  @@ -479,33 +480,33 @@
479 480 flag->setActive(false);
480 481 std::shared_ptr<SceneNode> flagNode = flag->getNode();
481 482
482 - _flag[0] = _sceneGraph->getRoot().addNode(flagNode, normalMask, flag->get<PhysicsComponent>()->physicsGroup(), "Team1Flag");
483 + _flag[0] = _sceneGraph->getRoot().addNode(flagNode, normalMask, flag->get<RigidBodyComponent>()->physicsGroup(), "Team1Flag");
483 484
484 485 SceneGraphNode_ptr flag0(_flag[0].lock());
485 486 flag0->setSelectable(false);
486 487 flag0->usageContext(flag->usageContext());
487 - PhysicsComponent* flagPComp = flag0->get<PhysicsComponent>();
488 + TransformComponent* flagtComp = flag0->get<TransformComponent>();
488 489 NavigationComponent* flagNComp = flag0->get<NavigationComponent>();
489 490 RenderingComponent* flagRComp = flag0->getChild(0).get<RenderingComponent>();
490 491
491 - flagPComp->setScale(flag->get<PhysicsComponent>()->getScale());
492 - flagPComp->setPosition(vec3<F32>(25.0f, 0.1f, -206.0f));
492 + flagtComp->setScale(flag->get<TransformComponent>()->getScale());
493 + flagtComp->setPosition(vec3<F32>(25.0f, 0.1f, -206.0f));
493 494
494 495 flagNComp->navigationContext(NavigationComponent::NavigationContext::NODE_IGNORE);
495 496
496 497 flagRComp->getMaterialInstance()->setDiffuse(DefaultColours::BLUE);
497 498
498 - _flag[1] = _sceneGraph->getRoot().addNode(flagNode, normalMask, flag->get<PhysicsComponent>()->physicsGroup(), "Team2Flag");
499 + _flag[1] = _sceneGraph->getRoot().addNode(flagNode, normalMask, flag->get<RigidBodyComponent>()->physicsGroup(), "Team2Flag");
499 500 SceneGraphNode_ptr flag1(_flag[1].lock());
500 501 flag1->setSelectable(false);
501 502 flag1->usageContext(flag->usageContext());
502 503
503 - flagPComp = flag1->get<PhysicsComponent>();
504 + flagtComp = flag1->get<TransformComponent>();
504 505 flagNComp = flag1->get<NavigationComponent>();
505 506 flagRComp = flag1->getChild(0).get<RenderingComponent>();
506 507
507 - flagPComp->setPosition(vec3<F32>(25.0f, 0.1f, 206.0f));
508 - flagPComp->setScale(flag->get<PhysicsComponent>()->getScale());
508 + flagtComp->setPosition(vec3<F32>(25.0f, 0.1f, 206.0f));
509 + flagtComp->setScale(flag->get<TransformComponent>()->getScale());
509 510
510 511 flagNComp->navigationContext(NavigationComponent::NavigationContext::NODE_IGNORE);
511 512
  @@ -514,17 +515,17 @@
514 515 SceneGraphNode_ptr firstPersonFlag = _sceneGraph->getRoot().addNode(flagNode, normalMask, PhysicsGroup::GROUP_KINEMATIC, "FirstPersonFlag");
515 516 firstPersonFlag->lockVisibility(true);
516 517 firstPersonFlag->usageContext(SceneGraphNode::UsageContext::NODE_DYNAMIC);
517 - flagPComp = firstPersonFlag->get<PhysicsComponent>();
518 - flagPComp->setScale(0.0015f);
519 - flagPComp->setPosition(1.25f, -1.5f, 0.15f);
520 - flagPComp->rotate(-20.0f, -70.0f, 50.0f);
521 - flagPComp->onCollisionCbk(DELEGATE_BIND(&WarScene::weaponCollision, this, std::placeholders::_1));
518 + flagtComp = firstPersonFlag->get<TransformComponent>();
519 + flagtComp->setScale(0.0015f);
520 + flagtComp->setPosition(1.25f, -1.5f, 0.15f);
521 + flagtComp->rotate(-20.0f, -70.0f, 50.0f);
522 + firstPersonFlag->get<RigidBodyComponent>()->onCollisionCbk(DELEGATE_BIND(&WarScene::weaponCollision, this, std::placeholders::_1));
522 523 flagRComp = firstPersonFlag->getChild(0).get<RenderingComponent>();
523 524 flagRComp->getMaterialInstance()->setDiffuse(DefaultColours::GREEN);
524 525 flagRComp->getMaterialInstance()->setHighPriority(true);
525 526 _firstPersonWeapon = firstPersonFlag;
526 527
527 - //_firstPersonWeapon.lock()->get<PhysicsComponent>()->ignoreView(true, playerCamera()->getGUID());
528 + //_firstPersonWeapon.lock()->get<TransformComponent>()->ignoreView(true, playerCamera()->getGUID());
528 529
529 530 AI::WarSceneAIProcessor::registerFlags(_flag[0], _flag[1]);
530 531
  @@ -575,11 +576,11 @@
575 576 _particleEmitter = addParticleEmitter("TESTPARTICLES", particles, _sceneGraph->getRoot());
576 577 SceneGraphNode_ptr testSGN = _particleEmitter.lock();
577 578 std::shared_ptr<ParticleEmitter> test = testSGN->getNode<ParticleEmitter>();
578 - testSGN->get<PhysicsComponent>()->translateY(10);
579 + testSGN->get<TransformComponent>()->translateY(10);
579 580 test->setDrawImpostor(true);
580 581 test->enableEmitter(true);
581 582 test->addSource(particleSource);
582 - boxGenerator->pos(vec4<F32>(testSGN->get<PhysicsComponent>()->getPosition()));
583 + boxGenerator->pos(vec4<F32>(testSGN->get<TransformComponent>()->getPosition()));
583 584
584 585 std::shared_ptr<ParticleEulerUpdater> eulerUpdater = std::make_shared<ParticleEulerUpdater>(platformContext().gfx());
585 586 eulerUpdater->_globalAcceleration.set(0.0f, -20.0f, 0.0f);
  @@ -604,7 +605,7 @@
604 605 light->setCastShadows(false);
605 606 light->setDiffuseColour(DefaultColours::RANDOM());
606 607 SceneGraphNode_ptr lightSGN = _sceneGraph->getRoot().addNode(light, lightMask, PhysicsGroup::GROUP_IGNORE);
607 - lightSGN->get<PhysicsComponent>()->setPosition(vec3<F32>(-215.0f + (115 * row), 15.0f, (-215.0f + (115 * col))));
608 + lightSGN->get<TransformComponent>()->setPosition(vec3<F32>(-215.0f + (115 * row), 15.0f, (-215.0f + (115 * col))));
608 609 _lightNodes.push_back(lightSGN);
609 610 }
610 611 }
  @@ -768,7 +769,7 @@
768 769 Scene::postLoadMainThread();
769 770 }
770 771
771 - void WarScene::weaponCollision(const PhysicsComponent& collider) {
772 + void WarScene::weaponCollision(const RigidBodyComponent& collider) {
772 773 Console::d_printfn("Weapon touched [ %s ]", collider.getSGN().getName().c_str());
773 774 }
774 775