Merge pull request #1981 from smalcom/qt_assimp_viewer

Qt assimp viewer and few fixes in another places
pull/1979/head^2
Kim Kulling 2018-05-26 11:04:30 +02:00 committed by GitHub
commit 48100d0016
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 514 additions and 191 deletions

2
.gitignore vendored
View File

@ -12,6 +12,8 @@ build
bin/ bin/
lib/ lib/
# QtCreator
CMakeLists.txt.user
# Generated # Generated
assimp.pc assimp.pc

View File

@ -412,32 +412,7 @@ IF ( ASSIMP_BUILD_ASSIMP_TOOLS )
ENDIF ( WIN32 AND DirectX_D3DX9_LIBRARY ) ENDIF ( WIN32 AND DirectX_D3DX9_LIBRARY )
ADD_SUBDIRECTORY( tools/assimp_cmd/ ) ADD_SUBDIRECTORY( tools/assimp_cmd/ )
# Check dependencies for assimp_qt_viewer.
# Why here? Maybe user do not want Qt viewer and have no Qt.
# Why assimp_qt_viewer/CMakeLists.txt still contain similar check?
# Because viewer can be build independently of Assimp.
FIND_PACKAGE(Qt5Widgets QUIET)
FIND_PACKAGE(DevIL QUIET)
FIND_PACKAGE(OpenGL QUIET)
IF ( Qt5Widgets_FOUND AND IL_FOUND AND OPENGL_FOUND)
ADD_SUBDIRECTORY( tools/assimp_qt_viewer/ ) ADD_SUBDIRECTORY( tools/assimp_qt_viewer/ )
ELSE()
SET ( ASSIMP_QT_VIEWER_DEPENDENCIES "")
IF (NOT Qt5_FOUND)
SET ( ASSIMP_QT_VIEWER_DEPENDENCIES "${ASSIMP_QT_VIEWER_DEPENDENCIES} Qt5")
ENDIF (NOT Qt5_FOUND)
IF (NOT IL_FOUND)
SET ( ASSIMP_QT_VIEWER_DEPENDENCIES "${ASSIMP_QT_VIEWER_DEPENDENCIES} DevIL")
ENDIF (NOT IL_FOUND)
IF (NOT OPENGL_FOUND)
SET ( ASSIMP_QT_VIEWER_DEPENDENCIES "${ASSIMP_QT_VIEWER_DEPENDENCIES} OpengGL")
ENDIF (NOT OPENGL_FOUND)
MESSAGE (WARNING "Build of assimp_qt_viewer is disabled. Unsatisfied dendencies: ${ASSIMP_QT_VIEWER_DEPENDENCIES}")
ENDIF ( Qt5Widgets_FOUND AND IL_FOUND AND OPENGL_FOUND)
ENDIF ( ASSIMP_BUILD_ASSIMP_TOOLS ) ENDIF ( ASSIMP_BUILD_ASSIMP_TOOLS )
IF ( ASSIMP_BUILD_SAMPLES) IF ( ASSIMP_BUILD_SAMPLES)

View File

@ -71,7 +71,7 @@ static const aiImporterDesc desc = {
0, 0,
0, 0,
0, 0,
"3ds prj 3DS PRJ" "3ds prj"
}; };
@ -127,7 +127,7 @@ Discreet3DSImporter::~Discreet3DSImporter() {
// Returns whether the class can handle the format of the given file. // Returns whether the class can handle the format of the given file.
bool Discreet3DSImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const { bool Discreet3DSImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const {
std::string extension = GetExtension(pFile); std::string extension = GetExtension(pFile);
if(extension == "3ds" || extension == "3DS" || extension == "prj"|| extension == "PRJ" ) { if(extension == "3ds" || extension == "prj") {
return true; return true;
} }

View File

@ -222,7 +222,7 @@ void D3MFExporter::writeMetaData() {
return; return;
} }
const aiString *key; const aiString *key = nullptr;
const aiMetadataEntry *entry(nullptr); const aiMetadataEntry *entry(nullptr);
for ( size_t i = 0; i < numMetaEntries; ++i ) { for ( size_t i = 0; i < numMetaEntries; ++i ) {
mScene->mMetaData->Get( i, key, entry ); mScene->mMetaData->Get( i, key, entry );

View File

@ -970,6 +970,8 @@ void Importer::GetExtensionList(aiString& szOut) const
(*i)->GetExtensionList(str); (*i)->GetExtensionList(str);
} }
// List can be empty
if( !str.empty() ) {
for (std::set<std::string>::const_iterator it = str.begin();; ) { for (std::set<std::string>::const_iterator it = str.begin();; ) {
szOut.Append("*."); szOut.Append("*.");
szOut.Append((*it).c_str()); szOut.Append((*it).c_str());
@ -979,6 +981,7 @@ void Importer::GetExtensionList(aiString& szOut) const
} }
szOut.Append(";"); szOut.Append(";");
} }
}
ASSIMP_END_EXCEPTION_REGION(void); ASSIMP_END_EXCEPTION_REGION(void);
} }

View File

@ -516,7 +516,7 @@ void glTF2Exporter::ExportMaterials()
if (mat->Get(AI_MATKEY_GLTF_PBRSPECULARGLOSSINESS_GLOSSINESS_FACTOR, pbrSG.glossinessFactor) != AI_SUCCESS) { if (mat->Get(AI_MATKEY_GLTF_PBRSPECULARGLOSSINESS_GLOSSINESS_FACTOR, pbrSG.glossinessFactor) != AI_SUCCESS) {
float shininess; float shininess;
if (mat->Get(AI_MATKEY_SHININESS, shininess)) { if (mat->Get(AI_MATKEY_SHININESS, shininess) == AI_SUCCESS) {
pbrSG.glossinessFactor = shininess / 1000; pbrSG.glossinessFactor = shininess / 1000;
} }
} }

View File

