Ejemplo n.º 1
0
		/// <summary>Called on a pool if a camera was requested.
		/// This call occurs when something on the main UI is being rendered ontop of an inline camera.</summary>
		public bool CheckCameraRequired(){
			
			if(!CameraRequested){
				return false;
			}
			
			// Clear the request:
			CameraRequested=false;
			
			// A camera is required!
			
			// Get the main UI renderer:
			Renderman renderer=UI.GetRenderer();
			
			// We must create a UICamera (or pull one from the pool):
			UICamera camera=GetPooledCamera();
			
			if(camera==null){
				// Create one:
				camera=new UICamera(renderer);
			}
			
			// Add it to the main set:
			AddCamera(camera);
			
			// Next, set the current depth:
			camera.SetDepth(AllocatedDepth);
			
			// Finally, we must now make sure any batches are parented to this new camera.
			// We do this by setting it to the root of the renderer:
			renderer.Node=camera.Gameobject;
			
			return true;
		}
Ejemplo n.º 2
0
		/// <summary>Resets the pool. Called before a main UI layout occurs.</summary>
		public void Reset(){
			CameraRequested=false;
			CameraDepth=UI.CameraDepth;
			
			// Push all active cameras into the inactive pool:
			DidLayout=true;
			FirstPoolCamera=FirstCamera;
			LastPoolCamera=LastCamera;
			FirstCamera=null;
			LastCamera=null;
		}
Ejemplo n.º 3
0
		/// <summary>Adds the given active camera to the main linked list for processing.</summary>
		public void AddCamera(UICamera camera){
			if(FirstCamera==null){
				FirstCamera=LastCamera=camera;
			}else{
				LastCamera=LastCamera.CameraAfter=camera;
			}
		}
Ejemplo n.º 4
0
		/// <summary>Gets a camera from the inactive pool. Null if the pool is empty.</summary>
		public UICamera GetPooledCamera(){
			if(FirstPoolCamera==null){
				return null;
			}
			
			UICamera result=FirstPoolCamera;
			FirstPoolCamera=result.CameraAfter;
			result.CameraAfter=null;
			return result;
		}
Ejemplo n.º 5
0
		/// <summary>Clears the inactive pool.</summary>
		public void ClearPool(){
			DidLayout=false;
			UICamera current=FirstPoolCamera;
			FirstPoolCamera=null;
			LastPoolCamera=null;
			
			while(current!=null){
				current.Destroy();
				current=current.CameraAfter;
			}
		}
Ejemplo n.º 6
0
		/// <summary>Destroys everything in this set.</summary>
		public void Destroy(){
			
			// Clear the pool:
			ClearPool();
			
			// Put the whole active set into the inactive pool:
			FirstPoolCamera=FirstCamera;
			FirstCamera=null;
			LastCamera=null;
			
			// Clear the pool again:
			ClearPool();
		}