Class SolaEntityGraphicsModule<V extends technology.sola.ecs.view.ViewEntry>

java.lang.Object
technology.sola.engine.defaults.graphics.modules.SolaGraphicsModule
technology.sola.engine.defaults.graphics.modules.SolaEntityGraphicsModule<V>
All Implemented Interfaces:
Comparable<SolaGraphicsModule>
Direct Known Subclasses:
CircleEntityGraphicsModule, DebugEntityGraphicsModule, ParticleEmitterEntityGraphicsModule, RectangleEntityGraphicsModule, SpriteEntityGraphicsModule, TriangleEntityGraphicsModule

@NullMarked public abstract class SolaEntityGraphicsModule<V extends technology.sola.ecs.view.ViewEntry> extends SolaGraphicsModule
SolaEntityGraphicsModule adds rendering functionality to SolaGraphics for rendering Entity that have specified Components.
  • Constructor Details

    • SolaEntityGraphicsModule

      public SolaEntityGraphicsModule()
  • Method Details

    • getViewToRender

      public abstract technology.sola.ecs.view.View<V> getViewToRender(technology.sola.ecs.World world)
      Returns a View of Entity that need to be rendered via renderEntity(Renderer, V, TransformComponent)
      Parameters:
      world - the World
      Returns:
      the view of entities
    • renderEntity

      public abstract void renderEntity(Renderer renderer, V viewEntry, TransformComponent cameraModifiedEntityTransform)
      Called on each Entity to render it. A TransformComponent instance with the camera's transform applied is provided for each entity. If an entity has a LayerComponent it will be rendered to its layer.
      Parameters:
      renderer - tbe Renderer instance
      viewEntry - the ViewEntry containing the Entity to render
      cameraModifiedEntityTransform - a TransformComponent with the camera's transform applied to the entity's transform
    • renderEntity

      public void renderEntity(Renderer renderer, V viewEntry, Matrix3D cameraScaleTransform, Matrix3D cameraTranslationTransform)
      Called on each Entity to render it. It calculates a TransformComponent instance with the camera's transform applied which is then passed into the renderEntity(Renderer, ViewEntry, TransformComponent) method. If an entity has a LayerComponent it will be rendered to its layer.
      Parameters:
      renderer - tbe Renderer instance
      viewEntry - the ViewEntry containing the Entity to render
      cameraScaleTransform - the camera's scale
      cameraTranslationTransform - the camera's translation
    • renderMethod

      public void renderMethod(Renderer renderer, technology.sola.ecs.World world, Matrix3D cameraScaleTransform, Matrix3D cameraTranslationTransform)
      Description copied from class: SolaGraphicsModule
      The specific render method for a graphics module that is called once per frame if active.
      Specified by:
      renderMethod in class SolaGraphicsModule
      Parameters:
      renderer - tbe Renderer instance
      world - the World instance
      cameraScaleTransform - the camera's scale
      cameraTranslationTransform - the camera's translation
    • getTransformForAppliedCamera

      protected TransformComponent getTransformForAppliedCamera(TransformComponent entityTransform, Matrix3D cameraScaleTransform, Matrix3D cameraTranslationTransform)
      Utility method for calculating the transform when a camera's transform is applied to another transform.
      Parameters:
      entityTransform - the Entity's transform
      cameraScaleTransform - the camera's scale
      cameraTranslationTransform - the camera's translate
      Returns:
      the resulting TransformComponent