فهرست منبع

Fixing DDS rendering issue
New option for Max2Babylon: Do not export hidden objects

David Catuhe 11 سال پیش
والد
کامیت
b05f4630f7

+ 0 - 4
Babylon/Tools/babylon.tools.dds.js

@@ -193,10 +193,6 @@
                         dataOffset += dataLength;
                         width *= 0.5;
                         height *= 0.5;
-
-                        if (width <= 2 || height <= 2) {
-                            break;
-                        }
                     }
                 }
             };

+ 1 - 5
Babylon/Tools/babylon.tools.dds.ts

@@ -196,7 +196,7 @@
             if (header[off_flags] & DDSD_MIPMAPCOUNT && loadMipmaps !== false) {
                 mipmapCount = Math.max(1, header[off_mipmapCount]);
             }
-
+            
             var bpp = header[off_RGBbpp];
 
             for (var face = 0; face < faces; face++) {
@@ -229,10 +229,6 @@
                     dataOffset += dataLength;
                     width *= 0.5;
                     height *= 0.5;
-
-                    if (width <= 2 || height <= 2) {
-                        break;
-                    }
                 }
             }
         }

+ 1 - 1
Babylon/babylon.engine.js

@@ -932,7 +932,7 @@
                 BABYLON.Tools.LoadFile(url, function (data) {
                     var info = BABYLON.Internals.DDSTools.GetDDSInfo(data);
 
-                    var loadMipmap = (info.isRGB || info.isLuminance || info.mipmapCount > 1) && !noMipmap && ((info.width >> (info.mipmapCount - 1)) <= 4);
+                    var loadMipmap = (info.isRGB || info.isLuminance || info.mipmapCount > 1) && !noMipmap && ((info.width >> (info.mipmapCount - 1)) == 1);
 
                     prepareWebGLTexture(texture, _this._gl, scene, info.width, info.height, invertY, !loadMipmap, info.isFourCC, function () {
                         BABYLON.Internals.DDSTools.UploadDDSLevels(_this._gl, _this.getCaps().s3tc, data, info, loadMipmap, 1);

+ 1 - 1
Babylon/babylon.engine.ts

@@ -963,7 +963,7 @@
                 BABYLON.Tools.LoadFile(url, data => {
                     var info = BABYLON.Internals.DDSTools.GetDDSInfo(data);
 
-                    var loadMipmap = (info.isRGB || info.isLuminance || info.mipmapCount > 1) && !noMipmap && ((info.width >> (info.mipmapCount -1)) <= 4);
+                    var loadMipmap = (info.isRGB || info.isLuminance || info.mipmapCount > 1) && !noMipmap && ((info.width >> (info.mipmapCount -1)) == 1);
 
                     prepareWebGLTexture(texture, this._gl, scene, info.width, info.height, invertY, !loadMipmap, info.isFourCC, () => {
                         Internals.DDSTools.UploadDDSLevels(this._gl, this.getCaps().s3tc, data, info, loadMipmap, 1);

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


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

@@ -18,6 +18,11 @@ namespace Max2Babylon
                 return;
             }
 
+            if (!ExportHiddenObjects && !meshNode.Visible)
+            {
+                return;
+            }
+
             var babylonMesh = new BabylonMesh();
             int vx1, vx2, vx3;
 

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

@@ -23,7 +23,9 @@ namespace Max2Babylon
 
         readonly List<string> alreadyExportedTextures = new List<string>();
 
+        public bool ExportHiddenObjects { get; set; }
         public bool IsCancelled { get; set; }
+
         public bool CopyTexturesToOutput { get; set; }
 
         private bool exportQuaternionsInsteadOfEulers;
@@ -127,6 +129,10 @@ namespace Max2Babylon
             {
                 RaiseWarning("No camera defined", 1);
             }
+            else
+            {
+                RaiseMessage(string.Format("Total: {0}", babylonScene.CamerasList.Count), Color.Gray, 1);
+            }
 
             // Fog
             for (var index = 0; index < Loader.Core.NumAtmospheric; index++)
@@ -168,6 +174,7 @@ namespace Max2Babylon
 
                 CheckCancelled();
             }
+            RaiseMessage(string.Format("Total: {0}", babylonScene.MeshesList.Count), Color.Gray, 1);
 
             // Materials
             RaiseMessage("Exporting materials");
@@ -177,6 +184,7 @@ namespace Max2Babylon
                 ExportMaterial(mat, babylonScene);
                 CheckCancelled();
             }
+            RaiseMessage(string.Format("Total: {0}", babylonScene.MaterialsList.Count + babylonScene.MultiMaterialsList.Count), Color.Gray, 1);
 
             // Lights
             RaiseMessage("Exporting lights");
@@ -190,6 +198,10 @@ namespace Max2Babylon
             {
                 RaiseWarning("No light defined", 1);
             }
+            else
+            {
+                RaiseMessage(string.Format("Total: {0}", babylonScene.LightsList.Count), Color.Gray, 1);
+            }
 
             // Skeletons
             RaiseMessage("Exporting skeletons");

+ 16 - 3
Exporters/3ds Max/Max2Babylon/Forms/ExporterForm.Designer.cs

@@ -43,6 +43,7 @@
             this.label2 = new System.Windows.Forms.Label();
             this.chkCopyTextures = new System.Windows.Forms.CheckBox();
             this.groupBox1 = new System.Windows.Forms.GroupBox();
+            this.chkHidden = new System.Windows.Forms.CheckBox();
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
             this.groupBox1.SuspendLayout();
             this.SuspendLayout();
@@ -149,7 +150,6 @@
             this.chkManifest.Size = new System.Drawing.Size(112, 17);
             this.chkManifest.TabIndex = 2;
             this.chkManifest.Text = "Generate .manifest";
-            this.chkManifest.ThreeState = true;
             this.chkManifest.UseVisualStyleBackColor = true;
             // 
             // chkQuaternions
@@ -161,7 +161,6 @@
             this.chkQuaternions.Size = new System.Drawing.Size(221, 17);
             this.chkQuaternions.TabIndex = 1;
             this.chkQuaternions.Text = "Export quaternions instead of Euler angles";
-            this.chkQuaternions.ThreeState = true;
             this.chkQuaternions.UseVisualStyleBackColor = true;
             // 
             // label2
@@ -183,13 +182,13 @@
             this.chkCopyTextures.Size = new System.Drawing.Size(132, 17);
             this.chkCopyTextures.TabIndex = 12;
             this.chkCopyTextures.Text = "Copy textures to output";
-            this.chkCopyTextures.ThreeState = true;
             this.chkCopyTextures.UseVisualStyleBackColor = true;
             // 
             // groupBox1
             // 
             this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
             | System.Windows.Forms.AnchorStyles.Right)));
+            this.groupBox1.Controls.Add(this.chkHidden);
             this.groupBox1.Controls.Add(this.label1);
             this.groupBox1.Controls.Add(this.chkCopyTextures);
             this.groupBox1.Controls.Add(this.txtFilename);
@@ -203,6 +202,19 @@
             this.groupBox1.TabIndex = 13;
             this.groupBox1.TabStop = false;
             // 
+            // chkHidden
+            // 
+            this.chkHidden.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+            this.chkHidden.AutoSize = true;
+            this.chkHidden.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+            this.chkHidden.Location = new System.Drawing.Point(338, 102);
+            this.chkHidden.Name = "chkHidden";
+            this.chkHidden.Size = new System.Drawing.Size(125, 17);
+            this.chkHidden.TabIndex = 13;
+            this.chkHidden.Text = "Export hidden objects";
+            this.chkHidden.ThreeState = true;
+            this.chkHidden.UseVisualStyleBackColor = true;
+            // 
             // ExporterForm
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -246,5 +258,6 @@
         private System.Windows.Forms.Label label2;
         private System.Windows.Forms.CheckBox chkCopyTextures;
         private System.Windows.Forms.GroupBox groupBox1;
+        private System.Windows.Forms.CheckBox chkHidden;
     }
 }

