/Rendering/SceneGraph/SceneGraphNodeCamera.cs
C# | 73 lines | 36 code | 6 blank | 31 comment | 1 complexity | 82d198a6221a30a3b59b538ce7ba9041 MD5 | raw file
Possible License(s): Apache-2.0
- #region License
- /* Copyright : Santtu Syrjälä
- * License : New BSD
- *
- * SceneGraphNode for Delta Engine
- *
- * General purpose scene graph for 2D and 3D that is compatible with Delta Engines vertex constructs, cameras and rendering pipeline.
- *
- * 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
- * in here if YOU WISH.
- *
- * 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
- * this. It is NOT REQUIRED, though it would serve as a little thanks that would warm this programmer's heart.
- *
- * Changes :
- * 10.09.2011 : Release of the preview 0.1.0.0
- */
- #endregion
-
- using Delta.Rendering.Cameras;
-
- namespace Delta.Rendering.SceneGraph
- {
- /// <summary>
- /// SceneGraphNode for wrapping a Camera.
- /// </summary>
- public class SceneGraphNodeCamera : SceneGraphNode
- {
- #region Camera (Public)
- /// <summary>
- /// Camera to be wrapped.
- /// </summary>
- public BaseCamera Camera
- {
- get;
- protected set;
- }
- #endregion
-
- #region Constructors
- /// <summary>
- /// Creates a new instance of <see cref="SceneGraphNodeCamera"/>
- /// </summary>
- /// <param name="camera">The camera attached to this node.</param>
- public SceneGraphNodeCamera(BaseCamera camera)
- {
- Camera = camera;
- }
- #endregion
-
- #region Methods (Private)
-
- #region UpdateTransformation
- /// <summary>
- /// Overridden UpdateTranformation method for settings the world
- /// position/rotation for the camera.
- /// </summary>
- /// <returns>True if transform was updated, otherwise False.</returns>
- protected override bool UpdateTransformation()
- {
- bool toReturn = base.UpdateTransformation();
- if (toReturn)
- {
- Camera.Position = WorldPosition;
- Camera.Rotation = WorldRotation;
- }
- return toReturn;
- }
- #endregion
-
- #endregion
- }
- }