mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 10:23:56 +00:00
post merge fixes and some misc clean up
This commit is contained in:
parent
41767f8dfa
commit
2557ef4d7d
1 changed files with 36 additions and 41 deletions
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
using namespace MWRender;
|
using namespace MWRender;
|
||||||
|
|
||||||
// These are the Morrowind.ini defaults
|
/// \todo Replace these, once fallback values from the ini file are available.
|
||||||
float Objects::lightLinearValue = 3;
|
float Objects::lightLinearValue = 3;
|
||||||
float Objects::lightLinearRadiusMult = 1;
|
float Objects::lightLinearRadiusMult = 1;
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@ int Objects::uniqueID = 0;
|
||||||
|
|
||||||
void Objects::clearSceneNode (Ogre::SceneNode *node)
|
void Objects::clearSceneNode (Ogre::SceneNode *node)
|
||||||
{
|
{
|
||||||
/// \todo This should probably be moved into OpenEngine at some point.
|
|
||||||
for (int i=node->numAttachedObjects()-1; i>=0; --i)
|
for (int i=node->numAttachedObjects()-1; i>=0; --i)
|
||||||
{
|
{
|
||||||
Ogre::MovableObject *object = node->getAttachedObject (i);
|
Ogre::MovableObject *object = node->getAttachedObject (i);
|
||||||
|
@ -374,20 +373,17 @@ void Objects::disableLights()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace pulse
|
namespace MWRender
|
||||||
{
|
{
|
||||||
static float frequency (float x)
|
namespace Pulse
|
||||||
{
|
{
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
static float amplitude (float phase)
|
static float amplitude (float phase)
|
||||||
{
|
{
|
||||||
return sin (phase);
|
return sin (phase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace flicker
|
namespace Flicker
|
||||||
{
|
{
|
||||||
static const float fa = 0.785398f;
|
static const float fa = 0.785398f;
|
||||||
static const float fb = 1.17024f;
|
static const float fb = 1.17024f;
|
||||||
|
@ -415,6 +411,7 @@ namespace flicker
|
||||||
return v * s;
|
return v * s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Objects::update(const float dt)
|
void Objects::update(const float dt)
|
||||||
{
|
{
|
||||||
|
@ -425,7 +422,6 @@ void Objects::update(const float dt)
|
||||||
{
|
{
|
||||||
Ogre::Light* light = mMwRoot->getCreator()->getLight(it->name);
|
Ogre::Light* light = mMwRoot->getCreator()->getLight(it->name);
|
||||||
|
|
||||||
|
|
||||||
float brightness;
|
float brightness;
|
||||||
float cycle_time;
|
float cycle_time;
|
||||||
float time_distortion;
|
float time_distortion;
|
||||||
|
@ -438,8 +434,8 @@ void Objects::update(const float dt)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cycle_time = 500.0f;
|
cycle_time = 500.0f;
|
||||||
it->phase = fmod (it->phase + dt, flicker::phase_wavelength);
|
it->phase = fmod (it->phase + dt, Flicker::phase_wavelength);
|
||||||
time_distortion = flicker::frequency (it->phase);
|
time_distortion = Flicker::frequency (it->phase);
|
||||||
}
|
}
|
||||||
|
|
||||||
it->time += it->dir*dt*time_distortion;
|
it->time += it->dir*dt*time_distortion;
|
||||||
|
@ -461,23 +457,23 @@ void Objects::update(const float dt)
|
||||||
if (it->type == LT_Normal)
|
if (it->type == LT_Normal)
|
||||||
{
|
{
|
||||||
// Less than 1/255 light modifier for a constant light:
|
// Less than 1/255 light modifier for a constant light:
|
||||||
brightness = (const float)(1.0 + flicker::amplitude(it->time*slow) / 255.0 );
|
brightness = (const float)(1.0 + Flicker::amplitude(it->time*slow) / 255.0 );
|
||||||
}
|
}
|
||||||
else if (it->type == LT_Flicker)
|
else if (it->type == LT_Flicker)
|
||||||
{
|
{
|
||||||
brightness = (const float)(0.75 + flicker::amplitude(it->time*fast) * 0.25);
|
brightness = (const float)(0.75 + Flicker::amplitude(it->time*fast) * 0.25);
|
||||||
}
|
}
|
||||||
else if (it->type == LT_FlickerSlow)
|
else if (it->type == LT_FlickerSlow)
|
||||||
{
|
{
|
||||||
brightness = (const float)(0.75 + flicker::amplitude(it->time*slow) * 0.25);
|
brightness = (const float)(0.75 + Flicker::amplitude(it->time*slow) * 0.25);
|
||||||
}
|
}
|
||||||
else if (it->type == LT_Pulse)
|
else if (it->type == LT_Pulse)
|
||||||
{
|
{
|
||||||
brightness = (const float)(1.0 + pulse::amplitude (it->time*fast) * 0.25);
|
brightness = (const float)(1.0 + Pulse::amplitude (it->time*fast) * 0.25);
|
||||||
}
|
}
|
||||||
else if (it->type == LT_PulseSlow)
|
else if (it->type == LT_PulseSlow)
|
||||||
{
|
{
|
||||||
brightness = (const float)(1.0 + pulse::amplitude (it->time*slow) * 0.25);
|
brightness = (const float)(1.0 + Pulse::amplitude (it->time*slow) * 0.25);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
assert(0 && "Invalid light type");
|
assert(0 && "Invalid light type");
|
||||||
|
@ -506,8 +502,7 @@ void Objects::rebuildStaticGeometry()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void Objects::updateObjectCell(const MWWorld::Ptr &ptr)
|
||||||
Objects::updateObjectCell(const MWWorld::Ptr &ptr)
|
|
||||||
{
|
{
|
||||||
Ogre::SceneNode *node;
|
Ogre::SceneNode *node;
|
||||||
MWWorld::CellStore *newCell = ptr.getCell();
|
MWWorld::CellStore *newCell = ptr.getCell();
|
||||||
|
|
Loading…
Reference in a new issue