@ -210,7 +210,7 @@ TEST_F( utMetadata, copy_test ) {
// int32_t test // int32_t test
{ {
int32_t v; int32_t v = 0;
bool ok = copy.Get( "int32", v ); bool ok = copy.Get( "int32", v );
EXPECT_TRUE( ok ); EXPECT_TRUE( ok );
EXPECT_EQ( i32v, v ); EXPECT_EQ( i32v, v );

View File

@ -78,7 +78,7 @@ TEST_F(SharedPPDataTest, testPODProperty)
{ {
int i = 5; int i = 5;
shared->AddProperty("test",i); shared->AddProperty("test",i);
int o; int o = 0;
EXPECT_TRUE(shared->GetProperty("test",o)); EXPECT_TRUE(shared->GetProperty("test",o));
EXPECT_EQ(5, o); EXPECT_EQ(5, o);
EXPECT_FALSE(shared->GetProperty("test2",o)); EXPECT_FALSE(shared->GetProperty("test2",o));

View File

@ -3,44 +3,103 @@ project(assimp_qt_viewer)
cmake_minimum_required(VERSION 2.6) cmake_minimum_required(VERSION 2.6)
find_package(Qt5 COMPONENTS Gui Widgets OpenGL REQUIRED) OPTION( ASSIMP_QT4_VIEWER
find_package(DevIL REQUIRED) "Set to ON to enable Qt4 against Qt5 for assimp_qt_viewer"
find_package(OpenGL REQUIRED) OFF
)
include_directories( FIND_PACKAGE(DevIL QUIET)
${Qt5Widgets_INCLUDES} FIND_PACKAGE(OpenGL QUIET)
IF(ASSIMP_QT4_VIEWER)
# Qt4 version
FIND_PACKAGE(Qt4 QUIET)
ELSE(ASSIMP_QT4_VIEWER)
# Qt5 version
FIND_PACKAGE(Qt5 COMPONENTS Gui Widgets OpenGL QUIET)
ENDIF(ASSIMP_QT4_VIEWER)
SET(VIEWER_BUILD:BOOL FALSE)
IF((Qt4_FOUND OR Qt5Widgets_FOUND) AND IL_FOUND AND OPENGL_FOUND)
SET(VIEWER_BUILD TRUE)
ELSE((Qt4_FOUND OR Qt5Widgets_FOUND) AND IL_FOUND AND OPENGL_FOUND)
SET ( ASSIMP_QT_VIEWER_DEPENDENCIES "")
IF(ASSIMP_QT4_VIEWER)
IF (NOT Qt4_FOUND)
SET ( ASSIMP_QT_VIEWER_DEPENDENCIES "${ASSIMP_QT_VIEWER_DEPENDENCIES} Qt4")
ENDIF (NOT Qt4_FOUND)
ELSE(ASSIMP_QT4_VIEWER)
IF (NOT Qt5_FOUND)
SET ( ASSIMP_QT_VIEWER_DEPENDENCIES "${ASSIMP_QT_VIEWER_DEPENDENCIES} Qt5")
ENDIF (NOT Qt5_FOUND)
ENDIF(ASSIMP_QT4_VIEWER)
IF (NOT IL_FOUND)
SET ( ASSIMP_QT_VIEWER_DEPENDENCIES "${ASSIMP_QT_VIEWER_DEPENDENCIES} DevIL")
ENDIF (NOT IL_FOUND)
IF (NOT OPENGL_FOUND)
SET ( ASSIMP_QT_VIEWER_DEPENDENCIES "${ASSIMP_QT_VIEWER_DEPENDENCIES} OpengGL")
ENDIF (NOT OPENGL_FOUND)
MESSAGE (WARNING "Build of assimp_qt_viewer is disabled. Unsatisfied dendencies: ${ASSIMP_QT_VIEWER_DEPENDENCIES}")
ENDIF((Qt4_FOUND OR Qt5Widgets_FOUND) AND IL_FOUND AND OPENGL_FOUND)
IF(VIEWER_BUILD)
INCLUDE_DIRECTORIES(
${Assimp_SOURCE_DIR}/include ${Assimp_SOURCE_DIR}/include
${Assimp_SOURCE_DIR}/code ${Assimp_SOURCE_DIR}/code
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}
${OPENGL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR}
${IL_INCLUDE_DIR} ${IL_INCLUDE_DIR}
) )
link_directories(${Assimp_BINARY_DIR}) LINK_DIRECTORIES(${Assimp_BINARY_DIR})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pedantic -Wall") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pedantic -Wall")
set(assimp_qt_viewer_SRCS main.cpp loggerview.cpp glview.cpp mainwindow.cpp) SET(assimp_qt_viewer_SRCS main.cpp loggerview.cpp glview.cpp mainwindow.cpp)
qt5_wrap_ui(UISrcs mainwindow.ui)
qt5_wrap_cpp(MOCrcs mainwindow.hpp glview.hpp)
add_executable(${PROJECT_NAME} ${assimp_qt_viewer_SRCS} ${UISrcs} ${MOCrcs}) IF(ASSIMP_QT4_VIEWER)
target_link_libraries(${PROJECT_NAME} Qt5::Gui Qt5::Widgets Qt5::OpenGL ${IL_LIBRARIES} ${OPENGL_LIBRARIES} assimp) MESSAGE("assimp_qt_viewer use Qt4")
ADD_DEFINITIONS( -DASSIMP_QT4_VIEWER )
INCLUDE_DIRECTORIES(${QT_INCLUDES})
qt4_wrap_ui(UISrcs mainwindow.ui)
qt4_wrap_cpp(MOCrcs mainwindow.hpp glview.hpp)
ELSE()
MESSAGE("assimp_qt_viewer use Qt5")
INCLUDE_DIRECTORIES(${Qt5Widgets_INCLUDES})
qt5_wrap_ui(UISrcs mainwindow.ui)
qt5_wrap_cpp(MOCrcs mainwindow.hpp glview.hpp)
ENDIF()
if(WIN32) # Check if we are on Windows add_executable(${PROJECT_NAME} ${assimp_qt_viewer_SRCS} ${UISrcs} ${MOCrcs})
if(MSVC) # Check if we are using the Visual Studio compiler
IF(ASSIMP_QT4_VIEWER)
target_link_libraries(${PROJECT_NAME} ${QT_LIBRARIES} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} ${IL_LIBRARIES} ${OPENGL_LIBRARIES} assimp)
ELSE()
target_link_libraries(${PROJECT_NAME} Qt5::Gui Qt5::Widgets Qt5::OpenGL ${IL_LIBRARIES} ${OPENGL_LIBRARIES} assimp)
ENDIF()
IF(WIN32) # Check if we are on Windows
IF(MSVC) # Check if we are using the Visual Studio compiler
#set_target_properties(TestProject PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS") #set_target_properties(TestProject PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS")
elseif(CMAKE_COMPILER_IS_GNUCXX) ELSEIF(CMAKE_COMPILER_IS_GNUCXX)
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mwindows") # Not tested # SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mwindows") # Not tested
else() ELSE()
message(SEND_ERROR "You are using an unsupported Windows compiler! (Not MSVC or GCC)") MESSAGE(SEND_ERROR "You are using an unsupported Windows compiler! (Not MSVC or GCC)")
endif() ENDIF()
elseif(UNIX) ELSEIF(UNIX)
# Nothing special required # Nothing special required
else() ELSE()
message(SEND_ERROR "You are on an unsupported platform! (Not Win32 or Unix)") MESSAGE(SEND_ERROR "You are on an unsupported platform! (Not Win32 or Unix)")
endif() ENDIF()
set_property(TARGET ${PROJECT_NAME} PROPERTY DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
INSTALL(TARGETS assimp_qt_viewer DESTINATION "${ASSIMP_BIN_INSTALL_DIR}")
install(TARGETS assimp_qt_viewer DESTINATION "${ASSIMP_BIN_INSTALL_DIR}") ENDIF(VIEWER_BUILD)

View File

@ -5,6 +5,9 @@
#include "glview.hpp" #include "glview.hpp"
// Header files, Qt.
#include <QTime>
// Header files, OpenGL. // Header files, OpenGL.
#if defined(__APPLE__) #if defined(__APPLE__)
# include <OpenGL/glu.h> # include <OpenGL/glu.h>
@ -58,6 +61,33 @@ void CGLView::SHelper_Camera::SetDefault()
/************ CGLView *************/ /************ CGLView *************/
/**********************************/ /**********************************/
#if !ASSIMP_QT4_VIEWER
# define ConditionalContextControl_Begin \
bool ContextEnabledHere; \
\
if(mGLContext_Current) \
{ \
ContextEnabledHere = false; \
} \
else \
{ \
makeCurrent(); \
mGLContext_Current = true; \
ContextEnabledHere = true; \
} \
\
do {} while(false)
# define ConditionalContextControl_End \
if(ContextEnabledHere) \
{ \
doneCurrent(); \
mGLContext_Current = false; \
} \
\
do {} while(false)
#endif // ASSIMP_QT4_VIEWER
void CGLView::Material_Apply(const aiMaterial* pMaterial) void CGLView::Material_Apply(const aiMaterial* pMaterial)
{ {
GLfloat tcol[4]; GLfloat tcol[4];
@ -105,7 +135,7 @@ void CGLView::Material_Apply(const aiMaterial* pMaterial)
glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, tcol); glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, tcol);
// Shininess // Shininess
float shininess, strength; ai_real shininess, strength;
max = 1; max = 1;
ret1 = aiGetMaterialFloatArray(pMaterial, AI_MATKEY_SHININESS, &shininess, &max); ret1 = aiGetMaterialFloatArray(pMaterial, AI_MATKEY_SHININESS, &shininess, &max);
@ -406,9 +436,9 @@ void CGLView::BBox_GetFromVertices(const aiVector3D* pVertices, const size_t pVe
for(size_t idx_vert = 1; idx_vert < pVerticesQuantity; idx_vert++) for(size_t idx_vert = 1; idx_vert < pVerticesQuantity; idx_vert++)
{ {
const GLfloat x = pVertices[idx_vert].x; const ai_real x = pVertices[idx_vert].x;
const GLfloat y = pVertices[idx_vert].y; const ai_real y = pVertices[idx_vert].y;
const GLfloat z = pVertices[idx_vert].z; const ai_real z = pVertices[idx_vert].z;
// search minimal... // search minimal...
AssignIfLesser(&pBBox.Minimum.x, x); AssignIfLesser(&pBBox.Minimum.x, x);
@ -446,7 +476,12 @@ void CGLView::Draw_Node(const aiNode* pNode)
// Apply node transformation matrix. // Apply node transformation matrix.
mat_node.Transpose(); mat_node.Transpose();
glPushMatrix(); glPushMatrix();
#if ASSIMP_DOUBLE_PRECISION
glMultMatrixd((GLdouble*)mat_node[0]);
#else
glMultMatrixf((GLfloat*)&mat_node); glMultMatrixf((GLfloat*)&mat_node);
#endif // ASSIMP_DOUBLE_PRECISION
// Draw all meshes assigned to this node // Draw all meshes assigned to this node
for(size_t idx_mesh_arr = 0; idx_mesh_arr < pNode->mNumMeshes; idx_mesh_arr++) Draw_Mesh(pNode->mMeshes[idx_mesh_arr]); for(size_t idx_mesh_arr = 0; idx_mesh_arr < pNode->mNumMeshes; idx_mesh_arr++) Draw_Mesh(pNode->mMeshes[idx_mesh_arr]);
@ -473,13 +508,21 @@ void CGLView::Draw_Mesh(const size_t pMesh_Index)
// Vertices array // Vertices array
// //
glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_VERTEX_ARRAY);
#if ASSIMP_DOUBLE_PRECISION
glVertexPointer(3, GL_DOUBLE, 0, mesh_cur.mVertices);
#else
glVertexPointer(3, GL_FLOAT, 0, mesh_cur.mVertices); glVertexPointer(3, GL_FLOAT, 0, mesh_cur.mVertices);
#endif // ASSIMP_DOUBLE_PRECISION
if(mesh_cur.HasVertexColors(0)) if(mesh_cur.HasVertexColors(0))
{ {
glEnable(GL_COLOR_MATERIAL);///TODO: cache glEnable(GL_COLOR_MATERIAL);///TODO: cache
glEnableClientState(GL_COLOR_ARRAY); glEnableClientState(GL_COLOR_ARRAY);
#if ASSIMP_DOUBLE_PRECISION
glColorPointer(4, GL_DOUBLE, 0, mesh_cur.mColors[0]);
#else
glColorPointer(4, GL_FLOAT, 0, mesh_cur.mColors[0]); glColorPointer(4, GL_FLOAT, 0, mesh_cur.mColors[0]);
#endif // ASSIMP_DOUBLE_PRECISION
} }
// //
@ -488,7 +531,11 @@ void CGLView::Draw_Mesh(const size_t pMesh_Index)
if(mesh_cur.HasTextureCoords(0)) if(mesh_cur.HasTextureCoords(0))
{ {
glEnableClientState(GL_TEXTURE_COORD_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY);
#if ASSIMP_DOUBLE_PRECISION
glTexCoordPointer(2, GL_DOUBLE, sizeof(aiVector3D), mesh_cur.mTextureCoords[0]);
#else
glTexCoordPointer(2, GL_FLOAT, sizeof(aiVector3D), mesh_cur.mTextureCoords[0]); glTexCoordPointer(2, GL_FLOAT, sizeof(aiVector3D), mesh_cur.mTextureCoords[0]);
#endif // ASSIMP_DOUBLE_PRECISION
} }
// //
@ -497,7 +544,11 @@ void CGLView::Draw_Mesh(const size_t pMesh_Index)
if(mesh_cur.HasNormals()) if(mesh_cur.HasNormals())
{ {
glEnableClientState(GL_NORMAL_ARRAY); glEnableClientState(GL_NORMAL_ARRAY);
#if ASSIMP_DOUBLE_PRECISION
glNormalPointer(GL_DOUBLE, 0, mesh_cur.mNormals);
#else
glNormalPointer(GL_FLOAT, 0, mesh_cur.mNormals); glNormalPointer(GL_FLOAT, 0, mesh_cur.mNormals);
#endif // ASSIMP_DOUBLE_PRECISION
} }
// //
@ -530,22 +581,46 @@ void CGLView::Draw_BBox(const SBBox& pBBox)
glBindTexture(GL_TEXTURE_1D, 0); glBindTexture(GL_TEXTURE_1D, 0);
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
glBindTexture(GL_TEXTURE_3D, 0); glBindTexture(GL_TEXTURE_3D, 0);
#if ASSIMP_QT4_VIEWER
qglColor(QColor(Qt::white)); qglColor(QColor(Qt::white));
#else
const QColor c_w(Qt::white);
glColor3f(c_w.redF(), c_w.greenF(), c_w.blueF());
#endif // ASSIMP_QT4_VIEWER
glBegin(GL_LINE_STRIP); glBegin(GL_LINE_STRIP);
# if ASSIMP_DOUBLE_PRECISION
glVertex3dv(&vertex[0][0]), glVertex3dv(&vertex[1][0]), glVertex3dv(&vertex[2][0]), glVertex3dv(&vertex[3][0]), glVertex3dv(&vertex[0][0]);// "Minimum" side.
glVertex3dv(&vertex[4][0]), glVertex3dv(&vertex[5][0]), glVertex3dv(&vertex[6][0]), glVertex3dv(&vertex[7][0]), glVertex3dv(&vertex[4][0]);// Edge and "maximum" side.
# else
glVertex3fv(&vertex[0][0]), glVertex3fv(&vertex[1][0]), glVertex3fv(&vertex[2][0]), glVertex3fv(&vertex[3][0]), glVertex3fv(&vertex[0][0]);// "Minimum" side. glVertex3fv(&vertex[0][0]), glVertex3fv(&vertex[1][0]), glVertex3fv(&vertex[2][0]), glVertex3fv(&vertex[3][0]), glVertex3fv(&vertex[0][0]);// "Minimum" side.
glVertex3fv(&vertex[4][0]), glVertex3fv(&vertex[5][0]), glVertex3fv(&vertex[6][0]), glVertex3fv(&vertex[7][0]), glVertex3fv(&vertex[4][0]);// Edge and "maximum" side. glVertex3fv(&vertex[4][0]), glVertex3fv(&vertex[5][0]), glVertex3fv(&vertex[6][0]), glVertex3fv(&vertex[7][0]), glVertex3fv(&vertex[4][0]);// Edge and "maximum" side.
# endif // ASSIMP_DOUBLE_PRECISION
glEnd(); glEnd();
glBegin(GL_LINES); glBegin(GL_LINES);
# if ASSIMP_DOUBLE_PRECISION
glVertex3dv(&vertex[1][0]), glVertex3dv(&vertex[5][0]);
glVertex3dv(&vertex[2][0]), glVertex3dv(&vertex[6][0]);
glVertex3dv(&vertex[3][0]), glVertex3dv(&vertex[7][0]);
# else
glVertex3fv(&vertex[1][0]), glVertex3fv(&vertex[5][0]); glVertex3fv(&vertex[1][0]), glVertex3fv(&vertex[5][0]);
glVertex3fv(&vertex[2][0]), glVertex3fv(&vertex[6][0]); glVertex3fv(&vertex[2][0]), glVertex3fv(&vertex[6][0]);
glVertex3fv(&vertex[3][0]), glVertex3fv(&vertex[7][0]); glVertex3fv(&vertex[3][0]), glVertex3fv(&vertex[7][0]);
# endif // ASSIMP_DOUBLE_PRECISION
glEnd(); glEnd();
glDisable(GL_COLOR_MATERIAL); glDisable(GL_COLOR_MATERIAL);
if(mLightingEnabled) glEnable(GL_LIGHTING); if(mLightingEnabled) glEnable(GL_LIGHTING);
} }
void CGLView::Enable_Textures(const bool pEnable) void CGLView::Enable_Textures(const bool pEnable)
{ {
#if !ASSIMP_QT4_VIEWER
ConditionalContextControl_Begin;
#endif // ASSIMP_QT4_VIEWER
if(pEnable) if(pEnable)
{ {
glEnable(GL_TEXTURE_1D); glEnable(GL_TEXTURE_1D);
@ -558,30 +633,10 @@ void CGLView::Enable_Textures(const bool pEnable)
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
glDisable(GL_TEXTURE_3D); glDisable(GL_TEXTURE_3D);
} }
}
void CGLView::Enable_Axes(const bool pEnable){ #if !ASSIMP_QT4_VIEWER
if(pEnable) ConditionalContextControl_End;
{ #endif // ASSIMP_QT4_VIEWER
this->mAxesEnabled = true;
}
else
{
this->mAxesEnabled = false;
}
}
void CGLView::Enable_Reload_Textures(const bool pEnable)
{
if(pEnable)
{
this->mReloadTexturesEnabled = true;
// this->mScene->ImportTextures(this->mScene->pScenePath);
}
else
{
this->mReloadTexturesEnabled = false;
}
} }
/********************************************************************/ /********************************************************************/
@ -590,7 +645,13 @@ void CGLView::Enable_Reload_Textures(const bool pEnable)
void CGLView::initializeGL() void CGLView::initializeGL()
{ {
#if ASSIMP_QT4_VIEWER
qglClearColor(Qt::gray); qglClearColor(Qt::gray);
#else
mGLContext_Current = true;
initializeOpenGLFunctions();
glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
#endif // ASSIMP_QT4_VIEWER
glShadeModel(GL_SMOOTH); glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
@ -607,23 +668,38 @@ void CGLView::initializeGL()
glCullFace(GL_BACK); glCullFace(GL_BACK);
glFrontFace(GL_CCW); glFrontFace(GL_CCW);
#if !ASSIMP_QT4_VIEWER
mGLContext_Current = false;
#endif // ASSIMP_QT4_VIEWER
} }
void CGLView::resizeGL(int pWidth, int pHeight) void CGLView::resizeGL(int pWidth, int pHeight)
{ {
#if !ASSIMP_QT4_VIEWER
mGLContext_Current = true;
#endif // ASSIMP_QT4_VIEWER
mCamera_Viewport_AspectRatio = (GLdouble)pWidth / pHeight; mCamera_Viewport_AspectRatio = (GLdouble)pWidth / pHeight;
glViewport(0, 0, pWidth, pHeight); glViewport(0, 0, pWidth, pHeight);
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glLoadIdentity(); glLoadIdentity();
gluPerspective(mCamera_FOVY, mCamera_Viewport_AspectRatio, 1.0, 100000.0);///TODO: znear/zfar depend on scene size. gluPerspective(mCamera_FOVY, mCamera_Viewport_AspectRatio, 1.0, 100000.0);///TODO: znear/zfar depend on scene size.
#if !ASSIMP_QT4_VIEWER
mGLContext_Current = false;
#endif // ASSIMP_QT4_VIEWER
} }
void CGLView::drawCoordSystem() { void CGLView::drawCoordSystem() {
// Disable lighting. Colors must be bright and colorful)
if ( mLightingEnabled ) glDisable( GL_LIGHTING );///TODO: display list
// For same reason - disable textures.
glBindTexture(GL_TEXTURE_1D, 0); glBindTexture(GL_TEXTURE_1D, 0);
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
glBindTexture(GL_TEXTURE_3D, 0); glBindTexture(GL_TEXTURE_3D, 0);
glEnable(GL_COLOR_MATERIAL); glEnable(GL_COLOR_MATERIAL);
glBegin(GL_LINES); glBegin(GL_LINES);
#if ASSIMP_QT4_VIEWER
// X, -X // X, -X
qglColor(QColor(Qt::red)), glVertex3f(0.0, 0.0, 0.0), glVertex3f(100000.0, 0.0, 0.0); qglColor(QColor(Qt::red)), glVertex3f(0.0, 0.0, 0.0), glVertex3f(100000.0, 0.0, 0.0);
qglColor(QColor(Qt::cyan)), glVertex3f(0.0, 0.0, 0.0), glVertex3f(-100000.0, 0.0, 0.0); qglColor(QColor(Qt::cyan)), glVertex3f(0.0, 0.0, 0.0), glVertex3f(-100000.0, 0.0, 0.0);
@ -634,11 +710,30 @@ void CGLView::drawCoordSystem() {
qglColor(QColor(Qt::blue)), glVertex3f(0.0, 0.0, 0.0), glVertex3f(0.0, 0.0, 100000.0); qglColor(QColor(Qt::blue)), glVertex3f(0.0, 0.0, 0.0), glVertex3f(0.0, 0.0, 100000.0);
qglColor(QColor(Qt::yellow)), glVertex3f(0.0, 0.0, 0.0), glVertex3f(0.0, 0.0, -100000.0); qglColor(QColor(Qt::yellow)), glVertex3f(0.0, 0.0, 0.0), glVertex3f(0.0, 0.0, -100000.0);
qglColor(QColor(Qt::white)); qglColor(QColor(Qt::white));
#else
// X, -X
glColor3f(1.0f, 0.0f, 0.0f), glVertex3f(0.0, 0.0, 0.0), glVertex3f(100000.0, 0.0, 0.0);
glColor3f(0.5f, 0.5f, 1.0f), glVertex3f(0.0, 0.0, 0.0), glVertex3f(-100000.0, 0.0, 0.0);
// Y, -Y
glColor3f(0.0f, 1.0f, 0.0f), glVertex3f(0.0, 0.0, 0.0), glVertex3f(0.0, 100000.0, 0.0);
glColor3f(1.0f, 0.0f, 1.0f), glVertex3f(0.0, 0.0, 0.0), glVertex3f(0.0, -100000.0, 0.0);
// Z, -Z
glColor3f(0.0f, 0.0f, 1.0f), glVertex3f(0.0, 0.0, 0.0), glVertex3f(0.0, 0.0, 100000.0);
glColor3f(1.0f, 1.0f, 0.0f), glVertex3f(0.0, 0.0, 0.0), glVertex3f(0.0, 0.0, -100000.0);
glColor3f(1.0f, 1.0f, 1.0f);
#endif // ASSIMP_QT4_VIEWER
glEnd(); glEnd();
// Restore previous state of lighting.
if(mLightingEnabled) glEnable(GL_LIGHTING);
} }
void CGLView::paintGL() void CGLView::paintGL()
{ {
#if !ASSIMP_QT4_VIEWER
mGLContext_Current = true;
#endif // ASSIMP_QT4_VIEWER
QTime time_paintbegin; QTime time_paintbegin;
time_paintbegin = QTime::currentTime(); time_paintbegin = QTime::currentTime();
@ -647,30 +742,36 @@ void CGLView::paintGL()
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
glLoadIdentity(); glLoadIdentity();
// Apply current camera transformations. // Apply current camera transformations.
#if ASSIMP_DOUBLE_PRECISION
glMultMatrixd((GLdouble*)&mHelper_Camera.Rotation_AroundCamera);
glTranslated(-mHelper_Camera.Translation_ToScene.x, -mHelper_Camera.Translation_ToScene.y, -mHelper_Camera.Translation_ToScene.z);
glMultMatrixd((GLdouble*)&mHelper_Camera.Rotation_Scene);
#else
glMultMatrixf((GLfloat*)&mHelper_Camera.Rotation_AroundCamera); glMultMatrixf((GLfloat*)&mHelper_Camera.Rotation_AroundCamera);
glTranslatef(-mHelper_Camera.Translation_ToScene.x, -mHelper_Camera.Translation_ToScene.y, -mHelper_Camera.Translation_ToScene.z); glTranslatef(-mHelper_Camera.Translation_ToScene.x, -mHelper_Camera.Translation_ToScene.y, -mHelper_Camera.Translation_ToScene.z);
glMultMatrixf((GLfloat*)&mHelper_Camera.Rotation_Scene); glMultMatrixf((GLfloat*)&mHelper_Camera.Rotation_Scene);
#endif // ASSIMP_DOUBLE_PRECISION
// Coordinate system // Coordinate system
if ( mLightingEnabled ) { if (mScene_AxesEnabled == true)
glDisable( GL_LIGHTING );///TODO: display list
}
if (this->mAxesEnabled == true)
{ {
drawCoordSystem(); drawCoordSystem();
} }
glDisable(GL_COLOR_MATERIAL); glDisable(GL_COLOR_MATERIAL);
if(mLightingEnabled) glEnable(GL_LIGHTING);
// Scene // Scene
if(mScene != nullptr) if(mScene != nullptr)
{ {
Draw_Node(mScene->mRootNode); Draw_Node(mScene->mRootNode);
// Scene BBox // Scene BBox
if(mScene_DrawBBox) Draw_BBox(mScene_BBox); if(mScene_DrawBBox) Draw_BBox(mScene_BBox);
} }
emit Paint_Finished((size_t)time_paintbegin.msecsTo(QTime::currentTime()), mHelper_Camera.Translation_ToScene.Length()); emit Paint_Finished((size_t)time_paintbegin.msecsTo(QTime::currentTime()), mHelper_Camera.Translation_ToScene.Length());
#if !ASSIMP_QT4_VIEWER
mGLContext_Current = false;
#endif // ASSIMP_QT4_VIEWER
} }
/********************************************************************/ /********************************************************************/
@ -678,10 +779,12 @@ void CGLView::paintGL()
/********************************************************************/ /********************************************************************/
CGLView::CGLView(QWidget *pParent) CGLView::CGLView(QWidget *pParent)
#if ASSIMP_QT4_VIEWER
: QGLWidget(QGLFormat(QGL::DoubleBuffer | QGL::DepthBuffer), pParent) : QGLWidget(QGLFormat(QGL::DoubleBuffer | QGL::DepthBuffer), pParent)
#else
: QOpenGLWidget(pParent), mGLContext_Current(false)
#endif // ASSIMP_QT4_VIEWER
{ {
static_assert(sizeof(GLfloat) == sizeof(ai_real), "ai_real in Assimp must be equal to GLfloat/float.");///TODO: may be templates can be used.
// set initial view // set initial view
mHelper_CameraDefault.SetDefault(); mHelper_CameraDefault.SetDefault();
Camera_Set(0); Camera_Set(0);
@ -698,6 +801,10 @@ CGLView::~CGLView()
void CGLView::FreeScene() void CGLView::FreeScene()
{ {
#if !ASSIMP_QT4_VIEWER
ConditionalContextControl_Begin;
#endif // ASSIMP_QT4_VIEWER
// Set scene to null and after that \ref paintGL will not try to render it. // Set scene to null and after that \ref paintGL will not try to render it.
mScene = nullptr; mScene = nullptr;
// Clean helper objects. // Clean helper objects.
@ -727,10 +834,18 @@ void CGLView::FreeScene()
mTexture_IDMap.clear(); mTexture_IDMap.clear();
delete [] id_tex; delete [] id_tex;
} }
#if !ASSIMP_QT4_VIEWER
ConditionalContextControl_End;
#endif // ASSIMP_QT4_VIEWER
} }
void CGLView::SetScene(const aiScene *pScene, const QString& pScenePath) void CGLView::SetScene(const aiScene *pScene, const QString& pScenePath)
{ {
#if !ASSIMP_QT4_VIEWER
ConditionalContextControl_Begin;
#endif // ASSIMP_QT4_VIEWER
FreeScene();// Clear old data FreeScene();// Clear old data
// Why checking here, not at begin of function. Because old scene may not exist at know. So, need cleanup. // Why checking here, not at begin of function. Because old scene may not exist at know. So, need cleanup.
if(pScene == nullptr) return; if(pScene == nullptr) return;
@ -957,6 +1072,10 @@ void CGLView::SetScene(const aiScene *pScene, const QString& pScenePath)
emit SceneObject_Camera(mScene->mCameras[idx_cam]->mName.C_Str()); emit SceneObject_Camera(mScene->mCameras[idx_cam]->mName.C_Str());
} }
}// if(!mScene->HasCameras()) else }// if(!mScene->HasCameras()) else
#if !ASSIMP_QT4_VIEWER
ConditionalContextControl_End;
#endif // ASSIMP_QT4_VIEWER
} }
/********************************************************************/ /********************************************************************/
@ -965,39 +1084,65 @@ void CGLView::SetScene(const aiScene *pScene, const QString& pScenePath)
void CGLView::Lighting_Enable() void CGLView::Lighting_Enable()
{ {
#if !ASSIMP_QT4_VIEWER
ConditionalContextControl_Begin;
#endif // ASSIMP_QT4_VIEWER
mLightingEnabled = true; mLightingEnabled = true;
glEnable(GL_LIGHTING); glEnable(GL_LIGHTING);
#if !ASSIMP_QT4_VIEWER
ConditionalContextControl_End;
#endif // ASSIMP_QT4_VIEWER
} }
void CGLView::Lighting_Disable() void CGLView::Lighting_Disable()
{ {
#if !ASSIMP_QT4_VIEWER
ConditionalContextControl_Begin;
#endif // ASSIMP_QT4_VIEWER
glDisable(GL_LIGHTING); glDisable(GL_LIGHTING);
mLightingEnabled = false; mLightingEnabled = false;
#if !ASSIMP_QT4_VIEWER
ConditionalContextControl_End;
#endif // ASSIMP_QT4_VIEWER
} }
void CGLView::Lighting_EditSource(const size_t pLightNumber, const SLightParameters& pLightParameters) void CGLView::Lighting_EditSource(const size_t pLightNumber, const SLightParameters& pLightParameters)
{ {
#if !ASSIMP_QT4_VIEWER
ConditionalContextControl_Begin;
#endif // ASSIMP_QT4_VIEWER
const size_t light_num = GL_LIGHT0 + pLightNumber; const size_t light_num = GL_LIGHT0 + pLightNumber;
GLfloat farr[4]; GLfloat farr[4];
if(pLightNumber >= GL_MAX_LIGHTS) return;///TODO: return value; if(pLightNumber >= GL_MAX_LIGHTS) return;///TODO: return value;
glLightfv(light_num, GL_AMBIENT, &pLightParameters.Ambient.r);// Ambient color // Ambient color
glLightfv(light_num, GL_DIFFUSE, &pLightParameters.Diffuse.r);// Diffuse color farr[0] = pLightParameters.Ambient.r, farr[1] = pLightParameters.Ambient.g; farr[2] = pLightParameters.Ambient.b; farr[3] = pLightParameters.Ambient.a;
glLightfv(light_num, GL_SPECULAR, &pLightParameters.Specular.r);// Specular color glLightfv(light_num, GL_AMBIENT, farr);
// Diffuse color
farr[0] = pLightParameters.Diffuse.r, farr[1] = pLightParameters.Diffuse.g; farr[2] = pLightParameters.Diffuse.b; farr[3] = pLightParameters.Diffuse.a;
glLightfv(light_num, GL_DIFFUSE, farr);
// Specular color
farr[0] = pLightParameters.Specular.r, farr[1] = pLightParameters.Specular.g; farr[2] = pLightParameters.Specular.b; farr[3] = pLightParameters.Specular.a;
glLightfv(light_num, GL_SPECULAR, farr);
// Other parameters // Other parameters
switch(pLightParameters.Type) switch(pLightParameters.Type)
{ {
case aiLightSource_DIRECTIONAL: case aiLightSource_DIRECTIONAL:
// Direction // Direction
farr[0] = pLightParameters.For.Directional.Direction.x, farr[2] = pLightParameters.For.Directional.Direction.y; farr[0] = pLightParameters.For.Directional.Direction.x, farr[1] = pLightParameters.For.Directional.Direction.y;
farr[2] = pLightParameters.For.Directional.Direction.z; farr[3] = 0; farr[2] = pLightParameters.For.Directional.Direction.z; farr[3] = 0;
glLightfv(light_num, GL_POSITION, farr); glLightfv(light_num, GL_POSITION, farr);
break; break;
case aiLightSource_POINT: case aiLightSource_POINT:
// Position // Position
farr[0] = pLightParameters.For.Point.Position.x, farr[2] = pLightParameters.For.Point.Position.y; farr[0] = pLightParameters.For.Point.Position.x, farr[1] = pLightParameters.For.Point.Position.y;
farr[2] = pLightParameters.For.Point.Position.z; farr[3] = 1; farr[2] = pLightParameters.For.Point.Position.z; farr[3] = 1;
glLightfv(light_num, GL_POSITION, farr); glLightfv(light_num, GL_POSITION, farr);
// Attenuation // Attenuation
@ -1008,20 +1153,20 @@ GLfloat farr[4];
break; break;
case aiLightSource_SPOT: case aiLightSource_SPOT:
// Position // Position
farr[0] = pLightParameters.For.Spot.Position.x, farr[2] = pLightParameters.For.Spot.Position.y, farr[2] = pLightParameters.For.Spot.Position.z; farr[3] = 1; farr[0] = pLightParameters.For.Spot.Position.x, farr[1] = pLightParameters.For.Spot.Position.y, farr[2] = pLightParameters.For.Spot.Position.z; farr[3] = 1;
glLightfv(light_num, GL_POSITION, farr); glLightfv(light_num, GL_POSITION, farr);
// Attenuation // Attenuation
glLightf(light_num, GL_CONSTANT_ATTENUATION, pLightParameters.For.Spot.Attenuation_Constant); glLightf(light_num, GL_CONSTANT_ATTENUATION, pLightParameters.For.Spot.Attenuation_Constant);
glLightf(light_num, GL_LINEAR_ATTENUATION, pLightParameters.For.Spot.Attenuation_Linear); glLightf(light_num, GL_LINEAR_ATTENUATION, pLightParameters.For.Spot.Attenuation_Linear);
glLightf(light_num, GL_QUADRATIC_ATTENUATION, pLightParameters.For.Spot.Attenuation_Quadratic); glLightf(light_num, GL_QUADRATIC_ATTENUATION, pLightParameters.For.Spot.Attenuation_Quadratic);
// Spot specific // Spot specific
farr[0] = pLightParameters.For.Spot.Direction.x, farr[2] = pLightParameters.For.Spot.Direction.y, farr[2] = pLightParameters.For.Spot.Direction.z; farr[3] = 0; farr[0] = pLightParameters.For.Spot.Direction.x, farr[1] = pLightParameters.For.Spot.Direction.y, farr[2] = pLightParameters.For.Spot.Direction.z; farr[3] = 0;
glLightfv(light_num, GL_SPOT_DIRECTION, farr); glLightfv(light_num, GL_SPOT_DIRECTION, farr);
glLightf(light_num, GL_SPOT_CUTOFF, pLightParameters.For.Spot.CutOff); glLightf(light_num, GL_SPOT_CUTOFF, pLightParameters.For.Spot.CutOff);
break; break;
default:// For unknown light source types use point source. default:// For unknown light source types use point source.
// Position // Position
farr[0] = pLightParameters.For.Point.Position.x, farr[2] = pLightParameters.For.Point.Position.y; farr[0] = pLightParameters.For.Point.Position.x, farr[1] = pLightParameters.For.Point.Position.y;
farr[2] = pLightParameters.For.Point.Position.z; farr[3] = 1; farr[2] = pLightParameters.For.Point.Position.z; farr[3] = 1;
glLightfv(light_num, GL_POSITION, farr); glLightfv(light_num, GL_POSITION, farr);
// Attenuation // Attenuation
@ -1031,20 +1176,40 @@ GLfloat farr[4];
glLightf(light_num, GL_SPOT_CUTOFF, 180.0); glLightf(light_num, GL_SPOT_CUTOFF, 180.0);
break; break;
}// switch(pLightParameters.Type) }// switch(pLightParameters.Type)
#if !ASSIMP_QT4_VIEWER
ConditionalContextControl_End;
#endif // ASSIMP_QT4_VIEWER
} }
void CGLView::Lighting_EnableSource(const size_t pLightNumber) void CGLView::Lighting_EnableSource(const size_t pLightNumber)
{ {
#if !ASSIMP_QT4_VIEWER
ConditionalContextControl_Begin;
#endif // ASSIMP_QT4_VIEWER
if(pLightNumber >= GL_MAX_LIGHTS) return;///TODO: return value; if(pLightNumber >= GL_MAX_LIGHTS) return;///TODO: return value;
glEnable(GL_LIGHT0 + pLightNumber); glEnable(GL_LIGHT0 + pLightNumber);
#if !ASSIMP_QT4_VIEWER
ConditionalContextControl_End;
#endif // ASSIMP_QT4_VIEWER
} }
void CGLView::Lighting_DisableSource(const size_t pLightNumber) void CGLView::Lighting_DisableSource(const size_t pLightNumber)
{ {
#if !ASSIMP_QT4_VIEWER
ConditionalContextControl_Begin;
#endif // ASSIMP_QT4_VIEWER
if(pLightNumber >= GL_MAX_LIGHTS) return;///TODO: return value; if(pLightNumber >= GL_MAX_LIGHTS) return;///TODO: return value;
glDisable(GL_LIGHT0 + pLightNumber); glDisable(GL_LIGHT0 + pLightNumber);
#if !ASSIMP_QT4_VIEWER
ConditionalContextControl_End;
#endif // ASSIMP_QT4_VIEWER
} }
/********************************************************************/ /********************************************************************/
@ -1096,23 +1261,29 @@ void CGLView::Camera_Set(const size_t pCameraNumber)
gluLookAt(hcam.Position.x, hcam.Position.y, hcam.Position.z, hcam.Target.x, hcam.Target.y, hcam.Target.z, up.x, up.y, up.z); gluLookAt(hcam.Position.x, hcam.Position.y, hcam.Position.z, hcam.Target.x, hcam.Target.y, hcam.Target.z, up.x, up.y, up.z);
} }
void CGLView::Camera_RotateScene(const GLfloat pAngle_X, const GLfloat pAngle_Y, const GLfloat pAngle_Z) void CGLView::Camera_RotateScene(const GLfloat pAngle_X, const GLfloat pAngle_Y, const GLfloat pAngle_Z, const aiMatrix4x4* pMatrix_Rotation_Initial)
{ {
auto deg2rad = [](const GLfloat pDegree) -> GLfloat { return pDegree * M_PI / 180.0; }; auto deg2rad = [](const GLfloat pDegree) -> GLfloat { return pDegree * M_PI / 180.0; };
aiMatrix4x4 mat_rot; aiMatrix4x4 mat_rot;
mat_rot.FromEulerAnglesXYZ(deg2rad(pAngle_X), deg2rad(pAngle_Y), deg2rad(pAngle_Z)); mat_rot.FromEulerAnglesXYZ(deg2rad(pAngle_X), deg2rad(pAngle_Y), deg2rad(pAngle_Z));
if(pMatrix_Rotation_Initial != nullptr)
mHelper_Camera.Rotation_Scene = *pMatrix_Rotation_Initial * mat_rot;
else
mHelper_Camera.Rotation_Scene *= mat_rot; mHelper_Camera.Rotation_Scene *= mat_rot;
} }
void CGLView::Camera_Rotate(const GLfloat pAngle_X, const GLfloat pAngle_Y, const GLfloat pAngle_Z) void CGLView::Camera_Rotate(const GLfloat pAngle_X, const GLfloat pAngle_Y, const GLfloat pAngle_Z, const aiMatrix4x4* pMatrix_Rotation_Initial)
{ {
auto deg2rad = [](const GLfloat pDegree) -> GLfloat { return pDegree * M_PI / 180.0; }; auto deg2rad = [](const GLfloat pDegree) -> GLfloat { return pDegree * M_PI / 180.0; };
aiMatrix4x4 mat_rot; aiMatrix4x4 mat_rot;
mat_rot.FromEulerAnglesXYZ(deg2rad(pAngle_X), deg2rad(pAngle_Y), deg2rad(pAngle_Z)); mat_rot.FromEulerAnglesXYZ(deg2rad(pAngle_X), deg2rad(pAngle_Y), deg2rad(pAngle_Z));
if(pMatrix_Rotation_Initial != nullptr)
mHelper_Camera.Rotation_AroundCamera = *pMatrix_Rotation_Initial * mat_rot;
else
mHelper_Camera.Rotation_AroundCamera *= mat_rot; mHelper_Camera.Rotation_AroundCamera *= mat_rot;
} }
@ -1123,3 +1294,10 @@ aiVector3D vect_tr(pTranslate_X, pTranslate_Y, pTranslate_Z);
vect_tr *= mHelper_Camera.Rotation_AroundCamera; vect_tr *= mHelper_Camera.Rotation_AroundCamera;
mHelper_Camera.Translation_ToScene += vect_tr; mHelper_Camera.Translation_ToScene += vect_tr;
} }
void CGLView::Camera_Matrix(aiMatrix4x4& pRotation_Camera, aiMatrix4x4& pRotation_Scene, aiVector3D& pTranslation_Camera)
{
pRotation_Camera = mHelper_Camera.Rotation_AroundCamera;
pRotation_Scene = mHelper_Camera.Rotation_Scene;
pTranslation_Camera = mHelper_Camera.Translation_ToScene;
}

