start migrating X3D.
parent
deddaf49df
commit
58b81a2590
File diff suppressed because it is too large
Load Diff
|
@ -3,8 +3,6 @@ Open Asset Import Library (assimp)
|
|||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2020, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
@ -49,10 +47,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#ifndef ASSIMP_BUILD_NO_X3D_IMPORTER
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <cerrno>
|
||||
#include <cwchar>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <assimp/XmlParser.h>
|
||||
|
@ -64,58 +62,58 @@ struct FIValue {
|
|||
virtual ~FIValue() {}
|
||||
};
|
||||
|
||||
struct FIStringValue: public FIValue {
|
||||
struct FIStringValue : public FIValue {
|
||||
std::string value;
|
||||
static std::shared_ptr<FIStringValue> create(std::string &&value);
|
||||
};
|
||||
|
||||
struct FIByteValue: public FIValue {
|
||||
struct FIByteValue : public FIValue {
|
||||
std::vector<uint8_t> value;
|
||||
};
|
||||
|
||||
struct FIHexValue: public FIByteValue {
|
||||
struct FIHexValue : public FIByteValue {
|
||||
static std::shared_ptr<FIHexValue> create(std::vector<uint8_t> &&value);
|
||||
};
|
||||
|
||||
struct FIBase64Value: public FIByteValue {
|
||||
struct FIBase64Value : public FIByteValue {
|
||||
static std::shared_ptr<FIBase64Value> create(std::vector<uint8_t> &&value);
|
||||
};
|
||||
|
||||
struct FIShortValue: public FIValue {
|
||||
struct FIShortValue : public FIValue {
|
||||
std::vector<int16_t> value;
|
||||
static std::shared_ptr<FIShortValue> create(std::vector<int16_t> &&value);
|
||||
};
|
||||
|
||||
struct FIIntValue: public FIValue {
|
||||
struct FIIntValue : public FIValue {
|
||||
std::vector<int32_t> value;
|
||||
static std::shared_ptr<FIIntValue> create(std::vector<int32_t> &&value);
|
||||
};
|
||||
|
||||
struct FILongValue: public FIValue {
|
||||
struct FILongValue : public FIValue {
|
||||
std::vector<int64_t> value;
|
||||
static std::shared_ptr<FILongValue> create(std::vector<int64_t> &&value);
|
||||
};
|
||||
|
||||
struct FIBoolValue: public FIValue {
|
||||
struct FIBoolValue : public FIValue {
|
||||
std::vector<bool> value;
|
||||
static std::shared_ptr<FIBoolValue> create(std::vector<bool> &&value);
|
||||
};
|
||||
|
||||
struct FIFloatValue: public FIValue {
|
||||
struct FIFloatValue : public FIValue {
|
||||
std::vector<float> value;
|
||||
static std::shared_ptr<FIFloatValue> create(std::vector<float> &&value);
|
||||
};
|
||||
|
||||
struct FIDoubleValue: public FIValue {
|
||||
struct FIDoubleValue : public FIValue {
|
||||
std::vector<double> value;
|
||||
static std::shared_ptr<FIDoubleValue> create(std::vector<double> &&value);
|
||||
};
|
||||
|
||||
struct FIUUIDValue: public FIByteValue {
|
||||
struct FIUUIDValue : public FIByteValue {
|
||||
static std::shared_ptr<FIUUIDValue> create(std::vector<uint8_t> &&value);
|
||||
};
|
||||
|
||||
struct FICDATAValue: public FIStringValue {
|
||||
struct FICDATAValue : public FIStringValue {
|
||||
static std::shared_ptr<FICDATAValue> create(std::string &&value);
|
||||
};
|
||||
|
||||
|
@ -161,7 +159,7 @@ class IOStream;
|
|||
|
||||
class FIReader {
|
||||
public:
|
||||
virtual ~FIReader();
|
||||
virtual ~FIReader();
|
||||
|
||||
virtual std::shared_ptr<const FIValue> getAttributeEncodedValue(int idx) const = 0;
|
||||
|
||||
|
@ -171,16 +169,17 @@ public:
|
|||
|
||||
virtual void registerVocabulary(const std::string &vocabularyUri, const FIVocabulary *vocabulary) = 0;
|
||||
|
||||
virtual bool read() = 0;
|
||||
|
||||
static std::unique_ptr<FIReader> create(IOStream *stream);
|
||||
|
||||
};// class IFIReader
|
||||
}; // class IFIReader
|
||||
|
||||
inline
|
||||
FIReader::~FIReader() {
|
||||
// empty
|
||||
inline FIReader::~FIReader() {
|
||||
// empty
|
||||
}
|
||||
|
||||
}// namespace Assimp
|
||||
} // namespace Assimp
|
||||
|
||||
#endif // #ifndef ASSIMP_BUILD_NO_X3D_IMPORTER
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -194,7 +194,7 @@ namespace Assimp {
|
|||
class X3DImporter : public BaseImporter
|
||||
{
|
||||
public:
|
||||
std::list<CX3DImporter_NodeElement*> NodeElement_List;///< All elements of scene graph.
|
||||
std::list<X3DNodeElementBase*> NodeElement_List;///< All elements of scene graph.
|
||||
|
||||
public:
|
||||
/***********************************************/
|
||||
|
@ -246,7 +246,7 @@ private:
|
|||
/// \param [in] pType - type of requested element.
|
||||
/// \param [out] pElement - pointer to pointer to item found.
|
||||
/// \return true - if the element is found, else - false.
|
||||
bool FindNodeElement_FromRoot(const std::string& pID, const CX3DImporter_NodeElement::EType pType, CX3DImporter_NodeElement** pElement);
|
||||
bool FindNodeElement_FromRoot(const std::string& pID, const X3DNodeElementBase::EType pType, X3DNodeElementBase** pElement);
|
||||
|
||||
/// Find requested node element. Search will be made from pointed node down to childs.
|
||||
/// \param [in] pStartNode - pointer to start node.
|
||||
|
@ -254,15 +254,15 @@ private:
|
|||
/// \param [in] pType - type of requested element.
|
||||
/// \param [out] pElement - pointer to pointer to item found.
|
||||
/// \return true - if the element is found, else - false.
|
||||
bool FindNodeElement_FromNode(CX3DImporter_NodeElement* pStartNode, const std::string& pID, const CX3DImporter_NodeElement::EType pType,
|
||||
CX3DImporter_NodeElement** pElement);
|
||||
bool FindNodeElement_FromNode(X3DNodeElementBase* pStartNode, const std::string& pID, const X3DNodeElementBase::EType pType,
|
||||
X3DNodeElementBase** 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.
|
||||
/// \param [out] pElement - pointer to pointer to item found.
|
||||
/// \return true - if the element is found, else - false.
|
||||
bool FindNodeElement(const std::string& pName, const CX3DImporter_NodeElement::EType pType, CX3DImporter_NodeElement** pElement);
|
||||
bool FindNodeElement(const std::string& pName, const X3DNodeElementBase::EType pType, X3DNodeElementBase** pElement);
|
||||
|
||||
/***********************************************/
|
||||
/********* Functions: postprocess set **********/
|
||||
|
@ -274,34 +274,34 @@ private:
|
|||
/// 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;
|
||||
void PostprocessHelper_CollectMetadata(const X3DNodeElementBase& pNodeElement, std::list<X3DNodeElementBase*>& pList) 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;
|
||||
bool PostprocessHelper_ElementIsMetadata(const X3DNodeElementBase::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;
|
||||
bool PostprocessHelper_ElementIsMesh(const X3DNodeElementBase::EType pType) 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;
|
||||
void Postprocess_BuildLight(const X3DNodeElementBase& pNodeElement, std::list<aiLight*>& pSceneLightList) 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;
|
||||
void Postprocess_BuildMaterial(const X3DNodeElementBase& 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 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;
|
||||
void Postprocess_BuildMesh(const X3DNodeElementBase& pNodeElement, aiMesh** pMesh) 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.
|
||||
|
@ -310,7 +310,7 @@ private:
|
|||
/// \param [out] pSceneMeshList - list with aiMesh which belong to scene.
|
||||
/// \param [out] pSceneMaterialList - list with aiMaterial which belong to scene.
|
||||
/// \param [out] pSceneLightList - list with aiLight which belong to scene.
|
||||
void Postprocess_BuildNode(const CX3DImporter_NodeElement& pNodeElement, aiNode& pSceneNode, std::list<aiMesh*>& pSceneMeshList,
|
||||
void Postprocess_BuildNode(const X3DNodeElementBase& pNodeElement, aiNode& pSceneNode, std::list<aiMesh*>& pSceneMeshList,
|
||||
std::list<aiMaterial*>& pSceneMaterialList, std::list<aiLight*>& pSceneLightList) const;
|
||||
|
||||
/// To create mesh and material kept in <Schape>.
|
||||
|
@ -318,85 +318,13 @@ private:
|
|||
/// \param pNodeMeshInd - reference to list with mesh indices. When pShapeNodeElement will read new mesh index will be added to this list.
|
||||
/// \param pSceneMeshList - reference to list with meshes. When pShapeNodeElement will read new mesh will be added to this list.
|
||||
/// \param pSceneMaterialList - reference to list with materials. When pShapeNodeElement will read new material will be added to this list.
|
||||
void Postprocess_BuildShape(const CX3DImporter_NodeElement_Shape& pShapeNodeElement, std::list<unsigned int>& pNodeMeshInd,
|
||||
void Postprocess_BuildShape(const X3DShape& pShapeNodeElement, std::list<unsigned int>& pNodeMeshInd,
|
||||
std::list<aiMesh*>& pSceneMeshList, std::list<aiMaterial*>& pSceneMaterialList) 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.
|
||||
void Postprocess_CollectMetadata(const CX3DImporter_NodeElement& pNodeElement, aiNode& pSceneNode) const;
|
||||
|
||||
/***********************************************/
|
||||
/************* Functions: throw set ************/
|
||||
/***********************************************/
|
||||
|
||||
/// 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);
|
||||
|
||||
/// Call that function when close tag of node not found and exception must be raised.
|
||||
/// E.g.:
|
||||
/// <Scene>
|
||||
/// <Shape>
|
||||
/// </Scene> <!--- shape not closed --->
|
||||
/// \throw DeadlyImportError.
|
||||
/// \param [in] pNode - node name in which exception happened.
|
||||
void Throw_CloseNotFound(const std::string& pNode);
|
||||
|
||||
/// 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);
|
||||
|
||||
/// 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();
|
||||
|
||||
/// 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);
|
||||
|
||||
/// 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);
|
||||
|
||||
/// 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>
|
||||
/// <Box/> <!--- first geometry node --->
|
||||
/// <Sphere/> <!--- second geometry node. raise exception --->
|
||||
/// </Shape>
|
||||
/// \throw DeadlyImportError.
|
||||
/// \param [in] pNodeType - type of node which defined one more time.
|
||||
/// \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);
|
||||
|
||||
/// 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>
|
||||
/// <Transform> <!--- first grouping node begin --->
|
||||
/// <Group> <!--- second grouping node begin --->
|
||||
/// </Transform> <!--- first grouping node end --->
|
||||
/// </Scene> <!--- one grouping node still not closed --->
|
||||
/// \throw DeadlyImportError.
|
||||
/// \param [in] pNode - node name in which exception happened.
|
||||
void Throw_TagCountIncorrect(const std::string& pNode);
|
||||
|
||||
/// 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.
|
||||
void Throw_USE_NotFound(const std::string& pAttrValue);
|
||||
|
||||
/***********************************************/
|
||||
/************** Functions: LOG set *************/
|
||||
/***********************************************/
|
||||
|
||||
/// Short variant for calling \ref DefaultLogger::get()->info()
|
||||
void LogInfo(const std::string& pMessage) { DefaultLogger::get()->info(pMessage); }
|
||||
void Postprocess_CollectMetadata(const X3DNodeElementBase& pNodeElement, aiNode& pSceneNode) const;
|
||||
|
||||
/***********************************************/
|
||||
/************** Functions: XML set *************/
|
||||
|
@ -408,7 +336,7 @@ private:
|
|||
/// Check 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; }
|
||||
//bool XML_CheckNode_NameEqual(const std::string& pNodeName) { return mReader->getNodeName() == pNodeName; }
|
||||
|
||||
/// 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.
|
||||
|
@ -612,7 +540,7 @@ private:
|
|||
|
||||
/// 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);
|
||||
void ParseHelper_Node_Enter(X3DNodeElementBase* pNode);
|
||||
|
||||
/// This function must be called when exiting from X3D group node(e.g. </Group>). \ref ParseHelper_Group_Begin.
|
||||
void ParseHelper_Node_Exit();
|
||||
|
@ -649,7 +577,7 @@ private:
|
|||
/// \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);
|
||||
void ParseNode_Metadata(X3DNodeElementBase* pParentElement, const std::string& pNodeName);
|
||||
|
||||
/// Parse <MetadataBoolean> node of the file.
|
||||
void ParseNode_MetadataBoolean();
|
||||
|
@ -671,52 +599,52 @@ private:
|
|||
void ParseNode_MetadataString();
|
||||
|
||||
/// Parse <Arc2D> node of the file.
|
||||
void ParseNode_Geometry2D_Arc2D();
|
||||
void ParseNode_Geometry2D_Arc2D(XmlNode &node);
|
||||
|
||||
/// Parse <ArcClose2D> node of the file.
|
||||
void ParseNode_Geometry2D_ArcClose2D();
|
||||
void ParseNode_Geometry2D_ArcClose2D(XmlNode &node);
|
||||
|
||||
/// Parse <Circle2D> node of the file.
|
||||
void ParseNode_Geometry2D_Circle2D();
|
||||
void ParseNode_Geometry2D_Circle2D(XmlNode &node);
|
||||
|
||||
/// Parse <Disk2D> node of the file.
|
||||
void ParseNode_Geometry2D_Disk2D();
|
||||
void ParseNode_Geometry2D_Disk2D(XmlNode &node);
|
||||
|
||||
/// Parse <Polyline2D> node of the file.
|
||||
void ParseNode_Geometry2D_Polyline2D();
|
||||
void ParseNode_Geometry2D_Polyline2D(XmlNode &node);
|
||||
|
||||
/// Parse <Polypoint2D> node of the file.
|
||||
void ParseNode_Geometry2D_Polypoint2D();
|
||||
void ParseNode_Geometry2D_Polypoint2D(XmlNode &node);
|
||||
|
||||
/// Parse <Rectangle2D> node of the file.
|
||||
void ParseNode_Geometry2D_Rectangle2D();
|
||||
void ParseNode_Geometry2D_Rectangle2D(XmlNode &node);
|
||||
|
||||
/// Parse <TriangleSet2D> node of the file.
|
||||
void ParseNode_Geometry2D_TriangleSet2D();
|
||||
void ParseNode_Geometry2D_TriangleSet2D(XmlNode &node);
|
||||
|
||||
/// Parse <Box> node of the file.
|
||||
void ParseNode_Geometry3D_Box();
|
||||
void ParseNode_Geometry3D_Box(XmlNode &node);
|
||||
|
||||
/// Parse <Cone> node of the file.
|
||||
void ParseNode_Geometry3D_Cone();
|
||||
void ParseNode_Geometry3D_Cone(XmlNode &node);
|
||||
|
||||
/// Parse <Cylinder> node of the file.
|
||||
void ParseNode_Geometry3D_Cylinder();
|
||||
void ParseNode_Geometry3D_Cylinder(XmlNode &node);
|
||||
|
||||
/// Parse <ElevationGrid> node of the file.
|
||||
void ParseNode_Geometry3D_ElevationGrid();
|
||||
void ParseNode_Geometry3D_ElevationGrid(XmlNode &node);
|
||||
|
||||
/// Parse <Extrusion> node of the file.
|
||||
void ParseNode_Geometry3D_Extrusion();
|
||||
void ParseNode_Geometry3D_Extrusion(XmlNode &node);
|
||||
|
||||
/// Parse <IndexedFaceSet> node of the file.
|
||||
void ParseNode_Geometry3D_IndexedFaceSet();
|
||||
void ParseNode_Geometry3D_IndexedFaceSet(XmlNode &node);
|
||||
|
||||
/// Parse <Sphere> node of the file.
|
||||
void ParseNode_Geometry3D_Sphere();
|
||||
void ParseNode_Geometry3D_Sphere(XmlNode &node);
|
||||
|
||||
/// Parse <Group> node of the file. And create new node in scene graph.
|
||||
void ParseNode_Grouping_Group();
|
||||
void ParseNode_Grouping_Group(XmlNode &node);
|
||||
|
||||
/// Doing actions at an exit from <Group>. Walk up in scene graph.
|
||||
void ParseNode_Grouping_GroupEnd();
|
||||
|
@ -824,7 +752,7 @@ private:
|
|||
/***********************************************/
|
||||
/****************** Variables ******************/
|
||||
/***********************************************/
|
||||
CX3DImporter_NodeElement* NodeElement_Cur;///< Current element.
|
||||
X3DNodeElementBase* mNodeElementCur;///< Current element.
|
||||
std::unique_ptr<FIReader> mReader;///< Pointer to XML-reader object
|
||||
IOSystem *mpIOHandler;
|
||||
};// class X3DImporter
|
||||
|
|
|
@ -64,20 +64,19 @@ namespace Assimp
|
|||
// towards the positive y-axis. The radius field specifies the radius of the circle of which the arc is a portion. The arc extends from the startAngle
|
||||
// counterclockwise to the endAngle. The values of startAngle and endAngle shall be in the range [-2pi, 2pi] radians (or the equivalent if a different
|
||||
// angle base unit has been specified). If startAngle and endAngle have the same value, a circle is specified.
|
||||
void X3DImporter::ParseNode_Geometry2D_Arc2D()
|
||||
{
|
||||
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( nullptr );
|
||||
X3DNodeElementBase* ne = nullptr;
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
/*MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
MACRO_ATTRREAD_CHECK_RET("endAngle", endAngle, XML_ReadNode_GetAttrVal_AsFloat);
|
||||
MACRO_ATTRREAD_CHECK_RET("radius", radius, XML_ReadNode_GetAttrVal_AsFloat);
|
||||
MACRO_ATTRREAD_CHECK_RET("startAngle", startAngle, XML_ReadNode_GetAttrVal_AsFloat);
|
||||
MACRO_ATTRREAD_LOOPEND;
|
||||
MACRO_ATTRREAD_LOOPEND;*/
|
||||
|
||||
// if "USE" defined then find already defined element.
|
||||
if(!use.empty())
|
||||
|
@ -87,20 +86,20 @@ void X3DImporter::ParseNode_Geometry2D_Arc2D()
|
|||
else
|
||||
{
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_Geometry2D(CX3DImporter_NodeElement::ENET_Arc2D, NodeElement_Cur);
|
||||
ne = new X3DGeometry2D(X3DNodeElementBase::ENET_Arc2D, mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
// create point list of geometry object and convert it to line set.
|
||||
std::list<aiVector3D> tlist;
|
||||
|
||||
GeometryHelper_Make_Arc2D(startAngle, endAngle, radius, 10, tlist);///TODO: IME - AI_CONFIG for NumSeg
|
||||
GeometryHelper_Extend_PointToLine(tlist, ((CX3DImporter_NodeElement_Geometry2D*)ne)->Vertices);
|
||||
((CX3DImporter_NodeElement_Geometry2D*)ne)->NumIndices = 2;
|
||||
GeometryHelper_Extend_PointToLine(tlist, ((X3DGeometry2D*)ne)->Vertices);
|
||||
((X3DGeometry2D*)ne)->NumIndices = 2;
|
||||
// check for X3DMetadataObject childs.
|
||||
if(!mReader->isEmptyElement())
|
||||
ParseNode_Metadata(ne, "Arc2D");
|
||||
else
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
}// if(!use.empty()) else
|
||||
|
@ -133,7 +132,7 @@ void X3DImporter::ParseNode_Geometry2D_ArcClose2D()
|
|||
float radius = 1;
|
||||
bool solid = false;
|
||||
float startAngle = 0;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -152,16 +151,16 @@ void X3DImporter::ParseNode_Geometry2D_ArcClose2D()
|
|||
else
|
||||
{
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_Geometry2D(CX3DImporter_NodeElement::ENET_ArcClose2D, NodeElement_Cur);
|
||||
ne = new X3DGeometry2D(X3DNodeElementBase::ENET_ArcClose2D, mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
((CX3DImporter_NodeElement_Geometry2D*)ne)->Solid = solid;
|
||||
((X3DGeometry2D*)ne)->Solid = solid;
|
||||
// create point list of geometry object.
|
||||
GeometryHelper_Make_Arc2D(startAngle, endAngle, radius, 10, ((CX3DImporter_NodeElement_Geometry2D*)ne)->Vertices);///TODO: IME - AI_CONFIG for NumSeg
|
||||
GeometryHelper_Make_Arc2D(startAngle, endAngle, radius, 10, ((X3DGeometry2D*)ne)->Vertices);///TODO: IME - AI_CONFIG for NumSeg
|
||||
// add chord or two radiuses only if not a circle was defined
|
||||
if(!((std::fabs(endAngle - startAngle) >= AI_MATH_TWO_PI_F) || (endAngle == startAngle)))
|
||||
{
|
||||
std::list<aiVector3D>& vlist = ((CX3DImporter_NodeElement_Geometry2D*)ne)->Vertices;// just short alias.
|
||||
std::list<aiVector3D>& vlist = ((X3DGeometry2D*)ne)->Vertices;// just short alias.
|
||||
|
||||
if((closureType == "PIE") || (closureType == "\"PIE\""))
|
||||
vlist.push_back(aiVector3D(0, 0, 0));// center point - first radial line
|
||||
|
@ -171,12 +170,12 @@ void X3DImporter::ParseNode_Geometry2D_ArcClose2D()
|
|||
vlist.push_back(*vlist.begin());// arc first point - chord from first to last point of arc(if CHORD) or second radial line(if PIE).
|
||||
}
|
||||
|
||||
((CX3DImporter_NodeElement_Geometry2D*)ne)->NumIndices = ((CX3DImporter_NodeElement_Geometry2D*)ne)->Vertices.size();
|
||||
((X3DGeometry2D*)ne)->NumIndices = ((X3DGeometry2D*)ne)->Vertices.size();
|
||||
// check for X3DMetadataObject childs.
|
||||
if(!mReader->isEmptyElement())
|
||||
ParseNode_Metadata(ne, "ArcClose2D");
|
||||
else
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
}// if(!use.empty()) else
|
||||
|
@ -191,7 +190,7 @@ void X3DImporter::ParseNode_Geometry2D_Circle2D()
|
|||
{
|
||||
std::string def, use;
|
||||
float radius = 1;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -206,20 +205,20 @@ void X3DImporter::ParseNode_Geometry2D_Circle2D()
|
|||
else
|
||||
{
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_Geometry2D(CX3DImporter_NodeElement::ENET_Circle2D, NodeElement_Cur);
|
||||
ne = new X3DGeometry2D(X3DNodeElementBase::ENET_Circle2D, mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
// create point list of geometry object and convert it to line set.
|
||||
std::list<aiVector3D> tlist;
|
||||
|
||||
GeometryHelper_Make_Arc2D(0, 0, radius, 10, tlist);///TODO: IME - AI_CONFIG for NumSeg
|
||||
GeometryHelper_Extend_PointToLine(tlist, ((CX3DImporter_NodeElement_Geometry2D*)ne)->Vertices);
|
||||
((CX3DImporter_NodeElement_Geometry2D*)ne)->NumIndices = 2;
|
||||
GeometryHelper_Extend_PointToLine(tlist, ((X3DGeometry2D*)ne)->Vertices);
|
||||
((X3DGeometry2D*)ne)->NumIndices = 2;
|
||||
// check for X3DMetadataObject childs.
|
||||
if(!mReader->isEmptyElement())
|
||||
ParseNode_Metadata(ne, "Circle2D");
|
||||
else
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
}// if(!use.empty()) else
|
||||
|
@ -244,7 +243,7 @@ void X3DImporter::ParseNode_Geometry2D_Disk2D()
|
|||
float innerRadius = 0;
|
||||
float outerRadius = 1;
|
||||
bool solid = false;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -265,7 +264,7 @@ void X3DImporter::ParseNode_Geometry2D_Disk2D()
|
|||
if(innerRadius > outerRadius) Throw_IncorrectAttrValue("innerRadius");
|
||||
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_Geometry2D(CX3DImporter_NodeElement::ENET_Disk2D, NodeElement_Cur);
|
||||
ne = new X3DGeometry2D(X3DNodeElementBase::ENET_Disk2D, mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
// create point list of geometry object.
|
||||
|
@ -274,18 +273,18 @@ void X3DImporter::ParseNode_Geometry2D_Disk2D()
|
|||
if(innerRadius == 0.0f)
|
||||
{// make filled disk
|
||||
// in tlist_o we already have points of circle. just copy it and sign as polygon.
|
||||
((CX3DImporter_NodeElement_Geometry2D*)ne)->Vertices = tlist_o;
|
||||
((CX3DImporter_NodeElement_Geometry2D*)ne)->NumIndices = tlist_o.size();
|
||||
((X3DGeometry2D*)ne)->Vertices = tlist_o;
|
||||
((X3DGeometry2D*)ne)->NumIndices = tlist_o.size();
|
||||
}
|
||||
else if(innerRadius == outerRadius)
|
||||
{// make circle
|
||||
// in tlist_o we already have points of circle. convert it to line set.
|
||||
GeometryHelper_Extend_PointToLine(tlist_o, ((CX3DImporter_NodeElement_Geometry2D*)ne)->Vertices);
|
||||
((CX3DImporter_NodeElement_Geometry2D*)ne)->NumIndices = 2;
|
||||
GeometryHelper_Extend_PointToLine(tlist_o, ((X3DGeometry2D*)ne)->Vertices);
|
||||
((X3DGeometry2D*)ne)->NumIndices = 2;
|
||||
}
|
||||
else
|
||||
{// make disk
|
||||
std::list<aiVector3D>& vlist = ((CX3DImporter_NodeElement_Geometry2D*)ne)->Vertices;// just short alias.
|
||||
std::list<aiVector3D>& vlist = ((X3DGeometry2D*)ne)->Vertices;// just short alias.
|
||||
|
||||
GeometryHelper_Make_Arc2D(0, 0, innerRadius, 10, tlist_i);// inner circle
|
||||
//
|
||||
|
@ -309,15 +308,15 @@ void X3DImporter::ParseNode_Geometry2D_Disk2D()
|
|||
vlist.push_back(*tlist_o.begin());// 3rd point
|
||||
vlist.push_back(*tlist_o.begin());// 4th point
|
||||
|
||||
((CX3DImporter_NodeElement_Geometry2D*)ne)->NumIndices = 4;
|
||||
((X3DGeometry2D*)ne)->NumIndices = 4;
|
||||
}
|
||||
|
||||
((CX3DImporter_NodeElement_Geometry2D*)ne)->Solid = solid;
|
||||
((X3DGeometry2D*)ne)->Solid = solid;
|
||||
// check for X3DMetadataObject childs.
|
||||
if(!mReader->isEmptyElement())
|
||||
ParseNode_Metadata(ne, "Disk2D");
|
||||
else
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
}// if(!use.empty()) else
|
||||
|
@ -332,7 +331,7 @@ void X3DImporter::ParseNode_Geometry2D_Polyline2D()
|
|||
{
|
||||
std::string def, use;
|
||||
std::list<aiVector2D> lineSegments;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -347,7 +346,7 @@ void X3DImporter::ParseNode_Geometry2D_Polyline2D()
|
|||
else
|
||||
{
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_Geometry2D(CX3DImporter_NodeElement::ENET_Polyline2D, NodeElement_Cur);
|
||||
ne = new X3DGeometry2D(X3DNodeElementBase::ENET_Polyline2D, mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
//
|
||||
|
@ -359,13 +358,13 @@ void X3DImporter::ParseNode_Geometry2D_Polyline2D()
|
|||
for(std::list<aiVector2D>::iterator it2 = lineSegments.begin(); it2 != lineSegments.end(); ++it2) tlist.push_back(aiVector3D(it2->x, it2->y, 0));
|
||||
|
||||
// convert point set to line set
|
||||
GeometryHelper_Extend_PointToLine(tlist, ((CX3DImporter_NodeElement_Geometry2D*)ne)->Vertices);
|
||||
((CX3DImporter_NodeElement_Geometry2D*)ne)->NumIndices = 2;
|
||||
GeometryHelper_Extend_PointToLine(tlist, ((X3DGeometry2D*)ne)->Vertices);
|
||||
((X3DGeometry2D*)ne)->NumIndices = 2;
|
||||
// check for X3DMetadataObject childs.
|
||||
if(!mReader->isEmptyElement())
|
||||
ParseNode_Metadata(ne, "Polyline2D");
|
||||
else
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
}// if(!use.empty()) else
|
||||
|
@ -380,7 +379,7 @@ void X3DImporter::ParseNode_Geometry2D_Polypoint2D()
|
|||
{
|
||||
std::string def, use;
|
||||
std::list<aiVector2D> point;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -395,21 +394,21 @@ void X3DImporter::ParseNode_Geometry2D_Polypoint2D()
|
|||
else
|
||||
{
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_Geometry2D(CX3DImporter_NodeElement::ENET_Polypoint2D, NodeElement_Cur);
|
||||
ne = new X3DGeometry2D(X3DNodeElementBase::ENET_Polypoint2D, mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
// convert vec2 to vec3
|
||||
for(std::list<aiVector2D>::iterator it2 = point.begin(); it2 != point.end(); ++it2)
|
||||
{
|
||||
((CX3DImporter_NodeElement_Geometry2D*)ne)->Vertices.push_back(aiVector3D(it2->x, it2->y, 0));
|
||||
((X3DGeometry2D*)ne)->Vertices.push_back(aiVector3D(it2->x, it2->y, 0));
|
||||
}
|
||||
|
||||
((CX3DImporter_NodeElement_Geometry2D*)ne)->NumIndices = 1;
|
||||
((X3DGeometry2D*)ne)->NumIndices = 1;
|
||||
// check for X3DMetadataObject childs.
|
||||
if(!mReader->isEmptyElement())
|
||||
ParseNode_Metadata(ne, "Polypoint2D");
|
||||
else
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
}// if(!use.empty()) else
|
||||
|
@ -426,7 +425,7 @@ void X3DImporter::ParseNode_Geometry2D_Rectangle2D()
|
|||
std::string def, use;
|
||||
aiVector2D size(2, 2);
|
||||
bool solid = false;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -442,26 +441,26 @@ void X3DImporter::ParseNode_Geometry2D_Rectangle2D()
|
|||
else
|
||||
{
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_Geometry2D(CX3DImporter_NodeElement::ENET_Rectangle2D, NodeElement_Cur);
|
||||
ne = new X3DGeometry2D(X3DNodeElementBase::ENET_Rectangle2D, mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
float x1 = -size.x / 2.0f;
|
||||
float x2 = size.x / 2.0f;
|
||||
float y1 = -size.y / 2.0f;
|
||||
float y2 = size.y / 2.0f;
|
||||
std::list<aiVector3D>& vlist = ((CX3DImporter_NodeElement_Geometry2D*)ne)->Vertices;// just short alias.
|
||||
std::list<aiVector3D>& vlist = ((X3DGeometry2D*)ne)->Vertices;// just short alias.
|
||||
|
||||
vlist.push_back(aiVector3D(x2, y1, 0));// 1st point
|
||||
vlist.push_back(aiVector3D(x2, y2, 0));// 2nd point
|
||||
vlist.push_back(aiVector3D(x1, y2, 0));// 3rd point
|
||||
vlist.push_back(aiVector3D(x1, y1, 0));// 4th point
|
||||
((CX3DImporter_NodeElement_Geometry2D*)ne)->Solid = solid;
|
||||
((CX3DImporter_NodeElement_Geometry2D*)ne)->NumIndices = 4;
|
||||
((X3DGeometry2D*)ne)->Solid = solid;
|
||||
((X3DGeometry2D*)ne)->NumIndices = 4;
|
||||
// check for X3DMetadataObject childs.
|
||||
if(!mReader->isEmptyElement())
|
||||
ParseNode_Metadata(ne, "Rectangle2D");
|
||||
else
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
}// if(!use.empty()) else
|
||||
|
@ -478,7 +477,7 @@ void X3DImporter::ParseNode_Geometry2D_TriangleSet2D()
|
|||
std::string def, use;
|
||||
bool solid = false;
|
||||
std::list<aiVector2D> vertices;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -496,22 +495,22 @@ void X3DImporter::ParseNode_Geometry2D_TriangleSet2D()
|
|||
if(vertices.size() % 3) throw DeadlyImportError("TriangleSet2D. Not enough points for defining triangle.");
|
||||
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_Geometry2D(CX3DImporter_NodeElement::ENET_TriangleSet2D, NodeElement_Cur);
|
||||
ne = new X3DGeometry2D(X3DNodeElementBase::ENET_TriangleSet2D, mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
// convert vec2 to vec3
|
||||
for(std::list<aiVector2D>::iterator it2 = vertices.begin(); it2 != vertices.end(); ++it2)
|
||||
{
|
||||
((CX3DImporter_NodeElement_Geometry2D*)ne)->Vertices.push_back(aiVector3D(it2->x, it2->y, 0));
|
||||
((X3DGeometry2D*)ne)->Vertices.push_back(aiVector3D(it2->x, it2->y, 0));
|
||||
}
|
||||
|
||||
((CX3DImporter_NodeElement_Geometry2D*)ne)->Solid = solid;
|
||||
((CX3DImporter_NodeElement_Geometry2D*)ne)->NumIndices = 3;
|
||||
((X3DGeometry2D*)ne)->Solid = solid;
|
||||
((X3DGeometry2D*)ne)->NumIndices = 3;
|
||||
// check for X3DMetadataObject childs.
|
||||
if(!mReader->isEmptyElement())
|
||||
ParseNode_Metadata(ne, "TriangleSet2D");
|
||||
else
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
}// if(!use.empty()) else
|
||||
|
|
|
@ -69,7 +69,7 @@ void X3DImporter::ParseNode_Geometry3D_Box()
|
|||
std::string def, use;
|
||||
bool solid = true;
|
||||
aiVector3D size(2, 2, 2);
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -85,17 +85,17 @@ void X3DImporter::ParseNode_Geometry3D_Box()
|
|||
else
|
||||
{
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_Geometry3D(CX3DImporter_NodeElement::ENET_Box, NodeElement_Cur);
|
||||
ne = new X3DGeometry3D(X3DNodeElementBase::ENET_Box, mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
GeometryHelper_MakeQL_RectParallelepiped(size, ((CX3DImporter_NodeElement_Geometry3D*)ne)->Vertices);// get quad list
|
||||
((CX3DImporter_NodeElement_Geometry3D*)ne)->Solid = solid;
|
||||
((CX3DImporter_NodeElement_Geometry3D*)ne)->NumIndices = 4;
|
||||
GeometryHelper_MakeQL_RectParallelepiped(size, ((X3DGeometry3D*)ne)->Vertices);// get quad list
|
||||
((X3DGeometry3D*)ne)->Solid = solid;
|
||||
((X3DGeometry3D*)ne)->NumIndices = 4;
|
||||
// check for X3DMetadataObject childs.
|
||||
if(!mReader->isEmptyElement())
|
||||
ParseNode_Metadata(ne, "Box");
|
||||
else
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
}// if(!use.empty()) else
|
||||
|
@ -118,7 +118,7 @@ void X3DImporter::ParseNode_Geometry3D_Cone()
|
|||
float height = 2;
|
||||
bool side = true;
|
||||
bool solid = true;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -141,7 +141,7 @@ void X3DImporter::ParseNode_Geometry3D_Cone()
|
|||
std::vector<aiVector3D> tvec;// temp array for vertices.
|
||||
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_Geometry3D(CX3DImporter_NodeElement::ENET_Cone, NodeElement_Cur);
|
||||
ne = new X3DGeometry3D(X3DNodeElementBase::ENET_Cone, mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
// make cone or parts according to flags.
|
||||
|
@ -157,15 +157,15 @@ void X3DImporter::ParseNode_Geometry3D_Cone()
|
|||
}
|
||||
|
||||
// copy data from temp array
|
||||
for(std::vector<aiVector3D>::iterator it = tvec.begin(); it != tvec.end(); ++it) ((CX3DImporter_NodeElement_Geometry3D*)ne)->Vertices.push_back(*it);
|
||||
for(std::vector<aiVector3D>::iterator it = tvec.begin(); it != tvec.end(); ++it) ((X3DGeometry3D*)ne)->Vertices.push_back(*it);
|
||||
|
||||
((CX3DImporter_NodeElement_Geometry3D*)ne)->Solid = solid;
|
||||
((CX3DImporter_NodeElement_Geometry3D*)ne)->NumIndices = 3;
|
||||
((X3DGeometry3D*)ne)->Solid = solid;
|
||||
((X3DGeometry3D*)ne)->NumIndices = 3;
|
||||
// check for X3DMetadataObject childs.
|
||||
if(!mReader->isEmptyElement())
|
||||
ParseNode_Metadata(ne, "Cone");
|
||||
else
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
}// if(!use.empty()) else
|
||||
|
@ -190,7 +190,7 @@ void X3DImporter::ParseNode_Geometry3D_Cylinder()
|
|||
bool side = true;
|
||||
bool solid = true;
|
||||
bool top = true;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -215,7 +215,7 @@ void X3DImporter::ParseNode_Geometry3D_Cylinder()
|
|||
std::vector<aiVector3D> tcir;// temp array for vertices of circle.
|
||||
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_Geometry3D(CX3DImporter_NodeElement::ENET_Cylinder, NodeElement_Cur);
|
||||
ne = new X3DGeometry3D(X3DNodeElementBase::ENET_Cylinder, mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
// make cilynder or parts according to flags.
|
||||
|
@ -224,7 +224,7 @@ void X3DImporter::ParseNode_Geometry3D_Cylinder()
|
|||
height /= 2;// height defined for whole cylinder, when creating top and bottom circle we are using just half of height.
|
||||
if(top || bottom) StandardShapes::MakeCircle(radius, tess, tcir);
|
||||
// copy data from temp arrays
|
||||
std::list<aiVector3D>& vlist = ((CX3DImporter_NodeElement_Geometry3D*)ne)->Vertices;// just short alias.
|
||||
std::list<aiVector3D>& vlist = ((X3DGeometry3D*)ne)->Vertices;// just short alias.
|
||||
|
||||
for(std::vector<aiVector3D>::iterator it = tside.begin(); it != tside.end(); ++it) vlist.push_back(*it);
|
||||
|
||||
|
@ -246,13 +246,13 @@ void X3DImporter::ParseNode_Geometry3D_Cylinder()
|
|||
}
|
||||
}// if(top)
|
||||
|
||||
((CX3DImporter_NodeElement_Geometry3D*)ne)->Solid = solid;
|
||||
((CX3DImporter_NodeElement_Geometry3D*)ne)->NumIndices = 3;
|
||||
((X3DGeometry3D*)ne)->Solid = solid;
|
||||
((X3DGeometry3D*)ne)->NumIndices = 3;
|
||||
// check for X3DMetadataObject childs.
|
||||
if(!mReader->isEmptyElement())
|
||||
ParseNode_Metadata(ne, "Cylinder");
|
||||
else
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
}// if(!use.empty()) else
|
||||
|
@ -293,7 +293,7 @@ void X3DImporter::ParseNode_Geometry3D_ElevationGrid()
|
|||
float xSpacing = 1;
|
||||
int32_t zDimension = 0;
|
||||
float zSpacing = 1;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -321,10 +321,10 @@ void X3DImporter::ParseNode_Geometry3D_ElevationGrid()
|
|||
if((size_t)(xDimension * zDimension) != height.size()) Throw_IncorrectAttrValue("Heights count must be equal to \"xDimension * zDimension\"");
|
||||
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_ElevationGrid(CX3DImporter_NodeElement::ENET_ElevationGrid, NodeElement_Cur);
|
||||
ne = new X3DElevationGrid(X3DNodeElementBase::ENET_ElevationGrid, mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
CX3DImporter_NodeElement_ElevationGrid& grid_alias = *((CX3DImporter_NodeElement_ElevationGrid*)ne);// create alias for conveience
|
||||
X3DElevationGrid& grid_alias = *((X3DElevationGrid*)ne);// create alias for conveience
|
||||
|
||||
{// create grid vertices list
|
||||
std::vector<float>::const_iterator he_it = height.begin();
|
||||
|
@ -346,7 +346,7 @@ void X3DImporter::ParseNode_Geometry3D_ElevationGrid()
|
|||
// check if we have quads
|
||||
if((xDimension < 2) || (zDimension < 2))// only one element in dimension is set, create line set.
|
||||
{
|
||||
((CX3DImporter_NodeElement_ElevationGrid*)ne)->NumIndices = 2;// will be holded as line set.
|
||||
((X3DElevationGrid*)ne)->NumIndices = 2;// will be holded as line set.
|
||||
for(size_t i = 0, i_e = (grid_alias.Vertices.size() - 1); i < i_e; i++)
|
||||
{
|
||||
grid_alias.CoordIdx.push_back(static_cast<int32_t>(i));
|
||||
|
@ -356,7 +356,7 @@ void X3DImporter::ParseNode_Geometry3D_ElevationGrid()
|
|||
}
|
||||
else// two or more elements in every dimension is set. create quad set.
|
||||
{
|
||||
((CX3DImporter_NodeElement_ElevationGrid*)ne)->NumIndices = 4;
|
||||
((X3DElevationGrid*)ne)->NumIndices = 4;
|
||||
for(int32_t fzi = 0, fzi_e = (zDimension - 1); fzi < fzi_e; fzi++)// rows
|
||||
{
|
||||
for(int32_t fxi = 0, fxi_e = (xDimension - 1); fxi < fxi_e; fxi++)// columns
|
||||
|
@ -410,7 +410,7 @@ void X3DImporter::ParseNode_Geometry3D_ElevationGrid()
|
|||
}// if(!mReader->isEmptyElement())
|
||||
else
|
||||
{
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
}// if(!mReader->isEmptyElement()) else
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
|
@ -584,7 +584,7 @@ void X3DImporter::ParseNode_Geometry3D_Extrusion()
|
|||
std::vector<aiVector2D> scale;
|
||||
bool solid = true;
|
||||
std::vector<aiVector3D> spine;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -667,10 +667,10 @@ void X3DImporter::ParseNode_Geometry3D_Extrusion()
|
|||
//
|
||||
// create and if needed - define new geometry object.
|
||||
//
|
||||
ne = new CX3DImporter_NodeElement_IndexedSet(CX3DImporter_NodeElement::ENET_Extrusion, NodeElement_Cur);
|
||||
ne = new X3DIndexedSet(X3DNodeElementBase::ENET_Extrusion, mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
CX3DImporter_NodeElement_IndexedSet& ext_alias = *((CX3DImporter_NodeElement_IndexedSet*)ne);// create alias for conveience
|
||||
X3DIndexedSet& ext_alias = *((X3DIndexedSet*)ne);// create alias for conveience
|
||||
// assign part of input data
|
||||
ext_alias.CCW = ccw;
|
||||
ext_alias.Convex = convex;
|
||||
|
@ -834,7 +834,7 @@ void X3DImporter::ParseNode_Geometry3D_Extrusion()
|
|||
if(!mReader->isEmptyElement())
|
||||
ParseNode_Metadata(ne, "Extrusion");
|
||||
else
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
}// if(!use.empty()) else
|
||||
|
@ -873,7 +873,7 @@ void X3DImporter::ParseNode_Geometry3D_IndexedFaceSet()
|
|||
bool normalPerVertex = true;
|
||||
bool solid = true;
|
||||
std::vector<int32_t> texCoordIndex;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -900,10 +900,10 @@ void X3DImporter::ParseNode_Geometry3D_IndexedFaceSet()
|
|||
if(coordIndex.size() == 0) throw DeadlyImportError("IndexedFaceSet must contain not empty \"coordIndex\" attribute.");
|
||||
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_IndexedSet(CX3DImporter_NodeElement::ENET_IndexedFaceSet, NodeElement_Cur);
|
||||
ne = new X3DIndexedSet(X3DNodeElementBase::ENET_IndexedFaceSet, mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
CX3DImporter_NodeElement_IndexedSet& ne_alias = *((CX3DImporter_NodeElement_IndexedSet*)ne);
|
||||
X3DIndexedSet& ne_alias = *((X3DIndexedSet*)ne);
|
||||
|
||||
ne_alias.CCW = ccw;
|
||||
ne_alias.ColorIndex = colorIndex;
|
||||
|
@ -934,7 +934,7 @@ void X3DImporter::ParseNode_Geometry3D_IndexedFaceSet()
|
|||
}// if(!mReader->isEmptyElement())
|
||||
else
|
||||
{
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
}
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
|
@ -952,7 +952,7 @@ void X3DImporter::ParseNode_Geometry3D_Sphere()
|
|||
std::string use, def;
|
||||
ai_real radius = 1;
|
||||
bool solid = true;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -972,23 +972,23 @@ void X3DImporter::ParseNode_Geometry3D_Sphere()
|
|||
std::vector<aiVector3D> tlist;
|
||||
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_Geometry3D(CX3DImporter_NodeElement::ENET_Sphere, NodeElement_Cur);
|
||||
ne = new X3DGeometry3D(X3DNodeElementBase::ENET_Sphere, mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
StandardShapes::MakeSphere(tess, tlist);
|
||||
// copy data from temp array and apply scale
|
||||
for(std::vector<aiVector3D>::iterator it = tlist.begin(); it != tlist.end(); ++it)
|
||||
{
|
||||
((CX3DImporter_NodeElement_Geometry3D*)ne)->Vertices.push_back(*it * radius);
|
||||
((X3DGeometry3D*)ne)->Vertices.push_back(*it * radius);
|
||||
}
|
||||
|
||||
((CX3DImporter_NodeElement_Geometry3D*)ne)->Solid = solid;
|
||||
((CX3DImporter_NodeElement_Geometry3D*)ne)->NumIndices = 3;
|
||||
((X3DGeometry3D*)ne)->Solid = solid;
|
||||
((X3DGeometry3D*)ne)->NumIndices = 3;
|
||||
// check for X3DMetadataObject childs.
|
||||
if(!mReader->isEmptyElement())
|
||||
ParseNode_Metadata(ne, "Sphere");
|
||||
else
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
}// if(!use.empty()) else
|
||||
|
|
|
@ -76,7 +76,7 @@ void X3DImporter::ParseNode_Grouping_Group()
|
|||
// if "USE" defined then find already defined element.
|
||||
if(!use.empty())
|
||||
{
|
||||
CX3DImporter_NodeElement* ne;
|
||||
X3DNodeElementBase* ne;
|
||||
|
||||
MACRO_USE_CHECKANDAPPLY(def, use, ENET_Group, ne);
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ void X3DImporter::ParseNode_Grouping_Group()
|
|||
{
|
||||
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()) mNodeElementCur->ID = 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
|
||||
|
@ -122,7 +122,7 @@ void X3DImporter::ParseNode_Grouping_StaticGroup()
|
|||
// if "USE" defined then find already defined element.
|
||||
if(!use.empty())
|
||||
{
|
||||
CX3DImporter_NodeElement* ne;
|
||||
X3DNodeElementBase* ne;
|
||||
|
||||
MACRO_USE_CHECKANDAPPLY(def, use, ENET_Group, ne);
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ void X3DImporter::ParseNode_Grouping_StaticGroup()
|
|||
{
|
||||
ParseHelper_Group_Begin(true);// 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()) mNodeElementCur->ID = 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
|
||||
|
@ -172,7 +172,7 @@ void X3DImporter::ParseNode_Grouping_Switch()
|
|||
// if "USE" defined then find already defined element.
|
||||
if(!use.empty())
|
||||
{
|
||||
CX3DImporter_NodeElement* ne;
|
||||
X3DNodeElementBase* ne;
|
||||
|
||||
MACRO_USE_CHECKANDAPPLY(def, use, ENET_Group, ne);
|
||||
}
|
||||
|
@ -180,11 +180,11 @@ void X3DImporter::ParseNode_Grouping_Switch()
|
|||
{
|
||||
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()) mNodeElementCur->ID = def;
|
||||
|
||||
// also set values specific to this type of group
|
||||
((CX3DImporter_NodeElement_Group*)NodeElement_Cur)->UseChoice = true;
|
||||
((CX3DImporter_NodeElement_Group*)NodeElement_Cur)->Choice = whichChoice;
|
||||
((X3DGroup*)mNodeElementCur)->UseChoice = true;
|
||||
((X3DGroup*)mNodeElementCur)->Choice = whichChoice;
|
||||
// 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
|
||||
|
@ -266,7 +266,7 @@ void X3DImporter::ParseNode_Grouping_Transform()
|
|||
// if "USE" defined then find already defined element.
|
||||
if(!use.empty())
|
||||
{
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_USE_CHECKANDAPPLY(def, use, ENET_Group, ne);
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ void X3DImporter::ParseNode_Grouping_Transform()
|
|||
// at this place new group mode created and made current, so we can name it.
|
||||
if ( !def.empty() )
|
||||
{
|
||||
NodeElement_Cur->ID = def;
|
||||
mNodeElementCur->ID = def;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -297,7 +297,7 @@ void X3DImporter::ParseNode_Grouping_Transform()
|
|||
aiMatrix4x4::Translation(-center, tmatr);// -C
|
||||
matr *= tmatr;
|
||||
// and assign it
|
||||
((CX3DImporter_NodeElement_Group*)NodeElement_Cur)->Transformation = matr;
|
||||
((X3DGroup*)mNodeElementCur)->Transformation = matr;
|
||||
// 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
|
||||
|
|
|
@ -71,7 +71,7 @@ void X3DImporter::ParseNode_Lighting_DirectionalLight()
|
|||
bool global = false;
|
||||
float intensity = 1;
|
||||
bool on = true;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -93,27 +93,27 @@ void X3DImporter::ParseNode_Lighting_DirectionalLight()
|
|||
if(on)
|
||||
{
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_Light(CX3DImporter_NodeElement::ENET_DirectionalLight, NodeElement_Cur);
|
||||
ne = new X3DLight(X3DNodeElementBase::ENET_DirectionalLight, mNodeElementCur);
|
||||
if(!def.empty())
|
||||
ne->ID = def;
|
||||
else
|
||||
ne->ID = "DirectionalLight_" + to_string((size_t)ne);// make random name
|
||||
|
||||
((CX3DImporter_NodeElement_Light*)ne)->AmbientIntensity = ambientIntensity;
|
||||
((CX3DImporter_NodeElement_Light*)ne)->Color = color;
|
||||
((CX3DImporter_NodeElement_Light*)ne)->Direction = direction;
|
||||
((CX3DImporter_NodeElement_Light*)ne)->Global = global;
|
||||
((CX3DImporter_NodeElement_Light*)ne)->Intensity = intensity;
|
||||
((X3DLight*)ne)->AmbientIntensity = ambientIntensity;
|
||||
((X3DLight*)ne)->Color = color;
|
||||
((X3DLight*)ne)->Direction = direction;
|
||||
((X3DLight*)ne)->Global = global;
|
||||
((X3DLight*)ne)->Intensity = intensity;
|
||||
// Assimp want a node with name similar to a light. "Why? I don't no." )
|
||||
ParseHelper_Group_Begin(false);
|
||||
|
||||
NodeElement_Cur->ID = ne->ID;// assign name to node and return to light element.
|
||||
mNodeElementCur->ID = ne->ID;// assign name to node and return to light element.
|
||||
ParseHelper_Node_Exit();
|
||||
// check for child nodes
|
||||
if(!mReader->isEmptyElement())
|
||||
ParseNode_Metadata(ne, "DirectionalLight");
|
||||
else
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
}// if(on)
|
||||
|
@ -143,7 +143,7 @@ void X3DImporter::ParseNode_Lighting_PointLight()
|
|||
aiVector3D location( 0, 0, 0 );
|
||||
bool on = true;
|
||||
float radius = 100;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -167,28 +167,28 @@ void X3DImporter::ParseNode_Lighting_PointLight()
|
|||
if(on)
|
||||
{
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_Light(CX3DImporter_NodeElement::ENET_PointLight, NodeElement_Cur);
|
||||
ne = new X3DLight(X3DNodeElementBase::ENET_PointLight, mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
((CX3DImporter_NodeElement_Light*)ne)->AmbientIntensity = ambientIntensity;
|
||||
((CX3DImporter_NodeElement_Light*)ne)->Attenuation = attenuation;
|
||||
((CX3DImporter_NodeElement_Light*)ne)->Color = color;
|
||||
((CX3DImporter_NodeElement_Light*)ne)->Global = global;
|
||||
((CX3DImporter_NodeElement_Light*)ne)->Intensity = intensity;
|
||||
((CX3DImporter_NodeElement_Light*)ne)->Location = location;
|
||||
((CX3DImporter_NodeElement_Light*)ne)->Radius = radius;
|
||||
((X3DLight*)ne)->AmbientIntensity = ambientIntensity;
|
||||
((X3DLight*)ne)->Attenuation = attenuation;
|
||||
((X3DLight*)ne)->Color = color;
|
||||
((X3DLight*)ne)->Global = global;
|
||||
((X3DLight*)ne)->Intensity = intensity;
|
||||
((X3DLight*)ne)->Location = location;
|
||||
((X3DLight*)ne)->Radius = radius;
|
||||
// Assimp want a node with name similar to a light. "Why? I don't no." )
|
||||
ParseHelper_Group_Begin(false);
|
||||
// make random name
|
||||
if(ne->ID.empty()) ne->ID = "PointLight_" + to_string((size_t)ne);
|
||||
|
||||
NodeElement_Cur->ID = ne->ID;// assign name to node and return to light element.
|
||||
mNodeElementCur->ID = ne->ID;// assign name to node and return to light element.
|
||||
ParseHelper_Node_Exit();
|
||||
// check for child nodes
|
||||
if(!mReader->isEmptyElement())
|
||||
ParseNode_Metadata(ne, "PointLight");
|
||||
else
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
}// if(on)
|
||||
|
@ -224,7 +224,7 @@ void X3DImporter::ParseNode_Lighting_SpotLight()
|
|||
aiVector3D location( 0, 0, 0 );
|
||||
bool on = true;
|
||||
float radius = 100;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -251,34 +251,34 @@ void X3DImporter::ParseNode_Lighting_SpotLight()
|
|||
if(on)
|
||||
{
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_Light(CX3DImporter_NodeElement::ENET_SpotLight, NodeElement_Cur);
|
||||
ne = new X3DLight(X3DNodeElementBase::ENET_SpotLight, mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
if(beamWidth > cutOffAngle) beamWidth = cutOffAngle;
|
||||
|
||||
((CX3DImporter_NodeElement_Light*)ne)->AmbientIntensity = ambientIntensity;
|
||||
((CX3DImporter_NodeElement_Light*)ne)->Attenuation = attenuation;
|
||||
((CX3DImporter_NodeElement_Light*)ne)->BeamWidth = beamWidth;
|
||||
((CX3DImporter_NodeElement_Light*)ne)->Color = color;
|
||||
((CX3DImporter_NodeElement_Light*)ne)->CutOffAngle = cutOffAngle;
|
||||
((CX3DImporter_NodeElement_Light*)ne)->Direction = direction;
|
||||
((CX3DImporter_NodeElement_Light*)ne)->Global = global;
|
||||
((CX3DImporter_NodeElement_Light*)ne)->Intensity = intensity;
|
||||
((CX3DImporter_NodeElement_Light*)ne)->Location = location;
|
||||
((CX3DImporter_NodeElement_Light*)ne)->Radius = radius;
|
||||
((X3DLight*)ne)->AmbientIntensity = ambientIntensity;
|
||||
((X3DLight*)ne)->Attenuation = attenuation;
|
||||
((X3DLight*)ne)->BeamWidth = beamWidth;
|
||||
((X3DLight*)ne)->Color = color;
|
||||
((X3DLight*)ne)->CutOffAngle = cutOffAngle;
|
||||
((X3DLight*)ne)->Direction = direction;
|
||||
((X3DLight*)ne)->Global = global;
|
||||
((X3DLight*)ne)->Intensity = intensity;
|
||||
((X3DLight*)ne)->Location = location;
|
||||
((X3DLight*)ne)->Radius = radius;
|
||||
|
||||
// Assimp want a node with name similar to a light. "Why? I don't no." )
|
||||
ParseHelper_Group_Begin(false);
|
||||
// make random name
|
||||
if(ne->ID.empty()) ne->ID = "SpotLight_" + to_string((size_t)ne);
|
||||
|
||||
NodeElement_Cur->ID = ne->ID;// assign name to node and return to light element.
|
||||
mNodeElementCur->ID = ne->ID;// assign name to node and return to light element.
|
||||
ParseHelper_Node_Exit();
|
||||
// check for child nodes
|
||||
if(!mReader->isEmptyElement())
|
||||
ParseNode_Metadata(ne, "SpotLight");
|
||||
else
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
}// if(on)
|
||||
|
|
|
@ -106,7 +106,7 @@ bool X3DImporter::ParseHelper_CheckRead_X3DMetadataObject()
|
|||
return true;
|
||||
}
|
||||
|
||||
void X3DImporter::ParseNode_Metadata(CX3DImporter_NodeElement* pParentElement, const std::string& /*pNodeName*/)
|
||||
void X3DImporter::ParseNode_Metadata(X3DNodeElementBase* pParentElement, const std::string& /*pNodeName*/)
|
||||
{
|
||||
ParseHelper_Node_Enter(pParentElement);
|
||||
MACRO_NODECHECK_METADATA(mReader->getNodeName());
|
||||
|
@ -125,7 +125,7 @@ void X3DImporter::ParseNode_MetadataBoolean()
|
|||
std::string def, use;
|
||||
std::string name, reference;
|
||||
std::vector<bool> value;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -134,7 +134,7 @@ void X3DImporter::ParseNode_MetadataBoolean()
|
|||
MACRO_ATTRREAD_CHECK_REF("value", value, XML_ReadNode_GetAttrVal_AsArrB);
|
||||
MACRO_ATTRREAD_LOOPEND;
|
||||
|
||||
MACRO_METADATA_FINDCREATE(def, use, reference, value, ne, CX3DImporter_NodeElement_MetaBoolean, "MetadataBoolean", ENET_MetaBoolean);
|
||||
MACRO_METADATA_FINDCREATE(def, use, reference, value, ne, X3DMetaBoolean, "MetadataBoolean", ENET_MetaBoolean);
|
||||
}
|
||||
|
||||
// <MetadataDouble
|
||||
|
@ -149,7 +149,7 @@ void X3DImporter::ParseNode_MetadataDouble()
|
|||
std::string def, use;
|
||||
std::string name, reference;
|
||||
std::vector<double> value;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -158,7 +158,7 @@ void X3DImporter::ParseNode_MetadataDouble()
|
|||
MACRO_ATTRREAD_CHECK_REF("value", value, XML_ReadNode_GetAttrVal_AsArrD);
|
||||
MACRO_ATTRREAD_LOOPEND;
|
||||
|
||||
MACRO_METADATA_FINDCREATE(def, use, reference, value, ne, CX3DImporter_NodeElement_MetaDouble, "MetadataDouble", ENET_MetaDouble);
|
||||
MACRO_METADATA_FINDCREATE(def, use, reference, value, ne, X3DMetaDouble, "MetadataDouble", ENET_MetaDouble);
|
||||
}
|
||||
|
||||
// <MetadataFloat
|
||||
|
@ -173,7 +173,7 @@ void X3DImporter::ParseNode_MetadataFloat()
|
|||
std::string def, use;
|
||||
std::string name, reference;
|
||||
std::vector<float> value;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -182,7 +182,7 @@ void X3DImporter::ParseNode_MetadataFloat()
|
|||
MACRO_ATTRREAD_CHECK_REF("value", value, XML_ReadNode_GetAttrVal_AsArrF);
|
||||
MACRO_ATTRREAD_LOOPEND;
|
||||
|
||||
MACRO_METADATA_FINDCREATE(def, use, reference, value, ne, CX3DImporter_NodeElement_MetaFloat, "MetadataFloat", ENET_MetaFloat);
|
||||
MACRO_METADATA_FINDCREATE(def, use, reference, value, ne, X3DMetaFloat, "MetadataFloat", ENET_MetaFloat);
|
||||
}
|
||||
|
||||
// <MetadataInteger
|
||||
|
@ -197,7 +197,7 @@ void X3DImporter::ParseNode_MetadataInteger()
|
|||
std::string def, use;
|
||||
std::string name, reference;
|
||||
std::vector<int32_t> value;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -206,7 +206,7 @@ void X3DImporter::ParseNode_MetadataInteger()
|
|||
MACRO_ATTRREAD_CHECK_REF("value", value, XML_ReadNode_GetAttrVal_AsArrI32);
|
||||
MACRO_ATTRREAD_LOOPEND;
|
||||
|
||||
MACRO_METADATA_FINDCREATE(def, use, reference, value, ne, CX3DImporter_NodeElement_MetaInteger, "MetadataInteger", ENET_MetaInteger);
|
||||
MACRO_METADATA_FINDCREATE(def, use, reference, value, ne, X3DMetaInteger, "MetadataInteger", ENET_MetaInteger);
|
||||
}
|
||||
|
||||
// <MetadataSet
|
||||
|
@ -219,7 +219,7 @@ void X3DImporter::ParseNode_MetadataSet()
|
|||
{
|
||||
std::string def, use;
|
||||
std::string name, reference;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -234,15 +234,15 @@ void X3DImporter::ParseNode_MetadataSet()
|
|||
}
|
||||
else
|
||||
{
|
||||
ne = new CX3DImporter_NodeElement_MetaSet(NodeElement_Cur);
|
||||
ne = new X3DMetaSet(mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
((CX3DImporter_NodeElement_MetaSet*)ne)->Reference = reference;
|
||||
((X3DMetaSet*)ne)->Reference = reference;
|
||||
// also metadata node can contain childs
|
||||
if(!mReader->isEmptyElement())
|
||||
ParseNode_Metadata(ne, "MetadataSet");
|
||||
else
|
||||
NodeElement_Cur->Child.push_back(ne);// made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// made object as child to current element
|
||||
|
||||
NodeElement_List.push_back(ne);// add new element to elements list.
|
||||
}// if(!use.empty()) else
|
||||
|
@ -260,7 +260,7 @@ void X3DImporter::ParseNode_MetadataString()
|
|||
std::string def, use;
|
||||
std::string name, reference;
|
||||
std::list<std::string> value;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -269,7 +269,7 @@ void X3DImporter::ParseNode_MetadataString()
|
|||
MACRO_ATTRREAD_CHECK_REF("value", value, XML_ReadNode_GetAttrVal_AsListS);
|
||||
MACRO_ATTRREAD_LOOPEND;
|
||||
|
||||
MACRO_METADATA_FINDCREATE(def, use, reference, value, ne, CX3DImporter_NodeElement_MetaString, "MetadataString", ENET_MetaString);
|
||||
MACRO_METADATA_FINDCREATE(def, use, reference, value, ne, X3DMetaString, "MetadataString", ENET_MetaString);
|
||||
}
|
||||
|
||||
}// namespace Assimp
|
||||
|
|
|
@ -83,7 +83,7 @@ void X3DImporter::ParseNode_Networking_Inline()
|
|||
// if "USE" defined then find already defined element.
|
||||
if(!use.empty())
|
||||
{
|
||||
CX3DImporter_NodeElement* ne;
|
||||
X3DNodeElementBase* ne;
|
||||
|
||||
MACRO_USE_CHECKANDAPPLY(def, use, ENET_Group, ne);
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ void X3DImporter::ParseNode_Networking_Inline()
|
|||
{
|
||||
ParseHelper_Group_Begin(true);// 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()) mNodeElementCur->ID = def;
|
||||
|
||||
if(load && !url.empty())
|
||||
{
|
||||
|
@ -122,7 +122,7 @@ void X3DImporter::ParseNode_Networking_Inline()
|
|||
}
|
||||
|
||||
// check for X3DMetadataObject childs.
|
||||
if(!mReader->isEmptyElement()) ParseNode_Metadata(NodeElement_Cur, "Inline");
|
||||
if(!mReader->isEmptyElement()) ParseNode_Metadata(mNodeElementCur, "Inline");
|
||||
|
||||
// exit from node in that place
|
||||
ParseHelper_Node_Exit();
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -63,18 +63,18 @@ namespace Assimp
|
|||
|
||||
aiMatrix4x4 X3DImporter::PostprocessHelper_Matrix_GlobalToCurrent() const
|
||||
{
|
||||
CX3DImporter_NodeElement* cur_node;
|
||||
X3DNodeElementBase* cur_node;
|
||||
std::list<aiMatrix4x4> matr;
|
||||
aiMatrix4x4 out_matr;
|
||||
|
||||
// starting walk from current element to root
|
||||
cur_node = NodeElement_Cur;
|
||||
cur_node = mNodeElementCur;
|
||||
if(cur_node != nullptr)
|
||||
{
|
||||
do
|
||||
{
|
||||
// if cur_node is group then store group transformation matrix in list.
|
||||
if(cur_node->Type == CX3DImporter_NodeElement::ENET_Group) matr.push_back(((CX3DImporter_NodeElement_Group*)cur_node)->Transformation);
|
||||
if(cur_node->Type == X3DNodeElementBase::ENET_Group) matr.push_back(((X3DGroup*)cur_node)->Transformation);
|
||||
|
||||
cur_node = cur_node->Parent;
|
||||
} while(cur_node != nullptr);
|
||||
|
@ -86,29 +86,29 @@ aiMatrix4x4 X3DImporter::PostprocessHelper_Matrix_GlobalToCurrent() const
|
|||
return out_matr;
|
||||
}
|
||||
|
||||
void X3DImporter::PostprocessHelper_CollectMetadata(const CX3DImporter_NodeElement& pNodeElement, std::list<CX3DImporter_NodeElement*>& pList) const
|
||||
void X3DImporter::PostprocessHelper_CollectMetadata(const X3DNodeElementBase& pNodeElement, std::list<X3DNodeElementBase*>& pList) const
|
||||
{
|
||||
// walk through childs and find for metadata.
|
||||
for(std::list<CX3DImporter_NodeElement*>::const_iterator el_it = pNodeElement.Child.begin(); el_it != pNodeElement.Child.end(); ++el_it)
|
||||
for(std::list<X3DNodeElementBase*>::const_iterator el_it = pNodeElement.Child.begin(); el_it != pNodeElement.Child.end(); ++el_it)
|
||||
{
|
||||
if(((*el_it)->Type == CX3DImporter_NodeElement::ENET_MetaBoolean) || ((*el_it)->Type == CX3DImporter_NodeElement::ENET_MetaDouble) ||
|
||||
((*el_it)->Type == CX3DImporter_NodeElement::ENET_MetaFloat) || ((*el_it)->Type == CX3DImporter_NodeElement::ENET_MetaInteger) ||
|
||||
((*el_it)->Type == CX3DImporter_NodeElement::ENET_MetaString))
|
||||
if(((*el_it)->Type == X3DNodeElementBase::ENET_MetaBoolean) || ((*el_it)->Type == X3DNodeElementBase::ENET_MetaDouble) ||
|
||||
((*el_it)->Type == X3DNodeElementBase::ENET_MetaFloat) || ((*el_it)->Type == X3DNodeElementBase::ENET_MetaInteger) ||
|
||||
((*el_it)->Type == X3DNodeElementBase::ENET_MetaString))
|
||||
{
|
||||
pList.push_back(*el_it);
|
||||
}
|
||||
else if((*el_it)->Type == CX3DImporter_NodeElement::ENET_MetaSet)
|
||||
else if((*el_it)->Type == X3DNodeElementBase::ENET_MetaSet)
|
||||
{
|
||||
PostprocessHelper_CollectMetadata(**el_it, pList);
|
||||
}
|
||||
}// for(std::list<CX3DImporter_NodeElement*>::const_iterator el_it = pNodeElement.Child.begin(); el_it != pNodeElement.Child.end(); el_it++)
|
||||
}
|
||||
|
||||
bool X3DImporter::PostprocessHelper_ElementIsMetadata(const CX3DImporter_NodeElement::EType pType) const
|
||||
bool X3DImporter::PostprocessHelper_ElementIsMetadata(const X3DNodeElementBase::EType pType) const
|
||||
{
|
||||
if((pType == CX3DImporter_NodeElement::ENET_MetaBoolean) || (pType == CX3DImporter_NodeElement::ENET_MetaDouble) ||
|
||||
(pType == CX3DImporter_NodeElement::ENET_MetaFloat) || (pType == CX3DImporter_NodeElement::ENET_MetaInteger) ||
|
||||
(pType == CX3DImporter_NodeElement::ENET_MetaString) || (pType == CX3DImporter_NodeElement::ENET_MetaSet))
|
||||
if((pType == X3DNodeElementBase::ENET_MetaBoolean) || (pType == X3DNodeElementBase::ENET_MetaDouble) ||
|
||||
(pType == X3DNodeElementBase::ENET_MetaFloat) || (pType == X3DNodeElementBase::ENET_MetaInteger) ||
|
||||
(pType == X3DNodeElementBase::ENET_MetaString) || (pType == X3DNodeElementBase::ENET_MetaSet))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -118,20 +118,20 @@ bool X3DImporter::PostprocessHelper_ElementIsMetadata(const CX3DImporter_NodeEle
|
|||
}
|
||||
}
|
||||
|
||||
bool X3DImporter::PostprocessHelper_ElementIsMesh(const CX3DImporter_NodeElement::EType pType) const
|
||||
bool X3DImporter::PostprocessHelper_ElementIsMesh(const X3DNodeElementBase::EType pType) const
|
||||
{
|
||||
if((pType == CX3DImporter_NodeElement::ENET_Arc2D) || (pType == CX3DImporter_NodeElement::ENET_ArcClose2D) ||
|
||||
(pType == CX3DImporter_NodeElement::ENET_Box) || (pType == CX3DImporter_NodeElement::ENET_Circle2D) ||
|
||||
(pType == CX3DImporter_NodeElement::ENET_Cone) || (pType == CX3DImporter_NodeElement::ENET_Cylinder) ||
|
||||
(pType == CX3DImporter_NodeElement::ENET_Disk2D) || (pType == CX3DImporter_NodeElement::ENET_ElevationGrid) ||
|
||||
(pType == CX3DImporter_NodeElement::ENET_Extrusion) || (pType == CX3DImporter_NodeElement::ENET_IndexedFaceSet) ||
|
||||
(pType == CX3DImporter_NodeElement::ENET_IndexedLineSet) || (pType == CX3DImporter_NodeElement::ENET_IndexedTriangleFanSet) ||
|
||||
(pType == CX3DImporter_NodeElement::ENET_IndexedTriangleSet) || (pType == CX3DImporter_NodeElement::ENET_IndexedTriangleStripSet) ||
|
||||
(pType == CX3DImporter_NodeElement::ENET_PointSet) || (pType == CX3DImporter_NodeElement::ENET_LineSet) ||
|
||||
(pType == CX3DImporter_NodeElement::ENET_Polyline2D) || (pType == CX3DImporter_NodeElement::ENET_Polypoint2D) ||
|
||||
(pType == CX3DImporter_NodeElement::ENET_Rectangle2D) || (pType == CX3DImporter_NodeElement::ENET_Sphere) ||
|
||||
(pType == CX3DImporter_NodeElement::ENET_TriangleFanSet) || (pType == CX3DImporter_NodeElement::ENET_TriangleSet) ||
|
||||
(pType == CX3DImporter_NodeElement::ENET_TriangleSet2D) || (pType == CX3DImporter_NodeElement::ENET_TriangleStripSet))
|
||||
if((pType == X3DNodeElementBase::ENET_Arc2D) || (pType == X3DNodeElementBase::ENET_ArcClose2D) ||
|
||||
(pType == X3DNodeElementBase::ENET_Box) || (pType == X3DNodeElementBase::ENET_Circle2D) ||
|
||||
(pType == X3DNodeElementBase::ENET_Cone) || (pType == X3DNodeElementBase::ENET_Cylinder) ||
|
||||
(pType == X3DNodeElementBase::ENET_Disk2D) || (pType == X3DNodeElementBase::ENET_ElevationGrid) ||
|
||||
(pType == X3DNodeElementBase::ENET_Extrusion) || (pType == X3DNodeElementBase::ENET_IndexedFaceSet) ||
|
||||
(pType == X3DNodeElementBase::ENET_IndexedLineSet) || (pType == X3DNodeElementBase::ENET_IndexedTriangleFanSet) ||
|
||||
(pType == X3DNodeElementBase::ENET_IndexedTriangleSet) || (pType == X3DNodeElementBase::ENET_IndexedTriangleStripSet) ||
|
||||
(pType == X3DNodeElementBase::ENET_PointSet) || (pType == X3DNodeElementBase::ENET_LineSet) ||
|
||||
(pType == X3DNodeElementBase::ENET_Polyline2D) || (pType == X3DNodeElementBase::ENET_Polypoint2D) ||
|
||||
(pType == X3DNodeElementBase::ENET_Rectangle2D) || (pType == X3DNodeElementBase::ENET_Sphere) ||
|
||||
(pType == X3DNodeElementBase::ENET_TriangleFanSet) || (pType == X3DNodeElementBase::ENET_TriangleSet) ||
|
||||
(pType == X3DNodeElementBase::ENET_TriangleSet2D) || (pType == X3DNodeElementBase::ENET_TriangleStripSet))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -141,9 +141,9 @@ bool X3DImporter::PostprocessHelper_ElementIsMesh(const CX3DImporter_NodeElement
|
|||
}
|
||||
}
|
||||
|
||||
void X3DImporter::Postprocess_BuildLight(const CX3DImporter_NodeElement& pNodeElement, std::list<aiLight*>& pSceneLightList) const
|
||||
void X3DImporter::Postprocess_BuildLight(const X3DNodeElementBase& pNodeElement, std::list<aiLight*>& pSceneLightList) const
|
||||
{
|
||||
const CX3DImporter_NodeElement_Light& ne = *( ( CX3DImporter_NodeElement_Light* ) &pNodeElement );
|
||||
const X3DLight& ne = *( ( X3DLight* ) &pNodeElement );
|
||||
aiMatrix4x4 transform_matr = PostprocessHelper_Matrix_GlobalToCurrent();
|
||||
aiLight* new_light = new aiLight;
|
||||
|
||||
|
@ -153,12 +153,12 @@ void X3DImporter::Postprocess_BuildLight(const CX3DImporter_NodeElement& pNodeEl
|
|||
new_light->mColorSpecular = ne.Color * ne.Intensity;
|
||||
switch(pNodeElement.Type)
|
||||
{
|
||||
case CX3DImporter_NodeElement::ENET_DirectionalLight:
|
||||
case X3DNodeElementBase::ENET_DirectionalLight:
|
||||
new_light->mType = aiLightSource_DIRECTIONAL;
|
||||
new_light->mDirection = ne.Direction, new_light->mDirection *= transform_matr;
|
||||
|
||||
break;
|
||||
case CX3DImporter_NodeElement::ENET_PointLight:
|
||||
case X3DNodeElementBase::ENET_PointLight:
|
||||
new_light->mType = aiLightSource_POINT;
|
||||
new_light->mPosition = ne.Location, new_light->mPosition *= transform_matr;
|
||||
new_light->mAttenuationConstant = ne.Attenuation.x;
|
||||
|
@ -166,7 +166,7 @@ void X3DImporter::Postprocess_BuildLight(const CX3DImporter_NodeElement& pNodeEl
|
|||
new_light->mAttenuationQuadratic = ne.Attenuation.z;
|
||||
|
||||
break;
|
||||
case CX3DImporter_NodeElement::ENET_SpotLight:
|
||||
case X3DNodeElementBase::ENET_SpotLight:
|
||||
new_light->mType = aiLightSource_SPOT;
|
||||
new_light->mPosition = ne.Location, new_light->mPosition *= transform_matr;
|
||||
new_light->mDirection = ne.Direction, new_light->mDirection *= transform_matr;
|
||||
|
@ -184,7 +184,7 @@ void X3DImporter::Postprocess_BuildLight(const CX3DImporter_NodeElement& pNodeEl
|
|||
pSceneLightList.push_back(new_light);
|
||||
}
|
||||
|
||||
void X3DImporter::Postprocess_BuildMaterial(const CX3DImporter_NodeElement& pNodeElement, aiMaterial** pMaterial) const
|
||||
void X3DImporter::Postprocess_BuildMaterial(const X3DNodeElementBase& pNodeElement, aiMaterial** pMaterial) const
|
||||
{
|
||||
// check argument
|
||||
if(pMaterial == nullptr) throw DeadlyImportError("Postprocess_BuildMaterial. pMaterial is nullptr.");
|
||||
|
@ -194,13 +194,13 @@ void X3DImporter::Postprocess_BuildMaterial(const CX3DImporter_NodeElement& pNod
|
|||
aiMaterial& taimat = **pMaterial;// creating alias for convenience.
|
||||
|
||||
// at this point pNodeElement point to <Appearance> node. Walk through childs and add all stored data.
|
||||
for(std::list<CX3DImporter_NodeElement*>::const_iterator el_it = pNodeElement.Child.begin(); el_it != pNodeElement.Child.end(); ++el_it)
|
||||
for(std::list<X3DNodeElementBase*>::const_iterator el_it = pNodeElement.Child.begin(); el_it != pNodeElement.Child.end(); ++el_it)
|
||||
{
|
||||
if((*el_it)->Type == CX3DImporter_NodeElement::ENET_Material)
|
||||
if((*el_it)->Type == X3DNodeElementBase::ENET_Material)
|
||||
{
|
||||
aiColor3D tcol3;
|
||||
float tvalf;
|
||||
CX3DImporter_NodeElement_Material& tnemat = *((CX3DImporter_NodeElement_Material*)*el_it);
|
||||
X3DMaterial& tnemat = *((X3DMaterial*)*el_it);
|
||||
|
||||
tcol3.r = tnemat.AmbientIntensity, tcol3.g = tnemat.AmbientIntensity, tcol3.b = tnemat.AmbientIntensity;
|
||||
taimat.AddProperty(&tcol3, 1, AI_MATKEY_COLOR_AMBIENT);
|
||||
|
@ -213,9 +213,9 @@ void X3DImporter::Postprocess_BuildMaterial(const CX3DImporter_NodeElement& pNod
|
|||
tvalf = 1.0f - tnemat.Transparency;
|
||||
taimat.AddProperty(&tvalf, 1, AI_MATKEY_OPACITY);
|
||||
}// if((*el_it)->Type == CX3DImporter_NodeElement::ENET_Material)
|
||||
else if((*el_it)->Type == CX3DImporter_NodeElement::ENET_ImageTexture)
|
||||
else if((*el_it)->Type == X3DNodeElementBase::ENET_ImageTexture)
|
||||
{
|
||||
CX3DImporter_NodeElement_ImageTexture& tnetex = *((CX3DImporter_NodeElement_ImageTexture*)*el_it);
|
||||
X3DImageTexture& tnetex = *((X3DImageTexture*)*el_it);
|
||||
aiString url_str(tnetex.URL.c_str());
|
||||
int mode = aiTextureOp_Multiply;
|
||||
|
||||
|
@ -224,10 +224,10 @@ void X3DImporter::Postprocess_BuildMaterial(const CX3DImporter_NodeElement& pNod
|
|||
taimat.AddProperty(&tnetex.RepeatT, 1, AI_MATKEY_MAPPINGMODE_V_DIFFUSE(0));
|
||||
taimat.AddProperty(&mode, 1, AI_MATKEY_TEXOP_DIFFUSE(0));
|
||||
}// else if((*el_it)->Type == CX3DImporter_NodeElement::ENET_ImageTexture)
|
||||
else if((*el_it)->Type == CX3DImporter_NodeElement::ENET_TextureTransform)
|
||||
else if((*el_it)->Type == X3DNodeElementBase::ENET_TextureTransform)
|
||||
{
|
||||
aiUVTransform trans;
|
||||
CX3DImporter_NodeElement_TextureTransform& tnetextr = *((CX3DImporter_NodeElement_TextureTransform*)*el_it);
|
||||
X3DTextureTransform& tnetextr = *((X3DTextureTransform*)*el_it);
|
||||
|
||||
trans.mTranslation = tnetextr.Translation - tnetextr.Center;
|
||||
trans.mScaling = tnetextr.Scale;
|
||||
|
@ -237,7 +237,7 @@ void X3DImporter::Postprocess_BuildMaterial(const CX3DImporter_NodeElement& pNod
|
|||
}// for(std::list<CX3DImporter_NodeElement*>::const_iterator el_it = pNodeElement.Child.begin(); el_it != pNodeElement.Child.end(); el_it++)
|
||||
}
|
||||
|
||||
void X3DImporter::Postprocess_BuildMesh(const CX3DImporter_NodeElement& pNodeElement, aiMesh** pMesh) const
|
||||
void X3DImporter::Postprocess_BuildMesh(const X3DNodeElementBase& pNodeElement, aiMesh** pMesh) const
|
||||
{
|
||||
// check argument
|
||||
if(pMesh == nullptr) throw DeadlyImportError("Postprocess_BuildMesh. pMesh is nullptr.");
|
||||
|
@ -246,12 +246,12 @@ void X3DImporter::Postprocess_BuildMesh(const CX3DImporter_NodeElement& pNodeEle
|
|||
/************************************************************************************************************************************/
|
||||
/************************************************************ Geometry2D ************************************************************/
|
||||
/************************************************************************************************************************************/
|
||||
if((pNodeElement.Type == CX3DImporter_NodeElement::ENET_Arc2D) || (pNodeElement.Type == CX3DImporter_NodeElement::ENET_ArcClose2D) ||
|
||||
(pNodeElement.Type == CX3DImporter_NodeElement::ENET_Circle2D) || (pNodeElement.Type == CX3DImporter_NodeElement::ENET_Disk2D) ||
|
||||
(pNodeElement.Type == CX3DImporter_NodeElement::ENET_Polyline2D) || (pNodeElement.Type == CX3DImporter_NodeElement::ENET_Polypoint2D) ||
|
||||
(pNodeElement.Type == CX3DImporter_NodeElement::ENET_Rectangle2D) || (pNodeElement.Type == CX3DImporter_NodeElement::ENET_TriangleSet2D))
|
||||
if((pNodeElement.Type == X3DNodeElementBase::ENET_Arc2D) || (pNodeElement.Type == X3DNodeElementBase::ENET_ArcClose2D) ||
|
||||
(pNodeElement.Type == X3DNodeElementBase::ENET_Circle2D) || (pNodeElement.Type == X3DNodeElementBase::ENET_Disk2D) ||
|
||||
(pNodeElement.Type == X3DNodeElementBase::ENET_Polyline2D) || (pNodeElement.Type == X3DNodeElementBase::ENET_Polypoint2D) ||
|
||||
(pNodeElement.Type == X3DNodeElementBase::ENET_Rectangle2D) || (pNodeElement.Type == X3DNodeElementBase::ENET_TriangleSet2D))
|
||||
{
|
||||
CX3DImporter_NodeElement_Geometry2D& tnemesh = *((CX3DImporter_NodeElement_Geometry2D*)&pNodeElement);// create alias for convenience
|
||||
X3DGeometry2D& tnemesh = *((X3DGeometry2D*)&pNodeElement);// create alias for convenience
|
||||
std::vector<aiVector3D> tarr;
|
||||
|
||||
tarr.reserve(tnemesh.Vertices.size());
|
||||
|
@ -266,10 +266,10 @@ void X3DImporter::Postprocess_BuildMesh(const CX3DImporter_NodeElement& pNodeEle
|
|||
//
|
||||
// Predefined figures
|
||||
//
|
||||
if((pNodeElement.Type == CX3DImporter_NodeElement::ENET_Box) || (pNodeElement.Type == CX3DImporter_NodeElement::ENET_Cone) ||
|
||||
(pNodeElement.Type == CX3DImporter_NodeElement::ENET_Cylinder) || (pNodeElement.Type == CX3DImporter_NodeElement::ENET_Sphere))
|
||||
if((pNodeElement.Type == X3DNodeElementBase::ENET_Box) || (pNodeElement.Type == X3DNodeElementBase::ENET_Cone) ||
|
||||
(pNodeElement.Type == X3DNodeElementBase::ENET_Cylinder) || (pNodeElement.Type == X3DNodeElementBase::ENET_Sphere))
|
||||
{
|
||||
CX3DImporter_NodeElement_Geometry3D& tnemesh = *((CX3DImporter_NodeElement_Geometry3D*)&pNodeElement);// create alias for convenience
|
||||
X3DGeometry3D& tnemesh = *((X3DGeometry3D*)&pNodeElement);// create alias for convenience
|
||||
std::vector<aiVector3D> tarr;
|
||||
|
||||
tarr.reserve(tnemesh.Vertices.size());
|
||||
|
@ -282,23 +282,23 @@ void X3DImporter::Postprocess_BuildMesh(const CX3DImporter_NodeElement& pNodeEle
|
|||
//
|
||||
// Parametric figures
|
||||
//
|
||||
if(pNodeElement.Type == CX3DImporter_NodeElement::ENET_ElevationGrid)
|
||||
if(pNodeElement.Type == X3DNodeElementBase::ENET_ElevationGrid)
|
||||
{
|
||||
CX3DImporter_NodeElement_ElevationGrid& tnemesh = *((CX3DImporter_NodeElement_ElevationGrid*)&pNodeElement);// create alias for convenience
|
||||
X3DElevationGrid& tnemesh = *((X3DElevationGrid*)&pNodeElement);// create alias for convenience
|
||||
|
||||
// at first create mesh from existing vertices.
|
||||
*pMesh = GeometryHelper_MakeMesh(tnemesh.CoordIdx, tnemesh.Vertices);
|
||||
// copy additional information from children
|
||||
for(std::list<CX3DImporter_NodeElement*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
for(std::list<X3DNodeElementBase*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
{
|
||||
if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Color)
|
||||
MeshGeometry_AddColor(**pMesh, ((CX3DImporter_NodeElement_Color*)*ch_it)->Value, tnemesh.ColorPerVertex);
|
||||
else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_ColorRGBA)
|
||||
MeshGeometry_AddColor(**pMesh, ((CX3DImporter_NodeElement_ColorRGBA*)*ch_it)->Value, tnemesh.ColorPerVertex);
|
||||
else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Normal)
|
||||
MeshGeometry_AddNormal(**pMesh, ((CX3DImporter_NodeElement_Normal*)*ch_it)->Value, tnemesh.NormalPerVertex);
|
||||
else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_TextureCoordinate)
|
||||
MeshGeometry_AddTexCoord(**pMesh, ((CX3DImporter_NodeElement_TextureCoordinate*)*ch_it)->Value);
|
||||
if((*ch_it)->Type == X3DNodeElementBase::ENET_Color)
|
||||
MeshGeometry_AddColor(**pMesh, ((X3DColor*)*ch_it)->Value, tnemesh.ColorPerVertex);
|
||||
else if((*ch_it)->Type == X3DNodeElementBase::ENET_ColorRGBA)
|
||||
MeshGeometry_AddColor(**pMesh, ((X3DColorRGBA*)*ch_it)->Value, tnemesh.ColorPerVertex);
|
||||
else if((*ch_it)->Type == X3DNodeElementBase::ENET_Normal)
|
||||
MeshGeometry_AddNormal(**pMesh, ((X3DNormal*)*ch_it)->Value, tnemesh.NormalPerVertex);
|
||||
else if((*ch_it)->Type == X3DNodeElementBase::ENET_TextureCoordinate)
|
||||
MeshGeometry_AddTexCoord(**pMesh, ((X3DTextureCoordinate*)*ch_it)->Value);
|
||||
else
|
||||
throw DeadlyImportError("Postprocess_BuildMesh. Unknown child of ElevationGrid: " + to_string((*ch_it)->Type) + ".");
|
||||
}// for(std::list<CX3DImporter_NodeElement*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
|
@ -308,34 +308,34 @@ void X3DImporter::Postprocess_BuildMesh(const CX3DImporter_NodeElement& pNodeEle
|
|||
//
|
||||
// Indexed primitives sets
|
||||
//
|
||||
if(pNodeElement.Type == CX3DImporter_NodeElement::ENET_IndexedFaceSet)
|
||||
if(pNodeElement.Type == X3DNodeElementBase::ENET_IndexedFaceSet)
|
||||
{
|
||||
CX3DImporter_NodeElement_IndexedSet& tnemesh = *((CX3DImporter_NodeElement_IndexedSet*)&pNodeElement);// create alias for convenience
|
||||
X3DIndexedSet& tnemesh = *((X3DIndexedSet*)&pNodeElement);// create alias for convenience
|
||||
|
||||
// at first search for <Coordinate> node and create mesh.
|
||||
for(std::list<CX3DImporter_NodeElement*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
for(std::list<X3DNodeElementBase*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
{
|
||||
if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Coordinate)
|
||||
if((*ch_it)->Type == X3DNodeElementBase::ENET_Coordinate)
|
||||
{
|
||||
*pMesh = GeometryHelper_MakeMesh(tnemesh.CoordIndex, ((CX3DImporter_NodeElement_Coordinate*)*ch_it)->Value);
|
||||
*pMesh = GeometryHelper_MakeMesh(tnemesh.CoordIndex, ((X3DCoordinate*)*ch_it)->Value);
|
||||
}
|
||||
}
|
||||
|
||||
// copy additional information from children
|
||||
for(std::list<CX3DImporter_NodeElement*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
for(std::list<X3DNodeElementBase*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
{
|
||||
if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Color)
|
||||
MeshGeometry_AddColor(**pMesh, tnemesh.CoordIndex, tnemesh.ColorIndex, ((CX3DImporter_NodeElement_Color*)*ch_it)->Value, tnemesh.ColorPerVertex);
|
||||
else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_ColorRGBA)
|
||||
MeshGeometry_AddColor(**pMesh, tnemesh.CoordIndex, tnemesh.ColorIndex, ((CX3DImporter_NodeElement_ColorRGBA*)*ch_it)->Value,
|
||||
if((*ch_it)->Type == X3DNodeElementBase::ENET_Color)
|
||||
MeshGeometry_AddColor(**pMesh, tnemesh.CoordIndex, tnemesh.ColorIndex, ((X3DColor*)*ch_it)->Value, tnemesh.ColorPerVertex);
|
||||
else if((*ch_it)->Type == X3DNodeElementBase::ENET_ColorRGBA)
|
||||
MeshGeometry_AddColor(**pMesh, tnemesh.CoordIndex, tnemesh.ColorIndex, ((X3DColorRGBA*)*ch_it)->Value,
|
||||
tnemesh.ColorPerVertex);
|
||||
else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Coordinate)
|
||||
else if((*ch_it)->Type == X3DNodeElementBase::ENET_Coordinate)
|
||||
{} // skip because already read when mesh created.
|
||||
else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Normal)
|
||||
MeshGeometry_AddNormal(**pMesh, tnemesh.CoordIndex, tnemesh.NormalIndex, ((CX3DImporter_NodeElement_Normal*)*ch_it)->Value,
|
||||
else if((*ch_it)->Type == X3DNodeElementBase::ENET_Normal)
|
||||
MeshGeometry_AddNormal(**pMesh, tnemesh.CoordIndex, tnemesh.NormalIndex, ((X3DNormal*)*ch_it)->Value,
|
||||
tnemesh.NormalPerVertex);
|
||||
else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_TextureCoordinate)
|
||||
MeshGeometry_AddTexCoord(**pMesh, tnemesh.CoordIndex, tnemesh.TexCoordIndex, ((CX3DImporter_NodeElement_TextureCoordinate*)*ch_it)->Value);
|
||||
else if((*ch_it)->Type == X3DNodeElementBase::ENET_TextureCoordinate)
|
||||
MeshGeometry_AddTexCoord(**pMesh, tnemesh.CoordIndex, tnemesh.TexCoordIndex, ((X3DTextureCoordinate*)*ch_it)->Value);
|
||||
else
|
||||
throw DeadlyImportError("Postprocess_BuildMesh. Unknown child of IndexedFaceSet: " + to_string((*ch_it)->Type) + ".");
|
||||
}// for(std::list<CX3DImporter_NodeElement*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
|
@ -343,29 +343,29 @@ void X3DImporter::Postprocess_BuildMesh(const CX3DImporter_NodeElement& pNodeEle
|
|||
return;// mesh is build, nothing to do anymore.
|
||||
}// if(pNodeElement.Type == CX3DImporter_NodeElement::ENET_IndexedFaceSet)
|
||||
|
||||
if(pNodeElement.Type == CX3DImporter_NodeElement::ENET_IndexedLineSet)
|
||||
if(pNodeElement.Type == X3DNodeElementBase::ENET_IndexedLineSet)
|
||||
{
|
||||
CX3DImporter_NodeElement_IndexedSet& tnemesh = *((CX3DImporter_NodeElement_IndexedSet*)&pNodeElement);// create alias for convenience
|
||||
X3DIndexedSet& tnemesh = *((X3DIndexedSet*)&pNodeElement);// create alias for convenience
|
||||
|
||||
// at first search for <Coordinate> node and create mesh.
|
||||
for(std::list<CX3DImporter_NodeElement*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
for(std::list<X3DNodeElementBase*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
{
|
||||
if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Coordinate)
|
||||
if((*ch_it)->Type == X3DNodeElementBase::ENET_Coordinate)
|
||||
{
|
||||
*pMesh = GeometryHelper_MakeMesh(tnemesh.CoordIndex, ((CX3DImporter_NodeElement_Coordinate*)*ch_it)->Value);
|
||||
*pMesh = GeometryHelper_MakeMesh(tnemesh.CoordIndex, ((X3DCoordinate*)*ch_it)->Value);
|
||||
}
|
||||
}
|
||||
|
||||
// copy additional information from children
|
||||
for(std::list<CX3DImporter_NodeElement*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
for(std::list<X3DNodeElementBase*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
{
|
||||
ai_assert(*pMesh);
|
||||
if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Color)
|
||||
MeshGeometry_AddColor(**pMesh, tnemesh.CoordIndex, tnemesh.ColorIndex, ((CX3DImporter_NodeElement_Color*)*ch_it)->Value, tnemesh.ColorPerVertex);
|
||||
else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_ColorRGBA)
|
||||
MeshGeometry_AddColor(**pMesh, tnemesh.CoordIndex, tnemesh.ColorIndex, ((CX3DImporter_NodeElement_ColorRGBA*)*ch_it)->Value,
|
||||
if((*ch_it)->Type == X3DNodeElementBase::ENET_Color)
|
||||
MeshGeometry_AddColor(**pMesh, tnemesh.CoordIndex, tnemesh.ColorIndex, ((X3DColor*)*ch_it)->Value, tnemesh.ColorPerVertex);
|
||||
else if((*ch_it)->Type == X3DNodeElementBase::ENET_ColorRGBA)
|
||||
MeshGeometry_AddColor(**pMesh, tnemesh.CoordIndex, tnemesh.ColorIndex, ((X3DColorRGBA*)*ch_it)->Value,
|
||||
tnemesh.ColorPerVertex);
|
||||
else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Coordinate)
|
||||
else if((*ch_it)->Type == X3DNodeElementBase::ENET_Coordinate)
|
||||
{} // skip because already read when mesh created.
|
||||
else
|
||||
throw DeadlyImportError("Postprocess_BuildMesh. Unknown child of IndexedLineSet: " + to_string((*ch_it)->Type) + ".");
|
||||
|
@ -374,37 +374,37 @@ void X3DImporter::Postprocess_BuildMesh(const CX3DImporter_NodeElement& pNodeEle
|
|||
return;// mesh is build, nothing to do anymore.
|
||||
}// if(pNodeElement.Type == CX3DImporter_NodeElement::ENET_IndexedLineSet)
|
||||
|
||||
if((pNodeElement.Type == CX3DImporter_NodeElement::ENET_IndexedTriangleSet) ||
|
||||
(pNodeElement.Type == CX3DImporter_NodeElement::ENET_IndexedTriangleFanSet) ||
|
||||
(pNodeElement.Type == CX3DImporter_NodeElement::ENET_IndexedTriangleStripSet))
|
||||
if((pNodeElement.Type == X3DNodeElementBase::ENET_IndexedTriangleSet) ||
|
||||
(pNodeElement.Type == X3DNodeElementBase::ENET_IndexedTriangleFanSet) ||
|
||||
(pNodeElement.Type == X3DNodeElementBase::ENET_IndexedTriangleStripSet))
|
||||
{
|
||||
CX3DImporter_NodeElement_IndexedSet& tnemesh = *((CX3DImporter_NodeElement_IndexedSet*)&pNodeElement);// create alias for convenience
|
||||
X3DIndexedSet& tnemesh = *((X3DIndexedSet*)&pNodeElement);// create alias for convenience
|
||||
|
||||
// at first search for <Coordinate> node and create mesh.
|
||||
for(std::list<CX3DImporter_NodeElement*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
for(std::list<X3DNodeElementBase*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
{
|
||||
if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Coordinate)
|
||||
if((*ch_it)->Type == X3DNodeElementBase::ENET_Coordinate)
|
||||
{
|
||||
*pMesh = GeometryHelper_MakeMesh(tnemesh.CoordIndex, ((CX3DImporter_NodeElement_Coordinate*)*ch_it)->Value);
|
||||
*pMesh = GeometryHelper_MakeMesh(tnemesh.CoordIndex, ((X3DCoordinate*)*ch_it)->Value);
|
||||
}
|
||||
}
|
||||
|
||||
// copy additional information from children
|
||||
for(std::list<CX3DImporter_NodeElement*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
for(std::list<X3DNodeElementBase*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
{
|
||||
ai_assert(*pMesh);
|
||||
if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Color)
|
||||
MeshGeometry_AddColor(**pMesh, tnemesh.CoordIndex, tnemesh.ColorIndex, ((CX3DImporter_NodeElement_Color*)*ch_it)->Value, tnemesh.ColorPerVertex);
|
||||
else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_ColorRGBA)
|
||||
MeshGeometry_AddColor(**pMesh, tnemesh.CoordIndex, tnemesh.ColorIndex, ((CX3DImporter_NodeElement_ColorRGBA*)*ch_it)->Value,
|
||||
if((*ch_it)->Type == X3DNodeElementBase::ENET_Color)
|
||||
MeshGeometry_AddColor(**pMesh, tnemesh.CoordIndex, tnemesh.ColorIndex, ((X3DColor*)*ch_it)->Value, tnemesh.ColorPerVertex);
|
||||
else if((*ch_it)->Type == X3DNodeElementBase::ENET_ColorRGBA)
|
||||
MeshGeometry_AddColor(**pMesh, tnemesh.CoordIndex, tnemesh.ColorIndex, ((X3DColorRGBA*)*ch_it)->Value,
|
||||
tnemesh.ColorPerVertex);
|
||||
else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Coordinate)
|
||||
else if((*ch_it)->Type == X3DNodeElementBase::ENET_Coordinate)
|
||||
{} // skip because already read when mesh created.
|
||||
else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Normal)
|
||||
MeshGeometry_AddNormal(**pMesh, tnemesh.CoordIndex, tnemesh.NormalIndex, ((CX3DImporter_NodeElement_Normal*)*ch_it)->Value,
|
||||
else if((*ch_it)->Type == X3DNodeElementBase::ENET_Normal)
|
||||
MeshGeometry_AddNormal(**pMesh, tnemesh.CoordIndex, tnemesh.NormalIndex, ((X3DNormal*)*ch_it)->Value,
|
||||
tnemesh.NormalPerVertex);
|
||||
else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_TextureCoordinate)
|
||||
MeshGeometry_AddTexCoord(**pMesh, tnemesh.CoordIndex, tnemesh.TexCoordIndex, ((CX3DImporter_NodeElement_TextureCoordinate*)*ch_it)->Value);
|
||||
else if((*ch_it)->Type == X3DNodeElementBase::ENET_TextureCoordinate)
|
||||
MeshGeometry_AddTexCoord(**pMesh, tnemesh.CoordIndex, tnemesh.TexCoordIndex, ((X3DTextureCoordinate*)*ch_it)->Value);
|
||||
else
|
||||
throw DeadlyImportError("Postprocess_BuildMesh. Unknown child of IndexedTriangleSet or IndexedTriangleFanSet, or \
|
||||
IndexedTriangleStripSet: " + to_string((*ch_it)->Type) + ".");
|
||||
|
@ -413,9 +413,9 @@ void X3DImporter::Postprocess_BuildMesh(const CX3DImporter_NodeElement& pNodeEle
|
|||
return;// mesh is build, nothing to do anymore.
|
||||
}// if((pNodeElement.Type == CX3DImporter_NodeElement::ENET_IndexedTriangleFanSet) || (pNodeElement.Type == CX3DImporter_NodeElement::ENET_IndexedTriangleStripSet))
|
||||
|
||||
if(pNodeElement.Type == CX3DImporter_NodeElement::ENET_Extrusion)
|
||||
if(pNodeElement.Type == X3DNodeElementBase::ENET_Extrusion)
|
||||
{
|
||||
CX3DImporter_NodeElement_IndexedSet& tnemesh = *((CX3DImporter_NodeElement_IndexedSet*)&pNodeElement);// create alias for convenience
|
||||
X3DIndexedSet& tnemesh = *((X3DIndexedSet*)&pNodeElement);// create alias for convenience
|
||||
|
||||
*pMesh = GeometryHelper_MakeMesh(tnemesh.CoordIndex, tnemesh.Vertices);
|
||||
|
||||
|
@ -425,20 +425,20 @@ void X3DImporter::Postprocess_BuildMesh(const CX3DImporter_NodeElement& pNodeEle
|
|||
//
|
||||
// Primitives sets
|
||||
//
|
||||
if(pNodeElement.Type == CX3DImporter_NodeElement::ENET_PointSet)
|
||||
if(pNodeElement.Type == X3DNodeElementBase::ENET_PointSet)
|
||||
{
|
||||
CX3DImporter_NodeElement_Set& tnemesh = *((CX3DImporter_NodeElement_Set*)&pNodeElement);// create alias for convenience
|
||||
X3DSet& tnemesh = *((X3DSet*)&pNodeElement);// create alias for convenience
|
||||
|
||||
// at first search for <Coordinate> node and create mesh.
|
||||
for(std::list<CX3DImporter_NodeElement*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
for(std::list<X3DNodeElementBase*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
{
|
||||
if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Coordinate)
|
||||
if((*ch_it)->Type == X3DNodeElementBase::ENET_Coordinate)
|
||||
{
|
||||
std::vector<aiVector3D> vec_copy;
|
||||
|
||||
vec_copy.reserve(((CX3DImporter_NodeElement_Coordinate*)*ch_it)->Value.size());
|
||||
for(std::list<aiVector3D>::const_iterator it = ((CX3DImporter_NodeElement_Coordinate*)*ch_it)->Value.begin();
|
||||
it != ((CX3DImporter_NodeElement_Coordinate*)*ch_it)->Value.end(); ++it)
|
||||
vec_copy.reserve(((X3DCoordinate*)*ch_it)->Value.size());
|
||||
for(std::list<aiVector3D>::const_iterator it = ((X3DCoordinate*)*ch_it)->Value.begin();
|
||||
it != ((X3DCoordinate*)*ch_it)->Value.end(); ++it)
|
||||
{
|
||||
vec_copy.push_back(*it);
|
||||
}
|
||||
|
@ -448,14 +448,14 @@ void X3DImporter::Postprocess_BuildMesh(const CX3DImporter_NodeElement& pNodeEle
|
|||
}
|
||||
|
||||
// copy additional information from children
|
||||
for(std::list<CX3DImporter_NodeElement*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
for(std::list<X3DNodeElementBase*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
{
|
||||
ai_assert(*pMesh);
|
||||
if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Color)
|
||||
MeshGeometry_AddColor(**pMesh, ((CX3DImporter_NodeElement_Color*)*ch_it)->Value, true);
|
||||
else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_ColorRGBA)
|
||||
MeshGeometry_AddColor(**pMesh, ((CX3DImporter_NodeElement_ColorRGBA*)*ch_it)->Value, true);
|
||||
else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Coordinate)
|
||||
if((*ch_it)->Type == X3DNodeElementBase::ENET_Color)
|
||||
MeshGeometry_AddColor(**pMesh, ((X3DColor*)*ch_it)->Value, true);
|
||||
else if((*ch_it)->Type == X3DNodeElementBase::ENET_ColorRGBA)
|
||||
MeshGeometry_AddColor(**pMesh, ((X3DColorRGBA*)*ch_it)->Value, true);
|
||||
else if((*ch_it)->Type == X3DNodeElementBase::ENET_Coordinate)
|
||||
{} // skip because already read when mesh created.
|
||||
else
|
||||
throw DeadlyImportError("Postprocess_BuildMesh. Unknown child of PointSet: " + to_string((*ch_it)->Type) + ".");
|
||||
|
@ -464,28 +464,28 @@ void X3DImporter::Postprocess_BuildMesh(const CX3DImporter_NodeElement& pNodeEle
|
|||
return;// mesh is build, nothing to do anymore.
|
||||
}// if(pNodeElement.Type == CX3DImporter_NodeElement::ENET_PointSet)
|
||||
|
||||
if(pNodeElement.Type == CX3DImporter_NodeElement::ENET_LineSet)
|
||||
if(pNodeElement.Type == X3DNodeElementBase::ENET_LineSet)
|
||||
{
|
||||
CX3DImporter_NodeElement_Set& tnemesh = *((CX3DImporter_NodeElement_Set*)&pNodeElement);// create alias for convenience
|
||||
X3DSet& tnemesh = *((X3DSet*)&pNodeElement);// create alias for convenience
|
||||
|
||||
// at first search for <Coordinate> node and create mesh.
|
||||
for(std::list<CX3DImporter_NodeElement*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
for(std::list<X3DNodeElementBase*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
{
|
||||
if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Coordinate)
|
||||
if((*ch_it)->Type == X3DNodeElementBase::ENET_Coordinate)
|
||||
{
|
||||
*pMesh = GeometryHelper_MakeMesh(tnemesh.CoordIndex, ((CX3DImporter_NodeElement_Coordinate*)*ch_it)->Value);
|
||||
*pMesh = GeometryHelper_MakeMesh(tnemesh.CoordIndex, ((X3DCoordinate*)*ch_it)->Value);
|
||||
}
|
||||
}
|
||||
|
||||
// copy additional information from children
|
||||
for(std::list<CX3DImporter_NodeElement*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
for(std::list<X3DNodeElementBase*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
{
|
||||
ai_assert(*pMesh);
|
||||
if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Color)
|
||||
MeshGeometry_AddColor(**pMesh, ((CX3DImporter_NodeElement_Color*)*ch_it)->Value, true);
|
||||
else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_ColorRGBA)
|
||||
MeshGeometry_AddColor(**pMesh, ((CX3DImporter_NodeElement_ColorRGBA*)*ch_it)->Value, true);
|
||||
else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Coordinate)
|
||||
if((*ch_it)->Type == X3DNodeElementBase::ENET_Color)
|
||||
MeshGeometry_AddColor(**pMesh, ((X3DColor*)*ch_it)->Value, true);
|
||||
else if((*ch_it)->Type == X3DNodeElementBase::ENET_ColorRGBA)
|
||||
MeshGeometry_AddColor(**pMesh, ((X3DColorRGBA*)*ch_it)->Value, true);
|
||||
else if((*ch_it)->Type == X3DNodeElementBase::ENET_Coordinate)
|
||||
{} // skip because already read when mesh created.
|
||||
else
|
||||
throw DeadlyImportError("Postprocess_BuildMesh. Unknown child of LineSet: " + to_string((*ch_it)->Type) + ".");
|
||||
|
@ -494,36 +494,36 @@ void X3DImporter::Postprocess_BuildMesh(const CX3DImporter_NodeElement& pNodeEle
|
|||
return;// mesh is build, nothing to do anymore.
|
||||
}// if(pNodeElement.Type == CX3DImporter_NodeElement::ENET_LineSet)
|
||||
|
||||
if(pNodeElement.Type == CX3DImporter_NodeElement::ENET_TriangleFanSet)
|
||||
if(pNodeElement.Type == X3DNodeElementBase::ENET_TriangleFanSet)
|
||||
{
|
||||
CX3DImporter_NodeElement_Set& tnemesh = *((CX3DImporter_NodeElement_Set*)&pNodeElement);// create alias for convenience
|
||||
X3DSet& tnemesh = *((X3DSet*)&pNodeElement);// create alias for convenience
|
||||
|
||||
// at first search for <Coordinate> node and create mesh.
|
||||
for(std::list<CX3DImporter_NodeElement*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
for(std::list<X3DNodeElementBase*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
{
|
||||
if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Coordinate)
|
||||
if((*ch_it)->Type == X3DNodeElementBase::ENET_Coordinate)
|
||||
{
|
||||
*pMesh = GeometryHelper_MakeMesh(tnemesh.CoordIndex, ((CX3DImporter_NodeElement_Coordinate*)*ch_it)->Value);
|
||||
*pMesh = GeometryHelper_MakeMesh(tnemesh.CoordIndex, ((X3DCoordinate*)*ch_it)->Value);
|
||||
}
|
||||
}
|
||||
|
||||
// copy additional information from children
|
||||
for(std::list<CX3DImporter_NodeElement*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
for(std::list<X3DNodeElementBase*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
{
|
||||
if ( nullptr == *pMesh ) {
|
||||
break;
|
||||
}
|
||||
if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Color)
|
||||
MeshGeometry_AddColor(**pMesh, ((CX3DImporter_NodeElement_Color*)*ch_it)->Value,tnemesh.ColorPerVertex);
|
||||
else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_ColorRGBA)
|
||||
MeshGeometry_AddColor(**pMesh, ((CX3DImporter_NodeElement_ColorRGBA*)*ch_it)->Value, tnemesh.ColorPerVertex);
|
||||
else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Coordinate)
|
||||
if((*ch_it)->Type == X3DNodeElementBase::ENET_Color)
|
||||
MeshGeometry_AddColor(**pMesh, ((X3DColor*)*ch_it)->Value,tnemesh.ColorPerVertex);
|
||||
else if((*ch_it)->Type == X3DNodeElementBase::ENET_ColorRGBA)
|
||||
MeshGeometry_AddColor(**pMesh, ((X3DColorRGBA*)*ch_it)->Value, tnemesh.ColorPerVertex);
|
||||
else if((*ch_it)->Type == X3DNodeElementBase::ENET_Coordinate)
|
||||
{} // skip because already read when mesh created.
|
||||
else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Normal)
|
||||
MeshGeometry_AddNormal(**pMesh, tnemesh.CoordIndex, tnemesh.NormalIndex, ((CX3DImporter_NodeElement_Normal*)*ch_it)->Value,
|
||||
else if((*ch_it)->Type == X3DNodeElementBase::ENET_Normal)
|
||||
MeshGeometry_AddNormal(**pMesh, tnemesh.CoordIndex, tnemesh.NormalIndex, ((X3DNormal*)*ch_it)->Value,
|
||||
tnemesh.NormalPerVertex);
|
||||
else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_TextureCoordinate)
|
||||
MeshGeometry_AddTexCoord(**pMesh, tnemesh.CoordIndex, tnemesh.TexCoordIndex, ((CX3DImporter_NodeElement_TextureCoordinate*)*ch_it)->Value);
|
||||
else if((*ch_it)->Type == X3DNodeElementBase::ENET_TextureCoordinate)
|
||||
MeshGeometry_AddTexCoord(**pMesh, tnemesh.CoordIndex, tnemesh.TexCoordIndex, ((X3DTextureCoordinate*)*ch_it)->Value);
|
||||
else
|
||||
throw DeadlyImportError("Postprocess_BuildMesh. Unknown child of TrianlgeFanSet: " + to_string((*ch_it)->Type) + ".");
|
||||
}// for(std::list<CX3DImporter_NodeElement*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
|
@ -531,20 +531,20 @@ void X3DImporter::Postprocess_BuildMesh(const CX3DImporter_NodeElement& pNodeEle
|
|||
return;// mesh is build, nothing to do anymore.
|
||||
}// if(pNodeElement.Type == CX3DImporter_NodeElement::ENET_TriangleFanSet)
|
||||
|
||||
if(pNodeElement.Type == CX3DImporter_NodeElement::ENET_TriangleSet)
|
||||
if(pNodeElement.Type == X3DNodeElementBase::ENET_TriangleSet)
|
||||
{
|
||||
CX3DImporter_NodeElement_Set& tnemesh = *((CX3DImporter_NodeElement_Set*)&pNodeElement);// create alias for convenience
|
||||
X3DSet& tnemesh = *((X3DSet*)&pNodeElement);// create alias for convenience
|
||||
|
||||
// at first search for <Coordinate> node and create mesh.
|
||||
for(std::list<CX3DImporter_NodeElement*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
for(std::list<X3DNodeElementBase*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
{
|
||||
if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Coordinate)
|
||||
if((*ch_it)->Type == X3DNodeElementBase::ENET_Coordinate)
|
||||
{
|
||||
std::vector<aiVector3D> vec_copy;
|
||||
|
||||
vec_copy.reserve(((CX3DImporter_NodeElement_Coordinate*)*ch_it)->Value.size());
|
||||
for(std::list<aiVector3D>::const_iterator it = ((CX3DImporter_NodeElement_Coordinate*)*ch_it)->Value.begin();
|
||||
it != ((CX3DImporter_NodeElement_Coordinate*)*ch_it)->Value.end(); ++it)
|
||||
vec_copy.reserve(((X3DCoordinate*)*ch_it)->Value.size());
|
||||
for(std::list<aiVector3D>::const_iterator it = ((X3DCoordinate*)*ch_it)->Value.begin();
|
||||
it != ((X3DCoordinate*)*ch_it)->Value.end(); ++it)
|
||||
{
|
||||
vec_copy.push_back(*it);
|
||||
}
|
||||
|
@ -554,20 +554,20 @@ void X3DImporter::Postprocess_BuildMesh(const CX3DImporter_NodeElement& pNodeEle
|
|||
}
|
||||
|
||||
// copy additional information from children
|
||||
for(std::list<CX3DImporter_NodeElement*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
for(std::list<X3DNodeElementBase*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
{
|
||||
ai_assert(*pMesh);
|
||||
if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Color)
|
||||
MeshGeometry_AddColor(**pMesh, ((CX3DImporter_NodeElement_Color*)*ch_it)->Value, tnemesh.ColorPerVertex);
|
||||
else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_ColorRGBA)
|
||||
MeshGeometry_AddColor(**pMesh, ((CX3DImporter_NodeElement_ColorRGBA*)*ch_it)->Value, tnemesh.ColorPerVertex);
|
||||
else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Coordinate)
|
||||
if((*ch_it)->Type == X3DNodeElementBase::ENET_Color)
|
||||
MeshGeometry_AddColor(**pMesh, ((X3DColor*)*ch_it)->Value, tnemesh.ColorPerVertex);
|
||||
else if((*ch_it)->Type == X3DNodeElementBase::ENET_ColorRGBA)
|
||||
MeshGeometry_AddColor(**pMesh, ((X3DColorRGBA*)*ch_it)->Value, tnemesh.ColorPerVertex);
|
||||
else if((*ch_it)->Type == X3DNodeElementBase::ENET_Coordinate)
|
||||
{} // skip because already read when mesh created.
|
||||
else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Normal)
|
||||
MeshGeometry_AddNormal(**pMesh, tnemesh.CoordIndex, tnemesh.NormalIndex, ((CX3DImporter_NodeElement_Normal*)*ch_it)->Value,
|
||||
else if((*ch_it)->Type == X3DNodeElementBase::ENET_Normal)
|
||||
MeshGeometry_AddNormal(**pMesh, tnemesh.CoordIndex, tnemesh.NormalIndex, ((X3DNormal*)*ch_it)->Value,
|
||||
tnemesh.NormalPerVertex);
|
||||
else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_TextureCoordinate)
|
||||
MeshGeometry_AddTexCoord(**pMesh, tnemesh.CoordIndex, tnemesh.TexCoordIndex, ((CX3DImporter_NodeElement_TextureCoordinate*)*ch_it)->Value);
|
||||
else if((*ch_it)->Type == X3DNodeElementBase::ENET_TextureCoordinate)
|
||||
MeshGeometry_AddTexCoord(**pMesh, tnemesh.CoordIndex, tnemesh.TexCoordIndex, ((X3DTextureCoordinate*)*ch_it)->Value);
|
||||
else
|
||||
throw DeadlyImportError("Postprocess_BuildMesh. Unknown child of TrianlgeSet: " + to_string((*ch_it)->Type) + ".");
|
||||
}// for(std::list<CX3DImporter_NodeElement*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
|
@ -575,34 +575,34 @@ void X3DImporter::Postprocess_BuildMesh(const CX3DImporter_NodeElement& pNodeEle
|
|||
return;// mesh is build, nothing to do anymore.
|
||||
}// if(pNodeElement.Type == CX3DImporter_NodeElement::ENET_TriangleSet)
|
||||
|
||||
if(pNodeElement.Type == CX3DImporter_NodeElement::ENET_TriangleStripSet)
|
||||
if(pNodeElement.Type == X3DNodeElementBase::ENET_TriangleStripSet)
|
||||
{
|
||||
CX3DImporter_NodeElement_Set& tnemesh = *((CX3DImporter_NodeElement_Set*)&pNodeElement);// create alias for convenience
|
||||
X3DSet& tnemesh = *((X3DSet*)&pNodeElement);// create alias for convenience
|
||||
|
||||
// at first search for <Coordinate> node and create mesh.
|
||||
for(std::list<CX3DImporter_NodeElement*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
for(std::list<X3DNodeElementBase*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
{
|
||||
if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Coordinate)
|
||||
if((*ch_it)->Type == X3DNodeElementBase::ENET_Coordinate)
|
||||
{
|
||||
*pMesh = GeometryHelper_MakeMesh(tnemesh.CoordIndex, ((CX3DImporter_NodeElement_Coordinate*)*ch_it)->Value);
|
||||
*pMesh = GeometryHelper_MakeMesh(tnemesh.CoordIndex, ((X3DCoordinate*)*ch_it)->Value);
|
||||
}
|
||||
}
|
||||
|
||||
// copy additional information from children
|
||||
for(std::list<CX3DImporter_NodeElement*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
for(std::list<X3DNodeElementBase*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
{
|
||||
ai_assert(*pMesh);
|
||||
if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Color)
|
||||
MeshGeometry_AddColor(**pMesh, ((CX3DImporter_NodeElement_Color*)*ch_it)->Value, tnemesh.ColorPerVertex);
|
||||
else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_ColorRGBA)
|
||||
MeshGeometry_AddColor(**pMesh, ((CX3DImporter_NodeElement_ColorRGBA*)*ch_it)->Value, tnemesh.ColorPerVertex);
|
||||
else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Coordinate)
|
||||
if((*ch_it)->Type == X3DNodeElementBase::ENET_Color)
|
||||
MeshGeometry_AddColor(**pMesh, ((X3DColor*)*ch_it)->Value, tnemesh.ColorPerVertex);
|
||||
else if((*ch_it)->Type == X3DNodeElementBase::ENET_ColorRGBA)
|
||||
MeshGeometry_AddColor(**pMesh, ((X3DColorRGBA*)*ch_it)->Value, tnemesh.ColorPerVertex);
|
||||
else if((*ch_it)->Type == X3DNodeElementBase::ENET_Coordinate)
|
||||
{} // skip because already read when mesh created.
|
||||
else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Normal)
|
||||
MeshGeometry_AddNormal(**pMesh, tnemesh.CoordIndex, tnemesh.NormalIndex, ((CX3DImporter_NodeElement_Normal*)*ch_it)->Value,
|
||||
else if((*ch_it)->Type == X3DNodeElementBase::ENET_Normal)
|
||||
MeshGeometry_AddNormal(**pMesh, tnemesh.CoordIndex, tnemesh.NormalIndex, ((X3DNormal*)*ch_it)->Value,
|
||||
tnemesh.NormalPerVertex);
|
||||
else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_TextureCoordinate)
|
||||
MeshGeometry_AddTexCoord(**pMesh, tnemesh.CoordIndex, tnemesh.TexCoordIndex, ((CX3DImporter_NodeElement_TextureCoordinate*)*ch_it)->Value);
|
||||
else if((*ch_it)->Type == X3DNodeElementBase::ENET_TextureCoordinate)
|
||||
MeshGeometry_AddTexCoord(**pMesh, tnemesh.CoordIndex, tnemesh.TexCoordIndex, ((X3DTextureCoordinate*)*ch_it)->Value);
|
||||
else
|
||||
throw DeadlyImportError("Postprocess_BuildMesh. Unknown child of TriangleStripSet: " + to_string((*ch_it)->Type) + ".");
|
||||
}// for(std::list<CX3DImporter_NodeElement*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ++ch_it)
|
||||
|
@ -613,20 +613,20 @@ void X3DImporter::Postprocess_BuildMesh(const CX3DImporter_NodeElement& pNodeEle
|
|||
throw DeadlyImportError("Postprocess_BuildMesh. Unknown mesh type: " + to_string(pNodeElement.Type) + ".");
|
||||
}
|
||||
|
||||
void X3DImporter::Postprocess_BuildNode(const CX3DImporter_NodeElement& pNodeElement, aiNode& pSceneNode, std::list<aiMesh*>& pSceneMeshList,
|
||||
void X3DImporter::Postprocess_BuildNode(const X3DNodeElementBase& 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<X3DNodeElementBase*>::const_iterator chit_begin = pNodeElement.Child.begin();
|
||||
std::list<X3DNodeElementBase*>::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);
|
||||
// check if we have deal with grouping node. Which can contain transformation or switch
|
||||
if(pNodeElement.Type == CX3DImporter_NodeElement::ENET_Group)
|
||||
if(pNodeElement.Type == X3DNodeElementBase::ENET_Group)
|
||||
{
|
||||
const CX3DImporter_NodeElement_Group& tne_group = *((CX3DImporter_NodeElement_Group*)&pNodeElement);// create alias for convenience
|
||||
const X3DGroup& tne_group = *((X3DGroup*)&pNodeElement);// create alias for convenience
|
||||
|
||||
pSceneNode.mTransformation = tne_group.Transformation;
|
||||
if(tne_group.UseChoice)
|
||||
|
@ -648,9 +648,9 @@ void X3DImporter::Postprocess_BuildNode(const CX3DImporter_NodeElement& pNodeEle
|
|||
}// if(pNodeElement.Type == CX3DImporter_NodeElement::ENET_Group)
|
||||
|
||||
// Reserve memory for fast access and check children.
|
||||
for(std::list<CX3DImporter_NodeElement*>::const_iterator it = chit_begin; it != chit_end; ++it)
|
||||
for(std::list<X3DNodeElementBase*>::const_iterator it = chit_begin; it != chit_end; ++it)
|
||||
{// in this loop we do not read metadata because it's already read at begin.
|
||||
if((*it)->Type == CX3DImporter_NodeElement::ENET_Group)
|
||||
if((*it)->Type == X3DNodeElementBase::ENET_Group)
|
||||
{
|
||||
// if child is group then create new node and do recursive call.
|
||||
aiNode* new_node = new aiNode;
|
||||
|
@ -660,15 +660,15 @@ void X3DImporter::Postprocess_BuildNode(const CX3DImporter_NodeElement& pNodeEle
|
|||
SceneNode_Child.push_back(new_node);
|
||||
Postprocess_BuildNode(**it, *new_node, pSceneMeshList, pSceneMaterialList, pSceneLightList);
|
||||
}
|
||||
else if((*it)->Type == CX3DImporter_NodeElement::ENET_Shape)
|
||||
else if((*it)->Type == X3DNodeElementBase::ENET_Shape)
|
||||
{
|
||||
// shape can contain only one geometry and one appearance nodes.
|
||||
Postprocess_BuildShape(*((CX3DImporter_NodeElement_Shape*)*it), SceneNode_Mesh, pSceneMeshList, pSceneMaterialList);
|
||||
Postprocess_BuildShape(*((X3DShape*)*it), SceneNode_Mesh, pSceneMeshList, pSceneMaterialList);
|
||||
}
|
||||
else if(((*it)->Type == CX3DImporter_NodeElement::ENET_DirectionalLight) || ((*it)->Type == CX3DImporter_NodeElement::ENET_PointLight) ||
|
||||
((*it)->Type == CX3DImporter_NodeElement::ENET_SpotLight))
|
||||
else if(((*it)->Type == X3DNodeElementBase::ENET_DirectionalLight) || ((*it)->Type == X3DNodeElementBase::ENET_PointLight) ||
|
||||
((*it)->Type == X3DNodeElementBase::ENET_SpotLight))
|
||||
{
|
||||
Postprocess_BuildLight(*((CX3DImporter_NodeElement_Light*)*it), pSceneLightList);
|
||||
Postprocess_BuildLight(*((X3DLight*)*it), pSceneLightList);
|
||||
}
|
||||
else if(!PostprocessHelper_ElementIsMetadata((*it)->Type))// skip metadata
|
||||
{
|
||||
|
@ -698,15 +698,15 @@ void X3DImporter::Postprocess_BuildNode(const CX3DImporter_NodeElement& pNodeEle
|
|||
// that's all. return to previous deals
|
||||
}
|
||||
|
||||
void X3DImporter::Postprocess_BuildShape(const CX3DImporter_NodeElement_Shape& pShapeNodeElement, std::list<unsigned int>& pNodeMeshInd,
|
||||
void X3DImporter::Postprocess_BuildShape(const X3DShape& 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;
|
||||
X3DNodeElementBase::EType mesh_type = X3DNodeElementBase::ENET_Invalid;
|
||||
unsigned int mat_ind = 0;
|
||||
|
||||
for(std::list<CX3DImporter_NodeElement*>::const_iterator it = pShapeNodeElement.Child.begin(); it != pShapeNodeElement.Child.end(); ++it)
|
||||
for(std::list<X3DNodeElementBase*>::const_iterator it = pShapeNodeElement.Child.begin(); it != pShapeNodeElement.Child.end(); ++it)
|
||||
{
|
||||
if(PostprocessHelper_ElementIsMesh((*it)->Type))
|
||||
{
|
||||
|
@ -720,7 +720,7 @@ void X3DImporter::Postprocess_BuildShape(const CX3DImporter_NodeElement_Shape& p
|
|||
mesh_type = (*it)->Type;
|
||||
}
|
||||
}
|
||||
else if((*it)->Type == CX3DImporter_NodeElement::ENET_Appearance)
|
||||
else if((*it)->Type == X3DNodeElementBase::ENET_Appearance)
|
||||
{
|
||||
Postprocess_BuildMaterial(**it, &tmat);
|
||||
if(tmat != nullptr)
|
||||
|
@ -744,14 +744,14 @@ void X3DImporter::Postprocess_BuildShape(const CX3DImporter_NodeElement_Shape& p
|
|||
|
||||
switch(mesh_type)
|
||||
{
|
||||
case CX3DImporter_NodeElement::ENET_Box:
|
||||
case X3DNodeElementBase::ENET_Box:
|
||||
tm = aiTextureMapping_BOX;
|
||||
break;
|
||||
case CX3DImporter_NodeElement::ENET_Cone:
|
||||
case CX3DImporter_NodeElement::ENET_Cylinder:
|
||||
case X3DNodeElementBase::ENET_Cone:
|
||||
case X3DNodeElementBase::ENET_Cylinder:
|
||||
tm = aiTextureMapping_CYLINDER;
|
||||
break;
|
||||
case CX3DImporter_NodeElement::ENET_Sphere:
|
||||
case X3DNodeElementBase::ENET_Sphere:
|
||||
tm = aiTextureMapping_SPHERE;
|
||||
break;
|
||||
default:
|
||||
|
@ -764,9 +764,9 @@ void X3DImporter::Postprocess_BuildShape(const CX3DImporter_NodeElement_Shape& p
|
|||
}// if((tmesh != nullptr) && (tmat != nullptr))
|
||||
}
|
||||
|
||||
void X3DImporter::Postprocess_CollectMetadata(const CX3DImporter_NodeElement& pNodeElement, aiNode& pSceneNode) const
|
||||
void X3DImporter::Postprocess_CollectMetadata(const X3DNodeElementBase& pNodeElement, aiNode& pSceneNode) const
|
||||
{
|
||||
std::list<CX3DImporter_NodeElement*> meta_list;
|
||||
std::list<X3DNodeElementBase*> meta_list;
|
||||
size_t meta_idx;
|
||||
|
||||
PostprocessHelper_CollectMetadata(pNodeElement, meta_list);// find metadata in current node element.
|
||||
|
@ -779,39 +779,39 @@ void X3DImporter::Postprocess_CollectMetadata(const CX3DImporter_NodeElement& pN
|
|||
// copy collected metadata to output node.
|
||||
pSceneNode.mMetaData = aiMetadata::Alloc( static_cast<unsigned int>(meta_list.size()) );
|
||||
meta_idx = 0;
|
||||
for(std::list<CX3DImporter_NodeElement*>::const_iterator it = meta_list.begin(); it != meta_list.end(); ++it, ++meta_idx)
|
||||
for(std::list<X3DNodeElementBase*>::const_iterator it = meta_list.begin(); it != meta_list.end(); ++it, ++meta_idx)
|
||||
{
|
||||
CX3DImporter_NodeElement_Meta* cur_meta = (CX3DImporter_NodeElement_Meta*)*it;
|
||||
X3DMeta* cur_meta = (X3DMeta*)*it;
|
||||
|
||||
// due to limitations we can add only first element of value list.
|
||||
// Add an element according to its type.
|
||||
if((*it)->Type == CX3DImporter_NodeElement::ENET_MetaBoolean)
|
||||
if((*it)->Type == X3DNodeElementBase::ENET_MetaBoolean)
|
||||
{
|
||||
if(((CX3DImporter_NodeElement_MetaBoolean*)cur_meta)->Value.size() > 0) {
|
||||
const bool v = (bool) *( ( (CX3DImporter_NodeElement_MetaBoolean*) cur_meta )->Value.begin());
|
||||
if(((X3DMetaBoolean*)cur_meta)->Value.size() > 0) {
|
||||
const bool v = (bool) *( ( (X3DMetaBoolean*) cur_meta )->Value.begin());
|
||||
pSceneNode.mMetaData->Set(static_cast<unsigned int>(meta_idx), cur_meta->Name, v);
|
||||
}
|
||||
}
|
||||
else if((*it)->Type == CX3DImporter_NodeElement::ENET_MetaDouble)
|
||||
else if((*it)->Type == X3DNodeElementBase::ENET_MetaDouble)
|
||||
{
|
||||
if(((CX3DImporter_NodeElement_MetaDouble*)cur_meta)->Value.size() > 0)
|
||||
pSceneNode.mMetaData->Set(static_cast<unsigned int>(meta_idx), cur_meta->Name, (float)*(((CX3DImporter_NodeElement_MetaDouble*)cur_meta)->Value.begin()));
|
||||
if(((X3DMetaDouble*)cur_meta)->Value.size() > 0)
|
||||
pSceneNode.mMetaData->Set(static_cast<unsigned int>(meta_idx), cur_meta->Name, (float)*(((X3DMetaDouble*)cur_meta)->Value.begin()));
|
||||
}
|
||||
else if((*it)->Type == CX3DImporter_NodeElement::ENET_MetaFloat)
|
||||
else if((*it)->Type == X3DNodeElementBase::ENET_MetaFloat)
|
||||
{
|
||||
if(((CX3DImporter_NodeElement_MetaFloat*)cur_meta)->Value.size() > 0)
|
||||
pSceneNode.mMetaData->Set(static_cast<unsigned int>(meta_idx), cur_meta->Name, *(((CX3DImporter_NodeElement_MetaFloat*)cur_meta)->Value.begin()));
|
||||
if(((X3DMetaFloat*)cur_meta)->Value.size() > 0)
|
||||
pSceneNode.mMetaData->Set(static_cast<unsigned int>(meta_idx), cur_meta->Name, *(((X3DMetaFloat*)cur_meta)->Value.begin()));
|
||||
}
|
||||
else if((*it)->Type == CX3DImporter_NodeElement::ENET_MetaInteger)
|
||||
else if((*it)->Type == X3DNodeElementBase::ENET_MetaInteger)
|
||||
{
|
||||
if(((CX3DImporter_NodeElement_MetaInteger*)cur_meta)->Value.size() > 0)
|
||||
pSceneNode.mMetaData->Set(static_cast<unsigned int>(meta_idx), cur_meta->Name, *(((CX3DImporter_NodeElement_MetaInteger*)cur_meta)->Value.begin()));
|
||||
if(((X3DMetaInteger*)cur_meta)->Value.size() > 0)
|
||||
pSceneNode.mMetaData->Set(static_cast<unsigned int>(meta_idx), cur_meta->Name, *(((X3DMetaInteger*)cur_meta)->Value.begin()));
|
||||
}
|
||||
else if((*it)->Type == CX3DImporter_NodeElement::ENET_MetaString)
|
||||
else if((*it)->Type == X3DNodeElementBase::ENET_MetaString)
|
||||
{
|
||||
if(((CX3DImporter_NodeElement_MetaString*)cur_meta)->Value.size() > 0)
|
||||
if(((X3DMetaString*)cur_meta)->Value.size() > 0)
|
||||
{
|
||||
aiString tstr(((CX3DImporter_NodeElement_MetaString*)cur_meta)->Value.begin()->data());
|
||||
aiString tstr(((X3DMetaString*)cur_meta)->Value.begin()->data());
|
||||
|
||||
pSceneNode.mMetaData->Set(static_cast<unsigned int>(meta_idx), cur_meta->Name, tstr);
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ void X3DImporter::ParseNode_Rendering_Color()
|
|||
{
|
||||
std::string use, def;
|
||||
std::list<aiColor3D> color;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -76,15 +76,15 @@ void X3DImporter::ParseNode_Rendering_Color()
|
|||
else
|
||||
{
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_Color(NodeElement_Cur);
|
||||
ne = new X3DColor(mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
((CX3DImporter_NodeElement_Color*)ne)->Value = color;
|
||||
((X3DColor*)ne)->Value = color;
|
||||
// check for X3DMetadataObject childs.
|
||||
if(!mReader->isEmptyElement())
|
||||
ParseNode_Metadata(ne, "Color");
|
||||
else
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
}// if(!use.empty()) else
|
||||
|
@ -99,7 +99,7 @@ void X3DImporter::ParseNode_Rendering_ColorRGBA()
|
|||
{
|
||||
std::string use, def;
|
||||
std::list<aiColor4D> color;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -114,15 +114,15 @@ void X3DImporter::ParseNode_Rendering_ColorRGBA()
|
|||
else
|
||||
{
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_ColorRGBA(NodeElement_Cur);
|
||||
ne = new X3DColorRGBA(mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
((CX3DImporter_NodeElement_ColorRGBA*)ne)->Value = color;
|
||||
((X3DColorRGBA*)ne)->Value = color;
|
||||
// check for X3DMetadataObject childs.
|
||||
if(!mReader->isEmptyElement())
|
||||
ParseNode_Metadata(ne, "ColorRGBA");
|
||||
else
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
}// if(!use.empty()) else
|
||||
|
@ -137,7 +137,7 @@ void X3DImporter::ParseNode_Rendering_Coordinate()
|
|||
{
|
||||
std::string use, def;
|
||||
std::list<aiVector3D> point;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -152,15 +152,15 @@ void X3DImporter::ParseNode_Rendering_Coordinate()
|
|||
else
|
||||
{
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_Coordinate(NodeElement_Cur);
|
||||
ne = new X3DCoordinate(mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
((CX3DImporter_NodeElement_Coordinate*)ne)->Value = point;
|
||||
((X3DCoordinate*)ne)->Value = point;
|
||||
// check for X3DMetadataObject childs.
|
||||
if(!mReader->isEmptyElement())
|
||||
ParseNode_Metadata(ne, "Coordinate");
|
||||
else
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
}// if(!use.empty()) else
|
||||
|
@ -184,7 +184,7 @@ void X3DImporter::ParseNode_Rendering_IndexedLineSet()
|
|||
std::vector<int32_t> colorIndex;
|
||||
bool colorPerVertex = true;
|
||||
std::vector<int32_t> coordIndex;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -205,10 +205,10 @@ void X3DImporter::ParseNode_Rendering_IndexedLineSet()
|
|||
throw DeadlyImportError("IndexedLineSet must contain not empty \"coordIndex\" attribute.");
|
||||
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_IndexedSet(CX3DImporter_NodeElement::ENET_IndexedLineSet, NodeElement_Cur);
|
||||
ne = new X3DIndexedSet(X3DNodeElementBase::ENET_IndexedLineSet, mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
CX3DImporter_NodeElement_IndexedSet& ne_alias = *((CX3DImporter_NodeElement_IndexedSet*)ne);
|
||||
X3DIndexedSet& ne_alias = *((X3DIndexedSet*)ne);
|
||||
|
||||
ne_alias.ColorIndex = colorIndex;
|
||||
ne_alias.ColorPerVertex = colorPerVertex;
|
||||
|
@ -230,7 +230,7 @@ void X3DImporter::ParseNode_Rendering_IndexedLineSet()
|
|||
}// if(!mReader->isEmptyElement())
|
||||
else
|
||||
{
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
}
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
|
@ -260,7 +260,7 @@ void X3DImporter::ParseNode_Rendering_IndexedTriangleFanSet()
|
|||
std::vector<int32_t> index;
|
||||
bool normalPerVertex = true;
|
||||
bool solid = true;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -282,10 +282,10 @@ void X3DImporter::ParseNode_Rendering_IndexedTriangleFanSet()
|
|||
if(index.size() == 0) throw DeadlyImportError("IndexedTriangleFanSet must contain not empty \"index\" attribute.");
|
||||
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_IndexedSet(CX3DImporter_NodeElement::ENET_IndexedTriangleFanSet, NodeElement_Cur);
|
||||
ne = new X3DIndexedSet(X3DNodeElementBase::ENET_IndexedTriangleFanSet, mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
CX3DImporter_NodeElement_IndexedSet& ne_alias = *((CX3DImporter_NodeElement_IndexedSet*)ne);
|
||||
X3DIndexedSet& ne_alias = *((X3DIndexedSet*)ne);
|
||||
|
||||
ne_alias.CCW = ccw;
|
||||
ne_alias.ColorPerVertex = colorPerVertex;
|
||||
|
@ -348,7 +348,7 @@ void X3DImporter::ParseNode_Rendering_IndexedTriangleFanSet()
|
|||
}// if(!mReader->isEmptyElement())
|
||||
else
|
||||
{
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
}
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
|
@ -378,7 +378,7 @@ void X3DImporter::ParseNode_Rendering_IndexedTriangleSet()
|
|||
std::vector<int32_t> index;
|
||||
bool normalPerVertex = true;
|
||||
bool solid = true;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -400,10 +400,10 @@ void X3DImporter::ParseNode_Rendering_IndexedTriangleSet()
|
|||
if(index.size() == 0) throw DeadlyImportError("IndexedTriangleSet must contain not empty \"index\" attribute.");
|
||||
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_IndexedSet(CX3DImporter_NodeElement::ENET_IndexedTriangleSet, NodeElement_Cur);
|
||||
ne = new X3DIndexedSet(X3DNodeElementBase::ENET_IndexedTriangleSet, mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
CX3DImporter_NodeElement_IndexedSet& ne_alias = *((CX3DImporter_NodeElement_IndexedSet*)ne);
|
||||
X3DIndexedSet& ne_alias = *((X3DIndexedSet*)ne);
|
||||
|
||||
ne_alias.CCW = ccw;
|
||||
ne_alias.ColorPerVertex = colorPerVertex;
|
||||
|
@ -454,7 +454,7 @@ void X3DImporter::ParseNode_Rendering_IndexedTriangleSet()
|
|||
}// if(!mReader->isEmptyElement())
|
||||
else
|
||||
{
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
}
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
|
@ -484,7 +484,7 @@ void X3DImporter::ParseNode_Rendering_IndexedTriangleStripSet()
|
|||
std::vector<int32_t> index;
|
||||
bool normalPerVertex = true;
|
||||
bool solid = true;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -506,10 +506,10 @@ void X3DImporter::ParseNode_Rendering_IndexedTriangleStripSet()
|
|||
if(index.size() == 0) throw DeadlyImportError("IndexedTriangleStripSet must contain not empty \"index\" attribute.");
|
||||
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_IndexedSet(CX3DImporter_NodeElement::ENET_IndexedTriangleStripSet, NodeElement_Cur);
|
||||
ne = new X3DIndexedSet(X3DNodeElementBase::ENET_IndexedTriangleStripSet, mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
CX3DImporter_NodeElement_IndexedSet& ne_alias = *((CX3DImporter_NodeElement_IndexedSet*)ne);
|
||||
X3DIndexedSet& ne_alias = *((X3DIndexedSet*)ne);
|
||||
|
||||
ne_alias.CCW = ccw;
|
||||
ne_alias.ColorPerVertex = colorPerVertex;
|
||||
|
@ -568,7 +568,7 @@ void X3DImporter::ParseNode_Rendering_IndexedTriangleStripSet()
|
|||
}// if(!mReader->isEmptyElement())
|
||||
else
|
||||
{
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
}
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
|
@ -589,7 +589,7 @@ void X3DImporter::ParseNode_Rendering_LineSet()
|
|||
{
|
||||
std::string use, def;
|
||||
std::vector<int32_t> vertexCount;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -607,10 +607,10 @@ void X3DImporter::ParseNode_Rendering_LineSet()
|
|||
if(vertexCount.size() == 0) throw DeadlyImportError("LineSet must contain not empty \"vertexCount\" attribute.");
|
||||
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_Set(CX3DImporter_NodeElement::ENET_LineSet, NodeElement_Cur);
|
||||
ne = new X3DSet(X3DNodeElementBase::ENET_LineSet, mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
CX3DImporter_NodeElement_Set& ne_alias = *((CX3DImporter_NodeElement_Set*)ne);
|
||||
X3DSet& ne_alias = *((X3DSet*)ne);
|
||||
|
||||
ne_alias.VertexCount = vertexCount;
|
||||
// create CoordIdx
|
||||
|
@ -643,7 +643,7 @@ void X3DImporter::ParseNode_Rendering_LineSet()
|
|||
}// if(!mReader->isEmptyElement())
|
||||
else
|
||||
{
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
}
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
|
@ -662,7 +662,7 @@ void X3DImporter::ParseNode_Rendering_LineSet()
|
|||
void X3DImporter::ParseNode_Rendering_PointSet()
|
||||
{
|
||||
std::string use, def;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -676,7 +676,7 @@ void X3DImporter::ParseNode_Rendering_PointSet()
|
|||
else
|
||||
{
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_IndexedSet(CX3DImporter_NodeElement::ENET_PointSet, NodeElement_Cur);
|
||||
ne = new X3DIndexedSet(X3DNodeElementBase::ENET_PointSet, mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
// check for child nodes
|
||||
|
@ -696,7 +696,7 @@ void X3DImporter::ParseNode_Rendering_PointSet()
|
|||
}// if(!mReader->isEmptyElement())
|
||||
else
|
||||
{
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
}
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
|
@ -726,7 +726,7 @@ void X3DImporter::ParseNode_Rendering_TriangleFanSet()
|
|||
std::vector<int32_t> fanCount;
|
||||
bool normalPerVertex = true;
|
||||
bool solid = true;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -748,10 +748,10 @@ void X3DImporter::ParseNode_Rendering_TriangleFanSet()
|
|||
if(fanCount.size() == 0) throw DeadlyImportError("TriangleFanSet must contain not empty \"fanCount\" attribute.");
|
||||
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_Set(CX3DImporter_NodeElement::ENET_TriangleFanSet, NodeElement_Cur);
|
||||
ne = new X3DSet(X3DNodeElementBase::ENET_TriangleFanSet, mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
CX3DImporter_NodeElement_Set& ne_alias = *((CX3DImporter_NodeElement_Set*)ne);
|
||||
X3DSet& ne_alias = *((X3DSet*)ne);
|
||||
|
||||
ne_alias.CCW = ccw;
|
||||
ne_alias.ColorPerVertex = colorPerVertex;
|
||||
|
@ -813,7 +813,7 @@ void X3DImporter::ParseNode_Rendering_TriangleFanSet()
|
|||
}// if(!mReader->isEmptyElement())
|
||||
else
|
||||
{
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
}
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
|
@ -841,7 +841,7 @@ void X3DImporter::ParseNode_Rendering_TriangleSet()
|
|||
bool colorPerVertex = true;
|
||||
bool normalPerVertex = true;
|
||||
bool solid = true;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -859,10 +859,10 @@ void X3DImporter::ParseNode_Rendering_TriangleSet()
|
|||
else
|
||||
{
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_IndexedSet(CX3DImporter_NodeElement::ENET_TriangleSet, NodeElement_Cur);
|
||||
ne = new X3DIndexedSet(X3DNodeElementBase::ENET_TriangleSet, mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
CX3DImporter_NodeElement_Set& ne_alias = *((CX3DImporter_NodeElement_Set*)ne);
|
||||
X3DSet& ne_alias = *((X3DSet*)ne);
|
||||
|
||||
ne_alias.CCW = ccw;
|
||||
ne_alias.ColorPerVertex = colorPerVertex;
|
||||
|
@ -887,7 +887,7 @@ void X3DImporter::ParseNode_Rendering_TriangleSet()
|
|||
}// if(!mReader->isEmptyElement())
|
||||
else
|
||||
{
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
}
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
|
@ -917,7 +917,7 @@ void X3DImporter::ParseNode_Rendering_TriangleStripSet()
|
|||
std::vector<int32_t> stripCount;
|
||||
bool normalPerVertex = true;
|
||||
bool solid = true;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -939,10 +939,10 @@ void X3DImporter::ParseNode_Rendering_TriangleStripSet()
|
|||
if(stripCount.size() == 0) throw DeadlyImportError("TriangleStripSet must contain not empty \"stripCount\" attribute.");
|
||||
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_Set(CX3DImporter_NodeElement::ENET_TriangleStripSet, NodeElement_Cur);
|
||||
ne = new X3DSet(X3DNodeElementBase::ENET_TriangleStripSet, mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
CX3DImporter_NodeElement_Set& ne_alias = *((CX3DImporter_NodeElement_Set*)ne);
|
||||
X3DSet& ne_alias = *((X3DSet*)ne);
|
||||
|
||||
ne_alias.CCW = ccw;
|
||||
ne_alias.ColorPerVertex = colorPerVertex;
|
||||
|
@ -1021,7 +1021,7 @@ void X3DImporter::ParseNode_Rendering_TriangleStripSet()
|
|||
}// if(!mReader->isEmptyElement())
|
||||
else
|
||||
{
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
}
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
|
@ -1037,7 +1037,7 @@ void X3DImporter::ParseNode_Rendering_Normal()
|
|||
{
|
||||
std::string use, def;
|
||||
std::list<aiVector3D> vector;
|
||||
CX3DImporter_NodeElement* ne;
|
||||
X3DNodeElementBase* ne;
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -1052,15 +1052,15 @@ CX3DImporter_NodeElement* ne;
|
|||
else
|
||||
{
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_Normal(NodeElement_Cur);
|
||||
ne = new X3DNormal(mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
((CX3DImporter_NodeElement_Normal*)ne)->Value = vector;
|
||||
((X3DNormal*)ne)->Value = vector;
|
||||
// check for X3DMetadataObject childs.
|
||||
if(!mReader->isEmptyElement())
|
||||
ParseNode_Metadata(ne, "Normal");
|
||||
else
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
}// if(!use.empty()) else
|
||||
|
|
|
@ -70,7 +70,7 @@ namespace Assimp
|
|||
void X3DImporter::ParseNode_Shape_Shape()
|
||||
{
|
||||
std::string use, def;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -84,7 +84,7 @@ void X3DImporter::ParseNode_Shape_Shape()
|
|||
else
|
||||
{
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_Shape(NodeElement_Cur);
|
||||
ne = new X3DShape(mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
// check for child nodes
|
||||
|
@ -127,7 +127,7 @@ void X3DImporter::ParseNode_Shape_Shape()
|
|||
}// if(!mReader->isEmptyElement())
|
||||
else
|
||||
{
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
}
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
|
@ -147,7 +147,7 @@ void X3DImporter::ParseNode_Shape_Shape()
|
|||
void X3DImporter::ParseNode_Shape_Appearance()
|
||||
{
|
||||
std::string use, def;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -161,7 +161,7 @@ void X3DImporter::ParseNode_Shape_Appearance()
|
|||
else
|
||||
{
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_Appearance(NodeElement_Cur);
|
||||
ne = new X3DAppearance(mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
// check for child nodes
|
||||
|
@ -180,7 +180,7 @@ void X3DImporter::ParseNode_Shape_Appearance()
|
|||
}// if(!mReader->isEmptyElement())
|
||||
else
|
||||
{
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
}
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
|
@ -206,7 +206,7 @@ void X3DImporter::ParseNode_Shape_Material()
|
|||
aiColor3D diffuseColor(0.8f, 0.8f, 0.8f);
|
||||
aiColor3D emissiveColor(0, 0, 0);
|
||||
aiColor3D specularColor(0, 0, 0);
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -226,20 +226,20 @@ void X3DImporter::ParseNode_Shape_Material()
|
|||
else
|
||||
{
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_Material(NodeElement_Cur);
|
||||
ne = new X3DMaterial(mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
((CX3DImporter_NodeElement_Material*)ne)->AmbientIntensity = ambientIntensity;
|
||||
((CX3DImporter_NodeElement_Material*)ne)->Shininess = shininess;
|
||||
((CX3DImporter_NodeElement_Material*)ne)->Transparency = transparency;
|
||||
((CX3DImporter_NodeElement_Material*)ne)->DiffuseColor = diffuseColor;
|
||||
((CX3DImporter_NodeElement_Material*)ne)->EmissiveColor = emissiveColor;
|
||||
((CX3DImporter_NodeElement_Material*)ne)->SpecularColor = specularColor;
|
||||
((X3DMaterial*)ne)->AmbientIntensity = ambientIntensity;
|
||||
((X3DMaterial*)ne)->Shininess = shininess;
|
||||
((X3DMaterial*)ne)->Transparency = transparency;
|
||||
((X3DMaterial*)ne)->DiffuseColor = diffuseColor;
|
||||
((X3DMaterial*)ne)->EmissiveColor = emissiveColor;
|
||||
((X3DMaterial*)ne)->SpecularColor = specularColor;
|
||||
// check for child nodes
|
||||
if(!mReader->isEmptyElement())
|
||||
ParseNode_Metadata(ne, "Material");
|
||||
else
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
}// if(!use.empty()) else
|
||||
|
|
|
@ -66,7 +66,7 @@ void X3DImporter::ParseNode_Texturing_ImageTexture()
|
|||
bool repeatS = true;
|
||||
bool repeatT = true;
|
||||
std::list<std::string> url;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -83,22 +83,22 @@ void X3DImporter::ParseNode_Texturing_ImageTexture()
|
|||
else
|
||||
{
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_ImageTexture(NodeElement_Cur);
|
||||
ne = new X3DImageTexture(mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
((CX3DImporter_NodeElement_ImageTexture*)ne)->RepeatS = repeatS;
|
||||
((CX3DImporter_NodeElement_ImageTexture*)ne)->RepeatT = repeatT;
|
||||
((X3DImageTexture*)ne)->RepeatS = repeatS;
|
||||
((X3DImageTexture*)ne)->RepeatT = repeatT;
|
||||
// Attribute "url" can contain list of strings. But we need only one - first.
|
||||
if(!url.empty())
|
||||
((CX3DImporter_NodeElement_ImageTexture*)ne)->URL = url.front();
|
||||
((X3DImageTexture*)ne)->URL = url.front();
|
||||
else
|
||||
((CX3DImporter_NodeElement_ImageTexture*)ne)->URL = "";
|
||||
((X3DImageTexture*)ne)->URL = "";
|
||||
|
||||
// check for X3DMetadataObject childs.
|
||||
if(!mReader->isEmptyElement())
|
||||
ParseNode_Metadata(ne, "ImageTexture");
|
||||
else
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
}// if(!use.empty()) else
|
||||
|
@ -113,7 +113,7 @@ void X3DImporter::ParseNode_Texturing_TextureCoordinate()
|
|||
{
|
||||
std::string use, def;
|
||||
std::list<aiVector2D> point;
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -128,15 +128,15 @@ void X3DImporter::ParseNode_Texturing_TextureCoordinate()
|
|||
else
|
||||
{
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_TextureCoordinate(NodeElement_Cur);
|
||||
ne = new X3DTextureCoordinate(mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
((CX3DImporter_NodeElement_TextureCoordinate*)ne)->Value = point;
|
||||
((X3DTextureCoordinate*)ne)->Value = point;
|
||||
// check for X3DMetadataObject childs.
|
||||
if(!mReader->isEmptyElement())
|
||||
ParseNode_Metadata(ne, "TextureCoordinate");
|
||||
else
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
}// if(!use.empty()) else
|
||||
|
@ -157,7 +157,7 @@ void X3DImporter::ParseNode_Texturing_TextureTransform()
|
|||
float rotation = 0;
|
||||
aiVector2D scale(1, 1);
|
||||
aiVector2D translation(0, 0);
|
||||
CX3DImporter_NodeElement* ne( nullptr );
|
||||
X3DNodeElementBase* ne( nullptr );
|
||||
|
||||
MACRO_ATTRREAD_LOOPBEG;
|
||||
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
|
||||
|
@ -175,18 +175,18 @@ void X3DImporter::ParseNode_Texturing_TextureTransform()
|
|||
else
|
||||
{
|
||||
// create and if needed - define new geometry object.
|
||||
ne = new CX3DImporter_NodeElement_TextureTransform(NodeElement_Cur);
|
||||
ne = new X3DTextureTransform(mNodeElementCur);
|
||||
if(!def.empty()) ne->ID = def;
|
||||
|
||||
((CX3DImporter_NodeElement_TextureTransform*)ne)->Center = center;
|
||||
((CX3DImporter_NodeElement_TextureTransform*)ne)->Rotation = rotation;
|
||||
((CX3DImporter_NodeElement_TextureTransform*)ne)->Scale = scale;
|
||||
((CX3DImporter_NodeElement_TextureTransform*)ne)->Translation = translation;
|
||||
((X3DTextureTransform*)ne)->Center = center;
|
||||
((X3DTextureTransform*)ne)->Rotation = rotation;
|
||||
((X3DTextureTransform*)ne)->Scale = scale;
|
||||
((X3DTextureTransform*)ne)->Translation = translation;
|
||||
// check for X3DMetadataObject childs.
|
||||
if(!mReader->isEmptyElement())
|
||||
ParseNode_Metadata(ne, "TextureTransform");
|
||||
else
|
||||
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
|
||||
mNodeElementCur->Child.push_back(ne);// add made object as child to current element
|
||||
|
||||
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
|
||||
}// if(!use.empty()) else
|
||||
|
|
|
@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
|
|||
|
||||
Copyright (c) 2006-2020, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
|
@ -48,6 +47,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "FIReader.hpp"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace Assimp {
|
||||
|
||||
static const char *encodingAlgorithmTable_3_2[] = {
|
||||
|
|
|
@ -812,9 +812,9 @@ ADD_ASSIMP_IMPORTER( X3D
|
|||
AssetLib/X3D/X3DImporter_Rendering.cpp
|
||||
AssetLib/X3D/X3DImporter_Shape.cpp
|
||||
AssetLib/X3D/X3DImporter_Texturing.cpp
|
||||
AssetLib/X3D/FIReader.hpp
|
||||
AssetLib/X3D/FIReader.cpp
|
||||
AssetLib/X3D/X3DVocabulary.cpp
|
||||
#AssetLib/X3D/FIReader.hpp
|
||||
#AssetLib/X3D/FIReader.cpp
|
||||
#AssetLib/X3D/X3DVocabulary.cpp
|
||||
)
|
||||
|
||||
ADD_ASSIMP_IMPORTER( GLTF
|
||||
|
|
Loading…
Reference in New Issue