Fixed flipped normals workaround in max exporter.

Hope so. At least now hacked face normals correspond to face normals computed from scratch in Geometry.

(If only max didn't have zillion ways how to achieve the same visual results :/. I tracked this flipped normals/faces business down to XForm modifier - it doesn't get collapsed properly when making TriMesh / Editable_mesh snapshots. At least Editable_mesh snapshot differs in way that is exploitable for workaround hack.)
This commit is contained in:
alteredq
2011-03-06 22:56:36 +01:00
parent 88a13e7d39
commit 129fddfd57
+18 -4
View File
@@ -309,8 +309,6 @@ rollout ThreeJSExporter "ThreeJSExporter"
hasUVs = true
if exportNormal.checked and exportUv.checked and hasUVs then
triangles = #()
trianglesUvs = #()
trianglesNormals = #()
@@ -479,7 +477,7 @@ rollout ThreeJSExporter "ThreeJSExporter"
-------------------------------------------------------------------------------------
-- Extract normals from mesh
function ExtractNormals obj whereto =
function ExtractNormals obj whereto needsFlip =
(
if smoothNormal.checked then
(
@@ -490,6 +488,14 @@ rollout ThreeJSExporter "ThreeJSExporter"
(
n = GetNormal obj i
if needsFlip then
(
n.x *= -1
n.y *= -1
n.z *= -1
)
append whereto n
)
@@ -504,6 +510,14 @@ rollout ThreeJSExporter "ThreeJSExporter"
(
n = GetFaceNormal obj i
if needsFlip then
(
n.x *= -1
n.y *= -1
n.z *= -1
)
append whereto n
)
@@ -724,7 +738,7 @@ rollout ThreeJSExporter "ThreeJSExporter"
ExtractMaterials meshObj meshMaterial mergedMaterials
ExtractVertices meshObj mergedVertices
ExtractNormals meshObj mergedNormals
ExtractNormals meshObj mergedNormals needsFlip
ExtractUvs meshObj mergedUvs
--ExtractFaces meshObj zmaterial mergedFaces mergedVertices.count mergedUvs.count