The Fountain + Simulated Water Sample
Keys to use
1-7 | Re-initialize scene with another shape of the fountain |
w,s | move camera forward/backward |
a,d | turn camera right/left |
r,f | move camera up/down |
x,y | turn camera up/down |
c,v | strafe left/right |
Esc | Exit |
How does it work?
The classes CCamera and COGLTexture are described in tutorials on
www.codecolony.de/OpenGL
The files vectors.h/.cpp provide help with vector maths.
The class CPool was made from my SwimmingPool example (also on CodeColony).
The class CAirFountain was made from my Fountain Tutorial (online, too).
Changes in those classes:
Fountain gets a "Pool Pointer". Each time a drop falls into the water
(y < 0) I search for the pool's oscillator which is closest to the
drops position. This oscillator is put down a bit (y-value is decreased).
When a fountain has many drops, a whole pool area is often put so strongly
down that it is below the bowl and becomes invisible! This is unrealistic
anyway, so the "AffectOscillator" method does not allow to put an oscillator
too deep. The corresponding line of code should be replaced when using
the pool for other purposes.
The pool has a kind of damping (which is not physically correct). Otherwise
the waves would become too strong after a while.
The method "RenderBowl" is not very interesting - it simply renders a bowl!Here you can find the downloads to this document.
Back
**************************************************************************
Any comments? Conact me!
philipp.crocoll@web.de
www.codecolony.de