I just discovered this : state() is not valid when _level==0,
because it is doing:
{ return _state_stack[_state_stack.size() - 1]; }
and is returning a wrong index fetch ( 0 - 1 ) == -1
Moreover, st is not used when _level==0 so the line can be moved
to a safer place.
If we pass in a position or velocity of nan, openal will generate an assertion.
Under rare circumstances we could encounter a non-cooperative external fdm
that could trigger this condition. This patch catches the problem and returns
rather than letting FG get killed.
ehofman [Sat, 12 Jun 2004 21:03:45 +0000 (21:03 +0000)]
Frederic Bouvier:
Do state sorting by material before adding primitives
in the tile branch. I thought I could see a bit of
improvement in framerate but it is not the case on my setup.
I don't see a degradation though
ehofman [Mon, 7 Jun 2004 18:49:32 +0000 (18:49 +0000)]
Frederic Bouvier:
I am still experimenting with the
code. Here is so far the best I could achieve. The
dark aspect of clouds at dusk or dawn is far better
than the problems of transparency of the previous
version.
ehofman [Thu, 27 May 2004 13:03:01 +0000 (13:03 +0000)]
Add the possibillity to parse a user data pointer to getter and satter functions. This adds a convenient way to get the 'this' pointer to the static functions.
ehofman [Thu, 20 May 2004 14:18:15 +0000 (14:18 +0000)]
Frederic Bouvier:
Melchior spotted a problem where we can crash an airplane into the
beacon's beam. The patch below enable to mask out a branch from HOT
traversal, whatever the animation.
The beacon.xml file is also included. It has a
<enable-hot type="bool">false</enable-hot> in a halo branch
curt [Tue, 11 May 2004 22:21:24 +0000 (22:21 +0000)]
Frederic Bouvier:
I was not very happy with the size of the halo, so
I created a new animation to control it. Now we can
control the scale value with the distance from the
viewer to the object. The towers are now beginning to
look good. They might need some tuning though. If
you want to play, locate in radio-*.xml this code :
You get the idea ? ind is the distance, dep is the
resulting scale value.
The medium tower appears brighter than the tall one,
because the lights are closer to each other. Maybe
they need a smaller scale factor at distance. Feel
free to modify these values if you find a better
setup.
About the code : I renamed flash to custtrans because the
ssg branch is now less specialized. It needs a callback
to compute the so called 'custom transformation'. It can
be used for the SGFlashAnimation and the new
SGDistScaleAnimation. So please cvs remove flash.[ch]xx and
add custtrans.[ch]xx. I also undo some of the code I send
you yesterday that was totally useless. It is replaced by
something simpler and that works.
There is also a patch to matmodel.cxx. This is not related
and was something I forgot. Its purpose is to set the
alpha test on material billboard models that are likely to
be trees to lessen a transparency weird effect with clouds.
curt [Mon, 10 May 2004 20:27:30 +0000 (20:27 +0000)]
Frederic Bouvier:
I modified the included animation.cxx to have a randomly displaced
time origin, to break the unison. And the flashing period is also
random as you noticed. I also put all the flashing light of the pole
in the same animation so they flash in the same rhythm.
curt [Mon, 10 May 2004 14:59:02 +0000 (14:59 +0000)]
Frederic Bouvier:
Fix a memory leak, and brownian animation, if not motion.
I have 2 new files : personality.[ch]xx . They store the personality
data that would be deleted when the object is destroyed, instead
of staying in the animation maps. I also manage the current animation
step better and the towers are not flashing randomly now.
Makefile.am is updated.
curt [Mon, 10 May 2004 14:35:58 +0000 (14:35 +0000)]
Frederic Bouvier:
modellib.cxx :
Add a branch between the model and its transformation to add
a unique identifier for the model. I called it "personality
branch" and it maintains a "current_object" in SGAnimation.
Animations specifically written to support it ( currently only
the timed animation ) can add a degree of variety among the
occurrences of the same model that would look otherwise cloned.
flash.[ch]xx :
Better compute the view vector. The flash is now syncronized with
its axis even at the edge of the screen.
animation.[ch]xx :
Lots of changes :
- add a condition to 'rotate', 'spin', 'translate' and 'range'.
When a condition is specified *and* it evaluates to false, the
animation becomes a no-op. Possible usage : no rotation during
daylight, LOD range variable along the day, ...
- use different durations for each branch in the timed animation.
Enable the use of multiple <branch-duration-sec>, one for each
<object-name> specified. Usage : strobes with flash light.
- allow randomization of the <branch-duration-sec>, by using
<random><min>_min_value_</min><max>_max_value_</max></random>.
The value computed once is between _min_value_ and _max_value_.
- implement model personality in timed animation. If
<use-personality type="bool">true</use-personality> is specified,
a different set of duration is created for every model in the
scenegraph using this animation. Best if used with randomization.
When using strobes where the population of the same object is
dense, it avoids the "cheasy" clone effect.
ehofman [Fri, 7 May 2004 16:42:59 +0000 (16:42 +0000)]
Frederic Bouvier:
this patch introduce a new kind of animation and ssg branch.
I called them flash animation, because they help me to
enhance the look of the rotating beacon and possible future
lighthouse. It computes the cosine of the angle between an
arbitrary axis, transformed by the current modelview matrix,
and the view direction. No trig involved, just a dot/scalar
product.
The computed value can be modified by three parameters,
power, factor and offset, according to the formulae :
value = factor * pow( cosine, power ) + offset.
It is clamped between a minimum and a maximum.
This value is then used as the scale factor of a matrix
transformation applied to the children of the SGFlash
branch.
andy [Fri, 30 Apr 2004 00:44:04 +0000 (00:44 +0000)]
Changes to get SimGear to configure and compile out-of-the-box on
a MinGW target:
Link against alut.dll in addition to openal32.dll.
Remove some preprocessor defines from compiler.h that were
confusing the mingw and/or libstdc++ headers (I put the _isnan
one back in the only file it was used).
Hack a broken sleep() call into the OpenAL sample programs so
that they will compile (but not work) in a non-POSIX environment.
Change the header file ordering in sample_openal.hxx to get
around some really weird interactions between MinGW's windows.h
and the gcc iostream header.
Add support for specifying a positional offset relative to the listener.
This allows us to "place" cockpit sounds. For example, we can make left
engine sound come out of the left speaker, right engine out the right
speaker, etc.
Expose the ability to specify how the sound volume fades relative to
distance from the listener. This let's us configure "interior" cockpit
sounds versus "exterior" engine type sounds.
Rewrite the entire audio support library on top of OpenAL rather than plib's
sound manager. The interface was simplified and cleaned up a bit, and I
haven't back ported these changes to the plib sound wrappers ... we could
I suppose if someone really had a problem, but I haven't seen anything so
far that would indicate the extra effort is worth it.
gcc 3.4 has changed the rules for unqualified template name lookup. This
affects SGQueue.hxx. The changes I've made are backwards compatible with
earlier gcc versions. Everything else compiles pretty much okay except for a
few warnings. The resultant executable seems a bit faster too.
This is a new patch that allow to define a different
texture for top and bottom of clouds. It uses the
overcast_top.rgb you made for me last time.
What the patch do is to install a ssgStateSelector
instead of a ssgSimpleState for each layer.
The SGCloudLayer::draw method is modified to accept
a boolean that will select the proper state: 0/false
for bottom, 1/true for top.
Then, in SGSky::drawUpperClouds and SGSky::drawLowerClouds,
SGCloudLayer::draw is called with false and true because
we see the bottom of upper clouds and the top of
lower clouds.
Only overcast has 2 textures, the other types share the
same state for top and bottom, but that could be modified
in SGCloudLayer::rebuild.
put all leaf is a seperated branch so that it is
possible to use a pretrav callback to cull out
terrain without culling out light or dynamic
objects. It appears that plib is not calling the
pretrav callback for leaves.
add an optional parameter that would be called to
build the aircraft panel, so that flightgear's
model_panel no longer duplicate code.
add a pretrav callback to models so that we can
filter out models when calling ssgCullAndDraw on
the global scene.
sgSetModelFilter( true ) means that we want to draw
the models. Use false to cull them out.
andy [Tue, 23 Mar 2004 00:42:56 +0000 (00:42 +0000)]
Fix GC interaction. The "me" reference to a method call was being
popped off the stack in a situation where it could be garbage
collected. I believe this is the source of the spurious "non-object
have no members" bug that has been reported.
ehofman [Sat, 20 Mar 2004 22:41:40 +0000 (22:41 +0000)]
Frederic Bouvier:
The message 'Alert: catching up on tile delete queue'
comes from the fact that 48 tiles are scheduled and
added to the cache at startup before the plane location
is initialized. My proposed patch is to initialize
SGLocation with an invalid position and detect this
fact before scheduling tiles. I prefer to do that
rather than testing for lon and lat being 0,0 because
it is a valid position and someone could want to fly
near Accra.
ehofman [Sat, 20 Mar 2004 22:38:13 +0000 (22:38 +0000)]
Frederic Bouvier:
This patch is for windows only. It hides the console window
until there is a message to print. It only support SG_LOG,
that I think is the right way to display something in FG.