/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { Components.Add(new Cameras.FPSCameraGC(this, Vector3.Up * 200 + Vector3.Right * 100+ Vector3.Forward * 300)); Vector2[] waveDirection = new Vector2[4]; waveDirection[0] = new Vector2(-0.1f, -0.9f); waveDirection[1] = new Vector2(-0.1f, -0.9f); waveDirection[2] = new Vector2(-0.2f, -0.8f); waveDirection[3] = new Vector2(-0.2f, -0.8f); Components.Add(new OceanGeneratorDGC(this, Vector3.Up * 15, 256, 256, 1.0f, new Vector4(0.6f, 0.8f, 0.9f, 1.4f), new Vector4(3.0f, 0.0f, 0.0f, 0.0f), new Vector4(10.0f, 5.0f, 3.0f, 1.0f), waveDirection)); Components.Add(new TerrainGenerator.TerrainGenerator(this, Vector3.Zero, 256, 256, 1.0f)); Components.Add(new CloudsDGC(this, Vector3.Up * 200 + Vector3.Forward * 100 + Vector3.Right * 200, 150, 30.0f, 100.0f)); Components.Add(new CloudsDGC(this, Vector3.Up * 600 + Vector3.Forward * 100 + Vector3.Right * 100, 1000, 100.0f, 1000.0f)); Components.Add(new CloudsDGC(this, Vector3.Up * 200 + Vector3.Forward * 200 + Vector3.Right * 100, 150, 10.0f, 20.0f)); Components.Add(new SceneGenerator.SkyboxHLSL_DGC(this)); camera = (Cameras.CameraInterface)this.Services.GetService(typeof(Cameras.CameraInterface)); fps = 0; base.Initialize(); }
protected override void LoadContent() { basicEffect = new BasicEffect(GraphicsDevice, null); vertexDeclaration = new VertexDeclaration(GraphicsDevice, VertexPositionTexture.VertexElements); camera = (Cameras.CameraInterface)Game.Services.GetService(typeof(Cameras.CameraInterface)); initBBVertices(); GraphicsDevice.RenderState.SourceBlend = Blend.SourceAlpha; GraphicsDevice.RenderState.DestinationBlend = Blend.InverseSourceAlpha; base.LoadContent(); }
protected override void LoadContent() { treeBB = new List<SceneGenerator.TreesDGC.bb>(); //CosRotationMatrix = Matrix.Identity; random = new Random(); basicEffect = new BasicEffect(this.GraphicsDevice, null); texture = Game.Content.Load<Texture2D>("grass"); heightTexture = Game.Content.Load<Texture2D>("heightmap3"); treeMap = Game.Content.Load<Texture2D>("treeMap"); treeTexture = Game.Content.Load<Texture2D>("3treeTexture"); boolTreeMap = loadTreeData(treeMap); mapHeight = heightTexture.Height; mapWidth = heightTexture.Width; heightData = loadHeightData(heightTexture); vertices = initVertices(); indices = initIndices(); vertices = normalize(vertices, indices); createBuffers(vertices, indices); camera = (Cameras.CameraInterface)Game.Content.ServiceProvider.GetService (typeof(Cameras.CameraInterface)); Game.Components.Add(new SceneGenerator.TreesDGC(Game, treeBB.ToArray(), treeTexture, world, treeTexturesNum)); base.LoadContent(); }
/// <summary> /// Allows the game component to perform any initialization it needs to before starting /// to run. This is where it can query for any required services and load content. /// </summary> public override void Initialize() { camera = (Cameras.CameraInterface)Game.Services.GetService(typeof(Cameras.CameraInterface)); this.DrawOrder = int.MinValue; base.Initialize(); }
protected override void LoadContent() { random = new Random(); effect = Game.Content.Load<Effect>("oceanGenerator"); bumpMap = Game.Content.Load<Texture2D>("waterbumps"); textureCube = Game.Content.Load<TextureCube>("skyboxTexture"); effect.Parameters["BumpMap"].SetValue(bumpMap); effect.Parameters["BumpStrength"].SetValue(bumpStrenght); effect.Parameters["TextureCube"].SetValue(textureCube); effect.Parameters["TexStretch"].SetValue(bumpTextureStretch); effect.Parameters["FresnelTerm"].SetValue(fresnelTerm); effect.Parameters["SpecularPowerTerm"].SetValue(specularPowerTerm); effect.Parameters["WaveSpeeds"].SetValue(waveSpeed); effect.Parameters["WaveHeights"].SetValue(waveHeight); effect.Parameters["WaveLengths"].SetValue(waveLenght); effect.Parameters["WaveDir0"].SetValue(waveDirection[0]); effect.Parameters["WaveDir1"].SetValue(waveDirection[1]); effect.Parameters["WaveDir2"].SetValue(waveDirection[2]); effect.Parameters["WaveDir3"].SetValue(waveDirection[3]); vertices = initVertices(); indices = initIndices(); createBuffers(); camera = (Cameras.CameraInterface)Game.Content.ServiceProvider.GetService (typeof(Cameras.CameraInterface)); base.LoadContent(); }