mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
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:
parent
2d015bc426
commit
6ade6f08ce
545 changed files with 15077 additions and 8437 deletions
|
|
@ -3,7 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2019, assimp team
|
||||
Copyright (c) 2006-2020, assimp team
|
||||
|
||||
|
||||
|
||||
|
|
@ -175,15 +175,15 @@ void ObjFileImporter::CreateDataFromImport(const ObjFile::Model* pModel, aiScene
|
|||
ai_assert(false);
|
||||
}
|
||||
|
||||
if (pModel->m_Objects.size() > 0) {
|
||||
if (!pModel->m_Objects.empty()) {
|
||||
|
||||
unsigned int meshCount = 0;
|
||||
unsigned int childCount = 0;
|
||||
|
||||
for(size_t index = 0; index < pModel->m_Objects.size(); ++index) {
|
||||
if(pModel->m_Objects[index]) {
|
||||
for (auto object : pModel->m_Objects) {
|
||||
if(object) {
|
||||
++childCount;
|
||||
meshCount += (unsigned int)pModel->m_Objects[index]->m_Meshes.size();
|
||||
meshCount += (unsigned int)object->m_Meshes.size();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -365,8 +365,8 @@ aiMesh *ObjFileImporter::createTopology( const ObjFile::Model* pModel, const Obj
|
|||
unsigned int outIndex( 0 );
|
||||
|
||||
// Copy all data from all stored meshes
|
||||
for (size_t index = 0; index < pObjMesh->m_Faces.size(); index++) {
|
||||
ObjFile::Face* const inp = pObjMesh->m_Faces[ index ];
|
||||
for (auto& face : pObjMesh->m_Faces) {
|
||||
ObjFile::Face* const inp = face;
|
||||
if (inp->m_PrimitiveType == aiPrimitiveType_LINE) {
|
||||
for(size_t i = 0; i < inp->m_vertices.size() - 1; ++i) {
|
||||
aiFace& f = pMesh->mFaces[ outIndex++ ];
|
||||
|
|
@ -385,7 +385,7 @@ aiMesh *ObjFileImporter::createTopology( const ObjFile::Model* pModel, const Obj
|
|||
}
|
||||
|
||||
aiFace *pFace = &pMesh->mFaces[ outIndex++ ];
|
||||
const unsigned int uiNumIndices = (unsigned int) pObjMesh->m_Faces[ index ]->m_vertices.size();
|
||||
const unsigned int uiNumIndices = (unsigned int) face->m_vertices.size();
|
||||
uiIdxCount += pFace->mNumIndices = (unsigned int) uiNumIndices;
|
||||
if (pFace->mNumIndices > 0) {
|
||||
pFace->mIndices = new unsigned int[ uiNumIndices ];
|
||||
|
|
@ -446,13 +446,10 @@ void ObjFileImporter::createVertexArray(const ObjFile::Model* pModel,
|
|||
// Copy vertices, normals and textures into aiMesh instance
|
||||
bool normalsok = true, uvok = true;
|
||||
unsigned int newIndex = 0, outIndex = 0;
|
||||
for ( size_t index=0; index < pObjMesh->m_Faces.size(); index++ ) {
|
||||
// Get source face
|
||||
ObjFile::Face *pSourceFace = pObjMesh->m_Faces[ index ];
|
||||
|
||||
for (auto sourceFace : pObjMesh->m_Faces) {
|
||||
// Copy all index arrays
|
||||
for ( size_t vertexIndex = 0, outVertexIndex = 0; vertexIndex < pSourceFace->m_vertices.size(); vertexIndex++ ) {
|
||||
const unsigned int vertex = pSourceFace->m_vertices.at( vertexIndex );
|
||||
for (size_t vertexIndex = 0, outVertexIndex = 0; vertexIndex < sourceFace->m_vertices.size(); vertexIndex++ ) {
|
||||
const unsigned int vertex = sourceFace->m_vertices.at(vertexIndex );
|
||||
if ( vertex >= pModel->m_Vertices.size() ) {
|
||||
throw DeadlyImportError( "OBJ: vertex index out of range" );
|
||||
}
|
||||
|
|
@ -464,8 +461,8 @@ void ObjFileImporter::createVertexArray(const ObjFile::Model* pModel,
|
|||
pMesh->mVertices[ newIndex ] = pModel->m_Vertices[ vertex ];
|
||||
|
||||
// Copy all normals
|
||||
if ( normalsok && !pModel->m_Normals.empty() && vertexIndex < pSourceFace->m_normals.size()) {
|
||||
const unsigned int normal = pSourceFace->m_normals.at( vertexIndex );
|
||||
if ( normalsok && !pModel->m_Normals.empty() && vertexIndex < sourceFace->m_normals.size()) {
|
||||
const unsigned int normal = sourceFace->m_normals.at(vertexIndex );
|
||||
if ( normal >= pModel->m_Normals.size() )
|
||||
{
|
||||
normalsok = false;
|
||||
|
|
@ -484,9 +481,9 @@ void ObjFileImporter::createVertexArray(const ObjFile::Model* pModel,
|
|||
}
|
||||
|
||||
// Copy all texture coordinates
|
||||
if ( uvok && !pModel->m_TextureCoord.empty() && vertexIndex < pSourceFace->m_texturCoords.size())
|
||||
if ( uvok && !pModel->m_TextureCoord.empty() && vertexIndex < sourceFace->m_texturCoords.size())
|
||||
{
|
||||
const unsigned int tex = pSourceFace->m_texturCoords.at( vertexIndex );
|
||||
const unsigned int tex = sourceFace->m_texturCoords.at(vertexIndex );
|
||||
|
||||
if ( tex >= pModel->m_TextureCoord.size() )
|
||||
{
|
||||
|
|
@ -502,16 +499,16 @@ void ObjFileImporter::createVertexArray(const ObjFile::Model* pModel,
|
|||
// Get destination face
|
||||
aiFace *pDestFace = &pMesh->mFaces[ outIndex ];
|
||||
|
||||
const bool last = ( vertexIndex == pSourceFace->m_vertices.size() - 1 );
|
||||
if (pSourceFace->m_PrimitiveType != aiPrimitiveType_LINE || !last) {
|
||||
const bool last = (vertexIndex == sourceFace->m_vertices.size() - 1 );
|
||||
if (sourceFace->m_PrimitiveType != aiPrimitiveType_LINE || !last) {
|
||||
pDestFace->mIndices[ outVertexIndex ] = newIndex;
|
||||
outVertexIndex++;
|
||||
}
|
||||
|
||||
if (pSourceFace->m_PrimitiveType == aiPrimitiveType_POINT) {
|
||||
if (sourceFace->m_PrimitiveType == aiPrimitiveType_POINT) {
|
||||
outIndex++;
|
||||
outVertexIndex = 0;
|
||||
} else if (pSourceFace->m_PrimitiveType == aiPrimitiveType_LINE) {
|
||||
} else if (sourceFace->m_PrimitiveType == aiPrimitiveType_LINE) {
|
||||
outVertexIndex = 0;
|
||||
|
||||
if(!last)
|
||||
|
|
@ -520,7 +517,7 @@ void ObjFileImporter::createVertexArray(const ObjFile::Model* pModel,
|
|||
if (vertexIndex) {
|
||||
if(!last) {
|
||||
pMesh->mVertices[ newIndex+1 ] = pMesh->mVertices[ newIndex ];
|
||||
if ( !pSourceFace->m_normals.empty() && !pModel->m_Normals.empty()) {
|
||||
if (!sourceFace->m_normals.empty() && !pModel->m_Normals.empty()) {
|
||||
pMesh->mNormals[ newIndex+1 ] = pMesh->mNormals[newIndex ];
|
||||
}
|
||||
if ( !pModel->m_TextureCoord.empty() ) {
|
||||
|
|
@ -563,13 +560,11 @@ void ObjFileImporter::countObjects(const std::vector<ObjFile::Object*> &rObjects
|
|||
return;
|
||||
|
||||
iNumMeshes += static_cast<unsigned int>( rObjects.size() );
|
||||
for (std::vector<ObjFile::Object*>::const_iterator it = rObjects.begin();
|
||||
it != rObjects.end();
|
||||
++it)
|
||||
for (auto object: rObjects)
|
||||
{
|
||||
if (!(*it)->m_SubObjects.empty())
|
||||
if (!object->m_SubObjects.empty())
|
||||
{
|
||||
countObjects((*it)->m_SubObjects, iNumMeshes);
|
||||
countObjects(object->m_SubObjects, iNumMeshes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue