Merge branch 'light'
commit
ce792cf182
@ -0,0 +1,4 @@
|
||||
|
||||
#include "lighting.hpp"
|
||||
|
||||
CSVRender::Lighting::~Lighting() {}
|
@ -0,0 +1,27 @@
|
||||
#ifndef OPENCS_VIEW_LIGHTING_H
|
||||
#define OPENCS_VIEW_LIGHTING_H
|
||||
|
||||
namespace Ogre
|
||||
{
|
||||
class SceneManager;
|
||||
class ColourValue;
|
||||
}
|
||||
|
||||
namespace CSVRender
|
||||
{
|
||||
class Lighting
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~Lighting();
|
||||
|
||||
virtual void activate (Ogre::SceneManager *sceneManager,
|
||||
const Ogre::ColourValue *defaultAmbient = 0) = 0;
|
||||
|
||||
virtual void deactivate() = 0;
|
||||
|
||||
virtual void setDefaultAmbient (const Ogre::ColourValue& colour) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,30 @@
|
||||
|
||||
#include "lightingbright.hpp"
|
||||
|
||||
#include <OgreSceneManager.h>
|
||||
|
||||
CSVRender::LightingBright::LightingBright() : mSceneManager (0), mLight (0) {}
|
||||
|
||||
void CSVRender::LightingBright::activate (Ogre::SceneManager *sceneManager,
|
||||
const Ogre::ColourValue *defaultAmbient)
|
||||
{
|
||||
mSceneManager = sceneManager;
|
||||
|
||||
mSceneManager->setAmbientLight (Ogre::ColourValue (1.0, 1.0, 1.0, 1));
|
||||
|
||||
mLight = mSceneManager->createLight();
|
||||
mLight->setType (Ogre::Light::LT_DIRECTIONAL);
|
||||
mLight->setDirection (Ogre::Vector3 (0, 0, -1));
|
||||
mLight->setDiffuseColour (Ogre::ColourValue (1.0, 1.0, 1.0));
|
||||
}
|
||||
|
||||
void CSVRender::LightingBright::deactivate()
|
||||
{
|
||||
if (mLight)
|
||||
{
|
||||
mSceneManager->destroyLight (mLight);
|
||||
mLight = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void CSVRender::LightingBright::setDefaultAmbient (const Ogre::ColourValue& colour) {}
|
@ -0,0 +1,31 @@
|
||||
#ifndef OPENCS_VIEW_LIGHTING_BRIGHT_H
|
||||
#define OPENCS_VIEW_LIGHTING_BRIGHT_H
|
||||
|
||||
#include "lighting.hpp"
|
||||
|
||||
namespace Ogre
|
||||
{
|
||||
class Light;
|
||||
}
|
||||
|
||||
namespace CSVRender
|
||||
{
|
||||
class LightingBright : public Lighting
|
||||
{
|
||||
Ogre::SceneManager *mSceneManager;
|
||||
Ogre::Light *mLight;
|
||||
|
||||
public:
|
||||
|
||||
LightingBright();
|
||||
|
||||
virtual void activate (Ogre::SceneManager *sceneManager,
|
||||
const Ogre::ColourValue *defaultAmbient = 0);
|
||||
|
||||
virtual void deactivate();
|
||||
|
||||
virtual void setDefaultAmbient (const Ogre::ColourValue& colour);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,36 @@
|
||||
|
||||
#include "lightingday.hpp"
|
||||
|
||||
#include <OgreSceneManager.h>
|
||||
|
||||
CSVRender::LightingDay::LightingDay() : mSceneManager (0), mLight (0) {}
|
||||
|
||||
void CSVRender::LightingDay::activate (Ogre::SceneManager *sceneManager,
|
||||
const Ogre::ColourValue *defaultAmbient)
|
||||
{
|
||||
mSceneManager = sceneManager;
|
||||
|
||||
if (defaultAmbient)
|
||||
mSceneManager->setAmbientLight (*defaultAmbient);
|
||||
else
|
||||
mSceneManager->setAmbientLight (Ogre::ColourValue (0.7, 0.7, 0.7, 1));
|
||||
|
||||
mLight = mSceneManager->createLight();
|
||||
mLight->setType (Ogre::Light::LT_DIRECTIONAL);
|
||||
mLight->setDirection (Ogre::Vector3 (0, 0, -1));
|
||||
mLight->setDiffuseColour (Ogre::ColourValue (1, 1, 1));
|
||||
}
|
||||
|
||||
void CSVRender::LightingDay::deactivate()
|
||||
{
|
||||
if (mLight)
|
||||
{
|
||||
mSceneManager->destroyLight (mLight);
|
||||
mLight = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void CSVRender::LightingDay::setDefaultAmbient (const Ogre::ColourValue& colour)
|
||||
{
|
||||
mSceneManager->setAmbientLight (colour);
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
#ifndef OPENCS_VIEW_LIGHTING_DAY_H
|
||||
#define OPENCS_VIEW_LIGHTING_DAY_H
|
||||
|
||||
#include "lighting.hpp"
|
||||
|
||||
namespace Ogre
|
||||
{
|
||||
class Light;
|
||||
}
|
||||
|
||||
namespace CSVRender
|
||||
{
|
||||
class LightingDay : public Lighting
|
||||
{
|
||||
Ogre::SceneManager *mSceneManager;
|
||||
Ogre::Light *mLight;
|
||||
|
||||
public:
|
||||
|
||||
LightingDay();
|
||||
|
||||
virtual void activate (Ogre::SceneManager *sceneManager,
|
||||
const Ogre::ColourValue *defaultAmbient = 0);
|
||||
|
||||
virtual void deactivate();
|
||||
|
||||
virtual void setDefaultAmbient (const Ogre::ColourValue& colour);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,36 @@
|
||||
|
||||
#include "lightingnight.hpp"
|
||||
|
||||
#include <OgreSceneManager.h>
|
||||
|
||||
CSVRender::LightingNight::LightingNight() : mSceneManager (0), mLight (0) {}
|
||||
|
||||
void CSVRender::LightingNight::activate (Ogre::SceneManager *sceneManager,
|
||||
const Ogre::ColourValue *defaultAmbient)
|
||||
{
|
||||
mSceneManager = sceneManager;
|
||||
|
||||
if (defaultAmbient)
|
||||
mSceneManager->setAmbientLight (*defaultAmbient);
|
||||
else
|
||||
mSceneManager->setAmbientLight (Ogre::ColourValue (0.2, 0.2, 0.2, 1));
|
||||
|
||||
mLight = mSceneManager->createLight();
|
||||
mLight->setType (Ogre::Light::LT_DIRECTIONAL);
|
||||
mLight->setDirection (Ogre::Vector3 (0, 0, -1));
|
||||
mLight->setDiffuseColour (Ogre::ColourValue (0.2, 0.2, 0.2));
|
||||
}
|
||||
|
||||
void CSVRender::LightingNight::deactivate()
|
||||
{
|
||||
if (mLight)
|
||||
{
|
||||
mSceneManager->destroyLight (mLight);
|
||||
mLight = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void CSVRender::LightingNight::setDefaultAmbient (const Ogre::ColourValue& colour)
|
||||
{
|
||||
mSceneManager->setAmbientLight (colour);
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
#ifndef OPENCS_VIEW_LIGHTING_NIGHT_H
|
||||
#define OPENCS_VIEW_LIGHTING_NIGHT_H
|
||||
|
||||
#include "lighting.hpp"
|
||||
|
||||
namespace Ogre
|
||||
{
|
||||
class Light;
|
||||
}
|
||||
|
||||
namespace CSVRender
|
||||
{
|
||||
class LightingNight : public Lighting
|
||||
{
|
||||
Ogre::SceneManager *mSceneManager;
|
||||
Ogre::Light *mLight;
|
||||
|
||||
public:
|
||||
|
||||
LightingNight();
|
||||
|
||||
virtual void activate (Ogre::SceneManager *sceneManager,
|
||||
const Ogre::ColourValue *defaultAmbient = 0);
|
||||
|
||||
virtual void deactivate();
|
||||
|
||||
virtual void setDefaultAmbient (const Ogre::ColourValue& colour);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue