1
0
Fork 0
Commit graph

173 commits

Author SHA1 Message Date
curt
f54302e9e9 Begin work on improving runway lighting infrastructure. 2002-10-09 03:40:23 +00:00
curt
e74c4d9437 Oops, I had my lighting tris wound the wrong way. 2002-10-08 22:25:41 +00:00
curt
cf96178ea8 Misc clean ups. 2002-10-06 04:27:24 +00:00
curt
c162577340 Begin work on rendering runway lights using environment maps. The basics
are now working.  A runway light is defined by a point and a direction.  The
point and direction are combined with the local up vector to create a small
triangle orthogonal to the direction.  The two ficticous corners of the
triangle are given an alpha value of zero, the orignal corner is given an
alpha of one.  The triangle is drawn in glPolygonMode(GL_FRONT, GL_POINT)
mode which means only the corner points are drawn, and since two have alpha=0
only the original point is drawn.  This is a long way to go to draw a point,
but it ensures that the point is only visible within 90 degrees of the light
direction, behind the light it is not visible.  This is still a long way
to get to drawing a point, but we use an environement map, with the direction
vector as the normal to mimic a light that is brightest when viewed head
on and dimmest when viewed perpendicularly or disappears when viewed from
behind.

- warning, there is a bug in how the current runway light direction vector
  is calculated which will adversely effect runway lighting.  The airports
  should be regenerated in order to fix this problem.
2002-10-06 03:53:19 +00:00
david
ee6f6ecf61 Turn the runway lights on during the day when visibility is less than
5000m (about 3SM).
2002-10-04 00:23:40 +00:00
curt
c5f7f15f5b Updated from Norman to hack on clouds ... some progress. 2002-09-18 14:57:20 +00:00
curt
f8abc6d848 Fixed: When you select Menu->Autopilot->Set Heading nothing happens. 2002-09-11 16:51:23 +00:00
curt
2da005377e Fix a typo that could cause a crash on some platforms. 2002-09-07 14:15:10 +00:00
curt
4f00d9a959 Tidy up the autoconf/automake configuration a bit.
- Removed some old cruft.

