예제 #1
0
        public GameRenderer()
        {
            this.shaderMan = new ShaderManager();
            var shaderLoader = ShaderFileLoader.CreateDefault("data/shaders");
            this.shaderMan.Add(shaderLoader.Load(""));

            this.surfaces = new SurfaceManager(this.shaderMan);

            new GeometryManager(this.surfaces);
        }
예제 #2
0
        public ShaderManager()
        {
            var loader = ShaderFileLoader.CreateDefault("data/shaders");
            var man    = new amulware.Graphics.ShaderManagement.ShaderManager();

            man.Add(loader.Load(""));

            this.Primitives = man.MakeShaderProgram("primitives");

            this.UVColor = man.MakeShaderProgram("uvcolor");
        }
        protected override void OnLoad(EventArgs e)
        {
            this.shaderMan = new ShaderManager();

            var shaderLoader = ShaderFileLoader.CreateDefault("shaders");

            // load all shaders
            var shaders = shaderLoader.Load("").ToList();
            this.shaderMan.Add(shaders);

            var layerShader = this.shaderMan.MakeShaderProgram()
                .WithVertexShader("copy").WithFragmentShader("copy")
                .As("layer");

            var copyShader = this.shaderMan.MakeShaderProgram()
                .WithVertexShader("post").WithFragmentShader("copy")
                .As("copypost");

            var wispShader = this.shaderMan.MakeShaderProgram()
                .WithVertexShader("wisp").WithFragmentShader("wisp")
                .As("wisp");

            var rayShader = this.shaderMan.MakeShaderProgram()
                .WithVertexShader("crepuscularrays")
                .WithGeometryShader("crepuscularrays")
                .WithFragmentShader("crepuscularrays")
                .As("crepuscularrays");

            this.renderTexture = new Texture(1, 1);
            this.renderTexture.SetParameters(TextureMinFilter.Linear, TextureMagFilter.Linear, TextureWrapMode.ClampToBorder, TextureWrapMode.ClampToBorder);

            this.renderTarget = new RenderTarget(this.renderTexture);
            var renderTextureUniform = new TextureUniform("diffuseTexture", this.renderTexture);

            this.copyToScreen = new PostProcessSurface();
            this.copyToScreen.AddSettings(renderTextureUniform, new ColorUniform("color", Color.White));
            copyShader.UseOnSurface(this.copyToScreen);

            this.raySurface = new VertexSurface<CrepuscularRayVertex>(PrimitiveType.Points);
            this.raySurface.AddSettings(renderTextureUniform);
            rayShader.UseOnSurface(this.raySurface);

            var rayGeo = new CrepuscularRayGeometry(this.raySurface);

            const int layerCount = 4;
            const float maxBrightness = 0.03f;
            const float brightnessStep = maxBrightness / layerCount;

            this.layers = Enumerable.Range(0, layerCount).Reverse()
                .Select(i => new Layer(layerShader, wispShader, rayGeo, "layer" + i, GameMath.Sqrt(brightnessStep * i), i * i * 5))
                .ToList();

            InputManager.Initialize(this.Mouse);
        }
예제 #4
0
 public ProgramBuilder(ShaderManager manager)
 {
     this.manager = manager;
 }
예제 #5
0
 public ProgramBuilder(ShaderManager manager)
 {
     this.manager = manager;
 }