/// <summary> /// Constructor /// </summary> public SceneManager( ) { tileManager = null; renderableManager = null; textureManager = null; data2DManager = null; pageManager = null; needOptionsUpdate = false; worldGeomIsSetup = false; }
/// <summary> /// Loads the LandScape using parameters in the given config file. /// </summary> /// <param name="filename"></param> public override void LoadWorldGeometry(string filename) { if (worldGeomIsSetup == true) { ClearScene(); } // Load the configuration file options = PagingLandscape.Options.Instance; options.Load(filename); // Create the Tile and Renderable and 2D Data Manager tileManager = TileManager.Instance; renderableManager = RenderableManager.Instance; textureManager = Texture.TextureManager.Instance; data2DManager = Data2DManager.Instance; pageManager = new PageManager(this.rootSceneNode); worldGeomIsSetup = true; }
/// <summary> /// Empties the entire scene, inluding all SceneNodes, Cameras, Entities and Lights etc. /// </summary> public override void ClearScene() { if (worldGeomIsSetup == true) { worldGeomIsSetup = false; // Delete the Managers if (pageManager != null) { pageManager.Dispose(); pageManager = null; } if (tileManager != null) { tileManager.Dispose(); tileManager = null; } if (renderableManager != null) { renderableManager.Dispose(); renderableManager = null; } if (textureManager != null) { textureManager.Dispose(); textureManager = null; } if (data2DManager != null) { data2DManager.Dispose(); data2DManager = null; } } //Call the default base.ClearScene(); }
public void Dispose() { if (instance == this) { instance = null; } }
/// <summary> /// Constructor /// </summary> public PageManager(SceneNode rootNode) { if (instance != null) { throw new ApplicationException("PageManager.Constructor() called twice!"); } instance = this; sceneRoot = rootNode; currentCameraPageX = 0; currentCameraPageZ = 0; currentCameraTileX = 0; currentCameraTileZ = 0; lastCameraPageState = CameraPageState.Change; lastCameraPos = new Vector3(-999999,9999999,-999999); pause = 99; width = Options.Instance.World_Width; heigth = Options.Instance.World_Height; pageLoadQueue = new PageQueue(); pageUnloadQueue = new PageQueue(); pagePreloadQueue = new PageQueue(); pagePostunloadQueue = new PageQueue(); //setup the page array. // mPages.reserve (mWidth); // mPages.resize (mWidth); pages = new Pages( width ); for (long i = 0; i < width; i++ ) { PageRow pr = new PageRow( heigth ); // mPages[ i ].reserve (mHeigth); // mPages[ i ].resize (mHeigth); for (long j = 0; j < heigth; j++ ) { pr.Add( new Page( i, j ) ); } pages.Add( pr ); } for (long j = 0; j < heigth; j++ ) { for (long i = 0; i < width; i++ ) { if ( j != heigth - 1) { pages[ i ][ j ].SetNeighbor( Neighbor.South, pages[ i ][ j + 1 ] ); pages[ i ][ j + 1 ].SetNeighbor( Neighbor.North, pages[ i ][ j ] ); } if ( i != width - 1) { pages[ i ][ j ].SetNeighbor( Neighbor.East, pages[ i + 1 ][ j ] ); pages[ i + 1 ][ j ].SetNeighbor( Neighbor.West, pages[ i ][ j ] ); } } } }