Ejemplo n.º 1
0
        public override void updateRenderState(Graphics.Material m, RenderState state)
        {
            if (myLightVisualizer == null)
            {
                myLightVisualizer = Renderer.visualizers["light"] as LightVisualizer;
            }

            //material properties
            PerPixelUniformData matData = new PerPixelUniformData
            {
                ambientReflectivity  = m.ambient,
                diffuseReflectivity  = m.diffuse,
                specularReflectivity = m.spec,
                emmission            = m.emission,
                shininess            = m.shininess,
                alpha = m.alpha
            };

            //setup diffuse map, it should exists
            ArrayTexture tex = (m.findAttribute("texArray") as TextureAttribute).value() as ArrayTexture;

            state.setTexture((int)tex.id(), 0, TextureTarget.Texture2DArray);
            state.setUniform(new UniformData(20, Uniform.UniformType.Int, 0));

            //setup the lights that influence this terrain
            byte[] data = matData.toBytes();
            state.setUniformUpload(myMaterialUniform, data);
            state.setUniformBuffer(myMaterialUniform.id, 3);
            state.setUniformBuffer(myLightVisualizer.myLightUniforBuffer.id, 1);
        }
Ejemplo n.º 2
0
        public override PipelineState createPipeline(Graphics.Material m)
        {
            PipelineState state = new PipelineState();

            state.culling.enabled    = true;
            state.blending.enabled   = false;
            state.depthWrite.enabled = true;

            state.shaderState.shaderProgram = myShader;
            state.id = 1;             //solid effect
            return(state);
        }
        public override void updateRenderState(Graphics.Material m, RenderState state)
        {
            if (myLightVisualizer == null)
            {
                myLightVisualizer = Renderer.visualizers["light"] as LightVisualizer;
            }

            //setup diffuse map, it should exists
            ArrayTexture tex = (m.findAttribute("texArray") as TextureAttribute).value() as ArrayTexture;

            state.setTexture((int)tex.id(), 0, TextureTarget.Texture2DArray);
            state.setUniform(new UniformData(20, Uniform.UniformType.Int, 0));

            //setup the lights that influence this terrain
            state.setUniformBuffer(myLightVisualizer.myLightUniforBuffer.id, 1);
        }