Merge branch 'master' into bug-3201-collada_root_meshes

pull/3205/head
Kim Kulling 2020-05-16 20:50:34 +02:00 committed by GitHub
commit cfbdacb02a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
202 changed files with 3584 additions and 19959 deletions

6
.gitignore vendored
View File

@ -79,6 +79,12 @@ test/gtest/src/gtest-stamp/Debug/
tools/assimp_view/assimp_viewer.vcxproj.user
*.pyc
### Rust ###
# Generated by Cargo; will have compiled files and executables
port/assimp_rs/target/
# Backup files generated by rustfmt
port/assimp_rs/**/*.rs.bk
# Unix editor backups
*~
test/gtest/src/gtest-stamp/gtest-gitinfo.txt

100
INSTALL
View File

@ -1,50 +1,50 @@
========================================================================
Open Asset Import Library (assimp) INSTALL
========================================================================
------------------------------
Getting the documentation
------------------------------
A regularly-updated copy is available at
http://assimp.sourceforge.net/lib_html/index.html
A CHM file is included in the SVN repos: ./doc/AssimpDoc_Html/AssimpDoc.chm.
To build the doxygen documentation on your own, follow these steps:
a) download & install latest doxygen
b) make sure doxygen is in the executable search path
c) navigate to ./doc
d) and run 'doxygen'
Open the generated HTML (AssimpDoc_Html/index.html) in the browser of your choice.
Windows only: To generate the CHM doc, install 'Microsoft HTML Workshop'
and configure the path to it in the DOXYFILE first.
------------------------------
Building Assimp
------------------------------
More detailed build instructions can be found in the documentation,
this section is just for the inpatient among you.
CMake is the preferred build system for Assimp. The minimum required version
is 2.6. If you don't have it yet, downloads for CMake can be found on
http://www.cmake.org/.
For Unix:
1. mkdir build && cd build
2. cmake .. -G 'Unix Makefiles'
3. make -j4
For Windows:
1. Open a command prompt
2. mkdir build
3. cd build
4. cmake ..
5. cmake --build .
For iOS:
Just check the following project, which deploys a compiler toolchain for different iOS-versions: https://github.com/assimp/assimp/tree/master/port/iOS
========================================================================
Open Asset Import Library (assimp) INSTALL
========================================================================
------------------------------
Getting the documentation
------------------------------
A regularly-updated copy is available at
http://assimp.sourceforge.net/lib_html/index.html
A CHM file is included in the SVN repos: ./doc/AssimpDoc_Html/AssimpDoc.chm.
To build the doxygen documentation on your own, follow these steps:
a) download & install latest doxygen
b) make sure doxygen is in the executable search path
c) navigate to ./doc
d) and run 'doxygen'
Open the generated HTML (AssimpDoc_Html/index.html) in the browser of your choice.
Windows only: To generate the CHM doc, install 'Microsoft HTML Workshop'
and configure the path to it in the DOXYFILE first.
------------------------------
Building Assimp
------------------------------
More detailed build instructions can be found in the documentation,
this section is just for the inpatient among you.
CMake is the preferred build system for Assimp. The minimum required version
is 2.6. If you don't have it yet, downloads for CMake can be found on
http://www.cmake.org/.
For Unix:
1. mkdir build && cd build
2. cmake .. -G 'Unix Makefiles'
3. make -j4
For Windows:
1. Open a command prompt
2. mkdir build
3. cd build
4. cmake ..
5. cmake --build .
For iOS:
Just check the following project, which deploys a compiler toolchain for different iOS-versions: https://github.com/assimp/assimp/tree/master/port/iOS

View File

@ -1,4 +1,4 @@
/*
/*
---------------------------------------------------------------------------
Open Asset Import Library (assimp)
---------------------------------------------------------------------------

View File

@ -1,4 +1,4 @@
/*
/*
---------------------------------------------------------------------------
Open Asset Import Library (assimp)
---------------------------------------------------------------------------

View File

@ -1,4 +1,4 @@
/*
/*
---------------------------------------------------------------------------
Open Asset Import Library (assimp)
---------------------------------------------------------------------------

View File

@ -1,4 +1,4 @@
/*
/*
---------------------------------------------------------------------------
Open Asset Import Library (assimp)
---------------------------------------------------------------------------

View File

@ -83,6 +83,18 @@ static const aiImporterDesc desc = {
"dae zae"
};
static const float kMillisecondsFromSeconds = 1000.f;
// Add an item of metadata to a node
// Assumes the key is not already in the list
template <typename T>
inline void AddNodeMetaData(aiNode *node, const std::string &key, const T &value) {
if (nullptr == node->mMetaData) {
node->mMetaData = new aiMetadata();
}
node->mMetaData->Add(key, value);
}
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
ColladaLoader::ColladaLoader() :
@ -230,27 +242,15 @@ void ColladaLoader::InternReadFile(const std::string &pFile, aiScene *pScene, IO
}
}
// store all meshes
StoreSceneMeshes(pScene);
// store all materials
StoreSceneMaterials(pScene);
// store all textures
StoreSceneTextures(pScene);
// store all lights
StoreSceneLights(pScene);
// store all cameras
StoreSceneCameras(pScene);
// store all animations
StoreAnimations(pScene, parser);
// If no meshes have been loaded, it's probably just an animated skeleton.
if (0u == pScene->mNumMeshes) {
if (!noSkeletonMesh) {
SkeletonMeshBuilder hero(pScene);
}
@ -258,15 +258,6 @@ void ColladaLoader::InternReadFile(const std::string &pFile, aiScene *pScene, IO
}
}
// Add an item of metadata to a node
// Assumes the key is not already in the list
template <typename T>
inline void AddNodeMetaData(aiNode *node, const std::string &key, const T &value) {
if (nullptr == node->mMetaData)
node->mMetaData = new aiMetadata();
node->mMetaData->Add(key, value);
}
// ------------------------------------------------------------------------------------------------
// Recursively constructs a scene node for the given parser node and returns it.
aiNode *ColladaLoader::BuildHierarchy(const ColladaParser &pParser, const Collada::Node *pNode) {
@ -277,10 +268,12 @@ aiNode *ColladaLoader::BuildHierarchy(const ColladaParser &pParser, const Collad
node->mName.Set(FindNameForNode(pNode));
// if we're not using the unique IDs, hold onto them for reference and export
if (useColladaName) {
if (!pNode->mID.empty())
if (!pNode->mID.empty()) {
AddNodeMetaData(node, AI_METADATA_COLLADA_ID, aiString(pNode->mID));
if (!pNode->mSID.empty())
}
if (!pNode->mSID.empty()) {
AddNodeMetaData(node, AI_METADATA_COLLADA_SID, aiString(pNode->mSID));
}
}
// calculate the transformation matrix for it
@ -305,13 +298,8 @@ aiNode *ColladaLoader::BuildHierarchy(const ColladaParser &pParser, const Collad
node->mChildren[pNode->mChildren.size() + a]->mParent = node;
}
// construct meshes
BuildMeshesForNode(pParser, pNode, node);
// construct cameras
BuildCamerasForNode(pParser, pNode, node);
// construct lights
BuildLightsForNode(pParser, pNode, node);
return node;
@ -347,9 +335,7 @@ void ColladaLoader::ResolveNodeInstances(const ColladaParser &pParser, const Col
// ------------------------------------------------------------------------------------------------
// Resolve UV channels
void ColladaLoader::ApplyVertexToEffectSemanticMapping(Collada::Sampler &sampler,
const Collada::SemanticMappingTable &table) {
void ColladaLoader::ApplyVertexToEffectSemanticMapping(Collada::Sampler &sampler, const Collada::SemanticMappingTable &table) {
std::map<std::string, Collada::InputSemanticMapEntry>::const_iterator it = table.mMap.find(sampler.mUVChannel);
if (it != table.mMap.end()) {
if (it->second.mType != Collada::IT_Texcoord) {
@ -599,6 +585,10 @@ void ColladaLoader::BuildMeshesForNode(const ColladaParser &pParser, const Colla
// ------------------------------------------------------------------------------------------------
// Find mesh from either meshes or morph target meshes
aiMesh *ColladaLoader::findMesh(const std::string &meshid) {
if ( meshid.empty()) {
return nullptr;
}
for (unsigned int i = 0; i < mMeshes.size(); ++i) {
if (std::string(mMeshes[i]->mName.data) == meshid) {
return mMeshes[i];
@ -1386,9 +1376,9 @@ void ColladaLoader::CreateAnimation(aiScene *pScene, const ColladaParser &pParse
double time = double(mat.d4); // remember? time is stored in mat.d4
mat.d4 = 1.0f;
dstAnim->mPositionKeys[a].mTime = time;
dstAnim->mRotationKeys[a].mTime = time;
dstAnim->mScalingKeys[a].mTime = time;
dstAnim->mPositionKeys[a].mTime = time * kMillisecondsFromSeconds ;
dstAnim->mRotationKeys[a].mTime = time * kMillisecondsFromSeconds ;
dstAnim->mScalingKeys[a].mTime = time * kMillisecondsFromSeconds ;
mat.Decompose(dstAnim->mScalingKeys[a].mValue, dstAnim->mRotationKeys[a].mValue, dstAnim->mPositionKeys[a].mValue);
}
@ -1409,7 +1399,7 @@ void ColladaLoader::CreateAnimation(aiScene *pScene, const ColladaParser &pParse
if (e.mTargetId.find("morph-weights") != std::string::npos)
morphChannels.push_back(e);
}
if (morphChannels.size() > 0) {
if (!morphChannels.empty() ) {
// either 1) morph weight animation count should contain morph target count channels
// or 2) one channel with morph target count arrays
// assume first
@ -1418,7 +1408,6 @@ void ColladaLoader::CreateAnimation(aiScene *pScene, const ColladaParser &pParse
morphAnim->mName.Set(nodeName);
std::vector<MorphTimeValues> morphTimeValues;
int morphAnimChannelIndex = 0;
for (std::vector<Collada::ChannelEntry>::iterator it = morphChannels.begin(); it != morphChannels.end(); ++it) {
Collada::ChannelEntry &e = *it;
@ -1430,8 +1419,9 @@ void ColladaLoader::CreateAnimation(aiScene *pScene, const ColladaParser &pParse
// weight target can be in format Weight_M_N, Weight_N, WeightN, or some other way
// we ignore the name and just assume the channels are in the right order
for (unsigned int i = 0; i < e.mTimeData->mValues.size(); i++)
insertMorphTimeValue(morphTimeValues, e.mTimeData->mValues.at(i), e.mValueData->mValues.at(i), morphAnimChannelIndex);
for (unsigned int i = 0; i < e.mTimeData->mValues.size(); i++) {
insertMorphTimeValue(morphTimeValues, e.mTimeData->mValues[i], e.mValueData->mValues[i], morphAnimChannelIndex);
}
++morphAnimChannelIndex;
}
@ -1443,8 +1433,8 @@ void ColladaLoader::CreateAnimation(aiScene *pScene, const ColladaParser &pParse
morphAnim->mKeys[key].mValues = new unsigned int[morphChannels.size()];
morphAnim->mKeys[key].mWeights = new double[morphChannels.size()];
morphAnim->mKeys[key].mTime = morphTimeValues[key].mTime;
for (unsigned int valueIndex = 0; valueIndex < morphChannels.size(); valueIndex++) {
morphAnim->mKeys[key].mTime = morphTimeValues[key].mTime * kMillisecondsFromSeconds ;
for (unsigned int valueIndex = 0; valueIndex < morphChannels.size(); ++valueIndex ) {
morphAnim->mKeys[key].mValues[valueIndex] = valueIndex;
morphAnim->mKeys[key].mWeights[valueIndex] = getWeightAtKey(morphTimeValues, key, valueIndex);
}
@ -1494,18 +1484,22 @@ void ColladaLoader::AddTexture(aiMaterial &mat, const ColladaParser &pParser,
// mapping mode
int map = aiTextureMapMode_Clamp;
if (sampler.mWrapU)
if (sampler.mWrapU) {
map = aiTextureMapMode_Wrap;
if (sampler.mWrapU && sampler.mMirrorU)
}
if (sampler.mWrapU && sampler.mMirrorU) {
map = aiTextureMapMode_Mirror;
}
mat.AddProperty(&map, 1, _AI_MATKEY_MAPPINGMODE_U_BASE, type, idx);
map = aiTextureMapMode_Clamp;
if (sampler.mWrapV)
if (sampler.mWrapV) {
map = aiTextureMapMode_Wrap;
if (sampler.mWrapV && sampler.mMirrorV)
}
if (sampler.mWrapV && sampler.mMirrorV) {
map = aiTextureMapMode_Mirror;
}
mat.AddProperty(&map, 1, _AI_MATKEY_MAPPINGMODE_V_BASE, type, idx);
@ -1526,9 +1520,9 @@ void ColladaLoader::AddTexture(aiMaterial &mat, const ColladaParser &pParser,
// number in the channel name. We assume it is the zero-based index into the
// UV channel array of all corresponding meshes. It could also be one-based
// for some exporters, but we won't care of it unless someone complains about.
if (sampler.mUVId != UINT_MAX)
if (sampler.mUVId != UINT_MAX) {
map = sampler.mUVId;
else {
} else {
map = -1;
for (std::string::const_iterator it = sampler.mUVChannel.begin(); it != sampler.mUVChannel.end(); ++it) {
if (IsNumeric(*it)) {
@ -1553,27 +1547,27 @@ void ColladaLoader::FillMaterials(const ColladaParser &pParser, aiScene * /*pSce
// resolve shading mode
int shadeMode;
if (effect.mFaceted) /* fixme */
if (effect.mFaceted) {
shadeMode = aiShadingMode_Flat;
else {
} else {
switch (effect.mShadeType) {
case Collada::Shade_Constant:
shadeMode = aiShadingMode_NoShading;
break;
case Collada::Shade_Lambert:
shadeMode = aiShadingMode_Gouraud;
break;
case Collada::Shade_Blinn:
shadeMode = aiShadingMode_Blinn;
break;
case Collada::Shade_Phong:
shadeMode = aiShadingMode_Phong;
break;
case Collada::Shade_Constant:
shadeMode = aiShadingMode_NoShading;
break;
case Collada::Shade_Lambert:
shadeMode = aiShadingMode_Gouraud;
break;
case Collada::Shade_Blinn:
shadeMode = aiShadingMode_Blinn;
break;
case Collada::Shade_Phong:
shadeMode = aiShadingMode_Phong;
break;
default:
ASSIMP_LOG_WARN("Collada: Unrecognized shading mode, using gouraud shading");
shadeMode = aiShadingMode_Gouraud;
break;
default:
ASSIMP_LOG_WARN("Collada: Unrecognized shading mode, using gouraud shading");
shadeMode = aiShadingMode_Gouraud;
break;
}
}
mat.AddProperty<int>(&shadeMode, 1, AI_MATKEY_SHADING_MODEL);
@ -1679,23 +1673,6 @@ void ColladaLoader::BuildMaterials(ColladaParser &pParser, aiScene * /*pScene*/)
// ScenePreprocessor generates a default material automatically if none is there.
// All further code here in this loader works well without a valid material so
// we can safely let it to ScenePreprocessor.
#if 0
if (newMats.size() == 0)
{
aiMaterial* mat = new aiMaterial;
aiString name(AI_DEFAULT_MATERIAL_NAME);
mat->AddProperty(&name, AI_MATKEY_NAME);
const int shadeMode = aiShadingMode_Phong;
mat->AddProperty<int>(&shadeMode, 1, AI_MATKEY_SHADING_MODEL);
aiColor4D colAmbient(0.2, 0.2, 0.2, 1.0), colDiffuse(0.8, 0.8, 0.8, 1.0), colSpecular(0.5, 0.5, 0.5, 0.5);
mat->AddProperty(&colAmbient, 1, AI_MATKEY_COLOR_AMBIENT);
mat->AddProperty(&colDiffuse, 1, AI_MATKEY_COLOR_DIFFUSE);
mat->AddProperty(&colSpecular, 1, AI_MATKEY_COLOR_SPECULAR);
const ai_real specExp = 5.0;
mat->AddProperty(&specExp, 1, AI_MATKEY_SHININESS);
}
#endif
}
// ------------------------------------------------------------------------------------------------
@ -1755,20 +1732,21 @@ aiString ColladaLoader::FindFilenameForEffectTexture(const ColladaParser &pParse
// and add this texture to the list
mTextures.push_back(tex);
} else {
if (imIt->second.mFileName.empty()) {
throw DeadlyImportError("Collada: Invalid texture, no data or file reference given");
}
return result;
}
result.Set(imIt->second.mFileName);
if (imIt->second.mFileName.empty()) {
throw DeadlyImportError("Collada: Invalid texture, no data or file reference given");
}
result.Set(imIt->second.mFileName);
return result;
}
// ------------------------------------------------------------------------------------------------
// Reads a float value from an accessor and its data array.
ai_real ColladaLoader::ReadFloat(const Collada::Accessor &pAccessor, const Collada::Data &pData, size_t pIndex, size_t pOffset) const {
// FIXME: (thom) Test for data type here in every access? For the moment, I leave this to the caller
size_t pos = pAccessor.mStride * pIndex + pAccessor.mOffset + pOffset;
ai_assert(pos < pData.mValues.size());
return pData.mValues[pos];

View File

@ -3315,6 +3315,7 @@ void FBXConverter::InterpolateKeys(aiQuatKey *valOut, const KeyTimeList &keys, c
// http://www.3dkingdoms.com/weekly/weekly.php?a=36
if (quat.x * lastq.x + quat.y * lastq.y + quat.z * lastq.z + quat.w * lastq.w < 0) {
quat.Conjugate();
quat.w = -quat.w;
}
lastq = quat;

View File

@ -93,4 +93,4 @@ private:
} // Namespace Assimp
#endif
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,114 +0,0 @@
/*
---------------------------------------------------------------------------
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
Copyright (c) 2006-2020, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following
conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of the assimp team, nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------
*/
#ifndef ASSIMP_BUILD_NO_STEP_IMPORTER
#include "StepFileImporter.h"
#include "../../Importer/STEPParser/STEPFileReader.h"
#include <assimp/importerdesc.h>
#include <assimp/DefaultIOSystem.h>
namespace Assimp {
namespace StepFile {
using namespace STEP;
static const aiImporterDesc desc = { "StepFile Importer",
"",
"",
"",
0,
0,
0,
0,
0,
"stp" };
StepFileImporter::StepFileImporter()
: BaseImporter() {
}
StepFileImporter::~StepFileImporter() {
}
bool StepFileImporter::CanRead(const std::string& file, IOSystem* pIOHandler, bool checkSig) const {
const std::string &extension = GetExtension(file);
if ( extension == "stp" || extension == "step" ) {
return true;
} else if ((!extension.length() || checkSig) && pIOHandler) {
const char* tokens[] = { "ISO-10303-21" };
const bool found(SearchFileHeaderForToken(pIOHandler, file, tokens, 1));
return found;
}
return false;
}
const aiImporterDesc *StepFileImporter::GetInfo() const {
return &desc;
}
static const std::string mode = "rb";
static const std::string StepFileSchema = "CONFIG_CONTROL_DESIGN";
void StepFileImporter::InternReadFile(const std::string &file, aiScene*, IOSystem* pIOHandler) {
// Read file into memory
std::shared_ptr<IOStream> fileStream(pIOHandler->Open(file, mode));
if (!fileStream.get()) {
throw DeadlyImportError("Failed to open file " + file + ".");
}
std::unique_ptr<STEP::DB> db(STEP::ReadFileHeader(fileStream));
const STEP::HeaderInfo& head = static_cast<const STEP::DB&>(*db).GetHeader();
if (!head.fileSchema.size() || head.fileSchema != StepFileSchema) {
DeadlyImportError("Unrecognized file schema: " + head.fileSchema);
}
}
} // Namespace StepFile
} // Namespace Assimp
#endif // ASSIMP_BUILD_NO_STEP_IMPORTER

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/*
/*
Open Asset Import Library (assimp)
----------------------------------------------------------------------

View File

@ -1,4 +1,4 @@
/*
/*
Open Asset Import Library (assimp)
----------------------------------------------------------------------

View File

@ -1,4 +1,4 @@
/*
/*
Open Asset Import Library (assimp)
----------------------------------------------------------------------

View File

@ -363,20 +363,44 @@ struct Object {
// Classes for each glTF top-level object type
//
//! Base class for types that access binary data from a BufferView, such as accessors
//! or sparse accessors' indices.
//! N.B. not a virtual class. All owned pointers to BufferViewClient instances should
//! be to their most derived types (which may of course be just BufferViewClient).
struct BufferViewClient : public Object {
Ref<BufferView> bufferView; //!< The ID of the bufferView. (required)
size_t byteOffset; //!< The offset relative to the start of the bufferView in bytes. (required)
inline uint8_t *GetPointer();
void Read(Value &obj, Asset &r);
};
//! BufferViewClient with component type information.
//! N.B. not a virtual class. All owned pointers to ComponentTypedBufferViewClient
//! instances should be to their most derived types (which may of course be just
//! ComponentTypedBufferViewClient).
struct ComponentTypedBufferViewClient : public BufferViewClient {
ComponentType componentType; //!< The datatype of components in the attribute. (required)
unsigned int GetBytesPerComponent();
void Read(Value &obj, Asset &r);
};
//! A typed view into a BufferView. A BufferView contains raw binary data.
//! An accessor provides a typed view into a BufferView or a subset of a BufferView
//! similar to how WebGL's vertexAttribPointer() defines an attribute in a buffer.
struct Accessor : public Object {
Ref<BufferView> bufferView; //!< The ID of the bufferView. (required)
size_t byteOffset; //!< The offset relative to the start of the bufferView in bytes. (required)
ComponentType componentType; //!< The datatype of components in the attribute. (required)
struct Accessor : public ComponentTypedBufferViewClient {
struct Sparse;
size_t count; //!< The number of attributes referenced by this accessor. (required)
AttribType::Value type; //!< Specifies if the attribute is a scalar, vector, or matrix. (required)
std::vector<double> max; //!< Maximum value of each component in this attribute.
std::vector<double> min; //!< Minimum value of each component in this attribute.
std::unique_ptr<Sparse> sparse; //!< Sparse accessor information
unsigned int GetNumComponents();
unsigned int GetBytesPerComponent();
unsigned int GetElementSize();
inline uint8_t *GetPointer();
@ -417,11 +441,61 @@ struct Accessor : public Object {
}
};
//! Sparse accessor information
struct Sparse {
size_t count;
ComponentTypedBufferViewClient indices;
BufferViewClient values;
std::vector<uint8_t> data; //!< Actual data, which may be defaulted to an array of zeros or the original data, with the sparse buffer view applied on top of it.
inline void PopulateData(size_t numBytes, uint8_t *bytes) {
if (bytes) {
data.assign(bytes, bytes + numBytes);
} else {
data.resize(numBytes, 0x00);
}
}
inline void PatchData(unsigned int elementSize)
{
uint8_t *pIndices = indices.GetPointer();
const unsigned int indexSize = indices.GetBytesPerComponent();
uint8_t *indicesEnd = pIndices + count * indexSize;
uint8_t *pValues = values.GetPointer();
while (pIndices != indicesEnd) {
size_t offset;
switch (indices.componentType) {
case ComponentType_UNSIGNED_BYTE:
offset = *pIndices;
break;
case ComponentType_UNSIGNED_SHORT:
offset = *reinterpret_cast<uint16_t *>(pIndices);
break;
case ComponentType_UNSIGNED_INT:
offset = *reinterpret_cast<uint32_t *>(pIndices);
break;
default:
// have fun with float and negative values from signed types as indices.
throw DeadlyImportError("Unsupported component type in index.");
}
offset *= elementSize;
std::memcpy(data.data() + offset, pValues, elementSize);
pValues += elementSize;
pIndices += indexSize;
}
}
};
inline Indexer GetIndexer() {
return Indexer(*this);
}
Accessor() {}
void Read(Value &obj, Asset &r);
};

View File

@ -551,36 +551,10 @@ inline void BufferView::Read(Value &obj, Asset &r) {
}
//
// struct Accessor
// struct BufferViewClient
//
inline void Accessor::Read(Value &obj, Asset &r) {
if (Value *bufferViewVal = FindUInt(obj, "bufferView")) {
bufferView = r.bufferViews.Retrieve(bufferViewVal->GetUint());
}
byteOffset = MemberOrDefault(obj, "byteOffset", size_t(0));
componentType = MemberOrDefault(obj, "componentType", ComponentType_BYTE);
count = MemberOrDefault(obj, "count", size_t(0));
const char *typestr;
type = ReadMember(obj, "type", typestr) ? AttribType::FromString(typestr) : AttribType::SCALAR;
}
inline unsigned int Accessor::GetNumComponents() {
return AttribType::GetNumComponents(type);
}
inline unsigned int Accessor::GetBytesPerComponent() {
return int(ComponentTypeSize(componentType));
}
inline unsigned int Accessor::GetElementSize() {
return GetNumComponents() * GetBytesPerComponent();
}
inline uint8_t *Accessor::GetPointer() {
inline uint8_t *BufferViewClient::GetPointer() {
if (!bufferView || !bufferView->buffer) return 0;
uint8_t *basePtr = bufferView->buffer->GetPointer();
if (!basePtr) return 0;
@ -599,6 +573,76 @@ inline uint8_t *Accessor::GetPointer() {
return basePtr + offset;
}
inline void BufferViewClient::Read(Value &obj, Asset &r) {
if (Value *bufferViewVal = FindUInt(obj, "bufferView")) {
bufferView = r.bufferViews.Retrieve(bufferViewVal->GetUint());
}
byteOffset = MemberOrDefault(obj, "byteOffset", size_t(0));
}
//
// struct ComponentTypedBufferViewClient
//
inline unsigned int ComponentTypedBufferViewClient::GetBytesPerComponent() {
return int(ComponentTypeSize(componentType));
}
inline void ComponentTypedBufferViewClient::Read(Value &obj, Asset &r) {
BufferViewClient::Read(obj, r);
componentType = MemberOrDefault(obj, "componentType", ComponentType_BYTE);
}
//
// struct Accessor
//
inline uint8_t *Accessor::GetPointer() {
if (!sparse) return BufferViewClient::GetPointer();
return sparse->data.data();
}
inline void Accessor::Read(Value &obj, Asset &r) {
ComponentTypedBufferViewClient::Read(obj, r);
count = MemberOrDefault(obj, "count", size_t(0));
const char *typestr;
type = ReadMember(obj, "type", typestr) ? AttribType::FromString(typestr) : AttribType::SCALAR;
if (Value *sparseValue = FindObject(obj, "sparse")) {
sparse.reset(new Sparse);
ReadMember(*sparseValue, "count", sparse->count);
if (Value *indicesValue = FindObject(*sparseValue, "indices")) {
sparse->indices.Read(*indicesValue, r);
}
if (Value *valuesValue = FindObject(*sparseValue, "values")) {
sparse->values.Read(*valuesValue, r);
}
const unsigned int elementSize = GetElementSize();
const size_t dataSize = count * elementSize;
sparse->PopulateData(dataSize, BufferViewClient::GetPointer());
sparse->PatchData(elementSize);
}
}
inline unsigned int Accessor::GetNumComponents() {
return AttribType::GetNumComponents(type);
}
inline unsigned int Accessor::GetElementSize() {
return GetNumComponents() * GetBytesPerComponent();
}
namespace {
inline void CopyData(size_t count,
const uint8_t *src, size_t src_stride,
@ -635,7 +679,7 @@ void Accessor::ExtractData(T *&outData)
const size_t targetElemSize = sizeof(T);
ai_assert(elemSize <= targetElemSize);
ai_assert(count * stride <= bufferView->byteLength);
ai_assert(count * stride <= (bufferView ? bufferView->byteLength : sparse->data.size()));
outData = new T[count];
if (stride == elemSize && targetElemSize == elemSize) {
@ -1002,7 +1046,7 @@ inline void Mesh::Read(Value &pJSON_Object, Asset &pAsset_Root) {
// Valid attribute semantics include POSITION, NORMAL, TANGENT
int undPos = 0;
Mesh::AccessorList *vec = 0;
if (GetAttribTargetVector(prim, i, attr, vec, undPos)) {
if (GetAttribTargetVector(prim, j, attr, vec, undPos)) {
size_t idx = (attr[undPos] == '_') ? atoi(attr + undPos + 1) : 0;
if ((*vec).size() <= idx) {
(*vec).resize(idx + 1);
@ -1067,10 +1111,10 @@ inline void Camera::Read(Value &obj, Asset & /*r*/) {
cameraProperties.perspective.zfar = MemberOrDefault(*it, "zfar", 100.f);
cameraProperties.perspective.znear = MemberOrDefault(*it, "znear", 0.01f);
} else {
cameraProperties.ortographic.xmag = MemberOrDefault(obj, "xmag", 1.f);
cameraProperties.ortographic.ymag = MemberOrDefault(obj, "ymag", 1.f);
cameraProperties.ortographic.zfar = MemberOrDefault(obj, "zfar", 100.f);
cameraProperties.ortographic.znear = MemberOrDefault(obj, "znear", 0.01f);
cameraProperties.ortographic.xmag = MemberOrDefault(*it, "xmag", 1.f);
cameraProperties.ortographic.ymag = MemberOrDefault(*it, "ymag", 1.f);
cameraProperties.ortographic.zfar = MemberOrDefault(*it, "zfar", 100.f);
cameraProperties.ortographic.znear = MemberOrDefault(*it, "znear", 0.01f);
}
}

View File

@ -1,4 +1,4 @@
/*
/*
Open Asset Import Library (assimp)
----------------------------------------------------------------------

View File

@ -45,10 +45,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "CInterfaceIOWrapper.h"
namespace Assimp {
namespace Assimp {
CIOStreamWrapper::~CIOStreamWrapper(void)
{
CIOStreamWrapper::~CIOStreamWrapper(void) {
/* Various places depend on this destructor to close the file */
if (mFile) {
mIO->mFileSystem->CloseProc(mIO->mFileSystem, mFile);
@ -57,28 +56,25 @@ CIOStreamWrapper::~CIOStreamWrapper(void)
}
// ...................................................................
size_t CIOStreamWrapper::Read(void* pvBuffer,
size_t pSize,
size_t pCount
){
size_t CIOStreamWrapper::Read(void *pvBuffer,
size_t pSize,
size_t pCount) {
// need to typecast here as C has no void*
return mFile->ReadProc(mFile,(char*)pvBuffer,pSize,pCount);
return mFile->ReadProc(mFile, (char *)pvBuffer, pSize, pCount);
}
// ...................................................................
size_t CIOStreamWrapper::Write(const void* pvBuffer,
size_t pSize,
size_t pCount
){
size_t CIOStreamWrapper::Write(const void *pvBuffer,
size_t pSize,
size_t pCount) {
// need to typecast here as C has no void*
return mFile->WriteProc(mFile,(const char*)pvBuffer,pSize,pCount);
return mFile->WriteProc(mFile, (const char *)pvBuffer, pSize, pCount);
}
// ...................................................................
aiReturn CIOStreamWrapper::Seek(size_t pOffset,
aiOrigin pOrigin
){
return mFile->SeekProc(mFile,pOffset,pOrigin);
aiOrigin pOrigin) {
return mFile->SeekProc(mFile, pOffset, pOrigin);
}
// ...................................................................
@ -92,16 +88,16 @@ size_t CIOStreamWrapper::FileSize() const {
}
// ...................................................................
void CIOStreamWrapper::Flush () {
void CIOStreamWrapper::Flush() {
return mFile->FlushProc(mFile);
}
// ------------------------------------------------------------------------------------------------
// Custom IOStream implementation for the C-API
bool CIOSystemWrapper::Exists( const char* pFile) const {
aiFile* p = mFileSystem->OpenProc(mFileSystem,pFile,"rb");
if (p){
mFileSystem->CloseProc(mFileSystem,p);
bool CIOSystemWrapper::Exists(const char *pFile) const {
aiFile *p = mFileSystem->OpenProc(mFileSystem, pFile, "rb");
if (p) {
mFileSystem->CloseProc(mFileSystem, p);
return true;
}
return false;
@ -117,8 +113,8 @@ char CIOSystemWrapper::getOsSeparator() const {
}
// ...................................................................
IOStream* CIOSystemWrapper::Open(const char* pFile,const char* pMode) {
aiFile* p = mFileSystem->OpenProc(mFileSystem,pFile,pMode);
IOStream *CIOSystemWrapper::Open(const char *pFile, const char *pMode) {
aiFile *p = mFileSystem->OpenProc(mFileSystem, pFile, pMode);
if (!p) {
return NULL;
}
@ -126,11 +122,11 @@ IOStream* CIOSystemWrapper::Open(const char* pFile,const char* pMode) {
}
// ...................................................................
void CIOSystemWrapper::Close( IOStream* pFile) {
void CIOSystemWrapper::Close(IOStream *pFile) {
if (!pFile) {
return;
}
delete pFile;
}
}
} // namespace Assimp

View File

@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2020, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@ -50,50 +48,47 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/IOStream.hpp>
#include <assimp/IOSystem.hpp>
namespace Assimp {
namespace Assimp {
class CIOSystemWrapper;
// ------------------------------------------------------------------------------------------------
// Custom IOStream implementation for the C-API
class CIOStreamWrapper : public IOStream
{
class CIOStreamWrapper : public IOStream {
public:
explicit CIOStreamWrapper(aiFile* pFile, CIOSystemWrapper* io)
: mFile(pFile),
mIO(io)
{}
explicit CIOStreamWrapper(aiFile *pFile, CIOSystemWrapper *io) :
mFile(pFile),
mIO(io) {}
~CIOStreamWrapper(void);
size_t Read(void* pvBuffer, size_t pSize, size_t pCount);
size_t Write(const void* pvBuffer, size_t pSize, size_t pCount);
size_t Read(void *pvBuffer, size_t pSize, size_t pCount);
size_t Write(const void *pvBuffer, size_t pSize, size_t pCount);
aiReturn Seek(size_t pOffset, aiOrigin pOrigin);
size_t Tell(void) const;
size_t FileSize() const;
void Flush();
private:
aiFile* mFile;
CIOSystemWrapper* mIO;
aiFile *mFile;
CIOSystemWrapper *mIO;
};
class CIOSystemWrapper : public IOSystem
{
class CIOSystemWrapper : public IOSystem {
friend class CIOStreamWrapper;
public:
explicit CIOSystemWrapper(aiFileIO* pFile)
: mFileSystem(pFile)
{}
bool Exists( const char* pFile) const;
public:
explicit CIOSystemWrapper(aiFileIO *pFile) :
mFileSystem(pFile) {}
bool Exists(const char *pFile) const;
char getOsSeparator() const;
IOStream* Open(const char* pFile,const char* pMode = "rb");
void Close( IOStream* pFile);
IOStream *Open(const char *pFile, const char *pMode = "rb");
void Close(IOStream *pFile);
private:
aiFileIO* mFileSystem;
aiFileIO *mFileSystem;
};
}
} // namespace Assimp
#endif

View File

@ -1233,7 +1233,7 @@ if (APPLE)
# add ./Compiler/*.h to assimp.framework via copy command
ADD_CUSTOM_COMMAND(TARGET assimp POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy_directory
"../${HEADER_PATH}/Compiler"
"${HEADER_PATH}/Compiler"
assimp.framework/Headers/Compiler
COMMENT "Copying public ./Compiler/ header files to framework bundle's Headers/Compiler/")
ENDIF()

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/*
/*
---------------------------------------------------------------------------
Open Asset Import Library (assimp)
---------------------------------------------------------------------------

View File

@ -109,4 +109,4 @@ public:
} // Namespace Assimp
#endif // SCALE_PROCESS_H_
#endif // SCALE_PROCESS_H_

View File

@ -94,4 +94,4 @@ private:
} // Namespace Assimp
#endif // SCALE_PROCESS_H_
#endif // SCALE_PROCESS_H_

View File

@ -52,6 +52,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <limits>
#include <assimp/TinyFormatter.h>
#include <assimp/Exceptional.h>
#include <set>
using namespace Assimp;
using namespace Assimp::Formatter;
@ -172,7 +173,15 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
const aiBone* bone = pMesh->mBones[a];
for( unsigned int b = 0; b < bone->mNumWeights; ++b)
{
vertexBones[ bone->mWeights[b].mVertexId ].push_back( BoneWeight( a, bone->mWeights[b].mWeight));
if (bone->mWeights[b].mWeight > 0.0f)
{
int vertexId = bone->mWeights[b].mVertexId;
vertexBones[vertexId].push_back( BoneWeight( a, bone->mWeights[b].mWeight));
if (vertexBones[vertexId].size() > mMaxBoneCount)
{
throw DeadlyImportError("SplitByBoneCountProcess: Single face requires more bones than specified max bone count!");
}
}
}
}
@ -188,9 +197,6 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
subMeshFaces.reserve( pMesh->mNumFaces);
// accumulated vertex count of all the faces in this submesh
unsigned int numSubMeshVertices = 0;
// a small local array of new bones for the current face. State of all used bones for that face
// can only be updated AFTER the face is completely analysed. Thanks to imre for the fix.
std::vector<unsigned int> newBonesAtCurrentFace;
// add faces to the new submesh as long as all bones affecting the faces' vertices fit in the limit
for( unsigned int a = 0; a < pMesh->mNumFaces; ++a)
@ -200,33 +206,25 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
{
continue;
}
// a small local set of new bones for the current face. State of all used bones for that face
// can only be updated AFTER the face is completely analysed. Thanks to imre for the fix.
std::set<unsigned int> newBonesAtCurrentFace;
const aiFace& face = pMesh->mFaces[a];
// check every vertex if its bones would still fit into the current submesh
for( unsigned int b = 0; b < face.mNumIndices; ++b )
{
const std::vector<BoneWeight>& vb = vertexBones[face.mIndices[b]];
for( unsigned int c = 0; c < vb.size(); ++c)
const std::vector<BoneWeight>& vb = vertexBones[face.mIndices[b]];
for( unsigned int c = 0; c < vb.size(); ++c)
{
unsigned int boneIndex = vb[c].first;
if( !isBoneUsed[boneIndex] )
{
unsigned int boneIndex = vb[c].first;
// if the bone is already used in this submesh, it's ok
if( isBoneUsed[boneIndex] )
{
continue;
}
// if it's not used, yet, we would need to add it. Store its bone index
if( std::find( newBonesAtCurrentFace.begin(), newBonesAtCurrentFace.end(), boneIndex) == newBonesAtCurrentFace.end() )
{
newBonesAtCurrentFace.push_back( boneIndex);
}
}
newBonesAtCurrentFace.insert(boneIndex);
}
}
}
if (newBonesAtCurrentFace.size() > mMaxBoneCount)
{
throw DeadlyImportError("SplitByBoneCountProcess: Single face requires more bones than specified max bone count!");
}
// leave out the face if the new bones required for this face don't fit the bone count limit anymore
if( numBones + newBonesAtCurrentFace.size() > mMaxBoneCount )
{
@ -234,17 +232,13 @@ void SplitByBoneCountProcess::SplitMesh( const aiMesh* pMesh, std::vector<aiMesh
}
// mark all new bones as necessary
while( !newBonesAtCurrentFace.empty() )
for (std::set<unsigned int>::iterator it = newBonesAtCurrentFace.begin(); it != newBonesAtCurrentFace.end(); ++it)
{
unsigned int newIndex = newBonesAtCurrentFace.back();
newBonesAtCurrentFace.pop_back(); // this also avoids the deallocation which comes with a clear()
if( isBoneUsed[newIndex] )
{
continue;
}
isBoneUsed[newIndex] = true;
if (!isBoneUsed[*it])
{
isBoneUsed[*it] = true;
numBones++;
}
}
// store the face index and the vertex count

View File

@ -1,4 +1,4 @@
/*
/*
---------------------------------------------------------------------------
Open Asset Import Library (assimp)
---------------------------------------------------------------------------

View File

@ -1,4 +1,4 @@
/*
/*
Copyright (c) 2013 Khaled Mammou - Advanced Micro Devices, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy

View File

@ -237,4 +237,4 @@ The _android-cmake_ should correctly handle projects with assembler sources (`*.
## Copying
_android-cmake_ is distributed under the terms of [BSD 3-Clause License](http://opensource.org/licenses/BSD-3-Clause)
_android-cmake_ is distributed under the terms of [BSD 3-Clause License](http://opensource.org/licenses/BSD-3-Clause)

View File

@ -11,4 +11,4 @@ documentation for that specific version instead.**
To contribute code to Google Test, read:
* [DevGuide](DevGuide.md) -- read this _before_ writing your first patch.
* [PumpManual](PumpManual.md) -- how we generate some of Google Test's source files.
* [PumpManual](PumpManual.md) -- how we generate some of Google Test's source files.

View File

@ -9,4 +9,4 @@ This page lists all official documentation wiki pages for Google Test **1.5.0**
To contribute code to Google Test, read:
* DevGuide -- read this _before_ writing your first patch.
* [PumpManual](V1_5_PumpManual.md) -- how we generate some of Google Test's source files.
* [PumpManual](V1_5_PumpManual.md) -- how we generate some of Google Test's source files.

View File

@ -174,4 +174,4 @@ You can find real-world applications of Pump in [Google Test](http://www.google.
## Tips ##
* If a meta variable is followed by a letter or digit, you can separate them using `[[]]`, which inserts an empty string. For example `Foo$j[[]]Helper` generate `Foo1Helper` when `j` is 1.
* To avoid extra-long Pump source lines, you can break a line anywhere you want by inserting `[[]]` followed by a new line. Since any new-line character next to `[[` or `]]` is ignored, the generated code won't contain this new line.
* To avoid extra-long Pump source lines, you can break a line anywhere you want by inserting `[[]]` followed by a new line. Since any new-line character next to `[[` or `]]` is ignored, the generated code won't contain this new line.

View File

@ -90,4 +90,4 @@ The Debugger has exited with status 0.
# Summary #
Unit testing is a valuable way to ensure your data model stays valid even during rapid development or refactoring. The Google Testing Framework is a great unit testing framework for C and C++ which integrates well with an Xcode development environment.
Unit testing is a valuable way to ensure your data model stays valid even during rapid development or refactoring. The Google Testing Framework is a great unit testing framework for C and C++ which integrates well with an Xcode development environment.

View File

@ -11,4 +11,4 @@ documentation for that specific version instead.**
To contribute code to Google Test, read:
* [DevGuide](DevGuide.md) -- read this _before_ writing your first patch.
* [PumpManual](V1_6_PumpManual.md) -- how we generate some of Google Test's source files.
* [PumpManual](V1_6_PumpManual.md) -- how we generate some of Google Test's source files.

View File

@ -90,4 +90,4 @@ The Debugger has exited with status 0.
# Summary #
Unit testing is a valuable way to ensure your data model stays valid even during rapid development or refactoring. The Google Testing Framework is a great unit testing framework for C and C++ which integrates well with an Xcode development environment.
Unit testing is a valuable way to ensure your data model stays valid even during rapid development or refactoring. The Google Testing Framework is a great unit testing framework for C and C++ which integrates well with an Xcode development environment.

View File

@ -11,4 +11,4 @@ documentation for that specific version instead.**
To contribute code to Google Test, read:
* [DevGuide](DevGuide.md) -- read this _before_ writing your first patch.
* [PumpManual](V1_7_PumpManual.md) -- how we generate some of Google Test's source files.
* [PumpManual](V1_7_PumpManual.md) -- how we generate some of Google Test's source files.

View File

@ -90,4 +90,4 @@ The Debugger has exited with status 0.
# Summary #
Unit testing is a valuable way to ensure your data model stays valid even during rapid development or refactoring. The Google Testing Framework is a great unit testing framework for C and C++ which integrates well with an Xcode development environment.
Unit testing is a valuable way to ensure your data model stays valid even during rapid development or refactoring. The Google Testing Framework is a great unit testing framework for C and C++ which integrates well with an Xcode development environment.

View File

@ -90,4 +90,4 @@ The Debugger has exited with status 0.
# Summary #
Unit testing is a valuable way to ensure your data model stays valid even during rapid development or refactoring. The Google Testing Framework is a great unit testing framework for C and C++ which integrates well with an Xcode development environment.
Unit testing is a valuable way to ensure your data model stays valid even during rapid development or refactoring. The Google Testing Framework is a great unit testing framework for C and C++ which integrates well with an Xcode development environment.

View File

@ -1,4 +1,4 @@
==================
==================
INSTALLATION GUIDE
==================
@ -48,4 +48,4 @@ Examples:
./p2t nazca_monkey.dat 0 0 9
./p2t random 10 100 5.0
./p2t random 1000 20000 0.025
./p2t random 1000 20000 0.025

View File

@ -362,4 +362,4 @@ void Triangle::DebugPrint()
cout << points_[2]->x << "," << points_[2]->y << endl;
}
}
}

View File

@ -324,4 +324,4 @@ inline void Triangle::IsInterior(bool b)
}
#endif
#endif

View File

@ -35,4 +35,4 @@
#include "common/shapes.h"
#include "sweep/cdt.h"
#endif
#endif

View File

@ -105,4 +105,4 @@ AdvancingFront::~AdvancingFront()
{
}
}
}

View File

@ -115,4 +115,4 @@ inline void AdvancingFront::set_search(Node* node)
}
#endif
#endif

View File

@ -68,4 +68,4 @@ CDT::~CDT()
delete sweep_;
}
}
}

View File

@ -102,4 +102,4 @@ public:
}
#endif
#endif

View File

@ -282,4 +282,4 @@ private:
}
#endif
#endif

View File

@ -7459,4 +7459,4 @@ AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
------------------------------------------------------------------------------
*/
*/

View File

@ -15,4 +15,4 @@ else
make -j 8
make install
ASAN_OPTIONS=detect_leaks=0 LSAN_OPTIONS=verbosity=1:log_threads=1 ctest -V
fi
fi

View File

@ -19,4 +19,4 @@ after_success:
- make
- make test
# Uploading report to CodeCov
- bash <(curl -s https://codecov.io/bash)
- bash <(curl -s https://codecov.io/bash)

View File

@ -196,10 +196,7 @@ if(MINGW)
set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj)
endif(MINGW)
add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
set_target_properties(zlib PROPERTIES SOVERSION 1)
INSTALL( TARGETS zlibstatic
LIBRARY DESTINATION ${ASSIMP_LIB_INSTALL_DIR}

View File

@ -1 +1 @@
AIAIAIAIAIAIA
AIAIAIAIAIAIA

View File

@ -20,4 +20,4 @@ FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
DEALINGS IN THE SOFTWARE.

View File

@ -7,4 +7,4 @@ copy to a directory file from :
- contrib/masmx64
- contrib/vstudio/vc7
and open testzlib8.sln
and open testzlib8.sln

View File

@ -8,4 +8,4 @@ This is a heavily modified and shrinked version of zlib 1.2.3
Assimp itself does not use the compression part yet, so
it needn't be compiled (trees.c, deflate.c, compress.c).
Currently these units are just used by assimp_cmd.
Currently these units are just used by assimp_cmd.

View File

@ -351,4 +351,4 @@ BI8AxOURXedNEuG6jMiRPHKQsuuS4BGAuDzS0NCQlZV18JFlRI7qkRRdlwSPAHzCIynKaa5LgkcA
ETwCgEfwCAAewSMAeASP4BEAPIJHAPAIHgFItrEBsYNHAD7BK4gZPAKAR/AIAB7BIwCQBvwfU/j0
jy2hMWgAAAAASUVORK5C" />
</BODY>
</HTML>
</HTML>

View File

@ -645,4 +645,4 @@ tQ2gtkFtg9oGQG2jtkFtA6C2UduA2gZQ26C2QW0DoLZR26C2AVDbqG1AbQMoKg8CahvUNgBqG7UN
ahsAtY3aBtQ2AGobtQ1qGwC1jdoGtQ2A2kZtA2obALWN2ga1DUA1igr2o7ZBbQPw0/wD+/DsALUN
gNpGbYPaBkBto7ZBbQMAAD/R/wDNluGGIxSgmAAAAABJRU5ErkJg" />
</BODY>
</HTML>
</HTML>

View File

@ -104,4 +104,4 @@ tfMWuhaZfgHUw0Q32sDAwIcPH4I/C1fbaJVKRX0GBwft4RA5hXdkNepJqndpKD2R7TlrjeqmxkKh
oLOf5O8VrfC7XlrtOvYCO77PYocddthhhx122GGHHXbYYYcddthhhx122GGHHXbYYYdd29q1c83s
I9m5B21Yuxg77FJtRzQV/wEjVLA5JUDyfgAAAABJRU5ErkJg" />
</BODY>
</HTML>
</HTML>

View File

@ -872,4 +872,4 @@ DYMQQgghNAxCCCGEEBoGIYQQQmgYhBBCCKFhEEIIIYTQMAghhBBCwyCEEEIIDYMQQgghNAxCCCGE
EBoGIYQQQmgYhBBCCKFhEEIIIYTQMAghhBBCwyCEEEJI/PP/A0zci3P89Qf2AAAAAElFTkSuQmCC
" />
</BODY>
</HTML>
</HTML>

View File

@ -334,4 +334,4 @@ CQCsyZpgTQCsyZpgTQCsyZpgTQCsyZpgTQCsCdZkTQBgTdZkTQBgTdZkTQBgTdYEawJgTdYEawJg
TdYEawJgTbAmawIAa7ImawIAa7ImawIAa7ImWBMAa7ImWBMAa7ImWBPAvDIByoc1WRMA/uU3lI1q
YU0ArAnWZE0AYE3WZE0AABY4/wVVY1WTrOVxIAAAAABJRU5ErkJg" />
</BODY>
</HTML>
</HTML>

View File

@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2020, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@ -40,30 +38,19 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------
*/
#include <assimp/cimport.h>
#include <assimp/scene.h>
#include <assimp/postprocess.h>
#pragma once
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t dataSize) {
aiLogStream stream = aiGetPredefinedLogStream(aiDefaultLogStream_STDOUT,NULL);
aiAttachLogStream(&stream);
#ifndef ASSIMP_BUILD_NO_STEP_IMPORTER
Importer importer;
const aiScene *sc = importer.ReadFileFromMemory(data, dataSize,
aiProcessPreset_TargetRealtime_Quality, nullptr );
#include <assimp/BaseImporter.h>
namespace Assimp {
namespace StepFile {
class StepFileImporter : public BaseImporter {
public:
StepFileImporter();
~StepFileImporter();
bool CanRead(const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const override;
const aiImporterDesc* GetInfo() const override;
protected:
void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler ) override;
private:
};
} // Namespace StepFile
} // Namespace Assimp
#endif // ASSIMP_BUILD_NO_STEP_IMPORTER
aiDetachLogStream(&stream);
return 0;
}

View File

@ -1,4 +1,4 @@
/*
/*
---------------------------------------------------------------------------
Open Asset Import Library (assimp)
---------------------------------------------------------------------------

View File

@ -1,8 +1,6 @@
Project home page:
http://assimp.sourceforge.net
Sourceforge.net project page:
http://www.sourceforge.net/projects/assimp
Project home page:
http://assimp.sourceforge.net
Sourceforge.net project page:
http://www.sourceforge.net/projects/assimp

View File

@ -29,4 +29,4 @@ Reinstall Microsoft Visual C++ 2005 SP1 Redistributable (x86 or x64, depending o
Add it to PATH. That's not a bug, the installer does not alter the PATH.
4. Crashes immediately
You CPU lacks SSE2 support. Build Assimp from scratch to suit your CPU, sorry.
You CPU lacks SSE2 support. Build Assimp from scratch to suit your CPU, sorry.

View File

@ -26,4 +26,4 @@ Install the latest DirectX runtime or grab the file from somewhere (that's evil
(Re)install Microsoft Visual C++ 2005 SP1 Redistributable (x86 or x64, depending on your system)
3. Crashes immediately
You CPU lacks SSE2 support. Build Assimp from scratch to suit your CPU, sorry.
You CPU lacks SSE2 support. Build Assimp from scratch to suit your CPU, sorry.

View File

@ -1,11 +1,11 @@
#-*- coding: UTF-8 -*-
"""
All possible errors.
"""
class AssimpError(BaseException):
"""
If an internal error occurs.
"""
pass
#-*- coding: UTF-8 -*-
"""
All possible errors.
"""
class AssimpError(BaseException):
"""
If an internal error occurs.
"""
pass

6
port/assimp_rs/Cargo.lock generated 100644
View File

@ -0,0 +1,6 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "assimp_rs"
version = "0.1.0"

View File

@ -0,0 +1,9 @@
[package]
name = "assimp_rs"
version = "0.1.0"
authors = ["David Golembiowski <dmgolembiowski@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

View File

@ -0,0 +1 @@
pub use self::structs::{Camera};

View File

View File

View File

View File

@ -0,0 +1,17 @@
pub mod camera;
pub mod core;
pub mod errors;
pub mod formats;
pub mod material;
pub mod postprocess;
pub mod shims;
pub mod socket;
pub mod structs;
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(true, true);
}
}

View File

View File

View File

@ -0,0 +1,44 @@
pub struct Animation<'mA, 'mMA, 'nA> {
/* The name of the animation. If the modeling package this data was
* exported from does support only a single animation channel, this
* name is usually empty (length is zero).
*/
m_name: Option<String>,
// Duration of the animation in ticks
m_duration: f64,
// Ticks per second. Zero (0.000... ticks/second) if not
// specified in the imported file
m_ticks_per_second: Option<f64>,
/* Number of bone animation channels.
Each channel affects a single node.
*/
m_num_channels: u64,
/* Node animation channels. Each channel
affects a single node.
?? -> The array is m_num_channels in size.
(maybe refine to a derivative type of usize?)
*/
m_channels: &'nA NodeAnim,
/* Number of mesh animation channels. Each
channel affects a single mesh and defines
vertex-based animation.
*/
m_num_mesh_channels: u64,
/* The mesh animation channels. Each channel
affects a single mesh.
The array is m_num_mesh_channels in size
(maybe refine to a derivative of usize?)
*/
m_mesh_channels: &'mA MeshAnim,
/* The number of mesh animation channels. Each channel
affects a single mesh and defines some morphing animation.
*/
m_num_morph_mesh_channels: u64,
/* The morph mesh animation channels. Each channel affects a single mesh.
The array is mNumMorphMeshChannels in size.
*/
m_morph_mesh_channels: &'mMA MeshMorphAnim
}
pub struct NodeAnim {}
pub struct MeshAnim {}
pub struct MeshMorphAnim {}

View File

@ -0,0 +1,6 @@
mod anim;
pub use self::anim::{
Animation,
NodeAnim,
MeshAnim,
MeshMorphAnim};

View File

@ -0,0 +1,2 @@
mod blob;

View File

@ -0,0 +1,2 @@
mod bone;

View File

@ -0,0 +1,2 @@
mod camera;

View File

@ -0,0 +1,27 @@
#[derive(Clone, Debug, Copy)]
struct Color3D {
r: f32,
g: f32,
b: f32
}
impl Color3D {
pub fn new(r_f32: f32, g_f32: f32, b_f32: f32) -> Color3D {
Color3D {r: r_f32, g: g_f32, b: b_f32 }
}
}
#[derive(Clone, Debug, Copy)]
struct Color4D {
r: f32,
g: f32,
b: f32,
a: f32
}
impl Color4D {
pub fn new(r_f32: f32, g_f32: f32, b_f32: f32, a_f32: f32) -> Color4D {
Color4D {r: r_f32, g: g_f32, b: b_f32, a: a_f32 }
}
}

View File

@ -0,0 +1,5 @@
mod color;
pub use self::color::{
Color3D,
Color4D
};

View File

@ -0,0 +1,2 @@
mod face;

View File

@ -0,0 +1,2 @@
mod key;

View File

@ -0,0 +1,2 @@
mod light;

View File

@ -0,0 +1,2 @@
mod material;

View File

@ -0,0 +1,64 @@
#[derive(Clone, Debug, Copy)]
struct Matrix3x3 {
a1: f32,
a2: f32,
a3: f32,
b1: f32,
b2: f32,
b3: f32,
c1: f32,
c2: f32,
c3: f32
}
#[derive(Clone, Debug, Copy)]
struct Matrix4x4 {
a1: f32,
a2: f32,
a3: f32,
a4: f32,
b1: f32,
b2: f32,
b3: f32,
b4: f32,
c1: f32,
c2: f32,
c3: f32,
c4: f32,
d1: f32,
d2: f32,
d3: f32,
d4: f32
}
impl Matrix3x3 {
pub fn new(
a1_f32: f32, a2_f32: f32, a3_f32: f32,
b1_f32: f32, b2_f32: f32, b3_f32: f32,
c1_f32: f32, c2_f32: f32, c3_f32: f32
) -> Matrix3x3 {
Matrix3x3 {
a1: a1_f32, a2: a2_f32, a3: a3_f32,
b1: b1_f32, b2: b2_f32, b3: b3_f32,
c1: c1_f32, c2: c2_f32, c3: c3_f32
}
}
}
impl Matrix4x4 {
pub fn new(
a1_f32: f32, a2_f32: f32, a3_f32: f32, a4_f32: f32,
b1_f32: f32, b2_f32: f32, b3_f32: f32, b4_f32: f32,
c1_f32: f32, c2_f32: f32, c3_f32: f32, c4_f32: f32,
d1_f32: f32, d2_f32: f32, d3_f32: f32, d4_f32: f32
) -> Matrix4x4 {
Matrix4x4 {
a1: a1_f32, a2: a2_f32, a3: a3_f32, a4: a4_f32,
b1: b1_f32, b2: b2_f32, b3: b3_f32, b4: b4_f32,
c1: c1_f32, c2: c2_f32, c3: c3_f32, c4: c4_f32,
d1: d1_f32, d2: d2_f32, d3: d3_f32, d4: d4_f32
}
}
}

View File

@ -0,0 +1,4 @@
mod matrix;
pub use self::matrix::{
Matrix3x3,
Matrix4x4};

View File

@ -0,0 +1,35 @@
#[derive(Clone, Debug, Copy)]
struct MemoryInfo {
textures: u32,
materials: u32,
meshes: u32,
nodes: u32,
animations: u32,
cameras: u32,
lights: u32,
total: u32
}
impl MemoryInfo {
pub fn new(
textures_uint: u32,
materials_uint: u32,
meshes_uint: u32,
nodes_uint: u32,
animations_uint: u32,
cameras_uint: u32,
lights_uint: u32,
total_uint: u32) -> MemoryInfo {
MemoryInfo {
textures: textures_uint,
materials: materials_uint,
meshes: meshes_uint,
nodes: nodes_uint,
animations: animations_uint,
cameras: cameras_uint,
lights: lights_uint,
total: total_uint
}
}
}

Some files were not shown because too many files have changed in this diff Show More