private void InitializerObjects() { FogShader = TGCShaders.Instance.LoadEffect(ShadersDir + "Shaders.fx"); FogShader.SetValue("ColorFog", Color.SteelBlue.ToArgb()); FogShader.SetValue("StartFogDistance", 2000); FogShader.SetValue("EndFogDistance", 10000); FogShader.SetValue("globalLightPosition", TGCVector3.TGCVector3ToFloat4Array(LightPosition)); SetMaterialColors(); /* Initializer object */ LightBox = TGCBox.fromSize(TGCVector3.One * 150, Color.White); Skybox = new Skybox(MediaDir, Camera); Water = new Water(MediaDir, ShadersDir, new TGCVector3(0, 3500, 0)); Ship = new Ship(MediaDir); ShowScene = true; Terrain = new Terrain(MediaDir, ShadersDir); MeshBuilder = new MeshBuilder(Terrain, Water); Shark = new Shark(MediaDir, Skybox, Terrain, Camera, SoundManager); Character = new Character(Camera, Input, SoundManager); Weapon = new Weapon(MediaDir, Camera); Vegetation = new Vegetation(MediaDir); Common = new Common(MediaDir); Fishes = Common.ListFishes.Select(mesh => new Fish(Skybox, Terrain, mesh)).ToList(); Bubble = new Bubble(MediaDir); AddWeaponToCharacter(); /* Location */ MeshBuilder.LocateMeshesInWorld(meshes: ref Vegetation.ListAlgas, area: Skybox.CurrentPerimeter); MeshBuilder.LocateMeshesInWorld(meshes: ref Common.ListCorals, area: Skybox.CurrentPerimeter); MeshBuilder.LocateMeshesInWorld(meshes: ref Common.ListOres, area: Skybox.CurrentPerimeter); MeshBuilder.LocateMeshesInWorld(meshes: ref Common.ListRock, area: Skybox.CurrentPerimeter); MeshBuilder.LocateMeshesInWorld(meshes: ref Common.ListFishes, area: Skybox.CurrentPerimeter); MeshBuilder.LocateMeshesInWorld(meshes: ref Bubble.Bubbles, area: Skybox.CurrentPerimeter); Common.LocateObjects(); /* Add rigidBody to the world */ PhysicalWorld = new PhysicalWorld(); PhysicalWorld.AddBodyToTheWorld(Terrain.Body); PhysicalWorld.AddBodyToTheWorld(Character.Body); PhysicalWorld.AddBodyToTheWorld(Ship.BodyOutdoorShip); PhysicalWorld.AddBodyToTheWorld(Ship.BodyIndoorShip); PhysicalWorld.AddBodyToTheWorld(Shark.Body); Common.ListCorals.ForEach(coral => PhysicalWorld.AddBodyToTheWorld(coral.Body)); Common.ListOres.ForEach(ore => PhysicalWorld.AddBodyToTheWorld(ore.Body)); Common.ListRock.ForEach(rock => PhysicalWorld.AddBodyToTheWorld(rock.Body)); AddRoofRigidBody(); Bubble.SetShader(FogShader, "FogBubble"); Skybox.SetShader(FogShader, "Fog"); Common.SetShader(FogShader, "Fog"); Shark.SetShader(FogShader, "Fog"); Vegetation.SetShader(FogShader, "FogVegetation"); Ship.SetShader(ref FogShader); LightBox.Transform = TGCMatrix.Translation(LightPosition); var meshes = GetStaticMeshes(); QuadTree.Camera = Camera; QuadTree.create(meshes, Terrain.world.BoundingBox); }