Linking renderables to entities

Started by
0 comments, last by TiPiou 10 years ago

Hi,

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.

Crealysm game & engine development: http://www.crealysm.com

Looking for a passionate, disciplined and structured producer? PM me

Advertisement

HI,

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 !

Follow NeREIDS development on my blog : fa-nacht.rmyzen.net/

This topic is closed to new replies.

Advertisement