git-svn-id: svn://db.shs.com.ru/libs@29 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2015-06-24 07:49:28 +00:00
parent 66bc4c7b1c
commit ff2939ca76
6 changed files with 13 additions and 13 deletions

View File

@@ -17,7 +17,7 @@ foreach(F ${PIP_FOLDERS})
endforeach(F) endforeach(F)
#message(STATUS "PIP includes = ${PIP_INCLUDES}") #message(STATUS "PIP includes = ${PIP_INCLUDES}")
set(LIST_LIBS pip qad_widgets qad_utils qad_application qad_blockview qad_graphic qad_sql_table piqt mbricks kx_tools piqt_tools touch_widgets) set(LIST_LIBS pip qad_widgets qad_utils qad_application qad_blockview qad_graphic qad_sql_table piqt mbricks kx_tools piqt_tools touch_widgets qglview)
foreach(L ${LIST_LIBS}) foreach(L ${LIST_LIBS})
add_subdirectory(${L}) add_subdirectory(${L})

View File

@@ -4,16 +4,12 @@ find_package(Qt4 REQUIRED)
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${QT_INCLUDES}) include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${QT_INCLUDES})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -Wall") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3") #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3")
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}") set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}")
add_definitions(-DGL_GLEXT_PROTOTYPES)
set(LIBS ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} qad_widgets) set(LIBS ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} qad_widgets)
if (${WIN32}) find_package(OpenGL REQUIRED)
list(APPEND LIBS opengl32 glu32) list(APPEND LIBS ${OPENGL_LIBRARIES})
else (${WIN32})
list(APPEND LIBS GL GLU glut GLEW)
endif (${WIN32})
file(GLOB MOCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.h") file(GLOB MOCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.h")
file(GLOB CPPS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp") file(GLOB CPPS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp")

View File

@@ -41,6 +41,7 @@
# define CC_VC # define CC_VC
#endif #endif
#define GL_GLEXT_PROTOTYPES
#ifdef WINDOWS #ifdef WINDOWS
# include "GLee.h" # include "GLee.h"
#else #else

View File

