Just the functional assimp lib rather than the entire assimp repository unnecessarily.

This commit is contained in:
Areloch 2019-02-28 16:37:15 -06:00
parent 0f7641a282
commit e9ea38eda3
1747 changed files with 9012 additions and 925008 deletions

View file

@ -2,8 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team
Copyright (c) 2006-2017, assimp team
All rights reserved.
@ -79,13 +78,14 @@ Geometry::Geometry(uint64_t id, const Element& element, const std::string& name,
// ------------------------------------------------------------------------------------------------
Geometry::~Geometry()
{
// empty
}
const Skin* Geometry::DeformerSkin() const {
return skin;
}
// ------------------------------------------------------------------------------------------------
MeshGeometry::MeshGeometry(uint64_t id, const Element& element, const std::string& name, const Document& doc)
: Geometry(id, element,name, doc)
@ -185,8 +185,9 @@ MeshGeometry::MeshGeometry(uint64_t id, const Element& element, const std::strin
}
// ------------------------------------------------------------------------------------------------
MeshGeometry::~MeshGeometry() {
// empty
MeshGeometry::~MeshGeometry()
{
}
// ------------------------------------------------------------------------------------------------
@ -306,6 +307,7 @@ void MeshGeometry::ReadLayerElement(const Scope& layerElement)
<< type << ", index: " << typedIndex);
}
// ------------------------------------------------------------------------------------------------
void MeshGeometry::ReadVertexData(const std::string& type, int index, const Scope& source)
{
@ -409,6 +411,7 @@ void MeshGeometry::ReadVertexData(const std::string& type, int index, const Scop
}
}
// ------------------------------------------------------------------------------------------------
// Lengthy utility function to read and resolve a FBX vertex data array - that is, the
// output is in polygon vertex order. This logic is used for reading normals, UVs, colors,
@ -424,23 +427,13 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
const std::vector<unsigned int>& mapping_offsets,
const std::vector<unsigned int>& mappings)
{
bool isDirect = ReferenceInformationType == "Direct";
bool isIndexToDirect = ReferenceInformationType == "IndexToDirect";
// fall-back to direct data if there is no index data element
if ( isIndexToDirect && !HasElement( source, indexDataElementName ) ) {
isDirect = true;
isIndexToDirect = false;
}
// handle permutations of Mapping and Reference type - it would be nice to
// deal with this more elegantly and with less redundancy, but right
// now it seems unavoidable.
if (MappingInformationType == "ByVertice" && isDirect) {
if (!HasElement(source, dataElementName)) {
return;
}
std::vector<T> tempData;
if (MappingInformationType == "ByVertice" && ReferenceInformationType == "Direct") {
std::vector<T> tempData;
ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName));
data_out.resize(vertex_count);
@ -452,7 +445,7 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
}
}
}
else if (MappingInformationType == "ByVertice" && isIndexToDirect) {
else if (MappingInformationType == "ByVertice" && ReferenceInformationType == "IndexToDirect") {
std::vector<T> tempData;
ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName));
@ -460,6 +453,7 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
std::vector<int> uvIndices;
ParseVectorDataArray(uvIndices,GetRequiredElement(source,indexDataElementName));
for (size_t i = 0, e = uvIndices.size(); i < e; ++i) {
const unsigned int istart = mapping_offsets[i], iend = istart + mapping_counts[i];
@ -471,7 +465,7 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
}
}
}
else if (MappingInformationType == "ByPolygonVertex" && isDirect) {
else if (MappingInformationType == "ByPolygonVertex" && ReferenceInformationType == "Direct") {
std::vector<T> tempData;
ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName));
@ -484,7 +478,7 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
data_out.swap(tempData);
}
else if (MappingInformationType == "ByPolygonVertex" && isIndexToDirect) {
else if (MappingInformationType == "ByPolygonVertex" && ReferenceInformationType == "IndexToDirect") {
std::vector<T> tempData;
ParseVectorDataArray(tempData, GetRequiredElement(source, dataElementName));
@ -498,14 +492,9 @@ void ResolveVertexDataArray(std::vector<T>& data_out, const Scope& source,
return;
}
const T empty;
unsigned int next = 0;
for(int i : uvIndices) {
if ( -1 == i ) {
data_out[ next++ ] = empty;
continue;
}
if (static_cast<size_t>(i) >= tempData.size()) {
if (static_cast<size_t>(i) >= tempData.size()) {
DOMError("index out of range",&GetRequiredElement(source,indexDataElementName));
}
@ -532,6 +521,7 @@ void MeshGeometry::ReadVertexDataNormals(std::vector<aiVector3D>& normals_out, c
m_mappings);
}
// ------------------------------------------------------------------------------------------------
void MeshGeometry::ReadVertexDataUV(std::vector<aiVector2D>& uv_out, const Scope& source,
const std::string& MappingInformationType,
@ -546,6 +536,7 @@ void MeshGeometry::ReadVertexDataUV(std::vector<aiVector2D>& uv_out, const Scope
m_mappings);
}
// ------------------------------------------------------------------------------------------------
void MeshGeometry::ReadVertexDataColors(std::vector<aiColor4D>& colors_out, const Scope& source,
const std::string& MappingInformationType,