+ 5 - 0
Exporters/3ds Max/Max2Babylon/Forms/ExporterForm.cs

@@ -27,6 +27,7 @@ namespace Max2Babylon
             Tools.PrepareCheckBox(chkQuaternions, Kernel.Scene.RootNode._Node, "babylonjs_exportquaternions");
             Tools.PrepareCheckBox(chkManifest, Kernel.Scene.RootNode._Node, "babylonjs_generatemanifest");
             Tools.PrepareCheckBox(chkCopyTextures, Kernel.Scene.RootNode._Node, "babylonjs_copytextures", 1);
+            Tools.PrepareCheckBox(chkHidden, Kernel.Scene.RootNode._Node, "babylonjs_exporthidden");
         }
 
         private void butBrowse_Click(object sender, EventArgs e)
@@ -42,6 +43,7 @@ namespace Max2Babylon
             Tools.UpdateCheckBox(chkQuaternions, Kernel.Scene.RootNode._Node, "babylonjs_exportquaternions");
             Tools.UpdateCheckBox(chkManifest, Kernel.Scene.RootNode._Node, "babylonjs_generatemanifest");
             Tools.UpdateCheckBox(chkCopyTextures, Kernel.Scene.RootNode._Node, "babylonjs_copytextures");
+            Tools.UpdateCheckBox(chkHidden, Kernel.Scene.RootNode._Node, "babylonjs_exporthidden");
             Kernel.Scene.RootNode.SetLocalData(txtFilename.Text);
 
             exporter = new BabylonExporter();
@@ -102,6 +104,7 @@ namespace Max2Babylon
 
             try
             {
+                exporter.ExportHiddenObjects = chkHidden.Checked;
                 exporter.CopyTexturesToOutput = chkCopyTextures.Checked;
                 exporter.Export(txtFilename.Text, chkManifest.Checked, this);
             }
@@ -119,6 +122,8 @@ namespace Max2Babylon
 
             butCancel.Enabled = false;
             butExport.Enabled = true;
+
+            BringToFront();
         }
 
         private TreeNode CreateTreeNode(int rank, string text, Color color)

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 3 - 3
babylon.1.12.js