protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); GameObject terrainObject = new GameObject(); terrainObject.Transform.LocalScale *= new Vector3(1, 5, 1); terrain = terrainObject.Add<TerrainRenderer>(); terrain.Initialize( Content.Load<Texture2D>("Textures/Heightmap"), Vector2.One * 100, Vector2.One * 200); terrain.NormalMap = Content.Load<Texture2D>("Textures/Normalmap"); effect = Content.Load<Effect>("Effects/TerrainShader"); GameObject cameraObject = new GameObject(); cameraObject.Transform.LocalPosition = Vector3.Backward * 5 + Vector3.Right * 5 + Vector3.Up * 5; camera = cameraObject.Add<Camera>(); }
protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); gunSound = Content.Load<SoundEffect>("Sounds/Gun"); cube = Content.Load<Model>("Models/Cube"); sphere = Content.Load<Model>("Models/Sphere"); GameObject gameObject; gameObject = new GameObject(); gameObject.Transform.LocalPosition = new Vector3(1, 0, 0); objects.Add(gameObject); BoxCollider boxCollider = gameObject.Add<BoxCollider>(); boxCollider.Size = 1; colliders.Add(boxCollider); gameObject = new GameObject(); gameObject.Transform.LocalPosition = new Vector3(-1, 0, 0); objects.Add(gameObject); SphereCollider sphereCollider = gameObject.Add<SphereCollider>(); sphereCollider.Radius = 1; colliders.Add(sphereCollider); // Front Camera gameObject = new GameObject(); gameObject.Transform.LocalPosition = Vector3.Backward * 5; camera = gameObject.Add<Camera>(); camera.Position = new Vector2(0f, 0f); camera.Size = new Vector2(0.5f, 1f); camera.AspectRatio = camera.Viewport.AspectRatio; cameras.Add(camera); // Top Down Camera gameObject = new GameObject(); gameObject.Transform.LocalPosition = Vector3.Up * 10; gameObject.Transform.Rotate(Vector3.Right, -MathHelper.PiOver2); camera = gameObject.Add<Camera>(); camera.Position = new Vector2(0.5f, 0f); camera.Size = new Vector2(0.5f, 1f); camera.AspectRatio = camera.Viewport.AspectRatio; cameras.Add(camera); camera = cameras[0]; }
protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); // Let's load our model model = Content.Load<Model>("Models/Torus"); // Ask our model to do "default" lighting" foreach (ModelMesh mesh in model.Meshes) foreach (BasicEffect effect in mesh.Effects) { effect.EnableDefaultLighting(); effect.Alpha = 1; } parentObject = new GameObject(); childObject = new GameObject(); childObject.Transform.Parent = parentObject.Transform; childObject.Transform.LocalPosition = Vector3.Right * 10; cameraObject = new GameObject(); cameraObject.Transform.LocalPosition = Vector3.Backward * 50; camera = cameraObject.Add<Camera>(); }
protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); // Let's load our model model = Content.Load<Model>("Models/Torus"); parentObject = new GameObject(); childObject = new GameObject(); childObject.Transform.Parent = parentObject.Transform; childObject.Transform.LocalPosition = Vector3.Right * 10; cameraObject = new GameObject(); cameraObject.Transform.LocalPosition = Vector3.Backward * 50; camera = cameraObject.Add<Camera>(); texture = Content.Load<Texture2D>("Textures/Square"); effect = Content.Load<Effect>("Effects/SimpleShading"); }