mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-14 04:03:46 +00:00
Just the functional assimp lib rather than the entire assimp repository unnecessarily.
This commit is contained in:
parent
bf170ffbca
commit
25ce4477ce
1747 changed files with 9012 additions and 925008 deletions
|
|
@ -3,8 +3,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2018, assimp team
|
||||
|
||||
Copyright (c) 2006-2017, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
|
@ -45,9 +44,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#ifndef ASSIMP_BUILD_NO_PLY_IMPORTER
|
||||
|
||||
#include <assimp/fast_atof.h>
|
||||
#include "fast_atof.h"
|
||||
#include <assimp/DefaultLogger.hpp>
|
||||
#include <assimp/ByteSwapper.h>
|
||||
#include "ByteSwapper.h"
|
||||
#include "PlyLoader.h"
|
||||
|
||||
using namespace Assimp;
|
||||
|
|
@ -97,7 +96,7 @@ PLY::EDataType PLY::Property::ParseDataType(std::vector<char> &buffer) {
|
|||
}
|
||||
if (PLY::EDT_INVALID == eOut)
|
||||
{
|
||||
ASSIMP_LOG_INFO("Found unknown data type in PLY file. This is OK");
|
||||
DefaultLogger::get()->info("Found unknown data type in PLY file. This is OK");
|
||||
}
|
||||
|
||||
return eOut;
|
||||
|
|
@ -229,7 +228,7 @@ PLY::ESemantic PLY::Property::ParseSemantic(std::vector<char> &buffer) {
|
|||
eOut = PLY::EST_ZNormal;
|
||||
}
|
||||
else {
|
||||
ASSIMP_LOG_INFO("Found unknown property semantic in file. This is ok");
|
||||
DefaultLogger::get()->info("Found unknown property semantic in file. This is ok");
|
||||
PLY::DOM::SkipLine(buffer);
|
||||
}
|
||||
return eOut;
|
||||
|
|
@ -295,7 +294,7 @@ bool PLY::Property::ParseProperty(std::vector<char> &buffer, PLY::Property* pOut
|
|||
|
||||
if (PLY::EST_INVALID == pOut->Semantic)
|
||||
{
|
||||
ASSIMP_LOG_INFO("Found unknown semantic in PLY file. This is OK");
|
||||
DefaultLogger::get()->info("Found unknown semantic in PLY file. This is OK");
|
||||
std::string(&buffer[0], &buffer[0] + strlen(&buffer[0]));
|
||||
}
|
||||
|
||||
|
|
@ -514,7 +513,7 @@ bool PLY::DOM::SkipComments(std::vector<char> &buffer)
|
|||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
bool PLY::DOM::ParseHeader(IOStreamBuffer<char> &streamBuffer, std::vector<char> &buffer, bool isBinary) {
|
||||
ASSIMP_LOG_DEBUG("PLY::DOM::ParseHeader() begin");
|
||||
DefaultLogger::get()->debug("PLY::DOM::ParseHeader() begin");
|
||||
|
||||
// parse all elements
|
||||
while (!buffer.empty())
|
||||
|
|
@ -543,14 +542,14 @@ bool PLY::DOM::ParseHeader(IOStreamBuffer<char> &streamBuffer, std::vector<char>
|
|||
if (!isBinary) // it would occur an error, if binary data start with values as space or line end.
|
||||
SkipSpacesAndLineEnd(buffer);
|
||||
|
||||
ASSIMP_LOG_DEBUG("PLY::DOM::ParseHeader() succeeded");
|
||||
DefaultLogger::get()->debug("PLY::DOM::ParseHeader() succeeded");
|
||||
return true;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
bool PLY::DOM::ParseElementInstanceLists(IOStreamBuffer<char> &streamBuffer, std::vector<char> &buffer, PLYImporter* loader)
|
||||
{
|
||||
ASSIMP_LOG_DEBUG("PLY::DOM::ParseElementInstanceLists() begin");
|
||||
DefaultLogger::get()->debug("PLY::DOM::ParseElementInstanceLists() begin");
|
||||
alElementData.resize(alElements.size());
|
||||
|
||||
std::vector<PLY::Element>::const_iterator i = alElements.begin();
|
||||
|
|
@ -571,7 +570,7 @@ bool PLY::DOM::ParseElementInstanceLists(IOStreamBuffer<char> &streamBuffer, std
|
|||
}
|
||||
}
|
||||
|
||||
ASSIMP_LOG_DEBUG("PLY::DOM::ParseElementInstanceLists() succeeded");
|
||||
DefaultLogger::get()->debug("PLY::DOM::ParseElementInstanceLists() succeeded");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -582,7 +581,7 @@ bool PLY::DOM::ParseElementInstanceListsBinary(IOStreamBuffer<char> &streamBuffe
|
|||
PLYImporter* loader,
|
||||
bool p_bBE)
|
||||
{
|
||||
ASSIMP_LOG_DEBUG("PLY::DOM::ParseElementInstanceListsBinary() begin");
|
||||
DefaultLogger::get()->debug("PLY::DOM::ParseElementInstanceListsBinary() begin");
|
||||
alElementData.resize(alElements.size());
|
||||
|
||||
std::vector<PLY::Element>::const_iterator i = alElements.begin();
|
||||
|
|
@ -602,7 +601,7 @@ bool PLY::DOM::ParseElementInstanceListsBinary(IOStreamBuffer<char> &streamBuffe
|
|||
}
|
||||
}
|
||||
|
||||
ASSIMP_LOG_DEBUG("PLY::DOM::ParseElementInstanceListsBinary() succeeded");
|
||||
DefaultLogger::get()->debug("PLY::DOM::ParseElementInstanceListsBinary() succeeded");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -615,11 +614,11 @@ bool PLY::DOM::ParseInstanceBinary(IOStreamBuffer<char> &streamBuffer, DOM* p_pc
|
|||
std::vector<char> buffer;
|
||||
streamBuffer.getNextLine(buffer);
|
||||
|
||||
ASSIMP_LOG_DEBUG("PLY::DOM::ParseInstanceBinary() begin");
|
||||
DefaultLogger::get()->debug("PLY::DOM::ParseInstanceBinary() begin");
|
||||
|
||||
if (!p_pcOut->ParseHeader(streamBuffer, buffer, true))
|
||||
{
|
||||
ASSIMP_LOG_DEBUG("PLY::DOM::ParseInstanceBinary() failure");
|
||||
DefaultLogger::get()->debug("PLY::DOM::ParseInstanceBinary() failure");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -628,10 +627,10 @@ bool PLY::DOM::ParseInstanceBinary(IOStreamBuffer<char> &streamBuffer, DOM* p_pc
|
|||
const char* pCur = (char*)&buffer[0];
|
||||
if (!p_pcOut->ParseElementInstanceListsBinary(streamBuffer, buffer, pCur, bufferSize, loader, p_bBE))
|
||||
{
|
||||
ASSIMP_LOG_DEBUG("PLY::DOM::ParseInstanceBinary() failure");
|
||||
DefaultLogger::get()->debug("PLY::DOM::ParseInstanceBinary() failure");
|
||||
return false;
|
||||
}
|
||||
ASSIMP_LOG_DEBUG("PLY::DOM::ParseInstanceBinary() succeeded");
|
||||
DefaultLogger::get()->debug("PLY::DOM::ParseInstanceBinary() succeeded");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -644,11 +643,11 @@ bool PLY::DOM::ParseInstance(IOStreamBuffer<char> &streamBuffer, DOM* p_pcOut, P
|
|||
std::vector<char> buffer;
|
||||
streamBuffer.getNextLine(buffer);
|
||||
|
||||
ASSIMP_LOG_DEBUG("PLY::DOM::ParseInstance() begin");
|
||||
DefaultLogger::get()->debug("PLY::DOM::ParseInstance() begin");
|
||||
|
||||
if (!p_pcOut->ParseHeader(streamBuffer, buffer, false))
|
||||
{
|
||||
ASSIMP_LOG_DEBUG("PLY::DOM::ParseInstance() failure");
|
||||
DefaultLogger::get()->debug("PLY::DOM::ParseInstance() failure");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -656,10 +655,10 @@ bool PLY::DOM::ParseInstance(IOStreamBuffer<char> &streamBuffer, DOM* p_pcOut, P
|
|||
streamBuffer.getNextLine(buffer);
|
||||
if (!p_pcOut->ParseElementInstanceLists(streamBuffer, buffer, loader))
|
||||
{
|
||||
ASSIMP_LOG_DEBUG("PLY::DOM::ParseInstance() failure");
|
||||
DefaultLogger::get()->debug("PLY::DOM::ParseInstance() failure");
|
||||
return false;
|
||||
}
|
||||
ASSIMP_LOG_DEBUG("PLY::DOM::ParseInstance() succeeded");
|
||||
DefaultLogger::get()->debug("PLY::DOM::ParseInstance() succeeded");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -787,7 +786,7 @@ bool PLY::ElementInstance::ParseInstance(const char* &pCur,
|
|||
{
|
||||
if (!(PLY::PropertyInstance::ParseInstance(pCur, &(*a), &(*i))))
|
||||
{
|
||||
ASSIMP_LOG_WARN("Unable to parse property instance. "
|
||||
DefaultLogger::get()->warn("Unable to parse property instance. "
|
||||
"Skipping this element instance");
|
||||
|
||||
PLY::PropertyInstance::ValueUnion v = PLY::PropertyInstance::DefaultValue((*a).eType);
|
||||
|
|
@ -819,7 +818,7 @@ bool PLY::ElementInstance::ParseInstanceBinary(
|
|||
{
|
||||
if (!(PLY::PropertyInstance::ParseInstanceBinary(streamBuffer, buffer, pCur, bufferSize, &(*a), &(*i), p_bBE)))
|
||||
{
|
||||
ASSIMP_LOG_WARN("Unable to parse binary property instance. "
|
||||
DefaultLogger::get()->warn("Unable to parse binary property instance. "
|
||||
"Skipping this element instance");
|
||||
|
||||
(*i).avList.push_back(PLY::PropertyInstance::DefaultValue((*a).eType));
|
||||
|
|
@ -1043,91 +1042,71 @@ bool PLY::PropertyInstance::ParseValueBinary(IOStreamBuffer<char> &streamBuffer,
|
|||
switch (eType)
|
||||
{
|
||||
case EDT_UInt:
|
||||
{
|
||||
uint32_t t;
|
||||
memcpy(&t, pCur, sizeof(uint32_t));
|
||||
pCur += sizeof(uint32_t);
|
||||
out->iUInt = (uint32_t)*((uint32_t*)pCur);
|
||||
pCur += 4;
|
||||
|
||||
// Swap endianness
|
||||
if (p_bBE)ByteSwap::Swap(&t);
|
||||
out->iUInt = t;
|
||||
if (p_bBE)ByteSwap::Swap((int32_t*)&out->iUInt);
|
||||
break;
|
||||
}
|
||||
|
||||
case EDT_UShort:
|
||||
{
|
||||
uint16_t t;
|
||||
memcpy(&t, pCur, sizeof(uint16_t));
|
||||
pCur += sizeof(uint16_t);
|
||||
uint16_t i = *((uint16_t*)pCur);
|
||||
|
||||
// Swap endianness
|
||||
if (p_bBE)ByteSwap::Swap(&t);
|
||||
out->iUInt = t;
|
||||
if (p_bBE)ByteSwap::Swap(&i);
|
||||
out->iUInt = (uint32_t)i;
|
||||
pCur += 2;
|
||||
break;
|
||||
}
|
||||
|
||||
case EDT_UChar:
|
||||
{
|
||||
uint8_t t;
|
||||
memcpy(&t, pCur, sizeof(uint8_t));
|
||||
pCur += sizeof(uint8_t);
|
||||
out->iUInt = t;
|
||||
out->iUInt = (uint32_t)(*((uint8_t*)pCur));
|
||||
pCur++;
|
||||
break;
|
||||
}
|
||||
|
||||
case EDT_Int:
|
||||
{
|
||||
int32_t t;
|
||||
memcpy(&t, pCur, sizeof(int32_t));
|
||||
pCur += sizeof(int32_t);
|
||||
out->iInt = *((int32_t*)pCur);
|
||||
pCur += 4;
|
||||
|
||||
// Swap endianness
|
||||
if (p_bBE)ByteSwap::Swap(&t);
|
||||
out->iInt = t;
|
||||
if (p_bBE)ByteSwap::Swap(&out->iInt);
|
||||
break;
|
||||
}
|
||||
|
||||
case EDT_Short:
|
||||
{
|
||||
int16_t t;
|
||||
memcpy(&t, pCur, sizeof(int16_t));
|
||||
pCur += sizeof(int16_t);
|
||||
int16_t i = *((int16_t*)pCur);
|
||||
|
||||
// Swap endianness
|
||||
if (p_bBE)ByteSwap::Swap(&t);
|
||||
out->iInt = t;
|
||||
if (p_bBE)ByteSwap::Swap(&i);
|
||||
out->iInt = (int32_t)i;
|
||||
pCur += 2;
|
||||
break;
|
||||
}
|
||||
|
||||
case EDT_Char:
|
||||
{
|
||||
int8_t t;
|
||||
memcpy(&t, pCur, sizeof(int8_t));
|
||||
pCur += sizeof(int8_t);
|
||||
out->iInt = t;
|
||||
out->iInt = (int32_t)*((int8_t*)pCur);
|
||||
pCur++;
|
||||
break;
|
||||
}
|
||||
|
||||
case EDT_Float:
|
||||
{
|
||||
float t;
|
||||
memcpy(&t, pCur, sizeof(float));
|
||||
pCur += sizeof(float);
|
||||
out->fFloat = *((float*)pCur);
|
||||
|
||||
// Swap endianness
|
||||
if (p_bBE)ByteSwap::Swap(&t);
|
||||
out->fFloat = t;
|
||||
if (p_bBE)ByteSwap::Swap((int32_t*)&out->fFloat);
|
||||
pCur += 4;
|
||||
break;
|
||||
}
|
||||
case EDT_Double:
|
||||
{
|
||||
double t;
|
||||
memcpy(&t, pCur, sizeof(double));
|
||||
pCur += sizeof(double);
|
||||
out->fDouble = *((double*)pCur);
|
||||
|
||||
// Swap endianness
|
||||
if (p_bBE)ByteSwap::Swap(&t);
|
||||
out->fDouble = t;
|
||||
if (p_bBE)ByteSwap::Swap((int64_t*)&out->fDouble);
|
||||
pCur += 8;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue