commit
8358d585b0
|
@ -485,7 +485,8 @@ uint8_t* new_data;
|
||||||
inline size_t Buffer::AppendData(uint8_t* data, size_t length)
|
inline size_t Buffer::AppendData(uint8_t* data, size_t length)
|
||||||
{
|
{
|
||||||
size_t offset = this->byteLength;
|
size_t offset = this->byteLength;
|
||||||
Grow(length);
|
// Force alignment to 4 bits
|
||||||
|
Grow((length + 3) & ~3);
|
||||||
memcpy(mData.get() + offset, data, length);
|
memcpy(mData.get() + offset, data, length);
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
|
@ -708,8 +708,13 @@ void glTF2Exporter::ExportMeshes()
|
||||||
if (v) p.attributes.position.push_back(v);
|
if (v) p.attributes.position.push_back(v);
|
||||||
|
|
||||||
/******************** Normals ********************/
|
/******************** Normals ********************/
|
||||||
|
// Normalize all normals as the validator can emit a warning otherwise
|
||||||
|
for (auto i = 0u; i < aim->mNumVertices; ++i) {
|
||||||
|
aim->mNormals[i].Normalize();
|
||||||
|
}
|
||||||
|
|
||||||
Ref<Accessor> n = ExportData(*mAsset, meshId, b, aim->mNumVertices, aim->mNormals, AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT);
|
Ref<Accessor> n = ExportData(*mAsset, meshId, b, aim->mNumVertices, aim->mNormals, AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT);
|
||||||
if (n) p.attributes.normal.push_back(n);
|
if (n) p.attributes.normal.push_back(n);
|
||||||
|
|
||||||
/************** Texture coordinates **************/
|
/************** Texture coordinates **************/
|
||||||
for (int i = 0; i < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++i) {
|
for (int i = 0; i < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++i) {
|
||||||
|
|
Loading…
Reference in New Issue