Example #1
0
 public virtual void Dispose()
 {
     if (font != null) font.Dispose();
     if (colorFBO != null) colorFBO.Dispose();
     if (depthFBO != null) depthFBO.Dispose();
     if (skybox != null) skybox.Dispose();
     skybox = null;
     colorFBO = null;
     depthFBO = null;
     font = null;
     world = null;
     Node.ObjectCount = 0;
     GLSLShader.UnBindShader();
     GLSLShader.SetShader("default.shader", "");
 }
Example #2
0
        /// <summary>
        /// renderoi worldin valosta päin (pelkän depthin)
        /// </summary>
        public static void SetupShadows(Renderable world, int lightNo, bool withParticles)
        {
            if (UseShadowMapping == false) return;

            if (Light.Lights.Count == 0)
            {
                Log.WriteLine("SetupShadows requires at least one light source!", false);
                return;
            }
            GL.Disable(EnableCap.Blend);
            GL.ColorMask(false, false, false, false);
            GL.Disable(EnableCap.CullFace);
            GL.PolygonOffset(1, 1);
            GL.Enable(EnableCap.PolygonOffsetFill);

            fbo.BindDepth();
            fbo.BindFBO();
            fbo.Clear();

            // kuvakulma valosta päin
            GLExt.LoadMatrix(ref Light.Lights[lightNo].OrigOrientationMatrix);
            GLExt.Translate(-Light.Lights[lightNo].Position.X, -Light.Lights[lightNo].Position.Y, -Light.Lights[lightNo].Position.Z);

            SetTextureMatrix();
            Frustum.CalculateFrustum();

            VBO.FastRenderPass = true;
            depthShader.UseProgram();
            world.Render();
            if (withParticles)
            {
                depthShaderAlphaTest.UseProgram();
                Particles.Render();
                GLSLShader.UnBindShader();
            }
            VBO.FastRenderPass = false;
            fbo.UnBindFBO();

            GL.Disable(EnableCap.PolygonOffsetFill);
            GL.Enable(EnableCap.CullFace);
            GL.ColorMask(true, true, true, true);

            GLExt.LoadIdentity();
            GameClass.NumOfObjects = 0;

            ShadowMapping.UnBindLightMask();
        }
Example #3
0
        /// <summary>
        /// putsaa listat ja poista gl-datat
        /// </summary>
        public void ClearArrays()
        {
            Texture.DisposeAll();
            GLSLShader.DisposeAll();
            Material.DisposeAll();
            Particles.DisposeAll();

            Light.Lights.Clear();
            Path.Paths.Clear();

            world = null;
            world = new Renderable("World");
            Node.ObjectCount = 0;
            for (int q = 0; q < Texture.MaxTextures; q++) Texture.UnBind(q);
            GLSLShader.UnBindShader();

            GLSLShader.SetShader("default.shader", "");
            
            GC.Collect();
            GC.WaitForPendingFinalizers();
        }
Example #4
0
 protected void Render(Renderable obj)
 {
     obj.Render();
 }
Example #5
0
 protected void Render(Renderable obj)
 {
     obj.Render();
 }