Esempio n. 1
0
        static BoundingBoxRenderableComponent GetBoundingBoxCom(BoundingBox box)
        {
            var name = "BoundingBoxShader";

            var compiler = new D3DShaderCompilator(null);

            var vertex = new ShaderInMemoryInfo(name + "Vertex", VertexShaderText,
                                                compiler.Compile(VertexShaderText,
                                                                 "VShaderBoundingBox", ShaderStages.Vertex.ToString()),
                                                ShaderStages.Vertex.ToString(), "VShaderBoundingBox");

            var pixel = new ShaderInMemoryInfo(name + "Pixel", PixelShaderText,
                                               compiler.Compile(PixelShaderText,
                                                                "PShaderBoundingBox", ShaderStages.Fragment.ToString()),
                                               ShaderStages.Fragment.ToString(), "PShaderBoundingBox");

            var geometry = new ShaderInMemoryInfo(name + "Geometry", GeometryShaderText,
                                                  compiler.Compile(GeometryShaderText,
                                                                   "GShaderBoundingBox", ShaderStages.Geometry.ToString()),
                                                  ShaderStages.Geometry.ToString(), "GShaderBoundingBox");

            var pass = new ShaderTechniquePass(new IShaderInfo[] { vertex, geometry, pixel, });

            var shader = new LineShaderSpecification(new[] { pass });

            return(new BoundingBoxRenderableComponent(shader, new LineDeviceBufferesUpdater(shader), box));
        }
Esempio n. 2
0
        public static ParticleRenderableComponent GetParticlesCom()
        {
            var name = "Particle";

            var compiler = new D3DShaderCompilator(null);

            var vertex = new ShaderInMemoryInfo(name + "Vertex", ShaderStructures + VertexShaderText,
                                                compiler.Compile(ShaderStructures + VertexShaderText,
                                                                 "TriangleVS", ShaderStages.Vertex.ToString()),
                                                ShaderStages.Vertex.ToString(), "TriangleVS");

            //var geometry = new ShaderInMemoryInfo(name + "Geometry", ShaderStructures + GeometryShaderText,
            //    compiler.Compile(ShaderStructures + GeometryShaderText,
            //        "TriangleGS", ShaderStages.Geometry.ToString()),
            //    ShaderStages.Geometry.ToString(), "TriangleGS");

            var pixel = new ShaderInMemoryInfo(name + "Pixel", ShaderStructures + PixelShaderText,
                                               compiler.Compile(ShaderStructures + PixelShaderText,
                                                                "TrianglePS", ShaderStages.Fragment.ToString()),
                                               ShaderStages.Fragment.ToString(), "TrianglePS");

            var pass = new ShaderTechniquePass(new IShaderInfo[] { vertex, /*geometry,*/ pixel });

            var shader = new ParticleShaderSpecification(new[] { pass });

            return(new ParticleRenderableComponent(shader, new ParticleDeviceBufferesUpdater(shader)));
        }