Force normalized normals
parent
0f4189c77e
commit
5e6cae3094
|
@ -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