Updated Assimp

Added initial behavior for ImageAssets to hold a list of GFX resources of different texture profiles to avoid mem leaks with incorrect-typed usages
Added function to ImageAsset to get best-fit asset, allowing for fallbacks if the requested assetID is not found
Added function to ShapeAsset to get best-fit asset, allowing for fallbacks if the requested assetID is not found
Disabled fields for dynamic and static shadowmap refresh rates
Moved noShape model to core/rendering/shapes to place it in a more logical module position
Added an include to avoid undefined type compile error and removed unneeded semicolon from zone code
Added call to reload probe textures when a reloadTextures call is made
Adjusted default directional light shadowmap settings to not be as extreme
Added utility function to probe manager to allow any class to request a 'best fit' list of probes that would affect a given location, allowing other classes such as fog or particles to utilize IBL. Also updated probeManager's forward rendering to utilize same function to reduce code duplication.
Shifted shape loader code to utilize assimp for loader consistency and testing
Changed render bin used for SSAO postfx so it runs at the right time
Made Core_Rendering module scan for assets
Updated loose file references to a number of assets to follow proper formatting
Refactored asset import code to follow a more consistent object heirarchy structure on importing assets, allowing more reliable cross-referencing between inbound items
Updated asset import logic for materials/images so that they properly utilize ImageType. Images correctly save out the assigned image type, materials reference the images' type to know what map slot they should be used in. Importer logic also updated to better find-and-add associated images based on type.
Cleaned up a bunch of old, outdated code in the asset importer
Added initial handling for in-place importing of files without needing to process them through the UI.
Added ability to edit module script from RMB context menu if torsion path is set
Updated list field code for variable inspector to utilize correct ownerObject field
This commit is contained in:
Areloch 2020-03-19 09:47:38 -05:00
parent 2d015bc426
commit 6ade6f08ce
545 changed files with 15077 additions and 8437 deletions

View file

@ -3,7 +3,7 @@
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2019, assimp team
Copyright (c) 2006-2020, assimp team
@ -53,6 +53,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/material.h>
#include <assimp/Importer.hpp>
#include <cstdlib>
#include <memory>
#include <utility>
namespace Assimp {
@ -71,16 +73,16 @@ ObjFileParser::ObjFileParser()
ObjFileParser::ObjFileParser( IOStreamBuffer<char> &streamBuffer, const std::string &modelName,
IOSystem *io, ProgressHandler* progress,
const std::string &originalObjFileName) :
std::string originalObjFileName) :
m_DataIt(),
m_DataItEnd(),
m_pModel(nullptr),
m_uiLine(0),
m_pIO( io ),
m_pIO(io),
m_progress(progress),
m_originalObjFileName(originalObjFileName)
m_originalObjFileName(std::move(originalObjFileName))
{
std::fill_n(m_buffer,Buffersize,0);
std::fill_n(m_buffer, Buffersize,0);
// Create the model instance to store all the data
m_pModel.reset(new ObjFile::Model());
@ -96,7 +98,8 @@ ObjFileParser::ObjFileParser( IOStreamBuffer<char> &streamBuffer, const std::str
parseFile( streamBuffer );
}
ObjFileParser::~ObjFileParser() {
ObjFileParser::~ObjFileParser()
{
}
void ObjFileParser::setBuffer( std::vector<char> &buffer ) {
@ -128,7 +131,7 @@ void ObjFileParser::parseFile( IOStreamBuffer<char> &streamBuffer ) {
processed = static_cast<unsigned int>(filePos);
lastFilePos = filePos;
progressCounter++;
m_progress->UpdateFileRead( processed, progressTotal );
m_progress->UpdateFileRead(processed, progressTotal);
}
// parse line
@ -182,7 +185,7 @@ void ObjFileParser::parseFile( IOStreamBuffer<char> &streamBuffer ) {
getNameNoSpace(m_DataIt, m_DataItEnd, name);
size_t nextSpace = name.find(" ");
size_t nextSpace = name.find(' ');
if (nextSpace != std::string::npos)
name = name.substr(0, nextSpace);
@ -199,7 +202,7 @@ void ObjFileParser::parseFile( IOStreamBuffer<char> &streamBuffer ) {
getNameNoSpace(m_DataIt, m_DataItEnd, name);
size_t nextSpace = name.find(" ");
size_t nextSpace = name.find(' ');
if (nextSpace != std::string::npos)
name = name.substr(0, nextSpace);
@ -274,13 +277,8 @@ static bool isDataDefinitionEnd( const char *tmp ) {
static bool isNanOrInf(const char * in) {
// Look for "nan" or "inf", case insensitive
if ((in[0] == 'N' || in[0] == 'n') && ASSIMP_strincmp(in, "nan", 3) == 0) {
return true;
}
else if ((in[0] == 'I' || in[0] == 'i') && ASSIMP_strincmp(in, "inf", 3) == 0) {
return true;
}
return false;
return ((in[0] == 'N' || in[0] == 'n') && ASSIMP_strincmp(in, "nan", 3) == 0) ||
((in[0] == 'I' || in[0] == 'i') && ASSIMP_strincmp(in, "inf", 3) == 0);
}
size_t ObjFileParser::getNumComponentsInDataDefinition() {
@ -341,7 +339,7 @@ size_t ObjFileParser::getTexCoordVector( std::vector<aiVector3D> &point3d_array
if (!std::isfinite(z))
z = 0;
point3d_array.push_back( aiVector3D( x, y, z ) );
point3d_array.emplace_back( x, y, z );
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
return numComponents;
}
@ -357,7 +355,7 @@ void ObjFileParser::getVector3( std::vector<aiVector3D> &point3d_array ) {
copyNextWord( m_buffer, Buffersize );
z = ( ai_real ) fast_atof( m_buffer );
point3d_array.push_back( aiVector3D( x, y, z ) );
point3d_array.emplace_back( x, y, z );
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
}
@ -378,7 +376,7 @@ void ObjFileParser::getHomogeneousVector3( std::vector<aiVector3D> &point3d_arra
if (w == 0)
throw DeadlyImportError("OBJ: Invalid component in homogeneous vector (Division by zero)");
point3d_array.push_back( aiVector3D( x/w, y/w, z/w ) );
point3d_array.emplace_back( x/w, y/w, z/w );
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
}
@ -393,7 +391,7 @@ void ObjFileParser::getTwoVectors3( std::vector<aiVector3D> &point3d_array_a, st
copyNextWord( m_buffer, Buffersize );
z = ( ai_real ) fast_atof( m_buffer );
point3d_array_a.push_back( aiVector3D( x, y, z ) );
point3d_array_a.emplace_back( x, y, z );
copyNextWord(m_buffer, Buffersize);
x = (ai_real) fast_atof(m_buffer);
@ -404,7 +402,7 @@ void ObjFileParser::getTwoVectors3( std::vector<aiVector3D> &point3d_array_a, st
copyNextWord( m_buffer, Buffersize );
z = ( ai_real ) fast_atof( m_buffer );
point3d_array_b.push_back( aiVector3D( x, y, z ) );
point3d_array_b.emplace_back( x, y, z );
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
}
@ -417,7 +415,7 @@ void ObjFileParser::getVector2( std::vector<aiVector2D> &point2d_array ) {
copyNextWord(m_buffer, Buffersize);
y = (ai_real) fast_atof(m_buffer);
point2d_array.push_back(aiVector2D(x, y));
point2d_array.emplace_back(x, y);
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
}
@ -439,9 +437,9 @@ void ObjFileParser::getFace( aiPrimitiveType type ) {
const bool vt = (!m_pModel->m_TextureCoord.empty());
const bool vn = (!m_pModel->m_Normals.empty());
int iStep = 0, iPos = 0;
int iPos = 0;
while ( m_DataIt != m_DataItEnd ) {
iStep = 1;
int iStep = 1;
if ( IsLineEnd( *m_DataIt ) ) {
break;
@ -845,7 +843,7 @@ void ObjFileParser::createMesh( const std::string &meshName )
bool ObjFileParser::needsNewMesh( const std::string &materialName )
{
// If no mesh data yet
if(m_pModel->m_pCurrentMesh == 0)
if (m_pModel->m_pCurrentMesh == nullptr)
{
return true;
}
@ -856,7 +854,7 @@ bool ObjFileParser::needsNewMesh( const std::string &materialName )
&& curMatIdx != matIdx
// no need create a new mesh if no faces in current
// lets say 'usemtl' goes straight after 'g'
&& m_pModel->m_pCurrentMesh->m_Faces.size() > 0 )
&& !m_pModel->m_pCurrentMesh->m_Faces.empty() )
{
// New material -> only one material per mesh, so we need to create a new
// material