public SetModelEffect ( |
||
effect | ||
CopyEffect | bool | |
return | void |
// 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 PostProcessor(Content.Load <Effect>("Content/BWPostProcessor"), GraphicsDevice); lastMouseState = Mouse.GetState(); }
public Water(ContentManager content, GraphicsDevice graphics, Vector3 position, Vector2 size) { this.content = content; this.graphics = graphics; waterMesh = new CModel(content.Load <Model>("Content/plane"), position, Vector3.Zero, new Vector3(size.X, 1, size.Y), graphics); waterEffect = content.Load <Effect>("Content/WaterEffect"); waterMesh.SetModelEffect(waterEffect, false); waterEffect.Parameters["viewportWidth"].SetValue((float)graphics.Viewport.Width); waterEffect.Parameters["viewportHeight"].SetValue((float)graphics.Viewport.Height); waterEffect.Parameters["WaterNormalMap"].SetValue(content.Load <Texture2D>("Content/water_normal")); reflectionTarg = new RenderTarget2D(graphics, graphics.Viewport.Width, graphics.Viewport.Height, false, SurfaceFormat.Color, DepthFormat.Depth24); }