C++11-combat: replace more std::to_string by assimp-specific to_string
parent
b90669c45e
commit
e0dde73018
|
@ -56,11 +56,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace Assimp
|
||||
{
|
||||
namespace Assimp {
|
||||
|
||||
/// \var aiImporterDesc X3DImporter::Description
|
||||
/// Conastant which hold importer description
|
||||
/// Constant which holds the importer description
|
||||
const aiImporterDesc X3DImporter::Description = {
|
||||
"Extensible 3D(X3D) Importer",
|
||||
"smalcom",
|
||||
|
@ -88,7 +87,7 @@ void X3DImporter::Clear()
|
|||
|
||||
X3DImporter::~X3DImporter()
|
||||
{
|
||||
if(mReader != nullptr) delete mReader;
|
||||
delete mReader;
|
||||
// Clear() is accounting if data already is deleted. So, just check again if all data is deleted.
|
||||
Clear();
|
||||
}
|
||||
|
@ -115,13 +114,16 @@ bool X3DImporter::FindNodeElement_FromRoot(const std::string& pID, const CX3DImp
|
|||
bool X3DImporter::FindNodeElement_FromNode(CX3DImporter_NodeElement* pStartNode, const std::string& pID,
|
||||
const CX3DImporter_NodeElement::EType pType, CX3DImporter_NodeElement** pElement)
|
||||
{
|
||||
bool found = false;// flag: true - if requested element is found.
|
||||
bool found = false;// flag: true - if requested element is found.
|
||||
|
||||
// Check if pStartNode - this is the element, we are looking for.
|
||||
if((pStartNode->Type == pType) && (pStartNode->ID == pID))
|
||||
{
|
||||
found = true;
|
||||
if(pElement != nullptr) *pElement = pStartNode;
|
||||
if ( pElement != nullptr )
|
||||
{
|
||||
*pElement = pStartNode;
|
||||
}
|
||||
|
||||
goto fne_fn_end;
|
||||
}// if((pStartNode->Type() == pType) && (pStartNode->ID() == pID))
|
||||
|
@ -130,7 +132,10 @@ bool found = false;// flag: true - if requested element is found.
|
|||
for(std::list<CX3DImporter_NodeElement*>::iterator ch_it = pStartNode->Child.begin(); ch_it != pStartNode->Child.end(); ch_it++)
|
||||
{
|
||||
found = FindNodeElement_FromNode(*ch_it, pID, pType, pElement);
|
||||
if(found) break;
|
||||
if ( found )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}// for(std::list<CX3DImporter_NodeElement*>::iterator ch_it = it->Child.begin(); ch_it != it->Child.end(); ch_it++)
|
||||
|
||||
fne_fn_end:
|
||||
|
@ -151,7 +156,6 @@ bool X3DImporter::FindNodeElement(const std::string& pID, const CX3DImporter_Nod
|
|||
if(((CX3DImporter_NodeElement_Group*)tnd)->Static)
|
||||
{
|
||||
static_search = true;// Flag found, stop walking up. Node with static flag will holded in tnd variable.
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -160,10 +164,14 @@ bool X3DImporter::FindNodeElement(const std::string& pID, const CX3DImporter_Nod
|
|||
}// while(tnd != nullptr)
|
||||
|
||||
// at now call appropriate search function.
|
||||
if(static_search)
|
||||
return FindNodeElement_FromNode(tnd, pID, pType, pElement);
|
||||
else
|
||||
return FindNodeElement_FromRoot(pID, pType, pElement);
|
||||
if ( static_search )
|
||||
{
|
||||
return FindNodeElement_FromNode( tnd, pID, pType, pElement );
|
||||
}
|
||||
else
|
||||
{
|
||||
return FindNodeElement_FromRoot( pID, pType, pElement );
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************************************************************************************************************/
|
||||
|
@ -969,8 +977,8 @@ void X3DImporter::MeshGeometry_AddColor(aiMesh& pMesh, const std::list<aiColor4D
|
|||
{
|
||||
if(pColors.size() < pMesh.mNumVertices)
|
||||
{
|
||||
throw DeadlyImportError("MeshGeometry_AddColor1. Colors count(" + std::to_string(pColors.size()) + ") can not be less than Vertices count(" +
|
||||
std::to_string(pMesh.mNumVertices) + ").");
|
||||
throw DeadlyImportError("MeshGeometry_AddColor1. Colors count(" + to_string(pColors.size()) + ") can not be less than Vertices count(" +
|
||||
to_string(pMesh.mNumVertices) + ").");
|
||||
}
|
||||
|
||||
// copy colors to mesh
|
||||
|
@ -981,8 +989,8 @@ void X3DImporter::MeshGeometry_AddColor(aiMesh& pMesh, const std::list<aiColor4D
|
|||
{
|
||||
if(pColors.size() < pMesh.mNumFaces)
|
||||
{
|
||||
throw DeadlyImportError("MeshGeometry_AddColor1. Colors count(" + std::to_string(pColors.size()) + ") can not be less than Faces count(" +
|
||||
std::to_string(pMesh.mNumFaces) + ").");
|
||||
throw DeadlyImportError("MeshGeometry_AddColor1. Colors count(" + to_string(pColors.size()) + ") can not be less than Faces count(" +
|
||||
to_string(pMesh.mNumFaces) + ").");
|
||||
}
|
||||
|
||||
// copy colors to mesh
|
||||
|
@ -990,7 +998,10 @@ void X3DImporter::MeshGeometry_AddColor(aiMesh& pMesh, const std::list<aiColor4D
|
|||
for(size_t fi = 0; fi < pMesh.mNumFaces; fi++)
|
||||
{
|
||||
// apply color to all vertices of face
|
||||
for(size_t vi = 0, vi_e = pMesh.mFaces[fi].mNumIndices; vi < vi_e; vi++) pMesh.mColors[0][pMesh.mFaces[fi].mIndices[vi]] = *col_it;
|
||||
for ( size_t vi = 0, vi_e = pMesh.mFaces[ fi ].mNumIndices; vi < vi_e; vi++ )
|
||||
{
|
||||
pMesh.mColors[ 0 ][ pMesh.mFaces[ fi ].mIndices[ vi ] ] = *col_it;
|
||||
}
|
||||
|
||||
col_it++;
|
||||
}
|
||||
|
@ -1038,16 +1049,25 @@ void X3DImporter::MeshGeometry_AddColor(aiMesh& pMesh, const std::list<int32_t>&
|
|||
// check indices array count.
|
||||
if(pColorIdx.size() < pCoordIdx.size())
|
||||
{
|
||||
throw DeadlyImportError("MeshGeometry_AddColor2. Colors indices count(" + std::to_string(pColorIdx.size()) +
|
||||
") can not be less than Coords inidces count(" + std::to_string(pCoordIdx.size()) + ").");
|
||||
throw DeadlyImportError("MeshGeometry_AddColor2. Colors indices count(" + to_string(pColorIdx.size()) +
|
||||
") can not be less than Coords inidces count(" + to_string(pCoordIdx.size()) + ").");
|
||||
}
|
||||
// create list with colors for every vertex.
|
||||
col_tgt_arr.resize(pMesh.mNumVertices);
|
||||
for(std::list<int32_t>::const_iterator colidx_it = pColorIdx.begin(), coordidx_it = pCoordIdx.begin(); colidx_it != pColorIdx.end(); colidx_it++, coordidx_it++)
|
||||
{
|
||||
if(*colidx_it == (-1)) continue;// skip faces delimiter
|
||||
if((unsigned int)(*coordidx_it) > pMesh.mNumVertices) throw DeadlyImportError("MeshGeometry_AddColor2. Coordinate idx is out of range.");
|
||||
if((unsigned int)*colidx_it > pMesh.mNumVertices) throw DeadlyImportError("MeshGeometry_AddColor2. Color idx is out of range.");
|
||||
if ( *colidx_it == ( -1 ) )
|
||||
{
|
||||
continue;// skip faces delimiter
|
||||
}
|
||||
if ( ( unsigned int ) ( *coordidx_it ) > pMesh.mNumVertices )
|
||||
{
|
||||
throw DeadlyImportError( "MeshGeometry_AddColor2. Coordinate idx is out of range." );
|
||||
}
|
||||
if ( ( unsigned int ) *colidx_it > pMesh.mNumVertices )
|
||||
{
|
||||
throw DeadlyImportError( "MeshGeometry_AddColor2. Color idx is out of range." );
|
||||
}
|
||||
|
||||
col_tgt_arr[*coordidx_it] = col_arr_copy[*colidx_it];
|
||||
}
|
||||
|
@ -1063,7 +1083,10 @@ void X3DImporter::MeshGeometry_AddColor(aiMesh& pMesh, const std::list<int32_t>&
|
|||
}
|
||||
// create list with colors for every vertex.
|
||||
col_tgt_arr.resize(pMesh.mNumVertices);
|
||||
for(size_t i = 0; i < pMesh.mNumVertices; i++) col_tgt_arr[i] = col_arr_copy[i];
|
||||
for ( size_t i = 0; i < pMesh.mNumVertices; i++ )
|
||||
{
|
||||
col_tgt_arr[ i ] = col_arr_copy[ i ];
|
||||
}
|
||||
}// if(pColorIdx.size() > 0) else
|
||||
}// if(pColorPerVertex)
|
||||
else
|
||||
|
@ -1149,8 +1172,8 @@ void X3DImporter::MeshGeometry_AddNormal(aiMesh& pMesh, const std::list<int32_t>
|
|||
for(size_t i = 0; (i < pMesh.mNumVertices) && (i < tind.size()); i++)
|
||||
{
|
||||
if(tind[i] >= norm_arr_copy.size())
|
||||
throw DeadlyImportError("MeshGeometry_AddNormal. Normal index(" + std::to_string(tind[i]) +
|
||||
") is out of range. Normals count: " + std::to_string(norm_arr_copy.size()) + ".");
|
||||
throw DeadlyImportError("MeshGeometry_AddNormal. Normal index(" + to_string(tind[i]) +
|
||||
") is out of range. Normals count: " + to_string(norm_arr_copy.size()) + ".");
|
||||
|
||||
pMesh.mNormals[i] = norm_arr_copy[tind[i]];
|
||||
}
|
||||
|
@ -1289,10 +1312,8 @@ void X3DImporter::MeshGeometry_AddTexCoord(aiMesh& pMesh, const std::list<aiVect
|
|||
|
||||
aiMesh* X3DImporter::GeometryHelper_MakeMesh(const std::list<int32_t>& pCoordIdx, const std::list<aiVector3D>& pVertices) const
|
||||
{
|
||||
aiMesh* tmesh( nullptr );
|
||||
std::vector<aiFace> faces;
|
||||
unsigned int prim_type = 0;
|
||||
size_t ts;
|
||||
|
||||
// create faces array from input string with vertices indices.
|
||||
GeometryHelper_CoordIdxStr2FacesArr(pCoordIdx, faces, prim_type);
|
||||
|
@ -1304,8 +1325,8 @@ aiMesh* X3DImporter::GeometryHelper_MakeMesh(const std::list<int32_t>& pCoordIdx
|
|||
//
|
||||
// Create new mesh and copy geometry data.
|
||||
//
|
||||
tmesh = new aiMesh;
|
||||
ts = faces.size();
|
||||
aiMesh *tmesh = new aiMesh;
|
||||
size_t ts = faces.size();
|
||||
// faces
|
||||
tmesh->mFaces = new aiFace[ts];
|
||||
tmesh->mNumFaces = ts;
|
||||
|
@ -1458,7 +1479,7 @@ void X3DImporter::ParseNode_Head()
|
|||
{
|
||||
XML_CheckNode_MustBeEmpty();
|
||||
|
||||
// adding metada from <head> as MetaString from <Scene>
|
||||
// adding metadata from <head> as MetaString from <Scene>
|
||||
CX3DImporter_NodeElement_MetaString* ms = new CX3DImporter_NodeElement_MetaString(NodeElement_Cur);
|
||||
|
||||
ms->Name = mReader->getAttributeValueSafe("name");
|
||||
|
@ -1467,8 +1488,10 @@ void X3DImporter::ParseNode_Head()
|
|||
{
|
||||
ms->Value.push_back(mReader->getAttributeValueSafe("content"));
|
||||
NodeElement_List.push_back(ms);
|
||||
if(NodeElement_Cur != nullptr) NodeElement_Cur->Child.push_back(ms);
|
||||
|
||||
if ( NodeElement_Cur != nullptr )
|
||||
{
|
||||
NodeElement_Cur->Child.push_back( ms );
|
||||
}
|
||||
}
|
||||
}// if(XML_CheckNode_NameEqual("meta"))
|
||||
}// if(mReader->getNodeType() == irr::io::EXN_ELEMENT)
|
||||
|
@ -1477,14 +1500,15 @@ void X3DImporter::ParseNode_Head()
|
|||
if(XML_CheckNode_NameEqual("head"))
|
||||
{
|
||||
close_found = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}// if(mReader->getNodeType() == irr::io::EXN_ELEMENT) else
|
||||
}// while(mReader->read())
|
||||
|
||||
if(!close_found) Throw_CloseNotFound("head");
|
||||
|
||||
if ( !close_found )
|
||||
{
|
||||
Throw_CloseNotFound( "head" );
|
||||
}
|
||||
}
|
||||
|
||||
void X3DImporter::ParseNode_Scene()
|
||||
|
@ -1502,10 +1526,10 @@ auto GroupCounter_Decrease = [&](size_t& pCounter, const char* pGroupName) -> vo
|
|||
pCounter--;
|
||||
};
|
||||
|
||||
const char* GroupName_Group = "Group";
|
||||
const char* GroupName_StaticGroup = "StaticGroup";
|
||||
const char* GroupName_Transform = "Transform";
|
||||
const char* GroupName_Switch = "Switch";
|
||||
static const char* GroupName_Group = "Group";
|
||||
static const char* GroupName_StaticGroup = "StaticGroup";
|
||||
static const char* GroupName_Transform = "Transform";
|
||||
static const char* GroupName_Switch = "Switch";
|
||||
|
||||
bool close_found = false;
|
||||
size_t counter_group = 0;
|
||||
|
@ -1551,7 +1575,7 @@ size_t counter_switch = 0;
|
|||
if(mReader->isEmptyElement()) GroupCounter_Decrease(counter_switch, GroupName_Switch);
|
||||
}
|
||||
else if(XML_CheckNode_NameEqual("DirectionalLight"))
|
||||
{
|
||||
{
|
||||
ParseNode_Lighting_DirectionalLight();
|
||||
}
|
||||
else if(XML_CheckNode_NameEqual("PointLight"))
|
||||
|
|
|
@ -46,9 +46,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "X3DImporter.hpp"
|
||||
#include "X3DImporter_Macro.hpp"
|
||||
#include "StringUtils.h"
|
||||
|
||||
namespace Assimp
|
||||
{
|
||||
namespace Assimp {
|
||||
|
||||
// <DirectionalLight
|
||||
// DEF="" ID
|
||||
|
@ -95,7 +95,7 @@ void X3DImporter::ParseNode_Lighting_DirectionalLight()
|
|||
if(!def.empty())
|
||||
ne->ID = def;
|
||||
else
|
||||
ne->ID = "DirectionalLight_" + std::to_string((size_t)ne);// make random name
|
||||
ne->ID = "DirectionalLight_" + to_string((size_t)ne);// make random name
|
||||
|
||||
((CX3DImporter_NodeElement_Light*)ne)->AmbientIntensity = ambientIntensity;
|
||||
((CX3DImporter_NodeElement_Light*)ne)->Color = color;
|
||||
|
@ -178,7 +178,7 @@ void X3DImporter::ParseNode_Lighting_PointLight()
|
|||
// Assimp want a node with name similar to a light. "Why? I don't no." )
|
||||
ParseHelper_Group_Begin(false);
|
||||
// make random name
|
||||
if(ne->ID.empty()) ne->ID = "PointLight_" + std::to_string((size_t)ne);
|
||||
if(ne->ID.empty()) ne->ID = "PointLight_" + to_string((size_t)ne);
|
||||
|
||||
NodeElement_Cur->ID = ne->ID;// assign name to node and return to light element.
|
||||
ParseHelper_Node_Exit();
|
||||
|
@ -268,7 +268,7 @@ void X3DImporter::ParseNode_Lighting_SpotLight()
|
|||
// Assimp want a node with name similar to a light. "Why? I don't no." )
|
||||
ParseHelper_Group_Begin(false);
|
||||
// make random name
|
||||
if(ne->ID.empty()) ne->ID = "SpotLight_" + std::to_string((size_t)ne);
|
||||
if(ne->ID.empty()) ne->ID = "SpotLight_" + to_string((size_t)ne);
|
||||
|
||||
NodeElement_Cur->ID = ne->ID;// assign name to node and return to light element.
|
||||
ParseHelper_Node_Exit();
|
||||
|
|
|
@ -175,7 +175,7 @@ void X3DImporter::Postprocess_BuildLight(const CX3DImporter_NodeElement& pNodeEl
|
|||
|
||||
break;
|
||||
default:
|
||||
throw DeadlyImportError("Postprocess_BuildLight. Unknown type of light: " + std::to_string(pNodeElement.Type) + ".");
|
||||
throw DeadlyImportError("Postprocess_BuildLight. Unknown type of light: " + to_string(pNodeElement.Type) + ".");
|
||||
}
|
||||
|
||||
pSceneLightList.push_back(new_light);
|
||||
|
@ -364,7 +364,7 @@ void X3DImporter::Postprocess_BuildMesh(const CX3DImporter_NodeElement& pNodeEle
|
|||
else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Coordinate)
|
||||
{} // skip because already read when mesh created.
|
||||
else
|
||||
throw DeadlyImportError("Postprocess_BuildMesh. Unknown child of IndexedLineSet: " + std::to_string((*ch_it)->Type) + ".");
|
||||
throw DeadlyImportError("Postprocess_BuildMesh. Unknown child of IndexedLineSet: " + to_string((*ch_it)->Type) + ".");
|
||||
}// for(std::list<CX3DImporter_NodeElement*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ch_it++)
|
||||
|
||||
return;// mesh is build, nothing to do anymore.
|
||||
|
|
|
@ -731,7 +731,7 @@ void XFileParser::ParseDataObjectMaterial( Material* pMaterial)
|
|||
std::string matName;
|
||||
readHeadOfDataObject( &matName);
|
||||
if( matName.empty())
|
||||
matName = std::string( "material") + std::to_string( mLineNumber );
|
||||
matName = std::string( "material") + to_string( mLineNumber );
|
||||
pMaterial->mName = matName;
|
||||
pMaterial->mIsReference = false;
|
||||
|
||||
|
|
|
@ -292,14 +292,14 @@ inline void Buffer::Read(Value& obj, Asset& r)
|
|||
this->mData.reset(data);
|
||||
|
||||
if (statedLength > 0 && this->byteLength != statedLength) {
|
||||
throw DeadlyImportError("GLTF: buffer \"" + id + "\", expected " + std::to_string(statedLength) +
|
||||
" bytes, but found " + std::to_string(dataURI.dataLength));
|
||||
throw DeadlyImportError("GLTF: buffer \"" + id + "\", expected " + to_string(statedLength) +
|
||||
" bytes, but found " + to_string(dataURI.dataLength));
|
||||
}
|
||||
}
|
||||
else { // assume raw data
|
||||
if (statedLength != dataURI.dataLength) {
|
||||
throw DeadlyImportError("GLTF: buffer \"" + id + "\", expected " + std::to_string(statedLength) +
|
||||
" bytes, but found " + std::to_string(dataURI.dataLength));
|
||||
throw DeadlyImportError("GLTF: buffer \"" + id + "\", expected " + to_string(statedLength) +
|
||||
" bytes, but found " + to_string(dataURI.dataLength));
|
||||
}
|
||||
|
||||
this->mData.reset(new uint8_t[dataURI.dataLength]);
|
||||
|
@ -991,7 +991,7 @@ Ref<Buffer> buf = pAsset_Root.buffers.Get(pCompression_Open3DGC.Buffer);
|
|||
|
||||
break;
|
||||
default:
|
||||
throw DeadlyImportError("GLTF: Open3DGC. Unsupported type of float attribute: " + std::to_string(ifs.GetFloatAttributeType(idx)));
|
||||
throw DeadlyImportError("GLTF: Open3DGC. Unsupported type of float attribute: " + to_string(ifs.GetFloatAttributeType(idx)));
|
||||
}
|
||||
|
||||
tval *= ifs.GetFloatAttributeDim(idx) * sizeof(o3dgc::Real);// After checking count of objects we can get size of array.
|
||||
|
@ -1006,7 +1006,7 @@ Ref<Buffer> buf = pAsset_Root.buffers.Get(pCompression_Open3DGC.Buffer);
|
|||
switch( ifs.GetIntAttributeType( idx ) )
|
||||
{
|
||||
default:
|
||||
throw DeadlyImportError("GLTF: Open3DGC. Unsupported type of int attribute: " + std::to_string(ifs.GetIntAttributeType(idx)));
|
||||
throw DeadlyImportError("GLTF: Open3DGC. Unsupported type of int attribute: " + to_string(ifs.GetIntAttributeType(idx)));
|
||||
}
|
||||
|
||||
tval *= ifs.GetIntAttributeDim(idx) * sizeof(long);// See float attributes note.
|
||||
|
@ -1045,7 +1045,7 @@ Ref<Buffer> buf = pAsset_Root.buffers.Get(pCompression_Open3DGC.Buffer);
|
|||
|
||||
break;
|
||||
default:
|
||||
throw DeadlyImportError("GLTF: Open3DGC. Unsupported type of float attribute: " + std::to_string(ifs.GetFloatAttributeType(idx)));
|
||||
throw DeadlyImportError("GLTF: Open3DGC. Unsupported type of float attribute: " + to_string(ifs.GetFloatAttributeType(idx)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1055,7 +1055,7 @@ Ref<Buffer> buf = pAsset_Root.buffers.Get(pCompression_Open3DGC.Buffer);
|
|||
{
|
||||
// ifs.SetIntAttribute(idx, (long* const)(decoded_data + get_buf_offset(primitives[0].attributes.joint)));
|
||||
default:
|
||||
throw DeadlyImportError("GLTF: Open3DGC. Unsupported type of int attribute: " + std::to_string(ifs.GetIntAttributeType(idx)));
|
||||
throw DeadlyImportError("GLTF: Open3DGC. Unsupported type of int attribute: " + to_string(ifs.GetIntAttributeType(idx)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1620,6 +1620,4 @@ namespace Util {
|
|||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
} // ns glTF
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace glTF {
|
|||
inline Value& MakeValue(Value& val, const std::vector<float> & r, MemoryPoolAllocator<>& al) {
|
||||
val.SetArray();
|
||||
val.Reserve(r.size(), al);
|
||||
for (int i = 0; i < r.size(); ++i) {
|
||||
for (unsigned int i = 0; i < r.size(); ++i) {
|
||||
val.PushBack(r[i], al);
|
||||
}
|
||||
return val;
|
||||
|
|
|
@ -204,30 +204,29 @@ inline Ref<Accessor> ExportData(Asset& a, std::string& meshName, Ref<Buffer>& bu
|
|||
// calculate min and max values
|
||||
{
|
||||
// Allocate and initialize with large values.
|
||||
float float_MAX = 10000000000000;
|
||||
for (int i = 0 ; i < numCompsOut ; i++) {
|
||||
float float_MAX = 10000000000000.0f;
|
||||
for (unsigned int i = 0 ; i < numCompsOut ; i++) {
|
||||
acc->min.push_back( float_MAX);
|
||||
acc->max.push_back(-float_MAX);
|
||||
}
|
||||
|
||||
// Search and set extreme values.
|
||||
float valueTmp;
|
||||
for (int i = 0 ; i < count ; i++) {
|
||||
for (int j = 0 ; j < numCompsOut ; j++) {
|
||||
for (unsigned int i = 0 ; i < count ; i++) {
|
||||
for (unsigned int j = 0 ; j < numCompsOut ; j++) {
|
||||
if (numCompsOut == 1) {
|
||||
valueTmp = static_cast<unsigned short*>(data)[i];
|
||||
} else {
|
||||
valueTmp = static_cast<aiVector3D*>(data)[i][j];
|
||||
}
|
||||
|
||||
if (numCompsOut == 1) {
|
||||
valueTmp = static_cast<unsigned short*>(data)[i];
|
||||
} else {
|
||||
valueTmp = static_cast<aiVector3D*>(data)[i][j];
|
||||
if (valueTmp < acc->min[j]) {
|
||||
acc->min[j] = valueTmp;
|
||||
}
|
||||
if (valueTmp > acc->max[j]) {
|
||||
acc->max[j] = valueTmp;
|
||||
}
|
||||
}
|
||||
|
||||
if (valueTmp < acc->min[j]) {
|
||||
acc->min[j] = valueTmp;
|
||||
}
|
||||
if (valueTmp > acc->max[j]) {
|
||||
acc->max[j] = valueTmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -449,7 +448,7 @@ void ExportSkin(Asset& mAsset, const aiMesh* aim, Ref<Mesh>& meshRef, Ref<Buffer
|
|||
// aib->mName =====> skinRef->jointNames
|
||||
// Find the node with id = mName.
|
||||
Ref<Node> nodeRef = mAsset.nodes.Get(aib->mName.C_Str());
|
||||
nodeRef->jointName = "joint_" + std::to_string(idx_bone);
|
||||
nodeRef->jointName = "joint_" + to_string(idx_bone);
|
||||
skinRef->jointNames.push_back(nodeRef);
|
||||
|
||||
// Identity Matrix =====> skinRef->bindShapeMatrix
|
||||
|
@ -840,7 +839,7 @@ void glTFExporter::ExportAnimations()
|
|||
|
||||
// It appears that assimp stores this type of animation as multiple animations.
|
||||
// where each aiNodeAnim in mChannels animates a specific node.
|
||||
std::string name = nameAnim + "_" + std::to_string(channelIndex);
|
||||
std::string name = nameAnim + "_" + to_string(channelIndex);
|
||||
name = mAsset->FindUniqueID(name, "animation");
|
||||
Ref<Animation> animRef = mAsset->animations.Create(name);
|
||||
|
||||
|
|
Loading…
Reference in New Issue