提交 6151624e 编写于 作者: A alteredq

Max exporter now exports multiple selected objects.

Unfortunately with larger scenes with many different types of objects face flipping heuristics doesn't work all the time :(
上级 129fddfd
......@@ -28,17 +28,17 @@ rollout ThreeJSExporter "ThreeJSExporter"
vertexNormalFormat = "%,%,%",
UVFormat = "%,%",
triFormat = "%,%,%, %",
triUVFormat = "%,%,%, %, %,%,%",
triNFormat = "%,%,%, %, %,%,%",
triUVNFormat = "%,%,%, %, %,%,%, %,%,%",
triFormat = "%,%,%,%",
triUVFormat = "%,%,%,%,%,%,%",
triNFormat = "%,%,%,%,%,%,%",
triUVNFormat = "%,%,%,%,%,%,%,%,%,%",
footerFormat = "}\n\npostMessage( model );"
-------------------------------------------------------------------------------------
-- User interface
group "ThreeJSExporter v0.1"
group "ThreeJSExporter v0.2"
(
label msg "Exports meshes in Three.js ascii JSON format" align:#left
......@@ -94,7 +94,7 @@ rollout ThreeJSExporter "ThreeJSExporter"
Format vertexFormat x y z to:ostream
if i < num then Format ", " to:ostream
if i < num then Format "," to:ostream
)
......@@ -144,7 +144,7 @@ rollout ThreeJSExporter "ThreeJSExporter"
Format vertexNormalFormat x y z to:ostream
if i < num then Format ", " to:ostream
if i < num then Format "," to:ostream
)
......@@ -185,7 +185,7 @@ rollout ThreeJSExporter "ThreeJSExporter"
Format UVFormat u v to:ostream
if i < num then Format ", " to:ostream
if i < num then Format "," to:ostream
)
......@@ -236,7 +236,7 @@ rollout ThreeJSExporter "ThreeJSExporter"
)
else
(
-- normals have the same indices as faces
-- normals have the same indices as face
na = i - 1
nb = na
......@@ -291,7 +291,7 @@ rollout ThreeJSExporter "ThreeJSExporter"
Format triUVNFormat va vb vc m na nb nc ua ub uc to:ostream
)
if i < num then Format ", " to:ostream
if i < num then Format "," to:ostream
)
......@@ -735,29 +735,43 @@ rollout ThreeJSExporter "ThreeJSExporter"
append meshObjects result
vertexOffset = mergedVertices.count
uvOffset = mergedUvs.count
ExtractMaterials meshObj meshMaterial mergedMaterials
ExtractVertices meshObj mergedVertices
ExtractNormals meshObj mergedNormals needsFlip
ExtractUvs meshObj mergedUvs
--ExtractFaces meshObj zmaterial mergedFaces mergedVertices.count mergedUvs.count
ExtractFaces meshObj meshMaterial mergedFaces mergedMaterials needsFlip 0 0
ExtractFaces meshObj meshMaterial mergedFaces mergedMaterials needsFlip vertexOffset uvOffset
)
)
totalVertices = mergedVertices.count
totalFaces = mergedFaces.count
totalMaterials = mergedMaterials.count
totalNormals = 0
if exportNormal.checked then
(
totalNormals = mergedNormals.count
)
totalUvs = 0
if exportUv.checked then
(
totalUvs = mergedUvs.count
totalFaces = mergedFaces.count
totalMaterials = sceneMaterials.count
)
-- Dump header
Format headerFormat maxFileName totalVertices totalNormals totalUvs totalFaces totalMaterials to:ostream
-- Dump objects (debug)
Format "// Source objects:\n\n" to:ostream
......@@ -772,6 +786,7 @@ rollout ThreeJSExporter "ThreeJSExporter"
)
-- Dump model
Format "\n\nvar model = {\n\n" to:ostream
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册