OSDN Git Service

Some small optimizations and move texture downloads into the settings class.
authorRevolution Smythe <ASDFISBETTERTHANJKL@gmail.com>
Sun, 31 Jul 2011 08:14:32 +0000 (08:14 +0000)
committerRevolution Smythe <ASDFISBETTERTHANJKL@gmail.com>
Sun, 31 Jul 2011 08:14:32 +0000 (08:14 +0000)
git-svn-id: https://radegast.googlecode.com/svn/trunk@1045 f7a694da-4d33-11de-9ad6-1127a62b9fcd

Radegast/GUI/Rendering/RenderSettings.cs
Radegast/GUI/Rendering/Rendering.cs

index 794ca3d..899dbe3 100644 (file)
@@ -46,5 +46,6 @@ namespace Radegast.Rendering
         public static DetailLevel MeshRenderDetail = DetailLevel.Highest;
         public static bool AllowQuickAndDirtyMeshing = true;
         public static int MeshesPerFrame = 2;
+        public static int TexturesToDownloadPerFrame = 2;
     }
 }
index 6e5bd21..17e9e1c 100644 (file)
@@ -2214,9 +2214,9 @@ namespace Radegast.Rendering
             // Draw the prim faces\r
             for (int j = 0; j < mesh.Faces.Count; j++)\r
             {\r
-                Primitive.TextureEntryFace teFace = mesh.Prim.Textures.GetFace((uint)j);\r
+                Primitive.TextureEntryFace teFace = prim.Textures.GetFace((uint)j);\r
                 Face face = mesh.Faces[j];\r
-                FaceData data = (FaceData)mesh.Faces[j].UserData;\r
+                FaceData data = (FaceData)face.UserData;\r
 \r
                 if (data == null)\r
                     continue;\r
@@ -2225,13 +2225,15 @@ namespace Radegast.Rendering
                     continue;\r
 \r
                 // Don't render transparent faces\r
-                if (data.TextureInfo.FullAlpha || teFace.RGBA.A <= 0.01f) continue;\r
+                Color4 RGBA = teFace.RGBA;\r
+\r
+                if (data.TextureInfo.FullAlpha || RGBA.A <= 0.01f) continue;\r
 \r
                 bool switchedLightsOff = false;\r
 \r
                 if (pass != RenderPass.Picking)\r
                 {\r
-                    bool belongToAlphaPass = (teFace.RGBA.A < 0.99f) || (data.TextureInfo.HasAlpha && !data.TextureInfo.IsMask);\r
+                    bool belongToAlphaPass = (RGBA.A < 0.99f) || (data.TextureInfo.HasAlpha && !data.TextureInfo.IsMask);\r
 \r
                     if (belongToAlphaPass && pass != RenderPass.Alpha) continue;\r
                     if (!belongToAlphaPass && pass == RenderPass.Alpha) continue;\r
@@ -2272,7 +2274,7 @@ namespace Radegast.Rendering
                             break;\r
                     }\r
 \r
-                    var faceColor = new float[] { teFace.RGBA.R, teFace.RGBA.G, teFace.RGBA.B, teFace.RGBA.A };\r
+                    var faceColor = new float[] { RGBA.R, RGBA.G, RGBA.B, RGBA.A };\r
                     GL.Color4(faceColor);\r
 \r
                     GL.Material(MaterialFace.Front, MaterialParameter.Specular, new float[] { 0.5f, 0.5f, 0.5f, 1f });\r
@@ -2285,7 +2287,7 @@ namespace Radegast.Rendering
                     if (data.TextureInfo.TexturePointer == 0)\r
                     {\r
                         GL.Disable(EnableCap.Texture2D);\r
-                        if (texturesRequestedThisFrame < 2 && !data.TextureInfo.FetchFailed)\r
+                        if(texturesRequestedThisFrame < RenderSettings.TexturesToDownloadPerFrame && !data.TextureInfo.FetchFailed)\r
                         {\r
                             texturesRequestedThisFrame++;\r
 \r