Fixed atmosphere previews
This commit is contained in:
parent
be5c67e4aa
commit
00e04df25a
4 changed files with 19 additions and 5 deletions
|
@ -151,6 +151,9 @@ AtmosphereColorPreviewRenderer::AtmosphereColorPreviewRenderer(AtmosphereDefinit
|
||||||
definition(definition), heading(heading)
|
definition(definition), heading(heading)
|
||||||
{
|
{
|
||||||
getScenery()->getCamera()->setLocation(Vector3(0.0, 7.0, 0.0));
|
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)
|
void AtmosphereColorPreviewRenderer::bindEvent(BasePreview* preview)
|
||||||
|
@ -166,8 +169,8 @@ void AtmosphereColorPreviewRenderer::updateEvent()
|
||||||
|
|
||||||
Color AtmosphereColorPreviewRenderer::getColor2D(double x, double y, double)
|
Color AtmosphereColorPreviewRenderer::getColor2D(double x, double y, double)
|
||||||
{
|
{
|
||||||
Vector3 eye = {0.0, 7.0, 0.0};
|
Vector3 eye(0.0, 7.0, 0.0);
|
||||||
Vector3 direction = {x, -y, -1.0};
|
Vector3 direction = Vector3(x, -y, -1.0).normalize();
|
||||||
Vector3 hit, normal;
|
Vector3 hit, normal;
|
||||||
Matrix4 rotation;
|
Matrix4 rotation;
|
||||||
|
|
||||||
|
|
|
@ -567,8 +567,8 @@ void RenderArea::pushTriangle(const Vector3 &pixel1, const Vector3 &pixel2, cons
|
||||||
point3.callback = point1.callback;
|
point3.callback = point1.callback;
|
||||||
|
|
||||||
/* Prepare scanlines */
|
/* Prepare scanlines */
|
||||||
|
// TODO Don't create scanlines for each triangles (one by thread is more appropriate)
|
||||||
RenderScanlines scanlines;
|
RenderScanlines scanlines;
|
||||||
int x;
|
|
||||||
int width = params.width * params.antialias;
|
int width = params.width * params.antialias;
|
||||||
scanlines.left = width;
|
scanlines.left = width;
|
||||||
scanlines.right = -1;
|
scanlines.right = -1;
|
||||||
|
@ -586,8 +586,8 @@ void RenderArea::pushTriangle(const Vector3 &pixel1, const Vector3 &pixel2, cons
|
||||||
lock->release();
|
lock->release();
|
||||||
|
|
||||||
/* Free scalines */
|
/* Free scalines */
|
||||||
free(scanlines.up);
|
delete[] scanlines.up;
|
||||||
free(scanlines.down);
|
delete[] scanlines.down;
|
||||||
}
|
}
|
||||||
|
|
||||||
Color RenderArea::getPixel(int x, int y)
|
Color RenderArea::getPixel(int x, int y)
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "AtmosphereDefinition.h"
|
#include "AtmosphereDefinition.h"
|
||||||
#include "AtmosphereResult.h"
|
#include "AtmosphereResult.h"
|
||||||
#include "CloudsRenderer.h"
|
#include "CloudsRenderer.h"
|
||||||
|
#include "CloudsDefinition.h"
|
||||||
#include "TerrainRenderer.h"
|
#include "TerrainRenderer.h"
|
||||||
#include "TexturesRenderer.h"
|
#include "TexturesRenderer.h"
|
||||||
#include "WaterRenderer.h"
|
#include "WaterRenderer.h"
|
||||||
|
@ -119,6 +120,11 @@ void SoftwareRenderer::rasterize()
|
||||||
sky.rasterize();
|
sky.rasterize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SoftwareRenderer::disableClouds()
|
||||||
|
{
|
||||||
|
scenery->getClouds()->clear();
|
||||||
|
}
|
||||||
|
|
||||||
void SoftwareRenderer::setPreviewCallbacks(RenderArea::RenderCallbackStart start, RenderArea::RenderCallbackDraw draw, RenderArea::RenderCallbackUpdate update)
|
void SoftwareRenderer::setPreviewCallbacks(RenderArea::RenderCallbackStart start, RenderArea::RenderCallbackDraw draw, RenderArea::RenderCallbackUpdate update)
|
||||||
{
|
{
|
||||||
render_area->setPreviewCallbacks(start, draw, update);
|
render_area->setPreviewCallbacks(start, draw, update);
|
||||||
|
|
|
@ -64,6 +64,11 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void rasterize();
|
virtual void rasterize();
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Disable the clouds feature.
|
||||||
|
*/
|
||||||
|
void disableClouds();
|
||||||
|
|
||||||
void setPreviewCallbacks(RenderArea::RenderCallbackStart start, RenderArea::RenderCallbackDraw draw, RenderArea::RenderCallbackUpdate update);
|
void setPreviewCallbacks(RenderArea::RenderCallbackStart start, RenderArea::RenderCallbackDraw draw, RenderArea::RenderCallbackUpdate update);
|
||||||
void start(RenderArea::RenderParams params);
|
void start(RenderArea::RenderParams params);
|
||||||
void interrupt();
|
void interrupt();
|
||||||
|
|
Loading…
Reference in a new issue