AddCamera() public method

public AddCamera ( Camera c ) : void
c Axiom.Core.Camera
return void
Example #1
0
		protected override void SetupContent()
		{
			var blankTerrain = false;

			this.editMarker = SceneManager.CreateEntity( "editMarker", "sphere.mesh" );
			this.editNode = SceneManager.RootSceneNode.CreateChildSceneNode();
			this.editNode.AttachObject( this.editMarker );
			this.editNode.Scale = new Vector3( 0.05f, 0.05f, 0.05f );

			_setupControls();

			CameraManager.TopSpeed = 50;

			DragLook = true;

			MaterialManager.Instance.SetDefaultTextureFiltering( TextureFiltering.Anisotropic );
			MaterialManager.Instance.DefaultAnisotropy = 7;

			SceneManager.SetFog( FogMode.Linear, new ColorEx( 0.07f, 0.07f, 0.08f ), 0, 10000, 25000 );

			var lightDir = new Vector3( 0.55f, 0.3f, 0.75f );
			lightDir.Normalize();

			var l = SceneManager.CreateLight( "tsLight" );
			l.Type = LightType.Directional;
			l.Direction = lightDir;
			l.Diffuse = ColorEx.White;
			l.Specular = new ColorEx( 0.4f, 0.4f, 0.4f );

			SceneManager.AmbientLight = new ColorEx( 0.2f, 0.2f, 0.2f );

			this.terrainGroup = new TerrainGroup( SceneManager, Alignment.Align_X_Z, (ushort)TerrainSize, TerrainWorldSize );
			this.terrainGroup.SetFilenameConvention( TerrainFilePrefix, TerrainFileSuffix );
			this.terrainGroup.Origin = this.terrainPos;

			_configureTerrainDefaults( l );
#if PAGING
	// Paging setup
            pageManager = new PageManager();
            // Since we're not loading any pages from .page files, we need a way just 
            // to say we've loaded them without them actually being loaded
            pageManager.PageProvider = dummyPageProvider;
            pageManager.AddCamera( Camera );
            terrainPaging = new TerrainPaging( pageManager );
            PagedWorld world = pageManager.CreateWorld();
            terrainPaging.CreateWorldSection( world, terrainGroup, 2000, 3000,
                TerrainPageMinX, TerrainPageMinY,
                TerrainPageMaxX, TerrainPageMaxY );
#else
			for ( long x = TerrainPageMinX; x <= TerrainPageMaxX; ++x )
			{
				for ( long y = TerrainPageMinY; y <= TerrainPageMaxY; ++y )
				{
					_defineTerrain( x, y, blankTerrain );
				}
			}
			// sync load since we want everything in place when we start
			this.terrainGroup.LoadAllTerrains( true );
#endif

			if ( this.terrainsImported )
			{
				foreach ( var ts in this.terrainGroup.TerrainSlots )
				{
					_initBlendMaps( ts.Instance );
				}
			}

			this.terrainGroup.FreeTemporaryResources();

			var e = SceneManager.CreateEntity( "TudoMesh", "tudorhouse.mesh" );
			var entPos = new Vector3( this.terrainPos.x + 2043, 0, this.terrainPos.z + 1715 );
			var rot = new Quaternion();
			entPos.y = this.terrainGroup.GetHeightAtWorldPosition( entPos ) + 65.5 + this.terrainPos.y;
			rot = Quaternion.FromAngleAxis( Utility.RangeRandom( -180, 180 ), Vector3.UnitY );
			var sn = SceneManager.RootSceneNode.CreateChildSceneNode( entPos, rot );
			sn.Scale = new Vector3( 0.12, 0.12, 0.12 );
			sn.AttachObject( e );
			this.houseList.Add( e );

			e = SceneManager.CreateEntity( "TudoMesh1", "tudorhouse.mesh" );
			entPos = new Vector3( this.terrainPos.x + 1850, 0, this.terrainPos.z + 1478 );
			entPos.y = this.terrainGroup.GetHeightAtWorldPosition( entPos ) + 65.5 + this.terrainPos.y;
			rot = Quaternion.FromAngleAxis( Utility.RangeRandom( -180, 180 ), Vector3.UnitY );
			sn = SceneManager.RootSceneNode.CreateChildSceneNode( entPos, rot );
			sn.Scale = new Vector3( 0.12, 0.12, 0.12 );
			sn.AttachObject( e );
			this.houseList.Add( e );

			e = SceneManager.CreateEntity( "TudoMesh2", "tudorhouse.mesh" );
			entPos = new Vector3( this.terrainPos.x + 1970, 0, this.terrainPos.z + 2180 );
			entPos.y = this.terrainGroup.GetHeightAtWorldPosition( entPos ) + 65.5 + this.terrainPos.y;
			rot = Quaternion.FromAngleAxis( Utility.RangeRandom( -180, 180 ), Vector3.UnitY );
			sn = SceneManager.RootSceneNode.CreateChildSceneNode( entPos, rot );
			sn.Scale = new Vector3( 0.12, 0.12, 0.12 );
			sn.AttachObject( e );
			this.houseList.Add( e );

			//SceneManager.SetSkyDome( true, "Examples/CloudyNoonSkyBox", 5000, 8 );
			SceneManager.SetSkyDome( true, "Examples/CloudySky", 5000, 8 );
		}