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(); }
protected override void LoadScene() { //load textures List <String> a = new List <string>(); a.Add("ft.png"); a.Add("bk.png"); a.Add("up.png"); a.Add("dn.png"); a.Add("rt.png"); a.Add("lf.png"); skyboxtex = new Texture("../../assets/sky/darkskies_", a); woodtex = new Texture("../../assets/wood.png"); // create shaders shader = new Shader("../../shaders/vs.glsl", "../../shaders/fs.glsl"); shader_light = new Shader("../../shaders/vs.glsl", "../../shaders/fs_light.glsl"); postproc = new Shader("../../shaders/vs_post.glsl", "../../shaders/fs_post.glsl"); shader_cloud = new Shader("../../shaders/vs_cloud.glsl", "../../shaders/fs_cloud.glsl"); shader_fur = new Shader("../../shaders/vs_fur.glsl", "../../shaders/fs_fur.glsl"); furtex = new Texture("../../assets/fur2.png"); //Load skybox skyboxmesh = new Mesh("../../assets/cube1.obj"); // load entities pinguin = new EntitySkyReflect(new Mesh("../../assets/pin.obj"), shader, woodtex, skyboxtex); pinguin.scale = new Vector3(0.25f, 0.25f, 0.25f); floor = new EntityFur(new Mesh("../../assets/floor.obj"), shader_fur, furtex); floor.scale = new Vector3(5, 5, 5); floor.Move(new Vector3(0, 0, -10f)); //Add them to scenegraph scenegraph = new SceneGraph(); scenegraph.AddRootEntity(floor); scenegraph.AddEntity(pinguin, floor); //Load lightning lights = new List <EntityLight>(); lights.Add(new EntityLight(new Mesh("../../assets/sphere.obj"), shader_light, null, new Vector3(2000, 2000, 2000))); lights[0].SetPostition(new Vector3(0, 10, 3)); lights.Add(new EntityLight(new Mesh("../../assets/sphere.obj"), shader_light, null, new Vector3(250, 0, 0))); lights[1].scale = new Vector3(0.5f, 0.5f, 0.5f); lights[1].SetPostition(new Vector3(3.5f, 0, 0.6f)); ambient = new Vector3(0.0f, 0.0f, 0.8f); //Add the lightning to the scenegraph scenegraph.AddEntity(lights[0], floor); scenegraph.AddEntity(lights[1], pinguin); }
protected override void LoadScene() { //load textures datboitex = new Texture("../../assets/dat_boi.png"); // create shaders shader = new Shader("../../shaders/vs.glsl", "../../shaders/fs.glsl"); shader_light = new Shader("../../shaders/vs.glsl", "../../shaders/fs_light.glsl"); shader_sky = new Shader("../../shaders/vs_sky.glsl", "../../shaders/fs_sky.glsl"); postproc = new Shader("../../shaders/vs_post.glsl", "../../shaders/fs_post.glsl"); shader_fur = new Shader("../../shaders/vs_fur.glsl", "../../shaders/fs_fur.glsl"); // load entities datboi = new EntityLight(new Mesh("../../assets/datboi2.obj"), shader, datboitex, new Vector3(1, 1, 1)); //Add them to scenegraph scenegraph = new SceneGraph(); scenegraph.AddRootEntity(datboi); lights = new List <EntityLight>(); lights.Add(new EntityLight(new Mesh("../../assets/sphere.obj"), shader_light, null, new Vector3(200, 0, 0))); lights[0].SetPostition(new Vector3(5, 1, 5)); lights.Add(new EntityLight(new Mesh("../../assets/sphere.obj"), shader_light, null, new Vector3(0, 250, 0))); lights[1].SetPostition(new Vector3(-5, 1, 5)); lights.Add(new EntityLight(new Mesh("../../assets/sphere.obj"), shader_light, null, new Vector3(0, 0, 200))); lights[2].SetPostition(new Vector3(5, 1, -5)); lights.Add(new EntityLight(new Mesh("../../assets/sphere.obj"), shader_light, null, new Vector3(100, 100, 100))); lights[3].SetPostition(new Vector3(-5, 1, -5)); for (int i = 0; i < lights.Count; i++) { scenegraph.AddRootEntity(lights[i]); } }
protected override void LoadScene() { //load textures List <String> a = new List <string>(); a.Add("ft.png"); a.Add("bk.png"); a.Add("up.png"); a.Add("dn.png"); a.Add("rt.png"); a.Add("lf.png"); skyboxtex = new Texture("../../assets/sky/darkskies_", a); woodtex = new Texture("../../assets/wood.jpg"); furtex = new Texture("../../assets/furt.png"); martex = new Texture("../../assets/Mario Kart/Mario/Tex/mariotex.png"); peatex = new Texture("../../assets/Mario Kart/Peach/Tex/peachtex.png"); yostex = new Texture("../../assets/Mario Kart/Yoshi/Tex/yoshitex.png"); mkartex = new Texture("../../assets/Mario Kart/Mario/Tex/karttex.png"); pkartex = new Texture("../../assets/Mario Kart/Peach/Tex/karttex.png"); ykartex = new Texture("../../assets/Mario Kart/Yoshi/Tex/karttex.png"); wheeltex = new Texture("../../assets/Mario Kart/Mario/Tex/wheeltex.png"); maptex1 = new Texture("../../assets/Mario Kart/Maps/KPBeach/236F857A_c.png"); nultex = new Texture("../../assets/null.png"); startex = new Texture("../../assets/Mario Kart/Star/Mario's Star Image.png"); // create shaders shader = new Shader("../../shaders/vs.glsl", "../../shaders/fs.glsl"); shader_sky = new Shader("../../shaders/vs_sky.glsl", "../../shaders/fs_sky.glsl"); postproc = new Shader("../../shaders/vs_post.glsl", "../../shaders/fs_post.glsl"); shader_light = new Shader("../../shaders/vs.glsl", "../../shaders/fs_light.glsl"); shader_fur = new Shader("../../shaders/vs_fur.glsl", "../../shaders/fs_fur.glsl"); // load entities kart1 = new EntitySkyReflect(new Mesh("../../assets/Mario Kart/Mario/Kart.obj"), shader, mkartex, skyboxtex); mario = new EntitySkyReflect(new Mesh("../../assets/Mario Kart/Mario/Mario.obj"), shader, martex, skyboxtex); wheel1 = new EntitySkyReflect(new Mesh("../../assets/Mario Kart/Mario/Wheels.obj"), shader, wheeltex, skyboxtex); kart2 = new EntitySkyReflect(new Mesh("../../assets/Mario Kart/Mario/Kart.obj"), shader, pkartex, skyboxtex); peach = new EntitySkyReflect(new Mesh("../../assets/Mario Kart/Peach/Peach.obj"), shader, peatex, skyboxtex); wheel2 = new EntitySkyReflect(new Mesh("../../assets/Mario Kart/Mario/Wheels.obj"), shader, wheeltex, skyboxtex); kart3 = new EntitySkyReflect(new Mesh("../../assets/Mario Kart/Mario/Kart.obj"), shader, ykartex, skyboxtex); yoshi = new EntitySkyReflect(new Mesh("../../assets/Mario Kart/Yoshi/Yoshi.obj"), shader, yostex, skyboxtex); wheel3 = new EntitySkyReflect(new Mesh("../../assets/Mario Kart/Mario/Wheels.obj"), shader, wheeltex, skyboxtex); floor2 = new EntitySkyReflect(new Mesh("../../assets/floor.obj"), shader, nultex, skyboxtex); floor = new EntityFur(new Mesh("../../assets/floor.obj"), shader_fur, furtex); map = new EntitySkyReflect(new Mesh("../../assets/Mario Kart/Maps/KPBeach/KoopaTroopaBeach.obj"), shader, maptex1, skyboxtex); star = new EntitySkyReflect(new Mesh("../../assets/Mario Kart/Star/Star.obj"), shader, startex, skyboxtex); //Move and scale entities map.Move(new Vector3(0, -2, -1)); floor.Move(new Vector3(0, 0, -4)); kart1.Rotate(new Vector3(1.57f, 0.0f, 1.57f)); kart1.Move(new Vector3(0, -2, -3)); kart2.Rotate(new Vector3(1.57f, 0.0f, 3.14f)); kart2.Move(new Vector3(3, -2, 0)); kart3.Rotate(new Vector3(1.57f, 0.0f, 4.71f)); kart3.Move(new Vector3(0, -2, 3)); star.Scale(new Vector3(.5f, .5f, .5f)); star.Move(new Vector3(0, -1, 0)); //Add them to scenegraph scenegraph = new SceneGraph(); scenegraph.AddRootEntity(map); scenegraph.AddRootEntity(floor); scenegraph.AddEntity(floor2, floor); scenegraph.AddEntity(kart1, floor2); scenegraph.AddEntity(mario, kart1); scenegraph.AddEntity(wheel1, kart1); scenegraph.AddEntity(kart2, floor2); scenegraph.AddEntity(peach, kart2); scenegraph.AddEntity(wheel2, kart2); scenegraph.AddEntity(kart3, floor2); scenegraph.AddEntity(yoshi, kart3); scenegraph.AddEntity(wheel3, kart3); scenegraph.AddEntity(star, floor2); //Load skybox skyboxmesh = new Mesh("../../assets/cube1.obj"); lights = new List <EntityLight>(); lights.Add(new EntityLight(new Mesh("../../assets/sphere.obj"), shader_light, null, new Vector3(20, 0, 0))); lights[0].SetPostition(new Vector3(5, 5, -3)); lights.Add(new EntityLight(new Mesh("../../assets/sphere.obj"), shader_light, null, new Vector3(0, 0, 20))); lights[1].SetPostition(new Vector3(5, 1, -5)); lights.Add(new EntityLight(null, null, null, new Vector3(20, 20, 20))); lights[2].SetPostition(new Vector3(0, 2, -4)); for (int i = 0; i < lights.Count - 1; i++) { scenegraph.AddRootEntity(lights[i]); } }
protected override void LoadScene() { //load textures List <String> a = new List <string>(); a.Add("ft.png"); a.Add("bk.png"); a.Add("up.png"); a.Add("dn.png"); a.Add("rt.png"); a.Add("lf.png"); skyboxtex = new Texture("../../assets/sky/darkskies_", a); woodtex = new Texture("../../assets/wood.png"); furtex = new Texture("../../assets/fur2.png"); // create shaders shader = new Shader("../../shaders/vs.glsl", "../../shaders/fs.glsl"); shader_light = new Shader("../../shaders/vs.glsl", "../../shaders/fs_light.glsl"); shader_sky = new Shader("../../shaders/vs_sky.glsl", "../../shaders/fs_sky.glsl"); postproc = new Shader("../../shaders/vs_post.glsl", "../../shaders/fs_post.glsl"); shader_fur = new Shader("../../shaders/vs_fur.glsl", "../../shaders/fs_fur.glsl"); // load entities pot = new EntitySkyReflect(new Mesh("../../assets/teapot.obj", 0.3f, 0.3f, 0.3f), shader, woodtex, skyboxtex); floor = new EntityFur(new Mesh("../../assets/floor.obj"), shader_fur, furtex); floor2 = new EntitySkyReflect(new Mesh("../../assets/floor.obj"), shader, woodtex, skyboxtex); penguin = new EntitySkyReflect(new Mesh("../../assets/pin.obj"), shader, woodtex, skyboxtex); penguin2 = new EntitySkyReflect(new Mesh("../../assets/pin.obj"), shader, woodtex, skyboxtex); //Move and scale entities penguin.Move(new Vector3(20.0f, 1.0f, 1.0f)); penguin2.Move(new Vector3(5.0f, 1.0f, 5.0f)); floor2.Scale(new Vector3(10.0f, 10.0f, 10.0f)); floor2.Move(new Vector3(0, 0.0f, 0)); //Add them to scenegraph scenegraph = new SceneGraph(); scenegraph.AddRootEntity(floor); scenegraph.AddEntity(pot, floor); scenegraph.AddEntity(penguin, pot); scenegraph.AddRootEntity(penguin2); scenegraph.AddRootEntity(floor2); //Load skybox skyboxmesh = new Mesh("../../assets/cube1.obj"); lights = new List <EntityLight>(); lights.Add(new EntityLight(new Mesh("../../assets/sphere.obj"), shader_light, null, new Vector3(200, 0, 0))); lights[0].SetPostition(new Vector3(5, 1, 5)); lights.Add(new EntityLight(new Mesh("../../assets/sphere.obj"), shader_light, null, new Vector3(0, 250, 0))); lights[1].SetPostition(new Vector3(-5, 1, 5)); lights.Add(new EntityLight(new Mesh("../../assets/sphere.obj"), shader_light, null, new Vector3(0, 0, 200))); lights[2].SetPostition(new Vector3(5, 1, -5)); lights.Add(new EntityLight(new Mesh("../../assets/sphere.obj"), shader_light, null, new Vector3(100, 100, 100))); lights[3].SetPostition(new Vector3(-5, 1, -5)); for (int i = 0; i < lights.Count; i++) { scenegraph.AddRootEntity(lights[i]); } }