Fixed atmosphere previews

This commit is contained in:
Michaël Lemaire 2013-12-15 13:59:21 +01:00
parent be5c67e4aa
commit 00e04df25a
4 changed files with 19 additions and 5 deletions

View file

@ -151,6 +151,9 @@ AtmosphereColorPreviewRenderer::AtmosphereColorPreviewRenderer(AtmosphereDefinit
definition(definition), heading(heading)
{
getScenery()->getCamera()->setLocation(Vector3(0.0, 7.0, 0.0));
render_camera->setLocation(Vector3(0.0, 7.0, 0.0));
disableClouds();
}
void AtmosphereColorPreviewRenderer::bindEvent(BasePreview* preview)
@ -166,8 +169,8 @@ void AtmosphereColorPreviewRenderer::updateEvent()
Color AtmosphereColorPreviewRenderer::getColor2D(double x, double y, double)
{
Vector3 eye = {0.0, 7.0, 0.0};
Vector3 direction = {x, -y, -1.0};
Vector3 eye(0.0, 7.0, 0.0);
Vector3 direction = Vector3(x, -y, -1.0).normalize();
Vector3 hit, normal;
Matrix4 rotation;

View file

@ -567,8 +567,8 @@ void RenderArea::pushTriangle(const Vector3 &pixel1, const Vector3 &pixel2, cons
point3.callback = point1.callback;
/* Prepare scanlines */
// TODO Don't create scanlines for each triangles (one by thread is more appropriate)
RenderScanlines scanlines;
int x;
int width = params.width * params.antialias;
scanlines.left = width;
scanlines.right = -1;
@ -586,8 +586,8 @@ void RenderArea::pushTriangle(const Vector3 &pixel1, const Vector3 &pixel2, cons
lock->release();
/* Free scalines */
free(scanlines.up);
free(scanlines.down);
delete[] scanlines.up;
delete[] scanlines.down;
}
Color RenderArea::getPixel(int x, int y)

View file

@ -7,6 +7,7 @@
#include "AtmosphereDefinition.h"
#include "AtmosphereResult.h"
#include "CloudsRenderer.h"
#include "CloudsDefinition.h"
#include "TerrainRenderer.h"
#include "TexturesRenderer.h"
#include "WaterRenderer.h"
@ -119,6 +120,11 @@ void SoftwareRenderer::rasterize()
sky.rasterize();
}
void SoftwareRenderer::disableClouds()
{
scenery->getClouds()->clear();
}
void SoftwareRenderer::setPreviewCallbacks(RenderArea::RenderCallbackStart start, RenderArea::RenderCallbackDraw draw, RenderArea::RenderCallbackUpdate update)
{
render_area->setPreviewCallbacks(start, draw, update);

View file

@ -64,6 +64,11 @@ public:
*/
virtual void rasterize();
/*!
* \brief Disable the clouds feature.
*/
void disableClouds();
void setPreviewCallbacks(RenderArea::RenderCallbackStart start, RenderArea::RenderCallbackDraw draw, RenderArea::RenderCallbackUpdate update);
void start(RenderArea::RenderParams params);
void interrupt();