FBXImporter: move MeshGeometry declaration into its own header
This commit is contained in:
@@ -46,7 +46,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "FBXParser.h"
|
||||
#include "FBXMeshGeometry.h"
|
||||
#include "FBXDocument.h"
|
||||
#include "FBXImporter.h"
|
||||
#include "FBXImportSettings.h"
|
||||
@@ -57,8 +57,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
namespace Assimp {
|
||||
namespace FBX {
|
||||
|
||||
using namespace Util;
|
||||
|
||||
using namespace Util;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Geometry::Geometry(uint64_t id, const Element& element, const std::string& name, const Document& doc)
|
||||
@@ -82,6 +81,9 @@ Geometry::~Geometry()
|
||||
|
||||
}
|
||||
|
||||
const Skin* Geometry::DeformerSkin() const {
|
||||
return skin;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@@ -182,14 +184,93 @@ MeshGeometry::MeshGeometry(uint64_t id, const Element& element, const std::strin
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
MeshGeometry::~MeshGeometry()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
const std::vector<aiVector3D>& MeshGeometry::GetVertices() const {
|
||||
return vertices;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
const std::vector<aiVector3D>& MeshGeometry::GetNormals() const {
|
||||
return normals;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
const std::vector<aiVector3D>& MeshGeometry::GetTangents() const {
|
||||
return tangents;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
const std::vector<aiVector3D>& MeshGeometry::GetBinormals() const {
|
||||
return binormals;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
const std::vector<unsigned int>& MeshGeometry::GetFaceIndexCounts() const {
|
||||
return faces;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
const std::vector<aiVector2D>& MeshGeometry::GetTextureCoords( unsigned int index ) const {
|
||||
static const std::vector<aiVector2D> empty;
|
||||
return index >= AI_MAX_NUMBER_OF_TEXTURECOORDS ? empty : uvs[ index ];
|
||||
}
|
||||
|
||||
std::string MeshGeometry::GetTextureCoordChannelName( unsigned int index ) const {
|
||||
return index >= AI_MAX_NUMBER_OF_TEXTURECOORDS ? "" : uvNames[ index ];
|
||||
}
|
||||
|
||||
const std::vector<aiColor4D>& MeshGeometry::GetVertexColors( unsigned int index ) const {
|
||||
static const std::vector<aiColor4D> empty;
|
||||
return index >= AI_MAX_NUMBER_OF_COLOR_SETS ? empty : colors[ index ];
|
||||
}
|
||||
|
||||
const MatIndexArray& MeshGeometry::GetMaterialIndices() const {
|
||||
return materials;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
const unsigned int* MeshGeometry::ToOutputVertexIndex( unsigned int in_index, unsigned int& count ) const {
|
||||
if ( in_index >= mapping_counts.size() ) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ai_assert( mapping_counts.size() == mapping_offsets.size() );
|
||||
count = mapping_counts[ in_index ];
|
||||
|
||||
ai_assert( count != 0 );
|
||||
ai_assert( mapping_offsets[ in_index ] + count <= mappings.size() );
|
||||
|
||||
return &mappings[ mapping_offsets[ in_index ] ];
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
unsigned int MeshGeometry::FaceForVertexIndex( unsigned int in_index ) const {
|
||||
ai_assert( in_index < vertices.size() );
|
||||
|
||||
// in the current conversion pattern this will only be needed if
|
||||
// weights are present, so no need to always pre-compute this table
|
||||
if ( facesVertexStartIndices.empty() ) {
|
||||
facesVertexStartIndices.resize( faces.size() + 1, 0 );
|
||||
|
||||
std::partial_sum( faces.begin(), faces.end(), facesVertexStartIndices.begin() + 1 );
|
||||
facesVertexStartIndices.pop_back();
|
||||
}
|
||||
|
||||
ai_assert( facesVertexStartIndices.size() == faces.size() );
|
||||
const std::vector<unsigned int>::iterator it = std::upper_bound(
|
||||
facesVertexStartIndices.begin(),
|
||||
facesVertexStartIndices.end(),
|
||||
in_index
|
||||
);
|
||||
|
||||
return static_cast< unsigned int >( std::distance( facesVertexStartIndices.begin(), it - 1 ) );
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void MeshGeometry::ReadLayer(const Scope& layer)
|
||||
|
||||
Reference in New Issue
Block a user