git-svn-id: svn://db.shs.com.ru/libs@290 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -33,6 +33,12 @@ foreach(_Q ${_QAD_LIBS})
|
||||
#message(STATUS "Library ${_Q} (${_QU}) -> ${QAD_${_QU}_LIBRARY} found in ${_SEARCH_DIR}")
|
||||
list(APPEND QT_MULTILIB_LIST qad_${_Q})
|
||||
endforeach()
|
||||
list(APPEND QT_MULTILIB_LIST qglview)
|
||||
foreach(_v ${_QT_VERSIONS_})
|
||||
find_library(QGLVIEW${_v}_LIBRARY qglview${_v} ${_SEARCH_DIR})
|
||||
set(MULTILIB_qglview_SUFFIX_Qt${_v} ${_v})
|
||||
set(MULTILIB_qglview_SUFFIX_Qt${_v} ${_v} PARENT_SCOPE)
|
||||
endforeach()
|
||||
set(QT_MULTILIB_LIST ${QT_MULTILIB_LIST} PARENT_SCOPE)
|
||||
if(NOT LIBPROJECT)
|
||||
if (NOT _QAD_MSG)
|
||||
|
||||
@@ -17,7 +17,16 @@
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
@@ -30,8 +39,8 @@
|
||||
<rect>
|
||||
<x>-10</x>
|
||||
<y>0</y>
|
||||
<width>28</width>
|
||||
<height>361</height>
|
||||
<width>33</width>
|
||||
<height>420</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="layoutButtons">
|
||||
@@ -47,12 +56,6 @@
|
||||
<iconset resource="qad_graphic.qrc">
|
||||
<normaloff>:/icons/zoom-fit-best.png</normaloff>:/icons/zoom-fit-best.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@@ -64,12 +67,6 @@
|
||||
<iconset resource="qad_graphic.qrc">
|
||||
<normaloff>:/icons/view-grid.png</normaloff>:/icons/view-grid.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -87,12 +84,6 @@
|
||||
<iconset resource="qad_graphic.qrc">
|
||||
<normaloff>:/icons/edit-guides.png</normaloff>:/icons/edit-guides.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -107,12 +98,6 @@
|
||||
<iconset resource="qad_graphic.qrc">
|
||||
<normaloff>:/icons/expand_s_y.png</normaloff>:/icons/expand_s_y.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -127,12 +112,6 @@
|
||||
<iconset resource="qad_graphic.qrc">
|
||||
<normaloff>:/icons/expand_s_x.png</normaloff>:/icons/expand_s_x.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -147,12 +126,6 @@
|
||||
<iconset resource="qad_graphic.qrc">
|
||||
<normaloff>:/icons/view-fullscreen.png</normaloff>:/icons/view-fullscreen.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@@ -164,12 +137,6 @@
|
||||
<iconset resource="qad_graphic.qrc">
|
||||
<normaloff>:/icons/border-line.png</normaloff>:/icons/border-line.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -187,12 +154,6 @@
|
||||
<iconset resource="qad_graphic.qrc">
|
||||
<normaloff>:/icons/legend.png</normaloff>:/icons/legend.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -210,12 +171,6 @@
|
||||
<iconset resource="qad_graphic.qrc">
|
||||
<normaloff>:/icons/media-playback-pause.png</normaloff>:/icons/media-playback-pause.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@@ -230,12 +185,6 @@
|
||||
<iconset resource="qad_graphic.qrc">
|
||||
<normaloff>:/icons/configure.png</normaloff>:/icons/configure.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@@ -247,12 +196,6 @@
|
||||
<iconset resource="qad_graphic.qrc">
|
||||
<normaloff>:/icons/document-save.png</normaloff>:/icons/document-save.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@@ -280,12 +223,6 @@
|
||||
<iconset resource="qad_graphic.qrc">
|
||||
<normaloff>:/icons/edit-clear.png</normaloff>:/icons/edit-clear.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@@ -297,12 +234,6 @@
|
||||
<iconset resource="qad_graphic.qrc">
|
||||
<normaloff>:/icons/dialog-close.png</normaloff>:/icons/dialog-close.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@@ -350,7 +281,16 @@
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="2" column="1" colspan="2">
|
||||
@@ -365,7 +305,16 @@
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
@@ -417,7 +366,16 @@
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
@@ -455,12 +413,21 @@
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="layoutLegend">
|
||||
<property name="leftMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>448</width>
|
||||
<height>513</height>
|
||||
<width>492</width>
|
||||
<height>585</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -20,7 +20,16 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
@@ -35,7 +44,16 @@
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
@@ -142,7 +160,16 @@
|
||||
<property name="verticalSpacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="2">
|
||||
@@ -254,7 +281,16 @@
|
||||
<property name="verticalSpacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
@@ -390,7 +426,16 @@
|
||||
<string>Margins</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
|
||||
@@ -25,7 +25,7 @@ qt_add_library(${PROJECT_NAME} SHARED out_CPP)
|
||||
qt_target_link_libraries(${PROJECT_NAME} qad_utils qad_widgets ${OPENGL_LIBRARIES})
|
||||
message(STATUS "Building ${PROJECT_NAME}")
|
||||
if (LIBPROJECT)
|
||||
sdk_install("qad" "${PROJECT_NAME}" "${H}")
|
||||
sdk_install("qad" "${PROJECT_NAME}" "${out_HDR}")
|
||||
else()
|
||||
if (LIB)
|
||||
if (WIN32)
|
||||
|
||||
@@ -83,6 +83,7 @@ void GLCubeTexture::loadPathesFromDirectory(const QString & dir) {
|
||||
|
||||
|
||||
GLuint GLTextureManagerBase::loadTexture(const QString & path, bool ownership, bool bump) {
|
||||
if (!currentGLTextureManager) return 0;
|
||||
QString p = findFile(path, search_pathes);
|
||||
if (p.isEmpty()) return 0;
|
||||
int tid = ((GLTextureManagerBase*)currentGLTextureManager)->textureID(p, bump);
|
||||
@@ -225,7 +226,8 @@ void Material::apply(__GLShaderProgram__ * prog) {
|
||||
|
||||
void Material::loadTextures(GLTextureManagerBase * tm) {
|
||||
//qDebug() << "load textures";
|
||||
if (tm == 0) tm = (GLTextureManagerBase*)currentGLTextureManager;
|
||||
if (!tm) tm = (GLTextureManagerBase*)currentGLTextureManager;
|
||||
if (!tm) return;
|
||||
if (!map_diffuse.bitmap_path.isEmpty()) map_diffuse.bitmap_id = tm->loadTexture(map_diffuse.bitmap_path);
|
||||
if (!map_normal.bitmap_path.isEmpty()) map_normal.bitmap_id = tm->loadTexture(map_normal.bitmap_path, true, true);
|
||||
if (!map_relief.bitmap_path.isEmpty()) map_relief.bitmap_id = tm->loadTexture(map_relief.bitmap_path);
|
||||
|
||||
@@ -185,7 +185,7 @@ QMatrix4x4 getGLMatrix(GLenum matrix);
|
||||
void setGLMatrix(QMatrix4x4 matrix);
|
||||
inline void deleteGLTexture(GLuint & tex) {if (tex != 0) glDeleteTextures(1, &tex); tex = 0;}
|
||||
#if QT_VERSION >= 0x050600
|
||||
# define QGLCI QOpenGLExtraFunctions gf(QOpenGLContext::currentContext());
|
||||
# define QGLCI if (!QOpenGLContext::currentContext()) return; QOpenGLExtraFunctions gf(QOpenGLContext::currentContext());
|
||||
# define QGLC gf.
|
||||
inline void glActiveTextureChannel(int channel) {QGLCI gf.glActiveTexture(GL_TEXTURE0 + channel);}
|
||||
inline void glDisableTextures(int channels = 8) {QGLCI for (int i = channels - 1; i >= 0; --i) {glActiveTextureChannel(i); glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_CUBE_MAP);}}
|
||||
|
||||
@@ -39,6 +39,7 @@ QGLView::QGLView(QWidget * parent): QGraphicsView(parent), fbo_selection(3) {
|
||||
setFocusPolicy(Qt::WheelFocus);
|
||||
setScene(new QGraphicsScene());
|
||||
setInteractive(true);
|
||||
need_init_ = true;
|
||||
objects_.is_root = true;
|
||||
painter_ = 0;
|
||||
backColor_ = Qt::black;
|
||||
@@ -108,8 +109,11 @@ QGLView::QGLView(QWidget * parent): QGraphicsView(parent), fbo_selection(3) {
|
||||
|
||||
|
||||
QGLView::~QGLView() {
|
||||
stop();
|
||||
if (shader_select != 0) delete shader_select;
|
||||
if (shader_halo != 0) delete shader_halo;
|
||||
currentQGLView = 0;
|
||||
currentGLTextureManager = 0;
|
||||
//if (shader_rope != 0) delete shader_rope;
|
||||
}
|
||||
|
||||
@@ -159,12 +163,13 @@ void QGLView::drawBackground(QPainter * painter, const QRectF & rect) {
|
||||
glDisable(GL_CULL_FACE);
|
||||
glReleaseTextures();
|
||||
QGraphicsView::drawBackground(painter_, rect);
|
||||
painter_ = 0;
|
||||
}
|
||||
|
||||
|
||||
void QGLView::initializeGL() {
|
||||
//qDebug() << "init glview";
|
||||
makeCurrent();
|
||||
//makeCurrent();
|
||||
#if QT_VERSION >= 0x050600
|
||||
initializeOpenGLFunctions();
|
||||
#endif
|
||||
@@ -216,11 +221,18 @@ void QGLView::initializeGL() {
|
||||
//createGLTexture(t, QImage("e/bottom.jpg"));
|
||||
//qDebug() << bindTexture(QImage("e/bottom.jpg"));
|
||||
|
||||
need_init_ = false;
|
||||
emit glInitializeDone();
|
||||
}
|
||||
|
||||
|
||||
void QGLView::paintGL() {
|
||||
#if QT_VERSION >= 0x050600
|
||||
//initializeOpenGLFunctions();
|
||||
if (need_init_)
|
||||
initializeGL();
|
||||
#endif
|
||||
//qDebug() << "paintGL";
|
||||
//QMutexLocker ml_v(&v_mutex);
|
||||
glEnable(GL_CULL_FACE);
|
||||
//glDisable(GL_CULL_FACE);
|
||||
@@ -308,6 +320,7 @@ void QGLView::paintGL() {
|
||||
renderer_->prepareScene();
|
||||
renderer_->renderScene();
|
||||
}
|
||||
emit glPainting();
|
||||
if (selectionHalo_ || hoverHalo_) {
|
||||
glReleaseTextures();
|
||||
glReleaseShaders();
|
||||
@@ -342,7 +355,7 @@ void QGLView::paintGL() {
|
||||
glResetAllTransforms();
|
||||
glReleaseFramebuffer();
|
||||
|
||||
emit glPainting();
|
||||
emit glEndPaint();
|
||||
|
||||
/*releaseShaders();
|
||||
glActiveTextureChannel(0);
|
||||
|
||||
@@ -269,7 +269,7 @@ private:
|
||||
double fogDensity_, fogStart_, fogEnd_, fps_, fps_tm, hoverHaloFill_, selectionHaloFill_, m_motionBlurFactor;
|
||||
int timer, fps_cnt, sh_id_loc;
|
||||
bool is_init, fogEnabled_, lightEnabled_, grabMouse_, mouse_first, mouseRotate_, mouseSelect_, customMouseMove_;
|
||||
bool shaders_supported, changed_, cameraOrbit_;
|
||||
bool shaders_supported, changed_, cameraOrbit_, need_init_;
|
||||
bool hoverHalo_, selectionHalo_, mouseThis_, shaders_bind, selecting_;
|
||||
|
||||
public slots:
|
||||
@@ -305,6 +305,7 @@ public slots:
|
||||
signals:
|
||||
void glBeginPaint();
|
||||
void glPainting();
|
||||
void glEndPaint();
|
||||
void glKeyPressEvent(QKeyEvent * e);
|
||||
void glKeyReleaseEvent(QKeyEvent * e);
|
||||
void glMousePressEvent(QMouseEvent * e);
|
||||
|
||||
@@ -88,13 +88,13 @@ void RendererDeferredShading::renderScene() {
|
||||
fbo_g.bind();
|
||||
int buffs[] = {0, 1, 2, 3, 4};
|
||||
fbo_g.setWriteBuffers(buffs, 5);
|
||||
if (white_image_id == 0) {
|
||||
if (white_image_id == 0 && currentGLTextureManager) {
|
||||
glActiveTextureChannel(6);
|
||||
white_image_id = ((GLTextureManagerBase*)currentGLTextureManager)->loadTexture(white_image, false);
|
||||
glBindTexture(GL_TEXTURE_2D, white_image_id);
|
||||
glActiveTextureChannel(0);
|
||||
}
|
||||
if (violent_image_id == 0) {
|
||||
if (violent_image_id == 0 && currentGLTextureManager) {
|
||||
glActiveTextureChannel(7);
|
||||
violent_image_id = ((GLTextureManagerBase*)currentGLTextureManager)->loadTexture(violent_image, false);
|
||||
glBindTexture(GL_TEXTURE_2D, violent_image_id);
|
||||
|
||||
Reference in New Issue
Block a user