PDA

View Full Version : changing scenes



xbass
10-27-2004, 09:35 AM
hi again!!all of you are so great that i post questions from the past months, every day.i now found out the site and it is very cool!!!
i want to make a scene where things happen: rotations movements e.t.c and then after a while change the scene and render an other one totally new(yes like a demo :eek: )))) and continue that way.
thanks ...

Aeluned
10-27-2004, 10:57 AM
what is your question exaclty?

overcode
10-27-2004, 11:02 AM
Hmm, that should be nothing more than removing geometric data A and replacing it with geometric data B, perhaps after a certain amount of time has passed? I'm not sure what you mean by "changing scenes" because all you really need to do is change your geometric information and you'll have a new scene. Something like (just an example):

start demo
-render first scene
-after certain amount of time
--clear first scene
--load next scene

Is that what you mean?

zukko
10-27-2004, 12:53 PM
use
start = GetTickCount();

when the demo starts, then on your scene's use:

end = GetTickCount();

then :

elapsed=(end-start)/1000;

that will get you the amount of seconds from the begining to the actual time, on your main drawing scene you can do something like:

if(elapsed>=160) //160seconds from the begining
scene3();
else if (elapsed>=80) //80seconds from the begining
scene2();
else
scene1();

to switch between scenes,

xbass
10-28-2004, 05:29 AM
i was asking exactly what zukko answered good people out there!!!
thanks a lot one more time...now i have a lot of coding to do. may the main() be with you

Aeluned
10-28-2004, 05:45 AM
zukko's method will certainly work. For your application this may be the way to go. However one thing to be aware of is that this approach requires a seperate function for each scene you want to generate (or some other method of branching).

In a scenario where scene changes are not so out of the ordinary, a scene graph should be used.
This is basically a structure that maintains a list of all objects in your scene. You could update this list of objects rather than writing a seperate render function for each scene.

this way you make one call to SceneGraph::Render() and the scene graph iterates through its list rendering all objects in your scene.

if you want to change the scene, you simply load a different list of objects into the scene graph.

zukko
10-28-2004, 12:49 PM
glad to serve!