start migrating X3D.
parent
deddaf49df
commit
58b81a2590
|
@ -55,24 +55,24 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#endif
|
||||
|
||||
#include <assimp/Exceptional.h>
|
||||
#include <assimp/IOStream.hpp>
|
||||
#include <assimp/types.h>
|
||||
#include <assimp/MemoryIOWrapper.h>
|
||||
#include <assimp/types.h>
|
||||
#include <assimp/IOStream.hpp>
|
||||
#ifdef ASSIMP_USE_HUNTER
|
||||
#include <utf8/utf8.h>
|
||||
#else
|
||||
#include "../contrib/utf8cpp/source/utf8.h"
|
||||
#endif
|
||||
#include <assimp/fast_atof.h>
|
||||
#include <stack>
|
||||
#include <map>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
#include <stack>
|
||||
|
||||
namespace Assimp {
|
||||
|
||||
static const std::string parseErrorMessage = "Fast Infoset parse error";
|
||||
static const char *parseErrorMessage = "Fast Infoset parse error";
|
||||
|
||||
static const char *xmlDeclarations[] = {
|
||||
"<?xml encoding='finf'?>",
|
||||
|
@ -87,9 +87,13 @@ static const char *xmlDeclarations[] = {
|
|||
};
|
||||
|
||||
static size_t parseMagic(const uint8_t *data, const uint8_t *dataEnd) {
|
||||
ai_assert(nullptr != data);
|
||||
ai_assert(nullptr != dataEnd);
|
||||
|
||||
if (dataEnd - data < 4) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t magic = (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3];
|
||||
switch (magic) {
|
||||
case 0xe0000001:
|
||||
|
@ -155,8 +159,8 @@ struct FIHexValueImpl: public FIHexValue {
|
|||
mutable std::string strValue;
|
||||
mutable bool strValueValid;
|
||||
|
||||
FIHexValueImpl(std::vector<uint8_t> &&value_)
|
||||
: strValueValid( false ) {
|
||||
FIHexValueImpl(std::vector<uint8_t> &&value_) :
|
||||
strValueValid(false) {
|
||||
value = std::move(value_);
|
||||
}
|
||||
|
||||
|
@ -181,8 +185,8 @@ struct FIBase64ValueImpl: public FIBase64Value {
|
|||
mutable std::string strValue;
|
||||
mutable bool strValueValid;
|
||||
|
||||
FIBase64ValueImpl(std::vector<uint8_t> &&value_)
|
||||
: strValueValid(false) {
|
||||
FIBase64ValueImpl(std::vector<uint8_t> &&value_) :
|
||||
strValueValid(false) {
|
||||
value = std::move(value_);
|
||||
}
|
||||
|
||||
|
@ -238,8 +242,8 @@ struct FIShortValueImpl: public FIShortValue {
|
|||
mutable std::string strValue;
|
||||
mutable bool strValueValid;
|
||||
|
||||
FIShortValueImpl(std::vector<int16_t> &&value_)
|
||||
: strValueValid(false) {
|
||||
FIShortValueImpl(std::vector<int16_t> &&value_) :
|
||||
strValueValid(false) {
|
||||
value = std::move(value_);
|
||||
}
|
||||
|
||||
|
@ -264,8 +268,8 @@ struct FIIntValueImpl: public FIIntValue {
|
|||
mutable std::string strValue;
|
||||
mutable bool strValueValid;
|
||||
|
||||
FIIntValueImpl(std::vector<int32_t> &&value_)
|
||||
: strValueValid(false) {
|
||||
FIIntValueImpl(std::vector<int32_t> &&value_) :
|
||||
strValueValid(false) {
|
||||
value = std::move(value_);
|
||||
}
|
||||
|
||||
|
@ -290,8 +294,8 @@ struct FILongValueImpl: public FILongValue {
|
|||
mutable std::string strValue;
|
||||
mutable bool strValueValid;
|
||||
|
||||
FILongValueImpl(std::vector<int64_t> &&value_)
|
||||
: strValueValid(false) {
|
||||
FILongValueImpl(std::vector<int64_t> &&value_) :
|
||||
strValueValid(false) {
|
||||
value = std::move(value_);
|
||||
}
|
||||
|
||||
|
@ -316,8 +320,8 @@ struct FIBoolValueImpl: public FIBoolValue {
|
|||
mutable std::string strValue;
|
||||
mutable bool strValueValid;
|
||||
|
||||
FIBoolValueImpl(std::vector<bool> &&value_)
|
||||
: strValueValid(false) {
|
||||
FIBoolValueImpl(std::vector<bool> &&value_) :
|
||||
strValueValid(false) {
|
||||
value = std::move(value_);
|
||||
}
|
||||
|
||||
|
@ -328,7 +332,8 @@ struct FIBoolValueImpl: public FIBoolValue {
|
|||
os << std::boolalpha;
|
||||
int n = 0;
|
||||
std::for_each(value.begin(), value.end(), [&](bool b) {
|
||||
if (++n > 1) os << ' '; os << b;
|
||||
if (++n > 1) os << ' ';
|
||||
os << b;
|
||||
});
|
||||
strValue = os.str();
|
||||
}
|
||||
|
@ -345,8 +350,8 @@ struct FIFloatValueImpl: public FIFloatValue {
|
|||
mutable std::string strValue;
|
||||
mutable bool strValueValid;
|
||||
|
||||
FIFloatValueImpl(std::vector<float> &&value_)
|
||||
: strValueValid(false) {
|
||||
FIFloatValueImpl(std::vector<float> &&value_) :
|
||||
strValueValid(false) {
|
||||
value = std::move(value_);
|
||||
}
|
||||
|
||||
|
@ -371,8 +376,8 @@ struct FIDoubleValueImpl: public FIDoubleValue {
|
|||
mutable std::string strValue;
|
||||
mutable bool strValueValid;
|
||||
|
||||
FIDoubleValueImpl(std::vector<double> &&value_)
|
||||
: strValueValid(false) {
|
||||
FIDoubleValueImpl(std::vector<double> &&value_) :
|
||||
strValueValid(false) {
|
||||
value = std::move(value_);
|
||||
}
|
||||
|
||||
|
@ -396,8 +401,8 @@ struct FIUUIDValueImpl: public FIUUIDValue {
|
|||
mutable std::string strValue;
|
||||
mutable bool strValueValid;
|
||||
|
||||
FIUUIDValueImpl(std::vector<uint8_t> &&value_)
|
||||
: strValueValid(false) {
|
||||
FIUUIDValueImpl(std::vector<uint8_t> &&value_) :
|
||||
strValueValid(false) {
|
||||
value = std::move(value_);
|
||||
}
|
||||
|
||||
|
@ -602,15 +607,22 @@ struct FICDATADecoder: public FIDecoder {
|
|||
|
||||
class CFIReaderImpl : public FIReader {
|
||||
public:
|
||||
|
||||
CFIReaderImpl(std::unique_ptr<uint8_t[]> data_, size_t size) :
|
||||
data(std::move(data_)), dataP(data.get()), dataEnd(data.get() + size), currentNodeType(irr::io::EXN_NONE),
|
||||
emptyElement(false), headerPending(true), terminatorPending(false)
|
||||
{}
|
||||
data(std::move(data_)),
|
||||
dataP(data.get()),
|
||||
dataEnd(data.get() + size),
|
||||
currentNodeType(irr::io::EXN_NONE),
|
||||
emptyElement(false),
|
||||
headerPending(true),
|
||||
terminatorPending(false) {
|
||||
// empty
|
||||
}
|
||||
|
||||
virtual ~CFIReaderImpl() {}
|
||||
~CFIReaderImpl() override {
|
||||
// override
|
||||
}
|
||||
|
||||
virtual bool read() /*override*/ {
|
||||
virtual bool read() {
|
||||
if (headerPending) {
|
||||
headerPending = false;
|
||||
parseHeader();
|
||||
|
@ -620,13 +632,12 @@ public:
|
|||
if (elementStack.empty()) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
nodeName = elementStack.top();
|
||||
elementStack.pop();
|
||||
currentNodeType = nodeName.empty() ? irr::io::EXN_UNKNOWN : irr::io::EXN_ELEMENT_END;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (dataP >= dataEnd) {
|
||||
return false;
|
||||
}
|
||||
|
@ -635,15 +646,13 @@ public:
|
|||
// C.3
|
||||
parseElement();
|
||||
return true;
|
||||
}
|
||||
else if (b < 0xc0) { // Characters (C.3.7.5)
|
||||
} else if (b < 0xc0) { // Characters (C.3.7.5)
|
||||
// C.7
|
||||
auto chars = parseNonIdentifyingStringOrIndex3(vocabulary.charactersTable);
|
||||
nodeName = chars->toString();
|
||||
currentNodeType = irr::io::EXN_TEXT;
|
||||
return true;
|
||||
}
|
||||
else if (b < 0xe0) {
|
||||
} else if (b < 0xe0) {
|
||||
if ((b & 0xfc) == 0xc4) { // DTD (C.2.11.5)
|
||||
// C.9
|
||||
++dataP;
|
||||
|
@ -656,8 +665,7 @@ public:
|
|||
elementStack.push(EmptyString);
|
||||
currentNodeType = irr::io::EXN_UNKNOWN;
|
||||
return true;
|
||||
}
|
||||
else if ((b & 0xfc) == 0xc8) { // Unexpanded entity reference (C.3.7.4)
|
||||
} else if ((b & 0xfc) == 0xc8) { // Unexpanded entity reference (C.3.7.4)
|
||||
// C.6
|
||||
++dataP;
|
||||
/*const std::string &name =*/parseIdentifyingStringOrIndex(vocabulary.otherNCNameTable);
|
||||
|
@ -670,8 +678,7 @@ public:
|
|||
currentNodeType = irr::io::EXN_UNKNOWN;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (b < 0xf0) {
|
||||
} else if (b < 0xf0) {
|
||||
if (b == 0xe1) { // Processing instruction (C.2.11.3, C.3.7.3)
|
||||
// C.5
|
||||
++dataP;
|
||||
|
@ -682,8 +689,7 @@ public:
|
|||
/*std::shared_ptr<const FIValue> data =*/parseNonIdentifyingStringOrIndex1(vocabulary.otherStringTable);
|
||||
currentNodeType = irr::io::EXN_UNKNOWN;
|
||||
return true;
|
||||
}
|
||||
else if (b == 0xe2) { // Comment (C.2.11.4, C.3.7.6)
|
||||
} else if (b == 0xe2) { // Comment (C.2.11.4, C.3.7.6)
|
||||
// C.8
|
||||
++dataP;
|
||||
if (dataEnd - dataP < 1) {
|
||||
|
@ -694,16 +700,14 @@ public:
|
|||
currentNodeType = irr::io::EXN_COMMENT;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else { // Terminator (C.2.12, C.3.8)
|
||||
} else { // Terminator (C.2.12, C.3.8)
|
||||
++dataP;
|
||||
if (b == 0xff) {
|
||||
terminatorPending = true;
|
||||
}
|
||||
if (elementStack.empty()) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
nodeName = elementStack.top();
|
||||
elementStack.pop();
|
||||
currentNodeType = nodeName.empty() ? irr::io::EXN_UNKNOWN : irr::io::EXN_ELEMENT_END;
|
||||
|
@ -842,13 +846,13 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
|
||||
struct QName {
|
||||
std::string prefix;
|
||||
std::string uri;
|
||||
std::string name;
|
||||
inline QName() {}
|
||||
inline QName(const FIQName &qname): prefix(qname.prefix ? qname.prefix : ""), uri(qname.uri ? qname.uri : ""), name(qname.name) {}
|
||||
inline QName(const FIQName &qname) :
|
||||
prefix(qname.prefix ? qname.prefix : ""), uri(qname.uri ? qname.uri : ""), name(qname.name) {}
|
||||
};
|
||||
|
||||
struct Attribute {
|
||||
|
@ -893,13 +897,11 @@ private:
|
|||
uint8_t b = *dataP++;
|
||||
if (!(b & 0x40)) { // x0...... (C.25.2)
|
||||
return b & 0x3f;
|
||||
}
|
||||
else if ((b & 0x60) == 0x40) { // x10..... ........ (C.25.3)
|
||||
} else if ((b & 0x60) == 0x40) { // x10..... ........ (C.25.3)
|
||||
if (dataEnd - dataP > 0) {
|
||||
return (((b & 0x1f) << 8) | *dataP++) + 0x40;
|
||||
}
|
||||
}
|
||||
else if ((b & 0x70) == 0x60) { // x110.... ........ ........ (C.25.4)
|
||||
} else if ((b & 0x70) == 0x60) { // x110.... ........ ........ (C.25.4)
|
||||
if (dataEnd - dataP > 1) {
|
||||
size_t result = (((b & 0x0f) << 16) | (dataP[0] << 8) | dataP[1]) + 0x2040;
|
||||
dataP += 2;
|
||||
|
@ -913,20 +915,17 @@ private:
|
|||
uint8_t b = *dataP++;
|
||||
if (!(b & 0x20)) { // xx0..... (C.27.2)
|
||||
return b & 0x1f;
|
||||
}
|
||||
else if ((b & 0x38) == 0x20) { // xx100... ........ (C.27.3)
|
||||
} else if ((b & 0x38) == 0x20) { // xx100... ........ (C.27.3)
|
||||
if (dataEnd - dataP > 0) {
|
||||
return (((b & 0x07) << 8) | *dataP++) + 0x20;
|
||||
}
|
||||
}
|
||||
else if ((b & 0x38) == 0x28) { // xx101... ........ ........ (C.27.4)
|
||||
} else if ((b & 0x38) == 0x28) { // xx101... ........ ........ (C.27.4)
|
||||
if (dataEnd - dataP > 1) {
|
||||
size_t result = (((b & 0x07) << 16) | (dataP[0] << 8) | dataP[1]) + 0x820;
|
||||
dataP += 2;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
else if ((b & 0x3f) == 0x30) { // xx110000 0000.... ........ ........ (C.27.5)
|
||||
} else if ((b & 0x3f) == 0x30) { // xx110000 0000.... ........ ........ (C.27.5)
|
||||
if ((dataEnd - dataP > 2) && !(dataP[0] & 0xf0)) {
|
||||
size_t result = (((dataP[0] & 0x0f) << 16) | (dataP[1] << 8) | dataP[2]) + 0x80820;
|
||||
dataP += 3;
|
||||
|
@ -940,20 +939,17 @@ private:
|
|||
uint8_t b = *dataP++;
|
||||
if (!(b & 0x10)) { // xxx0.... (C.28.2)
|
||||
return b & 0x0f;
|
||||
}
|
||||
else if ((b & 0x1c) == 0x10) { // xxx100.. ........ (C.28.3)
|
||||
} else if ((b & 0x1c) == 0x10) { // xxx100.. ........ (C.28.3)
|
||||
if (dataEnd - dataP > 0) {
|
||||
return (((b & 0x03) << 8) | *dataP++) + 0x10;
|
||||
}
|
||||
}
|
||||
else if ((b & 0x1c) == 0x14) { // xxx101.. ........ ........ (C.28.4)
|
||||
} else if ((b & 0x1c) == 0x14) { // xxx101.. ........ ........ (C.28.4)
|
||||
if (dataEnd - dataP > 1) {
|
||||
size_t result = (((b & 0x03) << 16) | (dataP[0] << 8) | dataP[1]) + 0x410;
|
||||
dataP += 2;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
else if ((b & 0x1f) == 0x18) { // xxx11000 0000.... ........ ........ (C.28.5)
|
||||
} else if ((b & 0x1f) == 0x18) { // xxx11000 0000.... ........ ........ (C.28.5)
|
||||
if ((dataEnd - dataP > 2) && !(dataP[0] & 0xf0)) {
|
||||
size_t result = (((dataP[0] & 0x0f) << 16) | (dataP[1] << 8) | dataP[2]) + 0x40410;
|
||||
dataP += 3;
|
||||
|
@ -968,8 +964,7 @@ private:
|
|||
uint8_t b = *dataP++;
|
||||
if (b < 0x80) { // 0....... (C.21.2)
|
||||
return b;
|
||||
}
|
||||
else if ((b & 0xf0) == 0x80) { // 1000.... ........ ........ (C.21.3)
|
||||
} else if ((b & 0xf0) == 0x80) { // 1000.... ........ ........ (C.21.3)
|
||||
if (dataEnd - dataP > 1) {
|
||||
size_t result = (((b & 0x0f) << 16) | (dataP[0] << 8) | dataP[1]) + 0x80;
|
||||
dataP += 2;
|
||||
|
@ -986,21 +981,18 @@ private:
|
|||
size_t len;
|
||||
if (!(b & 0x40)) { // x0...... (C.22.3.1)
|
||||
len = b + 1;
|
||||
}
|
||||
else if (b == 0x40) { // x1000000 ........ (C.22.3.2)
|
||||
} else if (b == 0x40) { // x1000000 ........ (C.22.3.2)
|
||||
if (dataEnd - dataP < 1) {
|
||||
throw DeadlyImportError(parseErrorMessage);
|
||||
}
|
||||
len = *dataP++ + 0x41;
|
||||
}
|
||||
else if (b == 0x60) { // x1100000 ........ ........ ........ ........ (C.22.3.3)
|
||||
} else if (b == 0x60) { // x1100000 ........ ........ ........ ........ (C.22.3.3)
|
||||
if (dataEnd - dataP < 4) {
|
||||
throw DeadlyImportError(parseErrorMessage);
|
||||
}
|
||||
len = ((dataP[0] << 24) | (dataP[1] << 16) | (dataP[2] << 8) | dataP[3]) + 0x141;
|
||||
dataP += 4;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw DeadlyImportError(parseErrorMessage);
|
||||
}
|
||||
|
||||
|
@ -1019,13 +1011,11 @@ private:
|
|||
size_t b = *dataP++ & 0x0f;
|
||||
if (!(b & 0x08)) { // xxxx0... (C.23.3.1)
|
||||
return b + 1;
|
||||
}
|
||||
else if (b == 0x08) { // xxxx1000 ........ (C.23.3.2)
|
||||
} else if (b == 0x08) { // xxxx1000 ........ (C.23.3.2)
|
||||
if (dataEnd - dataP > 0) {
|
||||
return *dataP++ + 0x09;
|
||||
}
|
||||
}
|
||||
else if (b == 0x0c) { // xxxx1100 ........ ........ ........ ........ (C.23.3.3)
|
||||
} else if (b == 0x0c) { // xxxx1100 ........ ........ ........ ........ (C.23.3.3)
|
||||
if (dataEnd - dataP > 3) {
|
||||
size_t result = ((dataP[0] << 24) | (dataP[1] << 16) | (dataP[2] << 8) | dataP[3]) + 0x109;
|
||||
dataP += 4;
|
||||
|
@ -1040,13 +1030,11 @@ private:
|
|||
size_t b = *dataP++ & 0x03;
|
||||
if (!(b & 0x02)) { // xxxxxx0. (C.24.3.1)
|
||||
return b + 1;
|
||||
}
|
||||
else if (b == 0x02) { // xxxxxx10 ........ (C.24.3.2)
|
||||
} else if (b == 0x02) { // xxxxxx10 ........ (C.24.3.2)
|
||||
if (dataEnd - dataP > 0) {
|
||||
return *dataP++ + 0x3;
|
||||
}
|
||||
}
|
||||
else if (b == 0x03) { // xxxxxx11 ........ ........ ........ ........ (C.24.3.3)
|
||||
} else if (b == 0x03) { // xxxxxx11 ........ ........ ........ ........ (C.24.3.3)
|
||||
if (dataEnd - dataP > 3) {
|
||||
size_t result = ((dataP[0] << 24) | (dataP[1] << 16) | (dataP[2] << 8) | dataP[3]) + 0x103;
|
||||
dataP += 4;
|
||||
|
@ -1063,8 +1051,7 @@ private:
|
|||
throw DeadlyImportError("Invalid encoding algorithm index " + to_string(index));
|
||||
}
|
||||
return decoder->decode(dataP, len);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (index - 32 >= vocabulary.encodingAlgorithmTable.size()) {
|
||||
throw DeadlyImportError("Invalid encoding algorithm index " + to_string(index));
|
||||
}
|
||||
|
@ -1072,8 +1059,7 @@ private:
|
|||
auto it = decoderMap.find(uri);
|
||||
if (it == decoderMap.end()) {
|
||||
throw DeadlyImportError("Unsupported encoding algorithm " + uri);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return it->second->decode(dataP, len);
|
||||
}
|
||||
}
|
||||
|
@ -1092,8 +1078,7 @@ private:
|
|||
default:
|
||||
throw DeadlyImportError("Invalid restricted alphabet index " + to_string(index));
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (index - 16 >= vocabulary.restrictedAlphabetTable.size()) {
|
||||
throw DeadlyImportError("Invalid restricted alphabet index " + to_string(index));
|
||||
}
|
||||
|
@ -1146,13 +1131,11 @@ private:
|
|||
if (b & 0x10) {
|
||||
// encoding algorithm (C.19.3.4)
|
||||
result = parseEncodedData(index, len);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// Restricted alphabet (C.19.3.3)
|
||||
result = parseRestrictedAlphabet(index, len);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
len = parseNonEmptyOctetString5Length();
|
||||
if (dataEnd - dataP < static_cast<ptrdiff_t>(len)) {
|
||||
throw DeadlyImportError(parseErrorMessage);
|
||||
|
@ -1163,8 +1146,7 @@ private:
|
|||
throw DeadlyImportError(parseErrorMessage);
|
||||
}
|
||||
result = FIStringValue::create(parseUTF16String(dataP, len));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// UTF-8 (C.19.3.1)
|
||||
result = FIStringValue::create(parseUTF8String(dataP, len));
|
||||
}
|
||||
|
@ -1190,13 +1172,11 @@ private:
|
|||
if (b & 0x04) {
|
||||
// encoding algorithm (C.20.3.4)
|
||||
result = parseEncodedData(index, len);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// Restricted alphabet (C.20.3.3)
|
||||
result = parseRestrictedAlphabet(index, len);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
len = parseNonEmptyOctetString7Length();
|
||||
if (dataEnd - dataP < static_cast<ptrdiff_t>(len)) {
|
||||
throw DeadlyImportError(parseErrorMessage);
|
||||
|
@ -1207,8 +1187,7 @@ private:
|
|||
throw DeadlyImportError(parseErrorMessage);
|
||||
}
|
||||
result = FIStringValue::create(parseUTF16String(dataP, len));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// UTF-8 (C.20.3.1)
|
||||
result = FIStringValue::create(parseUTF8String(dataP, len));
|
||||
}
|
||||
|
@ -1229,8 +1208,7 @@ private:
|
|||
throw DeadlyImportError(parseErrorMessage);
|
||||
}
|
||||
return stringTable[index];
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// We have a string (C.13.3)
|
||||
stringTable.push_back(parseNonEmptyOctetString2());
|
||||
return stringTable.back();
|
||||
|
@ -1293,8 +1271,7 @@ private:
|
|||
result.name = parseIdentifyingStringOrIndex(vocabulary.localNameTable);
|
||||
qNameTable.push_back(result);
|
||||
return qNameTable.back();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// We have an index (C.17.4)
|
||||
size_t index = parseInt2();
|
||||
if (index >= qNameTable.size()) {
|
||||
|
@ -1318,8 +1295,7 @@ private:
|
|||
result.name = parseIdentifyingStringOrIndex(vocabulary.localNameTable);
|
||||
qNameTable.push_back(result);
|
||||
return qNameTable.back();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// We have an index (C.18.4)
|
||||
size_t index = parseInt3();
|
||||
if (index >= qNameTable.size()) {
|
||||
|
@ -1335,16 +1311,14 @@ private:
|
|||
// empty string
|
||||
++dataP;
|
||||
return EmptyFIString;
|
||||
}
|
||||
else if (b & 0x80) { // C.14.4
|
||||
} else if (b & 0x80) { // C.14.4
|
||||
// We have an index
|
||||
size_t index = parseInt2();
|
||||
if (index >= valueTable.size()) {
|
||||
throw DeadlyImportError(parseErrorMessage);
|
||||
}
|
||||
return valueTable[index];
|
||||
}
|
||||
else { // C.14.3
|
||||
} else { // C.14.3
|
||||
// We have a literal
|
||||
std::shared_ptr<const FIValue> result = parseEncodedCharacterString3();
|
||||
if (b & 0x40) { // C.14.3.1
|
||||
|
@ -1363,8 +1337,7 @@ private:
|
|||
throw DeadlyImportError(parseErrorMessage);
|
||||
}
|
||||
return valueTable[index];
|
||||
}
|
||||
else { // C.15.3
|
||||
} else { // C.15.3
|
||||
// We have a literal
|
||||
std::shared_ptr<const FIValue> result = parseEncodedCharacterString5();
|
||||
if (b & 0x10) { // C.15.3.1
|
||||
|
@ -1429,8 +1402,7 @@ private:
|
|||
}
|
||||
attr.value = parseNonIdentifyingStringOrIndex1(vocabulary.attributeValueTable);
|
||||
attributes.push_back(attr);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if ((b & 0xf0) != 0xf0) { // C.3.6.2
|
||||
throw DeadlyImportError(parseErrorMessage);
|
||||
}
|
||||
|
@ -1439,8 +1411,7 @@ private:
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (dataEnd - dataP < 1) {
|
||||
throw DeadlyImportError(parseErrorMessage);
|
||||
}
|
||||
|
@ -1776,14 +1747,11 @@ FIDecoder *CFIReaderImpl::defaultDecoder[32] = {
|
|||
&cdataDecoder
|
||||
};
|
||||
|
||||
class CXMLReaderImpl : public FIReader
|
||||
{
|
||||
class CXMLReaderImpl : public FIReader {
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CXMLReaderImpl(std::unique_ptr<irr::io::IIrrXMLReader<char, irr::io::IXMLBase>> reader_)
|
||||
: reader(std::move(reader_))
|
||||
{}
|
||||
CXMLReaderImpl(std::unique_ptr<irr::io::IIrrXMLReader<char, irr::io::IXMLBase>> reader_) :
|
||||
reader(std::move(reader_)) {}
|
||||
|
||||
virtual ~CXMLReaderImpl() {}
|
||||
|
||||
|
@ -1861,11 +1829,9 @@ public:
|
|||
|
||||
virtual void registerDecoder(const std::string & /*algorithmUri*/, std::unique_ptr<FIDecoder> /*decoder*/) /*override*/ {}
|
||||
|
||||
|
||||
virtual void registerVocabulary(const std::string & /*vocabularyUri*/, const FIVocabulary * /*vocabulary*/) /*override*/ {}
|
||||
|
||||
private:
|
||||
|
||||
std::unique_ptr<irr::io::IIrrXMLReader<char, irr::io::IXMLBase>> reader;
|
||||
};
|
||||
|
||||
|
@ -1880,15 +1846,13 @@ static std::unique_ptr<uint8_t[]> readFile(IOStream *stream, size_t &size, bool
|
|||
return data;
|
||||
}
|
||||
|
||||
std::unique_ptr<FIReader> FIReader::create(IOStream *stream)
|
||||
{
|
||||
std::unique_ptr<FIReader> FIReader::create(IOStream *stream) {
|
||||
size_t size;
|
||||
bool isFI;
|
||||
auto data = readFile(stream, size, isFI);
|
||||
if (isFI) {
|
||||
return std::unique_ptr<FIReader>(new CFIReaderImpl(std::move(data), size));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
auto memios = std::unique_ptr<MemoryIOStream>(new MemoryIOStream(data.release(), size, true));
|
||||
auto callback = std::unique_ptr<CIrrXML_IOStreamReader>(new CIrrXML_IOStreamReader(memios.get()));
|
||||
return std::unique_ptr<FIReader>(new CXMLReaderImpl(std::unique_ptr<irr::io::IIrrXMLReader<char, irr::io::IXMLBase>>(createIrrXMLReader(callback.get()))));
|
||||
|
|
|
@ -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>
|
||||
|
@ -171,12 +169,13 @@ 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
|
||||
|
||||
inline
|
||||
FIReader::~FIReader() {
|
||||
inline FIReader::~FIReader() {
|
||||
// empty
|
||||
}
|
||||
|
||||
|
|
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();
|
||||
|
|
|
@ -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,
|
||||
|
@ -53,23 +52,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
// Header files, stdlib.
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
/// \class CX3DImporter_NodeElement
|
||||
/// Base class for elements of nodes.
|
||||
class CX3DImporter_NodeElement
|
||||
{
|
||||
/***********************************************/
|
||||
/******************** Types ********************/
|
||||
/***********************************************/
|
||||
|
||||
class X3DNodeElementBase {
|
||||
public:
|
||||
|
||||
/// \enum EType
|
||||
/// Define what data type contain node element.
|
||||
enum EType
|
||||
{
|
||||
enum EType {
|
||||
ENET_Group, ///< Element has type "Group".
|
||||
ENET_MetaBoolean, ///< Element has type "Metadata boolean".
|
||||
ENET_MetaDouble, ///< Element has type "Metadata double".
|
||||
|
@ -118,63 +108,34 @@ public:
|
|||
ENET_Invalid ///< Element has invalid type and possible contain invalid data.
|
||||
};
|
||||
|
||||
/***********************************************/
|
||||
/****************** Constants ******************/
|
||||
/***********************************************/
|
||||
|
||||
public:
|
||||
|
||||
const EType Type;
|
||||
|
||||
/***********************************************/
|
||||
/****************** Variables ******************/
|
||||
/***********************************************/
|
||||
|
||||
public:
|
||||
|
||||
std::string ID; ///< ID of the element. Can be empty. In X3D synonym for "ID" attribute.
|
||||
CX3DImporter_NodeElement* Parent;///< Parent element. If nullptr then this node is root.
|
||||
std::list<CX3DImporter_NodeElement*> Child;///< Child elements.
|
||||
|
||||
/***********************************************/
|
||||
/****************** Functions ******************/
|
||||
/***********************************************/
|
||||
X3DNodeElementBase *Parent; ///< Parent element. If nullptr then this node is root.
|
||||
std::list<X3DNodeElementBase *> Child; ///< Child elements.
|
||||
|
||||
/// @brief The destructor, virtual.
|
||||
virtual ~CX3DImporter_NodeElement() {
|
||||
virtual ~X3DNodeElementBase() {
|
||||
// empty
|
||||
}
|
||||
|
||||
private:
|
||||
/// Disabled copy constructor.
|
||||
CX3DImporter_NodeElement(const CX3DImporter_NodeElement& pNodeElement);
|
||||
|
||||
/// Disabled assign operator.
|
||||
CX3DImporter_NodeElement& operator=(const CX3DImporter_NodeElement& pNodeElement);
|
||||
|
||||
/// Disabled default constructor.
|
||||
CX3DImporter_NodeElement();
|
||||
|
||||
protected:
|
||||
/// In constructor inheritor must set element type.
|
||||
/// \param [in] pType - element type.
|
||||
/// \param [in] pParent - parent element.
|
||||
CX3DImporter_NodeElement(const EType pType, CX3DImporter_NodeElement* pParent)
|
||||
: Type(pType), Parent(pParent)
|
||||
{}
|
||||
X3DNodeElementBase(const EType pType, X3DNodeElementBase *pParent) :
|
||||
Type(pType), Parent(pParent) {}
|
||||
|
||||
X3DNodeElementBase(const X3DNodeElementBase &pNodeElement) = delete;
|
||||
X3DNodeElementBase &operator=(const X3DNodeElementBase &pNodeElement) = delete;
|
||||
X3DNodeElementBase() = delete;
|
||||
}; // class IX3DImporter_NodeElement
|
||||
|
||||
/// \class CX3DImporter_NodeElement_Group
|
||||
/// Class that define grouping node. Define transformation matrix for children.
|
||||
/// Also can select which child will be kept and others are removed.
|
||||
class CX3DImporter_NodeElement_Group : public CX3DImporter_NodeElement
|
||||
{
|
||||
/***********************************************/
|
||||
/****************** Variables ******************/
|
||||
/***********************************************/
|
||||
|
||||
class X3DGroup : public X3DNodeElementBase {
|
||||
public:
|
||||
|
||||
aiMatrix4x4 Transformation; ///< Transformation matrix.
|
||||
|
||||
/// \var bool Static
|
||||
|
@ -186,290 +147,175 @@ public:
|
|||
bool UseChoice; ///< Flag: if true then use number from \ref Choice to choose what the child will be kept.
|
||||
int32_t Choice; ///< Number of the child which will be kept.
|
||||
|
||||
/***********************************************/
|
||||
/****************** Functions ******************/
|
||||
/***********************************************/
|
||||
|
||||
private:
|
||||
|
||||
/// \fn CX3DImporter_NodeElement_Group(const CX3DImporter_NodeElement_Group& pNode)
|
||||
/// Disabled copy constructor.
|
||||
CX3DImporter_NodeElement_Group(const CX3DImporter_NodeElement_Group& pNode);
|
||||
|
||||
/// \fn CX3DImporter_NodeElement_Group& operator=(const CX3DImporter_NodeElement_Group& pNode)
|
||||
/// Disabled assign operator.
|
||||
CX3DImporter_NodeElement_Group& operator=(const CX3DImporter_NodeElement_Group& pNode);
|
||||
|
||||
/// \fn CX3DImporter_NodeElement_Group()
|
||||
/// Disabled default constructor.
|
||||
CX3DImporter_NodeElement_Group();
|
||||
|
||||
public:
|
||||
|
||||
/// \fn CX3DImporter_NodeElement_Group(CX3DImporter_NodeElement_Group* pParent, const bool pStatic = false)
|
||||
/// Constructor.
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
/// \param [in] pStatic - static node flag.
|
||||
CX3DImporter_NodeElement_Group(CX3DImporter_NodeElement* pParent, const bool pStatic = false)
|
||||
: CX3DImporter_NodeElement(ENET_Group, pParent), Static(pStatic), UseChoice(false)
|
||||
{}
|
||||
|
||||
X3DGroup(X3DNodeElementBase *pParent, const bool pStatic = false) :
|
||||
X3DNodeElementBase(ENET_Group, pParent),
|
||||
Static(pStatic),
|
||||
UseChoice(false) {
|
||||
// empty
|
||||
}
|
||||
}; // class CX3DImporter_NodeElement_Group
|
||||
|
||||
/// \class CX3DImporter_NodeElement_Meta
|
||||
/// This struct describe metavalue.
|
||||
class CX3DImporter_NodeElement_Meta : public CX3DImporter_NodeElement
|
||||
{
|
||||
/***********************************************/
|
||||
/****************** Variables ******************/
|
||||
/***********************************************/
|
||||
|
||||
/// This struct describe meta-value.
|
||||
class X3DMeta : public X3DNodeElementBase {
|
||||
public:
|
||||
|
||||
std::string Name; ///< Name of metadata object.
|
||||
/// \var std::string Reference
|
||||
|
||||
/// If provided, it identifies the metadata standard or other specification that defines the name field. If the reference field is not provided or is
|
||||
/// empty, the meaning of the name field is considered implicit to the characters in the string.
|
||||
std::string Reference;
|
||||
|
||||
/***********************************************/
|
||||
/****************** Functions ******************/
|
||||
/***********************************************/
|
||||
|
||||
private:
|
||||
|
||||
/// \fn CX3DImporter_NodeElement_Meta(const CX3DImporter_NodeElement_Meta& pNode)
|
||||
/// Disabled copy constructor.
|
||||
CX3DImporter_NodeElement_Meta(const CX3DImporter_NodeElement_Meta& pNode);
|
||||
|
||||
/// \fn CX3DImporter_NodeElement_Meta& operator=(const CX3DImporter_NodeElement_Meta& pNode)
|
||||
/// Disabled assign operator.
|
||||
CX3DImporter_NodeElement_Meta& operator=(const CX3DImporter_NodeElement_Meta& pNode);
|
||||
|
||||
/// \fn CX3DImporter_NodeElement_Meta()
|
||||
/// Disabled default constructor.
|
||||
CX3DImporter_NodeElement_Meta();
|
||||
|
||||
public:
|
||||
|
||||
/// \fn CX3DImporter_NodeElement_Meta(const EType pType, CX3DImporter_NodeElement* pParent)
|
||||
/// In constructor inheritor must set element type.
|
||||
/// \param [in] pType - element type.
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
CX3DImporter_NodeElement_Meta(const EType pType, CX3DImporter_NodeElement* pParent)
|
||||
: CX3DImporter_NodeElement(pType, pParent)
|
||||
{}
|
||||
|
||||
X3DMeta(const EType pType, X3DNodeElementBase *pParent) :
|
||||
X3DNodeElementBase(pType, pParent) {}
|
||||
}; // class CX3DImporter_NodeElement_Meta
|
||||
|
||||
/// \struct CX3DImporter_NodeElement_MetaBoolean
|
||||
/// This struct describe metavalue of type boolean.
|
||||
struct CX3DImporter_NodeElement_MetaBoolean : public CX3DImporter_NodeElement_Meta
|
||||
{
|
||||
struct X3DMetaBoolean : public X3DMeta {
|
||||
std::vector<bool> Value; ///< Stored value.
|
||||
|
||||
/// \fn CX3DImporter_NodeElement_MetaBoolean(CX3DImporter_NodeElement* pParent)
|
||||
/// Constructor
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
CX3DImporter_NodeElement_MetaBoolean(CX3DImporter_NodeElement* pParent)
|
||||
: CX3DImporter_NodeElement_Meta(ENET_MetaBoolean, pParent)
|
||||
{}
|
||||
X3DMetaBoolean(X3DNodeElementBase *pParent) :
|
||||
X3DMeta(ENET_MetaBoolean, pParent) {}
|
||||
|
||||
}; // struct CX3DImporter_NodeElement_MetaBoolean
|
||||
|
||||
/// \struct CX3DImporter_NodeElement_MetaDouble
|
||||
/// This struct describe metavalue of type double.
|
||||
struct CX3DImporter_NodeElement_MetaDouble : public CX3DImporter_NodeElement_Meta
|
||||
{
|
||||
struct X3DMetaDouble : public X3DMeta {
|
||||
std::vector<double> Value; ///< Stored value.
|
||||
|
||||
/// \fn CX3DImporter_NodeElement_MetaDouble(CX3DImporter_NodeElement* pParent)
|
||||
/// Constructor
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
CX3DImporter_NodeElement_MetaDouble(CX3DImporter_NodeElement* pParent)
|
||||
: CX3DImporter_NodeElement_Meta(ENET_MetaDouble, pParent)
|
||||
{}
|
||||
X3DMetaDouble(X3DNodeElementBase *pParent) :
|
||||
X3DMeta(ENET_MetaDouble, pParent) {}
|
||||
|
||||
}; // struct CX3DImporter_NodeElement_MetaDouble
|
||||
|
||||
/// \struct CX3DImporter_NodeElement_MetaFloat
|
||||
/// This struct describe metavalue of type float.
|
||||
struct CX3DImporter_NodeElement_MetaFloat : public CX3DImporter_NodeElement_Meta
|
||||
{
|
||||
struct X3DMetaFloat : public X3DMeta {
|
||||
std::vector<float> Value; ///< Stored value.
|
||||
|
||||
/// \fn CX3DImporter_NodeElement_MetaFloat(CX3DImporter_NodeElement* pParent)
|
||||
/// Constructor
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
CX3DImporter_NodeElement_MetaFloat(CX3DImporter_NodeElement* pParent)
|
||||
: CX3DImporter_NodeElement_Meta(ENET_MetaFloat, pParent)
|
||||
{}
|
||||
X3DMetaFloat(X3DNodeElementBase *pParent) :
|
||||
X3DMeta(ENET_MetaFloat, pParent) {}
|
||||
|
||||
}; // struct CX3DImporter_NodeElement_MetaFloat
|
||||
|
||||
/// \struct CX3DImporter_NodeElement_MetaInteger
|
||||
/// This struct describe metavalue of type integer.
|
||||
struct CX3DImporter_NodeElement_MetaInteger : public CX3DImporter_NodeElement_Meta
|
||||
{
|
||||
struct X3DMetaInteger : public X3DMeta {
|
||||
std::vector<int32_t> Value; ///< Stored value.
|
||||
|
||||
/// \fn CX3DImporter_NodeElement_MetaInteger(CX3DImporter_NodeElement* pParent)
|
||||
/// Constructor
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
CX3DImporter_NodeElement_MetaInteger(CX3DImporter_NodeElement* pParent)
|
||||
: CX3DImporter_NodeElement_Meta(ENET_MetaInteger, pParent)
|
||||
{}
|
||||
X3DMetaInteger(X3DNodeElementBase *pParent) :
|
||||
X3DMeta(ENET_MetaInteger, pParent) {}
|
||||
|
||||
}; // struct CX3DImporter_NodeElement_MetaInteger
|
||||
|
||||
/// \struct CX3DImporter_NodeElement_MetaSet
|
||||
/// This struct describe container for metaobjects.
|
||||
struct CX3DImporter_NodeElement_MetaSet : public CX3DImporter_NodeElement_Meta
|
||||
{
|
||||
std::list<CX3DImporter_NodeElement_Meta> Value;///< Stored value.
|
||||
struct X3DMetaSet : public X3DMeta {
|
||||
std::list<X3DMeta> Value; ///< Stored value.
|
||||
|
||||
/// \fn CX3DImporter_NodeElement_MetaSet(CX3DImporter_NodeElement* pParent)
|
||||
/// Constructor
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
CX3DImporter_NodeElement_MetaSet(CX3DImporter_NodeElement* pParent)
|
||||
: CX3DImporter_NodeElement_Meta(ENET_MetaSet, pParent)
|
||||
{}
|
||||
X3DMetaSet(X3DNodeElementBase *pParent) :
|
||||
X3DMeta(ENET_MetaSet, pParent) {}
|
||||
|
||||
}; // struct CX3DImporter_NodeElement_MetaSet
|
||||
|
||||
/// \struct CX3DImporter_NodeElement_MetaString
|
||||
/// This struct describe metavalue of type string.
|
||||
struct CX3DImporter_NodeElement_MetaString : public CX3DImporter_NodeElement_Meta
|
||||
{
|
||||
struct X3DMetaString : public X3DMeta {
|
||||
std::list<std::string> Value; ///< Stored value.
|
||||
|
||||
/// \fn CX3DImporter_NodeElement_MetaString(CX3DImporter_NodeElement* pParent)
|
||||
/// Constructor
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
CX3DImporter_NodeElement_MetaString(CX3DImporter_NodeElement* pParent)
|
||||
: CX3DImporter_NodeElement_Meta(ENET_MetaString, pParent)
|
||||
{}
|
||||
X3DMetaString(X3DNodeElementBase *pParent) :
|
||||
X3DMeta(ENET_MetaString, pParent) {}
|
||||
|
||||
}; // struct CX3DImporter_NodeElement_MetaString
|
||||
|
||||
/// \struct CX3DImporter_NodeElement_Color
|
||||
/// This struct hold <Color> value.
|
||||
struct CX3DImporter_NodeElement_Color : public CX3DImporter_NodeElement
|
||||
{
|
||||
struct X3DColor : public X3DNodeElementBase {
|
||||
std::list<aiColor3D> Value; ///< Stored value.
|
||||
|
||||
/// \fn CX3DImporter_NodeElement_Color(CX3DImporter_NodeElement* pParent)
|
||||
/// Constructor
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
CX3DImporter_NodeElement_Color(CX3DImporter_NodeElement* pParent)
|
||||
: CX3DImporter_NodeElement(ENET_Color, pParent)
|
||||
{}
|
||||
X3DColor(X3DNodeElementBase *pParent) :
|
||||
X3DNodeElementBase(ENET_Color, pParent) {}
|
||||
|
||||
}; // struct CX3DImporter_NodeElement_Color
|
||||
|
||||
/// \struct CX3DImporter_NodeElement_ColorRGBA
|
||||
/// This struct hold <ColorRGBA> value.
|
||||
struct CX3DImporter_NodeElement_ColorRGBA : public CX3DImporter_NodeElement
|
||||
{
|
||||
struct X3DColorRGBA : public X3DNodeElementBase {
|
||||
std::list<aiColor4D> Value; ///< Stored value.
|
||||
|
||||
/// \fn CX3DImporter_NodeElement_ColorRGBA(CX3DImporter_NodeElement* pParent)
|
||||
/// Constructor
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
CX3DImporter_NodeElement_ColorRGBA(CX3DImporter_NodeElement* pParent)
|
||||
: CX3DImporter_NodeElement(ENET_ColorRGBA, pParent)
|
||||
{}
|
||||
X3DColorRGBA(X3DNodeElementBase *pParent) :
|
||||
X3DNodeElementBase(ENET_ColorRGBA, pParent) {}
|
||||
|
||||
}; // struct CX3DImporter_NodeElement_ColorRGBA
|
||||
|
||||
/// \struct CX3DImporter_NodeElement_Coordinate
|
||||
/// This struct hold <Coordinate> value.
|
||||
struct CX3DImporter_NodeElement_Coordinate : public CX3DImporter_NodeElement
|
||||
{
|
||||
struct X3DCoordinate : public X3DNodeElementBase {
|
||||
std::list<aiVector3D> Value; ///< Stored value.
|
||||
|
||||
/// \fn CX3DImporter_NodeElement_Coordinate(CX3DImporter_NodeElement* pParent)
|
||||
/// Constructor
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
CX3DImporter_NodeElement_Coordinate(CX3DImporter_NodeElement* pParent)
|
||||
: CX3DImporter_NodeElement(ENET_Coordinate, pParent)
|
||||
{}
|
||||
X3DCoordinate(X3DNodeElementBase *pParent) :
|
||||
X3DNodeElementBase(ENET_Coordinate, pParent) {}
|
||||
|
||||
}; // struct CX3DImporter_NodeElement_Coordinate
|
||||
|
||||
/// \struct CX3DImporter_NodeElement_Normal
|
||||
/// This struct hold <Normal> value.
|
||||
struct CX3DImporter_NodeElement_Normal : public CX3DImporter_NodeElement
|
||||
{
|
||||
struct X3DNormal : public X3DNodeElementBase {
|
||||
std::list<aiVector3D> Value; ///< Stored value.
|
||||
|
||||
/// \fn CX3DImporter_NodeElement_Normal(CX3DImporter_NodeElement* pParent)
|
||||
/// Constructor
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
CX3DImporter_NodeElement_Normal(CX3DImporter_NodeElement* pParent)
|
||||
: CX3DImporter_NodeElement(ENET_Normal, pParent)
|
||||
{}
|
||||
X3DNormal(X3DNodeElementBase *pParent) :
|
||||
X3DNodeElementBase(ENET_Normal, pParent) {}
|
||||
|
||||
}; // struct CX3DImporter_NodeElement_Normal
|
||||
|
||||
/// \struct CX3DImporter_NodeElement_TextureCoordinate
|
||||
/// This struct hold <TextureCoordinate> value.
|
||||
struct CX3DImporter_NodeElement_TextureCoordinate : public CX3DImporter_NodeElement
|
||||
{
|
||||
struct X3DTextureCoordinate : public X3DNodeElementBase {
|
||||
std::list<aiVector2D> Value; ///< Stored value.
|
||||
|
||||
/// \fn CX3DImporter_NodeElement_TextureCoordinate(CX3DImporter_NodeElement* pParent)
|
||||
/// Constructor
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
CX3DImporter_NodeElement_TextureCoordinate(CX3DImporter_NodeElement* pParent)
|
||||
: CX3DImporter_NodeElement(ENET_TextureCoordinate, pParent)
|
||||
{}
|
||||
X3DTextureCoordinate(X3DNodeElementBase *pParent) :
|
||||
X3DNodeElementBase(ENET_TextureCoordinate, pParent) {}
|
||||
|
||||
}; // struct CX3DImporter_NodeElement_TextureCoordinate
|
||||
|
||||
/// \class CX3DImporter_NodeElement_Geometry2D
|
||||
/// Two-dimensional figure.
|
||||
class CX3DImporter_NodeElement_Geometry2D : public CX3DImporter_NodeElement
|
||||
{
|
||||
/***********************************************/
|
||||
/****************** Variables ******************/
|
||||
/***********************************************/
|
||||
|
||||
class X3DGeometry2D : public X3DNodeElementBase {
|
||||
public:
|
||||
|
||||
std::list<aiVector3D> Vertices; ///< Vertices list.
|
||||
size_t NumIndices; ///< Number of indices in one face.
|
||||
bool Solid; ///< Flag: if true then render must use back-face culling, else render must draw both sides of object.
|
||||
|
||||
/***********************************************/
|
||||
/****************** Functions ******************/
|
||||
/***********************************************/
|
||||
|
||||
private:
|
||||
|
||||
/// \fn CX3DImporter_NodeElement_Geometry2D(const CX3DImporter_NodeElement_Geometry2D& pNode)
|
||||
/// Disabled copy constructor.
|
||||
CX3DImporter_NodeElement_Geometry2D(const CX3DImporter_NodeElement_Geometry2D& pNode);
|
||||
|
||||
/// \fn CX3DImporter_NodeElement_Geometry2D& operator=(const CX3DImporter_NodeElement_Geometry2D& pNode)
|
||||
/// Disabled assign operator.
|
||||
CX3DImporter_NodeElement_Geometry2D& operator=(const CX3DImporter_NodeElement_Geometry2D& pNode);
|
||||
|
||||
public:
|
||||
|
||||
/// \fn CX3DImporter_NodeElement_Geometry2D(const EType pType, CX3DImporter_NodeElement* pParent)
|
||||
/// Constructor.
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
/// \param [in] pType - type of geometry object.
|
||||
CX3DImporter_NodeElement_Geometry2D(const EType pType, CX3DImporter_NodeElement* pParent)
|
||||
: CX3DImporter_NodeElement(pType, pParent), Solid(true)
|
||||
{}
|
||||
X3DGeometry2D(const EType pType, X3DNodeElementBase *pParent) :
|
||||
X3DNodeElementBase(pType, pParent), Solid(true) {}
|
||||
|
||||
}; // class CX3DImporter_NodeElement_Geometry2D
|
||||
|
||||
/// \class CX3DImporter_NodeElement_Geometry3D
|
||||
/// Three-dimensional body.
|
||||
class CX3DImporter_NodeElement_Geometry3D : public CX3DImporter_NodeElement {
|
||||
class X3DGeometry3D : public X3DNodeElementBase {
|
||||
public:
|
||||
std::list<aiVector3D> Vertices; ///< Vertices list.
|
||||
size_t NumIndices; ///< Number of indices in one face.
|
||||
|
@ -478,77 +324,34 @@ public:
|
|||
/// Constructor.
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
/// \param [in] pType - type of geometry object.
|
||||
CX3DImporter_NodeElement_Geometry3D(const EType pType, CX3DImporter_NodeElement* pParent)
|
||||
: CX3DImporter_NodeElement(pType, pParent)
|
||||
, Vertices()
|
||||
, NumIndices( 0 )
|
||||
, Solid(true) {
|
||||
X3DGeometry3D(const EType pType, X3DNodeElementBase *pParent) :
|
||||
X3DNodeElementBase(pType, pParent), Vertices(), NumIndices(0), Solid(true) {
|
||||
// empty
|
||||
}
|
||||
|
||||
private:
|
||||
/// Disabled copy constructor.
|
||||
CX3DImporter_NodeElement_Geometry3D(const CX3DImporter_NodeElement_Geometry3D& pNode);
|
||||
|
||||
/// Disabled assign operator.
|
||||
CX3DImporter_NodeElement_Geometry3D& operator=(const CX3DImporter_NodeElement_Geometry3D& pNode);
|
||||
}; // class CX3DImporter_NodeElement_Geometry3D
|
||||
|
||||
/// \class CX3DImporter_NodeElement_ElevationGrid
|
||||
/// Uniform rectangular grid of varying height.
|
||||
class CX3DImporter_NodeElement_ElevationGrid : public CX3DImporter_NodeElement_Geometry3D
|
||||
{
|
||||
/***********************************************/
|
||||
/****************** Variables ******************/
|
||||
/***********************************************/
|
||||
|
||||
class X3DElevationGrid : public X3DGeometry3D {
|
||||
public:
|
||||
|
||||
bool NormalPerVertex; ///< If true then normals are defined for every vertex, else for every face(line).
|
||||
bool ColorPerVertex; ///< If true then colors are defined for every vertex, else for every face(line).
|
||||
/// \var CreaseAngle
|
||||
/// If the angle between the geometric normals of two adjacent faces is less than the crease angle, normals shall be calculated so that the faces are
|
||||
/// shaded smoothly across the edge; otherwise, normals shall be calculated so that a lighting discontinuity across the edge is produced.
|
||||
float CreaseAngle;
|
||||
std::vector<int32_t> CoordIdx; ///< Coordinates list by faces. In X3D format: "-1" - delimiter for faces.
|
||||
|
||||
/***********************************************/
|
||||
/****************** Functions ******************/
|
||||
/***********************************************/
|
||||
|
||||
private:
|
||||
|
||||
/// \fn CX3DImporter_NodeElement_ElevationGrid(const CX3DImporter_NodeElement_ElevationGrid& pNode)
|
||||
/// Disabled copy constructor.
|
||||
CX3DImporter_NodeElement_ElevationGrid(const CX3DImporter_NodeElement_ElevationGrid& pNode);
|
||||
|
||||
/// \fn CX3DImporter_NodeElement_ElevationGrid& operator=(const CX3DImporter_NodeElement_ElevationGrid& pNode)
|
||||
/// Disabled assign operator.
|
||||
CX3DImporter_NodeElement_ElevationGrid& operator=(const CX3DImporter_NodeElement_ElevationGrid& pNode);
|
||||
|
||||
public:
|
||||
|
||||
/// \fn CX3DImporter_NodeElement_ElevationGrid(const EType pType, CX3DImporter_NodeElement* pParent)
|
||||
/// Constructor.
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
/// \param [in] pType - type of geometry object.
|
||||
CX3DImporter_NodeElement_ElevationGrid(const EType pType, CX3DImporter_NodeElement* pParent)
|
||||
: CX3DImporter_NodeElement_Geometry3D(pType, pParent)
|
||||
{}
|
||||
X3DElevationGrid(const EType pType, X3DNodeElementBase *pParent) :
|
||||
X3DGeometry3D(pType, pParent) {}
|
||||
|
||||
}; // class CX3DImporter_NodeElement_IndexedSet
|
||||
|
||||
/// \class CX3DImporter_NodeElement_IndexedSet
|
||||
/// Shape with indexed vertices.
|
||||
class CX3DImporter_NodeElement_IndexedSet : public CX3DImporter_NodeElement_Geometry3D
|
||||
{
|
||||
/***********************************************/
|
||||
/****************** Variables ******************/
|
||||
/***********************************************/
|
||||
|
||||
class X3DIndexedSet : public X3DGeometry3D {
|
||||
public:
|
||||
|
||||
/// \var CCW
|
||||
/// The ccw field defines the ordering of the vertex coordinates of the geometry with respect to user-given or automatically generated normal vectors
|
||||
/// used in the lighting model equations. If ccw is TRUE, the normals shall follow the right hand rule; the orientation of each normal with respect to
|
||||
/// the vertices (taken in order) shall be such that the vertices appear to be oriented in a counterclockwise order when the vertices are viewed (in the
|
||||
|
@ -558,13 +361,11 @@ public:
|
|||
bool CCW;
|
||||
std::vector<int32_t> ColorIndex; ///< Field to specify the polygonal faces by indexing into the <Color> or <ColorRGBA>.
|
||||
bool ColorPerVertex; ///< If true then colors are defined for every vertex, else for every face(line).
|
||||
/// \var Convex
|
||||
/// The convex field indicates whether all polygons in the shape are convex (TRUE). A polygon is convex if it is planar, does not intersect itself,
|
||||
/// and all of the interior angles at its vertices are less than 180 degrees. Non planar and self intersecting polygons may produce undefined results
|
||||
/// even if the convex field is FALSE.
|
||||
bool Convex;
|
||||
std::vector<int32_t> CoordIndex; ///< Field to specify the polygonal faces by indexing into the <Coordinate>.
|
||||
/// \var CreaseAngle
|
||||
/// If the angle between the geometric normals of two adjacent faces is less than the crease angle, normals shall be calculated so that the faces are
|
||||
/// shaded smoothly across the edge; otherwise, normals shall be calculated so that a lighting discontinuity across the edge is produced.
|
||||
float CreaseAngle;
|
||||
|
@ -572,43 +373,17 @@ public:
|
|||
bool NormalPerVertex; ///< If true then normals are defined for every vertex, else for every face(line).
|
||||
std::vector<int32_t> TexCoordIndex; ///< Field to specify the polygonal faces by indexing into the <TextureCoordinate>.
|
||||
|
||||
/***********************************************/
|
||||
/****************** Functions ******************/
|
||||
/***********************************************/
|
||||
|
||||
private:
|
||||
|
||||
/// \fn CX3DImporter_NodeElement_IndexedSet(const CX3DImporter_NodeElement_IndexedSet& pNode)
|
||||
/// Disabled copy constructor.
|
||||
CX3DImporter_NodeElement_IndexedSet(const CX3DImporter_NodeElement_IndexedSet& pNode);
|
||||
|
||||
/// \fn CX3DImporter_NodeElement_IndexedSet& operator=(const CX3DImporter_NodeElement_IndexedSet& pNode)
|
||||
/// Disabled assign operator.
|
||||
CX3DImporter_NodeElement_IndexedSet& operator=(const CX3DImporter_NodeElement_IndexedSet& pNode);
|
||||
|
||||
public:
|
||||
|
||||
/// \fn CX3DImporter_NodeElement_IndexedSet(const EType pType, CX3DImporter_NodeElement* pParent)
|
||||
/// Constructor.
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
/// \param [in] pType - type of geometry object.
|
||||
CX3DImporter_NodeElement_IndexedSet(const EType pType, CX3DImporter_NodeElement* pParent)
|
||||
: CX3DImporter_NodeElement_Geometry3D(pType, pParent)
|
||||
{}
|
||||
X3DIndexedSet(const EType pType, X3DNodeElementBase *pParent) :
|
||||
X3DGeometry3D(pType, pParent) {}
|
||||
|
||||
}; // class CX3DImporter_NodeElement_IndexedSet
|
||||
|
||||
/// \class CX3DImporter_NodeElement_Set
|
||||
/// Shape with set of vertices.
|
||||
class CX3DImporter_NodeElement_Set : public CX3DImporter_NodeElement_Geometry3D
|
||||
{
|
||||
/***********************************************/
|
||||
/****************** Variables ******************/
|
||||
/***********************************************/
|
||||
|
||||
class X3DSet : public X3DGeometry3D {
|
||||
public:
|
||||
|
||||
/// \var CCW
|
||||
/// The ccw field defines the ordering of the vertex coordinates of the geometry with respect to user-given or automatically generated normal vectors
|
||||
/// used in the lighting model equations. If ccw is TRUE, the normals shall follow the right hand rule; the orientation of each normal with respect to
|
||||
/// the vertices (taken in order) shall be such that the vertices appear to be oriented in a counterclockwise order when the vertices are viewed (in the
|
||||
|
@ -623,61 +398,34 @@ public:
|
|||
std::vector<int32_t> TexCoordIndex; ///< Field to specify the polygonal faces by indexing into the <TextureCoordinate>.
|
||||
std::vector<int32_t> VertexCount; ///< Field describes how many vertices are to be used in each polyline(polygon) from the <Coordinate> field.
|
||||
|
||||
/***********************************************/
|
||||
/****************** Functions ******************/
|
||||
/***********************************************/
|
||||
|
||||
private:
|
||||
|
||||
/// \fn CX3DImporter_NodeElement_Set(const CX3DImporter_NodeElement_Set& pNode)
|
||||
/// Disabled copy constructor.
|
||||
CX3DImporter_NodeElement_Set(const CX3DImporter_NodeElement_Set& pNode);
|
||||
|
||||
/// \fn CX3DImporter_NodeElement_Set& operator=(const CX3DImporter_NodeElement_Set& pNode)
|
||||
/// Disabled assign operator.
|
||||
CX3DImporter_NodeElement_Set& operator=(const CX3DImporter_NodeElement_Set& pNode);
|
||||
|
||||
public:
|
||||
|
||||
/// \fn CX3DImporter_NodeElement_Set(const EType pType, CX3DImporter_NodeElement* pParent)
|
||||
/// Constructor.
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
/// \param [in] pType - type of geometry object.
|
||||
CX3DImporter_NodeElement_Set(const EType pType, CX3DImporter_NodeElement* pParent)
|
||||
: CX3DImporter_NodeElement_Geometry3D(pType, pParent)
|
||||
{}
|
||||
X3DSet(const EType pType, X3DNodeElementBase *pParent) :
|
||||
X3DGeometry3D(pType, pParent) {}
|
||||
|
||||
}; // class CX3DImporter_NodeElement_Set
|
||||
|
||||
/// \struct CX3DImporter_NodeElement_Shape
|
||||
/// This struct hold <Shape> value.
|
||||
struct CX3DImporter_NodeElement_Shape : public CX3DImporter_NodeElement
|
||||
{
|
||||
/// \fn CX3DImporter_NodeElement_Shape(CX3DImporter_NodeElement_Shape* pParent)
|
||||
struct X3DShape : public X3DNodeElementBase {
|
||||
/// Constructor
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
CX3DImporter_NodeElement_Shape(CX3DImporter_NodeElement* pParent)
|
||||
: CX3DImporter_NodeElement(ENET_Shape, pParent)
|
||||
{}
|
||||
X3DShape(X3DNodeElementBase *pParent) :
|
||||
X3DNodeElementBase(ENET_Shape, pParent) {}
|
||||
|
||||
}; // struct CX3DImporter_NodeElement_Shape
|
||||
|
||||
/// \struct CX3DImporter_NodeElement_Appearance
|
||||
/// This struct hold <Appearance> value.
|
||||
struct CX3DImporter_NodeElement_Appearance : public CX3DImporter_NodeElement
|
||||
{
|
||||
/// \fn CX3DImporter_NodeElement_Appearance(CX3DImporter_NodeElement_Appearance* pParent)
|
||||
struct X3DAppearance : public X3DNodeElementBase {
|
||||
/// Constructor
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
CX3DImporter_NodeElement_Appearance(CX3DImporter_NodeElement* pParent)
|
||||
: CX3DImporter_NodeElement(ENET_Appearance, pParent)
|
||||
{}
|
||||
X3DAppearance(X3DNodeElementBase *pParent) :
|
||||
X3DNodeElementBase(ENET_Appearance, pParent) {}
|
||||
|
||||
}; // struct CX3DImporter_NodeElement_Appearance
|
||||
|
||||
/// \class CX3DImporter_NodeElement_Material
|
||||
/// Material.
|
||||
class CX3DImporter_NodeElement_Material : public CX3DImporter_NodeElement {
|
||||
class X3DMaterial : public X3DNodeElementBase {
|
||||
public:
|
||||
float AmbientIntensity; ///< Specifies how much ambient light from light sources this surface shall reflect.
|
||||
aiColor3D DiffuseColor; ///< Reflects all X3D light sources depending on the angle of the surface with respect to the light source.
|
||||
|
@ -689,76 +437,57 @@ public:
|
|||
/// Constructor.
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
/// \param [in] pType - type of geometry object.
|
||||
CX3DImporter_NodeElement_Material(CX3DImporter_NodeElement* pParent)
|
||||
: CX3DImporter_NodeElement(ENET_Material, pParent)
|
||||
, AmbientIntensity( 0.0f )
|
||||
, DiffuseColor()
|
||||
, EmissiveColor()
|
||||
, Shininess( 0.0f )
|
||||
, SpecularColor()
|
||||
, Transparency( 1.0f ) {
|
||||
X3DMaterial(X3DNodeElementBase *pParent) :
|
||||
X3DNodeElementBase(ENET_Material, pParent),
|
||||
AmbientIntensity(0.0f),
|
||||
DiffuseColor(),
|
||||
EmissiveColor(),
|
||||
Shininess(0.0f),
|
||||
SpecularColor(),
|
||||
Transparency(1.0f) {
|
||||
// empty
|
||||
}
|
||||
|
||||
private:
|
||||
/// Disabled copy constructor.
|
||||
CX3DImporter_NodeElement_Material(const CX3DImporter_NodeElement_Material& pNode);
|
||||
|
||||
/// Disabled assign operator.
|
||||
CX3DImporter_NodeElement_Material& operator=(const CX3DImporter_NodeElement_Material& pNode);
|
||||
}; // class CX3DImporter_NodeElement_Material
|
||||
|
||||
/// \struct CX3DImporter_NodeElement_ImageTexture
|
||||
/// This struct hold <ImageTexture> value.
|
||||
struct CX3DImporter_NodeElement_ImageTexture : public CX3DImporter_NodeElement
|
||||
{
|
||||
/// \var RepeatS
|
||||
struct X3DImageTexture : public X3DNodeElementBase {
|
||||
/// RepeatS and RepeatT, that specify how the texture wraps in the S and T directions. If repeatS is TRUE (the default), the texture map is repeated
|
||||
/// outside the [0.0, 1.0] texture coordinate range in the S direction so that it fills the shape. If repeatS is FALSE, the texture coordinates are
|
||||
/// clamped in the S direction to lie within the [0.0, 1.0] range. The repeatT field is analogous to the repeatS field.
|
||||
bool RepeatS;
|
||||
bool RepeatT; ///< See \ref RepeatS.
|
||||
std::string URL; ///< URL of the texture.
|
||||
/// \fn CX3DImporter_NodeElement_ImageTexture(CX3DImporter_NodeElement_ImageTexture* pParent)
|
||||
|
||||
/// Constructor
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
CX3DImporter_NodeElement_ImageTexture(CX3DImporter_NodeElement* pParent)
|
||||
: CX3DImporter_NodeElement(ENET_ImageTexture, pParent)
|
||||
{}
|
||||
|
||||
X3DImageTexture(X3DNodeElementBase *pParent) :
|
||||
X3DNodeElementBase(ENET_ImageTexture, pParent) {}
|
||||
}; // struct CX3DImporter_NodeElement_ImageTexture
|
||||
|
||||
/// \struct CX3DImporter_NodeElement_TextureTransform
|
||||
/// This struct hold <TextureTransform> value.
|
||||
struct CX3DImporter_NodeElement_TextureTransform : public CX3DImporter_NodeElement
|
||||
{
|
||||
struct X3DTextureTransform : public X3DNodeElementBase {
|
||||
aiVector2D Center; ///< Specifies a translation offset in texture coordinate space about which the rotation and scale fields are applied.
|
||||
float Rotation; ///< Specifies a rotation in angle base units of the texture coordinates about the center point after the scale has been applied.
|
||||
aiVector2D Scale; ///< Specifies a scaling factor in S and T of the texture coordinates about the center point.
|
||||
aiVector2D Translation; ///< Specifies a translation of the texture coordinates.
|
||||
|
||||
/// \fn CX3DImporter_NodeElement_TextureTransform(CX3DImporter_NodeElement_TextureTransform* pParent)
|
||||
/// Constructor
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
CX3DImporter_NodeElement_TextureTransform(CX3DImporter_NodeElement* pParent)
|
||||
: CX3DImporter_NodeElement(ENET_TextureTransform, pParent)
|
||||
{}
|
||||
X3DTextureTransform(X3DNodeElementBase *pParent) :
|
||||
X3DNodeElementBase(ENET_TextureTransform, pParent) {}
|
||||
|
||||
}; // struct CX3DImporter_NodeElement_TextureTransform
|
||||
|
||||
/// \struct CX3DImporter_NodeElement_Light
|
||||
/// This struct hold <TextureTransform> value.
|
||||
struct CX3DImporter_NodeElement_Light : public CX3DImporter_NodeElement
|
||||
{
|
||||
struct X3DLight : public X3DNodeElementBase {
|
||||
float AmbientIntensity; ///< Specifies the intensity of the ambient emission from the light.
|
||||
aiColor3D Color; ///< specifies the spectral colour properties of both the direct and ambient light emission as an RGB value.
|
||||
aiVector3D Direction; ///< Specifies the direction vector of the illumination emanating from the light source in the local coordinate system.
|
||||
/// \var Global
|
||||
/// Field that determines whether the light is global or scoped. Global lights illuminate all objects that fall within their volume of lighting influence.
|
||||
/// Scoped lights only illuminate objects that are in the same transformation hierarchy as the light.
|
||||
bool Global;
|
||||
float Intensity; ///< Specifies the brightness of the direct emission from the light.
|
||||
/// \var Attenuation
|
||||
|
||||
/// PointLight node's illumination falls off with distance as specified by three attenuation coefficients. The attenuation factor
|
||||
/// is: "1 / max(attenuation[0] + attenuation[1] * r + attenuation[2] * r2, 1)", where r is the distance from the light to the surface being illuminated.
|
||||
aiVector3D Attenuation;
|
||||
|
@ -767,13 +496,11 @@ struct CX3DImporter_NodeElement_Light : public CX3DImporter_NodeElement
|
|||
float BeamWidth; ///< Specifies an inner solid angle in which the light source emits light at uniform full intensity.
|
||||
float CutOffAngle; ///< The light source's emission intensity drops off from the inner solid angle (beamWidth) to the outer solid angle (cutOffAngle).
|
||||
|
||||
/// \fn CX3DImporter_NodeElement_Light(EType pLightType, CX3DImporter_NodeElement* pParent)
|
||||
/// Constructor
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
/// \param [in] pLightType - type of the light source.
|
||||
CX3DImporter_NodeElement_Light(EType pLightType, CX3DImporter_NodeElement* pParent)
|
||||
: CX3DImporter_NodeElement(pLightType, pParent)
|
||||
{}
|
||||
X3DLight(EType pLightType, X3DNodeElementBase *pParent) :
|
||||
X3DNodeElementBase(pLightType, pParent) {}
|
||||
|
||||
}; // struct CX3DImporter_NodeElement_Light
|
||||
|
||||
|
|
|
@ -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