PageRenderTime 257ms CodeModel.GetById 111ms app.highlight 2ms RepoModel.GetById 139ms app.codeStats 0ms

/Rendering/SceneGraph/SceneGraphNodeCamera.cs

#
C# | 73 lines | 36 code | 6 blank | 31 comment | 1 complexity | 82d198a6221a30a3b59b538ce7ba9041 MD5 | raw file
 1#region License
 2/* Copyright : Santtu Syrjälä
 3 * License : New BSD
 4 * 
 5 * SceneGraphNode for Delta Engine 
 6 * 
 7 * General purpose scene graph for 2D and 3D that is compatible with Delta Engines vertex constructs, cameras and rendering pipeline.
 8 * 
 9 * If You find a bug, find a way to make it work faster or other additions to make it more useful please share them! You can find me in Delta Engine forums. You will get Your name
10 * in here if YOU WISH.
11 * 
12 * Addition : I don't wa...(of course I want) NEED money for this thing. I though would like You to include me in the credits portion of Your application if You like/use
13 * this. It is NOT REQUIRED, though it would serve as a little thanks that would warm this programmer's heart.
14 * 
15 * Changes :
16 * 10.09.2011 : Release of the preview 0.1.0.0
17 */
18#endregion
19
20using Delta.Rendering.Cameras;
21
22namespace Delta.Rendering.SceneGraph
23{
24	/// <summary>
25	/// SceneGraphNode for wrapping a Camera.
26	/// </summary>
27	public class SceneGraphNodeCamera : SceneGraphNode
28	{
29		#region Camera (Public)
30		/// <summary>
31		/// Camera to be wrapped.
32		/// </summary>
33		public BaseCamera Camera
34		{
35			get;
36			protected set;
37		}
38		#endregion
39
40		#region Constructors
41		/// <summary>
42		/// Creates a new instance of <see cref="SceneGraphNodeCamera"/>
43		/// </summary>
44		/// <param name="camera">The camera attached to this node.</param>
45		public SceneGraphNodeCamera(BaseCamera camera)
46		{
47			Camera = camera;
48		}
49		#endregion
50
51		#region Methods (Private)
52
53		#region UpdateTransformation
54		/// <summary>
55		/// Overridden UpdateTranformation method for settings the world 
56		/// position/rotation for the camera.
57		/// </summary>
58		/// <returns>True if transform was updated, otherwise False.</returns>
59		protected override bool UpdateTransformation()
60		{
61			bool toReturn = base.UpdateTransformation();
62			if (toReturn)
63			{
64				Camera.Position = WorldPosition;
65				Camera.Rotation = WorldRotation;
66			}
67			return toReturn;
68		}
69		#endregion
70
71		#endregion
72	}
73}