@@ -35,7 +35,7 @@ QGLView::QGLView(QWidget * parent): QGraphicsView(parent), fbo_selection(3) {
ambientColor_ = QColor(10, 10, 10); ambientColor_ = QColor(10, 10, 10);
lastPos = QPoint(-1, -1); lastPos = QPoint(-1, -1);
lineWidth_ = 1.; lineWidth_ = 1.;
linearFiltering_ = cameraOrbit_ = true; linearFiltering_ = cameraOrbit_ = lightEnabled_ = true;
shaders_supported = selecting_ = customMouseMove_ = false; shaders_supported = selecting_ = customMouseMove_ = false;
sel_button = Qt::LeftButton; sel_button = Qt::LeftButton;
sel_mod = Qt::NoModifier; sel_mod = Qt::NoModifier;
@@ -265,6 +265,7 @@ void QGLView::paintGL() {
renderer_->reloadShaders(); renderer_->reloadShaders();
} }
} }
emit glBeginPaint();
if (renderer_ != 0) renderer_->renderScene(); if (renderer_ != 0) renderer_->renderScene();
if (selectionHalo_ || hoverHalo_) { if (selectionHalo_ || hoverHalo_) {
glReleaseTextures(); glReleaseTextures();

View File

@@ -126,6 +126,7 @@ public:
FogMode fogMode() const {return fogMode_;} FogMode fogMode() const {return fogMode_;}
//LightingMode lightingMode() const {return lmode;} //LightingMode lightingMode() const {return lmode;}
bool isFogEnabled() const {return fogEnabled_;} bool isFogEnabled() const {return fogEnabled_;}
bool isLightEnabled() const {return lightEnabled_;}
bool isGrabMouseEnabled() const {return grabMouse_;} bool isGrabMouseEnabled() const {return grabMouse_;}
bool isMouseRotateEnabled() const {return mouseRotate_;} bool isMouseRotateEnabled() const {return mouseRotate_;}
bool isMouseSelectionEnabled() const {return mouseSelect_;} bool isMouseSelectionEnabled() const {return mouseSelect_;}
@@ -255,7 +256,7 @@ private:
double lineWidth_, linearFiltering_, accom_time, accom_max_speed, cur_luminance; double lineWidth_, linearFiltering_, accom_time, accom_max_speed, cur_luminance;
double fogDensity_, fogStart_, fogEnd_, fps_, fps_tm, hoverHaloFill_, selectionHaloFill_; double fogDensity_, fogStart_, fogEnd_, fps_, fps_tm, hoverHaloFill_, selectionHaloFill_;
int timer, fps_cnt, sh_id_loc, shadow_map_size, dynamic_cubemap_size; int timer, fps_cnt, sh_id_loc, shadow_map_size, dynamic_cubemap_size;
bool is_init, fogEnabled_, grabMouse_, mouse_first, mouseRotate_, mouseSelect_, customMouseMove_; bool is_init, fogEnabled_, lightEnabled_, grabMouse_, mouse_first, mouseRotate_, mouseSelect_, customMouseMove_;
bool hoverHalo_, selectionHalo_, mouseThis_, shaders_bind, shadows_, shadows_soft, selecting_; bool hoverHalo_, selectionHalo_, mouseThis_, shaders_bind, shadows_, shadows_soft, selecting_;
bool shaders_supported, dynamic_reflections, hdr_, bloom_, msaa_, fxaa_, accomodation_, changed_, cameraOrbit_; bool shaders_supported, dynamic_reflections, hdr_, bloom_, msaa_, fxaa_, accomodation_, changed_, cameraOrbit_;
@@ -274,6 +275,7 @@ public slots:
void setFogEnd(const double & arg) {fogEnd_ = arg;} void setFogEnd(const double & arg) {fogEnd_ = arg;}
void setFogMode(const FogMode & arg) {fogMode_ = arg;} void setFogMode(const FogMode & arg) {fogMode_ = arg;}
void setFogEnabled(const bool & arg) {fogEnabled_ = arg;} void setFogEnabled(const bool & arg) {fogEnabled_ = arg;}
void setLightEnabled(const bool & arg) {lightEnabled_ = arg;}
void setGrabMouseEnabled(const bool & arg) {grabMouse_ = arg; mouse_first = true;} void setGrabMouseEnabled(const bool & arg) {grabMouse_ = arg; mouse_first = true;}
void setMouseRotateEnabled(const bool & arg) {mouseRotate_ = arg;} void setMouseRotateEnabled(const bool & arg) {mouseRotate_ = arg;}
void setMouseSelectionEnabled(const bool & arg) {mouseSelect_ = arg;} void setMouseSelectionEnabled(const bool & arg) {mouseSelect_ = arg;}

View File

@@ -74,16 +74,16 @@ void RendererSimple::renderScene() {
fbo_c.bind(); fbo_c.bind();
glClearFramebuffer(); glClearFramebuffer();
shader->bind(); /// WARNING shader->bind(); /// WARNING
renderObjects(GLObjectBase::Solid, l, 0, true, true, view.isFogEnabled()); renderObjects(GLObjectBase::Solid, l, 0, true, view.isLightEnabled(), view.isFogEnabled());
shader->release(); /// WARNING shader->release(); /// WARNING
if (QRect(QPoint(), fbo_c.size()).contains(mpos)) { if (QRect(QPoint(), fbo_c.size()).contains(mpos)) {
//qDebug() << mpos; //qDebug() << mpos;
GLfloat data[4] = {0, 0, 0, 0}; GLfloat data[4] = {0, 0, 0, 0};
glReadPixels(mpos.x(), fbo_c.height() - mpos.y(), 1, 1, GL_RGBA, GL_FLOAT, data); glReadPixels(mpos.x(), fbo_c.height() - mpos.y(), 1, 1, GL_RGBA, GL_FLOAT, data);
qDebug() << QVector3D(data[0], data[1], data[2]); //qDebug() << QVector3D(data[0], data[1], data[2]);
} }
fbo_c.release(); fbo_c.release();
renderObjects(GLObjectBase::Solid, l, 0, true, true, view.isFogEnabled()); renderObjects(GLObjectBase::Solid, l, 0, true, view.isLightEnabled(), view.isFogEnabled());
//renderObjects(GLObjectBase::Solid, l, 0, true, true, view.isFogEnabled()); //renderObjects(GLObjectBase::Solid, l, 0, true, true, view.isFogEnabled());