PageRenderTime 82ms CodeModel.GetById 60ms app.highlight 2ms RepoModel.GetById 18ms app.codeStats 1ms

/Rendering/SceneGraph/SceneGraphNodeMesh.cs

#
C# | 75 lines | 35 code | 5 blank | 35 comment | 2 complexity | 83d0f06bb3f86d2f3af5ca639cd0a0ee 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.Models;
21
22namespace Delta.Rendering.SceneGraph
23{
24	/// <summary>
25	/// SceneGraphNode for Mesh based data.
26	/// </summary>
27	public class SceneGraphNodeMesh : SceneGraphNode
28	{
29		#region Mesh (Public)
30		/// <summary>
31		/// Gets or Sets the <see cref="Mesh"/> to be rendered.
32		/// </summary>
33		public Mesh Mesh
34		{
35			get;
36			set;
37		}
38		#endregion
39
40		#region Constructors
41		/// <summary>
42		/// Creates a new instance of <see cref="SceneGraphNodeMesh"/>.
43		/// </summary>
44		/// <param name="mesh">Mesh to be rendered.</param>
45		public SceneGraphNodeMesh(Mesh mesh)
46		{
47			Mesh = mesh;
48		}
49
50		/// <summary>
51		/// Creates a new instance of <see cref="SceneGraphNodeMesh"/>.
52		/// </summary>
53		/// <remarks>
54		/// You need to set the Mesh later for correct rendering.
55		/// </remarks>
56		public SceneGraphNodeMesh()
57			: this(null)
58		{
59		}
60		#endregion
61
62		#region Render (Public)
63		/// <summary>
64		/// Overriden Render method to render the Mesh.
65		/// </summary>
66		public override void Render()
67		{
68			if (Mesh != null)
69			{
70				Mesh.Draw(ref worldTransformation);
71			}
72		}
73		#endregion
74	}
75}