public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; graphics.GraphicsProfile = GraphicsProfile.HiDef; graphics.PreferredBackBufferWidth = 1920; graphics.PreferredBackBufferHeight = 1080; IsMouseVisible = true; kbm = new KeyboardStateManager(this); camera = new Base3DCamera(this, .5f, 20000); camera.Position = new Vector3(0, 10, 64); Components.Add(camera); Services.AddService(typeof(Base3DCamera), camera); string[] clouds = { "Textures/clouds00", "Textures/clouds0", "Textures/clouds1", "Textures/clouds2" }; skySphere = new SkySphere(this, "Models/sphere", "Textures/cubeMap", clouds); Components.Add(skySphere); skyBox = new BaseSkyBox(this, "Textures/cubeMap"); //Components.Add(skyBox); }
public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; graphics.GraphicsProfile = GraphicsProfile.HiDef; graphics.PreferredBackBufferWidth = 1920; graphics.PreferredBackBufferHeight = 1080; IsMouseVisible = true; kbm = new KeyboardStateManager(this); camera = new Base3DCamera(this, .5f, 20000); camera.Position = new Vector3(0, 10, 64); Components.Add(camera); Services.AddService(typeof(Base3DCamera), camera); string envMap = "Textures/SkyBox/HMcubemap"; skyBox = new BaseSkyBox(this, envMap); Components.Add(skyBox); water = new RCWater(this); water.myEnvironmentAsset = envMap; water.BumpAsset = "Textures/WaterBump"; Components.Add(water); }
public override void Update(GameTime gameTime) { KeyboardStateManager.UpdateKeyboardState(); var delta = (float)gameTime.ElapsedGameTime.TotalSeconds; if (KeyboardStateManager.IsCurPress(Keys.A)) { Move(Direction.Left, delta); } if (KeyboardStateManager.IsCurPress(Keys.D)) { Move(Direction.Right, delta); } if (KeyboardStateManager.IsNewPress(Keys.A)) { Move(Direction.Left, delta); } if (KeyboardStateManager.IsNewPress(Keys.D)) { Move(Direction.Right, delta); } if (KeyboardStateManager.IsCurPress(Keys.Space) && !GameObject.Airborne) { Jump(); } base.Update(gameTime); }
public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; graphics.GraphicsProfile = GraphicsProfile.HiDef; graphics.PreferredBackBufferWidth = 1920; graphics.PreferredBackBufferHeight = 1080; IsMouseVisible = true; msm = new MouseStateManager(this); kbm = new KeyboardStateManager(this); camera = new Base3DCamera(this, .5f, 20000); camera.Position = new Vector3(0, 0, 0); camera.ClearColor = Color.Ivory; Components.Add(camera); Services.AddService(typeof(Base3DCamera), camera); skyBox = new BaseSkyBox(this, "Textures/SkyBox/HMcubemap"); //Components.Add(skyBox); ground = new HatchedPlane(this); ground.Position = new Vector3(0, -1.5f, -10); ground.UVMultiplier = Vector2.One * .75f; Components.Add(ground); cube = new HatchedCube(this); cube.Position = new Vector3(-2, -1, -10); cube.UVMultiplier = Vector2.One * .1f; cube.LightPosition = LightPosition; Components.Add(cube); cube2 = new Base3DObjectCrossHatch(this, "Models/Cube"); cube2.Position = new Vector3(-2, 1, -10); cube2.Rotate(Vector3.Left + Vector3.Up, 45); cube2.ColorAsset = "Textures/h2mcpCube"; cube2.BumpAsset = "Textures/h2mcpCubeNormal"; cube2.LightPosition = LightPosition; Components.Add(cube2); bunny = new Base3DObjectCrossHatch(this, "Models/bunny"); bunny.Position = new Vector3(0, -1.5f, -10); bunny.LightPosition = LightPosition; Components.Add(bunny); earth = new Base3DObjectCrossHatch(this, "Models/sphere"); earth.Position = new Vector3(2, -1, -10); earth.ColorAsset = "Textures/Earth_Diffuse"; earth.BumpAsset = "Textures/Earth_NormalMap"; earth.LightPosition = LightPosition; Components.Add(earth); }
public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; graphics.GraphicsProfile = GraphicsProfile.HiDef; graphics.PreferredBackBufferWidth = 1920; graphics.PreferredBackBufferHeight = 1080; IsMouseVisible = true; msm = new MouseStateManager(this); kbm = new KeyboardStateManager(this); camera = new Base3DCamera(this, .5f, 20000); camera.Position = new Vector3(0, 0, 0); Components.Add(camera); Services.AddService(typeof(Base3DCamera), camera); skyBox = new BaseSkyBox(this, "Textures/SkyBox/HMcubemap"); Components.Add(skyBox); cube = new Base3DObject(this, "Models/cube"); cube.Name = "Cube"; cube.Position = new Vector3(-2, -1, -10); cube.ColorAsset = "Textures/h2mcpCube"; cube.BumpAsset = "Textures/h2mcpCubeNormal"; cube.LightPosition = LightPosition; cube.BoundingBox = new BoundingBox(-Vector3.One * .5f, Vector3.One * .5f); cube.BoundingSphere = new BoundingSphere(Vector3.Zero, .75f); Components.Add(cube); sceneObjects.Add(cube); bunny = new Base3DObject(this, "Models/bunny", "Shaders/RenderObjectNotTangentsOrTexCoords"); bunny.Name = "Bunny"; bunny.Position = new Vector3(0, -1.5f, -10); bunny.LightPosition = LightPosition; bunny.BoundingBox = new BoundingBox(new Vector3(-1, 0, -.6f), new Vector3(.7f, 1.65f, .7f)); bunny.BoundingSphere = new BoundingSphere(new Vector3(-.2f, .75f, 0), 1); Components.Add(bunny); sceneObjects.Add(bunny); earth = new Base3DObject(this, "Models/sphere"); earth.Name = "Globe"; earth.Position = new Vector3(2, -1, -10); earth.ColorAsset = "Textures/Earth_Diffuse"; earth.BumpAsset = "Textures/Earth_NormalMap"; earth.LightPosition = LightPosition; earth.BoundingBox = new BoundingBox(-Vector3.One, Vector3.One); earth.BoundingSphere = new BoundingSphere(Vector3.Zero, 1); Components.Add(earth); sceneObjects.Add(earth); }
public Game1() { graphics = new GraphicsDeviceManager(this); graphics.PreferredBackBufferHeight = 720; graphics.PreferredBackBufferWidth = 1208; graphics.ApplyChanges(); Content.RootDirectory = "Content"; msm = new MouseStateManager(this); kbm = new KeyboardStateManager(this); screenCanvas = new ScreenCanvasBase(this, new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight)); Components.Add(screenCanvas); //scrollRect = new ScrollRectangleBase(this, new Rectangle(0, 0, 500, 256)); //imgTest = new ImageBase(this, new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight), "Textures/map"); //scrollRect.AddChild(imgTest); //screenCanvas.AddChild(scrollRect); //scrollRect.Transform.LocalPosition2D = new Vector2(128, 128); //vScrollBar = new ScrollBarBase(this, new Rectangle(0, 0, 16, scrollRect.RenderSize.Height)); //vScrollBar.ScrollBarType = RandomchaosMGUIBase.ScrollBarTypesEnum.Vertical; //vScrollBar.Transform.LocalPosition2D = new Vector2(630, 128); //vScrollBar.ScrollRect = scrollRect; //vScrollBar.BackgroundColor = new Color(100, 100, 100, 255); //screenCanvas.AddChild(vScrollBar); //hScrollBar = new ScrollBarBase(this, new Rectangle(0, 0, scrollRect.RenderSize.Width, 16)); //hScrollBar.ScrollBarType = RandomchaosMGUIBase.ScrollBarTypesEnum.Horizontal; //hScrollBar.Transform.LocalPosition2D = new Vector2(128, 386); //hScrollBar.ScrollRect = scrollRect; //hScrollBar.BackgroundColor = new Color(100, 100, 100, 255); //screenCanvas.AddChild(hScrollBar); btnShowWindow = new ButtonBase(this, new Rectangle(graphics.PreferredBackBufferWidth - 108, graphics.PreferredBackBufferHeight - 40, 100, 32), "Show Window", "Fonts/Airel12"); btnShowWindow.TextColor = Color.Black; btnShowWindow.ShadowOffset = Vector2.Zero; btnShowWindow.OnMouseClickEvent += ShowWindow; screenCanvas.AddChild(btnShowWindow); btnShowFileBrowser = new ButtonBase(this, new Rectangle(graphics.PreferredBackBufferWidth - 266, graphics.PreferredBackBufferHeight - 40, 150, 32), "Show File Browser", "Fonts/Airel12"); btnShowFileBrowser.TextColor = Color.Black; btnShowFileBrowser.ShadowOffset = Vector2.Zero; btnShowFileBrowser.OnMouseClickEvent += ShowWindow; screenCanvas.AddChild(btnShowFileBrowser); // Add this last of all. mr = new MouseRenderer(this, "Textures/Icons/Mouse"); Components.Add(mr); }
public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; kbm = new KeyboardStateManager(this); sprite1 = new SpriteData(this, new Vector2(74, 74), Vector2.One * 64, Color.Red); Components.Add(sprite1); sprite2 = new SpriteData(this, new Vector2(graphics.PreferredBackBufferWidth - 74, graphics.PreferredBackBufferHeight - 74), Vector2.One * 64, Color.Blue); Components.Add(sprite2); sprite3 = new SpriteData(this, new Vector2(graphics.PreferredBackBufferWidth / 2, graphics.PreferredBackBufferHeight / 2), Vector2.One * 128, Color.Gold); Components.Add(sprite3); }
public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; kbm = new KeyboardStateManager(this); camera = new Base3DCamera(this, .5f, 2000); camera.Position = new Vector3(0, 0, 10); Components.Add(camera); Services.AddService(typeof(Base3DCamera), camera); Base3DObject tree = new Base3DObject(this, "Models/trees_pine", "Shaders/RenderObjectNoTangents"); tree.ColorAsset = "Models/palette"; tree.Rotate(Vector3.Up, -90); tree.Position = new Vector3(0, -2, 0); tree.Scale = Vector3.One * .01f; Components.Add(tree); }
public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; graphics.GraphicsProfile = GraphicsProfile.HiDef; graphics.PreferredBackBufferWidth = 1920; graphics.PreferredBackBufferHeight = 1080; IsMouseVisible = true; kbm = new KeyboardStateManager(this); camera = new Base3DCamera(this, .5f, 20000); camera.Position = new Vector3(0, 0, 10); Components.Add(camera); Services.AddService(typeof(Base3DCamera), camera); Fire3D = new RCLayeredFire(this, 8); Fire3D.Scale = new Vector3(2, 6, 8); Fire3D.AnimationSpeed = .01f; Fire3D.FlameOffSet = .2f; Components.Add(Fire3D); Fire = new CPUOldSchoolFire(this, new Point(400, 240)); Components.Add(Fire); Fire2 = new GPUOldSchoolFire(this, new Point(400, 240)); Components.Add(Fire2); Fire3 = new GPUOldSchoolFireBox(this); Components.Add(Fire3); Fire3D.Enabled = false; Fire.Enabled = false; Fire2.Enabled = false; Fire3.Enabled = false; Fire3D.Enabled = true; }
public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; graphics.GraphicsProfile = GraphicsProfile.HiDef; graphics.PreferredBackBufferWidth = 1920; graphics.PreferredBackBufferHeight = 1080; IsMouseVisible = true; float dist = -25f; kbm = new KeyboardStateManager(this); camera = new Base3DCamera(this, .5f, 20000); camera.Position = new Vector3(0, 0, 0); Components.Add(camera); Services.AddService(typeof(Base3DCamera), camera); #region Light And Shade I light = new LightModel(this, Color.White); light.Position = new Vector3(7, 7, dist); Components.Add(light); ShowLightAndShader[0] = true; // Ambient Only skullAmbient = new LightAndShadeModel(this, "Models/skullocc", "Shaders/AmbientLight"); skullAmbient.Scale = Vector3.One * .5f; skullAmbient.AmbientColor = AmbientColor; skullAmbient.AmbientIntensity = AmbientIntensity; skullAmbient.Position = new Vector3(0, 5, dist); Components.Add(skullAmbient); sphereAmbient = new LightAndShadeModel(this, "Models/sphere", "Shaders/AmbientLight"); sphereAmbient.AmbientColor = AmbientColor; sphereAmbient.AmbientIntensity = AmbientIntensity; sphereAmbient.Position = new Vector3(5, 5, dist); Components.Add(sphereAmbient); teapotAmbient = new LightAndShadeModel(this, "Models/teapot", "Shaders/AmbientLight"); teapotAmbient.AmbientColor = AmbientColor; teapotAmbient.AmbientIntensity = AmbientIntensity; teapotAmbient.Position = new Vector3(-5, 5, dist); Components.Add(teapotAmbient); // Diffuse Only skullDiffuse = new LightAndShadeModel(this, "Models/skullocc", "Shaders/DiffuseLight"); skullDiffuse.Scale = Vector3.One * .5f; skullDiffuse.SetLightParams(0, light); skullDiffuse.Position = new Vector3(0, 0, dist); Components.Add(skullDiffuse); sphereDiffuse = new LightAndShadeModel(this, "Models/sphere", "Shaders/DiffuseLight"); sphereDiffuse.SetLightParams(0, light); sphereDiffuse.Position = new Vector3(5, 0, dist); Components.Add(sphereDiffuse); teapotDiffuse = new LightAndShadeModel(this, "Models/teapot", "Shaders/DiffuseLight"); teapotDiffuse.SetLightParams(0, light); teapotDiffuse.Position = new Vector3(-5, 0, dist); Components.Add(teapotDiffuse); // Ambitne & Diffuse skullAmbientDiffuse = new LightAndShadeModel(this, "Models/skullocc", "Shaders/AmbientDiffuseLight"); skullAmbientDiffuse.Scale = Vector3.One * .5f; skullAmbientDiffuse.SetLightParams(0, light); skullAmbientDiffuse.AmbientColor = AmbientColor; skullAmbientDiffuse.AmbientIntensity = AmbientIntensity; skullAmbientDiffuse.Position = new Vector3(0, -5, dist); Components.Add(skullAmbientDiffuse); sphereAmbientDiffuse = new LightAndShadeModel(this, "Models/sphere", "Shaders/AmbientDiffuseLight"); sphereAmbientDiffuse.AmbientColor = AmbientColor; sphereAmbientDiffuse.SetLightParams(0, light); sphereAmbientDiffuse.AmbientIntensity = AmbientIntensity; sphereAmbientDiffuse.Position = new Vector3(5, -5, dist); Components.Add(sphereAmbientDiffuse); teapotAmbientDiffuse = new LightAndShadeModel(this, "Models/teapot", "Shaders/AmbientDiffuseLight"); teapotAmbientDiffuse.AmbientColor = AmbientColor; teapotAmbientDiffuse.SetLightParams(0, light); teapotAmbientDiffuse.AmbientIntensity = AmbientIntensity; teapotAmbientDiffuse.Position = new Vector3(-5, -5, dist); Components.Add(teapotAmbientDiffuse); #endregion #region Light & Shade II ShowLightAndShader[1] = false; // Colored Lights lights = new List <LightModel>(); for (int l = 0; l < 3; l++) { LightModel lm = null; switch (l) { case 0: lm = new LightModel(this, Color.Gold, Color.White); lm.Position = new Vector3(7, 7, dist); break; case 1: lm = new LightModel(this, Color.Red, Color.White); lm.Position = new Vector3(-7, 7, dist); break; case 2: lm = new LightModel(this, Color.Blue, Color.White); lm.Position = new Vector3(-7, -7, dist); break; } lights.Add(lm); Components.Add(lm); } // Diffuse Colored skullAmbientDiffuseColorLight = new LightAndShadeModel(this, "Models/skullocc", "Shaders/AmbientDiffuseColoredLight"); skullAmbientDiffuseColorLight.Scale = Vector3.One * .5f; skullAmbientDiffuseColorLight.AmbientColor = AmbientColor; skullAmbientDiffuseColorLight.AmbientIntensity = AmbientIntensity; skullAmbientDiffuseColorLight.Position = new Vector3(0, 5, dist); skullAmbientDiffuseColorLight.SetLightParams(0, lights[0]); Components.Add(skullAmbientDiffuseColorLight); sphereAmbientDiffuseColorLight = new LightAndShadeModel(this, "Models/sphere", "Shaders/AmbientDiffuseColoredLight"); sphereAmbientDiffuseColorLight.AmbientColor = AmbientColor; sphereAmbientDiffuseColorLight.AmbientIntensity = AmbientIntensity; sphereAmbientDiffuseColorLight.Position = new Vector3(5, 5, dist); sphereAmbientDiffuseColorLight.SetLightParams(0, lights[0]); Components.Add(sphereAmbientDiffuseColorLight); teapotAmbientDiffuseColorLight = new LightAndShadeModel(this, "Models/teapot", "Shaders/AmbientDiffuseColoredLight"); teapotAmbientDiffuseColorLight.AmbientColor = AmbientColor; teapotAmbientDiffuseColorLight.AmbientIntensity = AmbientIntensity; teapotAmbientDiffuseColorLight.Position = new Vector3(-5, 5, dist); teapotAmbientDiffuseColorLight.SetLightParams(0, lights[0]); Components.Add(teapotAmbientDiffuseColorLight); // MultiLight skullAmbientDiffuseColorMultiLight = new LightAndShadeModel(this, "Models/skullocc", "Shaders/ADCMultiLight"); skullAmbientDiffuseColorMultiLight.MultiLight = true; skullAmbientDiffuseColorMultiLight.Scale = Vector3.One * .5f; skullAmbientDiffuseColorMultiLight.AmbientColor = AmbientColor; skullAmbientDiffuseColorMultiLight.AmbientIntensity = AmbientIntensity; skullAmbientDiffuseColorMultiLight.Position = new Vector3(0, 0, dist); Components.Add(skullAmbientDiffuseColorMultiLight); sphereAmbientDiffuseColorMultiLight = new LightAndShadeModel(this, "Models/sphere", "Shaders/ADCMultiLight"); sphereAmbientDiffuseColorMultiLight.MultiLight = true; sphereAmbientDiffuseColorMultiLight.AmbientColor = AmbientColor; sphereAmbientDiffuseColorMultiLight.AmbientIntensity = AmbientIntensity; sphereAmbientDiffuseColorMultiLight.Position = new Vector3(5, 0, dist); Components.Add(sphereAmbientDiffuseColorMultiLight); teapotAmbientDiffuseColorMultiLight = new LightAndShadeModel(this, "Models/teapot", "Shaders/ADCMultiLight"); teapotAmbientDiffuseColorMultiLight.MultiLight = true; teapotAmbientDiffuseColorMultiLight.AmbientColor = AmbientColor; teapotAmbientDiffuseColorMultiLight.AmbientIntensity = AmbientIntensity; teapotAmbientDiffuseColorMultiLight.Position = new Vector3(-5, 0, dist); Components.Add(teapotAmbientDiffuseColorMultiLight); // Light with specualr Blinn-Phong skullAmbientDiffuseColorBlinnPhongLight = new LightAndShadeModel(this, "Models/skullocc", "Shaders/BlinnPhong"); skullAmbientDiffuseColorBlinnPhongLight.MultiLight = false; skullAmbientDiffuseColorBlinnPhongLight.Scale = Vector3.One * .5f; skullAmbientDiffuseColorBlinnPhongLight.AmbientColor = AmbientColor; skullAmbientDiffuseColorBlinnPhongLight.AmbientIntensity = AmbientIntensity; skullAmbientDiffuseColorBlinnPhongLight.Position = new Vector3(0, -5, dist); Components.Add(skullAmbientDiffuseColorBlinnPhongLight); sphereAmbientDiffuseColorBlinnPhongLight = new LightAndShadeModel(this, "Models/sphere", "Shaders/BlinnPhong"); sphereAmbientDiffuseColorBlinnPhongLight.MultiLight = false; sphereAmbientDiffuseColorBlinnPhongLight.AmbientColor = AmbientColor; sphereAmbientDiffuseColorBlinnPhongLight.AmbientIntensity = AmbientIntensity; sphereAmbientDiffuseColorBlinnPhongLight.Position = new Vector3(5, -5, dist); Components.Add(sphereAmbientDiffuseColorBlinnPhongLight); teapotAmbientDiffuseColorBlinnPhongLight = new LightAndShadeModel(this, "Models/teapot", "Shaders/BlinnPhong"); teapotAmbientDiffuseColorBlinnPhongLight.MultiLight = false; teapotAmbientDiffuseColorBlinnPhongLight.AmbientColor = AmbientColor; teapotAmbientDiffuseColorBlinnPhongLight.AmbientIntensity = AmbientIntensity; teapotAmbientDiffuseColorBlinnPhongLight.Position = new Vector3(-5, -5, dist); Components.Add(teapotAmbientDiffuseColorBlinnPhongLight); skullAmbientDiffuseColorBlinnPhongLight.SetLightParams(0, lights[0]); sphereAmbientDiffuseColorBlinnPhongLight.SetLightParams(0, lights[0]); teapotAmbientDiffuseColorBlinnPhongLight.SetLightParams(0, lights[0]); for (int l = 0; l < lights.Count; l++) { skullAmbientDiffuseColorMultiLight.SetLightParams(l, lights[l]); sphereAmbientDiffuseColorMultiLight.SetLightParams(l, lights[l]); teapotAmbientDiffuseColorMultiLight.SetLightParams(l, lights[l]); } #endregion #region Light & Shade III lightIII = new LightModel(this, Color.Gold); lightIII.Position = new Vector3(10, 0, 0); Components.Add(lightIII); ShowLightAndShader[2] = false; colorPlanet = new LightAndShadeModel(this, "Models/sphere", "Shaders/ColorMap", "Textures/Earth_Diffuse"); colorPlanet.Position = new Vector3(-2, 0, -5); colorPlanet.SetLightParams(0, lightIII); Components.Add(colorPlanet); colorGlowPlanet = new LightAndShadeModel(this, "Models/sphere", "Shaders/ColorGlowMap", "Textures/Earth_Diffuse", "Textures/Earth_Night"); colorGlowPlanet.Position = new Vector3(0, 0, -7); colorGlowPlanet.SetLightParams(0, lightIII); Components.Add(colorGlowPlanet); colorGlowBumpPlanet = new LightAndShadeModel(this, "Models/sphere", "Shaders/ColorGlowBumpMap", "Textures/Earth_Diffuse", "Textures/Earth_Night", "Textures/Earth_NormalMap"); colorGlowBumpPlanet.Position = new Vector3(2, 0, -9); colorGlowBumpPlanet.SetLightParams(0, lightIII); Components.Add(colorGlowBumpPlanet); colorGlowBumpReflectPlanet = new LightAndShadeModel(this, "Models/sphere", "Shaders/ColorGlowBumpReflect", "Textures/Earth_Diffuse", "Textures/Earth_Night", "Textures/Earth_NormalMap", "Textures/Earth_ReflectionMask"); colorGlowBumpReflectPlanet.Position = new Vector3(4, 0, -11); colorGlowBumpReflectPlanet.SetLightParams(0, lightIII); Components.Add(colorGlowBumpReflectPlanet); #endregion #region Light & Shade V ShowLightAndShader[3] = false; skyBox = new BaseSkyBox(this, "Textures/cubemap"); Components.Add(skyBox); skullGlass = new LightAndShadeModel(this, "Models/skullocc", "Shaders/glass1", "Textures/cubemap"); skullGlass.Scale = Vector3.One * .5f; skullGlass.Tint = Color.White; skullGlass.Position = new Vector3(0, 5, dist); Components.Add(skullGlass); sphereGlass = new LightAndShadeModel(this, "Models/sphere", "shaders/glass1", "Textures/cubemap"); sphereGlass.Tint = Color.White; sphereGlass.Position = new Vector3(-5, 5, dist); Components.Add(sphereGlass); teapotGlass = new LightAndShadeModel(this, "Models/teapot", "shaders/glass1", "Textures/cubemap"); teapotGlass.Position = new Vector3(5, 5, dist); teapotGlass.Tint = Color.White; Components.Add(teapotGlass); skullGlassFrez = new LightAndShadeModel(this, "Models/skullocc", "shaders/glass2", "Textures/cubemap", "Textures/Fresnel"); skullGlassFrez.Scale = Vector3.One * .5f; skullGlassFrez.Tint = Color.White; skullGlassFrez.Position = new Vector3(0, 0, dist); Components.Add(skullGlassFrez); sphereGlassFrez = new LightAndShadeModel(this, "Models/sphere", "shaders/glass2", "Textures/cubemap", "Textures/Fresnel"); sphereGlassFrez.Position = new Vector3(-5, 0, dist); sphereGlassFrez.Tint = Color.White; Components.Add(sphereGlassFrez); teapotGlassFrez = new LightAndShadeModel(this, "Models/teapot", "shaders/glass2", "Textures/cubemap", "Textures/Fresnel"); teapotGlassFrez.Position = new Vector3(5, 0, dist); teapotGlassFrez.Tint = Color.White; Components.Add(teapotGlassFrez); skullGlassFrezFree = new LightAndShadeModel(this, "Models/skullocc", "shaders/glass3", "Textures/cubemap"); skullGlassFrezFree.Scale = Vector3.One * .5f; skullGlassFrezFree.Tint = Color.White; skullGlassFrezFree.Position = new Vector3(0, -5, dist); Components.Add(skullGlassFrezFree); sphereGlassFrezFree = new LightAndShadeModel(this, "Models/sphere", "shaders/glass3", "Textures/cubemap"); sphereGlassFrezFree.Position = new Vector3(-5, -5, dist); sphereGlassFrezFree.Tint = Color.White; Components.Add(sphereGlassFrezFree); teapotGlassFrezFree = new LightAndShadeModel(this, "Models/teapot", "shaders/glass3", "Textures/cubemap"); teapotGlassFrezFree.Position = new Vector3(5, -5, dist); teapotGlassFrezFree.Tint = Color.White; Components.Add(teapotGlassFrezFree); #endregion #region Light & Shade VI ShowLightAndShader[4] = false; skullRefract = new LightAndShadeModel(this, "Models/skullocc", "Shaders/Refraction", "Textures/cubemap"); skullRefract.Scale = Vector3.One * .5f; skullRefract.Position = new Vector3(0, 5, dist); Components.Add(skullRefract); sphereRefract = new LightAndShadeModel(this, "Models/sphere", "Shaders/Refraction", "Textures/cubemap"); sphereRefract.Position = new Vector3(-5, 5, dist); Components.Add(sphereRefract); teapotRefract = new LightAndShadeModel(this, "Models/teapot", "Shaders/Refraction", "Textures/cubemap"); teapotRefract.Position = new Vector3(5, 5, dist); Components.Add(teapotRefract); skullReflect = new LightAndShadeModel(this, "Models/skullocc", "Shaders/Reflection", "Textures/cubemap"); skullReflect.Scale = Vector3.One * .5f; skullReflect.Position = new Vector3(0, 0, dist); Components.Add(skullReflect); sphereReflect = new LightAndShadeModel(this, "Models/sphere", "Shaders/Reflection", "Textures/cubemap"); sphereReflect.Position = new Vector3(-5, 0, dist); Components.Add(sphereReflect); teapotReflect = new LightAndShadeModel(this, "Models/teapot", "Shaders/Reflection", "Textures/cubemap"); teapotReflect.Position = new Vector3(5, 0, dist); Components.Add(teapotReflect); skullReflectRefract = new LightAndShadeModel(this, "Models/skullocc", "Shaders/ReflectionAndRefraction", "Textures/cubemap"); skullReflectRefract.Scale = Vector3.One * .5f; skullReflectRefract.Position = new Vector3(0, -5, dist); Components.Add(skullReflectRefract); sphereReflectRefract = new LightAndShadeModel(this, "Models/sphere", "Shaders/ReflectionAndRefraction", "Textures/cubemap"); sphereReflectRefract.Position = new Vector3(-5, -5, dist); Components.Add(sphereReflectRefract); teapotReflectRefract = new LightAndShadeModel(this, "Models/teapot", "Shaders/ReflectionAndRefraction", "Textures/cubemap"); teapotReflectRefract.Position = new Vector3(5, -5, dist); Components.Add(teapotReflectRefract); skullRC3DGlass = new LightAndShadeModel(this, "Models/skullocc", "Shaders/RC3DGlass", "Textures/cubemap"); skullRC3DGlass.Scale = Vector3.One * .5f; skullRC3DGlass.Position = new Vector3(0, -10, dist); Components.Add(skullRC3DGlass); sphereRC3DGlass = new LightAndShadeModel(this, "Models/sphere", "Shaders/RC3DGlass", "Textures/cubemap"); sphereRC3DGlass.Position = new Vector3(-5, -10, dist); Components.Add(sphereRC3DGlass); teapotRC3DGlass = new LightAndShadeModel(this, "Models/teapot", "Shaders/RC3DGlass", "Textures/cubemap"); teapotRC3DGlass.Position = new Vector3(5, -10, dist); Components.Add(teapotRC3DGlass); #endregion #region Light & Shade VIII ShowLightAndShader[5] = false; lightVIII = new LightModel(this, Color.White); lightVIII.Position = Vector3.Right * 10; Components.Add(lightVIII); earth = new LightAndShadeModel(this, "Models/sphere", "Shaders/PlanetShader", "Textures/Earth_Diffuse", "Textures/Earth_Night", "Textures/Earth_NormalMap", "Textures/Earth_ReflectionMask", "Textures/Earth_Cloud", "Textures/WaterRipples", "Textures/Earth_Atmos"); earth.Position = new Vector3(0, 0, -50); earth.SetLightParams(0, lightVIII); earth.Scale = Vector3.One * 10f; Components.Add(earth); #endregion }
public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; graphics.GraphicsProfile = GraphicsProfile.HiDef; graphics.PreferredBackBufferWidth = 1920; graphics.PreferredBackBufferHeight = 1080; IsMouseVisible = true; kbm = new KeyboardStateManager(this); lightingManager = new DeferredLightingManager(this); camera = new DeferredLightingCamera(this, .5f, 20000); camera.Position = new Vector3(0, 1, 0); camera.ClearColor = Color.Black; Components.Add(camera); Services.AddService(typeof(Base3DCamera), camera); BaseSkyBox skyBox = new BaseSkyBox(this, "Textures/SkyBox/HMcubemap"); skyBox.effectAsset = "Shaders/DeferredRender/SkyBoxShader"; Components.Add(skyBox); Plane plane = new Plane(this, "Shaders/DeferredRender/DeferredModelRender"); plane.ColorAsset = "Textures/cobbles"; plane.BumpAsset = "Textures/cobblesNormal"; plane.OcclusionAsset = "Textures/cobbleOcclusion"; plane.SpecularAsset = "Textures/cobblesSpecular"; plane.Scale = Vector3.One * 2; plane.UVMultiplier = Vector2.One * 5; plane.Position = new Vector3(0, -1, -20); Components.Add(plane); Base3DObject bunny = new Base3DObject(this, "Models/bunny", "Shaders/DeferredRender/DeferredModelRender"); bunny.Position = new Vector3(0, -1f, -20); Components.Add(bunny); Cube cube = new Cube(this, "Shaders/DeferredRender/DeferredModelRender"); cube.ColorAsset = "Textures/xnauguk"; cube.Position = new Vector3(-3, -.5f, -20); Components.Add(cube); Sphere sphere = new Sphere(this, "Shaders/DeferredRender/DeferredModelRender"); sphere.Scale = Vector3.One * 2; sphere.Position = new Vector3(3, -0, -20); sphere.ColorAsset = "Textures/brick"; sphere.BumpAsset = "Textures/brickNormal"; sphere.OcclusionAsset = "Textures/brickOcclusion"; sphere.SpecularAsset = "Textures/brickSpecular"; sphere.UVMultiplier = Vector2.One * 2; Components.Add(sphere); Cube sandBlock = new Cube(this, "Shaders/DeferredRender/DeferredModelRender"); sandBlock.ColorAsset = "Textures/sand"; sandBlock.BumpAsset = "Textures/sandNormal"; sandBlock.Position = new Vector3(-3, 1.5f, -20); sandBlock.Rotate(Vector3.Up + Vector3.Forward + Vector3.Left, 15); Components.Add(sandBlock); DeferredDirectionalLight directionalLight = new DeferredDirectionalLight(this, new Vector3(10, 10, 10), Color.AliceBlue, 1, true); directionalLight.Transform.LookAt(Vector3.Zero, 1, Vector3.Forward); Components.Add(directionalLight); lightingManager.AddLight(directionalLight); DeferredPointLight pointLight = new DeferredPointLight(this, new Vector3(0, 1, -20), Color.Red, 10, 1, false); Components.Add(pointLight); lightingManager.AddLight(pointLight); coneLight = new DeferredConeLight(this, new Vector3(-10, 5, -25), Color.Gold, 1, MathHelper.ToRadians(45), 5, true); coneLight.Transform.LookAt(new Vector3(0, 0, -20), 1, Vector3.Forward); Components.Add(coneLight); lightingManager.AddLight(coneLight); DeferredConeLight coneLight2 = new DeferredConeLight(this, new Vector3(0, 20, -20), Color.Green, 1, MathHelper.ToRadians(25), 50, true); coneLight2.Transform.LookAt(new Vector3(0, 0, -20), 1, Vector3.Forward); Components.Add(coneLight2); lightingManager.AddLight(coneLight2); // Shadow casters and receivers.. lightingManager.AddShadowCaster(bunny); lightingManager.AddShadowCaster(cube); lightingManager.AddShadowCaster(sphere); lightingManager.AddShadowCaster(sandBlock); }
public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; graphics.GraphicsProfile = GraphicsProfile.HiDef; graphics.PreferredBackBufferWidth = 1920; graphics.PreferredBackBufferHeight = 1080; IsMouseVisible = true; kbm = new KeyboardStateManager(this); camera = new Base3DCamera(this, .5f, 20000); camera.Position = new Vector3(0, 0, 0); Components.Add(camera); Services.AddService(typeof(Base3DCamera), camera); skyBox = new BaseSkyBox(this, "Textures/SkyBox/NebulaBlue"); Components.Add(skyBox); bunny = new Base3DObject(this, "Models/bunny", "Shaders/RenderObjectNotTangentsOrTexCoords"); bunny.Position = new Vector3(2, -1.5f, -20); bunny.LightPosition = LightPosition; Components.Add(bunny); cube = new Base3DObject(this, "Models/cube"); cube.Position = new Vector3(0, 0, -10); cube.ColorAsset = "Textures/h2mcpCube"; cube.BumpAsset = "Textures/h2mcpCubeNormal"; cube.LightPosition = LightPosition; Components.Add(cube); bunnies = new Base3DObject[10]; for (int s = 0; s < 10; s++) { bunnies[s] = new Base3DObject(this, "Models/Bunny"); bunnies[s].Position = new Vector3(20 + (s * 12), -1.5f, -10 - (s * 12)); bunnies[s].ColorAsset = "Textures/WindmillTopColor"; bunnies[s].BumpAsset = "Textures/WindmillTopNormal"; bunnies[s].LightPosition = LightPosition; Components.Add(bunnies[s]); } landShark = new Base3DObject(this, "Models/landShark"); landShark.Position = new Vector3(-20, 0, -10); landShark.ColorAsset = "Textures/Speeder_diff"; landShark.BumpAsset = "Textures/Speeder_bump"; landShark.LightPosition = LightPosition; Components.Add(landShark); earth = new Base3DObject(this, "Models/sphere"); earth.Position = new Vector3(0, 0, -200); earth.ColorAsset = "Textures/Earth_Diffuse"; earth.BumpAsset = "Textures/Earth_NormalMap"; earth.LightPosition = LightPosition; Components.Add(earth); ppManager = new PostProcessingManager(this); fog = new FogEffect(this, 50, 100, Color.DarkSlateGray); fog.Enabled = false; ppManager.AddEffect(fog); GodRays = new CrepuscularRays(this, LightPosition, "Textures/flare", 1500, .99f, .99f, .5f, .12f, .25f); GodRays.Enabled = false; ppManager.AddEffect(GodRays); sun = new SunEffect(this, LightPosition); sun.Enabled = false; ppManager.AddEffect(sun); bloom = new BloomEffect(this, 1.25f, 1f, 1f, 1f, .25f, 4f); bloom.Enabled = false; ppManager.AddEffect(bloom); dof = new DepthOfFieldEffect(this, 5, 30); dof.Enabled = false; ppManager.AddEffect(dof); haze = new HeatHazeEffect(this, "Textures/bumpmap", false); haze.Enabled = false; ppManager.AddEffect(haze); radialBlur = new RadialBlurEffect(this, 0.009f); radialBlur.Enabled = false; ppManager.AddEffect(radialBlur); ripple = new RippleEffect(this); ripple.Enabled = false; ppManager.AddEffect(ripple); sepia = new SepiaEffect(this); sepia.Enabled = false; ppManager.AddEffect(sepia); greyScale = new GreyScaleEffect(this); greyScale.Enabled = false; ppManager.AddEffect(greyScale); invert = new InvertColorEffect(this); invert.Enabled = false; ppManager.AddEffect(invert); colorFilter = new ColorFilterEffect(this, Color.White, .5f, .5f, .5f); colorFilter.Enabled = false; ppManager.AddEffect(colorFilter); bleach = new BleachEffect(this, 1); bleach.Enabled = false; ppManager.AddEffect(bleach); scanLines = new ScanLinesEffect(this, .001f, .001f, 128); scanLines.Enabled = false; ppManager.AddEffect(scanLines); deRezed = new DeRezedEffect(this, 128); deRezed.Enabled = false; ppManager.AddEffect(deRezed); }