Subversion Repository Public Repository

Divide-Framework

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

Diff Revisions 988 vs 989 for /trunk/Source Code/Scenes/Scene.cpp

Diff revisions: vs.
  @@ -75,7 +75,6 @@
75 75 _loadComplete(false),
76 76 _cookCollisionMeshesScheduled(false),
77 77 _pxScene(nullptr),
78 - _baseCamera(nullptr),
79 78 _paramHandler(ParamHandler::instance())
80 79 {
81 80 _sceneTimerUS = 0UL;
  @@ -471,7 +470,7 @@
471 470
472 471 SceneGraphNode_ptr Scene::addSky(const stringImpl& nodeName) {
473 472 ResourceDescriptor skyDescriptor("Default Sky");
474 - skyDescriptor.setID(to_U32(std::floor(_baseCamera->getZPlanes().y * 2)));
473 + skyDescriptor.setID(to_U32(std::floor(Camera::utilityCamera(Camera::UtilityCamera::DEFAULT)->getZPlanes().y * 2)));
475 474
476 475 std::shared_ptr<Sky> skyItem = CreateResource<Sky>(_resCache, skyDescriptor);
477 476 DIVIDE_ASSERT(skyItem != nullptr, "Scene::addSky error: Could not create sky resource!");
  @@ -720,28 +719,29 @@
720 719 XML::loadDefaultKeybindings(Paths::g_xmlDataLocation + "keyBindings.xml", this);
721 720 }
722 721
723 - void Scene::loadBaseCamera() {
724 - _baseCamera = Camera::createCamera(Util::StringFormat("BaseCamera_%s", _name.c_str()), Camera::CameraType::FREE_FLY);
722 + void Scene::loadDefaultCamera() {
723 + Camera* baseCamera = Camera::utilityCamera(Camera::UtilityCamera::DEFAULT);
725 724
726 725
727 726 // Camera position is overridden in the scene's XML configuration file
728 727 if (ParamHandler::instance().getParam<bool>(_ID_RT((getName() + ".options.cameraStartPositionOverride").c_str()))) {
729 - _baseCamera->setEye(vec3<F32>(
728 + baseCamera->setEye(vec3<F32>(
730 729 _paramHandler.getParam<F32>(_ID_RT((getName() + ".options.cameraStartPosition.x").c_str())),
731 730 _paramHandler.getParam<F32>(_ID_RT((getName() + ".options.cameraStartPosition.y").c_str())),
732 731 _paramHandler.getParam<F32>(_ID_RT((getName() + ".options.cameraStartPosition.z").c_str()))));
733 732 vec2<F32> camOrientation(_paramHandler.getParam<F32>(_ID_RT((getName() + ".options.cameraStartOrientation.xOffsetDegrees").c_str())),
734 733 _paramHandler.getParam<F32>(_ID_RT((getName() + ".options.cameraStartOrientation.yOffsetDegrees").c_str())));
735 - _baseCamera->setGlobalRotation(camOrientation.y /*yaw*/, camOrientation.x /*pitch*/);
734 + baseCamera->setGlobalRotation(camOrientation.y /*yaw*/, camOrientation.x /*pitch*/);
736 735 } else {
737 - _baseCamera->setEye(vec3<F32>(0, 50, 0));
736 + baseCamera->setEye(vec3<F32>(0, 50, 0));
738 737 }
739 738
740 - _baseCamera->setMoveSpeedFactor(_paramHandler.getParam<F32>(_ID_RT((getName() + ".options.cameraSpeed.move").c_str()), 1.0f));
741 - _baseCamera->setTurnSpeedFactor(_paramHandler.getParam<F32>(_ID_RT((getName() + ".options.cameraSpeed.turn").c_str()), 1.0f));
742 - _baseCamera->setProjection(_context.gfx().renderingData().aspectRatio(),
743 - _context.config().runtime.verticalFOV,
744 - vec2<F32>(_context.config().runtime.zNear, _context.config().runtime.zFar));
739 + baseCamera->setMoveSpeedFactor(_paramHandler.getParam<F32>(_ID_RT((getName() + ".options.cameraSpeed.move").c_str()), 1.0f));
740 + baseCamera->setTurnSpeedFactor(_paramHandler.getParam<F32>(_ID_RT((getName() + ".options.cameraSpeed.turn").c_str()), 1.0f));
741 + baseCamera->setProjection(_context.gfx().renderingData().aspectRatio(),
742 + _context.config().runtime.verticalFOV,
743 + vec2<F32>(_context.config().runtime.zNear, _context.config().runtime.zFar));
744 +
745 745 }
746 746
747 747 bool Scene::load(const stringImpl& name) {
  @@ -750,7 +750,7 @@
750 750 STUBBED("ToDo: load skyboxes from XML")
751 751 _name = name;
752 752
753 - loadBaseCamera();
753 + loadDefaultCamera();
754 754 loadXMLAssets();
755 755 addSelectionCallback([this](U8 pIndex){_context.gui().selectionChangeCallback(this, pIndex);});
756 756
  @@ -790,7 +790,6 @@
790 790 MemoryManager::DELETE(_pxScene);
791 791 _context.pfx().setPhysicsScene(nullptr);
792 792 clearObjects();
793 - Camera::destroyCamera(_baseCamera);
794 793 _loadComplete = false;
795 794 assert(_scenePlayers.empty());
796 795