About Store Forum Documentation Contact



Post Reply 
GUIViewport with Particles
Author Message
Qbound Offline
Member

Post: #1
GUIViewport with Particles
Hi all,

i try to show some particles in my GUIViewport.

The GUIViewport is a static method of a class (a character selection gamestate). The drawfunction is called by the engine. Via the GuiViewport.user variable i have access to all methods of the class.
The drawfunction therefore only calls my nonstatic method of the class and i now have full access to all things. (like the tipp from my GUI post).

So my problem is that if i want to render the particle nothing happens. The particles are corectly loaded and updated. then in the NonStatic drawfunction of the class i cannot draw them in the RM_BLEND or RM_PALETTE pass of the renderer.

It seem to be that Renderer at this stage do not know in which pass he is.

So the draw line of the particles is not called.

Code:
Box(1,Vec(0,0,0)).draw(WHITE);
switch(Renderer())
    {
    case RM_BLEND  :
    case RM_PALETTE:    m_psysCharacterBackground.draw(); break;
    }

the particle are also not rendered outside of the switch.
but the test box is correctly rendered and the camera works fine.

any tipp?

cu
Oliver
08-03-2010 10:35 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: GUIViewport with Particles
if you're inside gui viewport draw, then you must call Renderer manually, just like Draw and Render in main rendering

example:

void RenderViewport()
{
switch(Renderer())
{
}
}

void viewportdraw()
{
Renderer(RenderViewport);
}
08-03-2010 11:52 PM
Find all posts by this user Quote this message in a reply
Qbound Offline
Member

Post: #3
RE: GUIViewport with Particles
ah ok... thanks for the fast reply. this make sens but brings me to another problem.

the RenderViewport() is a static function and there is no cheap possibility to access my class members and methods. if i am not using a singleton for the class which is not the way to do for a non managerclasses.

so is there a way to give the T or This class pointer to the function like with the _GuiViewport.user (Ptr)?

This will solve some other problems i have too.
If there is no easy way like with the GUI Tipp you gave me then i will post a feature request for that wink

cu
Oliver
08-04-2010 08:04 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: GUIViewport with Particles
all draw and render functions are called only once at a time, in single thread, so you can do like this :


Ptr RenderUserData; // global


void Render()
{
//use RenderUserData
}

void Draw()
{
RenderUserData=xxx;
Rendererer(Render);
RenderUserData=NULL;
}
08-04-2010 10:17 AM
Find all posts by this user Quote this message in a reply
Qbound Offline
Member

Post: #5
RE: GUIViewport with Particles
Many thanks it works now perfect smile
08-04-2010 08:21 PM
Find all posts by this user Quote this message in a reply
Qbound Offline
Member

Post: #6
RE: GUIViewport with Particles
Hi all,

just a small screenshot. The localisation is not finished for this gamestate so that you'll find a mix between german and english.
The progressbar is the normal from esenthel but will be changed to a more medieval style type later.

at the position of the blue cloud you ll find the selected char for the game or the newly created character.

when running you see a blue particle cloud and in motion it gives you a beautiful atmo. And this thread was necessary to get this working smile

cu
Oliver


Attached File(s) Image(s)
   
08-05-2010 09:38 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #7
RE: GUIViewport with Particles
pretty nice wink
08-05-2010 09:40 AM
Find all posts by this user Quote this message in a reply
Post Reply