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:
parent
b59b25d599
commit
dd0fceb5c9
4 changed files with 15 additions and 6 deletions
|
@ -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));
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,27 +14,28 @@ public:
|
||||||
bool maintain();
|
bool maintain();
|
||||||
void updatePriority(CameraDefinition* camera);
|
void updatePriority(CameraDefinition* camera);
|
||||||
void render(QGLWidget* widget);
|
void render(QGLWidget* widget);
|
||||||
|
|
||||||
double priority;
|
double priority;
|
||||||
protected:
|
protected:
|
||||||
BaseExplorerChunk(Renderer* renderer);
|
BaseExplorerChunk(Renderer* renderer);
|
||||||
|
|
||||||
inline Renderer* renderer() {return _renderer;};
|
inline Renderer* renderer() {return _renderer;};
|
||||||
|
|
||||||
void askReset();
|
void askReset();
|
||||||
void setMaxTextureSize(int size);
|
void setMaxTextureSize(int size);
|
||||||
|
|
||||||
virtual void onCameraEvent(CameraDefinition* camera);
|
virtual void onCameraEvent(CameraDefinition* camera);
|
||||||
virtual void onResetEvent();
|
virtual void onResetEvent();
|
||||||
virtual bool onMaintainEvent();
|
virtual bool onMaintainEvent();
|
||||||
virtual void onRenderEvent(QGLWidget* widget);
|
virtual void onRenderEvent(QGLWidget* widget);
|
||||||
virtual double getDisplayedSizeHint(CameraDefinition* camera);
|
virtual double getDisplayedSizeHint(CameraDefinition* camera);
|
||||||
virtual Color getTextureColor(double x, double y);
|
virtual Color getTextureColor(double x, double y);
|
||||||
|
|
||||||
QMutex _lock_data;
|
QMutex _lock_data;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Renderer* _renderer;
|
Renderer* _renderer;
|
||||||
|
ColorProfile* _color_profile;
|
||||||
|
|
||||||
bool _reset_needed;
|
bool _reset_needed;
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue