Skip to main content
1 of 2
Papi75
  • 103
  • 1
  • 7

Entity system and rendering types

I would like to implement entity system in my game and I've got some question about entity system and rendering.

Currently, my renderer got two types of elements:

Current design

  • Mesh : A default renderable with a Material, a Geometry and a Transformable
  • Sprite : A type of mesh with some methods like "flip" and "setRect" methods and a rect member (With an imposed geometry, a quad)

This objects inherit from "Spacial" class.

Questions:

  • How can I handle this two types in an entity system?
  • I'm thinking about using "MeshComponent" and "SpriteComponent", but if I do that, an entity could have a Mesh and a Sprite at the same type, it's look stupid, right?

I thought the idea to have a parent "rendering" component : "RenderableComponent" for "MeshComponent" and "SpriteComponent" but it will be difficult to handle "cast" in the game (ex: did I need to ask entity->getComponent or SpineComponent, …)

Thanks a lot for reading me!

Papi75
  • 103
  • 1
  • 7