View File

@ -6,14 +6,24 @@
#pragma once #pragma once
// Header files, Qt. // Header files, Qt.
#include <QtOpenGL> #include <QMap>
#if ASSIMP_QT4_VIEWER
# include <QtOpenGL>
#else
# include <QOpenGLWidget>
# include <QOpenGLFunctions>
#endif // ASSIMP_QT4_VIEWER
// Header files Assimp // Header files Assimp
#include <assimp/scene.h> #include <assimp/scene.h>
/// \class CGLView /// \class CGLView
/// Class which hold and render scene. /// Class which hold and render scene.
#if ASSIMP_QT4_VIEWER
class CGLView : public QGLWidget class CGLView : public QGLWidget
#else
class CGLView : public QOpenGLWidget, protected QOpenGLFunctions
#endif // ASSIMP_QT4_VIEWER
{ {
Q_OBJECT Q_OBJECT
@ -75,9 +85,7 @@ private:
}; };
public: public:
bool mAxesEnabled = true;
// Textures
bool mReloadTexturesEnabled = false; // If true then textures will reload when the window is activated.
/// \enum ELightType /// \enum ELightType
/// Type of light source. /// Type of light source.
enum class ELightType { Directional, Point, Spot }; enum class ELightType { Directional, Point, Spot };
@ -141,11 +149,16 @@ public:
private: private:
#if !ASSIMP_QT4_VIEWER
// Qt5 widget has another behavior, so you must to know that you already made context are current. Yes, its a dirty hack. Better decision are welcome.
bool mGLContext_Current;///< Widget's GL-context made current.
#endif // ASSIMP_QT4_VIEWER
// Scene // Scene
const aiScene* mScene = nullptr;///< Copy of pointer to scene (\ref aiScene). const aiScene* mScene = nullptr;///< Copy of pointer to scene (\ref aiScene).
SBBox mScene_BBox;///< Bounding box of scene. SBBox mScene_BBox;///< Bounding box of scene.
aiVector3D mScene_Center;///< Coordinates of center of the scene. aiVector3D mScene_Center;///< Coordinates of center of the scene.
bool mScene_DrawBBox = false;///< Flag which control drawing scene BBox. bool mScene_DrawBBox = false;///< Flag which control drawing scene BBox.
bool mScene_AxesEnabled = true;///< Flag which control drawing axes of the coordinate system.
// Meshes // Meshes
size_t mHelper_Mesh_Quantity = 0;///< Quantity of meshes in scene. size_t mHelper_Mesh_Quantity = 0;///< Quantity of meshes in scene.
SHelper_Mesh** mHelper_Mesh = nullptr;///< Array of pointers to helper objects for drawing mesh. Sequence of meshes are equivalent to \ref aiScene::mMeshes. SHelper_Mesh** mHelper_Mesh = nullptr;///< Array of pointers to helper objects for drawing mesh. Sequence of meshes are equivalent to \ref aiScene::mMeshes.
@ -254,7 +267,11 @@ private:
/********************************************************************/ /********************************************************************/
protected: protected:
/// \fn void drawCoordSystem()
/// Draw axes of the coordinate system.
void drawCoordSystem(); void drawCoordSystem();
/// \fn void initializeGL() override /// \fn void initializeGL() override
/// Override function to initialise OpenGL. /// Override function to initialise OpenGL.
void initializeGL() override; void initializeGL() override;
@ -307,11 +324,10 @@ public:
/// \param [in] pEnable - if true then enable textures, false - disable textures. /// \param [in] pEnable - if true then enable textures, false - disable textures.
void Enable_Textures(const bool pEnable); void Enable_Textures(const bool pEnable);
void Enable_Axes(const bool pEnable); /// \fn void Enable_Axes(const bool pEnable)
/// \fn void Enable_Textures(const bool pEnable) /// Control axes drawing.
/// Control textures drawing. /// \param [in] pEnable - if true then enable axes, false - disable axes.
/// \param [in] pEnable - if true then enable textures, false - disable textures. void Enable_Axes(const bool pEnable) { this->mScene_AxesEnabled = pEnable; }
void Enable_Reload_Textures(const bool pEnable);
/********************************************************************/ /********************************************************************/
/******************** Lighting control functions ********************/ /******************** Lighting control functions ********************/
@ -350,19 +366,23 @@ public:
/// \param [in] pCamera_Index - index of the camera (\ref aiScene::mCameras). /// \param [in] pCamera_Index - index of the camera (\ref aiScene::mCameras).
void Camera_Set(const size_t pCameraNumber); void Camera_Set(const size_t pCameraNumber);
/// \fn void Camera_RotateScene(const GLfloat pAngle_X, const GLfloat pAngle_Y, const GLfloat pAngle_Z) /// \fn void Camera_RotateScene(const GLfloat pAngle_X, const GLfloat pAngle_Y, const GLfloat pAngle_Z, const aiMatrix4x4* pMatrix_Rotation_Initial)
/// Rotate scene around axisees. /// Rotate scene around axisees.
/// \param [in] pAngle_X - specifies the angle of rotation around axis oX, in degrees. /// \param [in] pAngle_X - specifies the angle of rotation around axis oX, in degrees.
/// \param [in] pAngle_Y - specifies the angle of rotation around axis oY, in degrees. /// \param [in] pAngle_Y - specifies the angle of rotation around axis oY, in degrees.
/// \param [in] pAngle_Z - specifies the angle of rotation around axis oZ, in degrees. /// \param [in] pAngle_Z - specifies the angle of rotation around axis oZ, in degrees.
void Camera_RotateScene(const GLfloat pAngle_X, const GLfloat pAngle_Y, const GLfloat pAngle_Z); /// \param [in] pMatrix_Rotation_Initial - matrix from which calculates new transformation matrix. If not set (equal to nullptr) then current transformation matrix
/// will be used.
void Camera_RotateScene(const GLfloat pAngle_X, const GLfloat pAngle_Y, const GLfloat pAngle_Z, const aiMatrix4x4* pMatrix_Rotation_Initial = nullptr);
/// \fn void Camera_Rotate(const GLfloat pAngle_X, const GLfloat pAngle_Y, const GLfloat pAngle_Z) /// \fn void Camera_Rotate(const GLfloat pAngle_X, const GLfloat pAngle_Y, const GLfloat pAngle_Z, const aiMatrix4x4* pMatrix_Rotation_Initial = nullptr)
/// Rotate camera around axisees. /// Rotate camera around axisees.
/// \param [in] pAngle_X - specifies the angle of rotation around axis oX, in degrees. /// \param [in] pAngle_X - specifies the angle of rotation around axis oX, in degrees.
/// \param [in] pAngle_Y - specifies the angle of rotation around axis oY, in degrees. /// \param [in] pAngle_Y - specifies the angle of rotation around axis oY, in degrees.
/// \param [in] pAngle_Z - specifies the angle of rotation around axis oZ, in degrees. /// \param [in] pAngle_Z - specifies the angle of rotation around axis oZ, in degrees.
void Camera_Rotate(const GLfloat pAngle_X, const GLfloat pAngle_Y, const GLfloat pAngle_Z); /// \param [in] pMatrix_Rotation_Initial - matrix from which calculates new transformation matrix. If not set (equal to nullptr) then current transformation matrix
/// will be used.
void Camera_Rotate(const GLfloat pAngle_X, const GLfloat pAngle_Y, const GLfloat pAngle_Z, const aiMatrix4x4* pMatrix_Rotation_Initial = nullptr);
/// \fn void Camera_Translate(const size_t pTranslate_X, const size_t pTranslate_Y, const size_t pTranslate_Z) /// \fn void Camera_Translate(const size_t pTranslate_X, const size_t pTranslate_Y, const size_t pTranslate_Z)
/// Translate camera along axises. In local coordinates. /// Translate camera along axises. In local coordinates.
@ -371,6 +391,13 @@ public:
/// \param [in] pTranslate_Z - specifies the Z coordinate of translation vector. /// \param [in] pTranslate_Z - specifies the Z coordinate of translation vector.
void Camera_Translate(const GLfloat pTranslate_X, const GLfloat pTranslate_Y, const GLfloat pTranslate_Z); void Camera_Translate(const GLfloat pTranslate_X, const GLfloat pTranslate_Y, const GLfloat pTranslate_Z);
/// \fn void Camera_Matrix(aiMatrix4x4& pRotation_Camera, aiMatrix4x4& pRotation_Scene, aiVector3D& pTranslation_Camera)
/// Return data about camera position in world.
/// \param [out] pRotation_Camera - rotation matrix which set rotation angles of the scene around camera.
/// \param [out] pRotation_Scene - rotation matrix which set rotation angles of the scene around own center.
/// \param [out] pTranslation_Camera - translation vector from camera to the scene.
void Camera_Matrix(aiMatrix4x4& pRotation_Camera, aiMatrix4x4& pRotation_Scene, aiVector3D& pTranslation_Camera);
signals: signals:
/// \fn void Paint_Finished(const size_t pPaintTime, const GLfloat pDistance) /// \fn void Paint_Finished(const size_t pPaintTime, const GLfloat pDistance)