- Removed some support for older versions of automake which technically was
  correct, but caused the newer automakes to squawk warnings during an
  initial sanity check (which isn't done very intelligently.)

  NOTE: this fix is technically not correct for older version of automake.
  These older version use the variable "INCLUDES" internally and could have
  them already set to an important value.  That is why we were appending
  our values to them.  However, newer versions of automake don't set this
  value themselves so it is an error to append to a non-existant variable.
  We seem to "get away" with overwriting the value on older versions of
  automake, but if you have problems, consider upgrading to at least
  automake-1.5.
2002-08-25 19:40:04 +00:00
curt
1b197dd8bf Bernie Bright:
Here are some changes that gave me a significant frame rate increase of about 10 fps with random objects disabled.  The interesting thing is that these changes aren't in the main loop but are in tile loader.  My guess is that I've reduced the memory footprint just enough to reduce CPU cache misses, though I have no hard evidence of this.

Initially I modified all SGBinObject member functions to pass/return by reference instead of by-value.  This gives little or no speed up but allows for some optimizations in fgBinObjLoad().  It is these changes that reduce the number of memory allocations.  Needless copying of vectors, and vectors of vectors, can be very memory intensive, especially if they are large.

Anyway I would be interested to see if you get similar results.  I would emphasize that the frame rate increase only occurs with random objects disabled.  I lose about 10-15 fps on my GF2MX 32MB with random objects, probably a fill-rate limitation or texture memory thing.
2002-08-23 19:53:48 +00:00
david
47b4dcd65f Random-object and -light placement optimizations from Norman Vine. 2002-08-08 23:09:02 +00:00
david
0ebe8ec8f0 Removed the FG3DModel class and replaced it with fgLoad3DModel.
Animations are now contained within the scene graph itself and are
updated whenever the graph is traversed -- that saves time by not
updating animations not currently in sight, and it allows animations
to be used for static objects and random objects as well.

Added new FGModelLoader and FGTextureLoader classes.  These are intern
tables for models, to guarantee (mostly) that no model is loaded more
than once.  FGTextureLoader is not yet used anywhere, but
FGModelLoader is now in place everywhere that ssgLoad* used to be
used (thus adding the ability to use animations).

In the future, FGModelLoader will add some interesting functionality,
including the ability to reload 3D models on the fly.
2002-08-07 01:34:49 +00:00
david
f253425973 Detabified for Norman Vine. 2002-08-05 20:14:28 +00:00
david
67fc66f82e Improve the random seed calculation slightly. 2002-08-04 19:10:13 +00:00
david
4cb99e05ad Patch from Dave Luff:
Your 3D models cause a stackdump when the base is separate from the
root.  I've attached a patched newmat.cxx - you may want to test it
before committing!
2002-07-31 18:44:30 +00:00
david
a5f251a5de Patch from Erik Hofman:
I changed the code such that textures terrain also takes ambient,
diffuse, specular and emissive from the materials.xml file.

[note from dpm: doesn't seem to work yet]
2002-07-31 17:57:59 +00:00
david
43d89cb8d6 Create a top-level branch in each tile for random objects with the
name "random-objects".

Put the random objects for each tile inside a top-level
ssgRangeSelector with a maximum range of 20km.  This saves a lot of
range tests for distant tiles, and gives about a 10% framerate boost
on my card at 1000ft AGL (possibly more on faster cards).
2002-07-27 14:29:57 +00:00
curt
f1eddc9bf4 No need to additionally ref() subcomponents of a tree. Only the root node
needs to be ref()'d.
2002-07-26 23:27:53 +00:00
david
f05e8f95e2 Some renaming, since there wasn't really a tile-level LOD. 2002-07-26 22:12:29 +00:00
david
8244b210fa Give up on the idea of using a singleton dummy bounding sphere;
instead, use a separate dummy bounding sphere for each triangle and
each tile, with the actual bounds, to make sure that objects are
always added when they should be in sight.
2002-07-26 19:06:29 +00:00
david
c33c58476e Load models before counting them. 2002-07-26 19:04:40 +00:00
curt
94b6d4fed5 Oops, remove some unwanted debugging output. 2002-07-26 17:00:18 +00:00
curt
8c7fe4c328 Fixed some signed vs. unsigned warnings. 2002-07-26 16:54:40 +00:00
david
d86a513997 Fix random seeds to avoid coincident objects but still ensure
consistency.
2002-07-25 20:30:51 +00:00
david
e7e576055f Added a new range-selector layer above each tile. That way, by
default, each tile has only 3 extra SSG nodes unless it falls into
range.
2002-07-25 17:32:31 +00:00
david
140774b1e2 Renamed /sim/rendering/dynamic-objects to
/sim/rendering/random-objects, and changed the default from false to true.
2002-07-20 23:11:27 +00:00
david
3f174a15cd Added more documentation. 2002-07-20 23:10:42 +00:00
david
ab91bbe17a More efficient version of get_bounding_radius from Norm Vine. 2002-07-20 19:23:44 +00:00
david
d6f9038a25 Enforce a sane minimum of 1000m for coverage, to avoid run-away object
placement.
2002-07-20 18:41:17 +00:00
david
29268401b2 Randomly-place object overhaul and enhancements
-----------------------------------------------

Fixed a segfault on exit.

Changed the radius of the dummy bounding sphere from 10m to 1000m to
ensure that FOV culling doesn't leave anything out.

Allow an object to have more than one variant model, which will be
chosen randomly.  Simply repeat the <path>...</path> property.

Removed the <billboard> property and replaced it with <heading-type>,
which can be set to "fixed" (leave the model oriented as it is),
"random" (give the model a random heading between 0 and 359 deg), or
"billboard" (always turn the model to face the camera).  The default
is "fixed".  Models look much better when they are not all facing the
same direction.

Allow the user to group models with the same visual range, so that
there can be *many* fewer nodes in the scene graph when the models are
not visible.  This causes an XML-format change, so that instead of

  <object>
   <range-m>...</range-m>
   ...
  </object>
  <object>
   <range-m>...</range-m>
   ...
  </object>
  ...

we now have

  <object-group>
   <range-m>...</range-m>
   <object>
    ...
   </object>
   <object>
    ...
   </object>
   ...
  </object-group>

Every object in a group can still have its own model(s), coverage, and
heading-type, but they all share the same range selector.

This change should already help users with tight memory constraints,
but it will matter much more when we add more object types -- for
example, we can now add dozens of different urban building types
without bloating the scene graph or slowing down the LOD tests for
tris that are out of range (i.e. most of them).
2002-07-20 14:56:37 +00:00
david
cecedd302b Moved object information into a new subclass of FGNewMat, and changed
the property name from coverage to coverage_m2.
2002-07-20 01:51:27 +00:00
david
c814eb3a1e Make objects appear more smoothly and reliably. 2002-07-18 19:16:47 +00:00
david
4ab343569f More efficient rotation matrix calc from Norm Vine. 2002-07-18 15:54:21 +00:00
david
f4cfe4c207 Significant speedup for randomly-placed objects, by taking better
advantage of ssg Frustum culling.
2002-07-18 13:23:29 +00:00
david
f7a17c9020 Modifed random-object code for more memory efficiency:
1. Only one copy of each object (and its texture) is stored in memory,
   no matter how many materials use it.

2. Random objects are added to a triangle only when the objects are in
   range, and they are deleted as soon as the objects are out of
   range.  That way, only a relatively small number of ssg nodes are
   used at any one time.

This patch seems to eliminate freezes when tiles are freed.  There are
occasional stutters at extremely high speeds (i.e. over 3,000kt), but
it seems smooth enough for normal aviation speeds.
2002-07-18 01:04:08 +00:00
david
cc8567ad63 More functional decomposition and documentation. 2002-07-17 22:11:13 +00:00
david
5d2c640f1a Fix some minor inconsistencies and inefficiencies:
- no extra nodes are created at all if the material has no random
  objects defined

- the range selector is place correctly under the transformation

- there is only one range selector for each object type in each
  triangle (experimental -- doesn't seem to make a difference in speed
  or memory)

This patch removes Curt's patch that randomized ranges slightly, since
individual random objects no longer have their own range selectors.
It also leaves the object-group-range value unused, for now.
2002-07-17 21:00:54 +00:00
david
f71f4cf9ab Started functional decomposition for dynamic objects.
Fixed typo in last patch, where objects were using object_group_lod
rather than object_lod.
2002-07-16 23:39:53 +00:00
curt
8dc38a5198 put a separate LOD node in front of ever random object so we can randomize
the exact pop in location of each object ... this allows us to put some objects further out and perhaps hide the popping just a tiny bit?
2002-07-16 20:43:40 +00:00
david
84fcb479f6 Added support for dynamically-generated scenery objects. Set the
property /sim/rendering/dynamic-objects to true to enable them.
2002-07-15 18:16:20 +00:00
david
f3eafe1007 Property patches from Frederic Bouvier:
The FlightGear patch is to take account the change in the getChildren
function that now returns a vector<SGPropertyNode_ptr>. If the
removeChild functionnality is to be added in FlightGear, all those
SGPropertyNode * floating around should be changed to
SGPropertyNode_ptr.
2002-05-11 00:59:26 +00:00
david
56473dc28d Mac OS X fixes and MSVC warning fixes from Jonathan Polley. 2002-05-10 23:35:06 +00:00
curt
cf146a7d1b Fix a couple "make dist" problems that crept in since the last release.
Regengerate msvc project files.
2002-04-21 05:51:37 +00:00
david
5b2df63f54 Patches from Melchior Franz:
The first hunk might not be necessary, but the light_coverage property
was the only one that wasn't explicitly defaulted, which is unfair.  ;-)
   The second hunk adds the missing initialization to the init routine.
This is necessary, because (unlike the material entries from material.xml)
the generated light entries don't get the light coverage set. Yet
obj.cxx:795 reads this information out fot every leaf, although not needed
in the case of lights. Avoiding this isn't worth the trouble.
   The last hunk sets the missing normal_index. The POINTS branch in
gen_leaf was always called with this int_list empty, which made the normals
handling use data garbage.
2002-03-26 16:10:53 +00:00
david
f65f1800c7 Use !strcmp for all property name comparisons. 2002-03-20 22:23:10 +00:00
curt
99fa3a6e79 Various Irix cleanups.
Float/Double clean ups for fg_sound.cxx
2002-03-20 15:57:31 +00:00
david
0cc3bed841 Major property-manager rewrite, using const char * throughout
interface instead of string.  This will result in a lot more
efficiency later, once I add in a simple hash table for caching
lookups, since it will avoid creating a lot of temporary string
objects.  The major considerations for users will be that they cannot
use

  node->getName() == "foo";

any more, and will have to use c_str() when setting a string value
from a C++ string.
2002-03-19 17:12:13 +00:00
curt
3bf7269174 Initial revision. Things are just beginning to be stubbed in now. 2002-03-17 00:37:22 +00:00
curt
ac99a82b98 Replaced some debugging structure David inadvertantly removed. 2002-03-16 05:12:26 +00:00
david
d0eaafb1e1 Patches from Tony Peden to separate property XML I/O operations into a
separate header file.  This change will help integrate properties into
JSBSim.

Also, I (David Megginson) removed most of the SimGear include
statements from globals.hxx, reducing the amount of recompilation
every time SimGear changes.  This required making minor changes to a
lot of files that were depending on the side-effects of the inclusions
in globals.hxx.
2002-03-16 00:18:38 +00:00