- fbx: also support reading binary arrays of UNSIGNED data.
parent
96033e9fc0
commit
eb16c193ea
|
@ -848,9 +848,9 @@ void ParseVectorDataArray(std::vector<int>& out, const Element& el)
|
||||||
|
|
||||||
out.reserve(count);
|
out.reserve(count);
|
||||||
|
|
||||||
const uint32_t* ip = reinterpret_cast<const uint32_t*>(&buff[0]);
|
const int32_t* ip = reinterpret_cast<const int32_t*>(&buff[0]);
|
||||||
for (unsigned int i = 0; i < count; ++i, ++ip) {
|
for (unsigned int i = 0; i < count; ++i, ++ip) {
|
||||||
BE_NCONST uint32_t val = *ip;
|
BE_NCONST int32_t val = *ip;
|
||||||
AI_SWAP4(val);
|
AI_SWAP4(val);
|
||||||
out.push_back(val);
|
out.push_back(val);
|
||||||
}
|
}
|
||||||
|
@ -946,8 +946,40 @@ void ParseVectorDataArray(std::vector<unsigned int>& out, const Element& el)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tok[0]->IsBinary()) {
|
if(tok[0]->IsBinary()) {
|
||||||
// XXX don't think we need this - there is no special type sign for unsigned ints in the binary encoding
|
const char* data = tok[0]->begin(), *end = tok[0]->end();
|
||||||
ParseError("feature not implemented",&el);
|
|
||||||
|
char type;
|
||||||
|
uint32_t count;
|
||||||
|
ReadBinaryDataArrayHead(data, end, type, count, el);
|
||||||
|
|
||||||
|
if(!count) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type != 'i') {
|
||||||
|
ParseError("expected (u)int array (binary)",&el);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<char> buff;
|
||||||
|
ReadBinaryDataArray(type, count, data, end, buff, el);
|
||||||
|
|
||||||
|
ai_assert(data == end);
|
||||||
|
ai_assert(buff.size() == count * 4);
|
||||||
|
|
||||||
|
out.reserve(count);
|
||||||
|
|
||||||
|
const int32_t* ip = reinterpret_cast<const int32_t*>(&buff[0]);
|
||||||
|
for (unsigned int i = 0; i < count; ++i, ++ip) {
|
||||||
|
BE_NCONST int32_t val = *ip;
|
||||||
|
if(val < 0) {
|
||||||
|
ParseError("encountered negative integer index (binary)");
|
||||||
|
}
|
||||||
|
|
||||||
|
AI_SWAP4(val);
|
||||||
|
out.push_back(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const size_t dim = ParseTokenAsDim(*tok[0]);
|
const size_t dim = ParseTokenAsDim(*tok[0]);
|
||||||
|
|
Loading…
Reference in New Issue