Merge branch 'master' into issue_2024
commit
43ddd93fae
|
@ -272,12 +272,13 @@ struct Node
|
|||
/** Node instances at this node */
|
||||
std::vector<NodeInstance> mNodeInstances;
|
||||
|
||||
/** Rootnodes: Name of primary camera, if any */
|
||||
/** Root-nodes: Name of primary camera, if any */
|
||||
std::string mPrimaryCamera;
|
||||
|
||||
//! Constructor. Begin with a zero parent
|
||||
Node() {
|
||||
mParent = NULL;
|
||||
Node()
|
||||
: mParent( nullptr ){
|
||||
// empty
|
||||
}
|
||||
|
||||
//! Destructor: delete all children subsequently
|
||||
|
|
|
@ -201,6 +201,7 @@ void ColladaLoader::InternReadFile( const std::string& pFile, aiScene* pScene, I
|
|||
0, -1, 0, 0,
|
||||
0, 0, 0, 1);
|
||||
}
|
||||
|
||||
// store all meshes
|
||||
StoreSceneMeshes( pScene);
|
||||
|
||||
|
@ -740,10 +741,6 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada::
|
|||
// create bones if given
|
||||
if( pSrcController && pSrcController->mType == Collada::Skin)
|
||||
{
|
||||
// refuse if the vertex count does not match
|
||||
// if( pSrcController->mWeightCounts.size() != dstMesh->mNumVertices)
|
||||
// throw DeadlyImportError( "Joint Controller vertex count does not match mesh vertex count");
|
||||
|
||||
// resolve references - joint names
|
||||
const Collada::Accessor& jointNamesAcc = pParser.ResolveLibraryReference( pParser.mAccessorLibrary, pSrcController->mJointNameSource);
|
||||
const Collada::Data& jointNames = pParser.ResolveLibraryReference( pParser.mDataLibrary, jointNamesAcc.mSource);
|
||||
|
@ -971,7 +968,8 @@ void ColladaLoader::StoreAnimations( aiScene* pScene, const ColladaParser& pPars
|
|||
for( size_t b = a+1; b < mAnims.size(); ++b)
|
||||
{
|
||||
aiAnimation* other = mAnims[b];
|
||||
if( other->mNumChannels == 1 && other->mDuration == templateAnim->mDuration && other->mTicksPerSecond == templateAnim->mTicksPerSecond )
|
||||
if( other->mNumChannels == 1 && other->mDuration == templateAnim->mDuration &&
|
||||
other->mTicksPerSecond == templateAnim->mTicksPerSecond )
|
||||
collectedAnimIndices.push_back( b);
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ using namespace Assimp::Formatter;
|
|||
// Constructor to be privately used by Importer
|
||||
ColladaParser::ColladaParser( IOSystem* pIOHandler, const std::string& pFile)
|
||||
: mFileName( pFile )
|
||||
, mReader( NULL )
|
||||
, mReader( nullptr )
|
||||
, mDataLibrary()
|
||||
, mAccessorLibrary()
|
||||
, mMeshLibrary()
|
||||
|
@ -79,20 +79,20 @@ ColladaParser::ColladaParser( IOSystem* pIOHandler, const std::string& pFile)
|
|||
, mLightLibrary()
|
||||
, mCameraLibrary()
|
||||
, mControllerLibrary()
|
||||
, mRootNode( NULL )
|
||||
, mRootNode( nullptr )
|
||||
, mAnims()
|
||||
, mUnitSize( 1.0f )
|
||||
, mUpDirection( UP_Y )
|
||||
, mFormat(FV_1_5_n ) // We assume the newest file format by default
|
||||
{
|
||||
// validate io-handler instance
|
||||
if ( NULL == pIOHandler ) {
|
||||
if (nullptr == pIOHandler ) {
|
||||
throw DeadlyImportError("IOSystem is NULL." );
|
||||
}
|
||||
|
||||
// open the file
|
||||
std::unique_ptr<IOStream> file( pIOHandler->Open(pFile ) );
|
||||
if (file.get() == NULL) {
|
||||
if (file.get() == nullptr) {
|
||||
throw DeadlyImportError( "Failed to open file " + pFile + "." );
|
||||
}
|
||||
|
||||
|
@ -363,9 +363,9 @@ void ColladaParser::ReadAnimationClipLibrary()
|
|||
|
||||
void ColladaParser::PostProcessControllers()
|
||||
{
|
||||
for (ControllerLibrary::iterator it = mControllerLibrary.begin(); it != mControllerLibrary.end(); ++it)
|
||||
{
|
||||
std::string meshId = it->second.mMeshId;
|
||||
std::string meshId;
|
||||
for (ControllerLibrary::iterator it = mControllerLibrary.begin(); it != mControllerLibrary.end(); ++it) {
|
||||
meshId = it->second.mMeshId;
|
||||
ControllerLibrary::iterator findItr = mControllerLibrary.find(meshId);
|
||||
while(findItr != mControllerLibrary.end()) {
|
||||
meshId = findItr->second.mMeshId;
|
||||
|
|
|
@ -1261,9 +1261,10 @@ 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);
|
||||
}
|
||||
|
||||
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; };
|
||||
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 * AI_MATH_PI / 180.0;
|
||||
};
|
||||
|
||||
aiMatrix4x4 mat_rot;
|
||||
|
||||
|
@ -1276,7 +1277,7 @@ auto deg2rad = [](const GLfloat pDegree) -> GLfloat { return pDegree * M_PI / 18
|
|||
|
||||
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 * AI_MATH_PI / 180.0; };
|
||||
|
||||
aiMatrix4x4 mat_rot;
|
||||
|
||||
|
|
|
@ -133,8 +133,7 @@ void MainWindow::LogError(const QString& pMessage)
|
|||
void MainWindow::mousePressEvent(QMouseEvent* pEvent)
|
||||
{
|
||||
const QPoint ms_pt = pEvent->pos();
|
||||
|
||||
__unused aiVector3D temp_v3;
|
||||
aiVector3D temp_v3;
|
||||
|
||||
// Check if GLView is pointed.
|
||||
if(childAt(ms_pt) == mGLView)
|
||||
|
@ -305,24 +304,26 @@ void MainWindow::SceneObject_LightSource(const QString& pName)
|
|||
ui->lstLight->selectAll();
|
||||
}
|
||||
|
||||
void MainWindow::on_butOpenFile_clicked()
|
||||
{
|
||||
void MainWindow::on_butOpenFile_clicked() {
|
||||
aiString filter_temp;
|
||||
QString filename, filter;
|
||||
|
||||
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);
|
||||
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;
|
||||
|
@ -373,6 +374,7 @@ QMap<QString, const aiExportFormatDesc*> exportersMap;
|
|||
LogError(errorMessage);
|
||||
QMessageBox::critical(this, "Export error", errorMessage);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void MainWindow::on_cbxLighting_clicked(bool pChecked)
|
||||
|
@ -382,11 +384,7 @@ void MainWindow::on_cbxLighting_clicked(bool pChecked)
|
|||
else
|
||||
mGLView->Lighting_Disable();
|
||||
|
||||
#if ASSIMP_QT4_VIEWER
|
||||
mGLView->updateGL();
|
||||
#else
|
||||
mGLView->update();
|
||||
#endif // ASSIMP_QT4_VIEWER
|
||||
}
|
||||
|
||||
void MainWindow::on_lstLight_itemSelectionChanged()
|
||||
|
@ -438,9 +436,5 @@ void MainWindow::on_cbxDrawAxes_clicked(bool checked)
|
|||
void MainWindow::on_cbxTextures_clicked(bool checked)
|
||||
{
|
||||
mGLView->Enable_Textures(checked);
|
||||
#if ASSIMP_QT4_VIEWER
|
||||
mGLView->updateGL();
|
||||
#else
|
||||
mGLView->update();
|
||||
#endif // ASSIMP_QT4_VIEWER
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#pragma once
|
||||
|
||||
// Header files, Qt.
|
||||
#if ASSIMP_QT4_VIEWER
|
||||
#if defined ASSIMP_QT4_VIEWER
|
||||
# include <QMainWindow>
|
||||
#else
|
||||
# include <QtWidgets>
|
||||
|
|
Loading…
Reference in New Issue