Separate lightshaft from sun
This commit is contained in:
parent
af4575f6db
commit
90396678b7
@ -2437,8 +2437,8 @@ scene::ISceneNode *IrrDriver::addLight(const core::vector3df &pos, float energy,
|
||||
|
||||
if (sun)
|
||||
{
|
||||
m_sun_interposer->setPosition(pos);
|
||||
m_sun_interposer->updateAbsolutePosition();
|
||||
//m_sun_interposer->setPosition(pos);
|
||||
//m_sun_interposer->updateAbsolutePosition();
|
||||
|
||||
m_lensflare->setPosition(pos);
|
||||
m_lensflare->updateAbsolutePosition();
|
||||
|
@ -610,6 +610,8 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode, boo
|
||||
|
||||
if (isRace && UserConfigParams::m_light_shaft && m_sunpixels > 30 && hasgodrays)
|
||||
{
|
||||
Track* track = World::getWorld()->getTrack();
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
// Grab the sky
|
||||
out_fbo->Bind();
|
||||
@ -617,12 +619,14 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode, boo
|
||||
irr_driver->renderSkybox(camnode);
|
||||
|
||||
// Set the sun's color
|
||||
const SColor col = World::getWorld()->getTrack()->getSunColor();
|
||||
const SColor col = track->getGodRaysColor();
|
||||
ColorizeProvider * const colcb = (ColorizeProvider *)irr_driver->getCallback(ES_COLORIZE);
|
||||
colcb->setColor(col.getRed() / 255.0f, col.getGreen() / 255.0f, col.getBlue() / 255.0f);
|
||||
|
||||
// The sun interposer
|
||||
STKMeshSceneNode *sun = irr_driver->getSunInterposer();
|
||||
sun->setPosition(track->getGodRaysPosition());
|
||||
sun->updateAbsolutePosition();
|
||||
irr_driver->getSceneManager()->drawAll(ESNRP_CAMERA);
|
||||
irr_driver->setPhase(GLOW_PASS);
|
||||
sun->render();
|
||||
@ -637,7 +641,7 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode, boo
|
||||
renderGaussian3Blur(irr_driver->getFBO(FBO_QUARTER1), irr_driver->getFBO(FBO_QUARTER2));
|
||||
|
||||
// Calculate the sun's position in texcoords
|
||||
const core::vector3df pos = sun->getPosition();
|
||||
const core::vector3df pos = track->getGodRaysPosition();
|
||||
float ndc[4];
|
||||
core::matrix4 trans = camnode->getProjectionMatrix();
|
||||
trans *= camnode->getViewMatrix();
|
||||
|
@ -132,6 +132,8 @@ Track::Track(const std::string &filename)
|
||||
m_sky_particles = NULL;
|
||||
m_sky_dx = 0.05f;
|
||||
m_sky_dy = 0.0f;
|
||||
m_godrays_energy = 1.0f;
|
||||
m_godrays_color = video::SColor(255, 255, 255, 255);
|
||||
m_weather_type = WEATHER_NONE;
|
||||
m_cache_track = UserConfigParams::m_cache_overworld &&
|
||||
m_ident=="overworld";
|
||||
@ -439,6 +441,9 @@ void Track::loadTrackInfo()
|
||||
m_fog_height_end = 100.0f;
|
||||
m_gravity = 9.80665f;
|
||||
m_smooth_normals = false;
|
||||
m_godrays = false;
|
||||
m_godrays_energy = 1.0f;
|
||||
m_godrays_color = video::SColor(255, 255, 255, 255);
|
||||
/* ARGB */
|
||||
m_fog_color = video::SColor(255, 77, 179, 230);
|
||||
m_default_ambient_color = video::SColor(255, 120, 120, 120);
|
||||
@ -481,7 +486,6 @@ void Track::loadTrackInfo()
|
||||
root->get("bloom-threshold", &m_bloom_threshold);
|
||||
root->get("lens-flare", &m_lensflare);
|
||||
root->get("shadows", &m_shadows);
|
||||
root->get("god-rays", &m_godrays);
|
||||
root->get("displacement-speed", &m_displacement_speed);
|
||||
root->get("caustics-speed", &m_caustics_speed);
|
||||
root->get("color-level-in", &m_color_inlevel);
|
||||
@ -1724,6 +1728,14 @@ void Track::loadTrackModel(bool reverse_track, unsigned int mode_id)
|
||||
node->get("fog-end-height", &m_fog_height_end);
|
||||
}
|
||||
|
||||
if (const XMLNode *node = root->getNode("lightshaft"))
|
||||
{
|
||||
m_godrays = true;
|
||||
node->get("energy", &m_godrays_energy);
|
||||
node->get("color", &m_godrays_color);
|
||||
node->get("xyz", &m_godrays_position);
|
||||
}
|
||||
|
||||
loadMainTrack(*root);
|
||||
unsigned int main_track_count = m_all_nodes.size();
|
||||
|
||||
|
@ -383,7 +383,12 @@ private:
|
||||
float m_bloom_threshold;
|
||||
|
||||
bool m_lensflare;
|
||||
|
||||
bool m_godrays;
|
||||
core::vector3df m_godrays_position;
|
||||
float m_godrays_energy;
|
||||
video::SColor m_godrays_color;
|
||||
|
||||
bool m_shadows;
|
||||
|
||||
float m_displacement_speed;
|
||||
@ -613,6 +618,9 @@ public:
|
||||
|
||||
bool hasLensFlare() const { return m_lensflare; }
|
||||
bool hasGodRays() const { return m_godrays; }
|
||||
core::vector3df getGodRaysPosition() const { return m_godrays_position; }
|
||||
float getGodRaysOpacity() const { return m_godrays_energy; }
|
||||
video::SColor getGodRaysColor() const { return m_godrays_color; }
|
||||
bool hasShadows() const { return m_shadows; }
|
||||
|
||||
void addNode(scene::ISceneNode* node) { m_all_nodes.push_back(node); }
|
||||
|
Loading…
Reference in New Issue
Block a user