Godray: improve the effect and its stability.
This commit is contained in:
parent
04fc4c3be7
commit
2d1acf5353
@ -14,7 +14,7 @@ void main()
|
||||
mul = step(mul, 0.02);
|
||||
mul *= 0.97;
|
||||
|
||||
// res = res * vec4(mul);
|
||||
res = res * vec4(mul);
|
||||
|
||||
FragColor = res;
|
||||
}
|
||||
|
@ -459,6 +459,7 @@ void IrrDriver::initDevice()
|
||||
|
||||
irr::video::COpenGLDriver* gl_driver = (irr::video::COpenGLDriver*)m_device->getVideoDriver();
|
||||
gl_driver->extGlGenQueries(1, &m_lensflare_query);
|
||||
m_query_issued = false;
|
||||
|
||||
scene::IMesh * const sphere = m_scene_manager->getGeometryCreator()->createSphereMesh(1, 16, 16);
|
||||
m_sun_interposer = new STKMeshSceneNode(sphere, m_scene_manager->getRootSceneNode(), NULL, -1);
|
||||
|
@ -49,7 +49,6 @@ class ShadowImportanceProvider;
|
||||
|
||||
#include "graphics/rtts.hpp"
|
||||
#include "graphics/shaders.hpp"
|
||||
#include "graphics/stkmeshscenenode.hpp"
|
||||
#include "graphics/wind.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "utils/aligned_array.hpp"
|
||||
@ -172,6 +171,7 @@ private:
|
||||
unsigned object_count[PASS_COUNT];
|
||||
u32 m_renderpass;
|
||||
u32 m_lensflare_query;
|
||||
bool m_query_issued;
|
||||
class STKMeshSceneNode *m_sun_interposer;
|
||||
scene::CLensFlareSceneNode *m_lensflare;
|
||||
scene::ICameraSceneNode *m_suncam;
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "graphics/mlaa_areamap.hpp"
|
||||
#include "graphics/shaders.hpp"
|
||||
#include "graphics/stkmeshscenenode.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "karts/kart_model.hpp"
|
||||
@ -739,18 +740,18 @@ void PostProcessing::render()
|
||||
|
||||
// Set the sun's color
|
||||
const SColor col = World::getWorld()->getTrack()->getSunColor();
|
||||
// ColorizeProvider * const colcb = (ColorizeProvider *) irr_driver->getCallback(ES_COLORIZE);
|
||||
// colcb->setColor(col.getRed() / 255.0f, col.getGreen() / 255.0f, col.getBlue() / 255.0f);
|
||||
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->getMaterial(0).ColorMask = ECP_ALL;
|
||||
irr_driver->getSceneManager()->setCurrentRendertime(ESNRP_SOLID);*/
|
||||
irr_driver->getSceneManager()->drawAll(ESNRP_CAMERA);
|
||||
irr_driver->getSceneManager()->setCurrentRendertime(ESNRP_SOLID);
|
||||
|
||||
irr_driver->setPhase(GLOW_PASS);
|
||||
sun->render();
|
||||
|
||||
sun->getMaterial(0).ColorMask = ECP_NONE;*/
|
||||
//sun->getMaterial(0).ColorMask = ECP_NONE;
|
||||
|
||||
// Fade to quarter
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "graphics/screenquad.hpp"
|
||||
#include "graphics/shaders.hpp"
|
||||
#include "graphics/shadow_importance.hpp"
|
||||
#include "graphics/stkmeshscenenode.hpp"
|
||||
#include "graphics/wind.hpp"
|
||||
#include "io/file_manager.hpp"
|
||||
#include "items/item.hpp"
|
||||
@ -273,9 +274,9 @@ void IrrDriver::renderGLSL(float dt)
|
||||
{
|
||||
irr::video::COpenGLDriver* gl_driver = (irr::video::COpenGLDriver*)m_device->getVideoDriver();
|
||||
|
||||
GLuint res;
|
||||
gl_driver->extGlGetQueryObjectuiv(m_lensflare_query, GL_QUERY_RESULT, &res);
|
||||
printf("pixel is %d\n", res);
|
||||
GLuint res = 0;
|
||||
if (m_query_issued)
|
||||
gl_driver->extGlGetQueryObjectuiv(m_lensflare_query, GL_QUERY_RESULT, &res);
|
||||
m_post_processing->setSunPixels(res);
|
||||
|
||||
// Prepare the query for the next frame.
|
||||
@ -286,6 +287,7 @@ void IrrDriver::renderGLSL(float dt)
|
||||
irr_driver->setPhase(GLOW_PASS);
|
||||
m_sun_interposer->render();
|
||||
gl_driver->extGlEndQuery(GL_SAMPLES_PASSED_ARB);
|
||||
m_query_issued = true;
|
||||
|
||||
m_lensflare->setStrength(res / 4000.0f);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user