public Water(ContentManager content, GraphicsDevice graphics, Vector3 position, Vector2 size) { this.content = content; this.graphics = graphics; waterMesh = new CModel(content.Load <Model>("plane"), position, Vector3.Zero, new Vector3(size.X, 1, size.Y), graphics); waterEffect = content.Load <Effect>("WaterEffect"); waterMesh.SetModelEffect(waterEffect, false); waterEffect.Parameters["viewportWidth"].SetValue( graphics.Viewport.Width); waterEffect.Parameters["viewportHeight"].SetValue( graphics.Viewport.Height); waterEffect.Parameters["WaterNormalMap"].SetValue( content.Load <Texture2D>("water_normal")); reflectionTarg = new RenderTarget2D(graphics, graphics.Viewport.Width, graphics.Viewport.Height, false, SurfaceFormat.Color, DepthFormat.Depth24); }
public CDrawableComponent(Game1 game,Unit unit, CModel model) : base(game) { myGame = game; this.unit = unit; this.cModel = model; unit.BoundingSphere = cModel.buildBoundingSphere(); }
public CDrawableComponent(Game1 game, Unit unit, CModel model) : base(game) { myGame = game; this.unit = unit; this.cModel = model; unit.BoundingSphere = cModel.buildBoundingSphere(); }
// Called when the game should load its content protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); camera = new FreeCamera(new Vector3(1000, 650, 1000), MathHelper.ToRadians(45), MathHelper.ToRadians(-30), GraphicsDevice); Effect effect = Content.Load <Effect>("Content/LightingEffect"); LightingMaterial mat = new LightingMaterial(); for (int z = -1; z <= 1; z++) { for (int x = -1; x <= 1; x++) { CModel model = new CModel(Content.Load <Model>("Content/teapot__cv1"), new Vector3(x * 500, 0, z * 500), Vector3.Zero, Vector3.One * 50, GraphicsDevice); model.SetModelEffect(effect, true); model.SetModelMaterial(mat); model.Model.Meshes[0].MeshParts[0].Effect.Parameters["BasicTexture"].SetValue( Content.Load <Texture2D>("Content/brick_texture_map")); model.Model.Meshes[0].MeshParts[0].Effect.Parameters["TextureEnabled"].SetValue(true); models.Add(model); } } CModel ground = new CModel(Content.Load <Model>("Content/ground"), Vector3.Zero, Vector3.Zero, Vector3.One, GraphicsDevice, false); //ground.SetModelEffect(effect, true); //ground.SetModelMaterial(mat); models.Add(ground); renderCapture = new RenderCapture(GraphicsDevice); postprocessor = new GaussianBlur(GraphicsDevice, Content, 2); depthEffect = Content.Load <Effect>("Content/DepthEffect"); //depthCapture = new RenderCapture(GraphicsDevice, SurfaceFormat.HalfSingle); depthCapture = new RenderCapture(GraphicsDevice); blurCapture = new RenderCapture(GraphicsDevice, SurfaceFormat.Color); dof = new DepthOfField(GraphicsDevice, Content); lastMouseState = Mouse.GetState(); }
public SkySphere(ContentManager Content, GraphicsDevice GraphicsDevice, TextureCube Texture) { model = new CModel(Content.Load <Model>("Content/skysphere_mesh__cv1"), Vector3.Zero, Vector3.Zero, new Vector3(100000), GraphicsDevice); effect = Content.Load <Effect>("Content/skysphere_effect"); effect.Parameters["CubeMap"].SetValue(Texture); model.SetModelEffect(effect, false); this.graphics = GraphicsDevice; }
// Called when the game should load its content protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); camera = new FreeCamera(new Vector3(1000, 650, 1000), MathHelper.ToRadians(45), MathHelper.ToRadians(-30), GraphicsDevice); Effect effect = Content.Load <Effect>("Content/LightingEffect"); LightingMaterial mat = new LightingMaterial(); for (int z = -1; z <= 1; z++) { for (int x = -1; x <= 1; x++) { CModel model = new CModel(Content.Load <Model>("Content/glow_teapot__cv1"), new Vector3(x * 500, 0, z * 500), Vector3.Zero, Vector3.One * 5, GraphicsDevice); model.SetModelEffect(effect, true); model.SetModelMaterial(mat); models.Add(model); } } CModel ground = new CModel(Content.Load <Model>("Content/glow_plane__cv1"), Vector3.Zero, Vector3.Zero, Vector3.One * 6, GraphicsDevice); ground.SetModelEffect(effect, true); ground.SetModelMaterial(mat); models.Add(ground); renderCapture = new RenderCapture(GraphicsDevice); glowCapture = new RenderCapture(GraphicsDevice); glowEffect = Content.Load <Effect>("Content/GlowEffect"); glowEffect.Parameters["GlowTexture"].SetValue( Content.Load <Texture2D>("Content/glow_map")); blur = new GaussianBlur(GraphicsDevice, Content, 4); lastMouseState = Mouse.GetState(); }
// Called when the game should load its content protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); camera = new FreeCamera(new Vector3(100, 65, 100), MathHelper.ToRadians(45), MathHelper.ToRadians(-30), GraphicsDevice); Effect lit = Content.Load <Effect>("Content/LightingEffect"); Effect normal = Content.Load <Effect>("Content/NormalMapEffect"); LightingMaterial marble = new LightingMaterial(); marble.SpecularColor = Color.White.ToVector3(); LightingMaterial steel = new LightingMaterial(); steel.SpecularColor = Color.Gray.ToVector3(); NormalMapMaterial brick = new NormalMapMaterial( Content.Load <Texture2D>("Content/brick_normal_map")); NormalMapMaterial wood = new NormalMapMaterial( Content.Load <Texture2D>("Content/wood_normal")); CModel model = new CModel(Content.Load <Model>("Content/multimesh__cv1"), Vector3.Zero, Vector3.Zero, Vector3.One, GraphicsDevice); model.SetMeshEffect("Box01", normal, true); model.SetMeshMaterial("Box01", wood); model.SetMeshEffect("Pyramid01", normal, true); model.SetMeshMaterial("Pyramid01", brick); model.SetMeshEffect("Sphere01", lit, true); model.SetMeshMaterial("Sphere01", marble); model.SetMeshEffect("Plane01", lit, true); model.SetMeshMaterial("Plane01", steel); models.Add(model); lastMouseState = Mouse.GetState(); }
// Called when the game should load its content protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); camera = new FreeCamera(new Vector3(1000, 650, 1000), MathHelper.ToRadians(45), MathHelper.ToRadians(-30), GraphicsDevice); Effect effect = Content.Load <Effect>("LightingEffect"); LightingMaterial mat = new LightingMaterial(); for (int z = -1; z <= 1; z++) { for (int x = -1; x <= 1; x++) { CModel model = new CModel(Content.Load <Model>("teapot"), new Vector3(x * 500, 0, z * 500), Vector3.Zero, Vector3.One * 50, GraphicsDevice); model.SetModelEffect(effect, true); model.SetModelMaterial(mat); model.Model.Meshes[0].MeshParts[0].Effect.Parameters["BasicTexture"].SetValue( Content.Load <Texture2D>("brick_texture_map")); model.Model.Meshes[0].MeshParts[0].Effect.Parameters["TextureEnabled"].SetValue(true); models.Add(model); } } CModel ground = new CModel(Content.Load <Model>("ground"), Vector3.Zero, Vector3.Zero, Vector3.One, GraphicsDevice); ground.SetModelEffect(effect, true); ground.SetModelMaterial(mat); models.Add(ground); renderCapture = new RenderCapture(GraphicsDevice); postprocessor = new PostProcessor(Content.Load <Effect>("BWPostProcessor"), GraphicsDevice); lastMouseState = Mouse.GetState(); }
protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); Model model = Content.Load <Model>("Content/ship__cv1"); for (int y = 0; y < 3; y++) { for (int x = 0; x < 3; x++) { Vector3 position = new Vector3(-600 + x * 600, -400 + y * 400, 0); Vector3 rotation = new Vector3(0, MathHelper.ToRadians(90) * (y * 3 + x), 0); Vector3 scale = new Vector3(0.25f); CModel modelX = new CModel(model, position, rotation, scale, GraphicsDevice); models.Add(modelX); } } base.LoadContent(); }
public Monster(MyGame game, CModel model, Unit unit) : base(game, unit, model) { monsterModel = ((MonsterModel)cModel); monsterUnit = ((MonsterUnit)unit); }