View File

@ -48,7 +48,7 @@ QTime time_begin = QTime::currentTime();
ui->cbxLighting->setChecked(true); mGLView->Lighting_Enable(); ui->cbxLighting->setChecked(true); mGLView->Lighting_Enable();
ui->cbxBBox->setChecked(false); mGLView->Enable_SceneBBox(false); ui->cbxBBox->setChecked(false); mGLView->Enable_SceneBBox(false);
ui->cbxTextures->setChecked(true); mGLView->Enable_Textures(true); ui->cbxTextures->setChecked(true); mGLView->Enable_Textures(true);
ui->cbxReloadTextures->setChecked(true); mGLView->Enable_Reload_Textures(false);
// //
// Fill info labels // Fill info labels
// //
@ -84,7 +84,11 @@ QTime time_begin = QTime::currentTime();
mGLView->Camera_Set(0); mGLView->Camera_Set(0);
// Scene is loaded, do first rendering. // Scene is loaded, do first rendering.
LogInfo("Scene is ready for rendering."); LogInfo("Scene is ready for rendering.");
#if ASSIMP_QT4_VIEWER
mGLView->updateGL(); mGLView->updateGL();
#else
mGLView->update();
#endif // ASSIMP_QT4_VIEWER
} }
else else
{ {
@ -128,40 +132,74 @@ void MainWindow::LogError(const QString& pMessage)
void MainWindow::mousePressEvent(QMouseEvent* pEvent) void MainWindow::mousePressEvent(QMouseEvent* pEvent)
{ {
const QPoint ms_pt = pEvent->pos();
__unused aiVector3D temp_v3;
// Check if GLView is pointed.
if(childAt(ms_pt) == mGLView)
{
if(!mMouse_Transformation.Position_Pressed_Valid)
{
mMouse_Transformation.Position_Pressed_Valid = true;// set flag
// Store current transformation matrices.
mGLView->Camera_Matrix(mMouse_Transformation.Rotation_AroundCamera, mMouse_Transformation.Rotation_Scene, temp_v3);
}
if(pEvent->button() & Qt::LeftButton) if(pEvent->button() & Qt::LeftButton)
mPosition_Pressed_LMB = pEvent->pos(); mMouse_Transformation.Position_Pressed_LMB = ms_pt;
else if(pEvent->button() & Qt::RightButton) else if(pEvent->button() & Qt::RightButton)
mPosition_Pressed_RMB = pEvent->pos(); mMouse_Transformation.Position_Pressed_RMB = ms_pt;
}
else
{
mMouse_Transformation.Position_Pressed_Valid = false;
}
}
void MainWindow::mouseReleaseEvent(QMouseEvent *pEvent)
{
if(pEvent->buttons() == 0) mMouse_Transformation.Position_Pressed_Valid = false;
} }
void MainWindow::mouseMoveEvent(QMouseEvent* pEvent) void MainWindow::mouseMoveEvent(QMouseEvent* pEvent)
{ {
if(mMouse_Transformation.Position_Pressed_Valid)
{
if(pEvent->buttons() & Qt::LeftButton) if(pEvent->buttons() & Qt::LeftButton)
{ {
GLfloat dx = 180 * GLfloat(pEvent->x() - mPosition_Pressed_LMB.x()) / mGLView->width(); GLfloat dx = 180 * GLfloat(pEvent->x() - mMouse_Transformation.Position_Pressed_LMB.x()) / mGLView->width();
GLfloat dy = 180 * GLfloat(pEvent->y() - mPosition_Pressed_LMB.y()) / mGLView->height(); GLfloat dy = 180 * GLfloat(pEvent->y() - mMouse_Transformation.Position_Pressed_LMB.y()) / mGLView->height();
if(pEvent->modifiers() & Qt::ShiftModifier) if(pEvent->modifiers() & Qt::ShiftModifier)
mGLView->Camera_RotateScene(dy, 0, dx);// Rotate around oX and oZ axises. mGLView->Camera_RotateScene(dy, 0, dx, &mMouse_Transformation.Rotation_Scene);// Rotate around oX and oZ axises.
else else
mGLView->Camera_RotateScene(dy, dx, 0);// Rotate around oX and oY axises. mGLView->Camera_RotateScene(dy, dx, 0, &mMouse_Transformation.Rotation_Scene);// Rotate around oX and oY axises.
#if ASSIMP_QT4_VIEWER
mGLView->updateGL(); mGLView->updateGL();
mPosition_Pressed_LMB = pEvent->pos(); #else
mGLView->update();
#endif // ASSIMP_QT4_VIEWER
} }
if(pEvent->buttons() & Qt::RightButton) if(pEvent->buttons() & Qt::RightButton)
{ {
GLfloat dx = 180 * GLfloat(pEvent->x() - mPosition_Pressed_RMB.x()) / mGLView->width(); GLfloat dx = 180 * GLfloat(pEvent->x() - mMouse_Transformation.Position_Pressed_RMB.x()) / mGLView->width();
GLfloat dy = 180 * GLfloat(pEvent->y() - mPosition_Pressed_RMB.y()) / mGLView->height(); GLfloat dy = 180 * GLfloat(pEvent->y() - mMouse_Transformation.Position_Pressed_RMB.y()) / mGLView->height();
if(pEvent->modifiers() & Qt::ShiftModifier) if(pEvent->modifiers() & Qt::ShiftModifier)
mGLView->Camera_Rotate(dy, 0, dx);// Rotate around oX and oZ axises. mGLView->Camera_Rotate(dy, 0, dx, &mMouse_Transformation.Rotation_AroundCamera);// Rotate around oX and oZ axises.
else else
mGLView->Camera_Rotate(dy, dx, 0);// Rotate around oX and oY axises. mGLView->Camera_Rotate(dy, dx, 0, &mMouse_Transformation.Rotation_AroundCamera);// Rotate around oX and oY axises.
#if ASSIMP_QT4_VIEWER
mGLView->updateGL(); mGLView->updateGL();
mPosition_Pressed_RMB = pEvent->pos(); #else
mGLView->update();
#endif // ASSIMP_QT4_VIEWER
}
} }
} }
@ -189,19 +227,16 @@ GLfloat step;
else if(pEvent->key() == Qt::Key_Down) else if(pEvent->key() == Qt::Key_Down)
mGLView->Camera_Translate(0, 0, step); mGLView->Camera_Translate(0, 0, step);
#if ASSIMP_QT4_VIEWER
mGLView->updateGL(); mGLView->updateGL();
#else
mGLView->update();
#endif // ASSIMP_QT4_VIEWER
} }
/********************************************************************/ /********************************************************************/
/********************** Constructor/Destructor **********************/ /********************** Constructor/Destructor **********************/
/********************************************************************/ /********************************************************************/
bool MainWindow::event(QEvent *e)
{
if (e->type() == QEvent::WindowActivate && this->mGLView->mReloadTexturesEnabled == true) {
qInfo() << "Window Activated";
}
return QWidget::event(e);
}
MainWindow::MainWindow(QWidget *parent) MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow), : QMainWindow(parent), ui(new Ui::MainWindow),
@ -209,6 +244,9 @@ MainWindow::MainWindow(QWidget *parent)
{ {
using namespace Assimp; using namespace Assimp;
// other variables
mMouse_Transformation.Position_Pressed_Valid = false;
ui->setupUi(this); ui->setupUi(this);
// Create OpenGL widget // Create OpenGL widget
mGLView = new CGLView(this); mGLView = new CGLView(this);
@ -281,7 +319,6 @@ QString filename, filter;
if(!filename.isEmpty()) ImportFile(filename); if(!filename.isEmpty()) ImportFile(filename);
} }
void MainWindow::on_butExport_clicked() void MainWindow::on_butExport_clicked()
{ {
using namespace Assimp; using namespace Assimp;
@ -301,7 +338,7 @@ QMap<QString, const aiExportFormatDesc*> exportersMap;
return; return;
} }
for (int i = 0; i < exporter.GetExportFormatCount(); ++i) for (size_t i = 0; i < exporter.GetExportFormatCount(); ++i)
{ {
const aiExportFormatDesc* desc = exporter.GetExportFormatDescription(i); const aiExportFormatDesc* desc = exporter.GetExportFormatDescription(i);
exportersList.push_back(desc->id + QString(": ") + desc->description); exportersList.push_back(desc->id + QString(": ") + desc->description);
@ -345,7 +382,11 @@ void MainWindow::on_cbxLighting_clicked(bool pChecked)
else else
mGLView->Lighting_Disable(); mGLView->Lighting_Disable();
#if ASSIMP_QT4_VIEWER
mGLView->updateGL(); mGLView->updateGL();
#else
mGLView->update();
#endif // ASSIMP_QT4_VIEWER
} }
void MainWindow::on_lstLight_itemSelectionChanged() void MainWindow::on_lstLight_itemSelectionChanged()
@ -357,35 +398,49 @@ bool selected = ui->lstLight->isItemSelected(ui->lstLight->currentItem());
else else
mGLView->Lighting_DisableSource(ui->lstLight->currentRow()); mGLView->Lighting_DisableSource(ui->lstLight->currentRow());
#if ASSIMP_QT4_VIEWER
mGLView->updateGL(); mGLView->updateGL();
#else
mGLView->update();
#endif // ASSIMP_QT4_VIEWER
} }
void MainWindow::on_lstCamera_clicked( const QModelIndex &) void MainWindow::on_lstCamera_clicked( const QModelIndex &)
{ {
mGLView->Camera_Set(ui->lstLight->currentRow()); mGLView->Camera_Set(ui->lstLight->currentRow());
#if ASSIMP_QT4_VIEWER
mGLView->updateGL(); mGLView->updateGL();
#else
mGLView->update();
#endif // ASSIMP_QT4_VIEWER
} }
void MainWindow::on_cbxBBox_clicked(bool checked) void MainWindow::on_cbxBBox_clicked(bool checked)
{ {
mGLView->Enable_SceneBBox(checked); mGLView->Enable_SceneBBox(checked);
#if ASSIMP_QT4_VIEWER
mGLView->updateGL(); mGLView->updateGL();
#else
mGLView->update();
#endif // ASSIMP_QT4_VIEWER
} }
void MainWindow::on_cbxDrawAxes_clicked(bool checked) void MainWindow::on_cbxDrawAxes_clicked(bool checked)
{ {
mGLView->Enable_Axes(checked); mGLView->Enable_Axes(checked);
#if ASSIMP_QT4_VIEWER
mGLView->updateGL(); mGLView->updateGL();
} #else
mGLView->update();
void MainWindow::on_cbxReloadTextures_clicked(bool checked) #endif // ASSIMP_QT4_VIEWER
{
mGLView->Enable_Reload_Textures(checked);
mGLView->updateGL();
} }
void MainWindow::on_cbxTextures_clicked(bool checked) void MainWindow::on_cbxTextures_clicked(bool checked)
{ {
mGLView->Enable_Textures(checked); mGLView->Enable_Textures(checked);
#if ASSIMP_QT4_VIEWER
mGLView->updateGL(); mGLView->updateGL();
#else
mGLView->update();
#endif // ASSIMP_QT4_VIEWER
} }

