Jump to content
  • Advertisement
Sign in to follow this  

Linking renderables to entities

This topic is 2024 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts


I've reached the point that am acceptably satisfied with the rendering part of my 3d engine.

The next step is addind the posibility to insert entities in my 'scene', meaning game objects.


As a start I'm first going to add some random spheres which the player can shoot, after which they should be removed from the game entities list.


For rendering I currently load the whole scene and all it's meshes at startup, the renderqeue is created afterwards (one time) based on the scene contents.


My questions;

- I plan to have a pointer in the GameObject class, to the corresponding mesh instance (containing renderables).

That way I can control entities and their visibility for rondering, through the GameObjects. Is this the way to go?


- Would you simply update the full list of renderables after an entity is inserted or removed, or would you keep a separate renderqueue for game objects which will be inserted/ removed frequently? (the 1st means updating the whole renderqueue each time, including static world mesh instances/ renderables, sorting on materials, shaders etc.).


To be honest I need some pointers on where to start and what principles would be good to follow.

Any hints on articles on this are also really appreciated.

Edited by cozzie

Share this post

Link to post
Share on other sites


I'm far from an expert on the matter, but since you got no answer yet, maybe those hints could help :


You say you'll add only spheres at first. That sphere mesh is a good example of a mesh that is shared across multiple instances of your game objects.

In my mind all you have to do is iterate over your active GameObject instances, and ask their mesh (which you get from a pointer in your GameObject class, yes, why not, and which at the moment would all point to the same sphere mesh), to render, setting up a different world position (which could be known by the GameObject themselves) each time. To be honest I'm not too familiar with that renderqueue concept, does it prevent you from applying that simple approach ?

A more sophisticated approach would update a list of all world position matrixes for GameObjects that have that same sphere as a mesh, and use this info for instanced rendering, but even that list should be totally decoupled from other things like your static environment mesh and stuff, right ?


You'll eventually get to the point where you have different types of meshes to render instead of a single sphere, but the principles stays the same imho : at first, keep every distinct mesh "type" loaded, and simply decide based on what entities exist in your scene, where to display those meshes.


By the looks of it, deciding whether you need a more dynamic approach to resource loading should come later in your development, I would say.


Take care !

Edited by TiPiou

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!