Jump to content

  • Log In with Google      Sign In   
  • Create Account


Linking renderables to entities


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 cozzie   Members   -  Reputation: 1593

Like
0Likes
Like

Posted 01 April 2014 - 02:08 PM

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.


Edited by cozzie, 01 April 2014 - 02:09 PM.


Sponsor:

#2 TiPiou   Members   -  Reputation: 184

Like
0Likes
Like

Posted 02 April 2014 - 01:43 AM

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 !


Edited by TiPiou, 02 April 2014 - 01:54 AM.

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





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS