Moved small things from WidgetExplorer to OpenGLRenderer
This commit is contained in:
parent
742b93d3d9
commit
de79f912c3
3 changed files with 24 additions and 10 deletions
|
@ -6,6 +6,11 @@
|
||||||
#include "OpenGLSkybox.h"
|
#include "OpenGLSkybox.h"
|
||||||
#include "OpenGLWater.h"
|
#include "OpenGLWater.h"
|
||||||
#include "OpenGLTerrain.h"
|
#include "OpenGLTerrain.h"
|
||||||
|
#include "Scenery.h"
|
||||||
|
#include "LightingManager.h"
|
||||||
|
#include "Logs.h"
|
||||||
|
|
||||||
|
#include "GL/glu.h" // TEMP
|
||||||
|
|
||||||
OpenGLRenderer::OpenGLRenderer(Scenery* scenery):
|
OpenGLRenderer::OpenGLRenderer(Scenery* scenery):
|
||||||
SoftwareRenderer(scenery)
|
SoftwareRenderer(scenery)
|
||||||
|
@ -62,6 +67,7 @@ void OpenGLRenderer::initialize()
|
||||||
prepare();
|
prepare();
|
||||||
|
|
||||||
disableClouds();
|
disableClouds();
|
||||||
|
getLightingManager()->setSpecularity(false);
|
||||||
|
|
||||||
skybox->initialize();
|
skybox->initialize();
|
||||||
skybox->updateScenery();
|
skybox->updateScenery();
|
||||||
|
@ -71,6 +77,12 @@ void OpenGLRenderer::initialize()
|
||||||
|
|
||||||
terrain->initialize();
|
terrain->initialize();
|
||||||
terrain->updateScenery();
|
terrain->updateScenery();
|
||||||
|
|
||||||
|
cameraChangeEvent(getScenery()->getCamera());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
logError("Failed to initialize OpenGL bindings");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,6 +92,10 @@ void OpenGLRenderer::resize(int width, int height)
|
||||||
{
|
{
|
||||||
functions->glViewport(0, 0, width, height);
|
functions->glViewport(0, 0, width, height);
|
||||||
}
|
}
|
||||||
|
getScenery()->getCamera()->setRenderSize(width, height);
|
||||||
|
render_camera->setRenderSize(width, height);
|
||||||
|
|
||||||
|
cameraChangeEvent(getScenery()->getCamera());
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGLRenderer::paint()
|
void OpenGLRenderer::paint()
|
||||||
|
@ -95,6 +111,12 @@ void OpenGLRenderer::paint()
|
||||||
skybox->render();
|
skybox->render();
|
||||||
terrain->render();
|
terrain->render();
|
||||||
water->render();
|
water->render();
|
||||||
|
|
||||||
|
int error_code;
|
||||||
|
while ((error_code = glGetError()) != GL_NO_ERROR)
|
||||||
|
{
|
||||||
|
logWarning("[OpenGL] ERROR : %s", (const char*)gluErrorString(error_code));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,10 +28,6 @@ QGLWidget(parent)
|
||||||
camera->copy(_current_camera);
|
camera->copy(_current_camera);
|
||||||
|
|
||||||
_renderer = new OpenGLRenderer(scenery);
|
_renderer = new OpenGLRenderer(scenery);
|
||||||
_renderer->prepare();
|
|
||||||
_renderer->render_quality = 3;
|
|
||||||
_renderer->getLightingManager()->setSpecularity(false);
|
|
||||||
_renderer->disableClouds();
|
|
||||||
|
|
||||||
_average_frame_time = 0.05;
|
_average_frame_time = 0.05;
|
||||||
_quality = 3;
|
_quality = 3;
|
||||||
|
@ -205,7 +201,6 @@ void WidgetExplorer::resizeGL(int w, int h)
|
||||||
|
|
||||||
void WidgetExplorer::paintGL()
|
void WidgetExplorer::paintGL()
|
||||||
{
|
{
|
||||||
GLenum error_code;
|
|
||||||
QTime start_time;
|
QTime start_time;
|
||||||
double frame_time;
|
double frame_time;
|
||||||
|
|
||||||
|
@ -241,9 +236,4 @@ void WidgetExplorer::paintGL()
|
||||||
glColor3f(1.0, 1.0, 1.0);
|
glColor3f(1.0, 1.0, 1.0);
|
||||||
renderText(5, height() - 9, tr("Please wait while loading scene..."));
|
renderText(5, height() - 9, tr("Please wait while loading scene..."));
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
while ((error_code = glGetError()) != GL_NO_ERROR)
|
|
||||||
{
|
|
||||||
qDebug("[OpenGL] ERROR : %s", (const char*)gluErrorString(error_code));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,8 @@ DEFINES += OPENGL_LIBRARY
|
||||||
|
|
||||||
include(../../common.pri)
|
include(../../common.pri)
|
||||||
|
|
||||||
|
unix:LIBS += -lGLU
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
OpenGLRenderer.cpp \
|
OpenGLRenderer.cpp \
|
||||||
ExplorerChunkTerrain.cpp \
|
ExplorerChunkTerrain.cpp \
|
||||||
|
|
Loading…
Reference in a new issue