OSDN Git Service

Revert stencil invisiprim implementation.
authorLatif Khalifa <latifer@streamgrid.net>
Sun, 28 Aug 2011 07:10:39 +0000 (07:10 +0000)
committerLatif Khalifa <latifer@streamgrid.net>
Sun, 28 Aug 2011 07:10:39 +0000 (07:10 +0000)
git-svn-id: https://radegast.googlecode.com/svn/trunk@1119 f7a694da-4d33-11de-9ad6-1127a62b9fcd

Radegast/GUI/Rendering/RenderPrimitive.cs
Radegast/GUI/Rendering/Rendering.cs
Radegast/GUI/Rendering/RenderingHelpers.cs

index e3ea986..5bfa424 100644 (file)
@@ -459,10 +459,6 @@ namespace Radegast.Rendering
             {
                 HasAlphaFaces = false;
             }
-            else if (pass == RenderPass.Stencil)
-            {
-                HasInvisibleFaces = false;
-            }
 
             // Draw the prim faces
             for (int j = 0; j < Faces.Count; j++)
@@ -484,21 +480,8 @@ namespace Radegast.Rendering
 
                 bool switchedLightsOff = false;
 
-                if (pass == RenderPass.Picking)
-                {
-                    data.PickingID = pickingID;
-                    var primNrBytes = Utils.UInt16ToBytes((ushort)pickingID);
-                    var faceColor = new byte[] { primNrBytes[0], primNrBytes[1], (byte)j, 255 };
-                    GL.Color4(faceColor);
-                }
-                else if (pass == RenderPass.Stencil)
+                if (pass != RenderPass.Picking)
                 {
-                    if (!data.TextureInfo.IsInvisible) continue;
-                    HasInvisibleFaces = true;
-                }
-                else
-                {
-                    if (data.TextureInfo.IsInvisible) continue;
                     bool belongToAlphaPass = (RGBA.A < 0.99f) || (data.TextureInfo.HasAlpha && !data.TextureInfo.IsMask);
 
                     if (belongToAlphaPass && pass != RenderPass.Alpha) continue;
@@ -590,6 +573,13 @@ namespace Radegast.Rendering
                         GL.BindTexture(TextureTarget.Texture2D, data.TextureInfo.TexturePointer);
                     }
                 }
+                else
+                {
+                    data.PickingID = pickingID;
+                    var primNrBytes = Utils.UInt16ToBytes((ushort)pickingID);
+                    var faceColor = new byte[] { primNrBytes[0], primNrBytes[1], (byte)j, 255 };
+                    GL.Color4(faceColor);
+                }
 
                 if (!RenderSettings.UseVBO || data.VBOFailed)
                 {
@@ -630,7 +620,6 @@ namespace Radegast.Rendering
                     GL.Enable(EnableCap.Lighting);
                     switchedLightsOff = false;
                 }
-
             }
 
             GL.BindTexture(TextureTarget.Texture2D, 0);
index e62de6f..5979500 100644 (file)
@@ -2630,15 +2630,6 @@ namespace Radegast.Rendering
                 myPos = Client.Self.SimPosition;\r
             }\r
 \r
-            if (pass == RenderPass.Stencil)\r
-            {\r
-                GL.Disable(EnableCap.Texture2D);\r
-                GL.DepthMask(false);\r
-                GL.StencilFunc(StencilFunction.Always, 1, 1);\r
-                GL.StencilOp(StencilOp.Keep, StencilOp.Keep, StencilOp.Replace);\r
-                GL.ColorMask(false, false, false, false);\r
-            }\r
-\r
             int nrPrims = SortedObjects.Count;\r
             for (int i = 0; i < nrPrims; i++)\r
             {\r
@@ -2653,27 +2644,12 @@ namespace Radegast.Rendering
                 {\r
                     // Don't render objects that are outside the draw distane\r
                     if (Vector3.DistanceSquared(myPos, obj.RenderPosition) > drawDistanceSquared) continue;\r
-                    if (pass == RenderPass.Simple || pass == RenderPass.Alpha)\r
-                    {\r
-                        obj.StartQuery(pass);\r
-                        obj.Render(pass, ix, this, lastFrameTime);\r
-                        obj.EndQuery(pass);\r
-                    }\r
-                    else\r
-                    {\r
-                        obj.Render(pass, ix, this, lastFrameTime);\r
-                    }\r
+                    obj.StartQuery(pass);\r
+                    obj.Render(pass, ix, this, lastFrameTime);\r
+                    obj.EndQuery(pass);\r
                 }\r
             }\r
 \r
