Skip to content

Commit

Permalink
👹 (build broken) Barebone port to OGRE 2.2.4, part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
ohlidalp committed Feb 10, 2021
1 parent e677074 commit 3c23204
Show file tree
Hide file tree
Showing 22 changed files with 631 additions and 165 deletions.
59 changes: 59 additions & 0 deletions source/main/gameplay/IWater.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
This source file is part of Rigs of Rods
Copyright 2005-2012 Pierre-Michel Ricordel
Copyright 2007-2012 Thomas Fischer
Copyright 2017-2020 Petr Ohlidal
For more information, see http://www.rigsofrods.org/
Rigs of Rods is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3, as
published by the Free Software Foundation.
Rigs of Rods is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#include "ForwardDeclarations.h"
#include <Ogre.h>

namespace RoR {

class IWater //!< TODO: Mixed gfx+physics (waves) - must be separated ~ only_a_ptr, 02/2018
{
public:
IWater()
{
}

virtual ~IWater()
{
}

virtual float GetStaticWaterHeight() = 0; //!< Returns static water level configured in 'terrn2'
virtual void SetStaticWaterHeight(float value) = 0;
virtual void SetWaterBottomHeight(float value) {};
virtual float CalcWavesHeight(Ogre::Vector3 pos) = 0;
virtual Ogre::Vector3 CalcWavesVelocity(Ogre::Vector3 pos) = 0;
virtual void SetWaterVisible(bool value) = 0;
virtual void WaterSetSunPosition(Ogre::Vector3) {}
virtual bool IsUnderWater(Ogre::Vector3 pos) = 0;
virtual void FrameStepWater(float dt) = 0;
virtual void SetReflectionPlaneHeight(float centerheight) {}
virtual void UpdateReflectionPlane(float h) {}
virtual void WaterPrepareShutdown() {}
virtual void UpdateWater() = 0;

// Only used by class Water for SurveyMap texture creation
virtual void SetForcedCameraTransform(Ogre::Radian fovy, Ogre::Vector3 pos, Ogre::Quaternion rot) {};
virtual void ClearForcedCameraTransform() {};
};

} // namespace RoR
14 changes: 8 additions & 6 deletions source/main/gameplay/SceneMouse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,23 @@ SceneMouse::SceneMouse() :
void SceneMouse::InitializeVisuals()
{
// load 3d line for mouse picking
pickLine = App::GetGfxScene()->GetSceneManager()->createManualObject("PickLineObject");
pickLineNode = App::GetGfxScene()->GetSceneManager()->getRootSceneNode()->createChildSceneNode("PickLineNode");
pickLine = new Ogre::v1::ManualObject(
App::GetGfxScene()->GenerateId(),
&App::GetGfxScene()->GetSceneManager()->_getEntityMemoryManager(Ogre::SCENE_DYNAMIC),
App::GetGfxScene()->GetSceneManager());
pickLineNode = App::GetGfxScene()->GetSceneManager()->getRootSceneNode()->createChildSceneNode();

MaterialPtr pickLineMaterial = MaterialManager::getSingleton().getByName("PickLineMaterial", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
if (pickLineMaterial.isNull())
{
pickLineMaterial = MaterialManager::getSingleton().create("PickLineMaterial", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
}
pickLineMaterial->setReceiveShadows(false);
pickLineMaterial->getTechnique(0)->setLightingEnabled(true);
pickLineMaterial->getTechnique(0)->getPass(0)->setDiffuse(0, 0, 1, 0);
pickLineMaterial->getTechnique(0)->getPass(0)->setAmbient(0, 0, 1);
pickLineMaterial->getTechnique(0)->getPass(0)->setSelfIllumination(0, 0, 1);

pickLine->begin("PickLineMaterial", RenderOperation::OT_LINE_LIST);
pickLine->begin("PickLineMaterial", Ogre::OperationType::OT_LINE_LIST);
pickLine->position(0, 0, 0);
pickLine->position(0, 0, 0);
pickLine->end();
Expand All @@ -75,13 +77,13 @@ void SceneMouse::DiscardVisuals()
{
if (pickLineNode != nullptr)
{
App::GetGfxScene()->GetSceneManager()->getRootSceneNode()->removeAndDestroyChild("PickLineNode");
App::GetGfxScene()->GetSceneManager()->getRootSceneNode()->removeAndDestroyChild(pickLineNode);
pickLineNode = nullptr;
}

if (pickLine != nullptr)
{
App::GetGfxScene()->GetSceneManager()->destroyManualObject("PickLineObject");
delete pickLine;
pickLine = nullptr;
}
}
Expand Down

0 comments on commit 3c23204

Please sign in to comment.