paysages : Apply HDR to 3d explorer.

git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@499 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
Michaël Lemaire 2013-01-18 10:31:13 +00:00 committed by ThunderK
parent b59b25d599
commit dd0fceb5c9
4 changed files with 15 additions and 6 deletions

View file

@ -3,6 +3,7 @@
BaseExplorerChunk::BaseExplorerChunk(Renderer* renderer)
{
_renderer = renderer;
_color_profile = colorProfileCreate();
priority = 0.0;
_reset_needed = false;
@ -17,6 +18,7 @@ BaseExplorerChunk::BaseExplorerChunk(Renderer* renderer)
BaseExplorerChunk::~BaseExplorerChunk()
{
_lock_data.lock();
colorProfileDelete(_color_profile);
delete _texture;
_lock_data.unlock();
}
@ -48,6 +50,7 @@ bool BaseExplorerChunk::maintain()
if (_texture_current_size <= 1 || i % 2 != 0 || j % 2 != 0)
{
Color color = getTextureColor((double)i / (double)new_texture_size, 1.0 - (double)j / (double)new_texture_size);
color = colorProfileApply(_color_profile, color);
colorNormalize(&color);
new_image->setPixel(i, j, colorTo32BitBGRA(&color));
}

View file

@ -14,27 +14,28 @@ public:
bool maintain();
void updatePriority(CameraDefinition* camera);
void render(QGLWidget* widget);
double priority;
protected:
BaseExplorerChunk(Renderer* renderer);
inline Renderer* renderer() {return _renderer;};
void askReset();
void setMaxTextureSize(int size);
virtual void onCameraEvent(CameraDefinition* camera);
virtual void onResetEvent();
virtual bool onMaintainEvent();
virtual void onRenderEvent(QGLWidget* widget);
virtual double getDisplayedSizeHint(CameraDefinition* camera);
virtual Color getTextureColor(double x, double y);
QMutex _lock_data;
private:
Renderer* _renderer;
ColorProfile* _color_profile;
bool _reset_needed;

View file

@ -130,5 +130,10 @@ Color ExplorerChunkSky::getTextureColor(double x, double y)
location.z = y;
break;
}
return renderer()->atmosphere->getSkyColor(renderer(), v3Normalize(location));
location = v3Normalize(location);
if (location.y < 0.0)
{
location.y = 0.0;
}
return renderer()->atmosphere->getSkyColor(renderer(), location);
}

View file

@ -100,7 +100,7 @@ WidgetExplorer::WidgetExplorer(QWidget *parent, CameraDefinition* camera):
}
// Add skybox
for (int orientation = 0; orientation < 6; orientation++)
for (int orientation = 0; orientation < 5; orientation++)
{
ExplorerChunkSky* chunk = new ExplorerChunkSky(&_renderer, 500.0, (SkyboxOrientation)orientation);
_chunks.append(chunk);