PageRenderTime 31ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

/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
  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. using Delta.Rendering.Cameras;
  20. namespace Delta.Rendering.SceneGraph
  21. {
  22. /// <summary>
  23. /// SceneGraphNode for wrapping a Camera.
  24. /// </summary>
  25. public class SceneGraphNodeCamera : SceneGraphNode
  26. {
  27. #region Camera (Public)
  28. /// <summary>
  29. /// Camera to be wrapped.
  30. /// </summary>
  31. public BaseCamera Camera
  32. {
  33. get;
  34. protected set;
  35. }
  36. #endregion
  37. #region Constructors
  38. /// <summary>
  39. /// Creates a new instance of <see cref="SceneGraphNodeCamera"/>
  40. /// </summary>
  41. /// <param name="camera">The camera attached to this node.</param>
  42. public SceneGraphNodeCamera(BaseCamera camera)
  43. {
  44. Camera = camera;
  45. }
  46. #endregion
  47. #region Methods (Private)
  48. #region UpdateTransformation
  49. /// <summary>
  50. /// Overridden UpdateTranformation method for settings the world
  51. /// position/rotation for the camera.
  52. /// </summary>
  53. /// <returns>True if transform was updated, otherwise False.</returns>
  54. protected override bool UpdateTransformation()
  55. {
  56. bool toReturn = base.UpdateTransformation();
  57. if (toReturn)
  58. {
  59. Camera.Position = WorldPosition;
  60. Camera.Rotation = WorldRotation;
  61. }
  62. return toReturn;
  63. }
  64. #endregion
  65. #endregion
  66. }
  67. }