/// <summary> /// Draw this entity. /// </summary> /// <param name="parent">Parent node that's currently drawing this entity.</param> /// <param name="localTransformations">Local transformations from the direct parent node.</param> /// <param name="worldTransformations">World transformations to apply on this entity (this is what you should use to draw this entity).</param> public override void Draw(Node parent, ref Matrix localTransformations, ref Matrix worldTransformations) { // not visible / no active camera? skip if (!Visible || GraphicsManager.ActiveCamera == null) { return; } // call draw callback OnDraw?.Invoke(this); // draw all meshes foreach (DictionaryEntry mesh in _meshes) { GraphicsManager.DrawEntity(mesh.Value as MeshEntity, worldTransformations); } }
/// <summary> /// Draw the entity. /// </summary> /// <param name="parent">Parent node that's currently drawing this entity.</param> /// <param name="localTransformations">Local transformations from the direct parent node.</param> /// <param name="worldTransformations">World transformations to apply on this entity (this is what you should use to draw this entity).</param> public virtual void Draw(Node parent, ref Matrix localTransformations, ref Matrix worldTransformations) { // not visible / no active camera? skip if (!Visible || GraphicsManager.ActiveCamera == null) { return; } // call draw callback OnDraw?.Invoke(this); // make sure we got up-to-date bounding sphere, which is important for lightings and other optimizations GetBoundingSphere(parent, ref localTransformations, ref worldTransformations); // call to draw this entity - this will either add to the corresponding rendering queue, or draw immediately if have no drawing queue. GraphicsManager.DrawEntity(this, worldTransformations); }