Selaa lähdekoodia

Max2Babylon:
- textures animations

David Catuhe 11 vuotta sitten
vanhempi
commit
d75355e6e5

BIN
Exporters/3ds Max/Max2Babylon-0.4.6.zip


+ 1 - 2
Exporters/3ds Max/Max2Babylon/Exporter/BabylonExporter.Camera.cs

@@ -52,7 +52,7 @@ namespace Max2Babylon
             else
             {
                 var dir = wm.GetRow(2).MultiplyBy(-1);
-                babylonCamera.target = dir.ToArraySwitched();
+                babylonCamera.target = position.Add(dir).ToArraySwitched();
             }
 
             // Animations
@@ -65,7 +65,6 @@ namespace Max2Babylon
 
             ExportFloatAnimation("fov", animations, key => new[] { Tools.ConvertFov(maxCamera.GetFOV(key, Interval.Forever._IInterval)) });
 
-
             babylonCamera.animations = animations.ToArray();
 
             if (cameraNode._Node.GetBoolProperty("babylonjs_autoanimate"))

+ 14 - 1
Exporters/3ds Max/Max2Babylon/Exporter/BabylonExporter.Texture.cs

@@ -18,7 +18,7 @@ namespace Max2Babylon
             var babylonTexture = new BabylonTexture();
 
             var texMap = stdMat.GetSubTexmap(index);
-            var texture = (IBitmapTex) texMap.GetParamBlock(0).Owner;
+            var texture = texMap.GetParamBlock(0).Owner as IBitmapTex;
 
             if (texture == null)
             {
@@ -87,6 +87,19 @@ namespace Max2Babylon
 
             babylonTexture.name = Path.GetFileName(texture.MapName);
 
+            // Animations
+            var animations = new List<BabylonAnimation>();
+            ExportFloatAnimation("uOffset", animations, key => new []{uvGen.GetUOffs(key)});
+            ExportFloatAnimation("vOffset", animations, key => new[] { uvGen.GetVOffs(key) });
+            ExportFloatAnimation("uScale", animations, key => new[] { uvGen.GetUScl(key) });
+            ExportFloatAnimation("vScale", animations, key => new[] { uvGen.GetVScl(key) });
+            ExportFloatAnimation("uAng", animations, key => new[] { uvGen.GetUAng(key) });
+            ExportFloatAnimation("vAng", animations, key => new[] { uvGen.GetVAng(key) });
+            ExportFloatAnimation("wAng", animations, key => new[] { uvGen.GetWAng(key) });
+
+            babylonTexture.animations = animations.ToArray();
+
+            // Copy texture to output
             try
             {
                 if (File.Exists(texture.MapName))

+ 3 - 1
Exporters/3ds Max/readme.md

@@ -35,6 +35,7 @@ This exporter is designed for 3ds Max 2013+. You just have to unzip the content
  - Pickable (*)
  - Position / rotation / scaling
  - Geometry (position, normal, texture coordinates (2 channels))
+ - Show Bounding box and submeshes bounding boxes (*)
  - Animations: Position, scaling, rotation, visibility
 - *Materials*
  - Multi-materials
@@ -51,10 +52,11 @@ This exporter is designed for 3ds Max 2013+. You just have to unzip the content
  - Level
  - Coordinates mode (Spherical, planar, explicit)
  - Wrapping (Clamp, mirror, wrap)
+- Hierarchies are exported
 
 (*): Through custom UI
 
-Hierarchies are supported.
+Cameras, lights and meshes have custom properties (Right-click and select "Babylon properties" menu) to automatically launch animations at startup.
 
 ## Apache License 2.0 (Apache)