[*] Merged fresh master and resolved conflicts.
commit
8c6ee48af5
16
CHANGES
16
CHANGES
|
@ -2,6 +2,22 @@
|
|||
CHANGELOG
|
||||
----------------------------------------------------------------------
|
||||
|
||||
3.2.1 (2016-10-01)
|
||||
|
||||
FEATURES:
|
||||
- Updated glTF exporter to meet 1.0 specification.
|
||||
|
||||
FIXES/HOUSEKEEPING:
|
||||
- Fixed glTF Validator errors for exported glTF format.
|
||||
|
||||
ISSUES:
|
||||
- Hard coded sampler setting for
|
||||
- magFilter
|
||||
- minFilter
|
||||
- void* in ExportData for accessor max and min.
|
||||
|
||||
|
||||
|
||||
3.2.0 (2015-11-03)
|
||||
|
||||
FEATURES:
|
||||
|
|
|
@ -1,4 +1,45 @@
|
|||
/// \file AMFImporter.cpp
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, 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.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/// \file AMFImporter.cpp
|
||||
/// \brief AMF-format files importer for Assimp: main algorithm implementation.
|
||||
/// \date 2016
|
||||
/// \author smal.root@gmail.com
|
||||
|
|
|
@ -1,9 +1,51 @@
|
|||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, 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.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/// \file AMFImporter.hpp
|
||||
/// \brief AMF-format files importer for Assimp.
|
||||
/// \date 2016
|
||||
/// \author smal.root@gmail.com
|
||||
// Thanks to acorn89 for support.
|
||||
|
||||
#pragma once
|
||||
#ifndef INCLUDED_AI_AMF_IMPORTER_H
|
||||
#define INCLUDED_AI_AMF_IMPORTER_H
|
||||
|
||||
|
|
|
@ -1,4 +1,45 @@
|
|||
/// \file AMFImporter_Geometry.cpp
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, 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.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/// \file AMFImporter_Geometry.cpp
|
||||
/// \brief Parsing data from geometry nodes.
|
||||
/// \date 2016
|
||||
/// \author smal.root@gmail.com
|
||||
|
|
|
@ -1,8 +1,50 @@
|
|||
/// \file AMFImporter_Macro.hpp
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, 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.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/// \file AMFImporter_Macro.hpp
|
||||
/// \brief Useful macrodefines.
|
||||
/// \date 2016
|
||||
/// \author smal.root@gmail.com
|
||||
|
||||
#pragma once
|
||||
#ifndef AMFIMPORTER_MACRO_HPP_INCLUDED
|
||||
#define AMFIMPORTER_MACRO_HPP_INCLUDED
|
||||
|
||||
|
|
|
@ -1,4 +1,45 @@
|
|||
/// \file AMFImporter_Material.cpp
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, 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.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/// \file AMFImporter_Material.cpp
|
||||
/// \brief Parsing data from material nodes.
|
||||
/// \date 2016
|
||||
/// \author smal.root@gmail.com
|
||||
|
|
|
@ -1,8 +1,50 @@
|
|||
/// \file AMFImporter_Node.hpp
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, 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.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/// \file AMFImporter_Node.hpp
|
||||
/// \brief Elements of scene graph.
|
||||
/// \date 2016
|
||||
/// \author smal.root@gmail.com
|
||||
|
||||
#pragma once
|
||||
#ifndef INCLUDED_AI_AMF_IMPORTER_NODE_H
|
||||
#define INCLUDED_AI_AMF_IMPORTER_NODE_H
|
||||
|
||||
|
|
|
@ -1,4 +1,45 @@
|
|||
/// \file AMFImporter_Postprocess.cpp
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, 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.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/// \file AMFImporter_Postprocess.cpp
|
||||
/// \brief Convert built scenegraph and objects to Assimp scenegraph.
|
||||
/// \date 2016
|
||||
/// \author smal.root@gmail.com
|
||||
|
|
|
@ -806,4 +806,4 @@ void DNA::RegisterConverters() {
|
|||
}
|
||||
|
||||
|
||||
#endif ASSIMP_BUILD_NO_BLEND_IMPORTER
|
||||
#endif // ASSIMP_BUILD_NO_BLEND_IMPORTER
|
||||
|
|
|
@ -140,9 +140,9 @@ Exporter::ExportFormatEntry gExporters[] =
|
|||
|
||||
#ifndef ASSIMP_BUILD_NO_GLTF_EXPORTER
|
||||
Exporter::ExportFormatEntry( "gltf", "GL Transmission Format", "gltf", &ExportSceneGLTF,
|
||||
aiProcess_JoinIdenticalVertices | aiProcess_Triangulate /*| aiProcess_SortByPType*/),
|
||||
aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType),
|
||||
Exporter::ExportFormatEntry( "glb", "GL Transmission Format (binary)", "glb", &ExportSceneGLB,
|
||||
aiProcess_JoinIdenticalVertices | aiProcess_Triangulate /*| aiProcess_SortByPType*/),
|
||||
aiProcess_JoinIdenticalVertices | aiProcess_Triangulate | aiProcess_SortByPType),
|
||||
#endif
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_ASSBIN_EXPORTER
|
||||
|
|
|
@ -140,6 +140,9 @@ void ObjFileParser::parseFile()
|
|||
if (numComponents == 3) {
|
||||
// read in vertex definition
|
||||
getVector3(m_pModel->m_Vertices);
|
||||
} else if (numComponents == 4) {
|
||||
// read in vertex definition (homogeneous coords)
|
||||
getHomogeneousVector3(m_pModel->m_Vertices);
|
||||
} else if (numComponents == 6) {
|
||||
// read vertex and vertex-color
|
||||
getTwoVectors3(m_pModel->m_Vertices, m_pModel->m_VertexColors);
|
||||
|
@ -320,6 +323,26 @@ void ObjFileParser::getVector3( std::vector<aiVector3D> &point3d_array ) {
|
|||
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
||||
}
|
||||
|
||||
void ObjFileParser::getHomogeneousVector3( std::vector<aiVector3D> &point3d_array ) {
|
||||
ai_real x, y, z, w;
|
||||
copyNextWord(m_buffer, Buffersize);
|
||||
x = (ai_real) fast_atof(m_buffer);
|
||||
|
||||
copyNextWord(m_buffer, Buffersize);
|
||||
y = (ai_real) fast_atof(m_buffer);
|
||||
|
||||
copyNextWord( m_buffer, Buffersize );
|
||||
z = ( ai_real ) fast_atof( m_buffer );
|
||||
|
||||
copyNextWord( m_buffer, Buffersize );
|
||||
w = ( ai_real ) fast_atof( m_buffer );
|
||||
|
||||
ai_assert( w != 0 );
|
||||
|
||||
point3d_array.push_back( aiVector3D( x/w, y/w, z/w ) );
|
||||
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Get values for two 3D vectors on the same line
|
||||
void ObjFileParser::getTwoVectors3( std::vector<aiVector3D> &point3d_array_a, std::vector<aiVector3D> &point3d_array_b ) {
|
||||
|
|
|
@ -89,6 +89,8 @@ private:
|
|||
void getVector( std::vector<aiVector3D> &point3d_array );
|
||||
/// Stores the following 3d vector.
|
||||
void getVector3( std::vector<aiVector3D> &point3d_array );
|
||||
/// Stores the following homogeneous vector as a 3D vector
|
||||
void getHomogeneousVector3( std::vector<aiVector3D> &point3d_array );
|
||||
/// Stores the following two 3d vectors on the line.
|
||||
void getTwoVectors3( std::vector<aiVector3D> &point3d_array_a, std::vector<aiVector3D> &point3d_array_b );
|
||||
/// Stores the following 3d vector.
|
||||
|
|
|
@ -49,7 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <sstream>
|
||||
|
||||
namespace Assimp {
|
||||
namespace Formatter {
|
||||
namespace Formatter {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
/** stringstream utility. Usage:
|
||||
|
@ -160,4 +160,5 @@ typedef basic_formatter< wchar_t > wformat;
|
|||
} // ! namespace Formatter
|
||||
|
||||
} // ! namespace Assimp
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,3 +1,42 @@
|
|||
/*
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, 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.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
/// \file X3DImporter.cpp
|
||||
/// \brief X3D-format files importer for Assimp: main algorithm implementation.
|
||||
/// \date 2015-2016
|
||||
|
@ -100,8 +139,8 @@ fne_fn_end:
|
|||
|
||||
bool X3DImporter::FindNodeElement(const std::string& pID, const CX3DImporter_NodeElement::EType pType, CX3DImporter_NodeElement** pElement)
|
||||
{
|
||||
CX3DImporter_NodeElement* tnd = NodeElement_Cur;// temporary pointer to node.
|
||||
bool static_search = false;// flag: true if searching in static node.
|
||||
CX3DImporter_NodeElement* tnd = NodeElement_Cur;// temporary pointer to node.
|
||||
bool static_search = false;// flag: true if searching in static node.
|
||||
|
||||
// At first check if we have deal with static node. Go up thru parent nodes and check flag.
|
||||
while(tnd != nullptr)
|
||||
|
@ -187,86 +226,86 @@ void X3DImporter::XML_CheckNode_MustBeEmpty()
|
|||
|
||||
void X3DImporter::XML_CheckNode_SkipUnsupported(const std::string& pParentNodeName)
|
||||
{
|
||||
const size_t Uns_Skip_Len = 189;
|
||||
const char* Uns_Skip[Uns_Skip_Len] = {
|
||||
// CAD geometry component
|
||||
"CADAssembly", "CADFace", "CADLayer", "CADPart", "IndexedQuadSet", "QuadSet",
|
||||
// Core
|
||||
"ROUTE", "ExternProtoDeclare", "ProtoDeclare", "ProtoInstance", "ProtoInterface", "WorldInfo",
|
||||
// Distributed interactive simulation (DIS) component
|
||||
"DISEntityManager", "DISEntityTypeMapping", "EspduTransform", "ReceiverPdu", "SignalPdu", "TransmitterPdu",
|
||||
// Cube map environmental texturing component
|
||||
"ComposedCubeMapTexture", "GeneratedCubeMapTexture", "ImageCubeMapTexture",
|
||||
// Environmental effects component
|
||||
"Background", "Fog", "FogCoordinate", "LocalFog", "TextureBackground",
|
||||
// Environmental sensor component
|
||||
"ProximitySensor", "TransformSensor", "VisibilitySensor",
|
||||
// Followers component
|
||||
"ColorChaser", "ColorDamper", "CoordinateChaser", "CoordinateDamper", "OrientationChaser", "OrientationDamper", "PositionChaser", "PositionChaser2D",
|
||||
"PositionDamper", "PositionDamper2D", "ScalarChaser", "ScalarDamper", "TexCoordChaser2D", "TexCoordDamper2D",
|
||||
// Geospatial component
|
||||
"GeoCoordinate", "GeoElevationGrid", "GeoLocation", "GeoLOD", "GeoMetadata", "GeoOrigin", "GeoPositionInterpolator", "GeoProximitySensor",
|
||||
"GeoTouchSensor", "GeoTransform", "GeoViewpoint",
|
||||
// Humanoid Animation (H-Anim) component
|
||||
"HAnimDisplacer", "HAnimHumanoid", "HAnimJoint", "HAnimSegment", "HAnimSite",
|
||||
// Interpolation component
|
||||
"ColorInterpolator", "CoordinateInterpolator", "CoordinateInterpolator2D", "EaseInEaseOut", "NormalInterpolator", "OrientationInterpolator",
|
||||
"PositionInterpolator", "PositionInterpolator2D", "ScalarInterpolator", "SplinePositionInterpolator", "SplinePositionInterpolator2D",
|
||||
"SplineScalarInterpolator", "SquadOrientationInterpolator",
|
||||
// Key device sensor component
|
||||
"KeySensor", "StringSensor"
|
||||
// Layering component
|
||||
"Layer", "LayerSet", "Viewport",
|
||||
// Layout component
|
||||
"Layout", "LayoutGroup", "LayoutLayer", "ScreenFontStyle", "ScreenGroup",
|
||||
// Navigation component
|
||||
"Billboard", "Collision", "LOD", "NavigationInfo", "OrthoViewpoint", "Viewpoint", "ViewpointGroup",
|
||||
// Networking component
|
||||
"Anchor", "LoadSensor",
|
||||
// NURBS component
|
||||
"Contour2D", "ContourPolyline2D", "CoordinateDouble", "NurbsCurve", "NurbsCurve2D", "NurbsOrientationInterpolator", "NurbsPatchSurface",
|
||||
"NurbsPositionInterpolator", "NurbsSet", "NurbsSurfaceInterpolator", "NurbsSweptSurface", "NurbsSwungSurface", "NurbsTextureCoordinate",
|
||||
"NurbsTrimmedSurface",
|
||||
// Particle systems component
|
||||
"BoundedPhysicsModel", "ConeEmitter", "ExplosionEmitter", "ForcePhysicsModel", "ParticleSystem", "PointEmitter", "PolylineEmitter", "SurfaceEmitter",
|
||||
"VolumeEmitter", "WindPhysicsModel",
|
||||
// Picking component
|
||||
"LinePickSensor", "PickableGroup", "PointPickSensor", "PrimitivePickSensor", "VolumePickSensor",
|
||||
// Pointing device sensor component
|
||||
"CylinderSensor", "PlaneSensor", "SphereSensor", "TouchSensor",
|
||||
// Rendering component
|
||||
"ClipPlane",
|
||||
// Rigid body physics
|
||||
"BallJoint", "CollidableOffset", "CollidableShape", "CollisionCollection", "CollisionSensor", "CollisionSpace", "Contact", "DoubleAxisHingeJoint",
|
||||
"MotorJoint", "RigidBody", "RigidBodyCollection", "SingleAxisHingeJoint", "SliderJoint", "UniversalJoint",
|
||||
// Scripting component
|
||||
"Script",
|
||||
// Programmable shaders component
|
||||
"ComposedShader", "FloatVertexAttribute", "Matrix3VertexAttribute", "Matrix4VertexAttribute", "PackagedShader", "ProgramShader", "ShaderPart",
|
||||
"ShaderProgram",
|
||||
// Shape component
|
||||
"FillProperties", "LineProperties", "TwoSidedMaterial",
|
||||
// Sound component
|
||||
"AudioClip", "Sound",
|
||||
// Text component
|
||||
"FontStyle", "Text",
|
||||
// Texturing3D Component
|
||||
"ComposedTexture3D", "ImageTexture3D", "PixelTexture3D", "TextureCoordinate3D", "TextureCoordinate4D", "TextureTransformMatrix3D", "TextureTransform3D",
|
||||
// Texturing component
|
||||
"MovieTexture", "MultiTexture", "MultiTextureCoordinate", "MultiTextureTransform", "PixelTexture", "TextureCoordinateGenerator", "TextureProperties",
|
||||
// Time component
|
||||
"TimeSensor",
|
||||
// Event Utilities component
|
||||
"BooleanFilter", "BooleanSequencer", "BooleanToggle", "BooleanTrigger", "IntegerSequencer", "IntegerTrigger", "TimeTrigger",
|
||||
// Volume rendering component
|
||||
"BlendedVolumeStyle", "BoundaryEnhancementVolumeStyle", "CartoonVolumeStyle", "ComposedVolumeStyle", "EdgeEnhancementVolumeStyle", "IsoSurfaceVolumeData",
|
||||
"OpacityMapVolumeStyle", "ProjectionVolumeStyle", "SegmentedVolumeData", "ShadedVolumeStyle", "SilhouetteEnhancementVolumeStyle", "ToneMappedVolumeStyle",
|
||||
"VolumeData"
|
||||
};
|
||||
const size_t Uns_Skip_Len = 189;
|
||||
const char* Uns_Skip[ Uns_Skip_Len ] = {
|
||||
// CAD geometry component
|
||||
"CADAssembly", "CADFace", "CADLayer", "CADPart", "IndexedQuadSet", "QuadSet",
|
||||
// Core
|
||||
"ROUTE", "ExternProtoDeclare", "ProtoDeclare", "ProtoInstance", "ProtoInterface", "WorldInfo",
|
||||
// Distributed interactive simulation (DIS) component
|
||||
"DISEntityManager", "DISEntityTypeMapping", "EspduTransform", "ReceiverPdu", "SignalPdu", "TransmitterPdu",
|
||||
// Cube map environmental texturing component
|
||||
"ComposedCubeMapTexture", "GeneratedCubeMapTexture", "ImageCubeMapTexture",
|
||||
// Environmental effects component
|
||||
"Background", "Fog", "FogCoordinate", "LocalFog", "TextureBackground",
|
||||
// Environmental sensor component
|
||||
"ProximitySensor", "TransformSensor", "VisibilitySensor",
|
||||
// Followers component
|
||||
"ColorChaser", "ColorDamper", "CoordinateChaser", "CoordinateDamper", "OrientationChaser", "OrientationDamper", "PositionChaser", "PositionChaser2D",
|
||||
"PositionDamper", "PositionDamper2D", "ScalarChaser", "ScalarDamper", "TexCoordChaser2D", "TexCoordDamper2D",
|
||||
// Geospatial component
|
||||
"GeoCoordinate", "GeoElevationGrid", "GeoLocation", "GeoLOD", "GeoMetadata", "GeoOrigin", "GeoPositionInterpolator", "GeoProximitySensor",
|
||||
"GeoTouchSensor", "GeoTransform", "GeoViewpoint",
|
||||
// Humanoid Animation (H-Anim) component
|
||||
"HAnimDisplacer", "HAnimHumanoid", "HAnimJoint", "HAnimSegment", "HAnimSite",
|
||||
// Interpolation component
|
||||
"ColorInterpolator", "CoordinateInterpolator", "CoordinateInterpolator2D", "EaseInEaseOut", "NormalInterpolator", "OrientationInterpolator",
|
||||
"PositionInterpolator", "PositionInterpolator2D", "ScalarInterpolator", "SplinePositionInterpolator", "SplinePositionInterpolator2D",
|
||||
"SplineScalarInterpolator", "SquadOrientationInterpolator",
|
||||
// Key device sensor component
|
||||
"KeySensor", "StringSensor"
|
||||
// Layering component
|
||||
"Layer", "LayerSet", "Viewport",
|
||||
// Layout component
|
||||
"Layout", "LayoutGroup", "LayoutLayer", "ScreenFontStyle", "ScreenGroup",
|
||||
// Navigation component
|
||||
"Billboard", "Collision", "LOD", "NavigationInfo", "OrthoViewpoint", "Viewpoint", "ViewpointGroup",
|
||||
// Networking component
|
||||
"Anchor", "LoadSensor",
|
||||
// NURBS component
|
||||
"Contour2D", "ContourPolyline2D", "CoordinateDouble", "NurbsCurve", "NurbsCurve2D", "NurbsOrientationInterpolator", "NurbsPatchSurface",
|
||||
"NurbsPositionInterpolator", "NurbsSet", "NurbsSurfaceInterpolator", "NurbsSweptSurface", "NurbsSwungSurface", "NurbsTextureCoordinate",
|
||||
"NurbsTrimmedSurface",
|
||||
// Particle systems component
|
||||
"BoundedPhysicsModel", "ConeEmitter", "ExplosionEmitter", "ForcePhysicsModel", "ParticleSystem", "PointEmitter", "PolylineEmitter", "SurfaceEmitter",
|
||||
"VolumeEmitter", "WindPhysicsModel",
|
||||
// Picking component
|
||||
"LinePickSensor", "PickableGroup", "PointPickSensor", "PrimitivePickSensor", "VolumePickSensor",
|
||||
// Pointing device sensor component
|
||||
"CylinderSensor", "PlaneSensor", "SphereSensor", "TouchSensor",
|
||||
// Rendering component
|
||||
"ClipPlane",
|
||||
// Rigid body physics
|
||||
"BallJoint", "CollidableOffset", "CollidableShape", "CollisionCollection", "CollisionSensor", "CollisionSpace", "Contact", "DoubleAxisHingeJoint",
|
||||
"MotorJoint", "RigidBody", "RigidBodyCollection", "SingleAxisHingeJoint", "SliderJoint", "UniversalJoint",
|
||||
// Scripting component
|
||||
"Script",
|
||||
// Programmable shaders component
|
||||
"ComposedShader", "FloatVertexAttribute", "Matrix3VertexAttribute", "Matrix4VertexAttribute", "PackagedShader", "ProgramShader", "ShaderPart",
|
||||
"ShaderProgram",
|
||||
// Shape component
|
||||
"FillProperties", "LineProperties", "TwoSidedMaterial",
|
||||
// Sound component
|
||||
"AudioClip", "Sound",
|
||||
// Text component
|
||||
"FontStyle", "Text",
|
||||
// Texturing3D Component
|
||||
"ComposedTexture3D", "ImageTexture3D", "PixelTexture3D", "TextureCoordinate3D", "TextureCoordinate4D", "TextureTransformMatrix3D", "TextureTransform3D",
|
||||
// Texturing component
|
||||
"MovieTexture", "MultiTexture", "MultiTextureCoordinate", "MultiTextureTransform", "PixelTexture", "TextureCoordinateGenerator", "TextureProperties",
|
||||
// Time component
|
||||
"TimeSensor",
|
||||
// Event Utilities component
|
||||
"BooleanFilter", "BooleanSequencer", "BooleanToggle", "BooleanTrigger", "IntegerSequencer", "IntegerTrigger", "TimeTrigger",
|
||||
// Volume rendering component
|
||||
"BlendedVolumeStyle", "BoundaryEnhancementVolumeStyle", "CartoonVolumeStyle", "ComposedVolumeStyle", "EdgeEnhancementVolumeStyle", "IsoSurfaceVolumeData",
|
||||
"OpacityMapVolumeStyle", "ProjectionVolumeStyle", "SegmentedVolumeData", "ShadedVolumeStyle", "SilhouetteEnhancementVolumeStyle", "ToneMappedVolumeStyle",
|
||||
"VolumeData"
|
||||
};
|
||||
|
||||
std::string nn(mReader->getNodeName());
|
||||
bool found = false;
|
||||
bool close_found = false;
|
||||
const std::string nn( mReader->getNodeName() );
|
||||
bool found = false;
|
||||
bool close_found = false;
|
||||
|
||||
for(size_t i = 0; i < Uns_Skip_Len; i++)
|
||||
{
|
||||
|
@ -326,8 +365,8 @@ std::string val(mReader->getAttributeValue(pAttrIdx));
|
|||
|
||||
float X3DImporter::XML_ReadNode_GetAttrVal_AsFloat(const int pAttrIdx)
|
||||
{
|
||||
std::string val;
|
||||
float tvalf;
|
||||
std::string val;
|
||||
float tvalf;
|
||||
|
||||
ParseHelper_FixTruncatedFloatString(mReader->getAttributeValue(pAttrIdx), val);
|
||||
fast_atoreal_move(val.c_str(), tvalf, false);
|
||||
|
@ -342,8 +381,8 @@ int32_t X3DImporter::XML_ReadNode_GetAttrVal_AsI32(const int pAttrIdx)
|
|||
|
||||
void X3DImporter::XML_ReadNode_GetAttrVal_AsCol3f(const int pAttrIdx, aiColor3D& pValue)
|
||||
{
|
||||
std::list<float> tlist;
|
||||
std::list<float>::iterator it;
|
||||
std::list<float> tlist;
|
||||
std::list<float>::iterator it;
|
||||
|
||||
XML_ReadNode_GetAttrVal_AsListF(pAttrIdx, tlist);
|
||||
if(tlist.size() != 3) Throw_ConvertFail_Str2ArrF(mReader->getAttributeValue(pAttrIdx));
|
||||
|
@ -356,8 +395,8 @@ std::list<float>::iterator it;
|
|||
|
||||
void X3DImporter::XML_ReadNode_GetAttrVal_AsVec2f(const int pAttrIdx, aiVector2D& pValue)
|
||||
{
|
||||
std::list<float> tlist;
|
||||
std::list<float>::iterator it;
|
||||
std::list<float> tlist;
|
||||
std::list<float>::iterator it;
|
||||
|
||||
XML_ReadNode_GetAttrVal_AsListF(pAttrIdx, tlist);
|
||||
if(tlist.size() != 2) Throw_ConvertFail_Str2ArrF(mReader->getAttributeValue(pAttrIdx));
|
||||
|
@ -369,8 +408,8 @@ std::list<float>::iterator it;
|
|||
|
||||
void X3DImporter::XML_ReadNode_GetAttrVal_AsVec3f(const int pAttrIdx, aiVector3D& pValue)
|
||||
{
|
||||
std::list<float> tlist;
|
||||
std::list<float>::iterator it;
|
||||
std::list<float> tlist;
|
||||
std::list<float>::iterator it;
|
||||
|
||||
XML_ReadNode_GetAttrVal_AsListF(pAttrIdx, tlist);
|
||||
if(tlist.size() != 3) Throw_ConvertFail_Str2ArrF(mReader->getAttributeValue(pAttrIdx));
|
||||
|
@ -383,15 +422,14 @@ std::list<float>::iterator it;
|
|||
|
||||
void X3DImporter::XML_ReadNode_GetAttrVal_AsListB(const int pAttrIdx, std::list<bool>& pValue)
|
||||
{
|
||||
char* tok_str;
|
||||
size_t tok_str_len;
|
||||
|
||||
// make copy of attribute value - string with list of bool values. Also all bool values is strings.
|
||||
tok_str_len = strlen(mReader->getAttributeValue(pAttrIdx));
|
||||
if(!tok_str_len) Throw_IncorrectAttrValue(mReader->getAttributeName(pAttrIdx));
|
||||
size_t tok_str_len = strlen(mReader->getAttributeValue(pAttrIdx));
|
||||
if ( 0 == tok_str_len ) {
|
||||
Throw_IncorrectAttrValue( mReader->getAttributeName( pAttrIdx ) );
|
||||
}
|
||||
|
||||
tok_str_len++;// take in account terminating '\0'.
|
||||
tok_str = new char[tok_str_len];
|
||||
char *tok_str = new char[tok_str_len];
|
||||
|
||||
strcpy(tok_str, mReader->getAttributeValue(pAttrIdx));
|
||||
// change all spacebars to symbol '\0'. That is needed for parsing.
|
||||
|
@ -425,7 +463,7 @@ size_t tok_str_len;
|
|||
|
||||
void X3DImporter::XML_ReadNode_GetAttrVal_AsArrB(const int pAttrIdx, std::vector<bool>& pValue)
|
||||
{
|
||||
std::list<bool> tlist;
|
||||
std::list<bool> tlist;
|
||||
|
||||
XML_ReadNode_GetAttrVal_AsListB(pAttrIdx, tlist);// read as list
|
||||
// and copy to array
|
||||
|
@ -438,8 +476,8 @@ std::list<bool> tlist;
|
|||
|
||||
void X3DImporter::XML_ReadNode_GetAttrVal_AsListI32(const int pAttrIdx, std::list<int32_t>& pValue)
|
||||
{
|
||||
const char* tstr = mReader->getAttributeValue(pAttrIdx);
|
||||
const char* tstr_end = tstr + strlen(tstr);
|
||||
const char* tstr = mReader->getAttributeValue(pAttrIdx);
|
||||
const char* tstr_end = tstr + strlen(tstr);
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -459,7 +497,7 @@ const char* tstr_end = tstr + strlen(tstr);
|
|||
|
||||
void X3DImporter::XML_ReadNode_GetAttrVal_AsArrI32(const int pAttrIdx, std::vector<int32_t>& pValue)
|
||||
{
|
||||
std::list<int32_t> tlist;
|
||||
std::list<int32_t> tlist;
|
||||
|
||||
XML_ReadNode_GetAttrVal_AsListI32(pAttrIdx, tlist);// read as list
|
||||
// and copy to array
|
||||
|
@ -472,7 +510,7 @@ std::list<int32_t> tlist;
|
|||
|
||||
void X3DImporter::XML_ReadNode_GetAttrVal_AsListF(const int pAttrIdx, std::list<float>& pValue)
|
||||
{
|
||||
std::string str_fixed;
|
||||
std::string str_fixed;
|
||||
|
||||
// at first check string values like '.xxx'.
|
||||
ParseHelper_FixTruncatedFloatString(mReader->getAttributeValue(pAttrIdx), str_fixed);
|
||||
|
@ -498,7 +536,7 @@ std::string str_fixed;
|
|||
|
||||
void X3DImporter::XML_ReadNode_GetAttrVal_AsArrF(const int pAttrIdx, std::vector<float>& pValue)
|
||||
{
|
||||
std::list<float> tlist;
|
||||
std::list<float> tlist;
|
||||
|
||||
XML_ReadNode_GetAttrVal_AsListF(pAttrIdx, tlist);// read as list
|
||||
// and copy to array
|
||||
|
@ -511,7 +549,7 @@ std::list<float> tlist;
|
|||
|
||||
void X3DImporter::XML_ReadNode_GetAttrVal_AsListD(const int pAttrIdx, std::list<double>& pValue)
|
||||
{
|
||||
std::string str_fixed;
|
||||
std::string str_fixed;
|
||||
|
||||
// at first check string values like '.xxx'.
|
||||
ParseHelper_FixTruncatedFloatString(mReader->getAttributeValue(pAttrIdx), str_fixed);
|
||||
|
@ -537,7 +575,7 @@ std::string str_fixed;
|
|||
|
||||
void X3DImporter::XML_ReadNode_GetAttrVal_AsArrD(const int pAttrIdx, std::vector<double>& pValue)
|
||||
{
|
||||
std::list<double> tlist;
|
||||
std::list<double> tlist;
|
||||
|
||||
XML_ReadNode_GetAttrVal_AsListD(pAttrIdx, tlist);// read as list
|
||||
// and copy to array
|
||||
|
@ -550,7 +588,7 @@ std::list<double> tlist;
|
|||
|
||||
void X3DImporter::XML_ReadNode_GetAttrVal_AsListCol3f(const int pAttrIdx, std::list<aiColor3D>& pValue)
|
||||
{
|
||||
std::list<float> tlist;
|
||||
std::list<float> tlist;
|
||||
|
||||
XML_ReadNode_GetAttrVal_AsListF(pAttrIdx, tlist);// read as list
|
||||
if(tlist.size() % 3) Throw_ConvertFail_Str2ArrF(mReader->getAttributeValue(pAttrIdx));
|
||||
|
@ -569,7 +607,7 @@ std::list<float> tlist;
|
|||
|
||||
void X3DImporter::XML_ReadNode_GetAttrVal_AsArrCol3f(const int pAttrIdx, std::vector<aiColor3D>& pValue)
|
||||
{
|
||||
std::list<aiColor3D> tlist;
|
||||
std::list<aiColor3D> tlist;
|
||||
|
||||
XML_ReadNode_GetAttrVal_AsListCol3f(pAttrIdx, tlist);// read as list
|
||||
// and copy to array
|
||||
|
@ -582,7 +620,7 @@ std::list<aiColor3D> tlist;
|
|||
|
||||
void X3DImporter::XML_ReadNode_GetAttrVal_AsListCol4f(const int pAttrIdx, std::list<aiColor4D>& pValue)
|
||||
{
|
||||
std::list<float> tlist;
|
||||
std::list<float> tlist;
|
||||
|
||||
XML_ReadNode_GetAttrVal_AsListF(pAttrIdx, tlist);// read as list
|
||||
if(tlist.size() % 4) Throw_ConvertFail_Str2ArrF(mReader->getAttributeValue(pAttrIdx));
|
||||
|
@ -602,23 +640,29 @@ std::list<float> tlist;
|
|||
|
||||
void X3DImporter::XML_ReadNode_GetAttrVal_AsArrCol4f(const int pAttrIdx, std::vector<aiColor4D>& pValue)
|
||||
{
|
||||
std::list<aiColor4D> tlist;
|
||||
std::list<aiColor4D> tlist;
|
||||
|
||||
XML_ReadNode_GetAttrVal_AsListCol4f(pAttrIdx, tlist);// read as list
|
||||
// and copy to array
|
||||
if(tlist.size() > 0)
|
||||
{
|
||||
pValue.reserve(tlist.size());
|
||||
for(std::list<aiColor4D>::iterator it = tlist.begin(); it != tlist.end(); it++) pValue.push_back(*it);
|
||||
for ( std::list<aiColor4D>::iterator it = tlist.begin(); it != tlist.end(); it++ )
|
||||
{
|
||||
pValue.push_back( *it );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void X3DImporter::XML_ReadNode_GetAttrVal_AsListVec2f(const int pAttrIdx, std::list<aiVector2D>& pValue)
|
||||
{
|
||||
std::list<float> tlist;
|
||||
std::list<float> tlist;
|
||||
|
||||
XML_ReadNode_GetAttrVal_AsListF(pAttrIdx, tlist);// read as list
|
||||
if(tlist.size() % 2) Throw_ConvertFail_Str2ArrF(mReader->getAttributeValue(pAttrIdx));
|
||||
if ( tlist.size() % 2 )
|
||||
{
|
||||
Throw_ConvertFail_Str2ArrF( mReader->getAttributeValue( pAttrIdx ) );
|
||||
}
|
||||
|
||||
// copy data to array
|
||||
for(std::list<float>::iterator it = tlist.begin(); it != tlist.end();)
|
||||
|
@ -633,23 +677,29 @@ std::list<float> tlist;
|
|||
|
||||
void X3DImporter::XML_ReadNode_GetAttrVal_AsArrVec2f(const int pAttrIdx, std::vector<aiVector2D>& pValue)
|
||||
{
|
||||
std::list<aiVector2D> tlist;
|
||||
std::list<aiVector2D> tlist;
|
||||
|
||||
XML_ReadNode_GetAttrVal_AsListVec2f(pAttrIdx, tlist);// read as list
|
||||
// and copy to array
|
||||
if(tlist.size() > 0)
|
||||
{
|
||||
pValue.reserve(tlist.size());
|
||||
for(std::list<aiVector2D>::iterator it = tlist.begin(); it != tlist.end(); it++) pValue.push_back(*it);
|
||||
for ( std::list<aiVector2D>::iterator it = tlist.begin(); it != tlist.end(); it++ )
|
||||
{
|
||||
pValue.push_back( *it );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void X3DImporter::XML_ReadNode_GetAttrVal_AsListVec3f(const int pAttrIdx, std::list<aiVector3D>& pValue)
|
||||
{
|
||||
std::list<float> tlist;
|
||||
std::list<float> tlist;
|
||||
|
||||
XML_ReadNode_GetAttrVal_AsListF(pAttrIdx, tlist);// read as list
|
||||
if(tlist.size() % 3) Throw_ConvertFail_Str2ArrF(mReader->getAttributeValue(pAttrIdx));
|
||||
if ( tlist.size() % 3 )
|
||||
{
|
||||
Throw_ConvertFail_Str2ArrF( mReader->getAttributeValue( pAttrIdx ) );
|
||||
}
|
||||
|
||||
// copy data to array
|
||||
for(std::list<float>::iterator it = tlist.begin(); it != tlist.end();)
|
||||
|
@ -665,30 +715,32 @@ std::list<float> tlist;
|
|||
|
||||
void X3DImporter::XML_ReadNode_GetAttrVal_AsArrVec3f(const int pAttrIdx, std::vector<aiVector3D>& pValue)
|
||||
{
|
||||
std::list<aiVector3D> tlist;
|
||||
std::list<aiVector3D> tlist;
|
||||
|
||||
XML_ReadNode_GetAttrVal_AsListVec3f(pAttrIdx, tlist);// read as list
|
||||
// and copy to array
|
||||
if(tlist.size() > 0)
|
||||
{
|
||||
pValue.reserve(tlist.size());
|
||||
for(std::list<aiVector3D>::iterator it = tlist.begin(); it != tlist.end(); it++) pValue.push_back(*it);
|
||||
for ( std::list<aiVector3D>::iterator it = tlist.begin(); it != tlist.end(); it++ )
|
||||
{
|
||||
pValue.push_back( *it );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void X3DImporter::XML_ReadNode_GetAttrVal_AsListS(const int pAttrIdx, std::list<std::string>& pValue)
|
||||
{
|
||||
char* tok_str;
|
||||
char* tok_str_end;
|
||||
size_t tok_str_len;
|
||||
|
||||
// make copy of attribute value - strings list.
|
||||
tok_str_len = strlen(mReader->getAttributeValue(pAttrIdx));
|
||||
if(!tok_str_len) Throw_IncorrectAttrValue(mReader->getAttributeName(pAttrIdx));
|
||||
const size_t tok_str_len = strlen(mReader->getAttributeValue(pAttrIdx));
|
||||
if ( 0 == tok_str_len )
|
||||
{
|
||||
Throw_IncorrectAttrValue( mReader->getAttributeName( pAttrIdx ) );
|
||||
}
|
||||
|
||||
// get pointer to begin of value.
|
||||
tok_str = const_cast<char*>(mReader->getAttributeValue(pAttrIdx));
|
||||
tok_str_end = tok_str + tok_str_len;
|
||||
char *tok_str = const_cast<char*>(mReader->getAttributeValue(pAttrIdx));
|
||||
char *tok_str_end = tok_str + tok_str_len;
|
||||
// string list has following format: attr_name='"s1" "s2" "sn"'.
|
||||
do
|
||||
{
|
||||
|
@ -729,25 +781,33 @@ aiVector3D X3DImporter::GeometryHelper_Make_Point2D(const float pAngle, const fl
|
|||
void X3DImporter::GeometryHelper_Make_Arc2D(const float pStartAngle, const float pEndAngle, const float pRadius, size_t pNumSegments,
|
||||
std::list<aiVector3D>& pVertices)
|
||||
{
|
||||
float angle_full, angle_step;
|
||||
|
||||
// check argument values ranges.
|
||||
if((pStartAngle < -AI_MATH_TWO_PI_F) || (pStartAngle > AI_MATH_TWO_PI_F)) Throw_ArgOutOfRange("GeometryHelper_Make_Arc2D.pStartAngle");
|
||||
if((pEndAngle < -AI_MATH_TWO_PI_F) || (pEndAngle > AI_MATH_TWO_PI_F)) Throw_ArgOutOfRange("GeometryHelper_Make_Arc2D.pEndAngle");
|
||||
if(pRadius <= 0) Throw_ArgOutOfRange("GeometryHelper_Make_Arc2D.pRadius");
|
||||
if ( ( pStartAngle < -AI_MATH_TWO_PI_F ) || ( pStartAngle > AI_MATH_TWO_PI_F ) )
|
||||
{
|
||||
Throw_ArgOutOfRange( "GeometryHelper_Make_Arc2D.pStartAngle" );
|
||||
}
|
||||
if ( ( pEndAngle < -AI_MATH_TWO_PI_F ) || ( pEndAngle > AI_MATH_TWO_PI_F ) )
|
||||
{
|
||||
Throw_ArgOutOfRange( "GeometryHelper_Make_Arc2D.pEndAngle" );
|
||||
}
|
||||
if ( pRadius <= 0 )
|
||||
{
|
||||
Throw_ArgOutOfRange( "GeometryHelper_Make_Arc2D.pRadius" );
|
||||
}
|
||||
|
||||
// calculate arc angle and check type of arc
|
||||
angle_full = fabs(pEndAngle - pStartAngle);
|
||||
if((angle_full > AI_MATH_TWO_PI_F) || (angle_full == 0.0f)) angle_full = AI_MATH_TWO_PI_F;
|
||||
float angle_full = fabs(pEndAngle - pStartAngle);
|
||||
if ( ( angle_full > AI_MATH_TWO_PI_F ) || ( angle_full == 0.0f ) )
|
||||
{
|
||||
angle_full = AI_MATH_TWO_PI_F;
|
||||
}
|
||||
|
||||
// calculate angle for one step - angle to next point of line.
|
||||
angle_step = angle_full / (float)pNumSegments;
|
||||
float angle_step = angle_full / (float)pNumSegments;
|
||||
// make points
|
||||
for(size_t pi = 0; pi <= pNumSegments; pi++)
|
||||
{
|
||||
float tangle;
|
||||
|
||||
tangle = pStartAngle + pi * angle_step;
|
||||
float tangle = pStartAngle + pi * angle_step;
|
||||
pVertices.push_back(GeometryHelper_Make_Point2D(tangle, pRadius));
|
||||
}// for(size_t pi = 0; pi <= pNumSegments; pi++)
|
||||
|
||||
|
@ -757,12 +817,15 @@ float angle_full, angle_step;
|
|||
|
||||
void X3DImporter::GeometryHelper_Extend_PointToLine(const std::list<aiVector3D>& pPoint, std::list<aiVector3D>& pLine)
|
||||
{
|
||||
std::list<aiVector3D>::const_iterator pit = pPoint.begin();
|
||||
std::list<aiVector3D>::const_iterator pit_last = pPoint.end();
|
||||
std::list<aiVector3D>::const_iterator pit = pPoint.begin();
|
||||
std::list<aiVector3D>::const_iterator pit_last = pPoint.end();
|
||||
|
||||
pit_last--;
|
||||
|
||||
if(pPoint.size() < 2) Throw_ArgOutOfRange("GeometryHelper_Extend_PointToLine.pPoint.size() can not be less than 2.");
|
||||
if ( pPoint.size() < 2 )
|
||||
{
|
||||
Throw_ArgOutOfRange( "GeometryHelper_Extend_PointToLine.pPoint.size() can not be less than 2." );
|
||||
}
|
||||
|
||||
// add first point of first line.
|
||||
pLine.push_back(*pit++);
|
||||
|
@ -779,7 +842,7 @@ std::list<aiVector3D>::const_iterator pit_last = pPoint.end();
|
|||
|
||||
void X3DImporter::GeometryHelper_Extend_PolylineIdxToLineIdx(const std::list<int32_t>& pPolylineCoordIdx, std::list<int32_t>& pLineCoordIdx)
|
||||
{
|
||||
std::list<int32_t>::const_iterator plit = pPolylineCoordIdx.begin();
|
||||
std::list<int32_t>::const_iterator plit = pPolylineCoordIdx.begin();
|
||||
|
||||
while(plit != pPolylineCoordIdx.end())
|
||||
{
|
||||
|
@ -831,16 +894,19 @@ void X3DImporter::GeometryHelper_MakeQL_RectParallelepiped(const aiVector3D& pSi
|
|||
|
||||
void X3DImporter::GeometryHelper_CoordIdxStr2FacesArr(const std::list<int32_t>& pCoordIdx, std::vector<aiFace>& pFaces, unsigned int& pPrimitiveTypes) const
|
||||
{
|
||||
std::list<int32_t> f_data(pCoordIdx);
|
||||
std::vector<unsigned int> inds;
|
||||
unsigned int prim_type = 0;
|
||||
std::list<int32_t> f_data(pCoordIdx);
|
||||
std::vector<unsigned int> inds;
|
||||
unsigned int prim_type = 0;
|
||||
|
||||
if(f_data.back() != (-1)) f_data.push_back(-1);
|
||||
if ( f_data.back() != ( -1 ) )
|
||||
{
|
||||
f_data.push_back( -1 );
|
||||
}
|
||||
|
||||
// reserve average size.
|
||||
pFaces.reserve(f_data.size() / 3);
|
||||
inds.reserve(4);
|
||||
//PrintVectorSet("build. ci", pCoordIdx);
|
||||
//PrintVectorSet("build. ci", pCoordIdx);
|
||||
for(std::list<int32_t>::iterator it = f_data.begin(); it != f_data.end(); it++)
|
||||
{
|
||||
// when face is got count how many indices in it.
|
||||
|
@ -896,7 +962,7 @@ std::list<aiColor4D> tcol;
|
|||
|
||||
void X3DImporter::MeshGeometry_AddColor(aiMesh& pMesh, const std::list<aiColor4D>& pColors, const bool pColorPerVertex) const
|
||||
{
|
||||
std::list<aiColor4D>::const_iterator col_it = pColors.begin();
|
||||
std::list<aiColor4D>::const_iterator col_it = pColors.begin();
|
||||
|
||||
if(pColorPerVertex)
|
||||
{
|
||||
|
@ -933,10 +999,13 @@ std::list<aiColor4D>::const_iterator col_it = pColors.begin();
|
|||
void X3DImporter::MeshGeometry_AddColor(aiMesh& pMesh, const std::list<int32_t>& pCoordIdx, const std::list<int32_t>& pColorIdx,
|
||||
const std::list<aiColor3D>& pColors, const bool pColorPerVertex) const
|
||||
{
|
||||
std::list<aiColor4D> tcol;
|
||||
std::list<aiColor4D> tcol;
|
||||
|
||||
// create RGBA array from RGB.
|
||||
for(std::list<aiColor3D>::const_iterator it = pColors.begin(); it != pColors.end(); it++) tcol.push_back(aiColor4D((*it).r, (*it).g, (*it).b, 1));
|
||||
for ( std::list<aiColor3D>::const_iterator it = pColors.begin(); it != pColors.end(); it++ )
|
||||
{
|
||||
tcol.push_back( aiColor4D( ( *it ).r, ( *it ).g, ( *it ).b, 1 ) );
|
||||
}
|
||||
|
||||
// call existing function for adding RGBA colors
|
||||
MeshGeometry_AddColor(pMesh, pCoordIdx, pColorIdx, tcol, pColorPerVertex);
|
||||
|
@ -945,15 +1014,21 @@ std::list<aiColor4D> tcol;
|
|||
void X3DImporter::MeshGeometry_AddColor(aiMesh& pMesh, const std::list<int32_t>& pCoordIdx, const std::list<int32_t>& pColorIdx,
|
||||
const std::list<aiColor4D>& pColors, const bool pColorPerVertex) const
|
||||
{
|
||||
std::vector<aiColor4D> col_tgt_arr;
|
||||
std::list<aiColor4D> col_tgt_list;
|
||||
std::vector<aiColor4D> col_arr_copy;
|
||||
std::vector<aiColor4D> col_tgt_arr;
|
||||
std::list<aiColor4D> col_tgt_list;
|
||||
std::vector<aiColor4D> col_arr_copy;
|
||||
|
||||
if(pCoordIdx.size() == 0) throw DeadlyImportError("MeshGeometry_AddColor2. pCoordIdx can not be empty.");
|
||||
if ( pCoordIdx.size() == 0 )
|
||||
{
|
||||
throw DeadlyImportError( "MeshGeometry_AddColor2. pCoordIdx can not be empty." );
|
||||
}
|
||||
|
||||
// copy list to array because we are need indexed access to colors.
|
||||
col_arr_copy.reserve(pColors.size());
|
||||
for(std::list<aiColor4D>::const_iterator it = pColors.begin(); it != pColors.end(); it++) col_arr_copy.push_back(*it);
|
||||
for ( std::list<aiColor4D>::const_iterator it = pColors.begin(); it != pColors.end(); it++ )
|
||||
{
|
||||
col_arr_copy.push_back( *it );
|
||||
}
|
||||
|
||||
if(pColorPerVertex)
|
||||
{
|
||||
|
@ -1036,12 +1111,15 @@ std::vector<aiColor4D> col_arr_copy;
|
|||
void X3DImporter::MeshGeometry_AddNormal(aiMesh& pMesh, const std::list<int32_t>& pCoordIdx, const std::list<int32_t>& pNormalIdx,
|
||||
const std::list<aiVector3D>& pNormals, const bool pNormalPerVertex) const
|
||||
{
|
||||
std::vector<size_t> tind;
|
||||
std::vector<aiVector3D> norm_arr_copy;
|
||||
std::vector<size_t> tind;
|
||||
std::vector<aiVector3D> norm_arr_copy;
|
||||
|
||||
// copy list to array because we are need indexed access to normals.
|
||||
norm_arr_copy.reserve(pNormals.size());
|
||||
for(std::list<aiVector3D>::const_iterator it = pNormals.begin(); it != pNormals.end(); it++) norm_arr_copy.push_back(*it);
|
||||
for ( std::list<aiVector3D>::const_iterator it = pNormals.begin(); it != pNormals.end(); it++ )
|
||||
{
|
||||
norm_arr_copy.push_back( *it );
|
||||
}
|
||||
|
||||
if(pNormalPerVertex)
|
||||
{
|
||||
|
@ -1109,7 +1187,7 @@ std::vector<aiVector3D> norm_arr_copy;
|
|||
|
||||
void X3DImporter::MeshGeometry_AddNormal(aiMesh& pMesh, const std::list<aiVector3D>& pNormals, const bool pNormalPerVertex) const
|
||||
{
|
||||
std::list<aiVector3D>::const_iterator norm_it = pNormals.begin();
|
||||
std::list<aiVector3D>::const_iterator norm_it = pNormals.begin();
|
||||
|
||||
if(pNormalPerVertex)
|
||||
{
|
||||
|
@ -1138,9 +1216,9 @@ std::list<aiVector3D>::const_iterator norm_it = pNormals.begin();
|
|||
void X3DImporter::MeshGeometry_AddTexCoord(aiMesh& pMesh, const std::list<int32_t>& pCoordIdx, const std::list<int32_t>& pTexCoordIdx,
|
||||
const std::list<aiVector2D>& pTexCoords) const
|
||||
{
|
||||
std::vector<aiVector3D> texcoord_arr_copy;
|
||||
std::vector<aiFace> faces;
|
||||
unsigned int prim_type;
|
||||
std::vector<aiVector3D> texcoord_arr_copy;
|
||||
std::vector<aiFace> faces;
|
||||
unsigned int prim_type;
|
||||
|
||||
// copy list to array because we are need indexed access to normals.
|
||||
texcoord_arr_copy.reserve(pTexCoords.size());
|
||||
|
@ -1152,8 +1230,14 @@ unsigned int prim_type;
|
|||
if(pTexCoordIdx.size() > 0)
|
||||
{
|
||||
GeometryHelper_CoordIdxStr2FacesArr(pTexCoordIdx, faces, prim_type);
|
||||
if(!faces.size()) throw DeadlyImportError("Failed to add texture coordinates to mesh, faces list is empty.");
|
||||
if(faces.size() != pMesh.mNumFaces) throw DeadlyImportError("Texture coordinates faces count must be equal to mesh faces count.");
|
||||
if ( faces.empty() )
|
||||
{
|
||||
throw DeadlyImportError( "Failed to add texture coordinates to mesh, faces list is empty." );
|
||||
}
|
||||
if ( faces.size() != pMesh.mNumFaces )
|
||||
{
|
||||
throw DeadlyImportError( "Texture coordinates faces count must be equal to mesh faces count." );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1179,30 +1263,42 @@ unsigned int prim_type;
|
|||
|
||||
void X3DImporter::MeshGeometry_AddTexCoord(aiMesh& pMesh, const std::list<aiVector2D>& pTexCoords) const
|
||||
{
|
||||
std::vector<aiVector3D> tc_arr_copy;
|
||||
std::vector<aiVector3D> tc_arr_copy;
|
||||
|
||||
if(pTexCoords.size() != pMesh.mNumVertices) throw DeadlyImportError("MeshGeometry_AddTexCoord. Texture coordinates and vertices count must be equal.");
|
||||
if ( pTexCoords.size() != pMesh.mNumVertices )
|
||||
{
|
||||
throw DeadlyImportError( "MeshGeometry_AddTexCoord. Texture coordinates and vertices count must be equal." );
|
||||
}
|
||||
|
||||
// copy list to array because we are need convert aiVector2D to aiVector3D and also get indexed access as a bonus.
|
||||
tc_arr_copy.reserve(pTexCoords.size());
|
||||
for(std::list<aiVector2D>::const_iterator it = pTexCoords.begin(); it != pTexCoords.end(); it++) tc_arr_copy.push_back(aiVector3D((*it).x, (*it).y, 0));
|
||||
for ( std::list<aiVector2D>::const_iterator it = pTexCoords.begin(); it != pTexCoords.end(); it++ )
|
||||
{
|
||||
tc_arr_copy.push_back( aiVector3D( ( *it ).x, ( *it ).y, 0 ) );
|
||||
}
|
||||
|
||||
// copy texture coordinates to mesh
|
||||
pMesh.mTextureCoords[0] = new aiVector3D[pMesh.mNumVertices];
|
||||
pMesh.mNumUVComponents[0] = 2;
|
||||
for(size_t i = 0; i < pMesh.mNumVertices; i++) pMesh.mTextureCoords[0][i] = tc_arr_copy[i];
|
||||
for ( size_t i = 0; i < pMesh.mNumVertices; i++ )
|
||||
{
|
||||
pMesh.mTextureCoords[ 0 ][ i ] = tc_arr_copy[ i ];
|
||||
}
|
||||
}
|
||||
|
||||
aiMesh* X3DImporter::GeometryHelper_MakeMesh(const std::list<int32_t>& pCoordIdx, const std::list<aiVector3D>& pVertices) const
|
||||
{
|
||||
aiMesh* tmesh;
|
||||
std::vector<aiFace> faces;
|
||||
unsigned int prim_type = 0;
|
||||
size_t ts;
|
||||
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);
|
||||
if(!faces.size()) throw DeadlyImportError("Failed to create mesh, faces list is empty.");
|
||||
if ( !faces.size() )
|
||||
{
|
||||
throw DeadlyImportError( "Failed to create mesh, faces list is empty." );
|
||||
}
|
||||
|
||||
//
|
||||
// Create new mesh and copy geometry data.
|
||||
|
@ -1220,7 +1316,10 @@ size_t ts;
|
|||
ts = pVertices.size();
|
||||
tmesh->mVertices = new aiVector3D[ts];
|
||||
tmesh->mNumVertices = ts;
|
||||
for(size_t i = 0; i < ts; i++) tmesh->mVertices[i] = *vit++;
|
||||
for ( size_t i = 0; i < ts; i++ )
|
||||
{
|
||||
tmesh->mVertices[ i ] = *vit++;
|
||||
}
|
||||
|
||||
// set primitives type and return result.
|
||||
tmesh->mPrimitiveTypes = prim_type;
|
||||
|
@ -1234,10 +1333,13 @@ size_t ts;
|
|||
|
||||
void X3DImporter::ParseHelper_Group_Begin(const bool pStatic)
|
||||
{
|
||||
CX3DImporter_NodeElement_Group* new_group = new CX3DImporter_NodeElement_Group(NodeElement_Cur, pStatic);// create new node with current node as parent.
|
||||
CX3DImporter_NodeElement_Group* new_group = new CX3DImporter_NodeElement_Group(NodeElement_Cur, pStatic);// create new node with current node as parent.
|
||||
|
||||
// if we are adding not the root element then add new element to current element child list.
|
||||
if(NodeElement_Cur != nullptr) NodeElement_Cur->Child.push_back(new_group);
|
||||
if ( NodeElement_Cur != nullptr )
|
||||
{
|
||||
NodeElement_Cur->Child.push_back( new_group );
|
||||
}
|
||||
|
||||
NodeElement_List.push_back(new_group);// it's a new element - add it to list.
|
||||
NodeElement_Cur = new_group;// switch current element to new one.
|
||||
|
@ -1252,20 +1354,27 @@ void X3DImporter::ParseHelper_Node_Enter(CX3DImporter_NodeElement* pNode)
|
|||
void X3DImporter::ParseHelper_Node_Exit()
|
||||
{
|
||||
// check if we can walk up.
|
||||
if(NodeElement_Cur != nullptr) NodeElement_Cur = NodeElement_Cur->Parent;
|
||||
if ( NodeElement_Cur != nullptr )
|
||||
{
|
||||
NodeElement_Cur = NodeElement_Cur->Parent;
|
||||
}
|
||||
}
|
||||
|
||||
void X3DImporter::ParseHelper_FixTruncatedFloatString(const char* pInStr, std::string& pOutString)
|
||||
{
|
||||
size_t instr_len;
|
||||
|
||||
pOutString.clear();
|
||||
instr_len = strlen(pInStr);
|
||||
if(!instr_len) return;
|
||||
const size_t instr_len = strlen(pInStr);
|
||||
if ( 0 == instr_len )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pOutString.reserve(instr_len * 3 / 2);
|
||||
// check and correct floats in format ".x". Must be "x.y".
|
||||
if(pInStr[0] == '.') pOutString.push_back('0');
|
||||
if ( pInStr[ 0 ] == '.' )
|
||||
{
|
||||
pOutString.push_back( '0' );
|
||||
}
|
||||
|
||||
pOutString.push_back(pInStr[0]);
|
||||
for(size_t ci = 1; ci < instr_len; ci++)
|
||||
|
@ -1284,15 +1393,21 @@ size_t instr_len;
|
|||
|
||||
void X3DImporter::ParseFile(const std::string& pFile, IOSystem* pIOHandler)
|
||||
{
|
||||
irr::io::IrrXMLReader* OldReader = mReader;// store current XMLreader.
|
||||
std::unique_ptr<IOStream> file(pIOHandler->Open(pFile, "rb"));
|
||||
irr::io::IrrXMLReader* OldReader = mReader;// store current XMLreader.
|
||||
std::unique_ptr<IOStream> file(pIOHandler->Open(pFile, "rb"));
|
||||
|
||||
// Check whether we can read from the file
|
||||
if(file.get() == nullptr) throw DeadlyImportError("Failed to open X3D file " + pFile + ".");
|
||||
if ( file.get() == nullptr )
|
||||
{
|
||||
throw DeadlyImportError( "Failed to open X3D file " + pFile + "." );
|
||||
}
|
||||
// generate a XML reader for it
|
||||
std::unique_ptr<CIrrXML_IOStreamReader> mIOWrapper(new CIrrXML_IOStreamReader(file.get()));
|
||||
mReader = irr::io::createIrrXMLReader(mIOWrapper.get());
|
||||
if(!mReader) throw DeadlyImportError("Failed to create XML reader for file" + pFile + ".");
|
||||
if ( !mReader )
|
||||
{
|
||||
throw DeadlyImportError( "Failed to create XML reader for file" + pFile + "." );
|
||||
}
|
||||
// start reading
|
||||
ParseNode_Root();
|
||||
|
||||
|
@ -1304,13 +1419,19 @@ std::unique_ptr<IOStream> file(pIOHandler->Open(pFile, "rb"));
|
|||
void X3DImporter::ParseNode_Root()
|
||||
{
|
||||
// search for root tag <X3D>
|
||||
if(!XML_SearchNode("X3D")) throw DeadlyImportError("Root node \"X3D\" not found.");
|
||||
if ( !XML_SearchNode( "X3D" ) )
|
||||
{
|
||||
throw DeadlyImportError( "Root node \"X3D\" not found." );
|
||||
}
|
||||
|
||||
ParseHelper_Group_Begin();// create root node element.
|
||||
// parse other contents
|
||||
while(mReader->read())
|
||||
{
|
||||
if(mReader->getNodeType() != irr::io::EXN_ELEMENT) continue;
|
||||
if ( mReader->getNodeType() != irr::io::EXN_ELEMENT )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(XML_CheckNode_NameEqual("head"))
|
||||
ParseNode_Head();
|
||||
|
@ -1326,7 +1447,7 @@ void X3DImporter::ParseNode_Root()
|
|||
|
||||
void X3DImporter::ParseNode_Head()
|
||||
{
|
||||
bool close_found = false;// flag: true if close tag of node are found.
|
||||
bool close_found = false;// flag: true if close tag of node are found.
|
||||
|
||||
while(mReader->read())
|
||||
{
|
||||
|
@ -1367,10 +1488,10 @@ bool close_found = false;// flag: true if close tag of node are found.
|
|||
|
||||
void X3DImporter::ParseNode_Scene()
|
||||
{
|
||||
auto GroupCounter_Increase = [](size_t& pCounter, const char* pGroupName) -> void
|
||||
{
|
||||
pCounter++;
|
||||
if(pCounter == 0) throw DeadlyImportError("Group counter overflow. Too much groups with type: " + std::string(pGroupName) + ".");
|
||||
auto GroupCounter_Increase = [](size_t& pCounter, const char* pGroupName) -> void
|
||||
{
|
||||
pCounter++;
|
||||
if(pCounter == 0) throw DeadlyImportError("Group counter overflow. Too much groups with type: " + std::string(pGroupName) + ".");
|
||||
};
|
||||
|
||||
auto GroupCounter_Decrease = [&](size_t& pCounter, const char* pGroupName) -> void
|
||||
|
@ -1495,7 +1616,7 @@ size_t counter_switch = 0;
|
|||
|
||||
bool X3DImporter::CanRead(const std::string& pFile, IOSystem* pIOHandler, bool pCheckSig) const
|
||||
{
|
||||
const std::string extension = GetExtension(pFile);
|
||||
const std::string extension = GetExtension(pFile);
|
||||
|
||||
if(extension == "x3d") return true;
|
||||
|
||||
|
|
|
@ -1,3 +1,42 @@
|
|||
/*
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, 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.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
/// \file X3DImporter.hpp
|
||||
/// \brief X3D-format files importer for Assimp.
|
||||
/// \date 2015-2016
|
||||
|
@ -10,10 +49,10 @@
|
|||
#include "X3DImporter_Node.hpp"
|
||||
|
||||
// Header files, Assimp.
|
||||
#include "assimp/DefaultLogger.hpp"
|
||||
#include "assimp/importerdesc.h"
|
||||
#include "assimp/ProgressHandler.hpp"
|
||||
#include "assimp/types.h"
|
||||
#include <assimp/DefaultLogger.hpp>
|
||||
#include <assimp/importerdesc.h>
|
||||
#include <assimp/ProgressHandler.hpp>
|
||||
#include <assimp/types.h>
|
||||
#include "BaseImporter.h"
|
||||
#include "irrXMLWrapper.h"
|
||||
|
||||
|
@ -151,47 +190,49 @@ namespace Assimp
|
|||
///
|
||||
class X3DImporter : public BaseImporter
|
||||
{
|
||||
/***********************************************/
|
||||
/******************** Types ********************/
|
||||
/***********************************************/
|
||||
|
||||
/***********************************************/
|
||||
/****************** Constants ******************/
|
||||
/***********************************************/
|
||||
|
||||
private:
|
||||
|
||||
static const aiImporterDesc Description;
|
||||
|
||||
/***********************************************/
|
||||
/****************** Variables ******************/
|
||||
/***********************************************/
|
||||
|
||||
private:
|
||||
|
||||
CX3DImporter_NodeElement* NodeElement_Cur;///< Current element.
|
||||
irr::io::IrrXMLReader* mReader;///< Pointer to XML-reader object
|
||||
std::string mFileDir;
|
||||
|
||||
public:
|
||||
|
||||
std::list<CX3DImporter_NodeElement*> NodeElement_List;///< All elements of scene graph.
|
||||
|
||||
/***********************************************/
|
||||
/****************** Functions ******************/
|
||||
/***********************************************/
|
||||
public:
|
||||
/***********************************************/
|
||||
/****************** Functions ******************/
|
||||
/***********************************************/
|
||||
|
||||
/// Default constructor.
|
||||
X3DImporter()
|
||||
: NodeElement_Cur( nullptr ), mReader( nullptr )
|
||||
{}
|
||||
|
||||
/// Default destructor.
|
||||
~X3DImporter();
|
||||
|
||||
/***********************************************/
|
||||
/******** Functions: parse set, public *********/
|
||||
/***********************************************/
|
||||
|
||||
/// Parse X3D file and fill scene graph. The function has no return value. Result can be found by analyzing the generated graph.
|
||||
/// Also exception can be throwed if trouble will found.
|
||||
/// \param [in] pFile - name of file to be parsed.
|
||||
/// \param [in] pIOHandler - pointer to IO helper object.
|
||||
void ParseFile( const std::string& pFile, IOSystem* pIOHandler );
|
||||
|
||||
/***********************************************/
|
||||
/********* Functions: BaseImporter set *********/
|
||||
/***********************************************/
|
||||
|
||||
bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool pCheckSig ) const;
|
||||
void GetExtensionList( std::set<std::string>& pExtensionList );
|
||||
void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler );
|
||||
const aiImporterDesc* GetInfo()const;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/// \fn X3DImporter(const X3DImporter& pScene)
|
||||
/// Disabled copy constructor.
|
||||
X3DImporter(const X3DImporter& pScene);
|
||||
|
||||
/// \fn X3DImporter& operator=(const X3DImporter& pScene)
|
||||
/// Disabled assign operator.
|
||||
X3DImporter& operator=(const X3DImporter& pScene);
|
||||
|
||||
/// \fn void Clear()
|
||||
/// Clear all temporary data.
|
||||
void Clear();
|
||||
|
||||
|
@ -199,7 +240,6 @@ private:
|
|||
/************* Functions: find set *************/
|
||||
/***********************************************/
|
||||
|
||||
/// \fn bool FindNodeElement_FromRoot(const std::string& pID, const CX3DImporter_NodeElement::EType pType, CX3DImporter_NodeElement** pElement)
|
||||
/// Find requested node element. Search will be made in all existing nodes.
|
||||
/// \param [in] pID - ID of requested element.
|
||||
/// \param [in] pType - type of requested element.
|
||||
|
@ -207,7 +247,6 @@ private:
|
|||
/// \return true - if the element is found, else - false.
|
||||
bool FindNodeElement_FromRoot(const std::string& pID, const CX3DImporter_NodeElement::EType pType, CX3DImporter_NodeElement** pElement);
|
||||
|
||||
/// \fn bool FindNodeElement_FromNode(CX3DImporter_NodeElement* pStartNode, const std::string& pID, const CX3DImporter_NodeElement::EType pType, CX3DImporter_NodeElement** pElement)
|
||||
/// Find requested node element. Search will be made from pointed node down to childs.
|
||||
/// \param [in] pStartNode - pointer to start node.
|
||||
/// \param [in] pID - ID of requested element.
|
||||
|
@ -217,7 +256,6 @@ private:
|
|||
bool FindNodeElement_FromNode(CX3DImporter_NodeElement* pStartNode, const std::string& pID, const CX3DImporter_NodeElement::EType pType,
|
||||
CX3DImporter_NodeElement** pElement);
|
||||
|
||||
/// \fn bool FindNodeElement(const std::string& pName, const CX3DImporter_NodeElement::EType pType, CX3DImporter_NodeElement** pElement)
|
||||
/// Find requested node element. For "Node"'s accounting flag "Static".
|
||||
/// \param [in] pName - name of requested element.
|
||||
/// \param [in] pType - type of requested element.
|
||||
|
@ -229,49 +267,41 @@ private:
|
|||
/********* Functions: postprocess set **********/
|
||||
/***********************************************/
|
||||
|
||||
/// \fn aiMatrix4x4 PostprocessHelper_Matrix_GlobalToCurrent() const
|
||||
/// \return transformation matrix from global coordinate system to local.
|
||||
aiMatrix4x4 PostprocessHelper_Matrix_GlobalToCurrent() const;
|
||||
|
||||
/// \fn void PostprocessHelper_CollectMetadata(const CX3DImporter_NodeElement& pNodeElement, std::list<CX3DImporter_NodeElement*>& pList) const
|
||||
/// Check if child elements of node element is metadata and add it to temporary list.
|
||||
/// \param [in] pNodeElement - node element where metadata is searching.
|
||||
/// \param [out] pList - temporary list for collected metadata.
|
||||
void PostprocessHelper_CollectMetadata(const CX3DImporter_NodeElement& pNodeElement, std::list<CX3DImporter_NodeElement*>& pList) const;
|
||||
|
||||
/// \fn bool bool PostprocessHelper_ElementIsMetadata(const CX3DImporter_NodeElement::EType pType) const
|
||||
/// Check if type of node element is metadata. E.g. <MetadataSet>, <MetadataString>.
|
||||
/// \param [in] pType - checked type.
|
||||
/// \return true - if the type corresponds to the metadata.
|
||||
bool PostprocessHelper_ElementIsMetadata(const CX3DImporter_NodeElement::EType pType) const;
|
||||
|
||||
/// \fn bool PostprocessHelper_ElementIsMesh(const CX3DImporter_NodeElement::EType pType) const
|
||||
/// Check if type of node element is geometry object and can be used to build mesh. E.g. <Box>, <Arc2D>.
|
||||
/// \param [in] pType - checked type.
|
||||
/// \return true - if the type corresponds to the mesh.
|
||||
bool PostprocessHelper_ElementIsMesh(const CX3DImporter_NodeElement::EType pType) const;
|
||||
|
||||
/// \fn void Postprocess_BuildLight(const CX3DImporter_NodeElement& pNodeElement, std::list<aiLight*>& pSceneLightList) const
|
||||
/// Read CX3DImporter_NodeElement_Light, create aiLight and add it to list of the lights.
|
||||
/// \param [in] pNodeElement - reference to lisght element(<DirectionalLight>, <PointLight>, <SpotLight>).
|
||||
/// \param [out] pSceneLightList - reference to list of the lights.
|
||||
void Postprocess_BuildLight(const CX3DImporter_NodeElement& pNodeElement, std::list<aiLight*>& pSceneLightList) const;
|
||||
|
||||
/// \fn void Postprocess_BuildMaterial(const CX3DImporter_NodeElement& pNodeElement, aiMaterial** pMaterial) const
|
||||
/// Create filled structure with type \ref aiMaterial from \ref CX3DImporter_NodeElement. This function itseld extract
|
||||
/// all needed data from scene graph.
|
||||
/// \param [in] pNodeElement - reference to material element(<Appearance>).
|
||||
/// \param [out] pMaterial - pointer to pointer to created material. *pMaterial must be nullptr.
|
||||
void Postprocess_BuildMaterial(const CX3DImporter_NodeElement& pNodeElement, aiMaterial** pMaterial) const;
|
||||
|
||||
/// \fn void Postprocess_BuildMesh(const CX3DImporter_NodeElement& pNodeElement, aiMesh** pMesh) const
|
||||
/// Create filled structure with type \ref aiMaterial from \ref CX3DImporter_NodeElement. This function itseld extract
|
||||
/// all needed data from scene graph.
|
||||
/// \param [in] pNodeElement - reference to geometry object.
|
||||
/// \param [out] pMesh - pointer to pointer to created mesh. *pMesh must be nullptr.
|
||||
void Postprocess_BuildMesh(const CX3DImporter_NodeElement& pNodeElement, aiMesh** pMesh) const;
|
||||
|
||||
/// \fn void Postprocess_BuildNode(const CX3DImporter_NodeElement& pNodeElement, aiNode& pSceneNode, std::list<aiMesh*>& pSceneMeshList, std::list<aiMaterial*>& pSceneMaterialList, std::list<aiLight*>& pSceneLightList) const
|
||||
/// Create aiNode from CX3DImporter_NodeElement. Also function check children and make recursive call.
|
||||
/// \param [out] pNode - pointer to pointer to created node. *pNode must be nullptr.
|
||||
/// \param [in] pNodeElement - CX3DImporter_NodeElement which read.
|
||||
|
@ -282,7 +312,6 @@ private:
|
|||
void Postprocess_BuildNode(const CX3DImporter_NodeElement& pNodeElement, aiNode& pSceneNode, std::list<aiMesh*>& pSceneMeshList,
|
||||
std::list<aiMaterial*>& pSceneMaterialList, std::list<aiLight*>& pSceneLightList) const;
|
||||
|
||||
/// \fn void Postprocess_BuildShape(const CX3DImporter_NodeElement_Shape& pShapeNodeElement, std::list<unsigned int>& pNodeMeshInd, std::list<aiMesh*>& pSceneMeshList, std::list<aiMaterial*>& pSceneMaterialList) const
|
||||
/// To create mesh and material kept in <Schape>.
|
||||
/// \param pShapeNodeElement - reference to node element which kept <Shape> data.
|
||||
/// \param pNodeMeshInd - reference to list with mesh indices. When pShapeNodeElement will read new mesh index will be added to this list.
|
||||
|
@ -291,7 +320,6 @@ private:
|
|||
void Postprocess_BuildShape(const CX3DImporter_NodeElement_Shape& pShapeNodeElement, std::list<unsigned int>& pNodeMeshInd,
|
||||
std::list<aiMesh*>& pSceneMeshList, std::list<aiMaterial*>& pSceneMaterialList) const;
|
||||
|
||||
/// \fn void Postprocess_CollectMetadata(aiNode& pSceneNode, const CX3DImporter_NodeElement& pNodeElement) const
|
||||
/// Check if child elements of node element is metadata and add it to scene node.
|
||||
/// \param [in] pNodeElement - node element where metadata is searching.
|
||||
/// \param [out] pSceneNode - scene node in which metadata will be added.
|
||||
|
@ -301,13 +329,11 @@ private:
|
|||
/************* Functions: throw set ************/
|
||||
/***********************************************/
|
||||
|
||||
/// \fn void Throw_ArgOutOfRange(const std::string& pArgument)
|
||||
/// Call that function when argument is out of range and exception must be raised.
|
||||
/// \throw DeadlyImportError.
|
||||
/// \param [in] pArgument - argument name.
|
||||
void Throw_ArgOutOfRange(const std::string& pArgument);
|
||||
|
||||
/// \fn void Throw_CloseNotFound(const std::string& pNode)
|
||||
/// Call that function when close tag of node not found and exception must be raised.
|
||||
/// E.g.:
|
||||
/// <Scene>
|
||||
|
@ -317,31 +343,26 @@ private:
|
|||
/// \param [in] pNode - node name in which exception happened.
|
||||
void Throw_CloseNotFound(const std::string& pNode);
|
||||
|
||||
/// \fn void Throw_ConvertFail_Str2ArrF(const std::string& pAttrValue)
|
||||
/// Call that function when string value can not be converted to floating point value and exception must be raised.
|
||||
/// \param [in] pAttrValue - attribute value.
|
||||
/// \throw DeadlyImportError.
|
||||
void Throw_ConvertFail_Str2ArrF(const std::string& pAttrValue);
|
||||
|
||||
/// \fn void Throw_DEF_And_USE()
|
||||
/// Call that function when in node defined attributes "DEF" and "USE" and exception must be raised.
|
||||
/// E.g.: <Box DEF="BigBox" USE="MegaBox">
|
||||
/// \throw DeadlyImportError.
|
||||
void Throw_DEF_And_USE();
|
||||
|
||||
/// \fn void Throw_IncorrectAttr(const std::string& pAttrName)
|
||||
/// Call that function when attribute name is incorrect and exception must be raised.
|
||||
/// \param [in] pAttrName - attribute name.
|
||||
/// \throw DeadlyImportError.
|
||||
void Throw_IncorrectAttr(const std::string& pAttrName);
|
||||
|
||||
/// \fn void Throw_IncorrectAttrValue(const std::string& pAttrName)
|
||||
/// Call that function when attribute value is incorrect and exception must be raised.
|
||||
/// \param [in] pAttrName - attribute name.
|
||||
/// \throw DeadlyImportError.
|
||||
void Throw_IncorrectAttrValue(const std::string& pAttrName);
|
||||
|
||||
/// \fn void Throw_MoreThanOnceDefined(const std::string& pNode, const std::string& pDescription)
|
||||
/// Call that function when some type of nodes are defined twice or more when must be used only once and exception must be raised.
|
||||
/// E.g.:
|
||||
/// <Shape>
|
||||
|
@ -353,7 +374,6 @@ private:
|
|||
/// \param [in] pDescription - message about error. E.g. what the node defined while exception raised.
|
||||
void Throw_MoreThanOnceDefined(const std::string& pNodeType, const std::string& pDescription);
|
||||
|
||||
/// \fn void Throw_TagCountIncorrect(const std::string& pNode)
|
||||
/// Call that function when count of opening and closing tags which create group(e.g. <Group>) are not equal and exception must be raised.
|
||||
/// E.g.:
|
||||
/// <Scene>
|
||||
|
@ -365,7 +385,6 @@ private:
|
|||
/// \param [in] pNode - node name in which exception happened.
|
||||
void Throw_TagCountIncorrect(const std::string& pNode);
|
||||
|
||||
/// \fn void Throw_USE_NotFound(const std::string& pAttrValue)
|
||||
/// Call that function when defined in "USE" element are not found in graph and exception must be raised.
|
||||
/// \param [in] pAttrValue - "USE" attribute value.
|
||||
/// \throw DeadlyImportError.
|
||||
|
@ -375,7 +394,6 @@ private:
|
|||
/************** Functions: LOG set *************/
|
||||
/***********************************************/
|
||||
|
||||
/// \fn void LogInfo(const std::string& pMessage)
|
||||
/// Short variant for calling \ref DefaultLogger::get()->info()
|
||||
void LogInfo(const std::string& pMessage) { DefaultLogger::get()->info(pMessage); }
|
||||
|
||||
|
@ -383,144 +401,117 @@ private:
|
|||
/************** Functions: XML set *************/
|
||||
/***********************************************/
|
||||
|
||||
/// \fn void XML_CheckNode_MustBeEmpty()
|
||||
/// Chek if current node is empty: <node />. If not then exception will throwed.
|
||||
void XML_CheckNode_MustBeEmpty();
|
||||
|
||||
/// \fn bool XML_CheckNode_NameEqual(const std::string& pNodeName)
|
||||
/// Chek if current node name is equal to pNodeName.
|
||||
/// \param [in] pNodeName - name for checking.
|
||||
/// return true if current node name is equal to pNodeName, else - false.
|
||||
bool XML_CheckNode_NameEqual(const std::string& pNodeName) { return mReader->getNodeName() == pNodeName; }
|
||||
|
||||
/// \fn void XML_CheckNode_SkipUnsupported(const std::string& pParentNodeName)
|
||||
/// Skip unsupported node and report about that. Depend on node name can be skipped begin tag of node all whole node.
|
||||
/// \param [in] pParentNodeName - parent node name. Used for reporting.
|
||||
void XML_CheckNode_SkipUnsupported(const std::string& pParentNodeName);
|
||||
|
||||
/// \fn bool XML_SearchNode(const std::string& pNodeName)
|
||||
/// Search for specified node in file. XML file read pointer(mReader) will point to found node or file end after search is end.
|
||||
/// \param [in] pNodeName - requested node name.
|
||||
/// return true - if node is found, else - false.
|
||||
bool XML_SearchNode(const std::string& pNodeName);
|
||||
|
||||
/// \fn bool XML_ReadNode_GetAttrVal_AsBool(const int pAttrIdx)
|
||||
/// Read attribute value.
|
||||
/// \param [in] pAttrIdx - attribute index (\ref mReader->getAttribute* set).
|
||||
/// \return read data.
|
||||
bool XML_ReadNode_GetAttrVal_AsBool(const int pAttrIdx);
|
||||
|
||||
/// \fn float XML_ReadNode_GetAttrVal_AsFloat(const int pAttrIdx)
|
||||
/// Read attribute value.
|
||||
/// \param [in] pAttrIdx - attribute index (\ref mReader->getAttribute* set).
|
||||
/// \return read data.
|
||||
float XML_ReadNode_GetAttrVal_AsFloat(const int pAttrIdx);
|
||||
|
||||
/// \fn int32_t XML_ReadNode_GetAttrVal_AsI32(const int pAttrIdx)
|
||||
/// Read attribute value.
|
||||
/// \param [in] pAttrIdx - attribute index (\ref mReader->getAttribute* set).
|
||||
/// \return read data.
|
||||
int32_t XML_ReadNode_GetAttrVal_AsI32(const int pAttrIdx);
|
||||
|
||||
/// \fn void XML_ReadNode_GetAttrVal_AsCol3f(const int pAttrIdx, aiColor3D& pValue)
|
||||
/// Read attribute value.
|
||||
/// \param [in] pAttrIdx - attribute index (\ref mReader->getAttribute* set).
|
||||
/// \param [out] pValue - read data.
|
||||
void XML_ReadNode_GetAttrVal_AsCol3f(const int pAttrIdx, aiColor3D& pValue);
|
||||
|
||||
/// \fn void XML_ReadNode_GetAttrVal_AsVec2f(const int pAttrIdx, aiVector2D& pValue)
|
||||
/// Read attribute value.
|
||||
/// \param [in] pAttrIdx - attribute index (\ref mReader->getAttribute* set).
|
||||
/// \param [out] pValue - read data.
|
||||
void XML_ReadNode_GetAttrVal_AsVec2f(const int pAttrIdx, aiVector2D& pValue);
|
||||
|
||||
/// \fn void XML_ReadNode_GetAttrVal_AsVec3f(const int pAttrIdx, aiVector3D& pValue)
|
||||
/// Read attribute value.
|
||||
/// \param [in] pAttrIdx - attribute index (\ref mReader->getAttribute* set).
|
||||
/// \param [out] pValue - read data.
|
||||
void XML_ReadNode_GetAttrVal_AsVec3f(const int pAttrIdx, aiVector3D& pValue);
|
||||
|
||||
/// \fn void XML_ReadNode_GetAttrVal_AsListB(const int pAttrIdx, std::list<bool>& pValue)
|
||||
/// Read attribute value.
|
||||
/// \param [in] pAttrIdx - attribute index (\ref mReader->getAttribute* set).
|
||||
/// \param [out] pValue - read data.
|
||||
void XML_ReadNode_GetAttrVal_AsListB(const int pAttrIdx, std::list<bool>& pValue);
|
||||
|
||||
/// \fn void XML_ReadNode_GetAttrVal_AsArrB(const int pAttrIdx, std::vector<bool>& pValue)
|
||||
/// \overload void XML_ReadNode_GetAttrVal_AsListBool(const int pAttrIdx, std::list<bool>& pValue)
|
||||
void XML_ReadNode_GetAttrVal_AsArrB(const int pAttrIdx, std::vector<bool>& pValue);
|
||||
|
||||
/// \fn void XML_ReadNode_GetAttrVal_AsListI32(const int pAttrIdx, std::list<int32_t>& pValue)
|
||||
/// Read attribute value.
|
||||
/// \param [in] pAttrIdx - attribute index (\ref mReader->getAttribute* set).
|
||||
/// \param [out] pValue - read data.
|
||||
void XML_ReadNode_GetAttrVal_AsListI32(const int pAttrIdx, std::list<int32_t>& pValue);
|
||||
|
||||
/// \fn void XML_ReadNode_GetAttrVal_AsArrI32(const int pAttrIdx, std::vector<int32_t>& pValue)
|
||||
/// \overload void XML_ReadNode_GetAttrVal_AsListI32(const int pAttrIdx, std::list<int32_t>& pValue)
|
||||
void XML_ReadNode_GetAttrVal_AsArrI32(const int pAttrIdx, std::vector<int32_t>& pValue);
|
||||
|
||||
/// \fn void XML_ReadNode_GetAttrVal_AsListF(const int pAttrIdx, std::list<float>& pValue)
|
||||
/// Read attribute value.
|
||||
/// \param [in] pAttrIdx - attribute index (\ref mReader->getAttribute* set).
|
||||
/// \param [out] pValue - read data.
|
||||
void XML_ReadNode_GetAttrVal_AsListF(const int pAttrIdx, std::list<float>& pValue);
|
||||
|
||||
/// \fn void XML_ReadNode_GetAttrVal_AsArrF(const int pAttrIdx, std::vector<float>& pValue)
|
||||
/// \overload void XML_ReadNode_GetAttrVal_AsListF(const int pAttrIdx, std::list<float>& pValue)
|
||||
/// \overload void XML_ReadNode_GetAttrVal_AsListF(const int pAttrIdx, std::list<float>& pValue)
|
||||
void XML_ReadNode_GetAttrVal_AsArrF(const int pAttrIdx, std::vector<float>& pValue);
|
||||
|
||||
/// \fn void XML_ReadNode_GetAttrVal_AsListD(const int pAttrIdx, std::list<double>& pValue)
|
||||
/// Read attribute value.
|
||||
/// Read attribute value.
|
||||
/// \param [in] pAttrIdx - attribute index (\ref mReader->getAttribute* set).
|
||||
/// \param [out] pValue - read data.
|
||||
void XML_ReadNode_GetAttrVal_AsListD(const int pAttrIdx, std::list<double>& pValue);
|
||||
|
||||
/// \fn void XML_ReadNode_GetAttrVal_AsArrD(const int pAttrIdx, std::vector<double>& pValue)
|
||||
/// \overload void XML_ReadNode_GetAttrVal_AsListD(const int pAttrIdx, std::list<double>& pValue)
|
||||
void XML_ReadNode_GetAttrVal_AsArrD(const int pAttrIdx, std::vector<double>& pValue);
|
||||
|
||||
/// \fn void XML_ReadNode_GetAttrVal_AsListCol3f(const int pAttrIdx, std::list<aiColor3D>& pValue)
|
||||
/// Read attribute value.
|
||||
/// \param [in] pAttrIdx - attribute index (\ref mReader->getAttribute* set).
|
||||
/// \param [out] pValue - read data.
|
||||
void XML_ReadNode_GetAttrVal_AsListCol3f(const int pAttrIdx, std::list<aiColor3D>& pValue);
|
||||
|
||||
/// \fn void XML_ReadNode_GetAttrVal_AsArrCol3f(const int pAttrIdx, std::vector<aiColor3D>& pValue)
|
||||
/// \overload void XML_ReadNode_GetAttrVal_AsListCol3f(const int pAttrIdx, std::vector<aiColor3D>& pValue)
|
||||
void XML_ReadNode_GetAttrVal_AsArrCol3f(const int pAttrIdx, std::vector<aiColor3D>& pValue);
|
||||
|
||||
/// \fn void XML_ReadNode_GetAttrVal_AsListCol4f(const int pAttrIdx, std::list<aiColor4D>& pValue)
|
||||
/// Read attribute value.
|
||||
/// \param [in] pAttrIdx - attribute index (\ref mReader->getAttribute* set).
|
||||
/// \param [out] pValue - read data.
|
||||
void XML_ReadNode_GetAttrVal_AsListCol4f(const int pAttrIdx, std::list<aiColor4D>& pValue);
|
||||
|
||||
/// \fn void XML_ReadNode_GetAttrVal_AsArrCol4f(const int pAttrIdx, std::vector<aiColor4D>& pValue)
|
||||
/// \overload void XML_ReadNode_GetAttrVal_AsListCol4f(const int pAttrIdx, std::list<aiColor4D>& pValue)
|
||||
void XML_ReadNode_GetAttrVal_AsArrCol4f(const int pAttrIdx, std::vector<aiColor4D>& pValue);
|
||||
|
||||
/// \fn void XML_ReadNode_GetAttrVal_AsListVec2f(const int pAttrIdx, std::list<aiVector2D>& pValue)
|
||||
/// Read attribute value.
|
||||
/// \param [in] pAttrIdx - attribute index (\ref mReader->getAttribute* set).
|
||||
/// \param [out] pValue - read data.
|
||||
void XML_ReadNode_GetAttrVal_AsListVec2f(const int pAttrIdx, std::list<aiVector2D>& pValue);
|
||||
|
||||
/// \fn void XML_ReadNode_GetAttrVal_AsArrVec2f(const int pAttrIdx, std::vector<aiVector2D>& pValue)
|
||||
/// \overload void XML_ReadNode_GetAttrVal_AsListVec2f(const int pAttrIdx, std::list<aiVector2D>& pValue)
|
||||
void XML_ReadNode_GetAttrVal_AsArrVec2f(const int pAttrIdx, std::vector<aiVector2D>& pValue);
|
||||
|
||||
/// \fn void XML_ReadNode_GetAttrVal_AsListVec3f(const int pAttrIdx, std::list<aiVector3D>& pValue)
|
||||
/// Read attribute value.
|
||||
/// \param [in] pAttrIdx - attribute index (\ref mReader->getAttribute* set).
|
||||
/// \param [out] pValue - read data.
|
||||
void XML_ReadNode_GetAttrVal_AsListVec3f(const int pAttrIdx, std::list<aiVector3D>& pValue);
|
||||
|
||||
/// \fn void XML_ReadNode_GetAttrVal_AsArrVec3f(const int pAttrIdx, std::vector<aiVector3D>& pValue)
|
||||
/// \overload void XML_ReadNode_GetAttrVal_AsListVec3f(const int pAttrIdx, std::list<aiVector3D>& pValue)
|
||||
void XML_ReadNode_GetAttrVal_AsArrVec3f(const int pAttrIdx, std::vector<aiVector3D>& pValue);
|
||||
|
||||
/// \fn void XML_ReadNode_GetAttrVal_AsListS(const int pAttrIdx, std::list<std::string>& pValue)
|
||||
/// Read attribute value.
|
||||
/// \param [in] pAttrIdx - attribute index (\ref mReader->getAttribute* set).
|
||||
/// \param [out] pValue - read data.
|
||||
|
@ -530,14 +521,12 @@ private:
|
|||
/******* Functions: geometry helper set *******/
|
||||
/***********************************************/
|
||||
|
||||
/// \fn aiVector3D GeometryHelper_Make_Point2D(const float pAngle, const float pRadius)
|
||||
/// Make point on surface oXY.
|
||||
/// \param [in] pAngle - angle in radians between radius-vector of point and oX axis. Angle extends from the oX axis counterclockwise to the radius-vector.
|
||||
/// \param [in] pRadius - length of radius-vector.
|
||||
/// \return made point coordinates.
|
||||
aiVector3D GeometryHelper_Make_Point2D(const float pAngle, const float pRadius);
|
||||
|
||||
/// \fn void GeometryHelper_Make_Arc2D(const float pStartAngle, const float pEndAngle, const float pRadius, size_t pNumSegments, std::list<aiVector3D>& pVertices)
|
||||
/// Make 2D figure - linear circular arc with center in (0, 0). The z-coordinate is 0. The arc extends from the pStartAngle counterclockwise
|
||||
/// to the pEndAngle. If pStartAngle and pEndAngle have the same value, a circle is specified. If the absolute difference between pStartAngle
|
||||
/// and pEndAngle is greater than or equal to 2pi, a circle is specified.
|
||||
|
@ -548,32 +537,27 @@ private:
|
|||
/// \param [out] pVertices - generated vertices.
|
||||
void GeometryHelper_Make_Arc2D(const float pStartAngle, const float pEndAngle, const float pRadius, size_t pNumSegments, std::list<aiVector3D>& pVertices);
|
||||
|
||||
/// \fn void GeometryHelper_Extend_PointToLine(const std::list<aiVector3D>& pPoint, std::list<aiVector3D>& pLine)
|
||||
/// Create line set from point set.
|
||||
/// \param [in] pPoint - input points list.
|
||||
/// \param [out] pLine - made lines list.
|
||||
void GeometryHelper_Extend_PointToLine(const std::list<aiVector3D>& pPoint, std::list<aiVector3D>& pLine);
|
||||
|
||||
/// \fn GeometryHelper_Extend_PolylineIdxToLineIdx(const std::list<int32_t>& pPolylineCoordIdx, std::list<int32_t>& pLineCoordIdx)
|
||||
/// Create CoordIdx of line set from CoordIdx of polyline set.
|
||||
/// \param [in] pPolylineCoordIdx - vertices indices divided by delimiter "-1". Must contain faces with two or more indices.
|
||||
/// \param [out] pLineCoordIdx - made CoordIdx of line set.
|
||||
void GeometryHelper_Extend_PolylineIdxToLineIdx(const std::list<int32_t>& pPolylineCoordIdx, std::list<int32_t>& pLineCoordIdx);
|
||||
|
||||
/// \fn void GeometryHelper_MakeQL_RectParallelepiped(const aiVector3D& pSize, std::list<aiVector3D>& pVertices)
|
||||
/// Make 3D body - rectangular parallelepiped with center in (0, 0). QL mean quadlist (\sa pVertices).
|
||||
/// \param [in] pSize - scale factor for body for every axis. E.g. (1, 2, 1) mean: X-size and Z-size - 1, Y-size - 2.
|
||||
/// \param [out] pVertices - generated vertices. The list of vertices is grouped in quads.
|
||||
void GeometryHelper_MakeQL_RectParallelepiped(const aiVector3D& pSize, std::list<aiVector3D>& pVertices);
|
||||
|
||||
/// \fn void GeometryHelper_CoordIdxStr2FacesArr(const std::list<int32_t>& pCoordIdx, std::vector<aiFace>& pFaces, unsigned int& pPrimitiveTypes) const
|
||||
/// Create faces array from vertices indices array.
|
||||
/// \param [in] pCoordIdx - vertices indices divided by delimiter "-1".
|
||||
/// \param [in] pFaces - created faces array.
|
||||
/// \param [in] pPrimitiveTypes - type of primitives in faces.
|
||||
void GeometryHelper_CoordIdxStr2FacesArr(const std::list<int32_t>& pCoordIdx, std::vector<aiFace>& pFaces, unsigned int& pPrimitiveTypes) const;
|
||||
|
||||
/// \fn void MeshGeometry_AddColor(aiMesh& pMesh, const std::list<int32_t>& pCoordIdx, const std::list<aiColor4D>& pColors, const bool pColorPerVertex) const
|
||||
/// Add colors to mesh.
|
||||
/// a. If colorPerVertex is FALSE, colours are applied to each face, as follows:
|
||||
/// If the colorIndex field is not empty, one colour is used for each face of the mesh. There shall be at least as many indices in the
|
||||
|
@ -594,41 +578,33 @@ private:
|
|||
void MeshGeometry_AddColor(aiMesh& pMesh, const std::list<int32_t>& pCoordIdx, const std::list<int32_t>& pColorIdx,
|
||||
const std::list<aiColor4D>& pColors, const bool pColorPerVertex) const;
|
||||
|
||||
/// \fn void MeshGeometry_AddColor(aiMesh& pMesh, const std::list<int32_t>& pCoordIdx, const std::list<int32_t>& pColorIdx, const std::list<aiColor3D>& pColors, const bool pColorPerVertex) const;
|
||||
/// \overload void MeshGeometry_AddColor(aiMesh& pMesh, const std::list<int32_t>& pCoordIdx, const std::list<int32_t>& pColorIdx, const std::list<aiColor4D>& pColors, const bool pColorPerVertex) const;
|
||||
void MeshGeometry_AddColor(aiMesh& pMesh, const std::list<int32_t>& pCoordIdx, const std::list<int32_t>& pColorIdx,
|
||||
const std::list<aiColor3D>& pColors, const bool pColorPerVertex) const;
|
||||
|
||||
/// \fn void MeshGeometry_AddColor(aiMesh& pMesh, const std::list<aiColor4D>& pColors, const bool pColorPerVertex) const
|
||||
/// Add colors to mesh.
|
||||
/// \param [in] pMesh - mesh for adding data.
|
||||
/// \param [in] pColors - defined colors.
|
||||
/// \param [in] pColorPerVertex - if \ref pColorPerVertex is true then color in \ref pColors defined for every vertex, if false - for every face.
|
||||
void MeshGeometry_AddColor(aiMesh& pMesh, const std::list<aiColor4D>& pColors, const bool pColorPerVertex) const;
|
||||
|
||||
/// \fn void MeshGeometry_AddColor(aiMesh& pMesh, const std::list<aiColor3D>& pColors, const bool pColorPerVertex) const
|
||||
/// \overload void MeshGeometry_AddColor(aiMesh& pMesh, const std::list<aiColor4D>& pColors, const bool pColorPerVertex) const
|
||||
void MeshGeometry_AddColor(aiMesh& pMesh, const std::list<aiColor3D>& pColors, const bool pColorPerVertex) const;
|
||||
|
||||
/// \fn void MeshGeometry_AddNormal(aiMesh& pMesh, const std::list<int32_t>& pCoordIdx, const std::list<int32_t>& pNormalIdx, const std::list<aiVector3D>& pNormals, const bool pNormalPerVertex) const
|
||||
/// Add normals to mesh. Function work similar to \ref MeshGeometry_AddColor;
|
||||
void MeshGeometry_AddNormal(aiMesh& pMesh, const std::list<int32_t>& pCoordIdx, const std::list<int32_t>& pNormalIdx,
|
||||
const std::list<aiVector3D>& pNormals, const bool pNormalPerVertex) const;
|
||||
|
||||
/// \fn void MeshGeometry_AddNormal(aiMesh& pMesh, const std::list<aiVector3D>& pNormals, const bool pNormalPerVertex) const
|
||||
/// Add normals to mesh. Function work similar to \ref MeshGeometry_AddColor;
|
||||
void MeshGeometry_AddNormal(aiMesh& pMesh, const std::list<aiVector3D>& pNormals, const bool pNormalPerVertex) const;
|
||||
|
||||
/// \fn void MeshGeometry_AddTexCoord(aiMesh& pMesh, const std::list<int32_t>& pCoordIdx, const std::list<int32_t>& pTexCoordIdx, const std::list<aiVector2D>& pTexCoords) const
|
||||
/// Add texture coordinates to mesh. Function work similar to \ref MeshGeometry_AddColor;
|
||||
/// Add texture coordinates to mesh. Function work similar to \ref MeshGeometry_AddColor;
|
||||
void MeshGeometry_AddTexCoord(aiMesh& pMesh, const std::list<int32_t>& pCoordIdx, const std::list<int32_t>& pTexCoordIdx,
|
||||
const std::list<aiVector2D>& pTexCoords) const;
|
||||
|
||||
/// \fn void MeshGeometry_AddTexCoord(aiMesh& pMesh, const std::list<aiVector2D>& pTexCoords) const
|
||||
/// Add texture coordinates to mesh. Function work similar to \ref MeshGeometry_AddColor;
|
||||
/// Add texture coordinates to mesh. Function work similar to \ref MeshGeometry_AddColor;
|
||||
void MeshGeometry_AddTexCoord(aiMesh& pMesh, const std::list<aiVector2D>& pTexCoords) const;
|
||||
|
||||
/// \fn aiMesh* GeometryHelper_MakeMesh(const std::list<int32_t>& pCoordIdx, const std::list<aiVector3D>& pVertices) const
|
||||
/// Create mesh.
|
||||
/// \param [in] pCoordIdx - vertices indices divided by delimiter "-1".
|
||||
/// \param [in] pVertices - vertices of mesh.
|
||||
|
@ -639,36 +615,30 @@ private:
|
|||
/******** Functions: parse set private *********/
|
||||
/***********************************************/
|
||||
|
||||
/// \fn void ParseHelper_Group_Begin()
|
||||
/// Create node element with type "Node" in scene graph. That operation is needed when you enter to X3D group node
|
||||
/// like <Group>, <Transform> etc. When exiting from X3D group node(e.g. </Group>) \ref ParseHelper_Node_Exit must
|
||||
/// be called.
|
||||
/// \param [in] pStatic - flag: if true then static node is created(e.g. <StaticGroup>).
|
||||
void ParseHelper_Group_Begin(const bool pStatic = false);
|
||||
|
||||
/// \fn void ParseHelper_Node_Enter(CX3DImporter_NodeElement* pNode)
|
||||
/// Make pNode as current and enter deeper for parsing child nodes. At end \ref ParseHelper_Node_Exit must be called.
|
||||
/// \param [in] pNode - new current node.
|
||||
void ParseHelper_Node_Enter(CX3DImporter_NodeElement* pNode);
|
||||
|
||||
/// \fn void ParseHelper_Group_End()
|
||||
/// This function must be called when exiting from X3D group node(e.g. </Group>). \ref ParseHelper_Group_Begin.
|
||||
void ParseHelper_Node_Exit();
|
||||
|
||||
/// \fn void ParseHelper_FixTruncatedFloatString(const char* pInStr, std::string& pOutString)
|
||||
/// Attribute values of floating point types can take form ".x"(without leading zero). irrXMLReader can not read this form of values and it
|
||||
/// must be converted to right form - "0.xxx".
|
||||
/// \param [in] pInStr - pointer to input string which can contain incorrect form of values.
|
||||
/// \param [out[ pOutString - output string with right form of values.
|
||||
void ParseHelper_FixTruncatedFloatString(const char* pInStr, std::string& pOutString);
|
||||
|
||||
/// \fn bool ParseHelper_CheckRead_X3DMetadataObject()
|
||||
/// Check if current node has nodes of type X3DMetadataObject. Why we must do it? Because X3DMetadataObject can be in any non-empty X3DNode.
|
||||
/// Meaning that X3DMetadataObject can be in any non-empty node in <Scene>.
|
||||
/// \return true - if metadata node are found and parsed, false - metadata not found.
|
||||
bool ParseHelper_CheckRead_X3DMetadataObject();
|
||||
|
||||
/// \fn bool ParseHelper_CheckRead_X3DMetadataObject()
|
||||
/// Check if current node has nodes of type X3DGeometricPropertyNode. X3DGeometricPropertyNode
|
||||
/// X3DGeometricPropertyNode inheritors:
|
||||
/// <FogCoordinate>, <HAnimDisplacer>, <Color>, <ColorRGBA>, <Coordinate>, <CoordinateDouble>, <GeoCoordinate>, <Normal>,
|
||||
|
@ -677,42 +647,33 @@ private:
|
|||
/// \return true - if nodes are found and parsed, false - nodes not found.
|
||||
bool ParseHelper_CheckRead_X3DGeometricPropertyNode();
|
||||
|
||||
/// \fn void ParseNode_Root()
|
||||
/// Parse <X3D> node of the file.
|
||||
void ParseNode_Root();
|
||||
|
||||
/// \fn void ParseNode_Head()
|
||||
/// Parse <head> node of the file.
|
||||
void ParseNode_Head();
|
||||
|
||||
/// \fn void ParseNode_Root()
|
||||
/// Parse <Scene> node of the file.
|
||||
void ParseNode_Scene();
|
||||
|
||||
/// \fn void ParseNode_Metadata(CX3DImporter_NodeElement* pParent, const std::string& pNodeName)
|
||||
/// Parse child nodes of <Metadata*> node.
|
||||
/// \param [in] pNodeName - parsed node name. Must be set because that function is general and name needed for checking the end
|
||||
/// and error reporing.
|
||||
/// \param [in] pParentElement - parent metadata element.
|
||||
void ParseNode_Metadata(CX3DImporter_NodeElement* pParentElement, const std::string& pNodeName);
|
||||
|
||||
/// \fn void ParseNode_MetadataBoolean()
|
||||
/// Parse <MetadataBoolean> node of the file.
|
||||
void ParseNode_MetadataBoolean();
|
||||
|
||||
/// \fn void ParseNode_MetadataDouble()
|
||||
/// Parse <MetadataDouble> node of the file.
|
||||
void ParseNode_MetadataDouble();
|
||||
|
||||
/// \fn void ParseNode_MetadataFloat()
|
||||
/// Parse <MetadataFloat> node of the file.
|
||||
void ParseNode_MetadataFloat();
|
||||
|
||||
/// \fn void ParseNode_MetadataInteger()
|
||||
/// Parse <MetadataInteger> node of the file.
|
||||
void ParseNode_MetadataInteger();
|
||||
|
||||
/// \fn void ParseNode_MetadataSet()
|
||||
/// Parse <MetadataSet> node of the file.
|
||||
void ParseNode_MetadataSet();
|
||||
|
||||
|
@ -720,222 +681,160 @@ private:
|
|||
/// Parse <MetadataString> node of the file.
|
||||
void ParseNode_MetadataString();
|
||||
|
||||
/// \fn void ParseNode_Geometry2D_Arc2D()
|
||||
/// Parse <Arc2D> node of the file.
|
||||
void ParseNode_Geometry2D_Arc2D();
|
||||
|
||||
/// \fn void ParseNode_Geometry2D_ArcClose2D()
|
||||
/// Parse <ArcClose2D> node of the file.
|
||||
void ParseNode_Geometry2D_ArcClose2D();
|
||||
|
||||
/// \fn void ParseNode_Geometry2D_Circle2D()
|
||||
/// Parse <Circle2D> node of the file.
|
||||
void ParseNode_Geometry2D_Circle2D();
|
||||
|
||||
/// \fn void ParseNode_Geometry2D_Disk2D()
|
||||
/// Parse <Disk2D> node of the file.
|
||||
void ParseNode_Geometry2D_Disk2D();
|
||||
|
||||
/// \fn void ParseNode_Geometry2D_Polyline2D()
|
||||
/// Parse <Polyline2D> node of the file.
|
||||
void ParseNode_Geometry2D_Polyline2D();
|
||||
|
||||
/// \fn void ParseNode_Geometry2D_Polypoint2D()
|
||||
/// Parse <Polypoint2D> node of the file.
|
||||
void ParseNode_Geometry2D_Polypoint2D();
|
||||
|
||||
/// \fn void ParseNode_Geometry2D_Rectangle2D()
|
||||
/// Parse <Rectangle2D> node of the file.
|
||||
void ParseNode_Geometry2D_Rectangle2D();
|
||||
|
||||
/// \fn void ParseNode_Geometry2D_TriangleSet2D()
|
||||
/// Parse <TriangleSet2D> node of the file.
|
||||
void ParseNode_Geometry2D_TriangleSet2D();
|
||||
|
||||
/// \fn void ParseNode_Geometry3D_Box()
|
||||
/// Parse <Box> node of the file.
|
||||
void ParseNode_Geometry3D_Box();
|
||||
|
||||
/// \fn void ParseNode_Geometry3D_Cone()
|
||||
/// Parse <Cone> node of the file.
|
||||
void ParseNode_Geometry3D_Cone();
|
||||
|
||||
/// \fn void ParseNode_Geometry3D_Cylinder()
|
||||
/// Parse <Cylinder> node of the file.
|
||||
void ParseNode_Geometry3D_Cylinder();
|
||||
|
||||
/// \fn void ParseNode_Geometry3D_ElevationGrid()
|
||||
/// Parse <ElevationGrid> node of the file.
|
||||
void ParseNode_Geometry3D_ElevationGrid();
|
||||
|
||||
/// \fn void ParseNode_Geometry3D_Extrusion()
|
||||
/// Parse <Extrusion> node of the file.
|
||||
void ParseNode_Geometry3D_Extrusion();
|
||||
|
||||
/// \fn void ParseNode_Geometry3D_IndexedFaceSet()
|
||||
/// Parse <IndexedFaceSet> node of the file.
|
||||
void ParseNode_Geometry3D_IndexedFaceSet();
|
||||
|
||||
/// \fn void ParseNode_Geometry3D_Sphere()
|
||||
/// Parse <Sphere> node of the file.
|
||||
void ParseNode_Geometry3D_Sphere();
|
||||
|
||||
/// \fn void ParseNode_Grouping_Group()
|
||||
/// Parse <Group> node of the file. And create new node in scene graph.
|
||||
void ParseNode_Grouping_Group();
|
||||
|
||||
/// \fn void ParseNode_Grouping_GroupEnd()
|
||||
/// Doing actions at an exit from <Group>. Walk up in scene graph.
|
||||
void ParseNode_Grouping_GroupEnd();
|
||||
|
||||
/// \fn void ParseNode_Grouping_StaticGroup()
|
||||
/// Parse <StaticGroup> node of the file. And create new node in scene graph.
|
||||
void ParseNode_Grouping_StaticGroup();
|
||||
|
||||
/// \fn void ParseNode_Grouping_StaticGroupEnd()
|
||||
/// Doing actions at an exit from <StaticGroup>. Walk up in scene graph.
|
||||
void ParseNode_Grouping_StaticGroupEnd();
|
||||
|
||||
/// \fn void ParseNode_Grouping_Switch()
|
||||
/// Parse <Switch> node of the file. And create new node in scene graph.
|
||||
void ParseNode_Grouping_Switch();
|
||||
|
||||
/// \fn void ParseNode_Grouping_SwitchEnd()
|
||||
/// Doing actions at an exit from <Switch>. Walk up in scene graph.
|
||||
void ParseNode_Grouping_SwitchEnd();
|
||||
|
||||
/// \fn void ParseNode_Grouping_Transform()
|
||||
/// Parse <Transform> node of the file. And create new node in scene graph.
|
||||
void ParseNode_Grouping_Transform();
|
||||
|
||||
/// \fn void ParseNode_Grouping_TransformEnd()
|
||||
/// Doing actions at an exit from <Transform>. Walk up in scene graph.
|
||||
void ParseNode_Grouping_TransformEnd();
|
||||
|
||||
/// \fn void ParseNode_Rendering_Color()
|
||||
/// Parse <Color> node of the file.
|
||||
void ParseNode_Rendering_Color();
|
||||
|
||||
/// \fn void ParseNode_Rendering_ColorRGBA()
|
||||
/// Parse <ColorRGBA> node of the file.
|
||||
void ParseNode_Rendering_ColorRGBA();
|
||||
|
||||
/// \fn void ParseNode_Rendering_Coordinate()
|
||||
/// Parse <Coordinate> node of the file.
|
||||
void ParseNode_Rendering_Coordinate();
|
||||
|
||||
/// \fn void ParseNode_Rendering_Normal()
|
||||
/// Parse <Normal> node of the file.
|
||||
void ParseNode_Rendering_Normal();
|
||||
|
||||
/// \fn void ParseNode_Rendering_IndexedLineSet()
|
||||
/// Parse <IndexedLineSet> node of the file.
|
||||
void ParseNode_Rendering_IndexedLineSet();
|
||||
|
||||
/// \fn void ParseNode_Rendering_IndexedTriangleFanSet()
|
||||
/// Parse <IndexedTriangleFanSet> node of the file.
|
||||
void ParseNode_Rendering_IndexedTriangleFanSet();
|
||||
|
||||
/// \fn void ParseNode_Rendering_IndexedTriangleSet()
|
||||
/// Parse <IndexedTriangleSet> node of the file.
|
||||
void ParseNode_Rendering_IndexedTriangleSet();
|
||||
|
||||
/// \fn void ParseNode_Rendering_IndexedTriangleStripSet()
|
||||
/// Parse <IndexedTriangleStripSet> node of the file.
|
||||
void ParseNode_Rendering_IndexedTriangleStripSet();
|
||||
|
||||
/// \fn void ParseNode_Rendering_LineSet()
|
||||
/// Parse <LineSet> node of the file.
|
||||
void ParseNode_Rendering_LineSet();
|
||||
|
||||
/// \fn void ParseNode_Rendering_PointSet()
|
||||
/// Parse <PointSet> node of the file.
|
||||
void ParseNode_Rendering_PointSet();
|
||||
|
||||
/// \fn void ParseNode_Rendering_TriangleFanSet()
|
||||
/// Parse <TriangleFanSet> node of the file.
|
||||
void ParseNode_Rendering_TriangleFanSet();
|
||||
|
||||
/// \fn void ParseNode_Rendering_TriangleSet()
|
||||
/// Parse <TriangleSet> node of the file.
|
||||
void ParseNode_Rendering_TriangleSet();
|
||||
|
||||
/// \fn void ParseNode_Rendering_TriangleStripSet()
|
||||
/// Parse <TriangleStripSet> node of the file.
|
||||
void ParseNode_Rendering_TriangleStripSet();
|
||||
|
||||
/// \fn void ParseNode_Texturing_ImageTexture()
|
||||
/// Parse <ImageTexture> node of the file.
|
||||
void ParseNode_Texturing_ImageTexture();
|
||||
|
||||
/// \fn void ParseNode_Texturing_TextureCoordinate()
|
||||
/// Parse <TextureCoordinate> node of the file.
|
||||
void ParseNode_Texturing_TextureCoordinate();
|
||||
|
||||
/// \fn void ParseNode_Texturing_TextureTransform()
|
||||
/// Parse <TextureTransform> node of the file.
|
||||
void ParseNode_Texturing_TextureTransform();
|
||||
|
||||
/// \fn void ParseNode_Shape_Shape()
|
||||
/// Parse <Shape> node of the file.
|
||||
void ParseNode_Shape_Shape();
|
||||
|
||||
/// \fn void ParseNode_Shape_Appearance()
|
||||
/// Parse <Appearance> node of the file.
|
||||
void ParseNode_Shape_Appearance();
|
||||
|
||||
/// \fn void ParseNode_Shape_Material()
|
||||
/// Parse <Material> node of the file.
|
||||
void ParseNode_Shape_Material();
|
||||
|
||||
/// \fn void ParseNode_Networking_Inline()
|
||||
/// Parse <Inline> node of the file.
|
||||
void ParseNode_Networking_Inline();
|
||||
|
||||
/// \fn void ParseNode_Lighting_DirectionalLight()
|
||||
/// Parse <DirectionalLight> node of the file.
|
||||
void ParseNode_Lighting_DirectionalLight();
|
||||
|
||||
/// \fn void ParseNode_Lighting_PointLight()
|
||||
/// Parse <PointLight> node of the file.
|
||||
void ParseNode_Lighting_PointLight();
|
||||
|
||||
/// \fn void ParseNode_Lighting_SpotLight()
|
||||
/// Parse <SpotLight> node of the file.
|
||||
void ParseNode_Lighting_SpotLight();
|
||||
|
||||
public:
|
||||
private:
|
||||
/***********************************************/
|
||||
/******************** Types ********************/
|
||||
/***********************************************/
|
||||
|
||||
/// \fn X3DImporter()
|
||||
/// Default constructor.
|
||||
X3DImporter()
|
||||
: NodeElement_Cur(nullptr), mReader(nullptr)
|
||||
{}
|
||||
|
||||
/// \fn ~X3DImporter()
|
||||
/// Default destructor.
|
||||
~X3DImporter();
|
||||
|
||||
/***********************************************/
|
||||
/******** Functions: parse set, public *********/
|
||||
/***********************************************/
|
||||
|
||||
/// \fn void ParseFile(const std::string& pFile, IOSystem* pIOHandler)
|
||||
/// Parse X3D file and fill scene graph. The function has no return value. Result can be found by analyzing the generated graph.
|
||||
/// Also exception can be throwed if trouble will found.
|
||||
/// \param [in] pFile - name of file to be parsed.
|
||||
/// \param [in] pIOHandler - pointer to IO helper object.
|
||||
void ParseFile(const std::string& pFile, IOSystem* pIOHandler);
|
||||
|
||||
/***********************************************/
|
||||
/********* Functions: BaseImporter set *********/
|
||||
/***********************************************/
|
||||
|
||||
bool CanRead(const std::string& pFile, IOSystem* pIOHandler, bool pCheckSig) const;
|
||||
void GetExtensionList(std::set<std::string>& pExtensionList);
|
||||
void InternReadFile(const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler);
|
||||
const aiImporterDesc* GetInfo ()const;
|
||||
/***********************************************/
|
||||
/****************** Constants ******************/
|
||||
/***********************************************/
|
||||
static const aiImporterDesc Description;
|
||||
|
||||
/***********************************************/
|
||||
/****************** Variables ******************/
|
||||
/***********************************************/
|
||||
CX3DImporter_NodeElement* NodeElement_Cur;///< Current element.
|
||||
irr::io::IrrXMLReader* mReader;///< Pointer to XML-reader object
|
||||
std::string mFileDir;
|
||||
};// class X3DImporter
|
||||
|
||||
}// namespace Assimp
|
||||
|
|
|
@ -1,3 +1,42 @@
|
|||
/*
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, 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.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
/// \file X3DImporter_Geometry2D.cpp
|
||||
/// \brief Parsing data from nodes of "Geometry2D" set of X3D.
|
||||
/// \date 2015-2016
|
||||
|
@ -25,11 +64,11 @@ namespace Assimp
|
|||
// angle base unit has been specified). If startAngle and endAngle have the same value, a circle is specified.
|
||||
void X3DImporter::ParseNode_Geometry2D_Arc2D()
|
||||
{
|
||||
std::string def, use;
|
||||
float endAngle = AI_MATH_HALF_PI_F;
|
||||
float radius = 1;
|
||||
float startAngle = 0;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string def, use;
|
||||
float endAngle = AI_MATH_HALF_PI_F;
|
||||
float radius = 1;
|
||||
float startAngle = 0;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -86,13 +125,13 @@ CX3DImporter_NodeElement* ne;
|
|||
// viewed from the +Z-axis, the texture is mapped onto each face with the same orientation as if the image were displayed normally in 2D.
|
||||
void X3DImporter::ParseNode_Geometry2D_ArcClose2D()
|
||||
{
|
||||
std::string def, use;
|
||||
std::string closureType("PIE");
|
||||
float endAngle = AI_MATH_HALF_PI_F;
|
||||
float radius = 1;
|
||||
bool solid = false;
|
||||
float startAngle = 0;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string def, use;
|
||||
std::string closureType("PIE");
|
||||
float endAngle = AI_MATH_HALF_PI_F;
|
||||
float radius = 1;
|
||||
bool solid = false;
|
||||
float startAngle = 0;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -148,9 +187,9 @@ CX3DImporter_NodeElement* ne;
|
|||
// />
|
||||
void X3DImporter::ParseNode_Geometry2D_Circle2D()
|
||||
{
|
||||
std::string def, use;
|
||||
float radius = 1;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string def, use;
|
||||
float radius = 1;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -199,11 +238,11 @@ CX3DImporter_NodeElement* ne;
|
|||
// the Disk2D, when viewed from the +Z-axis, the texture is mapped onto each face with the same orientation as if the image were displayed normally in 2D.
|
||||
void X3DImporter::ParseNode_Geometry2D_Disk2D()
|
||||
{
|
||||
std::string def, use;
|
||||
float innerRadius = 0;
|
||||
float outerRadius = 1;
|
||||
bool solid = false;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string def, use;
|
||||
float innerRadius = 0;
|
||||
float outerRadius = 1;
|
||||
bool solid = false;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -289,9 +328,9 @@ CX3DImporter_NodeElement* ne;
|
|||
// />
|
||||
void X3DImporter::ParseNode_Geometry2D_Polyline2D()
|
||||
{
|
||||
std::string def, use;
|
||||
std::list<aiVector2D> lineSegments;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string def, use;
|
||||
std::list<aiVector2D> lineSegments;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -337,9 +376,9 @@ CX3DImporter_NodeElement* ne;
|
|||
// />
|
||||
void X3DImporter::ParseNode_Geometry2D_Polypoint2D()
|
||||
{
|
||||
std::string def, use;
|
||||
std::list<aiVector2D> point;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string def, use;
|
||||
std::list<aiVector2D> point;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -382,10 +421,10 @@ CX3DImporter_NodeElement* ne;
|
|||
// />
|
||||
void X3DImporter::ParseNode_Geometry2D_Rectangle2D()
|
||||
{
|
||||
std::string def, use;
|
||||
aiVector2D size(2, 2);
|
||||
bool solid = false;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string def, use;
|
||||
aiVector2D size(2, 2);
|
||||
bool solid = false;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -434,10 +473,10 @@ CX3DImporter_NodeElement* ne;
|
|||
// />
|
||||
void X3DImporter::ParseNode_Geometry2D_TriangleSet2D()
|
||||
{
|
||||
std::string def, use;
|
||||
bool solid = false;
|
||||
std::list<aiVector2D> vertices;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string def, use;
|
||||
bool solid = false;
|
||||
std::list<aiVector2D> vertices;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
|
|
@ -1,3 +1,42 @@
|
|||
/*
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, 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.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
/// \file X3DImporter_Geometry3D.cpp
|
||||
/// \brief Parsing data from nodes of "Geometry3D" set of X3D.
|
||||
/// \date 2015-2016
|
||||
|
@ -25,10 +64,10 @@ namespace Assimp
|
|||
// respectively and each component value shall be greater than zero.
|
||||
void X3DImporter::ParseNode_Geometry3D_Box()
|
||||
{
|
||||
std::string def, use;
|
||||
bool solid = true;
|
||||
aiVector3D size(2, 2, 2);
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string def, use;
|
||||
bool solid = true;
|
||||
aiVector3D size(2, 2, 2);
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -71,13 +110,13 @@ CX3DImporter_NodeElement* ne;
|
|||
// />
|
||||
void X3DImporter::ParseNode_Geometry3D_Cone()
|
||||
{
|
||||
std::string use, def;
|
||||
bool bottom = true;
|
||||
float bottomRadius = 1;
|
||||
float height = 2;
|
||||
bool side = true;
|
||||
bool solid = true;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string use, def;
|
||||
bool bottom = true;
|
||||
float bottomRadius = 1;
|
||||
float height = 2;
|
||||
bool side = true;
|
||||
bool solid = true;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -142,14 +181,14 @@ CX3DImporter_NodeElement* ne;
|
|||
// />
|
||||
void X3DImporter::ParseNode_Geometry3D_Cylinder()
|
||||
{
|
||||
std::string use, def;
|
||||
bool bottom = true;
|
||||
float height = 2;
|
||||
float radius = 1;
|
||||
bool side = true;
|
||||
bool solid = true;
|
||||
bool top = true;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string use, def;
|
||||
bool bottom = true;
|
||||
float height = 2;
|
||||
float radius = 1;
|
||||
bool side = true;
|
||||
bool solid = true;
|
||||
bool top = true;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -241,18 +280,18 @@ CX3DImporter_NodeElement* ne;
|
|||
// If either the xDimension or the zDimension is less than two, the ElevationGrid contains no quadrilaterals.
|
||||
void X3DImporter::ParseNode_Geometry3D_ElevationGrid()
|
||||
{
|
||||
std::string use, def;
|
||||
bool ccw = true;
|
||||
bool colorPerVertex = true;
|
||||
float creaseAngle = 0;
|
||||
std::list<float> height;
|
||||
bool normalPerVertex = true;
|
||||
bool solid = true;
|
||||
int32_t xDimension = 0;
|
||||
float xSpacing = 1;
|
||||
int32_t zDimension = 0;
|
||||
float zSpacing = 1;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string use, def;
|
||||
bool ccw = true;
|
||||
bool colorPerVertex = true;
|
||||
float creaseAngle = 0;
|
||||
std::list<float> height;
|
||||
bool normalPerVertex = true;
|
||||
bool solid = true;
|
||||
int32_t xDimension = 0;
|
||||
float xSpacing = 1;
|
||||
int32_t zDimension = 0;
|
||||
float zSpacing = 1;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -379,7 +418,7 @@ CX3DImporter_NodeElement* ne;
|
|||
template<typename TVector>
|
||||
static void GeometryHelper_Extrusion_CurveIsClosed(std::vector<TVector>& pCurve, const bool pDropTail, const bool pRemoveLastPoint, bool& pCurveIsClosed)
|
||||
{
|
||||
size_t cur_sz = pCurve.size();
|
||||
size_t cur_sz = pCurve.size();
|
||||
|
||||
pCurveIsClosed = false;
|
||||
// for curve with less than four points checking is have no sense,
|
||||
|
@ -422,9 +461,8 @@ size_t cur_sz = pCurve.size();
|
|||
|
||||
static aiVector3D GeometryHelper_Extrusion_GetNextY(const size_t pSpine_PointIdx, const std::vector<aiVector3D>& pSpine, const bool pSpine_Closed)
|
||||
{
|
||||
const size_t spine_idx_last = pSpine.size() - 1;
|
||||
|
||||
aiVector3D tvec;
|
||||
const size_t spine_idx_last = pSpine.size() - 1;
|
||||
aiVector3D tvec;
|
||||
|
||||
if((pSpine_PointIdx == 0) || (pSpine_PointIdx == spine_idx_last))// at first special cases
|
||||
{
|
||||
|
@ -456,10 +494,10 @@ aiVector3D tvec;
|
|||
static aiVector3D GeometryHelper_Extrusion_GetNextZ(const size_t pSpine_PointIdx, const std::vector<aiVector3D>& pSpine, const bool pSpine_Closed,
|
||||
const aiVector3D pVecZ_Prev)
|
||||
{
|
||||
const aiVector3D zero_vec(0);
|
||||
const size_t spine_idx_last = pSpine.size() - 1;
|
||||
const aiVector3D zero_vec(0);
|
||||
const size_t spine_idx_last = pSpine.size() - 1;
|
||||
|
||||
aiVector3D tvec;
|
||||
aiVector3D tvec;
|
||||
|
||||
// at first special cases
|
||||
if(pSpine.size() < 3)// spine have not enough points for vector calculations.
|
||||
|
@ -533,18 +571,18 @@ aiVector3D tvec;
|
|||
// />
|
||||
void X3DImporter::ParseNode_Geometry3D_Extrusion()
|
||||
{
|
||||
std::string use, def;
|
||||
bool beginCap = true;
|
||||
bool ccw = true;
|
||||
bool convex = true;
|
||||
float creaseAngle = 0;
|
||||
std::vector<aiVector2D> crossSection;
|
||||
bool endCap = true;
|
||||
std::vector<float> orientation;
|
||||
std::vector<aiVector2D> scale;
|
||||
bool solid = true;
|
||||
std::vector<aiVector3D> spine;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string use, def;
|
||||
bool beginCap = true;
|
||||
bool ccw = true;
|
||||
bool convex = true;
|
||||
float creaseAngle = 0;
|
||||
std::vector<aiVector2D> crossSection;
|
||||
bool endCap = true;
|
||||
std::vector<float> orientation;
|
||||
std::vector<aiVector2D> scale;
|
||||
bool solid = true;
|
||||
std::vector<aiVector3D> spine;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -816,18 +854,18 @@ CX3DImporter_NodeElement* ne;
|
|||
// </IndexedFaceSet>
|
||||
void X3DImporter::ParseNode_Geometry3D_IndexedFaceSet()
|
||||
{
|
||||
std::string use, def;
|
||||
bool ccw = true;
|
||||
std::list<int32_t> colorIndex;
|
||||
bool colorPerVertex = true;
|
||||
bool convex = true;
|
||||
std::list<int32_t> coordIndex;
|
||||
float creaseAngle = 0;
|
||||
std::list<int32_t> normalIndex;
|
||||
bool normalPerVertex = true;
|
||||
bool solid = true;
|
||||
std::list<int32_t> texCoordIndex;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string use, def;
|
||||
bool ccw = true;
|
||||
std::list<int32_t> colorIndex;
|
||||
bool colorPerVertex = true;
|
||||
bool convex = true;
|
||||
std::list<int32_t> coordIndex;
|
||||
float creaseAngle = 0;
|
||||
std::list<int32_t> normalIndex;
|
||||
bool normalPerVertex = true;
|
||||
bool solid = true;
|
||||
std::list<int32_t> texCoordIndex;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -903,10 +941,10 @@ CX3DImporter_NodeElement* ne;
|
|||
// />
|
||||
void X3DImporter::ParseNode_Geometry3D_Sphere()
|
||||
{
|
||||
std::string use, def;
|
||||
float radius = 1;
|
||||
bool solid = true;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string use, def;
|
||||
float radius = 1;
|
||||
bool solid = true;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
|
|
@ -1,3 +1,42 @@
|
|||
/*
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, 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.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
/// \file X3DImporter_Group.cpp
|
||||
/// \brief Parsing data from nodes of "Grouping" set of X3D.
|
||||
/// \date 2015-2016
|
||||
|
@ -26,7 +65,7 @@ namespace Assimp
|
|||
// A Group node contains children nodes without introducing a new transformation. It is equivalent to a Transform node containing an identity transform.
|
||||
void X3DImporter::ParseNode_Grouping_Group()
|
||||
{
|
||||
std::string def, use;
|
||||
std::string def, use;
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -72,7 +111,7 @@ void X3DImporter::ParseNode_Grouping_GroupEnd()
|
|||
// contain any USE references outside the StaticGroup.
|
||||
void X3DImporter::ParseNode_Grouping_StaticGroup()
|
||||
{
|
||||
std::string def, use;
|
||||
std::string def, use;
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -120,8 +159,8 @@ void X3DImporter::ParseNode_Grouping_StaticGroupEnd()
|
|||
// is chosen.
|
||||
void X3DImporter::ParseNode_Grouping_Switch()
|
||||
{
|
||||
std::string def, use;
|
||||
int32_t whichChoice = -1;
|
||||
std::string def, use;
|
||||
int32_t whichChoice = -1;
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -181,13 +220,13 @@ void X3DImporter::ParseNode_Grouping_SwitchEnd()
|
|||
// P' = T * C * R * SR * S * -SR * -C * P
|
||||
void X3DImporter::ParseNode_Grouping_Transform()
|
||||
{
|
||||
aiVector3D center(0, 0, 0);
|
||||
float rotation[4] = {0, 0, 1, 0};
|
||||
aiVector3D scale(1, 1, 1);// A value of zero indicates that any child geometry shall not be displayed
|
||||
float scale_orientation[4] = {0, 0, 1, 0};
|
||||
aiVector3D translation(0, 0, 0);
|
||||
aiMatrix4x4 matr, tmatr;
|
||||
std::string use, def;
|
||||
aiVector3D center(0, 0, 0);
|
||||
float rotation[4] = {0, 0, 1, 0};
|
||||
aiVector3D scale(1, 1, 1);// A value of zero indicates that any child geometry shall not be displayed
|
||||
float scale_orientation[4] = {0, 0, 1, 0};
|
||||
aiVector3D translation(0, 0, 0);
|
||||
aiMatrix4x4 matr, tmatr;
|
||||
std::string use, def;
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -209,11 +248,13 @@ std::string use, def;
|
|||
if(an == "scaleOrientation")
|
||||
{
|
||||
std::vector<float> tvec;
|
||||
|
||||
XML_ReadNode_GetAttrVal_AsArrF(idx, tvec);
|
||||
if(tvec.size() != 4) throw DeadlyImportError("<Transform>: scaleOrientation vector must have 4 elements.");
|
||||
if ( tvec.size() != 4 )
|
||||
{
|
||||
throw DeadlyImportError( "<Transform>: scaleOrientation vector must have 4 elements." );
|
||||
}
|
||||
|
||||
memcpy(scale_orientation, tvec.data(), sizeof(scale_orientation));
|
||||
::memcpy(scale_orientation, tvec.data(), sizeof(scale_orientation) );
|
||||
|
||||
continue;
|
||||
}
|
||||
|
@ -223,7 +264,7 @@ std::string use, def;
|
|||
// if "USE" defined then find already defined element.
|
||||
if(!use.empty())
|
||||
{
|
||||
CX3DImporter_NodeElement* ne;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_USE_CHECKANDAPPLY(def, use, ENET_Group, ne);
|
||||
}
|
||||
|
@ -231,12 +272,15 @@ std::string use, def;
|
|||
{
|
||||
ParseHelper_Group_Begin();// create new grouping element and go deeper if node has children.
|
||||
// at this place new group mode created and made current, so we can name it.
|
||||
if(!def.empty()) NodeElement_Cur->ID = def;
|
||||
if ( !def.empty() )
|
||||
{
|
||||
NodeElement_Cur->ID = def;
|
||||
}
|
||||
|
||||
//
|
||||
// also set values specific to this type of group
|
||||
//
|
||||
// calculate tranformation matrix
|
||||
// calculate transformation matrix
|
||||
aiMatrix4x4::Translation(translation, matr);// T
|
||||
aiMatrix4x4::Translation(center, tmatr);// C
|
||||
matr *= tmatr;
|
||||
|
@ -255,7 +299,10 @@ std::string use, def;
|
|||
// in grouping set of nodes check X3DMetadataObject is not needed, because it is done in <Scene> parser function.
|
||||
|
||||
// for empty element exit from node in that place
|
||||
if(mReader->isEmptyElement()) ParseHelper_Node_Exit();
|
||||
if ( mReader->isEmptyElement() )
|
||||
{
|
||||
ParseHelper_Node_Exit();
|
||||
}
|
||||
}// if(!use.empty()) else
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,42 @@
|
|||
/*
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, 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.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
/// \file X3DImporter_Light.cpp
|
||||
/// \brief Parsing data from nodes of "Lighting" set of X3D.
|
||||
/// \date 2015-2016
|
||||
|
@ -23,14 +62,14 @@ namespace Assimp
|
|||
// />
|
||||
void X3DImporter::ParseNode_Lighting_DirectionalLight()
|
||||
{
|
||||
std::string def, use;
|
||||
float ambientIntensity = 0;
|
||||
aiColor3D color(1, 1, 1);
|
||||
aiVector3D direction(0, 0, -1);
|
||||
bool global = false;
|
||||
float intensity = 1;
|
||||
bool on = true;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string def, use;
|
||||
float ambientIntensity = 0;
|
||||
aiColor3D color(1, 1, 1);
|
||||
aiVector3D direction(0, 0, -1);
|
||||
bool global = false;
|
||||
float intensity = 1;
|
||||
bool on = true;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -93,16 +132,16 @@ CX3DImporter_NodeElement* ne;
|
|||
// />
|
||||
void X3DImporter::ParseNode_Lighting_PointLight()
|
||||
{
|
||||
std::string def, use;
|
||||
float ambientIntensity = 0;
|
||||
aiVector3D attenuation(1, 0, 0);
|
||||
aiColor3D color(1, 1, 1);
|
||||
bool global = true;
|
||||
float intensity = 1;
|
||||
aiVector3D location(0, 0, 0);
|
||||
bool on = true;
|
||||
float radius = 100;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string def, use;
|
||||
float ambientIntensity = 0;
|
||||
aiVector3D attenuation( 1, 0, 0 );
|
||||
aiColor3D color( 1, 1, 1 );
|
||||
bool global = true;
|
||||
float intensity = 1;
|
||||
aiVector3D location( 0, 0, 0 );
|
||||
bool on = true;
|
||||
float radius = 100;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -171,19 +210,19 @@ CX3DImporter_NodeElement* ne;
|
|||
// />
|
||||
void X3DImporter::ParseNode_Lighting_SpotLight()
|
||||
{
|
||||
std::string def, use;
|
||||
float ambientIntensity = 0;
|
||||
aiVector3D attenuation(1, 0, 0);
|
||||
float beamWidth = 0.7854f;
|
||||
aiColor3D color(1, 1, 1);
|
||||
float cutOffAngle = 1.570796f;
|
||||
aiVector3D direction(0, 0, -1);
|
||||
bool global = true;
|
||||
float intensity = 1;
|
||||
aiVector3D location(0, 0, 0);
|
||||
bool on = true;
|
||||
float radius = 100;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string def, use;
|
||||
float ambientIntensity = 0;
|
||||
aiVector3D attenuation( 1, 0, 0 );
|
||||
float beamWidth = 0.7854f;
|
||||
aiColor3D color( 1, 1, 1 );
|
||||
float cutOffAngle = 1.570796f;
|
||||
aiVector3D direction( 0, 0, -1 );
|
||||
bool global = true;
|
||||
float intensity = 1;
|
||||
aiVector3D location( 0, 0, 0 );
|
||||
bool on = true;
|
||||
float radius = 100;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
|
|
@ -1,3 +1,42 @@
|
|||
/*
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, 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.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
/// \file X3DImporter_Macro.hpp
|
||||
/// \brief Useful macrodefines.
|
||||
/// \date 2015-2016
|
||||
|
|
|
@ -1,3 +1,42 @@
|
|||
/*
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, 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.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
/// \file X3DImporter_Metadata.cpp
|
||||
/// \brief Parsing data from nodes of "Metadata" set of X3D.
|
||||
/// \date 2015-2016
|
||||
|
@ -81,10 +120,10 @@ void X3DImporter::ParseNode_Metadata(CX3DImporter_NodeElement* pParentElement, c
|
|||
// />
|
||||
void X3DImporter::ParseNode_MetadataBoolean()
|
||||
{
|
||||
std::string def, use;
|
||||
std::string name, reference;
|
||||
std::list<bool> value;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string def, use;
|
||||
std::string name, reference;
|
||||
std::list<bool> value;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -105,10 +144,10 @@ CX3DImporter_NodeElement* ne;
|
|||
// />
|
||||
void X3DImporter::ParseNode_MetadataDouble()
|
||||
{
|
||||
std::string def, use;
|
||||
std::string name, reference;
|
||||
std::list<double> value;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string def, use;
|
||||
std::string name, reference;
|
||||
std::list<double> value;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -129,10 +168,10 @@ CX3DImporter_NodeElement* ne;
|
|||
// />
|
||||
void X3DImporter::ParseNode_MetadataFloat()
|
||||
{
|
||||
std::string def, use;
|
||||
std::string name, reference;
|
||||
std::list<float> value;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string def, use;
|
||||
std::string name, reference;
|
||||
std::list<float> value;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -153,10 +192,10 @@ CX3DImporter_NodeElement* ne;
|
|||
// />
|
||||
void X3DImporter::ParseNode_MetadataInteger()
|
||||
{
|
||||
std::string def, use;
|
||||
std::string name, reference;
|
||||
std::list<int32_t> value;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string def, use;
|
||||
std::string name, reference;
|
||||
std::list<int32_t> value;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -176,9 +215,9 @@ CX3DImporter_NodeElement* ne;
|
|||
// />
|
||||
void X3DImporter::ParseNode_MetadataSet()
|
||||
{
|
||||
std::string def, use;
|
||||
std::string name, reference;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string def, use;
|
||||
std::string name, reference;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -216,10 +255,10 @@ CX3DImporter_NodeElement* ne;
|
|||
// />
|
||||
void X3DImporter::ParseNode_MetadataString()
|
||||
{
|
||||
std::string def, use;
|
||||
std::string name, reference;
|
||||
std::list<std::string> value;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string def, use;
|
||||
std::string name, reference;
|
||||
std::list<std::string> value;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
|
|
@ -1,3 +1,42 @@
|
|||
/*
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, 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.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
/// \file X3DImporter_Networking.cpp
|
||||
/// \brief Parsing data from nodes of "Networking" set of X3D.
|
||||
/// \date 2015-2016
|
||||
|
@ -24,9 +63,9 @@ namespace Assimp
|
|||
// />
|
||||
void X3DImporter::ParseNode_Networking_Inline()
|
||||
{
|
||||
std::string def, use;
|
||||
bool load = true;
|
||||
std::list<std::string> url;
|
||||
std::string def, use;
|
||||
bool load = true;
|
||||
std::list<std::string> url;
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
|
|
@ -1,3 +1,42 @@
|
|||
/*
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, 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.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
/// \file X3DImporter_Node.hpp
|
||||
/// \brief Elements of scene graph.
|
||||
/// \date 2015-2016
|
||||
|
@ -7,8 +46,8 @@
|
|||
#define INCLUDED_AI_X3D_IMPORTER_NODE_H
|
||||
|
||||
// Header files, Assimp.
|
||||
#include "assimp/scene.h"
|
||||
#include "assimp/types.h"
|
||||
#include <assimp/scene.h>
|
||||
#include <assimp/types.h>
|
||||
|
||||
// Header files, stdlib.
|
||||
#include <list>
|
||||
|
|
|
@ -1,3 +1,42 @@
|
|||
/*
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, 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.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
/// \file X3DImporter_Postprocess.cpp
|
||||
/// \brief Convert built scenegraph and objects to Assimp scenegraph.
|
||||
/// \date 2015-2016
|
||||
|
@ -20,9 +59,9 @@ namespace Assimp
|
|||
|
||||
aiMatrix4x4 X3DImporter::PostprocessHelper_Matrix_GlobalToCurrent() const
|
||||
{
|
||||
CX3DImporter_NodeElement* cur_node;
|
||||
std::list<aiMatrix4x4> matr;
|
||||
aiMatrix4x4 out_matr;
|
||||
CX3DImporter_NodeElement* cur_node;
|
||||
std::list<aiMatrix4x4> matr;
|
||||
aiMatrix4x4 out_matr;
|
||||
|
||||
// starting walk from current element to root
|
||||
cur_node = NodeElement_Cur;
|
||||
|
@ -100,9 +139,9 @@ bool X3DImporter::PostprocessHelper_ElementIsMesh(const CX3DImporter_NodeElement
|
|||
|
||||
void X3DImporter::Postprocess_BuildLight(const CX3DImporter_NodeElement& pNodeElement, std::list<aiLight*>& pSceneLightList) const
|
||||
{
|
||||
const CX3DImporter_NodeElement_Light& ne = *((CX3DImporter_NodeElement_Light*)&pNodeElement);
|
||||
aiMatrix4x4 transform_matr = PostprocessHelper_Matrix_GlobalToCurrent();
|
||||
aiLight* new_light = new aiLight;
|
||||
const CX3DImporter_NodeElement_Light& ne = *( ( CX3DImporter_NodeElement_Light* ) &pNodeElement );
|
||||
aiMatrix4x4 transform_matr = PostprocessHelper_Matrix_GlobalToCurrent();
|
||||
aiLight* new_light = new aiLight;
|
||||
|
||||
new_light->mName = ne.ID;
|
||||
new_light->mColorAmbient = ne.Color * ne.AmbientIntensity;
|
||||
|
@ -564,10 +603,10 @@ void X3DImporter::Postprocess_BuildMesh(const CX3DImporter_NodeElement& pNodeEle
|
|||
void X3DImporter::Postprocess_BuildNode(const CX3DImporter_NodeElement& pNodeElement, aiNode& pSceneNode, std::list<aiMesh*>& pSceneMeshList,
|
||||
std::list<aiMaterial*>& pSceneMaterialList, std::list<aiLight*>& pSceneLightList) const
|
||||
{
|
||||
std::list<CX3DImporter_NodeElement*>::const_iterator chit_begin = pNodeElement.Child.begin();
|
||||
std::list<CX3DImporter_NodeElement*>::const_iterator chit_end = pNodeElement.Child.end();
|
||||
std::list<aiNode*> SceneNode_Child;
|
||||
std::list<unsigned int> SceneNode_Mesh;
|
||||
std::list<CX3DImporter_NodeElement*>::const_iterator chit_begin = pNodeElement.Child.begin();
|
||||
std::list<CX3DImporter_NodeElement*>::const_iterator chit_end = pNodeElement.Child.end();
|
||||
std::list<aiNode*> SceneNode_Child;
|
||||
std::list<unsigned int> SceneNode_Mesh;
|
||||
|
||||
// At first read all metadata
|
||||
Postprocess_CollectMetadata(pNodeElement, pSceneNode);
|
||||
|
@ -649,10 +688,10 @@ std::list<unsigned int> SceneNode_Mesh;
|
|||
void X3DImporter::Postprocess_BuildShape(const CX3DImporter_NodeElement_Shape& pShapeNodeElement, std::list<unsigned int>& pNodeMeshInd,
|
||||
std::list<aiMesh*>& pSceneMeshList, std::list<aiMaterial*>& pSceneMaterialList) const
|
||||
{
|
||||
aiMaterial* tmat = nullptr;
|
||||
aiMesh* tmesh = nullptr;
|
||||
CX3DImporter_NodeElement::EType mesh_type = CX3DImporter_NodeElement::ENET_Invalid;
|
||||
unsigned int mat_ind = 0;
|
||||
aiMaterial* tmat = nullptr;
|
||||
aiMesh* tmesh = nullptr;
|
||||
CX3DImporter_NodeElement::EType mesh_type = CX3DImporter_NodeElement::ENET_Invalid;
|
||||
unsigned int mat_ind = 0;
|
||||
|
||||
for(std::list<CX3DImporter_NodeElement*>::const_iterator it = pShapeNodeElement.Child.begin(); it != pShapeNodeElement.Child.end(); it++)
|
||||
{
|
||||
|
@ -714,8 +753,8 @@ unsigned int mat_ind = 0;
|
|||
|
||||
void X3DImporter::Postprocess_CollectMetadata(const CX3DImporter_NodeElement& pNodeElement, aiNode& pSceneNode) const
|
||||
{
|
||||
std::list<CX3DImporter_NodeElement*> meta_list;
|
||||
size_t meta_idx;
|
||||
std::list<CX3DImporter_NodeElement*> meta_list;
|
||||
size_t meta_idx;
|
||||
|
||||
PostprocessHelper_CollectMetadata(pNodeElement, meta_list);// find metadata in current node element.
|
||||
if(meta_list.size() > 0)
|
||||
|
|
|
@ -1,3 +1,42 @@
|
|||
/*
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, 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.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
/// \file X3DImporter_Rendering.cpp
|
||||
/// \brief Parsing data from nodes of "Rendering" set of X3D.
|
||||
/// \date 2015-2016
|
||||
|
@ -18,9 +57,9 @@ namespace Assimp
|
|||
// />
|
||||
void X3DImporter::ParseNode_Rendering_Color()
|
||||
{
|
||||
std::string use, def;
|
||||
std::list<aiColor3D> color;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string use, def;
|
||||
std::list<aiColor3D> color;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -56,9 +95,9 @@ CX3DImporter_NodeElement* ne;
|
|||
// />
|
||||
void X3DImporter::ParseNode_Rendering_ColorRGBA()
|
||||
{
|
||||
std::string use, def;
|
||||
std::list<aiColor4D> color;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string use, def;
|
||||
std::list<aiColor4D> color;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -94,9 +133,9 @@ CX3DImporter_NodeElement* ne;
|
|||
// />
|
||||
void X3DImporter::ParseNode_Rendering_Coordinate()
|
||||
{
|
||||
std::string use, def;
|
||||
std::list<aiVector3D> point;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string use, def;
|
||||
std::list<aiVector3D> point;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -139,11 +178,11 @@ CX3DImporter_NodeElement* ne;
|
|||
// </IndexedLineSet>
|
||||
void X3DImporter::ParseNode_Rendering_IndexedLineSet()
|
||||
{
|
||||
std::string use, def;
|
||||
std::list<int32_t> colorIndex;
|
||||
bool colorPerVertex = true;
|
||||
std::list<int32_t> coordIndex;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string use, def;
|
||||
std::list<int32_t> colorIndex;
|
||||
bool colorPerVertex = true;
|
||||
std::list<int32_t> coordIndex;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -213,13 +252,13 @@ CX3DImporter_NodeElement* ne;
|
|||
// </IndexedTriangleFanSet>
|
||||
void X3DImporter::ParseNode_Rendering_IndexedTriangleFanSet()
|
||||
{
|
||||
std::string use, def;
|
||||
bool ccw = true;
|
||||
bool colorPerVertex = true;
|
||||
std::list<int32_t> index;
|
||||
bool normalPerVertex = true;
|
||||
bool solid = true;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string use, def;
|
||||
bool ccw = true;
|
||||
bool colorPerVertex = true;
|
||||
std::list<int32_t> index;
|
||||
bool normalPerVertex = true;
|
||||
bool solid = true;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -294,13 +333,13 @@ CX3DImporter_NodeElement* ne;
|
|||
// </IndexedTriangleSet>
|
||||
void X3DImporter::ParseNode_Rendering_IndexedTriangleSet()
|
||||
{
|
||||
std::string use, def;
|
||||
bool ccw = true;
|
||||
bool colorPerVertex = true;
|
||||
std::list<int32_t> index;
|
||||
bool normalPerVertex = true;
|
||||
bool solid = true;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string use, def;
|
||||
bool ccw = true;
|
||||
bool colorPerVertex = true;
|
||||
std::list<int32_t> index;
|
||||
bool normalPerVertex = true;
|
||||
bool solid = true;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -375,13 +414,13 @@ CX3DImporter_NodeElement* ne;
|
|||
// </IndexedTriangleStripSet>
|
||||
void X3DImporter::ParseNode_Rendering_IndexedTriangleStripSet()
|
||||
{
|
||||
std::string use, def;
|
||||
bool ccw = true;
|
||||
bool colorPerVertex = true;
|
||||
std::list<int32_t> index;
|
||||
bool normalPerVertex = true;
|
||||
bool solid = true;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string use, def;
|
||||
bool ccw = true;
|
||||
bool colorPerVertex = true;
|
||||
std::list<int32_t> index;
|
||||
bool normalPerVertex = true;
|
||||
bool solid = true;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -451,9 +490,9 @@ CX3DImporter_NodeElement* ne;
|
|||
// </LineSet>
|
||||
void X3DImporter::ParseNode_Rendering_LineSet()
|
||||
{
|
||||
std::string use, def;
|
||||
std::list<int32_t> vertexCount;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string use, def;
|
||||
std::list<int32_t> vertexCount;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -525,8 +564,8 @@ CX3DImporter_NodeElement* ne;
|
|||
// </PointSet>
|
||||
void X3DImporter::ParseNode_Rendering_PointSet()
|
||||
{
|
||||
std::string use, def;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string use, def;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -584,13 +623,13 @@ CX3DImporter_NodeElement* ne;
|
|||
// </TriangleFanSet>
|
||||
void X3DImporter::ParseNode_Rendering_TriangleFanSet()
|
||||
{
|
||||
std::string use, def;
|
||||
bool ccw = true;
|
||||
bool colorPerVertex = true;
|
||||
std::list<int32_t> fanCount;
|
||||
bool normalPerVertex = true;
|
||||
bool solid = true;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string use, def;
|
||||
bool ccw = true;
|
||||
bool colorPerVertex = true;
|
||||
std::list<int32_t> fanCount;
|
||||
bool normalPerVertex = true;
|
||||
bool solid = true;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -700,12 +739,12 @@ CX3DImporter_NodeElement* ne;
|
|||
// </TriangleSet>
|
||||
void X3DImporter::ParseNode_Rendering_TriangleSet()
|
||||
{
|
||||
std::string use, def;
|
||||
bool ccw = true;
|
||||
bool colorPerVertex = true;
|
||||
bool normalPerVertex = true;
|
||||
bool solid = true;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string use, def;
|
||||
bool ccw = true;
|
||||
bool colorPerVertex = true;
|
||||
bool normalPerVertex = true;
|
||||
bool solid = true;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -775,13 +814,13 @@ CX3DImporter_NodeElement* ne;
|
|||
// </TriangleStripSet>
|
||||
void X3DImporter::ParseNode_Rendering_TriangleStripSet()
|
||||
{
|
||||
std::string use, def;
|
||||
bool ccw = true;
|
||||
bool colorPerVertex = true;
|
||||
std::list<int32_t> stripCount;
|
||||
bool normalPerVertex = true;
|
||||
bool solid = true;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string use, def;
|
||||
bool ccw = true;
|
||||
bool colorPerVertex = true;
|
||||
std::list<int32_t> stripCount;
|
||||
bool normalPerVertex = true;
|
||||
bool solid = true;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
|
|
@ -1,3 +1,42 @@
|
|||
/*
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, 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.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
/// \file X3DImporter_Shape.cpp
|
||||
/// \brief Parsing data from nodes of "Shape" set of X3D.
|
||||
/// \date 2015-2016
|
||||
|
@ -28,8 +67,8 @@ namespace Assimp
|
|||
// NOTE Geometry nodes that represent lines or points do not support lighting.
|
||||
void X3DImporter::ParseNode_Shape_Shape()
|
||||
{
|
||||
std::string use, def;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string use, def;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -105,8 +144,8 @@ CX3DImporter_NodeElement* ne;
|
|||
// </Appearance>
|
||||
void X3DImporter::ParseNode_Shape_Appearance()
|
||||
{
|
||||
std::string use, def;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string use, def;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -158,14 +197,14 @@ CX3DImporter_NodeElement* ne;
|
|||
// />
|
||||
void X3DImporter::ParseNode_Shape_Material()
|
||||
{
|
||||
std::string use, def;
|
||||
float ambientIntensity = 0.2f;
|
||||
float shininess = 0.2f;
|
||||
float transparency = 0;
|
||||
aiColor3D diffuseColor(0.8f, 0.8f, 0.8f);
|
||||
aiColor3D emissiveColor(0, 0, 0);
|
||||
aiColor3D specularColor(0, 0, 0);
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string use, def;
|
||||
float ambientIntensity = 0.2f;
|
||||
float shininess = 0.2f;
|
||||
float transparency = 0;
|
||||
aiColor3D diffuseColor(0.8f, 0.8f, 0.8f);
|
||||
aiColor3D emissiveColor(0, 0, 0);
|
||||
aiColor3D specularColor(0, 0, 0);
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
|
|
@ -1,3 +1,42 @@
|
|||
/*
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2016, 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.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
/// \file X3DImporter_Texturing.cpp
|
||||
/// \brief Parsing data from nodes of "Texturing" set of X3D.
|
||||
/// \date 2015-2016
|
||||
|
@ -21,11 +60,11 @@ namespace Assimp
|
|||
// When the url field contains no values ([]), texturing is disabled.
|
||||
void X3DImporter::ParseNode_Texturing_ImageTexture()
|
||||
{
|
||||
std::string use, def;
|
||||
bool repeatS = true;
|
||||
bool repeatT = true;
|
||||
std::list<std::string> url;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string use, def;
|
||||
bool repeatS = true;
|
||||
bool repeatT = true;
|
||||
std::list<std::string> url;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -70,9 +109,9 @@ CX3DImporter_NodeElement* ne;
|
|||
// />
|
||||
void X3DImporter::ParseNode_Texturing_TextureCoordinate()
|
||||
{
|
||||
std::string use, def;
|
||||
std::list<aiVector2D> point;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string use, def;
|
||||
std::list<aiVector2D> point;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -111,12 +150,12 @@ CX3DImporter_NodeElement* ne;
|
|||
// />
|
||||
void X3DImporter::ParseNode_Texturing_TextureTransform()
|
||||
{
|
||||
std::string use, def;
|
||||
aiVector2D center(0, 0);
|
||||
float rotation = 0;
|
||||
aiVector2D scale(1, 1);
|
||||
aiVector2D translation(0, 0);
|
||||
CX3DImporter_NodeElement* ne;
|
||||
std::string use, def;
|
||||
aiVector2D center(0, 0);
|
||||
float rotation = 0;
|
||||
aiVector2D scale(1, 1);
|
||||
aiVector2D translation(0, 0);
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
|
|
@ -236,6 +236,32 @@ namespace glTF
|
|||
BufferViewTarget_ELEMENT_ARRAY_BUFFER = 34963
|
||||
};
|
||||
|
||||
//! Values for the Sampler::magFilter field
|
||||
enum SamplerMagFilter
|
||||
{
|
||||
SamplerMagFilter_Nearest = 9728,
|
||||
SamplerMagFilter_Linear = 9729
|
||||
};
|
||||
|
||||
//! Values for the Sampler::minFilter field
|
||||
enum SamplerMinFilter
|
||||
{
|
||||
SamplerMinFilter_Nearest = 9728,
|
||||
SamplerMinFilter_Linear = 9729,
|
||||
SamplerMinFilter_Nearest_Mipmap_Nearest = 9984,
|
||||
SamplerMinFilter_Linear_Mipmap_Nearest = 9985,
|
||||
SamplerMinFilter_Nearest_Mipmap_Linear = 9986,
|
||||
SamplerMinFilter_Linear_Mipmap_Linear = 9987
|
||||
};
|
||||
|
||||
//! Values for the Sampler::wrapS and Sampler::wrapT field
|
||||
enum SamplerWrap
|
||||
{
|
||||
SamplerWrap_Clamp_To_Edge = 33071,
|
||||
SamplerWrap_Mirrored_Repeat = 33648,
|
||||
SamplerWrap_Repeat = 10497
|
||||
};
|
||||
|
||||
//! Values for the Texture::format and Texture::internalFormat fields
|
||||
enum TextureFormat
|
||||
{
|
||||
|
@ -377,8 +403,8 @@ namespace glTF
|
|||
ComponentType componentType; //!< The datatype of components in the attribute. (required)
|
||||
unsigned int 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<float> max; //!< Maximum value of each component in this attribute.
|
||||
//std::vector<float> min; //!< Minimum value of each component in this attribute.
|
||||
std::vector<float> max; //!< Maximum value of each component in this attribute.
|
||||
std::vector<float> min; //!< Minimum value of each component in this attribute.
|
||||
|
||||
unsigned int GetNumComponents();
|
||||
unsigned int GetBytesPerComponent();
|
||||
|
@ -812,8 +838,14 @@ namespace glTF
|
|||
|
||||
struct Sampler : public Object
|
||||
{
|
||||
SamplerMagFilter magFilter; //!< The texture magnification filter. (required)
|
||||
SamplerMinFilter minFilter; //!< The texture minification filter. (required)
|
||||
SamplerWrap wrapS; //!< The texture wrapping in the S direction. (required)
|
||||
SamplerWrap wrapT; //!< The texture wrapping in the T direction. (required)
|
||||
|
||||
Sampler() {}
|
||||
void Read(Value& obj, Asset& r);
|
||||
void SetDefaults();
|
||||
};
|
||||
|
||||
struct Scene : public Object
|
||||
|
@ -860,8 +892,8 @@ namespace glTF
|
|||
//! A texture and its sampler.
|
||||
struct Texture : public Object
|
||||
{
|
||||
//Ref<Sampler> source; //!< The ID of the sampler used by this texture. (required)
|
||||
Ref<Image> source; //!< The ID of the image used by this texture. (required)
|
||||
Ref<Sampler> sampler; //!< The ID of the sampler used by this texture. (required)
|
||||
Ref<Image> source; //!< The ID of the image used by this texture. (required)
|
||||
|
||||
//TextureFormat format; //!< The texture's format. (default: TextureFormat_RGBA)
|
||||
//TextureFormat internalFormat; //!< The texture's internal format. (default: TextureFormat_RGBA)
|
||||
|
@ -921,7 +953,7 @@ namespace glTF
|
|||
//! (Implemented in glTFAssetWriter.h)
|
||||
template<class T>
|
||||
void WriteLazyDict(LazyDict<T>& d, AssetWriter& w);
|
||||
|
||||
|
||||
|
||||
//! Manages lazy loading of the glTF top-level objects, and keeps a reference to them by ID
|
||||
//! It is the owner the loaded objects, so when it is destroyed it also deletes them
|
||||
|
@ -983,7 +1015,7 @@ namespace glTF
|
|||
int version; //!< The glTF format version (should be 1)
|
||||
|
||||
void Read(Document& doc);
|
||||
|
||||
|
||||
AssetMetadata()
|
||||
: premultipliedAlpha(false)
|
||||
, version(0)
|
||||
|
@ -1049,7 +1081,7 @@ namespace glTF
|
|||
LazyDict<Mesh> meshes;
|
||||
LazyDict<Node> nodes;
|
||||
//LazyDict<Program> programs;
|
||||
//LazyDict<Sampler> samplers;
|
||||
LazyDict<Sampler> samplers;
|
||||
LazyDict<Scene> scenes;
|
||||
//LazyDict<Shader> shaders;
|
||||
//LazyDict<Skin> skins;
|
||||
|
@ -1074,7 +1106,7 @@ namespace glTF
|
|||
, meshes (*this, "meshes")
|
||||
, nodes (*this, "nodes")
|
||||
//, programs (*this, "programs")
|
||||
//, samplers (*this, "samplers")
|
||||
, samplers (*this, "samplers")
|
||||
, scenes (*this, "scenes")
|
||||
//, shaders (*this, "shaders")
|
||||
//, skins (*this, "skins")
|
||||
|
|
|
@ -53,7 +53,7 @@ using namespace Assimp;
|
|||
namespace glTF {
|
||||
|
||||
namespace {
|
||||
|
||||
|
||||
//
|
||||
// JSON Value reading helpers
|
||||
//
|
||||
|
@ -62,7 +62,7 @@ namespace {
|
|||
struct ReadHelper { static bool Read(Value& val, T& out) {
|
||||
return val.IsInt() ? out = static_cast<T>(val.GetInt()), true : false;
|
||||
}};
|
||||
|
||||
|
||||
template<> struct ReadHelper<bool> { static bool Read(Value& val, bool& out) {
|
||||
return val.IsBool() ? out = val.GetBool(), true : false;
|
||||
}};
|
||||
|
@ -70,7 +70,7 @@ namespace {
|
|||
template<> struct ReadHelper<float> { static bool Read(Value& val, float& out) {
|
||||
return val.IsNumber() ? out = static_cast<float>(val.GetDouble()), true : false;
|
||||
}};
|
||||
|
||||
|
||||
template<unsigned int N> struct ReadHelper<float[N]> { static bool Read(Value& val, float (&out)[N]) {
|
||||
if (!val.IsArray() || val.Size() != N) return false;
|
||||
for (unsigned int i = 0; i < N; ++i) {
|
||||
|
@ -312,7 +312,7 @@ inline void Buffer::Read(Value& obj, Asset& r)
|
|||
if (file) {
|
||||
bool ok = LoadFromStream(*file, byteLength);
|
||||
delete file;
|
||||
|
||||
|
||||
if (!ok)
|
||||
throw DeadlyImportError("GLTF: error while reading referenced file \"" + std::string(uri) + "\"" );
|
||||
}
|
||||
|
@ -439,7 +439,7 @@ inline void BufferView::Read(Value& obj, Asset& r)
|
|||
if (bufferId) {
|
||||
buffer = r.buffers.Get(bufferId);
|
||||
}
|
||||
|
||||
|
||||
byteOffset = MemberOrDefault(obj, "byteOffset", 0u);
|
||||
byteLength = MemberOrDefault(obj, "byteLength", 0u);
|
||||
}
|
||||
|
@ -599,7 +599,7 @@ inline Image::Image()
|
|||
|
||||
inline void Image::Read(Value& obj, Asset& r)
|
||||
{
|
||||
// Check for extensions first (to detect binary embedded data)
|
||||
// Check for extensions first (to detect binary embedded data)
|
||||
if (Value* extensions = FindObject(obj, "extensions")) {
|
||||
if (r.extensionsUsed.KHR_binary_glTF) {
|
||||
if (Value* ext = FindObject(*extensions, "KHR_binary_glTF")) {
|
||||
|
@ -665,12 +665,35 @@ inline void Image::SetData(uint8_t* data, size_t length, Asset& r)
|
|||
}
|
||||
}
|
||||
|
||||
inline void Sampler::Read(Value& obj, Asset& r)
|
||||
{
|
||||
SetDefaults();
|
||||
|
||||
ReadMember(obj, "magFilter", magFilter);
|
||||
ReadMember(obj, "minFilter", minFilter);
|
||||
ReadMember(obj, "wrapS", wrapS);
|
||||
ReadMember(obj, "wrapT", wrapT);
|
||||
}
|
||||
|
||||
inline void Sampler::SetDefaults()
|
||||
{
|
||||
magFilter = SamplerMagFilter_Linear;
|
||||
minFilter = SamplerMinFilter_Linear;
|
||||
wrapS = SamplerWrap_Repeat;
|
||||
wrapT = SamplerWrap_Repeat;
|
||||
}
|
||||
|
||||
inline void Texture::Read(Value& obj, Asset& r)
|
||||
{
|
||||
const char* sourcestr;
|
||||
if (ReadMember(obj, "source", sourcestr)) {
|
||||
source = r.images.Get(sourcestr);
|
||||
}
|
||||
|
||||
const char* samplerstr;
|
||||
if (ReadMember(obj, "sampler", samplerstr)) {
|
||||
sampler = r.samplers.Get(samplerstr);
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
@ -1132,7 +1155,7 @@ inline void Node::Read(Value& obj, Asset& r)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (Value* matrix = FindArray(obj, "matrix")) {
|
||||
ReadValue(*matrix, this->matrix);
|
||||
}
|
||||
|
@ -1408,13 +1431,13 @@ inline std::string Asset::FindUniqueID(const std::string& str, const char* suffi
|
|||
id = buffer;
|
||||
it = mUsedIds.find(id);
|
||||
}
|
||||
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
namespace Util {
|
||||
|
||||
inline
|
||||
inline
|
||||
bool ParseDataURI(const char* const_uri, size_t uriLen, DataURI& out) {
|
||||
if ( NULL == const_uri ) {
|
||||
return false;
|
||||
|
|
|
@ -56,7 +56,16 @@ namespace glTF {
|
|||
inline Value& MakeValue(Value& val, float(&r)[N], MemoryPoolAllocator<>& al) {
|
||||
val.SetArray();
|
||||
val.Reserve(N, al);
|
||||
for (decltype(N) i = 0; i < N; ++i) {
|
||||
for (decltype(N) i = 0; i < N; ++i) {
|
||||
val.PushBack(r[i], al);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
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) {
|
||||
val.PushBack(r[i], al);
|
||||
}
|
||||
return val;
|
||||
|
@ -85,6 +94,10 @@ namespace glTF {
|
|||
obj.AddMember("componentType", int(a.componentType), w.mAl);
|
||||
obj.AddMember("count", a.count, w.mAl);
|
||||
obj.AddMember("type", StringRef(AttribType::ToString(a.type)), w.mAl);
|
||||
|
||||
Value vTmpMax, vTmpMin;
|
||||
obj.AddMember("max", MakeValue(vTmpMax, a.max, w.mAl), w.mAl);
|
||||
obj.AddMember("min", MakeValue(vTmpMin, a.min, w.mAl), w.mAl);
|
||||
}
|
||||
|
||||
inline void Write(Value& obj, Animation& a, AssetWriter& w)
|
||||
|
@ -285,7 +298,7 @@ namespace glTF {
|
|||
}
|
||||
primitives.PushBack(prim, w.mAl);
|
||||
}
|
||||
|
||||
|
||||
obj.AddMember("primitives", primitives, w.mAl);
|
||||
}
|
||||
|
||||
|
@ -323,7 +336,18 @@ namespace glTF {
|
|||
|
||||
inline void Write(Value& obj, Sampler& b, AssetWriter& w)
|
||||
{
|
||||
|
||||
if (b.wrapS) {
|
||||
obj.AddMember("wrapS", b.wrapS, w.mAl);
|
||||
}
|
||||
if (b.wrapT) {
|
||||
obj.AddMember("wrapT", b.wrapT, w.mAl);
|
||||
}
|
||||
if (b.magFilter) {
|
||||
obj.AddMember("magFilter", b.magFilter, w.mAl);
|
||||
}
|
||||
if (b.minFilter) {
|
||||
obj.AddMember("minFilter", b.minFilter, w.mAl);
|
||||
}
|
||||
}
|
||||
|
||||
inline void Write(Value& scene, Scene& s, AssetWriter& w)
|
||||
|
@ -351,6 +375,9 @@ namespace glTF {
|
|||
if (tex.source) {
|
||||
obj.AddMember("source", Value(tex.source->id, w.mAl).Move(), w.mAl);
|
||||
}
|
||||
if (tex.sampler) {
|
||||
obj.AddMember("sampler", Value(tex.sampler->id, w.mAl).Move(), w.mAl);
|
||||
}
|
||||
}
|
||||
|
||||
inline void Write(Value& obj, Light& b, AssetWriter& w)
|
||||
|
@ -487,13 +514,15 @@ namespace glTF {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline void AssetWriter::WriteMetadata()
|
||||
{
|
||||
Value asset;
|
||||
asset.SetObject();
|
||||
{
|
||||
asset.AddMember("version", mAsset.asset.version, mAl);
|
||||
char versionChar[10];
|
||||
ai_snprintf(versionChar, sizeof(versionChar), "%d", mAsset.asset.version);
|
||||
asset.AddMember("version", Value(versionChar, mAl).Move(), mAl);
|
||||
|
||||
asset.AddMember("generator", Value(mAsset.asset.generator, mAl).Move(), mAl);
|
||||
}
|
||||
|
|
|
@ -193,6 +193,36 @@ inline Ref<Accessor> ExportData(Asset& a, std::string& meshName, Ref<Buffer>& bu
|
|||
acc->count = count;
|
||||
acc->type = typeOut;
|
||||
|
||||
// calculate min and max values
|
||||
{
|
||||
// Allocate and initialize with large values.
|
||||
float float_MAX = 10000000000000;
|
||||
for (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++) {
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// copy the data
|
||||
acc->WriteData(count, data, numCompsIn*bytesPerComp);
|
||||
|
||||
|
@ -205,6 +235,52 @@ namespace {
|
|||
}
|
||||
}
|
||||
|
||||
void glTFExporter::GetTexSampler(const aiMaterial* mat, glTF::TexProperty& prop)
|
||||
{
|
||||
std::string samplerId = mAsset->FindUniqueID("", "sampler");
|
||||
prop.texture->sampler = mAsset->samplers.Create(samplerId);
|
||||
|
||||
aiTextureMapMode mapU, mapV;
|
||||
aiGetMaterialInteger(mat,AI_MATKEY_MAPPINGMODE_U_DIFFUSE(0),(int*)&mapU);
|
||||
aiGetMaterialInteger(mat,AI_MATKEY_MAPPINGMODE_V_DIFFUSE(0),(int*)&mapV);
|
||||
|
||||
switch (mapU) {
|
||||
case aiTextureMapMode_Wrap:
|
||||
prop.texture->sampler->wrapS = SamplerWrap_Repeat;
|
||||
break;
|
||||
case aiTextureMapMode_Clamp:
|
||||
prop.texture->sampler->wrapS = SamplerWrap_Clamp_To_Edge;
|
||||
break;
|
||||
case aiTextureMapMode_Mirror:
|
||||
prop.texture->sampler->wrapS = SamplerWrap_Mirrored_Repeat;
|
||||
break;
|
||||
case aiTextureMapMode_Decal:
|
||||
default:
|
||||
prop.texture->sampler->wrapS = SamplerWrap_Repeat;
|
||||
break;
|
||||
};
|
||||
|
||||
switch (mapV) {
|
||||
case aiTextureMapMode_Wrap:
|
||||
prop.texture->sampler->wrapT = SamplerWrap_Repeat;
|
||||
break;
|
||||
case aiTextureMapMode_Clamp:
|
||||
prop.texture->sampler->wrapT = SamplerWrap_Clamp_To_Edge;
|
||||
break;
|
||||
case aiTextureMapMode_Mirror:
|
||||
prop.texture->sampler->wrapT = SamplerWrap_Mirrored_Repeat;
|
||||
break;
|
||||
case aiTextureMapMode_Decal:
|
||||
default:
|
||||
prop.texture->sampler->wrapT = SamplerWrap_Repeat;
|
||||
break;
|
||||
};
|
||||
|
||||
// Hard coded Texture filtering options because I do not know where to find them in the aiMaterial.
|
||||
prop.texture->sampler->magFilter = SamplerMagFilter_Linear;
|
||||
prop.texture->sampler->minFilter = SamplerMinFilter_Linear;
|
||||
}
|
||||
|
||||
void glTFExporter::GetMatColorOrTex(const aiMaterial* mat, glTF::TexProperty& prop, const char* propName, int type, int idx, aiTextureType tt)
|
||||
{
|
||||
aiString tex;
|
||||
|
@ -244,6 +320,8 @@ void glTFExporter::GetMatColorOrTex(const aiMaterial* mat, glTF::TexProperty& pr
|
|||
else {
|
||||
prop.texture->source->uri = path;
|
||||
}
|
||||
|
||||
GetTexSampler(mat, prop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -254,6 +332,7 @@ void glTFExporter::GetMatColorOrTex(const aiMaterial* mat, glTF::TexProperty& pr
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void glTFExporter::ExportMaterials()
|
||||
{
|
||||
aiString aiName;
|
||||
|
@ -369,7 +448,7 @@ void glTFExporter::ExportMeshes()
|
|||
|
||||
if(comp_allow) idx_srcdata_tc.push_back(b->byteLength);// Store index of texture coordinates array.
|
||||
|
||||
Ref<Accessor> tc = ExportData(*mAsset, meshId, b, aim->mNumVertices, aim->mTextureCoords[i], AttribType::VEC3, type, ComponentType_FLOAT, true);
|
||||
Ref<Accessor> tc = ExportData(*mAsset, meshId, b, aim->mNumVertices, aim->mTextureCoords[i], AttribType::VEC3, type, ComponentType_FLOAT, false);
|
||||
if (tc) p.attributes.texcoord.push_back(tc);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,6 +94,7 @@ namespace Assimp
|
|||
|
||||
void WriteBinaryData(IOStream* outfile, std::size_t sceneLength);
|
||||
|
||||
void GetTexSampler(const aiMaterial* mat, glTF::TexProperty& prop);
|
||||
void GetMatColorOrTex(const aiMaterial* mat, glTF::TexProperty& prop, const char* propName, int type, int idx, aiTextureType tt);
|
||||
void ExportMetadata();
|
||||
void ExportMaterials();
|
||||
|
|
|
@ -38,7 +38,6 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/** @file scene.h
|
||||
* @brief Defines the data structures in which the imported scene is returned.
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue