Browse Source

Fixing NEAREST texture filter

David Catuhe 10 năm trước cách đây
mục cha
commit
5af37ecfc5

+ 16 - 0
Babylon/babylon.engine.js

@@ -1436,7 +1436,23 @@
                             _this._workingCanvas.width = potWidth;
                             _this._workingCanvas.height = potHeight;
 
+                            if (samplingMode === BABYLON.Texture.NEAREST_SAMPLINGMODE) {
+                                _this._workingContext.imageSmoothingEnabled = false;
+                                _this._workingContext.mozImageSmoothingEnabled = false;
+                                _this._workingContext.oImageSmoothingEnabled = false;
+                                _this._workingContext.webkitImageSmoothingEnabled = false;
+                                _this._workingContext.msImageSmoothingEnabled = false;
+                            }
+
                             _this._workingContext.drawImage(img, 0, 0, img.width, img.height, 0, 0, potWidth, potHeight);
+
+                            if (samplingMode === BABYLON.Texture.NEAREST_SAMPLINGMODE) {
+                                _this._workingContext.imageSmoothingEnabled = true;
+                                _this._workingContext.mozImageSmoothingEnabled = true;
+                                _this._workingContext.oImageSmoothingEnabled = true;
+                                _this._workingContext.webkitImageSmoothingEnabled = true;
+                                _this._workingContext.msImageSmoothingEnabled = true;
+                            }
                         }
 
                         _this._gl.texImage2D(_this._gl.TEXTURE_2D, 0, _this._gl.RGBA, _this._gl.RGBA, _this._gl.UNSIGNED_BYTE, isPot ? img : _this._workingCanvas);

+ 16 - 1
Babylon/babylon.engine.ts

@@ -1352,7 +1352,6 @@
         }
 
         public createTexture(url: string, noMipmap: boolean, invertY: boolean, scene: Scene, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE, onLoad: () => void = null, onError: () => void = null, buffer: any = null): WebGLTexture {
-
             var texture = this._gl.createTexture();
 
             var extension: string;
@@ -1439,7 +1438,23 @@
                             this._workingCanvas.width = potWidth;
                             this._workingCanvas.height = potHeight;
 
+                            if (samplingMode === Texture.NEAREST_SAMPLINGMODE) {
+                                this._workingContext.imageSmoothingEnabled = false;
+                                this._workingContext.mozImageSmoothingEnabled = false;
+                                this._workingContext.oImageSmoothingEnabled = false;
+                                this._workingContext.webkitImageSmoothingEnabled = false;
+                                this._workingContext.msImageSmoothingEnabled = false;
+                            }
+
                             this._workingContext.drawImage(img, 0, 0, img.width, img.height, 0, 0, potWidth, potHeight);
+
+                            if (samplingMode === Texture.NEAREST_SAMPLINGMODE) {
+                                this._workingContext.imageSmoothingEnabled = true;
+                                this._workingContext.mozImageSmoothingEnabled = true;
+                                this._workingContext.oImageSmoothingEnabled = true;
+                                this._workingContext.webkitImageSmoothingEnabled = true;
+                                this._workingContext.msImageSmoothingEnabled = true;
+                            }
                         }
 
                         this._gl.texImage2D(this._gl.TEXTURE_2D, 0, this._gl.RGBA, this._gl.RGBA, this._gl.UNSIGNED_BYTE, isPot ? img : this._workingCanvas);

+ 7 - 0
Babylon/babylon.mixins.ts

@@ -43,6 +43,13 @@ interface HTMLCanvasElement {
     webkitRequestPointerLock(): void;
 }
 
+interface CanvasRenderingContext2D {
+    imageSmoothingEnabled: boolean;
+    mozImageSmoothingEnabled: boolean;
+    oImageSmoothingEnabled: boolean;
+    webkitImageSmoothingEnabled: boolean;
+}
+
 interface WebGLTexture {
     isReady: boolean;
     isCube:boolean;

+ 16 - 4
Exporters/3ds Max/BabylonExport.Entities/BabylonMesh.cs

@@ -3,7 +3,7 @@
 namespace BabylonExport.Entities
 {
     [DataContract]
-    public class BabylonMesh: BabylonAbstractMesh
+    public class BabylonMesh : BabylonAbstractMesh
     {
 
         [DataMember]
@@ -58,11 +58,11 @@ namespace BabylonExport.Entities
         public bool checkCollisions { get; set; }
 
         [DataMember]
-        public bool receiveShadows { get; set; }    
-    
+        public bool receiveShadows { get; set; }
+
         [DataMember]
         public bool infiniteDistance { get; set; }
-        
+
         [DataMember]
         public int billboardMode { get; set; }
 
@@ -102,6 +102,18 @@ namespace BabylonExport.Entities
         [DataMember]
         public int alphaIndex { get; set; }
 
+        [DataMember]
+        public int physicsImpostor { get; set; }
+
+        [DataMember]
+        public float physicsMass { get; set; }
+
+        [DataMember]
+        public float physicsFriction { get; set; }
+
+        [DataMember]
+        public float physicsRestitution { get; set; }
+
         public BabylonMesh()
         {
             isEnabled = true;

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


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


+ 8 - 8
Exporters/3ds Max/Max2Babylon/Exporter/BabylonExporter.Light.cs

@@ -73,13 +73,13 @@ namespace Max2Babylon
             // Shadows 
             if (maxLight.ShadowMethod == 1)
             {
-                if (lightState.Type == LightType.DirectLgt)
+                if (lightState.Type == LightType.DirectLgt || lightState.Type == LightType.SpotLgt)
                 {
                     ExportShadowGenerator(lightNode.MaxNode, babylonScene);
                 }
                 else
                 {
-                    RaiseWarning("Shadows maps are only supported for directional lights", 2);
+                    RaiseWarning("Shadows maps are only supported for directional and spot lights", 2);
                 }
             }
 
@@ -91,7 +91,7 @@ namespace Max2Babylon
                 wm.MultiplyBy(parentWorld.Inverse);
             }
             var position = wm.Translation;
-            babylonLight.position = new float[] { position.X, position.Y, position.Z };
+            babylonLight.position = new[] { position.X, position.Y, position.Z };
 
             // Direction
             var target = gameLight.LightTarget;
@@ -101,13 +101,13 @@ namespace Max2Babylon
                 var targetPosition = targetWm.Translation;
 
                 var direction = targetPosition.Subtract(position).Normalize;
-                babylonLight.direction = new float[] { direction.X, direction.Y, direction.Z };
+                babylonLight.direction = new[] { direction.X, direction.Y, direction.Z };
             }
             else
             {
                 var vDir = Loader.Global.Point3.Create(0, -1, 0);
                 vDir = wm.ExtractMatrix3().VectorTransform(vDir).Normalize;
-                babylonLight.direction = new float[] { vDir.X, vDir.Y, vDir.Z };
+                babylonLight.direction = new[] { vDir.X, vDir.Y, vDir.Z };
             }
 
             var maxScene = Loader.Core.RootNode;
@@ -171,7 +171,7 @@ namespace Max2Babylon
                     mat.MultiplyBy(parentWorld.Inverse);
                 }
                 var pos = mat.Translation;
-                return new float[] { pos.X, pos.Y, pos.Z };
+                return new[] { pos.X, pos.Y, pos.Z };
             });
 
             ExportVector3Animation("direction", animations, key =>
@@ -190,13 +190,13 @@ namespace Max2Babylon
                     var targetPosition = targetWm.Translation;
 
                     var direction = targetPosition.Subtract(positionLight).Normalize;
-                    return new float[] { direction.X, direction.Y, direction.Z };
+                    return new[] { direction.X, direction.Y, direction.Z };
                 }
                 else
                 {
                     var vDir = Loader.Global.Point3.Create(0, -1, 0);
                     vDir = wmLight.ExtractMatrix3().VectorTransform(vDir).Normalize;
-                    return new float[] { vDir.X, vDir.Y, vDir.Z };
+                    return new[] { vDir.X, vDir.Y, vDir.Z };
                 }
             });
 

+ 48 - 25
Exporters/3ds Max/Max2Babylon/Exporter/BabylonExporter.Mesh.cs

@@ -124,7 +124,7 @@ namespace Max2Babylon
             // Collisions
             babylonMesh.checkCollisions = meshNode.MaxNode.GetBoolProperty("babylonjs_checkcollisions");
 
-            bool isSkinned = gameMesh.IsObjectSkinned;
+            var isSkinned = gameMesh.IsObjectSkinned;
             var skin = gameMesh.IGameSkin;
             var unskinnedMesh = gameMesh;
             IGMatrix skinInitPoseMatrix = Loader.Global.GMatrix.Create(Loader.Global.Matrix3.Create(true));
@@ -142,22 +142,20 @@ namespace Max2Babylon
             }
 
             // Position / rotation / scaling
+            var localTM = meshNode.GetObjectTM(0);
+            if (meshNode.NodeParent != null)
             {
-                var localTM = meshNode.GetObjectTM(0);
-                if (meshNode.NodeParent != null)
-                {
-                    var parentWorld = meshNode.NodeParent.GetObjectTM(0);
-                    localTM.MultiplyBy(parentWorld.Inverse);
-                }
-
-                var meshTrans = localTM.Translation;
-                var meshRotation = localTM.Rotation;
-                var meshScale = localTM.Scaling;
-                babylonMesh.position = new[] { meshTrans.X, meshTrans.Y, meshTrans.Z };
-                babylonMesh.rotationQuaternion = new[] { meshRotation.X, meshRotation.Y, meshRotation.Z, -meshRotation.W };
-                babylonMesh.scaling = new[] { meshScale.X, meshScale.Y, meshScale.Z };
+                var parentWorld = meshNode.NodeParent.GetObjectTM(0);
+                localTM.MultiplyBy(parentWorld.Inverse);
             }
 
+            var meshTrans = localTM.Translation;
+            var meshRotation = localTM.Rotation;
+            var meshScale = localTM.Scaling;
+            babylonMesh.position = new[] { meshTrans.X, meshTrans.Y, meshTrans.Z };
+            babylonMesh.rotationQuaternion = new[] { meshRotation.X, meshRotation.Y, meshRotation.Z, -meshRotation.W };
+            babylonMesh.scaling = new[] { meshScale.X, meshScale.Y, meshScale.Z };
+
             // Mesh
             RaiseMessage(meshNode.Name, 1);
 
@@ -178,6 +176,32 @@ namespace Max2Babylon
                     RaiseWarning(string.Format("Mesh {0} has tmore than 65536 vertices which means that it will require specific WebGL extension to be rendered. This may impact portability of your scene on low end devices.", babylonMesh.name), 2);
                 }
 
+                // Physics
+                var impostorText = meshNode.MaxNode.GetStringProperty("babylonjs_impostor", "None");
+
+                if (impostorText != "None")
+                {
+                    switch (impostorText)
+                    {
+                        case "Sphere":
+                            babylonMesh.physicsImpostor = 1;
+                            break;
+                        case "Box":
+                            babylonMesh.physicsImpostor = 2;
+                            break;
+                        case "Plane":
+                            babylonMesh.physicsImpostor = 3;
+                            break;
+                        default:
+                            babylonMesh.physicsImpostor = 0;
+                            break;
+                    }
+
+                    babylonMesh.physicsMass = meshNode.MaxNode.GetFloatProperty("babylonjs_mass");
+                    babylonMesh.physicsFriction = meshNode.MaxNode.GetFloatProperty("babylonjs_friction", 0.2f);
+                    babylonMesh.physicsRestitution = meshNode.MaxNode.GetFloatProperty("babylonjs_restitution", 0.2f);
+                }
+
                 // Material
                 var mtl = meshNode.NodeMaterial;
                 var multiMatsCount = 1;
@@ -342,20 +366,19 @@ namespace Max2Babylon
 
                 var instance = new BabylonAbstractMesh { name = tab.Name };
                 {
+                    var instanceLocalTM = meshNode.GetObjectTM(0);
 
-                    var localTM = meshNode.GetObjectTM(0);
-
-                    var meshTrans = localTM.Translation;
-                    var meshRotation = localTM.Rotation;
-                    var meshScale = localTM.Scaling;
-                    instance.position = new[] { meshTrans.X, meshTrans.Y, meshTrans.Z };
+                    var instanceTrans = instanceLocalTM.Translation;
+                    var instanceRotation = instanceLocalTM.Rotation;
+                    var instanceScale = instanceLocalTM.Scaling;
+                    instance.position = new[] { instanceTrans.X, instanceTrans.Y, instanceTrans.Z };
                     float rotx = 0, roty = 0, rotz = 0;
                     unsafe
                     {
-                        meshRotation.GetEuler(new IntPtr(&rotx), new IntPtr(&roty), new IntPtr(&rotz));
+                        instanceRotation.GetEuler(new IntPtr(&rotx), new IntPtr(&roty), new IntPtr(&rotz));
                     }
                     instance.rotation = new[] { rotx, roty, rotz };
-                    instance.scaling = new[] { meshScale.X, meshScale.Y, meshScale.Z };
+                    instance.scaling = new[] { instanceScale.X, instanceScale.Y, instanceScale.Z };
                 }
                 var instanceAnimations = new List<BabylonAnimation>();
                 GenerateCoordinatesAnimations(meshNode, instanceAnimations);
@@ -449,7 +472,7 @@ namespace Max2Babylon
                         worldMatrix.MultiplyBy(parentWorld.Inverse);
                     }
                     var trans = worldMatrix.Translation;
-                    return new[] {trans.X, trans.Y, trans.Z};
+                    return new[] { trans.X, trans.Y, trans.Z };
                 });
             }
 
@@ -469,7 +492,7 @@ namespace Max2Babylon
 
 
                     var rot = worldMatrix.Rotation;
-                    return new[] {rot.X, rot.Y, rot.Z, -rot.W};
+                    return new[] { rot.X, rot.Y, rot.Z, -rot.W };
                 });
             }
 
@@ -485,7 +508,7 @@ namespace Max2Babylon
                     }
                     var scale = worldMatrix.Scaling;
 
-                    return new[] {scale.X, scale.Y, scale.Z};
+                    return new[] { scale.X, scale.Y, scale.Z };
                 });
             }
         }

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

@@ -112,6 +112,8 @@ namespace Max2Babylon
 
             if (AutoSave3dsMaxFile)
             {
+                var forceSave = Loader.Core.FileSave;
+
                 if (callerForm != null)
                 {
                     callerForm.BringToFront();

+ 157 - 21
Exporters/3ds Max/Max2Babylon/Forms/ObjectPropertiesForm.Designer.cs

@@ -33,6 +33,8 @@
             this.butCancel = new System.Windows.Forms.Button();
             this.butOK = new System.Windows.Forms.Button();
             this.groupBox2 = new System.Windows.Forms.GroupBox();
+            this.nupAlphaIndex = new System.Windows.Forms.NumericUpDown();
+            this.label3 = new System.Windows.Forms.Label();
             this.chkNoExport = new System.Windows.Forms.CheckBox();
             this.chkShowSubMeshesBoundingBox = new System.Windows.Forms.CheckBox();
             this.chkShowBoundingBox = new System.Windows.Forms.CheckBox();
@@ -46,15 +48,26 @@
             this.nupFrom = new System.Windows.Forms.NumericUpDown();
             this.label1 = new System.Windows.Forms.Label();
             this.chkAutoAnimate = new System.Windows.Forms.CheckBox();
-            this.nupAlphaIndex = new System.Windows.Forms.NumericUpDown();
-            this.label3 = new System.Windows.Forms.Label();
+            this.groupBox4 = new System.Windows.Forms.GroupBox();
+            this.label6 = new System.Windows.Forms.Label();
+            this.cbImpostor = new System.Windows.Forms.ComboBox();
+            this.nupMass = new System.Windows.Forms.NumericUpDown();
+            this.label4 = new System.Windows.Forms.Label();
+            this.nupFriction = new System.Windows.Forms.NumericUpDown();
+            this.label5 = new System.Windows.Forms.Label();
+            this.nupRestitution = new System.Windows.Forms.NumericUpDown();
+            this.label7 = new System.Windows.Forms.Label();
             this.groupBox1.SuspendLayout();
             this.groupBox2.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.nupAlphaIndex)).BeginInit();
             this.groupBox3.SuspendLayout();
             this.grpAutoAnimate.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.nupTo)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.nupFrom)).BeginInit();
-            ((System.ComponentModel.ISupportInitialize)(this.nupAlphaIndex)).BeginInit();
+            this.groupBox4.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.nupMass)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.nupFriction)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.nupRestitution)).BeginInit();
             this.SuspendLayout();
             // 
             // groupBox1
@@ -85,7 +98,7 @@
             this.butCancel.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
             this.butCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
             this.butCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
-            this.butCancel.Location = new System.Drawing.Point(174, 430);
+            this.butCancel.Location = new System.Drawing.Point(174, 599);
             this.butCancel.Name = "butCancel";
             this.butCancel.Size = new System.Drawing.Size(75, 23);
             this.butCancel.TabIndex = 6;
@@ -97,7 +110,7 @@
             this.butOK.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
             this.butOK.DialogResult = System.Windows.Forms.DialogResult.OK;
             this.butOK.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
-            this.butOK.Location = new System.Drawing.Point(93, 430);
+            this.butOK.Location = new System.Drawing.Point(93, 599);
             this.butOK.Name = "butOK";
             this.butOK.Size = new System.Drawing.Size(75, 23);
             this.butOK.TabIndex = 5;
@@ -122,6 +135,27 @@
             this.groupBox2.TabStop = false;
             this.groupBox2.Text = "Misc.";
             // 
+            // nupAlphaIndex
+            // 
+            this.nupAlphaIndex.Location = new System.Drawing.Point(89, 143);
+            this.nupAlphaIndex.Maximum = new decimal(new int[] {
+            1000,
+            0,
+            0,
+            0});
+            this.nupAlphaIndex.Name = "nupAlphaIndex";
+            this.nupAlphaIndex.Size = new System.Drawing.Size(120, 20);
+            this.nupAlphaIndex.TabIndex = 5;
+            // 
+            // label3
+            // 
+            this.label3.AutoSize = true;
+            this.label3.Location = new System.Drawing.Point(18, 145);
+            this.label3.Name = "label3";
+            this.label3.Size = new System.Drawing.Size(65, 13);
+            this.label3.TabIndex = 6;
+            this.label3.Text = "Alpha index:";
+            // 
             // chkNoExport
             // 
             this.chkNoExport.AutoSize = true;
@@ -275,26 +309,113 @@
             this.chkAutoAnimate.UseVisualStyleBackColor = true;
             this.chkAutoAnimate.CheckedChanged += new System.EventHandler(this.chkAutoAnimate_CheckedChanged);
             // 
-            // nupAlphaIndex
-            // 
-            this.nupAlphaIndex.Location = new System.Drawing.Point(89, 143);
-            this.nupAlphaIndex.Maximum = new decimal(new int[] {
+            // groupBox4
+            // 
+            this.groupBox4.Controls.Add(this.nupRestitution);
+            this.groupBox4.Controls.Add(this.label7);
+            this.groupBox4.Controls.Add(this.nupFriction);
+            this.groupBox4.Controls.Add(this.label5);
+            this.groupBox4.Controls.Add(this.label6);
+            this.groupBox4.Controls.Add(this.cbImpostor);
+            this.groupBox4.Controls.Add(this.nupMass);
+            this.groupBox4.Controls.Add(this.label4);
+            this.groupBox4.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+            this.groupBox4.Location = new System.Drawing.Point(12, 424);
+            this.groupBox4.Name = "groupBox4";
+            this.groupBox4.Size = new System.Drawing.Size(319, 155);
+            this.groupBox4.TabIndex = 7;
+            this.groupBox4.TabStop = false;
+            this.groupBox4.Text = "Physics";
+            // 
+            // label6
+            // 
+            this.label6.AutoSize = true;
+            this.label6.Location = new System.Drawing.Point(18, 27);
+            this.label6.Name = "label6";
+            this.label6.Size = new System.Drawing.Size(50, 13);
+            this.label6.TabIndex = 8;
+            this.label6.Text = "Impostor:";
+            // 
+            // cbImpostor
+            // 
+            this.cbImpostor.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.cbImpostor.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+            this.cbImpostor.FormattingEnabled = true;
+            this.cbImpostor.Items.AddRange(new object[] {
+            "None",
+            "Sphere",
+            "Box",
+            "Plane"});
+            this.cbImpostor.Location = new System.Drawing.Point(25, 43);
+            this.cbImpostor.Name = "cbImpostor";
+            this.cbImpostor.Size = new System.Drawing.Size(290, 21);
+            this.cbImpostor.TabIndex = 7;
+            // 
+            // nupMass
+            // 
+            this.nupMass.DecimalPlaces = 2;
+            this.nupMass.Location = new System.Drawing.Point(89, 70);
+            this.nupMass.Maximum = new decimal(new int[] {
             1000,
             0,
             0,
             0});
-            this.nupAlphaIndex.Name = "nupAlphaIndex";
-            this.nupAlphaIndex.Size = new System.Drawing.Size(120, 20);
-            this.nupAlphaIndex.TabIndex = 5;
+            this.nupMass.Name = "nupMass";
+            this.nupMass.Size = new System.Drawing.Size(120, 20);
+            this.nupMass.TabIndex = 5;
             // 
-            // label3
+            // label4
             // 
-            this.label3.AutoSize = true;
-            this.label3.Location = new System.Drawing.Point(18, 145);
-            this.label3.Name = "label3";
-            this.label3.Size = new System.Drawing.Size(65, 13);
-            this.label3.TabIndex = 6;
-            this.label3.Text = "Alpha index:";
+            this.label4.AutoSize = true;
+            this.label4.Location = new System.Drawing.Point(18, 70);
+            this.label4.Name = "label4";
+            this.label4.Size = new System.Drawing.Size(35, 13);
+            this.label4.TabIndex = 6;
+            this.label4.Text = "Mass:";
+            // 
+            // nupFriction
+            // 
+            this.nupFriction.DecimalPlaces = 2;
+            this.nupFriction.Location = new System.Drawing.Point(89, 96);
+            this.nupFriction.Maximum = new decimal(new int[] {
+            1,
+            0,
+            0,
+            0});
+            this.nupFriction.Name = "nupFriction";
+            this.nupFriction.Size = new System.Drawing.Size(120, 20);
+            this.nupFriction.TabIndex = 9;
+            // 
+            // label5
+            // 
+            this.label5.AutoSize = true;
+            this.label5.Location = new System.Drawing.Point(18, 96);
+            this.label5.Name = "label5";
+            this.label5.Size = new System.Drawing.Size(44, 13);
+            this.label5.TabIndex = 10;
+            this.label5.Text = "Friction:";
+            // 
+            // nupRestitution
+            // 
+            this.nupRestitution.DecimalPlaces = 2;
+            this.nupRestitution.Location = new System.Drawing.Point(89, 122);
+            this.nupRestitution.Maximum = new decimal(new int[] {
+            1,
+            0,
+            0,
+            0});
+            this.nupRestitution.Name = "nupRestitution";
+            this.nupRestitution.Size = new System.Drawing.Size(120, 20);
+            this.nupRestitution.TabIndex = 11;
+            // 
+            // label7
+            // 
+            this.label7.AutoSize = true;
+            this.label7.Location = new System.Drawing.Point(18, 122);
+            this.label7.Name = "label7";
+            this.label7.Size = new System.Drawing.Size(60, 13);
+            this.label7.TabIndex = 12;
+            this.label7.Text = "Restitution:";
             // 
             // ObjectPropertiesForm
             // 
@@ -302,7 +423,8 @@
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.CancelButton = this.butCancel;
-            this.ClientSize = new System.Drawing.Size(343, 465);
+            this.ClientSize = new System.Drawing.Size(343, 634);
+            this.Controls.Add(this.groupBox4);
             this.Controls.Add(this.groupBox3);
             this.Controls.Add(this.groupBox2);
             this.Controls.Add(this.butCancel);
@@ -317,13 +439,18 @@
             this.groupBox1.PerformLayout();
             this.groupBox2.ResumeLayout(false);
             this.groupBox2.PerformLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.nupAlphaIndex)).EndInit();
             this.groupBox3.ResumeLayout(false);
             this.groupBox3.PerformLayout();
             this.grpAutoAnimate.ResumeLayout(false);
             this.grpAutoAnimate.PerformLayout();
             ((System.ComponentModel.ISupportInitialize)(this.nupTo)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.nupFrom)).EndInit();
-            ((System.ComponentModel.ISupportInitialize)(this.nupAlphaIndex)).EndInit();
+            this.groupBox4.ResumeLayout(false);
+            this.groupBox4.PerformLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.nupMass)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.nupFriction)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.nupRestitution)).EndInit();
             this.ResumeLayout(false);
 
         }
@@ -350,5 +477,14 @@
         private System.Windows.Forms.CheckBox chkNoExport;
         private System.Windows.Forms.NumericUpDown nupAlphaIndex;
         private System.Windows.Forms.Label label3;
+        private System.Windows.Forms.GroupBox groupBox4;
+        private System.Windows.Forms.NumericUpDown nupMass;
+        private System.Windows.Forms.Label label4;
+        private System.Windows.Forms.Label label6;
+        private System.Windows.Forms.ComboBox cbImpostor;
+        private System.Windows.Forms.NumericUpDown nupRestitution;
+        private System.Windows.Forms.Label label7;
+        private System.Windows.Forms.NumericUpDown nupFriction;
+        private System.Windows.Forms.Label label5;
     }
 }

+ 10 - 0
Exporters/3ds Max/Max2Babylon/Forms/ObjectPropertiesForm.cs

@@ -29,6 +29,10 @@ namespace Max2Babylon
             Tools.UpdateNumericUpDown(nupTo, objects, "babylonjs_autoanimate_to");
 
             Tools.UpdateNumericUpDown(nupAlphaIndex, objects, "babylonjs_alphaindex");
+            Tools.UpdateNumericUpDown(nupMass, objects, "babylonjs_mass");
+            Tools.UpdateNumericUpDown(nupFriction, objects, "babylonjs_friction");
+            Tools.UpdateNumericUpDown(nupRestitution, objects, "babylonjs_restitution");
+            Tools.UpdateComboBox(cbImpostor, objects, "babylonjs_impostor");
         }
 
         private void ObjectPropertiesForm_Load(object sender, EventArgs e)
@@ -55,6 +59,12 @@ namespace Max2Babylon
             Tools.PrepareNumericUpDown(nupFrom, objects, "babylonjs_autoanimate_from");
             Tools.PrepareNumericUpDown(nupTo, objects, "babylonjs_autoanimate_to", 100.0f);
             Tools.PrepareNumericUpDown(nupAlphaIndex, objects, "babylonjs_alphaindex", 1000);
+
+            Tools.PrepareNumericUpDown(nupMass, objects, "babylonjs_mass");
+            Tools.PrepareNumericUpDown(nupFriction, objects, "babylonjs_friction", 0.2f);
+            Tools.PrepareNumericUpDown(nupRestitution, objects, "babylonjs_restitution", 0.2f);
+
+            Tools.PrepareComboBox(cbImpostor, objects[0], "babylonjs_impostor", "None");
         }
 
         private void chkAutoAnimate_CheckedChanged(object sender, EventArgs e)

+ 1 - 0
Exporters/3ds Max/Max2Babylon/Tools/WebServer.cs

@@ -18,6 +18,7 @@ namespace Max2Babylon
 
 <head>
     <title>Babylon.js</title>
+    <script type='text/javascript' src='http://www.babylonjs.com/oimo.js'></script>
     <script type='text/javascript' src='http://www.babylonjs.com/cannon.js'></script>
     <script type='text/javascript' src='http://www.babylonjs.com/babylon.js'></script>
     <style type='text/css'>

+ 16 - 0
babylon.2.0-alpha.debug.js

@@ -5036,7 +5036,23 @@ var BABYLON;
                             _this._workingCanvas.width = potWidth;
                             _this._workingCanvas.height = potHeight;
 
+                            if (samplingMode === BABYLON.Texture.NEAREST_SAMPLINGMODE) {
+                                _this._workingContext.imageSmoothingEnabled = false;
+                                _this._workingContext.mozImageSmoothingEnabled = false;
+                                _this._workingContext.oImageSmoothingEnabled = false;
+                                _this._workingContext.webkitImageSmoothingEnabled = false;
+                                _this._workingContext.msImageSmoothingEnabled = false;
+                            }
+
                             _this._workingContext.drawImage(img, 0, 0, img.width, img.height, 0, 0, potWidth, potHeight);
+
+                            if (samplingMode === BABYLON.Texture.NEAREST_SAMPLINGMODE) {
+                                _this._workingContext.imageSmoothingEnabled = true;
+                                _this._workingContext.mozImageSmoothingEnabled = true;
+                                _this._workingContext.oImageSmoothingEnabled = true;
+                                _this._workingContext.webkitImageSmoothingEnabled = true;
+                                _this._workingContext.msImageSmoothingEnabled = true;
+                            }
                         }
 
                         _this._gl.texImage2D(_this._gl.TEXTURE_2D, 0, _this._gl.RGBA, _this._gl.RGBA, _this._gl.UNSIGNED_BYTE, isPot ? img : _this._workingCanvas);

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 7 - 7
babylon.2.0-alpha.js