示例#1
0
        public static PostEffect Load(string shaderFileName, string flags)
        {
            PostEffect eff = new PostEffect();

            eff.effect = GLSLShader.Load(shaderFileName + (flags == "" ? "" : ":" + flags));
            return(eff);
        }
示例#2
0
        public override void Render()
        {
            ShadowMapping.SetupShadows(world, 0, true);
            GL.Clear(ClearFlags);
            camera.SetFPSCamera();

            // render scene to colorFBO
            world.RenderSceneWithParticles(colorFBO);
            colorFBO.BindFBO();
            lightImg.RenderBillboard(Light.Lights[0].Position, 0, 100, true);
            colorFBO.UnBindFBO();

            Camera.Set2D();
            {
                PostEffect.Begin(colorFBO);
                if (Keyboard[Key.R])
                {
                    blurH.RenderEffect();
                    blurV.RenderEffect();
                }
                if (Keyboard[Key.T])
                {
                    bloom.RenderEffect();
                }

                PostEffect.End().DrawFullScreen(0, 0);
                font.Write("Soft particles + effects (press R / T)");
            }
            Camera.Set3D();

            base.Render();
        }
示例#3
0
        public override void Init()
        {
            colorFBO = new FBO(0, 0, 2, true); // 2 colorbufferia
            depthFBO = new FBO(0, 0, 0, true);
            blurH    = PostEffect.Load("blur.shader", "HORIZ");
            blurH.SetParameter("size", 1f / (float)colorFBO.Width);
            blurV = PostEffect.Load("blur.shader", "VERT");
            blurV.SetParameter("size", 1f / (float)colorFBO.Width);
            bloom = PostEffect.Load("bloom.shader", "");
            bloom.SetParameter("size", 0.001f);

            Particles.EnableSoftParticles();
            ShadowMapping.Create(depthFBO, "lightmask.png");

            font = BitmapFont.Load("fonts/comic12.png");

            skybox = Sky.Load("sky/sky2_", "jpg");
            world.Add(skybox);

            lightImg = Billboard.Load("lightimg.png");

            GLSLShader.SetShader("shadowmapping.shader", "SHADOWS");
            DotScene ds = DotScene.Load("scene1/scene1.scene", scene);

            world.Add(scene);

            actors[0] = AnimatedModel.Load("ugly/ukko.mesh");
            actors[0].LoadMD5Animation("act1", "ugly/ukko_action1.anim");
            actors[0].LoadMD5Animation("act2", "ugly/ukko_action2.anim");
            actors[0].LoadMD5Animation("act3", "ugly/ukko_action3.anim");
            actors[0].LoadMD5Animation("walk", "ugly/ukko_walk.anim");
            actors[0].SetAnimation("act2"); // idle anim
            actors[0].Position.Y = -0.5f;
            actors[0].Scale      = new Vector3(5, 5, 5);
            world.Add(actors[0]);

            explosion = Particles.Load("explosion.particles.xml", new ParticleCallback(RenderParticleCallback));
            smoke     = Particles.Load("smoke.particles.xml", null);
            actors[0].Add(smoke);

            Camera.Set3D();
            base.Init();
        }
示例#4
0
        public override void Init()
        {
            colorFBO = new FBO(0, 0, 2, true); // 2 colorbufferia
            depthFBO = new FBO(0, 0, 0, true);
            blurH = PostEffect.Load("blur.shader", "HORIZ");
            blurH.SetParameter("size", 1f / (float)colorFBO.Width);
            blurV = PostEffect.Load("blur.shader", "VERT");
            blurV.SetParameter("size", 1f / (float)colorFBO.Width);
            bloom = PostEffect.Load("bloom.shader", "");
            bloom.SetParameter("size", 0.001f);

            Particles.EnableSoftParticles();
            ShadowMapping.Create(depthFBO, "lightmask.png");

            font = BitmapFont.Load("fonts/comic12.png");

            skybox = Sky.Load("sky/sky2_", "jpg");
            world.Add(skybox);

            lightImg = Billboard.Load("lightimg.png");

            GLSLShader.SetShader("shadowmapping.shader", "SHADOWS");
            DotScene ds = DotScene.Load("scene1/scene1.scene", scene);
            world.Add(scene);

            actors[0] = AnimatedModel.Load("ugly/ukko.mesh");
            actors[0].LoadMD5Animation("act1", "ugly/ukko_action1.anim");
            actors[0].LoadMD5Animation("act2", "ugly/ukko_action2.anim");
            actors[0].LoadMD5Animation("act3", "ugly/ukko_action3.anim");
            actors[0].LoadMD5Animation("walk", "ugly/ukko_walk.anim");
            actors[0].SetAnimation("act2"); // idle anim
            actors[0].Position.Y = -0.5f;
            actors[0].Scale = new Vector3(5, 5, 5);
            world.Add(actors[0]);

            explosion = Particles.Load("explosion.particles.xml", new ParticleCallback(RenderParticleCallback));
            smoke = Particles.Load("smoke.particles.xml", null);
            actors[0].Add(smoke);

            Camera.Set3D();
            base.Init();
        }
示例#5
0
文件: PostEffect.cs 项目: bosoni/csat
 public static PostEffect Load(string shaderFileName, string flags)
 {
     PostEffect eff = new PostEffect();
     eff.effect = GLSLShader.Load(shaderFileName + (flags == "" ? "" : ":" + flags));
     return eff;
 }