Use alternate method to retrieve normals.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4098 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -64,24 +64,31 @@ macroScript TRModelExporter category:"File" \
|
|||||||
(
|
(
|
||||||
for i = 1 to mesh.numfaces do (
|
for i = 1 to mesh.numfaces do (
|
||||||
face = getFace mesh i
|
face = getFace mesh i
|
||||||
|
normals = meshop.getFaceRNormals mesh i
|
||||||
local tvface
|
local tvface
|
||||||
if mesh.numtverts > 0 do (
|
if mesh.numtverts > 0 do (
|
||||||
tvface = getTVFace mesh i
|
tvface = getTVFace mesh i
|
||||||
)
|
)
|
||||||
for i = 1 to 3 do (
|
for j = 1 to 3 do (
|
||||||
format " <vertex" to:outFile
|
format " <vertex" to:outFile
|
||||||
writePoint3Attr " location" (getVert mesh face[i]) outFile
|
writePoint3Attr " location" (getVert mesh face[j]) outFile
|
||||||
writePoint3Attr " normal" (getNormal mesh face[i]) outFile
|
local normal
|
||||||
|
if normals[j] != undefined then (
|
||||||
|
normal = normals[j]
|
||||||
|
) else (
|
||||||
|
normal = getNormal mesh face[j]
|
||||||
|
)
|
||||||
|
writePoint3Attr " normal" normal outFile
|
||||||
if tvface != undefined do (
|
if tvface != undefined do (
|
||||||
tvert = getTVert mesh tvface[i]
|
tvert = getTVert mesh tvface[j]
|
||||||
format " tcoords=\"%, %\"" tvert[1] tvert[2] to:outFile
|
format " tcoords=\"%, %\"" tvert[1] tvert[2] to:outFile
|
||||||
)
|
)
|
||||||
if isProperty mesh #skin or isProperty mesh #physique then (
|
if isProperty mesh #skin or isProperty mesh #physique then (
|
||||||
format ">\n" to:outFile
|
format ">\n" to:outFile
|
||||||
if isProperty mesh #skin then (
|
if isProperty mesh #skin then (
|
||||||
writeSkinBoneWeights mesh.skin face[i] outFile
|
writeSkinBoneWeights mesh.skin face[j] outFile
|
||||||
) else (
|
) else (
|
||||||
writePhysiqueBoneWeights mesh face[i] outFile
|
writePhysiqueBoneWeights mesh face[j] outFile
|
||||||
)
|
)
|
||||||
format " </vertex>\n" to:outFile
|
format " </vertex>\n" to:outFile
|
||||||
) else (
|
) else (
|
||||||
|
|||||||
Reference in New Issue
Block a user