This project is read-only.
With Rendering.NET every IGraphic object can be affected by a set of effects and Rendering.NET combines all the effects that are setted in the render before the graphic is visualized.

The Render.Draw method receives an IGraphic (or IModel) and a collection of effects as parameters. In the following example, Transforming, Lighting and Texturing are effects that affect the graphic being rendered.
IModel cube, teapot;
public override void Draw(System.Rendering.Forms.IControlRenderDevice render)
{
    render.BeginScene();

    render.Draw(() =>
    {
        render.Draw(cube,
	    Transforming.Rotate(Environment.TickCount / 1000f, Axis.Y),
	    Transforming.Translate(new System.Maths.Vector3(2, 0, 0)));
	render.Draw(teapot,
	    Transforming.Rotate(Environment.TickCount / 1000f, Axis.X),
	    Transforming.Translate(new System.Maths.Vector3(-2, 0, 0)));
    },
    Material.White.Plastic.Shinness.Shinness.Shinness.Glossy,
    Texturing.SetDiffuse(texture),
    Lighting.AmbientLight(new Vector4(0.2f, 0.2f, 0.2f, 1)),
    Lighting.PointLight(new System.Maths.Vector3(1, 4, 4), Vectors.White),
    Viewing.LookAtRH(new Vector3(GMath.sin((float)Environment.TickCount / 1000.0f), 0, 5), new Vector3(0, 0, 0), new Vector3(0, 1, 0)),
    Projecting.PerspectiveFovRH(GMath.PiOver4, render.ScreenHeight / (float)render.ScreenWidth, 1, 1000),
    Buffering.Clear(new Vector4(0.4f, 0.4f, 0.5f, 1)),
    Buffering.ClearDepth());

    render.EndScene();
}

Last edited Oct 22, 2012 at 9:52 PM by jrojasledesma, version 3

Comments

No comments yet.