From 00681c462222efd47bdd66ecfe73c0079387c080 Mon Sep 17 00:00:00 2001 From: Latif Khalifa Date: Sun, 28 Aug 2011 07:10:39 +0000 Subject: [PATCH] Revert stencil invisiprim implementation. git-svn-id: https://radegast.googlecode.com/svn/trunk@1119 f7a694da-4d33-11de-9ad6-1127a62b9fcd --- Radegast/GUI/Rendering/RenderPrimitive.cs | 27 ++++++------------ Radegast/GUI/Rendering/Rendering.cs | 46 ++++-------------------------- Radegast/GUI/Rendering/RenderingHelpers.cs | 7 +---- 3 files changed, 14 insertions(+), 66 deletions(-) diff --git a/Radegast/GUI/Rendering/RenderPrimitive.cs b/Radegast/GUI/Rendering/RenderPrimitive.cs index e3ea986..5bfa424 100644 --- a/Radegast/GUI/Rendering/RenderPrimitive.cs +++ b/Radegast/GUI/Rendering/RenderPrimitive.cs @@ -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); diff --git a/Radegast/GUI/Rendering/Rendering.cs b/Radegast/GUI/Rendering/Rendering.cs index e62de6f..5979500 100644 --- a/Radegast/GUI/Rendering/Rendering.cs +++ b/Radegast/GUI/Rendering/Rendering.cs @@ -2630,15 +2630,6 @@ namespace Radegast.Rendering myPos = Client.Self.SimPosition; } - if (pass == RenderPass.Stencil) - { - GL.Disable(EnableCap.Texture2D); - GL.DepthMask(false); - GL.StencilFunc(StencilFunction.Always, 1, 1); - GL.StencilOp(StencilOp.Keep, StencilOp.Keep, StencilOp.Replace); - GL.ColorMask(false, false, false, false); - } - int nrPrims = SortedObjects.Count; for (int i = 0; i < nrPrims; i++) { @@ -2653,27 +2644,12 @@ namespace Radegast.Rendering { // Don't render objects that are outside the draw distane if (Vector3.DistanceSquared(myPos, obj.RenderPosition) > drawDistanceSquared) continue; - if (pass == RenderPass.Simple || pass == RenderPass.Alpha) - { - obj.StartQuery(pass); - obj.Render(pass, ix, this, lastFrameTime); - obj.EndQuery(pass); - } - else - { - obj.Render(pass, ix, this, lastFrameTime); - } + obj.StartQuery(pass); + obj.Render(pass, ix, this, lastFrameTime); + obj.EndQuery(pass); } } - if (pass == RenderPass.Stencil) - { - GL.StencilOp(StencilOp.Keep, StencilOp.Keep, StencilOp.Keep); - GL.ColorMask(true, true, true, true); - GL.StencilFunc(StencilFunction.Notequal, 1, 1); - GL.DepthMask(true); - } - GL.Disable(EnableCap.Texture2D); GL.DisableClientState(ArrayCap.VertexArray); GL.DisableClientState(ArrayCap.TextureCoordArray); @@ -2714,7 +2690,7 @@ namespace Radegast.Rendering GL.ClearColor(0.39f, 0.58f, 0.93f, 1.0f); } - GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit | ClearBufferMask.StencilBufferBit); + GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); GL.LoadIdentity(); // Setup wireframe or solid fill drawing mode @@ -2795,11 +2771,9 @@ namespace Radegast.Rendering GL.Enable(EnableCap.AlphaTest); RenderObjects(RenderPass.Simple); RenderAvatarsSkeleton(RenderPass.Simple); - GL.Enable(EnableCap.StencilTest); - RenderObjects(RenderPass.Stencil); RenderAvatars(RenderPass.Simple); GL.Disable(EnableCap.AlphaTest); - GL.Disable(EnableCap.StencilTest); + GL.DepthMask(false); RenderOccludedObjects(); @@ -2952,10 +2926,6 @@ namespace Radegast.Rendering return false; } - - public static readonly UUID invisi1 = new UUID("38b86f85-2575-52a9-a531-23108d8da837"); - public static readonly UUID invisi2 = new UUID("e97cf410-8e61-7005-ec06-629eba4cd1fb"); - public void DownloadTexture(TextureLoadItem item) { if (texturesRequestedThisFrame < RenderSettings.TexturesToDownloadPerFrame) @@ -2968,12 +2938,6 @@ namespace Radegast.Rendering { item.Data.TextureInfo = TexturesPtrMap[item.TeFace.TextureID]; } - else if (item.TeFace.TextureID == invisi1 || item.TeFace.TextureID == invisi2) - { - TexturesPtrMap[item.TeFace.TextureID] = item.Data.TextureInfo; - TexturesPtrMap[item.TeFace.TextureID].HasAlpha = false; - TexturesPtrMap[item.TeFace.TextureID].IsInvisible = true; - } else { TexturesPtrMap[item.TeFace.TextureID] = item.Data.TextureInfo; diff --git a/Radegast/GUI/Rendering/RenderingHelpers.cs b/Radegast/GUI/Rendering/RenderingHelpers.cs index 7b6dfea..0227735 100644 --- a/Radegast/GUI/Rendering/RenderingHelpers.cs +++ b/Radegast/GUI/Rendering/RenderingHelpers.cs @@ -73,7 +73,6 @@ namespace Radegast.Rendering public bool HasAlpha; public bool FullAlpha; public bool IsMask; - public bool IsInvisible; public UUID TextureID; public bool FetchFailed; } @@ -92,8 +91,7 @@ namespace Radegast.Rendering { Picking, Simple, - Alpha, - Stencil + Alpha } public enum SceneObjectType @@ -135,7 +133,6 @@ namespace Radegast.Rendering public int SimpleQueryID = -1; public bool HasAlphaFaces; public bool HasSimpleFaces; - public bool HasInvisibleFaces; #endregion Public fields @@ -315,8 +312,6 @@ namespace Radegast.Rendering { if (!RenderSettings.OcclusionCullingEnabled) return false; - if (HasInvisibleFaces) return false; - if ((SimpleQueryID == -1 && AlphaQueryID == -1)) { return false; -- 2.11.0