-            if (pass == RenderPass.Stencil)\r
-            {\r
-                GL.StencilOp(StencilOp.Keep, StencilOp.Keep, StencilOp.Keep);\r
-                GL.ColorMask(true, true, true, true);\r
-                GL.StencilFunc(StencilFunction.Notequal, 1, 1);\r
-                GL.DepthMask(true);\r
-            }\r
-\r
             GL.Disable(EnableCap.Texture2D);\r
             GL.DisableClientState(ArrayCap.VertexArray);\r
             GL.DisableClientState(ArrayCap.TextureCoordArray);\r
@@ -2714,7 +2690,7 @@ namespace Radegast.Rendering
                 GL.ClearColor(0.39f, 0.58f, 0.93f, 1.0f);\r
             }\r
 \r
-            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit | ClearBufferMask.StencilBufferBit);\r
+            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);\r
             GL.LoadIdentity();\r
 \r
             // Setup wireframe or solid fill drawing mode\r
@@ -2795,11 +2771,9 @@ namespace Radegast.Rendering
                 GL.Enable(EnableCap.AlphaTest);\r
                 RenderObjects(RenderPass.Simple);\r
                 RenderAvatarsSkeleton(RenderPass.Simple);\r
-                GL.Enable(EnableCap.StencilTest);\r
-                RenderObjects(RenderPass.Stencil);\r
                 RenderAvatars(RenderPass.Simple);\r
                 GL.Disable(EnableCap.AlphaTest);\r
-                GL.Disable(EnableCap.StencilTest);\r
+\r
                 GL.DepthMask(false);\r
                 RenderOccludedObjects();\r
 \r
@@ -2952,10 +2926,6 @@ namespace Radegast.Rendering
             return false;\r
         }\r
 \r
-\r
-        public static readonly UUID invisi1 = new UUID("38b86f85-2575-52a9-a531-23108d8da837");\r
-        public static readonly UUID invisi2 = new UUID("e97cf410-8e61-7005-ec06-629eba4cd1fb");\r
-\r
         public void DownloadTexture(TextureLoadItem item)\r
         {\r
             if (texturesRequestedThisFrame < RenderSettings.TexturesToDownloadPerFrame)\r
@@ -2968,12 +2938,6 @@ namespace Radegast.Rendering
                     {\r
                         item.Data.TextureInfo = TexturesPtrMap[item.TeFace.TextureID];\r
                     }\r
-                    else if (item.TeFace.TextureID == invisi1 || item.TeFace.TextureID == invisi2)\r
-                    {\r
-                        TexturesPtrMap[item.TeFace.TextureID] = item.Data.TextureInfo;\r
-                        TexturesPtrMap[item.TeFace.TextureID].HasAlpha = false;\r
-                        TexturesPtrMap[item.TeFace.TextureID].IsInvisible = true;\r
-                    }\r
                     else\r
                     {\r
                         TexturesPtrMap[item.TeFace.TextureID] = item.Data.TextureInfo;\r
index 7b6dfea..0227735 100644 (file)
@@ -73,7 +73,6 @@ namespace Radegast.Rendering
         public bool HasAlpha;\r
         public bool FullAlpha;\r
         public bool IsMask;\r
-        public bool IsInvisible;\r
         public UUID TextureID;\r
         public bool FetchFailed;\r
     }\r
@@ -92,8 +91,7 @@ namespace Radegast.Rendering
     {\r
         Picking,\r
         Simple,\r
-        Alpha,\r
-        Stencil\r
+        Alpha\r
     }\r
 \r
     public enum SceneObjectType\r
@@ -135,7 +133,6 @@ namespace Radegast.Rendering
         public int SimpleQueryID = -1;\r
         public bool HasAlphaFaces;\r
         public bool HasSimpleFaces;\r
-        public bool HasInvisibleFaces;\r
 \r
         #endregion Public fields\r
 \r
@@ -315,8 +312,6 @@ namespace Radegast.Rendering
         {\r
             if (!RenderSettings.OcclusionCullingEnabled) return false;\r
 \r
-            if (HasInvisibleFaces) return false;\r
-\r
             if ((SimpleQueryID == -1 && AlphaQueryID == -1))\r
             {\r
                 return false;\r