View File

@ -6,7 +6,11 @@
#pragma once #pragma once
// Header files, Qt. // Header files, Qt.
#include <QtWidgets> #if ASSIMP_QT4_VIEWER
# include <QMainWindow>
#else
# include <QtWidgets>
#endif
// Header files, project. // Header files, project.
#include "glview.hpp" #include "glview.hpp"
@ -36,8 +40,17 @@ private:
CLoggerView* mLoggerView;///< Pointer to logging object. CLoggerView* mLoggerView;///< Pointer to logging object.
Assimp::Importer mImporter;///< Assimp importer. Assimp::Importer mImporter;///< Assimp importer.
const aiScene* mScene;///< Pointer to loaded scene (\ref aiScene). const aiScene* mScene;///< Pointer to loaded scene (\ref aiScene).
QPoint mPosition_Pressed_LMB;///< Position where was pressed left mouse button.
QPoint mPosition_Pressed_RMB;///< Position where was pressed right mouse button. /// \struct SMouse_Transformation
/// Holds data about transformation of the scene/camera when mouse us used.
struct SMouse_Transformation
{
bool Position_Pressed_Valid;///< Mouse button pressed on GLView.
QPoint Position_Pressed_LMB;///< Position where was pressed left mouse button.
QPoint Position_Pressed_RMB;///< Position where was pressed right mouse button.
aiMatrix4x4 Rotation_AroundCamera;///< Rotation matrix which set rotation angles of the scene around camera.
aiMatrix4x4 Rotation_Scene;///< Rotation matrix which set rotation angles of the scene around own center.
} mMouse_Transformation;
/**********************************/ /**********************************/
/************ Functions ***********/ /************ Functions ***********/
@ -80,6 +93,11 @@ protected:
/// \param [in] pEvent - pointer to event data. /// \param [in] pEvent - pointer to event data.
void mousePressEvent(QMouseEvent* pEvent) override; void mousePressEvent(QMouseEvent* pEvent) override;
/// \fn void mouseReleaseEvent(QMouseEvent *pEvent) override
/// Override function which handles mouse event "button released".
/// \param [in] pEvent - pointer to event data.
void mouseReleaseEvent(QMouseEvent *pEvent) override;
/// \fn void mouseMoveEvent(QMouseEvent* pEvent) override /// \fn void mouseMoveEvent(QMouseEvent* pEvent) override
/// Override function which handles mouse event "move". /// Override function which handles mouse event "move".
/// \param [in] pEvent - pointer to event data. /// \param [in] pEvent - pointer to event data.
@ -90,7 +108,6 @@ protected:
/// \param [in] pEvent - pointer to event data. /// \param [in] pEvent - pointer to event data.
void keyPressEvent(QKeyEvent* pEvent) override; void keyPressEvent(QKeyEvent* pEvent) override;
bool event(QEvent*);
public: public:
/********************************************************************/ /********************************************************************/
@ -134,5 +151,4 @@ private slots:
void on_cbxBBox_clicked(bool checked); void on_cbxBBox_clicked(bool checked);
void on_cbxTextures_clicked(bool checked); void on_cbxTextures_clicked(bool checked);
void on_cbxDrawAxes_clicked(bool checked); void on_cbxDrawAxes_clicked(bool checked);
void on_cbxReloadTextures_clicked(bool checked);
}; };

View File

@ -302,6 +302,9 @@
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget> </widget>
</item> </item>
<item row="5" column="1"> <item row="5" column="1">
@ -312,6 +315,9 @@
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget> </widget>
</item> </item>
<item row="6" column="1"> <item row="6" column="1">
@ -325,6 +331,9 @@
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget> </widget>
</item> </item>
<item row="7" column="1"> <item row="7" column="1">
@ -335,6 +344,9 @@
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget> </widget>
</item> </item>
<item row="8" column="0"> <item row="8" column="0">
@ -349,6 +361,9 @@
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>
@ -511,13 +526,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0">
<widget class="QCheckBox" name="cbxReloadTextures">
<property name="text">
<string>Live Reload Textures</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</widget> </widget>