mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 06:53:53 +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,45 +373,43 @@ void Objects::disableLights()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace pulse
|
namespace MWRender
|
||||||
{
|
{
|
||||||
static float frequency (float x)
|
namespace Pulse
|
||||||
{
|
{
|
||||||
return x;
|
static float amplitude (float phase)
|
||||||
|
{
|
||||||
|
return sin (phase);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static float amplitude (float phase)
|
namespace Flicker
|
||||||
{
|
{
|
||||||
return sin (phase);
|
static const float fa = 0.785398f;
|
||||||
}
|
static const float fb = 1.17024f;
|
||||||
}
|
|
||||||
|
|
||||||
namespace flicker
|
static const float tdo = 0.94f;
|
||||||
{
|
static const float tdm = 2.48f;
|
||||||
static const float fa = 0.785398f;
|
|
||||||
static const float fb = 1.17024f;
|
|
||||||
|
|
||||||
static const float tdo = 0.94f;
|
static const float f [3] = { 1.5708f, 4.18774f, 5.19934f };
|
||||||
static const float tdm = 2.48f;
|
static const float o [3] = { 0.804248f, 2.11115f, 3.46832f };
|
||||||
|
static const float m [3] = { 1.0f, 0.785f, 0.876f };
|
||||||
|
static const float s = 0.394f;
|
||||||
|
|
||||||
static const float f [3] = { 1.5708f, 4.18774f, 5.19934f };
|
static const float phase_wavelength = 120.0f * 3.14159265359f / fa;
|
||||||
static const float o [3] = { 0.804248f, 2.11115f, 3.46832f };
|
|
||||||
static const float m [3] = { 1.0f, 0.785f, 0.876f };
|
|
||||||
static const float s = 0.394f;
|
|
||||||
|
|
||||||
static const float phase_wavelength = 120.0f * 3.14159265359f / fa;
|
static float frequency (float x)
|
||||||
|
{
|
||||||
|
return tdo + tdm * sin (fa * x);
|
||||||
|
}
|
||||||
|
|
||||||
static float frequency (float x)
|
static float amplitude (float x)
|
||||||
{
|
{
|
||||||
return tdo + tdm * sin (fa * x);
|
float v = 0.0f;
|
||||||
}
|
for (int i = 0; i < 3; ++i)
|
||||||
|
v += sin (fb*x*f[i] + o[1])*m[i];
|
||||||
static float amplitude (float x)
|
return v * s;
|
||||||
{
|
}
|
||||||
float v = 0.0f;
|
|
||||||
for (int i = 0; i < 3; ++i)
|
|
||||||
v += sin (fb*x*f[i] + o[1])*m[i];
|
|
||||||
return v * s;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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