Merge branch 'master' into new_aistringsize
commit
06eb199704
|
@ -277,7 +277,6 @@ ELSEIF( CMAKE_COMPILER_IS_MINGW )
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF ( IOS AND NOT HUNTER_ENABLED)
|
IF ( IOS AND NOT HUNTER_ENABLED)
|
||||||
|
|
||||||
IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fembed-bitcode -Og")
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fembed-bitcode -Og")
|
||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode -Og")
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode -Og")
|
||||||
|
@ -286,7 +285,6 @@ ELSE()
|
||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode -O3")
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode -O3")
|
||||||
# Experimental for pdb generation
|
# Experimental for pdb generation
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
ENDIF( IOS AND NOT HUNTER_ENABLED)
|
ENDIF( IOS AND NOT HUNTER_ENABLED)
|
||||||
|
|
||||||
IF (ASSIMP_COVERALLS)
|
IF (ASSIMP_COVERALLS)
|
||||||
|
@ -559,17 +557,15 @@ ENDIF(NOT HUNTER_ENABLED)
|
||||||
|
|
||||||
ADD_SUBDIRECTORY( code/ )
|
ADD_SUBDIRECTORY( code/ )
|
||||||
IF ( ASSIMP_BUILD_ASSIMP_TOOLS )
|
IF ( ASSIMP_BUILD_ASSIMP_TOOLS )
|
||||||
|
# The viewer for windows only
|
||||||
IF ( WIN32 AND DirectX_D3DX9_LIBRARY )
|
IF ( WIN32 AND DirectX_D3DX9_LIBRARY )
|
||||||
OPTION ( ASSIMP_BUILD_ASSIMP_VIEW "If the Assimp view tool is built. (requires DirectX)" ${DirectX_FOUND} )
|
OPTION ( ASSIMP_BUILD_ASSIMP_VIEW "If the Assimp view tool is built. (requires DirectX)" ${DirectX_FOUND} )
|
||||||
IF ( ASSIMP_BUILD_ASSIMP_VIEW )
|
IF ( ASSIMP_BUILD_ASSIMP_VIEW )
|
||||||
ADD_SUBDIRECTORY( tools/assimp_view/ )
|
ADD_SUBDIRECTORY( tools/assimp_view/ )
|
||||||
ENDIF ( ASSIMP_BUILD_ASSIMP_VIEW )
|
ENDIF ( ASSIMP_BUILD_ASSIMP_VIEW )
|
||||||
ENDIF ( WIN32 AND DirectX_D3DX9_LIBRARY )
|
ENDIF ( WIN32 AND DirectX_D3DX9_LIBRARY )
|
||||||
|
# Te command line tool
|
||||||
ADD_SUBDIRECTORY( tools/assimp_cmd/ )
|
ADD_SUBDIRECTORY( tools/assimp_cmd/ )
|
||||||
IF (NOT IOS)
|
|
||||||
ADD_SUBDIRECTORY( tools/assimp_qt_viewer/ )
|
|
||||||
ENDIF (NOT IOS)
|
|
||||||
ENDIF ( ASSIMP_BUILD_ASSIMP_TOOLS )
|
ENDIF ( ASSIMP_BUILD_ASSIMP_TOOLS )
|
||||||
|
|
||||||
IF ( ASSIMP_BUILD_SAMPLES)
|
IF ( ASSIMP_BUILD_SAMPLES)
|
||||||
|
|
|
@ -1,76 +0,0 @@
|
||||||
set(PROJECT_VERSION "")
|
|
||||||
project(assimp_qt_viewer)
|
|
||||||
|
|
||||||
# Qt5 requires cmake 3.1 or newer
|
|
||||||
cmake_minimum_required(VERSION 3.1)
|
|
||||||
|
|
||||||
FIND_PACKAGE(OpenGL QUIET)
|
|
||||||
|
|
||||||
# Qt5 version
|
|
||||||
FIND_PACKAGE(Qt5 COMPONENTS Gui Widgets OpenGL QUIET)
|
|
||||||
|
|
||||||
SET(VIEWER_BUILD:BOOL FALSE)
|
|
||||||
|
|
||||||
IF( Qt5Widgets_FOUND AND OPENGL_FOUND)
|
|
||||||
SET(VIEWER_BUILD TRUE)
|
|
||||||
ELSE( Qt5Widgets_FOUND AND OPENGL_FOUND)
|
|
||||||
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 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 OPENGL_FOUND)
|
|
||||||
|
|
||||||
IF(VIEWER_BUILD)
|
|
||||||
INCLUDE_DIRECTORIES(
|
|
||||||
${Assimp_SOURCE_DIR}/include
|
|
||||||
${Assimp_SOURCE_DIR}/code
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
${CMAKE_SOURCE_DIR}
|
|
||||||
${OPENGL_INCLUDE_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
LINK_DIRECTORIES(${Assimp_BINARY_DIR})
|
|
||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pedantic -Wall")
|
|
||||||
|
|
||||||
SET(assimp_qt_viewer_SRCS
|
|
||||||
main.cpp
|
|
||||||
loggerview.hpp
|
|
||||||
loggerview.cpp
|
|
||||||
glview.hpp
|
|
||||||
glview.cpp
|
|
||||||
mainwindow.hpp
|
|
||||||
mainwindow.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
MESSAGE("assimp_qt_viewer use Qt5")
|
|
||||||
INCLUDE_DIRECTORIES(${Qt5Widgets_INCLUDES})
|
|
||||||
qt5_wrap_ui(UISrcs mainwindow.ui)
|
|
||||||
qt5_wrap_cpp(MOCrcs mainwindow.hpp glview.hpp)
|
|
||||||
|
|
||||||
add_executable(${PROJECT_NAME} ${assimp_qt_viewer_SRCS} ${UISrcs} ${MOCrcs})
|
|
||||||
target_link_libraries(${PROJECT_NAME} Qt5::Gui Qt5::Widgets Qt5::OpenGL ${OPENGL_LIBRARIES} assimp)
|
|
||||||
|
|
||||||
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")
|
|
||||||
ELSEIF(CMAKE_COMPILER_IS_GNUCXX)
|
|
||||||
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mwindows") # Not tested
|
|
||||||
ELSE()
|
|
||||||
MESSAGE(SEND_ERROR "You are using an unsupported Windows compiler! (Not MSVC or GCC)")
|
|
||||||
ENDIF()
|
|
||||||
ELSEIF(UNIX)
|
|
||||||
# Nothing special required
|
|
||||||
ELSE()
|
|
||||||
MESSAGE(SEND_ERROR "You are on an unsupported platform! (Not Win32 or Unix)")
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
|
|
||||||
INSTALL(TARGETS assimp_qt_viewer DESTINATION "${ASSIMP_BIN_INSTALL_DIR}")
|
|
||||||
ENDIF(VIEWER_BUILD)
|
|
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -1,456 +0,0 @@
|
||||||
/*
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
Open Asset Import Library (assimp)
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Copyright (c) 2006-2018, assimp team
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
|
||||||
with or without modification, are permitted provided that the following
|
|
||||||
conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above
|
|
||||||
copyright notice, this list of conditions and the
|
|
||||||
following disclaimer.
|
|
||||||
|
|
||||||
* Redistributions in binary form must reproduce the above
|
|
||||||
copyright notice, this list of conditions and the
|
|
||||||
following disclaimer in the documentation and/or other
|
|
||||||
materials provided with the distribution.
|
|
||||||
|
|
||||||
* Neither the name of the assimp team, nor the names of its
|
|
||||||
contributors may be used to endorse or promote products
|
|
||||||
derived from this software without specific prior
|
|
||||||
written permission of the assimp team.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
// Header files, Qt.
|
|
||||||
#include <QMap>
|
|
||||||
#if ASSIMP_QT4_VIEWER
|
|
||||||
# include <QtOpenGL>
|
|
||||||
#else
|
|
||||||
# include <QOpenGLWidget>
|
|
||||||
# include <QOpenGLFunctions>
|
|
||||||
#endif // ASSIMP_QT4_VIEWER
|
|
||||||
|
|
||||||
// Header files Assimp
|
|
||||||
#include <assimp/scene.h>
|
|
||||||
|
|
||||||
/// \class CGLView
|
|
||||||
/// Class which hold and render scene.
|
|
||||||
#if ASSIMP_QT4_VIEWER
|
|
||||||
class CGLView : public QGLWidget
|
|
||||||
#else
|
|
||||||
class CGLView : public QOpenGLWidget, protected QOpenGLFunctions
|
|
||||||
#endif // ASSIMP_QT4_VIEWER
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
/**********************************/
|
|
||||||
/************* Types **************/
|
|
||||||
/**********************************/
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
/// \struct SBBox
|
|
||||||
/// Bounding box for object.
|
|
||||||
struct SBBox
|
|
||||||
{
|
|
||||||
aiVector3D Minimum;///< Minimum values of coordinates.
|
|
||||||
aiVector3D Maximum;///< Maximum values of coordinates.
|
|
||||||
};
|
|
||||||
|
|
||||||
/// \struct SHelper_Mesh
|
|
||||||
/// Helper object for fast rendering of mesh (\ref aiMesh).
|
|
||||||
struct SHelper_Mesh
|
|
||||||
{
|
|
||||||
const size_t Quantity_Point;///< Quantity of points.
|
|
||||||
const size_t Quantity_Line;///< Quantity of lines.
|
|
||||||
const size_t Quantity_Triangle;///< Quantity of triangles.
|
|
||||||
GLuint* Index_Point;///< Array of indices for drawing points.
|
|
||||||
GLuint* Index_Line;///< Array of indices for drawing lines.
|
|
||||||
GLuint* Index_Triangle;///< Array of indices for drawing triangles.
|
|
||||||
|
|
||||||
const SBBox BBox;///< BBox of mesh.
|
|
||||||
|
|
||||||
/// \fn explicit SHelper_Mesh(const size_t pQuantity_Point, const size_t pQuantity_Line, const size_t pQuantity_Triangle, const SBBox& pBBox = {{0, 0, 0}, {0, 0, 0}})
|
|
||||||
/// Constructor.
|
|
||||||
/// \param [in] pQuantity_Point - quantity of points.
|
|
||||||
/// \param [in] pQuantity_Line - quantity of lines.
|
|
||||||
/// \param [in] pQuantity_Triangle - quantity of triangles.
|
|
||||||
/// \param [in] pBBox - BBox of mesh.
|
|
||||||
explicit SHelper_Mesh(const size_t pQuantity_Point, const size_t pQuantity_Line, const size_t pQuantity_Triangle, const SBBox& pBBox = {{0, 0, 0}, {0, 0, 0}});
|
|
||||||
|
|
||||||
/// \fn ~SHelper_Mesh()
|
|
||||||
/// Destructor.
|
|
||||||
~SHelper_Mesh();
|
|
||||||
};
|
|
||||||
|
|
||||||
/// \struct SHelper_Camera
|
|
||||||
/// Information about position of the camera in space.
|
|
||||||
struct SHelper_Camera
|
|
||||||
{
|
|
||||||
aiVector3D Position;///< Coordinates of the camera.
|
|
||||||
aiVector3D Target;///< Target point of the camera.
|
|
||||||
// Transformation path:
|
|
||||||
// set Camera -> Rotation_AroundCamera -> Translation_ToScene -> Rotation_Scene -> draw Scene
|
|
||||||
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.
|
|
||||||
aiVector3D Translation_ToScene;///< Translation vector from camera to the scene.
|
|
||||||
|
|
||||||
/// \fn void SetDefault()
|
|
||||||
/// Set default parameters of camera.
|
|
||||||
void SetDefault();
|
|
||||||
};
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
/// \enum ELightType
|
|
||||||
/// Type of light source.
|
|
||||||
enum class ELightType { Directional, Point, Spot };
|
|
||||||
|
|
||||||
/// \struct SLightParameters
|
|
||||||
/// Parameters of light source.
|
|
||||||
struct SLightParameters
|
|
||||||
{
|
|
||||||
aiLightSourceType Type;///< Type of light source.
|
|
||||||
|
|
||||||
aiColor4D Ambient;///< Ambient RGBA intensity of the light.
|
|
||||||
aiColor4D Diffuse;///< Diffuse RGBA intensity of the light.
|
|
||||||
aiColor4D Specular;///< Specular RGBA intensity of the light.
|
|
||||||
|
|
||||||
union UFor
|
|
||||||
{
|
|
||||||
/// \struct SDirectional
|
|
||||||
/// Parameters of directional light source.
|
|
||||||
struct SDirectional
|
|
||||||
{
|
|
||||||
aiVector3D Direction;
|
|
||||||
|
|
||||||
SDirectional() {}
|
|
||||||
} Directional;
|
|
||||||
|
|
||||||
/// \struct SPoint
|
|
||||||
/// Parameters of point light source.
|
|
||||||
struct SPoint
|
|
||||||
{
|
|
||||||
aiVector3D Position;
|
|
||||||
GLfloat Attenuation_Constant;
|
|
||||||
GLfloat Attenuation_Linear;
|
|
||||||
GLfloat Attenuation_Quadratic;
|
|
||||||
|
|
||||||
SPoint() {}
|
|
||||||
} Point;
|
|
||||||
|
|
||||||
/// \struct SSpot
|
|
||||||
/// Parameters of spot light source.
|
|
||||||
struct SSpot
|
|
||||||
{
|
|
||||||
aiVector3D Position;
|
|
||||||
GLfloat Attenuation_Constant;
|
|
||||||
GLfloat Attenuation_Linear;
|
|
||||||
GLfloat Attenuation_Quadratic;
|
|
||||||
aiVector3D Direction;
|
|
||||||
GLfloat CutOff;
|
|
||||||
|
|
||||||
SSpot() {}
|
|
||||||
} Spot;
|
|
||||||
|
|
||||||
UFor() {}
|
|
||||||
} For;
|
|
||||||
|
|
||||||
SLightParameters() {}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**********************************/
|
|
||||||
/************ Variables ***********/
|
|
||||||
/**********************************/
|
|
||||||
|
|
||||||
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
|
|
||||||
const aiScene* mScene = nullptr;///< Copy of pointer to scene (\ref aiScene).
|
|
||||||
SBBox mScene_BBox;///< Bounding box of scene.
|
|
||||||
aiVector3D mScene_Center;///< Coordinates of center of the scene.
|
|
||||||
bool mScene_DrawBBox = false;///< Flag which control drawing scene BBox.
|
|
||||||
bool mScene_AxesEnabled = true;///< Flag which control drawing axes of the coordinate system.
|
|
||||||
// Meshes
|
|
||||||
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.
|
|
||||||
// Cameras
|
|
||||||
SHelper_Camera mHelper_Camera;///< Information about current camera placing in space.
|
|
||||||
SHelper_Camera mHelper_CameraDefault;///< Information about default camera initial placing in space.
|
|
||||||
bool mCamera_DefaultAdded = true;///< If true then scene has no defined cameras and default was added, if false - scene has defined cameras.
|
|
||||||
GLdouble mCamera_FOVY = 45.0;///< Specifies the field of view angle, in degrees, in the y direction.
|
|
||||||
GLdouble mCamera_Viewport_AspectRatio;///< Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
|
|
||||||
// Lighting
|
|
||||||
bool mLightingEnabled = false;///< If true then OpenGL lighting is enabled (glEnable(GL_LIGHTING)), if false - disabled.
|
|
||||||
///TODO: map is goooood, but not for case when one image can be used in different materials with difference in: texture transformation, targeting of the
|
|
||||||
/// texture (ambient or emission, or even height map), texture properties.
|
|
||||||
QMap<QString, GLuint> mTexture_IDMap;///< Map image filenames to textures ID's.
|
|
||||||
|
|
||||||
/**********************************/
|
|
||||||
/************ Functions ***********/
|
|
||||||
/**********************************/
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
// Why in some cases pointers are used? Because: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36566
|
|
||||||
template<typename TArg> void AssignIfLesser(TArg* pBaseValue, const TArg pTestValue) { if(pTestValue < *pBaseValue) *pBaseValue = pTestValue; }
|
|
||||||
template<typename TArg> void AssignIfGreater(TArg* pBaseValue, const TArg pTestValue) { if(pTestValue > *pBaseValue) *pBaseValue = pTestValue; }
|
|
||||||
|
|
||||||
template<typename TArg> void AssignIfLesser(TArg& pBaseValue, const TArg pTestValue) { if(pTestValue < pBaseValue) pBaseValue = pTestValue; }
|
|
||||||
template<typename TArg> void AssignIfGreater(TArg& pBaseValue, const TArg pTestValue) { if(pTestValue > pBaseValue) pBaseValue = pTestValue; }
|
|
||||||
|
|
||||||
/// \fn void Material_Apply(const aiMaterial* pMaterial)
|
|
||||||
/// Enable pointed material.
|
|
||||||
/// \param [in] pMaterial - pointer to material which must be used.
|
|
||||||
void Material_Apply(const aiMaterial* pMaterial);
|
|
||||||
|
|
||||||
/// \fn void Matrix_NodeToRoot(const aiNode* pNode, aiMatrix4x4& pOutMatrix)
|
|
||||||
/// Calculate matrix for transforming coordinates from pointed node to root node (read as "global coordinate system").
|
|
||||||
/// \param [in] pNode - pointer initial node from which relative coordintaes will be taken,
|
|
||||||
/// \param [out] pOutMatrix - matrix for transform relative coordinates in \ref pNode to coordinates in root node (\ref aiScene::mRootNode).
|
|
||||||
void Matrix_NodeToRoot(const aiNode* pNode, aiMatrix4x4& pOutMatrix);
|
|
||||||
|
|
||||||
/// \fn void ImportTextures()
|
|
||||||
/// Import textures.
|
|
||||||
/// \param [in] pScenePath - path to the file of the scene.
|
|
||||||
void ImportTextures(const QString& pScenePath);
|
|
||||||
|
|
||||||
/// \fn void BBox_GetForNode(const aiNode& pNode, const aiMatrix4x4& pParentNode_TransformationMatrix, SBBox& pNodeBBox, bool& pFirstAssign)
|
|
||||||
/// Calculate BBox for pointed node. Function walk thru child nodes and apply all transformations.
|
|
||||||
/// \param [in] pNode - reference to node for which needed BBox.
|
|
||||||
/// \param [in] pParent_TransformationMatrix - reference to parent (parent for pNode) transformation matrix.
|
|
||||||
/// \param [in,out] pNodeBBox - reference to where pNode BBox will be placed. It will expanded by child nodes BBoxes.
|
|
||||||
/// \param [in] pFirstAssign - means that pNodeBBox not contain valid BBox at now and assign ('=') will used for setting new value, If
|
|
||||||
/// false then \ref BBox_Extend will be used for setting new BBox.
|
|
||||||
void BBox_GetForNode(const aiNode& pNode, const aiMatrix4x4& pParent_TransformationMatrix, SBBox& pNodeBBox, bool& pFirstAssign);
|
|
||||||
|
|
||||||
/// \fn void BBox_Extend(const SBBox& pChild, SBBox& pParent)
|
|
||||||
/// Check and if need - extend current node BBox with BBox of child node.
|
|
||||||
/// \param [in] pChild - reference to BBox which used for extend parent BBox.
|
|
||||||
/// \param [in.out] pParent - BBox which will be extended using child BBox.
|
|
||||||
void BBox_Extend(const SBBox& pChild, SBBox& pParent);
|
|
||||||
|
|
||||||
/// \fn void BBox_GetVertices(const SBBox& pBBox, aiVector3D pVertices[8])
|
|
||||||
/// Get vertices of a parallelepiped which is described by BBox.
|
|
||||||
/// \param [in] pBBox - input BBox.
|
|
||||||
/// \param [out] pVertices - array of vertices.
|
|
||||||
void BBox_GetVertices(const SBBox& pBBox, aiVector3D pVertices[8]);
|
|
||||||
|
|
||||||
/// \fn void BBox_GetFromVertices(const aiVector3D* pVertices, const size_t pVerticesQuantity, SBBox& pBBox)
|
|
||||||
/// Calculate BBox for vertices array.
|
|
||||||
/// \param [in] pVertices - vertices array.
|
|
||||||
/// \param [in] pVerticesQuantity - quantity of vertices in array. If 0 then pBBox will be assigned with {{0, 0, 0}, {0, 0, 0}}.
|
|
||||||
/// \param [out] pBBox - calculated BBox.
|
|
||||||
void BBox_GetFromVertices(const aiVector3D* pVertices, const size_t pVerticesQuantity, SBBox& pBBox);
|
|
||||||
|
|
||||||
/********************************************************************/
|
|
||||||
/************************ Logging functions *************************/
|
|
||||||
/********************************************************************/
|
|
||||||
|
|
||||||
/// \fn void LogInfo(const QString& pMessage)
|
|
||||||
/// Add message with severity "Warning" to log.
|
|
||||||
void LogInfo(const QString& pMessage);
|
|
||||||
|
|
||||||
/// \fn void LogError(const QString& pMessage)
|
|
||||||
/// Add message with severity "Error" to log.
|
|
||||||
void LogError(const QString& pMessage);
|
|
||||||
|
|
||||||
/********************************************************************/
|
|
||||||
/************************** Draw functions **************************/
|
|
||||||
/********************************************************************/
|
|
||||||
|
|
||||||
/// \fn void Draw_Node(const aiNode* pNode)
|
|
||||||
/// Apply node transformation and draw meshes assigned to this node.
|
|
||||||
/// \param [in] pNode - pointer to node for drawing (\ref aiNode).
|
|
||||||
void Draw_Node(const aiNode* pNode);
|
|
||||||
|
|
||||||
/// \fn void Draw_Mesh(const size_t pMesh_Index)
|
|
||||||
/// Draw mesh.
|
|
||||||
/// \param [in] pMesh_Index - index of mesh which must be drawn. Index point to mesh in \ref mHelper_Mesh.
|
|
||||||
void Draw_Mesh(const size_t pMesh_Index);
|
|
||||||
|
|
||||||
/// \fn void Draw_BBox(const SBBox& pBBox)
|
|
||||||
/// Draw bounding box using lines.
|
|
||||||
/// \param [in] pBBox - bounding box for drawing.
|
|
||||||
void Draw_BBox(const SBBox& pBBox);
|
|
||||||
|
|
||||||
/********************************************************************/
|
|
||||||
/*********************** Override functions ************************/
|
|
||||||
/********************************************************************/
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
/// \fn void drawCoordSystem()
|
|
||||||
/// Draw axes of the coordinate system.
|
|
||||||
void drawCoordSystem();
|
|
||||||
|
|
||||||
/// \fn void initializeGL() override
|
|
||||||
/// Override function to initialise OpenGL.
|
|
||||||
void initializeGL() override;
|
|
||||||
|
|
||||||
/// \fn void resizeGL(int pWidth, int pHeight) override
|
|
||||||
/// \param [in] pWidth - new width of viewport.
|
|
||||||
/// \param [in] pHeight - new height of viewport.
|
|
||||||
void resizeGL(int pWidth, int pHeight) override;
|
|
||||||
|
|
||||||
/// \fn void paintGL() override
|
|
||||||
/// Override function for rendering.
|
|
||||||
void paintGL() override;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
/********************************************************************/
|
|
||||||
/********************** Constructor/Destructor **********************/
|
|
||||||
/********************************************************************/
|
|
||||||
|
|
||||||
/// \fn explicit CGLView(QWidget* pParent)
|
|
||||||
/// Constructor.
|
|
||||||
/// \param [in] pParent - parent widget.
|
|
||||||
explicit CGLView(QWidget* pParent);
|
|
||||||
|
|
||||||
/// \fn virtual ~CGLView()
|
|
||||||
/// Destructor.
|
|
||||||
virtual ~CGLView();
|
|
||||||
|
|
||||||
/********************************************************************/
|
|
||||||
/********************* Scene control functions **********************/
|
|
||||||
/********************************************************************/
|
|
||||||
|
|
||||||
/// \fn void FreeScene()
|
|
||||||
/// Free all helper objects data.
|
|
||||||
void FreeScene();
|
|
||||||
|
|
||||||
/// \fn void SetScene(const aiScene* pScene)
|
|
||||||
/// Set scene for rendering.
|
|
||||||
/// \param [in] pScene - pointer to scene.
|
|
||||||
/// \param [in] pScenePath - path to the file of the scene.
|
|
||||||
void SetScene(const aiScene* pScene, const QString& pScenePath);
|
|
||||||
|
|
||||||
/// \fn void Enable_SceneBBox(const bool pEnable)
|
|
||||||
/// Enable drawing scene bounding box.
|
|
||||||
/// \param [in] pEnable - if true then bbox will be drawing, if false - will not be drawing.
|
|
||||||
void Enable_SceneBBox(const bool pEnable) { mScene_DrawBBox = pEnable; }
|
|
||||||
|
|
||||||
/// \fn void Enable_Textures(const bool pEnable)
|
|
||||||
/// Control textures drawing.
|
|
||||||
/// \param [in] pEnable - if true then enable textures, false - disable textures.
|
|
||||||
void Enable_Textures(const bool pEnable);
|
|
||||||
|
|
||||||
/// \fn void Enable_Axes(const bool pEnable)
|
|
||||||
/// Control axes drawing.
|
|
||||||
/// \param [in] pEnable - if true then enable axes, false - disable axes.
|
|
||||||
void Enable_Axes(const bool pEnable) { this->mScene_AxesEnabled = pEnable; }
|
|
||||||
|
|
||||||
/********************************************************************/
|
|
||||||
/******************** Lighting control functions ********************/
|
|
||||||
/********************************************************************/
|
|
||||||
|
|
||||||
/// \fn void Lighting_Enable()
|
|
||||||
/// Enable OpenGL lighting.
|
|
||||||
void Lighting_Enable();
|
|
||||||
|
|
||||||
/// \fn void Lighting_Disable()
|
|
||||||
/// Disable OpenGL lighting.
|
|
||||||
void Lighting_Disable();
|
|
||||||
|
|
||||||
/// \fn void Lighting_EditSource(const size_t pLightNumber, const SLightParameters& pLightParameters)
|
|
||||||
/// Edit light source properties.
|
|
||||||
/// \param [in] pLightNumber - light source number. \ref aiScene::mLights.
|
|
||||||
/// \param [in] pLightParameters - light source parameters.
|
|
||||||
void Lighting_EditSource(const size_t pLightNumber, const SLightParameters& pLightParameters);///TODO: function set
|
|
||||||
|
|
||||||
/// \fn void Lighting_EnableSource(const size_t pLightNumber)
|
|
||||||
/// Enable light source.
|
|
||||||
/// \param [in] pLightNumber - light source number. \ref aiScene::mLights.
|
|
||||||
void Lighting_EnableSource(const size_t pLightNumber);
|
|
||||||
|
|
||||||
///void Lighting_DisableSource(const size_t pLightNumber)
|
|
||||||
/// Disable light source,
|
|
||||||
/// \param [in] pLightNumber - light source number. \ref aiScene::mLights.
|
|
||||||
void Lighting_DisableSource(const size_t pLightNumber);
|
|
||||||
|
|
||||||
/********************************************************************/
|
|
||||||
/******************** Cameras control functions *********************/
|
|
||||||
/********************************************************************/
|
|
||||||
|
|
||||||
/// \fn void Camera_Set(const size_t pCameraNumber)
|
|
||||||
/// Set view from pointed camera.
|
|
||||||
/// \param [in] pCamera_Index - index of the camera (\ref aiScene::mCameras).
|
|
||||||
void Camera_Set(const size_t pCameraNumber);
|
|
||||||
|
|
||||||
/// \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.
|
|
||||||
/// \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_Z - specifies the angle of rotation around axis oZ, in degrees.
|
|
||||||
/// \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, const aiMatrix4x4* pMatrix_Rotation_Initial = nullptr)
|
|
||||||
/// Rotate camera around axisees.
|
|
||||||
/// \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_Z - specifies the angle of rotation around axis oZ, in degrees.
|
|
||||||
/// \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)
|
|
||||||
/// Translate camera along axises. In local coordinates.
|
|
||||||
/// \param [in] pTranslate_X - specifies the X coordinate of translation vector.
|
|
||||||
/// \param [in] pTranslate_Y - specifies the Y 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);
|
|
||||||
|
|
||||||
/// \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:
|
|
||||||
|
|
||||||
/// \fn void Paint_Finished(const size_t pPaintTime, const GLfloat pDistance)
|
|
||||||
///< Signal. Emits when execution of \ref paintGL is end.
|
|
||||||
/// \param [out] pPaintTime_ms - time spent for rendering, in milliseconds.
|
|
||||||
/// \param [out] pDistance - distance between current camera and center of the scene. \sa SHelper_Camera::Translation_ToScene.
|
|
||||||
void Paint_Finished(const size_t pPaintTime_ms, const GLfloat pDistance);
|
|
||||||
|
|
||||||
/// \fn void SceneObject_Camera(const QString& pName)
|
|
||||||
/// Signal. Emit for every camera found in scene. Also for default camera.
|
|
||||||
/// \param [out] pName - name of the camera.
|
|
||||||
void SceneObject_Camera(const QString& pName);
|
|
||||||
|
|
||||||
/// \fn void SceneObject_LightSource(const QString& pName)
|
|
||||||
/// Signal. Emit for every light source found in scene. Also for default light source.
|
|
||||||
/// \param [out] pName - name of the light source.
|
|
||||||
void SceneObject_LightSource(const QString& pName);
|
|
||||||
};// class CGLView
|
|
|
@ -1,64 +0,0 @@
|
||||||
/*
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
Open Asset Import Library (assimp)
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Copyright (c) 2006-2018, assimp team
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
|
||||||
with or without modification, are permitted provided that the following
|
|
||||||
conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above
|
|
||||||
copyright notice, this list of conditions and the
|
|
||||||
following disclaimer.
|
|
||||||
|
|
||||||
* Redistributions in binary form must reproduce the above
|
|
||||||
copyright notice, this list of conditions and the
|
|
||||||
following disclaimer in the documentation and/or other
|
|
||||||
materials provided with the distribution.
|
|
||||||
|
|
||||||
* Neither the name of the assimp team, nor the names of its
|
|
||||||
contributors may be used to endorse or promote products
|
|
||||||
derived from this software without specific prior
|
|
||||||
written permission of the assimp team.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
#include "loggerview.hpp"
|
|
||||||
|
|
||||||
// Header files, Qt.
|
|
||||||
#include <QTime>
|
|
||||||
#include <QTextBrowser>
|
|
||||||
|
|
||||||
CLoggerView::CLoggerView(QTextBrowser* pOutputWidget)
|
|
||||||
: mOutputWidget(pOutputWidget) {
|
|
||||||
// empty
|
|
||||||
}
|
|
||||||
|
|
||||||
CLoggerView::~CLoggerView() {
|
|
||||||
mOutputWidget = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CLoggerView::write(const char *pMessage) {
|
|
||||||
if (nullptr == mOutputWidget) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
mOutputWidget->insertPlainText(QString("[%1] %2").arg(QTime::currentTime().toString()).arg(pMessage));
|
|
||||||
}
|
|
|
@ -1,67 +0,0 @@
|
||||||
/*
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
Open Asset Import Library (assimp)
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Copyright (c) 2006-2018, assimp team
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
|
||||||
with or without modification, are permitted provided that the following
|
|
||||||
conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above
|
|
||||||
copyright notice, this list of conditions and the
|
|
||||||
following disclaimer.
|
|
||||||
|
|
||||||
* Redistributions in binary form must reproduce the above
|
|
||||||
copyright notice, this list of conditions and the
|
|
||||||
following disclaimer in the documentation and/or other
|
|
||||||
materials provided with the distribution.
|
|
||||||
|
|
||||||
* Neither the name of the assimp team, nor the names of its
|
|
||||||
contributors may be used to endorse or promote products
|
|
||||||
derived from this software without specific prior
|
|
||||||
written permission of the assimp team.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
// Header files, Assimp.
|
|
||||||
#include <assimp/DefaultLogger.hpp>
|
|
||||||
|
|
||||||
class QTextBrowser;
|
|
||||||
|
|
||||||
/// @class CLoggerView
|
|
||||||
/// @brief GUI-stream for Assimp logging sub-sytem. Get data for logging and write it to output widget.
|
|
||||||
class CLoggerView final : public ::Assimp::LogStream {
|
|
||||||
public:
|
|
||||||
/// @brief The class constructor.
|
|
||||||
/// @param [in] pOutputWidget - pointer to output widget.
|
|
||||||
explicit CLoggerView( QTextBrowser* pOutputWidget );
|
|
||||||
|
|
||||||
/// @brief The class destructor.
|
|
||||||
virtual ~CLoggerView();
|
|
||||||
|
|
||||||
/// Write message to output widget. Used by Assimp.
|
|
||||||
/// \param [in] pMessage - message for displaying.
|
|
||||||
virtual void write(const char *pMessage);
|
|
||||||
|
|
||||||
private:
|
|
||||||
QTextBrowser * mOutputWidget; ///< Widget for displaying messages.
|
|
||||||
};
|
|
|
@ -1,58 +0,0 @@
|
||||||
/*
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
Open Asset Import Library (assimp)
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Copyright (c) 2006-2018, assimp team
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
|
||||||
with or without modification, are permitted provided that the following
|
|
||||||
conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above
|
|
||||||
copyright notice, this list of conditions and the
|
|
||||||
following disclaimer.
|
|
||||||
|
|
||||||
* Redistributions in binary form must reproduce the above
|
|
||||||
copyright notice, this list of conditions and the
|
|
||||||
following disclaimer in the documentation and/or other
|
|
||||||
materials provided with the distribution.
|
|
||||||
|
|
||||||
* Neither the name of the assimp team, nor the names of its
|
|
||||||
contributors may be used to endorse or promote products
|
|
||||||
derived from this software without specific prior
|
|
||||||
written permission of the assimp team.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Thanks to acorn89 for support.
|
|
||||||
|
|
||||||
// Header files, project.
|
|
||||||
#include "mainwindow.hpp"
|
|
||||||
|
|
||||||
// Header files, Qt.
|
|
||||||
#include <QApplication>
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
|
||||||
QApplication app(argc, argv);
|
|
||||||
MainWindow win;
|
|
||||||
win.show();
|
|
||||||
|
|
||||||
return app.exec();
|
|
||||||
}
|
|
|
@ -1,466 +0,0 @@
|
||||||
/*
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
Open Asset Import Library (assimp)
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Copyright (c) 2006-2018, assimp team
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
|
||||||
with or without modification, are permitted provided that the following
|
|
||||||
conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above
|
|
||||||
copyright notice, this list of conditions and the
|
|
||||||
following disclaimer.
|
|
||||||
|
|
||||||
* Redistributions in binary form must reproduce the above
|
|
||||||
copyright notice, this list of conditions and the
|
|
||||||
following disclaimer in the documentation and/or other
|
|
||||||
materials provided with the distribution.
|
|
||||||
|
|
||||||
* Neither the name of the assimp team, nor the names of its
|
|
||||||
contributors may be used to endorse or promote products
|
|
||||||
derived from this software without specific prior
|
|
||||||
written permission of the assimp team.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "mainwindow.hpp"
|
|
||||||
#include "ui_mainwindow.h"
|
|
||||||
|
|
||||||
// Header files, Assimp.
|
|
||||||
#include <assimp/Exporter.hpp>
|
|
||||||
#include <assimp/postprocess.h>
|
|
||||||
|
|
||||||
#ifndef __unused
|
|
||||||
#define __unused __attribute__((unused))
|
|
||||||
#endif // __unused
|
|
||||||
|
|
||||||
using namespace Assimp;
|
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::ImportFile(const QString &pFileName) {
|
|
||||||
QTime time_begin = QTime::currentTime();
|
|
||||||
|
|
||||||
if ( mScene != nullptr ) {
|
|
||||||
mImporter.FreeScene();
|
|
||||||
mGLView->FreeScene();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try to import scene.
|
|
||||||
mScene = mImporter.ReadFile(pFileName.toStdString(), aiProcess_Triangulate | aiProcess_GenNormals | aiProcess_ValidateDataStructure | \
|
|
||||||
aiProcess_GenUVCoords | aiProcess_TransformUVCoords | aiProcess_FlipUVs);
|
|
||||||
if ( mScene != nullptr ) {
|
|
||||||
ui->lblLoadTime->setText(QString::number(time_begin.secsTo(QTime::currentTime())));
|
|
||||||
LogInfo("Import done: " + pFileName);
|
|
||||||
// Prepare widgets for new scene.
|
|
||||||
ui->leFileName->setText(pFileName.right(pFileName.length() - pFileName.lastIndexOf('/') - 1));
|
|
||||||
ui->lstLight->clear();
|
|
||||||
ui->lstCamera->clear();
|
|
||||||
ui->cbxLighting->setChecked(true); mGLView->Lighting_Enable();
|
|
||||||
ui->cbxBBox->setChecked(false); mGLView->Enable_SceneBBox(false);
|
|
||||||
ui->cbxTextures->setChecked(true); mGLView->Enable_Textures(true);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Fill info labels
|
|
||||||
//
|
|
||||||
// Cameras
|
|
||||||
ui->lblCameraCount->setText(QString::number(mScene->mNumCameras));
|
|
||||||
// Lights
|
|
||||||
ui->lblLightCount->setText(QString::number(mScene->mNumLights));
|
|
||||||
// Meshes, faces, vertices.
|
|
||||||
size_t qty_face = 0;
|
|
||||||
size_t qty_vert = 0;
|
|
||||||
|
|
||||||
for(size_t idx_mesh = 0; idx_mesh < mScene->mNumMeshes; idx_mesh++) {
|
|
||||||
qty_face += mScene->mMeshes[idx_mesh]->mNumFaces;
|
|
||||||
qty_vert += mScene->mMeshes[idx_mesh]->mNumVertices;
|
|
||||||
}
|
|
||||||
|
|
||||||
ui->lblMeshCount->setText(QString::number(mScene->mNumMeshes));
|
|
||||||
ui->lblFaceCount->setText(QString::number(qty_face));
|
|
||||||
ui->lblVertexCount->setText(QString::number(qty_vert));
|
|
||||||
// Animation
|
|
||||||
if(mScene->mNumAnimations)
|
|
||||||
ui->lblHasAnimation->setText("yes");
|
|
||||||
else
|
|
||||||
ui->lblHasAnimation->setText("no");
|
|
||||||
|
|
||||||
//
|
|
||||||
// Set scene for GL viewer.
|
|
||||||
//
|
|
||||||
mGLView->SetScene(mScene, pFileName);
|
|
||||||
// Select first camera
|
|
||||||
ui->lstCamera->setCurrentRow(0);
|
|
||||||
mGLView->Camera_Set(0);
|
|
||||||
// Scene is loaded, do first rendering.
|
|
||||||
LogInfo("Scene is ready for rendering.");
|
|
||||||
#if ASSIMP_QT4_VIEWER
|
|
||||||
mGLView->updateGL();
|
|
||||||
#else
|
|
||||||
mGLView->update();
|
|
||||||
#endif // ASSIMP_QT4_VIEWER
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ResetSceneInfos();
|
|
||||||
|
|
||||||
QString errorMessage = QString("Error parsing \'%1\' : \'%2\'").arg(pFileName).arg(mImporter.GetErrorString());
|
|
||||||
QMessageBox::critical(this, "Import error", errorMessage);
|
|
||||||
LogError(errorMessage);
|
|
||||||
}// if(mScene != nullptr)
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::ResetSceneInfos()
|
|
||||||
{
|
|
||||||
ui->lblLoadTime->clear();
|
|
||||||
ui->leFileName->clear();
|
|
||||||
ui->lblMeshCount->setText("0");
|
|
||||||
ui->lblFaceCount->setText("0");
|
|
||||||
ui->lblVertexCount->setText("0");
|
|
||||||
ui->lblCameraCount->setText("0");
|
|
||||||
ui->lblLightCount->setText("0");
|
|
||||||
ui->lblHasAnimation->setText("no");
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************************************/
|
|
||||||
/************************ Logging functions *************************/
|
|
||||||
/********************************************************************/
|
|
||||||
|
|
||||||
void MainWindow::LogInfo(const QString& pMessage)
|
|
||||||
{
|
|
||||||
Assimp::DefaultLogger::get()->info(pMessage.toStdString());
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::LogError(const QString& pMessage)
|
|
||||||
{
|
|
||||||
Assimp::DefaultLogger::get()->error(pMessage.toStdString());
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************************************/
|
|
||||||
/*********************** Override functions ************************/
|
|
||||||
/********************************************************************/
|
|
||||||
|
|
||||||
void MainWindow::mousePressEvent(QMouseEvent* pEvent)
|
|
||||||
{
|
|
||||||
const QPoint ms_pt = pEvent->pos();
|
|
||||||
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)
|
|
||||||
mMouse_Transformation.Position_Pressed_LMB = ms_pt;
|
|
||||||
else if(pEvent->button() & Qt::RightButton)
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
if(mMouse_Transformation.Position_Pressed_Valid)
|
|
||||||
{
|
|
||||||
if(pEvent->buttons() & Qt::LeftButton)
|
|
||||||
{
|
|
||||||
GLfloat dx = 180 * GLfloat(pEvent->x() - mMouse_Transformation.Position_Pressed_LMB.x()) / mGLView->width();
|
|
||||||
GLfloat dy = 180 * GLfloat(pEvent->y() - mMouse_Transformation.Position_Pressed_LMB.y()) / mGLView->height();
|
|
||||||
|
|
||||||
if(pEvent->modifiers() & Qt::ShiftModifier)
|
|
||||||
mGLView->Camera_RotateScene(dy, 0, dx, &mMouse_Transformation.Rotation_Scene);// Rotate around oX and oZ axises.
|
|
||||||
else
|
|
||||||
mGLView->Camera_RotateScene(dy, dx, 0, &mMouse_Transformation.Rotation_Scene);// Rotate around oX and oY axises.
|
|
||||||
|
|
||||||
#if ASSIMP_QT4_VIEWER
|
|
||||||
mGLView->updateGL();
|
|
||||||
#else
|
|
||||||
mGLView->update();
|
|
||||||
#endif // ASSIMP_QT4_VIEWER
|
|
||||||
}
|
|
||||||
|
|
||||||
if(pEvent->buttons() & Qt::RightButton)
|
|
||||||
{
|
|
||||||
GLfloat dx = 180 * GLfloat(pEvent->x() - mMouse_Transformation.Position_Pressed_RMB.x()) / mGLView->width();
|
|
||||||
GLfloat dy = 180 * GLfloat(pEvent->y() - mMouse_Transformation.Position_Pressed_RMB.y()) / mGLView->height();
|
|
||||||
|
|
||||||
if(pEvent->modifiers() & Qt::ShiftModifier)
|
|
||||||
mGLView->Camera_Rotate(dy, 0, dx, &mMouse_Transformation.Rotation_AroundCamera);// Rotate around oX and oZ axises.
|
|
||||||
else
|
|
||||||
mGLView->Camera_Rotate(dy, dx, 0, &mMouse_Transformation.Rotation_AroundCamera);// Rotate around oX and oY axises.
|
|
||||||
|
|
||||||
#if ASSIMP_QT4_VIEWER
|
|
||||||
mGLView->updateGL();
|
|
||||||
#else
|
|
||||||
mGLView->update();
|
|
||||||
#endif // ASSIMP_QT4_VIEWER
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::keyPressEvent(QKeyEvent* pEvent)
|
|
||||||
{
|
|
||||||
GLfloat step;
|
|
||||||
|
|
||||||
if(pEvent->modifiers() & Qt::ControlModifier)
|
|
||||||
step = 10;
|
|
||||||
else if(pEvent->modifiers() & Qt::AltModifier)
|
|
||||||
step = 100;
|
|
||||||
else
|
|
||||||
step = 1;
|
|
||||||
|
|
||||||
if(pEvent->key() == Qt::Key_A)
|
|
||||||
mGLView->Camera_Translate(-step, 0, 0);
|
|
||||||
else if(pEvent->key() == Qt::Key_D)
|
|
||||||
mGLView->Camera_Translate(step, 0, 0);
|
|
||||||
else if(pEvent->key() == Qt::Key_W)
|
|
||||||
mGLView->Camera_Translate(0, step, 0);
|
|
||||||
else if(pEvent->key() == Qt::Key_S)
|
|
||||||
mGLView->Camera_Translate(0, -step, 0);
|
|
||||||
else if(pEvent->key() == Qt::Key_Up)
|
|
||||||
mGLView->Camera_Translate(0, 0, -step);
|
|
||||||
else if(pEvent->key() == Qt::Key_Down)
|
|
||||||
mGLView->Camera_Translate(0, 0, step);
|
|
||||||
|
|
||||||
#if ASSIMP_QT4_VIEWER
|
|
||||||
mGLView->updateGL();
|
|
||||||
#else
|
|
||||||
mGLView->update();
|
|
||||||
#endif // ASSIMP_QT4_VIEWER
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************************************/
|
|
||||||
/********************** Constructor/Destructor **********************/
|
|
||||||
/********************************************************************/
|
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
|
||||||
: QMainWindow(parent), ui(new Ui::MainWindow),
|
|
||||||
mScene(nullptr)
|
|
||||||
{
|
|
||||||
|
|
||||||
// other variables
|
|
||||||
mMouse_Transformation.Position_Pressed_Valid = false;
|
|
||||||
|
|
||||||
ui->setupUi(this);
|
|
||||||
// Create OpenGL widget
|
|
||||||
mGLView = new CGLView(this);
|
|
||||||
mGLView->setMinimumSize(800, 600);
|
|
||||||
mGLView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding);
|
|
||||||
mGLView->setFocusPolicy(Qt::StrongFocus);
|
|
||||||
// Connect to GLView signals.
|
|
||||||
connect(mGLView, SIGNAL(Paint_Finished(size_t, GLfloat)), SLOT(Paint_Finished(size_t, GLfloat)));
|
|
||||||
connect(mGLView, SIGNAL(SceneObject_Camera(QString)), SLOT(SceneObject_Camera(QString)));
|
|
||||||
connect(mGLView, SIGNAL(SceneObject_LightSource(QString)), SLOT(SceneObject_LightSource(QString)));
|
|
||||||
// and add it to layout
|
|
||||||
ui->hlMainView->insertWidget(0, mGLView, 4);
|
|
||||||
// Create logger
|
|
||||||
mLoggerView = new CLoggerView(ui->tbLog);
|
|
||||||
DefaultLogger::create("", Logger::VERBOSE);
|
|
||||||
DefaultLogger::get()->attachStream(mLoggerView, DefaultLogger::Debugging | DefaultLogger::Info | DefaultLogger::Err | DefaultLogger::Warn);
|
|
||||||
|
|
||||||
ResetSceneInfos();
|
|
||||||
}
|
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
|
||||||
{
|
|
||||||
using namespace Assimp;
|
|
||||||
|
|
||||||
DefaultLogger::get()->detatchStream(mLoggerView, DefaultLogger::Debugging | DefaultLogger::Info | DefaultLogger::Err | DefaultLogger::Warn);
|
|
||||||
DefaultLogger::kill();
|
|
||||||
|
|
||||||
if(mScene != nullptr) mImporter.FreeScene();
|
|
||||||
if(mLoggerView != nullptr) delete mLoggerView;
|
|
||||||
if(mGLView != nullptr) delete mGLView;
|
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************************************/
|
|
||||||
/****************************** Slots *******************************/
|
|
||||||
/********************************************************************/
|
|
||||||
|
|
||||||
void MainWindow::Paint_Finished(const size_t pPaintTime_ms, const GLfloat pDistance)
|
|
||||||
{
|
|
||||||
ui->lblRenderTime->setText(QString::number(pPaintTime_ms));
|
|
||||||
ui->lblDistance->setText(QString::number(pDistance));
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::SceneObject_Camera(const QString& pName)
|
|
||||||
{
|
|
||||||
ui->lstCamera->addItem(pName);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::SceneObject_LightSource(const QString& pName)
|
|
||||||
{
|
|
||||||
ui->lstLight->addItem(pName);
|
|
||||||
// After item added "currentRow" is still contain old value (even '-1' if first item added). Because "currentRow"/"currentItem" is changed by user interaction,
|
|
||||||
// not by "addItem". So, "currentRow" must be set manually.
|
|
||||||
ui->lstLight->setCurrentRow(ui->lstLight->count() - 1);
|
|
||||||
// And after "selectAll" handler of "signal itemSelectionChanged" will get right "currentItem" and "currentRow" values.
|
|
||||||
ui->lstLight->selectAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::on_butOpenFile_clicked() {
|
|
||||||
aiString filter_temp;
|
|
||||||
mImporter.GetExtensionList( filter_temp );
|
|
||||||
|
|
||||||
QString filename, filter;
|
|
||||||
filter = filter_temp.C_Str();
|
|
||||||
filter.replace(';', ' ');
|
|
||||||
filter.append(" ;; All (*.*)");
|
|
||||||
filename = QFileDialog::getOpenFileName(this, "Choose the file", "", filter);
|
|
||||||
|
|
||||||
if (!filename.isEmpty()) {
|
|
||||||
ImportFile( filename );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::on_butExport_clicked()
|
|
||||||
{
|
|
||||||
using namespace Assimp;
|
|
||||||
|
|
||||||
#ifndef ASSIMP_BUILD_NO_EXPORT
|
|
||||||
QString filename, filter, format_id;
|
|
||||||
Exporter exporter;
|
|
||||||
QTime time_begin;
|
|
||||||
aiReturn rv;
|
|
||||||
QStringList exportersList;
|
|
||||||
QMap<QString, const aiExportFormatDesc*> exportersMap;
|
|
||||||
|
|
||||||
|
|
||||||
if(mScene == nullptr)
|
|
||||||
{
|
|
||||||
QMessageBox::critical(this, "Export error", "Scene is empty");
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (size_t i = 0; i < exporter.GetExportFormatCount(); ++i)
|
|
||||||
{
|
|
||||||
const aiExportFormatDesc* desc = exporter.GetExportFormatDescription(i);
|
|
||||||
exportersList.push_back(desc->id + QString(": ") + desc->description);
|
|
||||||
exportersMap.insert(desc->id, desc);
|
|
||||||
}
|
|
||||||
|
|
||||||
// get an exporter
|
|
||||||
bool dialogSelectExporterOk;
|
|
||||||
QString selectedExporter = QInputDialog::getItem(this, "Export format", "Select the exporter : ", exportersList, 0, false, &dialogSelectExporterOk);
|
|
||||||
if (!dialogSelectExporterOk)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// build the filter
|
|
||||||
QString selectedId = selectedExporter.left(selectedExporter.indexOf(':'));
|
|
||||||
filter = QString("*.") + exportersMap[selectedId]->fileExtension;
|
|
||||||
|
|
||||||
// get file path
|
|
||||||
filename = QFileDialog::getSaveFileName(this, "Set file name", "", filter);
|
|
||||||
// if it's canceled
|
|
||||||
if (filename == "")
|
|
||||||
return;
|
|
||||||
|
|
||||||
// begin export
|
|
||||||
time_begin = QTime::currentTime();
|
|
||||||
rv = exporter.Export(mScene, selectedId.toLocal8Bit(), filename.toLocal8Bit(), aiProcess_FlipUVs);
|
|
||||||
ui->lblExportTime->setText(QString::number(time_begin.secsTo(QTime::currentTime())));
|
|
||||||
if(rv == aiReturn_SUCCESS)
|
|
||||||
LogInfo("Export done: " + filename);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
QString errorMessage = QString("Export failed: ") + filename;
|
|
||||||
LogError(errorMessage);
|
|
||||||
QMessageBox::critical(this, "Export error", errorMessage);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::on_cbxLighting_clicked(bool pChecked)
|
|
||||||
{
|
|
||||||
if(pChecked)
|
|
||||||
mGLView->Lighting_Enable();
|
|
||||||
else
|
|
||||||
mGLView->Lighting_Disable();
|
|
||||||
|
|
||||||
mGLView->update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::on_lstLight_itemSelectionChanged()
|
|
||||||
{
|
|
||||||
bool selected = ui->lstLight->isItemSelected(ui->lstLight->currentItem());
|
|
||||||
|
|
||||||
if(selected)
|
|
||||||
mGLView->Lighting_EnableSource(ui->lstLight->currentRow());
|
|
||||||
else
|
|
||||||
mGLView->Lighting_DisableSource(ui->lstLight->currentRow());
|
|
||||||
|
|
||||||
#if ASSIMP_QT4_VIEWER
|
|
||||||
mGLView->updateGL();
|
|
||||||
#else
|
|
||||||
mGLView->update();
|
|
||||||
#endif // ASSIMP_QT4_VIEWER
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::on_lstCamera_clicked( const QModelIndex &)
|
|
||||||
{
|
|
||||||
mGLView->Camera_Set(ui->lstLight->currentRow());
|
|
||||||
#if ASSIMP_QT4_VIEWER
|
|
||||||
mGLView->updateGL();
|
|
||||||
#else
|
|
||||||
mGLView->update();
|
|
||||||
#endif // ASSIMP_QT4_VIEWER
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::on_cbxBBox_clicked(bool checked)
|
|
||||||
{
|
|
||||||
mGLView->Enable_SceneBBox(checked);
|
|
||||||
#if ASSIMP_QT4_VIEWER
|
|
||||||
mGLView->updateGL();
|
|
||||||
#else
|
|
||||||
mGLView->update();
|
|
||||||
#endif // ASSIMP_QT4_VIEWER
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::on_cbxDrawAxes_clicked(bool checked)
|
|
||||||
{
|
|
||||||
mGLView->Enable_Axes(checked);
|
|
||||||
#if ASSIMP_QT4_VIEWER
|
|
||||||
mGLView->updateGL();
|
|
||||||
#else
|
|
||||||
mGLView->update();
|
|
||||||
#endif // ASSIMP_QT4_VIEWER
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::on_cbxTextures_clicked(bool checked)
|
|
||||||
{
|
|
||||||
mGLView->Enable_Textures(checked);
|
|
||||||
mGLView->update();
|
|
||||||
}
|
|
|
@ -1,148 +0,0 @@
|
||||||
/*
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
Open Asset Import Library (assimp)
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Copyright (c) 2006-2018, assimp team
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
|
||||||
with or without modification, are permitted provided that the following
|
|
||||||
conditions are met:
|
|
||||||
|
|
||||||
* Redistributions of source code must retain the above
|
|
||||||
copyright notice, this list of conditions and the
|
|
||||||
following disclaimer.
|
|
||||||
|
|
||||||
* Redistributions in binary form must reproduce the above
|
|
||||||
copyright notice, this list of conditions and the
|
|
||||||
following disclaimer in the documentation and/or other
|
|
||||||
materials provided with the distribution.
|
|
||||||
|
|
||||||
* Neither the name of the assimp team, nor the names of its
|
|
||||||
contributors may be used to endorse or promote products
|
|
||||||
derived from this software without specific prior
|
|
||||||
written permission of the assimp team.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
// Header files, Qt.
|
|
||||||
#if defined ASSIMP_QT4_VIEWER
|
|
||||||
# include <QMainWindow>
|
|
||||||
#else
|
|
||||||
# include <QtWidgets>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Header files, project.
|
|
||||||
#include "glview.hpp"
|
|
||||||
#include "loggerview.hpp"
|
|
||||||
|
|
||||||
// Header files, Assimp.
|
|
||||||
#include <assimp/Importer.hpp>
|
|
||||||
#include <assimp/scene.h>
|
|
||||||
|
|
||||||
namespace Ui {
|
|
||||||
class MainWindow;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// \class MainWindow
|
|
||||||
/// Main window and algorithms.
|
|
||||||
class MainWindow : public QMainWindow {
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
struct SMouse_Transformation;
|
|
||||||
|
|
||||||
public:
|
|
||||||
/// @brief The class constructor.
|
|
||||||
/// \param [in] pParent - pointer to parent widget.
|
|
||||||
explicit MainWindow( QWidget* pParent = 0 );
|
|
||||||
|
|
||||||
/// @brief The class destructor.
|
|
||||||
~MainWindow();
|
|
||||||
|
|
||||||
/// Import scene from file.
|
|
||||||
/// \param [in] pFileName - path and name of the file.
|
|
||||||
void ImportFile(const QString& pFileName);
|
|
||||||
|
|
||||||
/// Reset informations about the scene
|
|
||||||
void ResetSceneInfos();
|
|
||||||
|
|
||||||
/// Add message with severity "Warning" to log.
|
|
||||||
void LogInfo(const QString& pMessage);
|
|
||||||
|
|
||||||
/// Add message with severity "Error" to log.
|
|
||||||
void LogError(const QString& pMessage);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
/// Override function which handles mouse event "button pressed".
|
|
||||||
/// \param [in] pEvent - pointer to event data.
|
|
||||||
void mousePressEvent(QMouseEvent* pEvent) override;
|
|
||||||
|
|
||||||
/// Override function which handles mouse event "button released".
|
|
||||||
/// \param [in] pEvent - pointer to event data.
|
|
||||||
void mouseReleaseEvent(QMouseEvent *pEvent) override;
|
|
||||||
|
|
||||||
/// Override function which handles mouse event "move".
|
|
||||||
/// \param [in] pEvent - pointer to event data.
|
|
||||||
void mouseMoveEvent(QMouseEvent* pEvent) override;
|
|
||||||
|
|
||||||
/// Override function which handles key event "key pressed".
|
|
||||||
/// \param [in] pEvent - pointer to event data.
|
|
||||||
void keyPressEvent(QKeyEvent* pEvent) override;
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
/// Show paint/render time and distance between camera and center of the scene.
|
|
||||||
/// \param [in] pPaintTime_ms - paint time in milliseconds.
|
|
||||||
void Paint_Finished(const size_t pPaintTime_ms, const GLfloat pDistance);
|
|
||||||
|
|
||||||
/// Add camera name to list.
|
|
||||||
/// \param [in] pName - name of the camera.
|
|
||||||
void SceneObject_Camera(const QString& pName);
|
|
||||||
|
|
||||||
/// Add lighting source name to list.
|
|
||||||
/// \param [in] pName - name of the light source,
|
|
||||||
void SceneObject_LightSource(const QString& pName);
|
|
||||||
|
|
||||||
void on_butOpenFile_clicked();
|
|
||||||
void on_butExport_clicked();
|
|
||||||
void on_cbxLighting_clicked(bool pChecked);
|
|
||||||
void on_lstLight_itemSelectionChanged();
|
|
||||||
void on_lstCamera_clicked(const QModelIndex &index);
|
|
||||||
void on_cbxBBox_clicked(bool checked);
|
|
||||||
void on_cbxTextures_clicked(bool checked);
|
|
||||||
void on_cbxDrawAxes_clicked(bool checked);
|
|
||||||
|
|
||||||
private:
|
|
||||||
Ui::MainWindow *ui;
|
|
||||||
CGLView *mGLView;///< Pointer to OpenGL render.
|
|
||||||
CLoggerView *mLoggerView;///< Pointer to logging object.
|
|
||||||
Assimp::Importer mImporter;///< Assimp importer.
|
|
||||||
const aiScene* mScene;///< Pointer to loaded scene (\ref aiScene).
|
|
||||||
|
|
||||||
/// \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;
|
|
||||||
};
|
|
|
@ -1,544 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>MainWindow</class>
|
|
||||||
<widget class="QMainWindow" name="MainWindow">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>641</width>
|
|
||||||
<height>778</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>MainWindow</string>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="centralWidget">
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="5,1">
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="hlMainView" stretch="0">
|
|
||||||
<property name="sizeConstraint">
|
|
||||||
<enum>QLayout::SetDefaultConstraint</enum>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="grpFile">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="title">
|
|
||||||
<string>File</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QFormLayout" name="formLayout_2">
|
|
||||||
<item row="0" column="0" colspan="2">
|
|
||||||
<widget class="QPushButton" name="butOpenFile">
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Open file</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="lblFileName_Label">
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>File name</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QLineEdit" name="leFileName">
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>160</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="frame">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="readOnly">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="lblLoadTime_Label">
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Load time, s</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QLabel" name="lblLoadTime">
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0" colspan="2">
|
|
||||||
<widget class="Line" name="line">
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="0" colspan="2">
|
|
||||||
<widget class="QPushButton" name="butExport">
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Export</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="0">
|
|
||||||
<widget class="QLabel" name="lblExportTime_Label">
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Export time, s</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="1">
|
|
||||||
<widget class="QLabel" name="lblExportTime">
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="grpInfo">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="title">
|
|
||||||
<string>Info</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QFormLayout" name="formLayout_4">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="lblRenderTime_Label">
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Render time, ms</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QLabel" name="lblRenderTime">
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="lblMeshCount_Label">
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Meshes</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="lblFaceCount_Label">
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Faces</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QLabel" name="lblMeshCount">
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QLabel" name="lblFaceCount">
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
|
||||||
<widget class="QLabel" name="lblVertexCount_Label">
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Vertices</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="QLabel" name="lblVertexCount">
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0">
|
|
||||||
<widget class="QLabel" name="lblLightCount_Label">
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Lights</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="0">
|
|
||||||
<widget class="QLabel" name="lblCameraCount_Label">
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Cameras</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="7" column="0">
|
|
||||||
<widget class="QLabel" name="lblHasAnimation_Label">
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Animation</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="0">
|
|
||||||
<widget class="QLabel" name="lblShaderCount_Label">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Shaders</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="1">
|
|
||||||
<widget class="QLabel" name="lblLightCount">
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="1">
|
|
||||||
<widget class="QLabel" name="lblCameraCount">
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="1">
|
|
||||||
<widget class="QLabel" name="lblShaderCount">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="7" column="1">
|
|
||||||
<widget class="QLabel" name="lblHasAnimation">
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="8" column="0">
|
|
||||||
<widget class="QLabel" name="lblDistance_Label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Distance</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="8" column="1">
|
|
||||||
<widget class="QLabel" name="lblDistance">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="grpDynamics">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="title">
|
|
||||||
<string>Dynamics</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QPushButton" name="butAnimationStart">
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Animation start</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QPushButton" name="butAnimationStop">
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Animation stop</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QTabWidget" name="tabInfoAndControl">
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="currentIndex">
|
|
||||||
<number>2</number>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="tab">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Log</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QTextBrowser" name="tbLog">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="tab_2">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Lights and cameras</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QListWidget" name="lstLight">
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Light sources of the scene</string>
|
|
||||||
</property>
|
|
||||||
<property name="editTriggers">
|
|
||||||
<set>QAbstractItemView::SelectedClicked</set>
|
|
||||||
</property>
|
|
||||||
<property name="showDropIndicator" stdset="0">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="selectionMode">
|
|
||||||
<enum>QAbstractItemView::MultiSelection</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QListWidget" name="lstCamera">
|
|
||||||
<property name="focusPolicy">
|
|
||||||
<enum>Qt::NoFocus</enum>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Cameras of the scene</string>
|
|
||||||
</property>
|
|
||||||
<property name="editTriggers">
|
|
||||||
<set>QAbstractItemView::NoEditTriggers</set>
|
|
||||||
</property>
|
|
||||||
<property name="showDropIndicator" stdset="0">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="tab_3">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Control</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QCheckBox" name="cbxLighting">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Enable/Disable OpenGL lighting</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Lighting</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QCheckBox" name="cbxBBox">
|
|
||||||
<property name="text">
|
|
||||||
<string>Scene BBox</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QCheckBox" name="cbxTextures">
|
|
||||||
<property name="text">
|
|
||||||
<string>Textures</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
|
||||||
<widget class="QCheckBox" name="cbxDrawAxes">
|
|
||||||
<property name="text">
|
|
||||||
<string>Show Axes</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
<slots>
|
|
||||||
<signal>installEventFilter()</signal>
|
|
||||||
</slots>
|
|
||||||
</ui>
|
|
Loading…
Reference in New Issue