Exemplo n.º 1
0
        public VoxelEffect(GraphicsDevice graphicsDevice)
            : base(graphicsDevice, EffectHelper.LoadShaderBytes("voxelShader"))
        {
            BatchTechnique                = Techniques["Batch"];
            InstancingTechnique           = Techniques["Instancing"];
            MeshTechnique                 = Techniques["Mesh"];
            InstancingDepthTechnique      = Techniques["InstancingDepth"];
            InstancingWithShadowTechnique = Techniques["InstancingWithShadow"];
            InstancingShadowMapTechnique  = Techniques["InstancingShadowMap"];

            _paletteParam = Parameters["Palette"];

            _positionParam   = Parameters["ChunkPosition"];
            _viewParam       = Parameters["View"];
            _projectionParam = Parameters["Projection"];

            _dirLightMatrixParam = Parameters["DirectionalLightMatrix"];
            _lightDirParam       = Parameters["LightDirection"];
            _diffuseLightParam   = Parameters["DiffuseLight"];
            _ambientLightParam   = Parameters["AmbientLight"];

            _shadowMapParam = Parameters["ShadowMap"];

            Parameters["Normals"].SetValue(CubeBuilder.GetNormals());
        }