Fixed render precision sometimes being 0
This commit is contained in:
parent
10bbf8078b
commit
ce33390321
1 changed files with 3 additions and 1 deletions
|
@ -24,6 +24,7 @@
|
||||||
#include "VegetationRenderer.h"
|
#include "VegetationRenderer.h"
|
||||||
#include "WaterRasterizer.h"
|
#include "WaterRasterizer.h"
|
||||||
#include "WaterRenderer.h"
|
#include "WaterRenderer.h"
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
SoftwareRenderer::SoftwareRenderer(Scenery *scenery) : scenery(scenery) {
|
SoftwareRenderer::SoftwareRenderer(Scenery *scenery) : scenery(scenery) {
|
||||||
render_camera = new CameraDefinition;
|
render_camera = new CameraDefinition;
|
||||||
|
@ -163,7 +164,8 @@ double SoftwareRenderer::getPrecision(const Vector3 &location) {
|
||||||
projected.x += 1.0;
|
projected.x += 1.0;
|
||||||
// projected.y += 1.0;
|
// projected.y += 1.0;
|
||||||
|
|
||||||
return render_camera->unproject(projected).sub(location).getNorm() * 0.1 / to_double(render_quality);
|
double result = render_camera->unproject(projected).sub(location).getNorm() * 0.1 / to_double(render_quality);
|
||||||
|
return max(result, 0.000001);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector3 SoftwareRenderer::projectPoint(const Vector3 &point) {
|
Vector3 SoftwareRenderer::projectPoint(const Vector3 &point) {
|
||||||
|
|
Loading…
Reference in a new issue