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

View file

@ -35,6 +35,7 @@ protected:
private: private:
Renderer* _renderer; Renderer* _renderer;
ColorProfile* _color_profile;
bool _reset_needed; bool _reset_needed;

View file

@ -130,5 +130,10 @@ Color ExplorerChunkSky::getTextureColor(double x, double y)
location.z = y; location.z = y;
break; 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 // 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); ExplorerChunkSky* chunk = new ExplorerChunkSky(&_renderer, 500.0, (SkyboxOrientation)orientation);
_chunks.append(chunk); _chunks.append(chunk);