예제 #1
0
파일: game.cs 프로젝트: Wootsz/Rasterizer
    bool holdingTab;                        // speaks for itself i think. used for the light on/off-ness

	// initialize
	public void Init()
	{
        // make the meshes list and scenegraph and camera
        sceneGraph = new SceneGraph();
        meshes = new List<Mesh>();
        camera = new Camera();
        // loading the lights
        light1 = new Light(new Vector4(100.0f, 11.0f, 12.0f, 1.0f), Vector4.Zero, Vector4.Zero, Vector3.Zero);
        light2 = new Light(new Vector4(-11.0f, 11.0f, 12.0f, 1.0f), Vector4.Zero, Vector4.Zero, Vector3.Zero);
        light3 = new Light(new Vector4(-20.0f, -30.0f, 2.0f, 1.0f), Vector4.Zero, Vector4.Zero, Vector3.Zero);
        light4 = new Light(new Vector4(0.0f, 1.0f, 2.0f, 1.0f), Vector4.Zero, Vector4.Zero, Vector3.Zero);
		// load teapot and floor
		mesh = new Mesh( "../../assets/teapot.obj" );
		floor = new Mesh( "../../assets/floor.obj" );
        // add the meshes to the hierarchy and the meshes list
        sceneGraph.AddParent(floor);
        sceneGraph.AddChild(floor, mesh);
        meshes.Add(mesh);
        meshes.Add(floor);
		// initialize stopwatch
		timer = new Stopwatch();
		timer.Reset();
		timer.Start();
		// create shaders
		shader = new Shader( "../../shaders/vs.glsl", "../../shaders/fs.glsl" );
		postproc = new Shader( "../../shaders/vs_post.glsl", "../../shaders/fs_post.glsl" );
		// load a texture
		wood = new Texture( "../../assets/wood.jpg" );
		// create the render target
		target = new RenderTarget( screen.width, screen.height );
		quad = new ScreenQuad();
	}
예제 #2
0
 public Scene()
 {
     blendQuad = new ScreenQuad();
 }
예제 #3
0
 public virtual void DrawPost(ScreenQuad q, RenderTarget t)
 {
     q.Render(postproc, t.GetTextureID());
 }