From 0a0fe193a59bbb68891a7b9e4064e3ef325ecda0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Lemaire?= Date: Sat, 9 Jun 2012 20:26:34 +0000 Subject: [PATCH] paysages : Small explorer improvements. git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@344 b1fd45b6-86a6-48da-8261-f70d1f35bdcc --- ChangeLog | 40 +++++++++++++++++++++++++-------- TODO | 1 + gui_qt/explorerchunkterrain.cpp | 20 ++++++++--------- lib_paysages/camera.c | 19 ++++++++++------ 4 files changed, 54 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index c4d537b..9bb81b6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,14 +1,36 @@ ????-??-?? Technology Preview 2 ------------------------------- -* Previews scaling is now logarithmic (slower when zoomed). -* Previews drawing now takes advantage of multiple CPU cores. -* New texture model (perpendicular displacement and thickness). -* Added clouds hardness to light. -* Version management in saved files. -* Added ground texture and skybox in 3D explorer. -* 3D explorer now takes advantage of multiple CPU cores. -* Added sun halo control. + +Previews : + * Scaling is now logarithmic (slower when zoomed). + * Drawing now takes advantage of multiple CPU cores. + +3D Explorer: + * Added ground texture and skybox. + * Progressive rendering now takes advantage of multiple CPU cores. + +Scenery : + * Added clouds hardness to light. + * Added sun halo control. + +Rendering : + * New texture model (perpendicular displacement and thickness). + +GUI : + * Improved curve rendering. + * New material editor. + +Misc : + * Version handling in saved files. 2012-04-20 Technology Preview 1 ------------------------------- -* First preview version. + +First preview version : + * Ground with simple texture layers + * Water with waves, transparency and reflection + * Sky with sun + * Atmosphere with fog + * Cloud 3d layers + * Two-pass rendering + * Form-based GUI, with real-time previews diff --git a/TODO b/TODO index c37dfb3..71ae6e5 100644 --- a/TODO +++ b/TODO @@ -13,6 +13,7 @@ Technology Preview 2 : - Add a terrain modifier dialog with zones. - Use the curve editor in noise editor - Add a noise filler (and maybe noise intervals ?). +- Add a popup when rendering is complete (with stats), except for quick render. - Fix the distorted sun appearance. - Improve curve editor. => Add curve modes diff --git a/gui_qt/explorerchunkterrain.cpp b/gui_qt/explorerchunkterrain.cpp index 25af52c..6b4425c 100644 --- a/gui_qt/explorerchunkterrain.cpp +++ b/gui_qt/explorerchunkterrain.cpp @@ -101,7 +101,7 @@ void ExplorerChunkTerrain::onRenderEvent(QGLWidget* widget) double tsize = 1.0 / (double)_tessellation_max_size; _lock_data.unlock(); - if (tessellation_size == 0) + if (tessellation_size <= 1) { return; } @@ -123,21 +123,21 @@ void ExplorerChunkTerrain::onRenderEvent(QGLWidget* widget) double ExplorerChunkTerrain::getDisplayedSizeHint(CameraDefinition* camera) { - double distance, wanted_size; + double distance; Vector3 center; center = getCenter(); - distance = v3Norm(v3Sub(camera->location, center)); - distance = distance < 0.1 ? 0.1 : distance; - wanted_size = (int)ceil(120.0 - distance / 3.0); - - if (!cameraIsBoxInView(camera, center, _size, _size, 40.0)) + if (cameraIsBoxInView(camera, center, _size, 40.0, _size)) { - wanted_size -= 500.0; + distance = v3Norm(v3Sub(camera->location, center)); + distance = distance < 0.1 ? 0.1 : distance; + return (int)ceil(120.0 - distance / 1.5); + } + else + { + return -800.0; } - - return wanted_size; } Color ExplorerChunkTerrain::getTextureColor(double x, double y) diff --git a/lib_paysages/camera.c b/lib_paysages/camera.c index 939dbce..92906f0 100644 --- a/lib_paysages/camera.c +++ b/lib_paysages/camera.c @@ -233,6 +233,11 @@ void cameraSetRenderSize(CameraDefinition* camera, int width, int height) Vector3 cameraProject(CameraDefinition* camera, Renderer* renderer, Vector3 point) { point = m4Transform(camera->project, point); + if (point.z < 1.0) + { + point.x = -point.x; + point.y = -point.y; + } point.x = (point.x + 1.0) * 0.5 * camera->width; point.y = (-point.y + 1.0) * 0.5 * camera->height; return point; @@ -323,10 +328,6 @@ int cameraIsBoxInView(CameraDefinition* camera, Vector3 center, double xsize, do projected = cameraProject(camera, NULL, center); _updateBox(&projected, &xmin, &xmax, &ymin, &ymax, &zmax); - center.y += ysize; - projected = cameraProject(camera, NULL, center); - _updateBox(&projected, &xmin, &xmax, &ymin, &ymax, &zmax); - center.z += zsize; projected = cameraProject(camera, NULL, center); _updateBox(&projected, &xmin, &xmax, &ymin, &ymax, &zmax); @@ -334,11 +335,11 @@ int cameraIsBoxInView(CameraDefinition* camera, Vector3 center, double xsize, do center.x -= xsize; projected = cameraProject(camera, NULL, center); _updateBox(&projected, &xmin, &xmax, &ymin, &ymax, &zmax); - - center.y -= ysize; + + center.y += ysize; projected = cameraProject(camera, NULL, center); _updateBox(&projected, &xmin, &xmax, &ymin, &ymax, &zmax); - + center.x += xsize; projected = cameraProject(camera, NULL, center); _updateBox(&projected, &xmin, &xmax, &ymin, &ymax, &zmax); @@ -346,6 +347,10 @@ int cameraIsBoxInView(CameraDefinition* camera, Vector3 center, double xsize, do center.z -= zsize; projected = cameraProject(camera, NULL, center); _updateBox(&projected, &xmin, &xmax, &ymin, &ymax, &zmax); + + center.x -= xsize; + projected = cameraProject(camera, NULL, center); + _updateBox(&projected, &xmin, &xmax, &ymin, &ymax, &zmax); return xmin <= camera->width && xmax >= 0.0 && ymin <= camera->height && ymax >= 0.0 && zmax >= camera->znear; }