正方形的水面

suqred water plane.

Inheritance: IBufferable
Ejemplo n.º 1
0
        public static WaterRenderer Create(int waterPlaneLength)
        {
            var model = new WaterPlaneModel(waterPlaneLength);
            var shaderCodes = new ShaderCode[2];
            shaderCodes[0] = new ShaderCode(File.ReadAllText(@"shaders\water\Water.vert.glsl"), ShaderType.VertexShader);
            shaderCodes[1] = new ShaderCode(File.ReadAllText(@"shaders\water\Water.frag.glsl"), ShaderType.FragmentShader);
            var map = new AttributeMap();
            map.Add("a_vertex", WaterPlaneModel.strPosition);
            var renderer = new WaterRenderer(model, shaderCodes, map, new FrontFaceState(FrontFaceMode.CCW));
            renderer.waterTextureRenderer = WaterTextureRenderer.Create(waterPlaneLength);
            renderer.backgroundRenderer = WaterBackgroundRenderer.Create(waterPlaneLength);
            renderer.ModelSize = new vec3(waterPlaneLength + 1, waterPlaneLength + 1, waterPlaneLength + 1);
            renderer.waterPlaneLength = waterPlaneLength;

            return renderer;
        }
Ejemplo n.º 2
0
        public static WaterRenderer Create(int waterPlaneLength)
        {
            var model       = new WaterPlaneModel(waterPlaneLength);
            var shaderCodes = new ShaderCode[2];

            shaderCodes[0] = new ShaderCode(File.ReadAllText(@"shaders\water\Water.vert.glsl"), ShaderType.VertexShader);
            shaderCodes[1] = new ShaderCode(File.ReadAllText(@"shaders\water\Water.frag.glsl"), ShaderType.FragmentShader);
            var map = new AttributeMap();

            map.Add("a_vertex", WaterPlaneModel.strPosition);
            var renderer = new WaterRenderer(model, shaderCodes, map, new FrontFaceSwitch(FrontFaceMode.CCW));

            renderer.waterTextureRenderer = WaterTextureRenderer.Create(waterPlaneLength);
            renderer.backgroundRenderer   = WaterBackgroundRenderer.Create(waterPlaneLength);
            renderer.Lengths          = new vec3(waterPlaneLength + 1, waterPlaneLength + 1, waterPlaneLength + 1);
            renderer.waterPlaneLength = waterPlaneLength;

            return(renderer);
        }