Commit Graph
100 Commits
Author SHA1 Message Date
Tim Moore 7e7ce2f38e Merge branch 'maint' into next 2009-05-18 00:34:06 +02:00
Tim Moore 006f90997a Merge branch 'maint' into next 2009-03-31 00:04:30 +02:00
Tim Moore 342de209a2 Merge branch 'topic/nasal' into next 2009-02-16 00:48:00 +01:00
Tim Moore ff7e70f4d5 Merge branch 'topic/gcintersect' into next 2009-02-13 10:07:15 +01:00
Tim Moore 950f51909c New getPrimitive function.
This searches for the primitive found in an OSG intersection query.
2009-02-13 09:40:05 +01:00
Tim Moore f86e6d344c Make SGSubsystemGroup::Member copy constructor private.
The copy constructor wouldn't make any sense and would confuse ownership of
the subsystem pointer. Problem noted by John Denker.
2009-02-07 00:37:47 +01:00
Tim Moore 08581282dd Merge branch 'topic/cloudz' into next 2009-02-06 19:16:19 +01:00
Tim Moore e1e47e76ec Turn off z buffer writes for clouds.
This is standard practice for semi-transparent objects and should cut down
on the flickering and other sorting artifacts.
2009-02-06 17:48:23 +01:00
Tim Moore 22c7df5936 Merge branch 'maint' into next 2009-02-04 11:03:20 +01:00
Tim Moore 81a44d1340 Merge branch 'releng/1.9.1' into maint 2009-02-04 11:02:30 +01:00
Tim Moore 589dae7b0c Build trees under a transform note that is rotated to Z-up.
This allows the tree geometry to be shared across the entire scene because it
doesn't need to be rotated for each scenery tile.
2009-01-30 11:18:08 +01:00
Tim Moore 3ff13189aa Don't expand all the trees into display lists.
This can chew up large amounts of memory for questionable gains. We do
let the tree model geometry be in a display list if OSG chooses to put
it there.

Various renaming and cleanup. Save some memory by reverting
ShaderGeometry's base class back to osg::Drawable.
2009-01-30 11:17:02 +01:00
Tim Moore 7151c3fac1 Merge branch 'topic/yontree' into next 2009-01-28 07:53:38 +01:00
Tim Moore 3e023b77dd Merge branch 'maint' into next 2009-01-28 07:53:31 +01:00
Tim Moore 31d9eaf54c Use osg::Geometry code to draw trees ourselves.
This reverts back in the direction of Yon's original patch: the model is
drawn within ShaderGeometry::drawImplementation. This saves a lot of memory
over the previous approach of creating a PrimitiveSet for each model.
2009-01-28 07:43:09 +01:00
Tim Moore 781c445d14 Merge branch 'topic/modelopt' into next 2009-01-23 23:27:48 +01:00
Tim Moore 26a416399f Merge branch 'topic/yontree' into next 2009-01-23 23:27:37 +01:00
Tim Moore f7dc7f039e QuadTreeBuilder: create leaves on demand
This avoids lots of empty leaves.
2009-01-23 19:30:29 +01:00
Tim Moore 3c74fea087 Rewrite ShaderGeometry to use display lists and OSG primitives.
Based on a patch from Yon Uriarte.

Eliminate _trees list from ShaderGeometry

Use the position and scale values that are already available.
2009-01-23 19:29:18 +01:00
Tim Moore be0635bfd3 Optimize empty groups from .ac models
The OSG optimizer seems to have changed since this work was originally done.
2009-01-23 16:11:23 +01:00
Tim Moore 6723ef95c2 Merge branch 'maint' into next 2009-01-19 00:13:07 +01:00
Tim Moore 1a8fd62680 Protect against division by zero in QuadTreeBuilder
This could only happen when there's one leaf in the tree, or all the objects
happen to have the same position. Noticed by Csaba Halaz
2009-01-19 00:04:59 +01:00
Tim Moore 8b57ed46b1 Sort cloud sprites using std::sort, based on projected Z.
A "cleanup" of cloud sorting.
2009-01-16 00:37:40 +01:00
Tim Moore 25c08e56c2 Merge branch 'foo' into next 2009-01-15 22:52:11 +01:00
Tim Moore a47d5536fa Merge branch 'maint' into next 2009-01-14 22:34:20 +01:00
Tim Moore db8f7f21e8 Remove OptionsPusher and manipulation of osgDB dataFilePathList.
The bug it worked around has been fixed in the OSG ac3d loader, and changing
the path list has unpleasant multithreading implications.
2009-01-14 22:13:12 +01:00
Tim Moore 3c312c55f1 Merge branch 'maint' into next 2009-01-14 12:13:44 +01:00
Tim Moore 2d11419cba SGPropertyNode must increment / decrement the reference counter in an aliased
node.

From Csaba Halász.
2009-01-14 12:10:23 +01:00
Tim Moore 07a4508944 Merge branch 'topic/mat-anim' into next 2009-01-13 22:58:45 +01:00
Tim Moore 62913739bb Merge branch 'maint' into next 2009-01-13 22:52:19 +01:00
Tim Moore 55e9d8d944 SGMaterialAnimation: Don't install an update callback if values are static 2009-01-13 15:35:15 +01:00
Tim Moore a9439d58c7 SGMaterialAnimation: factor out update of osg::Material 2009-01-13 13:15:34 +01:00
Tim Moore 62864637a3 Merge branch 'maint' into next 2009-01-12 13:14:31 +01:00
timoore ecf0a1a736 Fix include path 2009-01-08 23:06:23 +01:00
timoore 966b9e5c2b Use a singleton Fog attribute for all 3D clouds.
Don't update this Fog with any kind of update callback; instead, update from
the sky repaint method.
2008-12-10 22:39:48 +00:00
timoore 1625192c81 Use StateAttributeFactory for CullFace and ShadeModel attributes 2008-12-10 22:39:23 +00:00
timoore c5e8c6603c Use Boost singleton template for our singletons 2008-12-10 22:39:02 +00:00
timoore 37e541d326 Render cloud layers with face culling
Also, allow definition of colors for the cloud layer corners for debugging.
2008-12-10 22:38:34 +00:00
timoore 862a827fe6 Add cullFaceFront as a state attribute to the StateAttributeFactory 2008-12-10 22:38:14 +00:00
timoore b96c5c9e4b Render sky with depth test off.
Also, don't set BACKGROUND_BIT for cloud layers.
2008-12-10 22:37:52 +00:00
timoore ae5297e6d7 logstream improvements from Yon Uriarte
Avoid descending into iostream when a message won't be logged.
2008-11-29 00:17:29 +00:00
timoore bad80521a8 Track time in TileCache; assign new tiles the current time 2008-11-24 22:08:31 +00:00
timoore 98cecfe940 Templates for interacting with OSG objects 2008-11-21 14:48:15 +00:00
timoore 2e65538fb5 Template functions and overloaded functions for accessing property values.
These are useful for writing templates that manipulate properties.
2008-11-18 22:16:58 +00:00
timoore cc17cc4af7 Respect precipitation-enable property
From Csaba Halász
2008-10-31 09:46:23 +00:00
timoore 6afd7e1a38 enable world coordinate particle fix 2008-10-30 23:51:41 +00:00
timoore 19aac5b14c Keep non-local particles in a Z-up frame that is periodically moved.
This eliminates jitter and other rendering problems.
For the moment this is dependent on an osg fix.

Also, don't read wind properties from FlightGear; provide a mechanism
for fg to set the wind.
2008-09-11 10:19:05 +00:00
timoore 12495547c4 Don't use osgDB::SharedStateManager::share in SGLoadTexture2D
It is not safe to call this function from the database pager thread;
in any event, state sets and textures created in the database pager
will get passed through the SharedStateManager anyway.
2008-08-29 07:39:05 +00:00
timoore 29aad066f0 pointers in Particles object should be ref_ptr 2008-08-11 08:32:13 +00:00
timoore 74d3bdc68c Return eof after a number of reptetitions of file input. 2008-08-07 22:24:01 +00:00
timoore cf19b81dd4 forward declare osg::DrawElementsUShort for real 2008-07-29 02:54:48 +00:00
timoore 942fa53ed9 Add repeat option to SGFile.
This supports auto-looping over a playback file, for demos and such.
2008-07-19 16:01:20 +00:00
timoore 1729841083 Eliminate empty default constructor for SGReaderWriterBTGOptions 2008-07-19 16:00:58 +00:00
timoore c8c693db53 From Benoit Laniel: replace SG threading constructs with those from OpenThreads
Also, move any static local mutexes up to global level.
2008-06-12 08:14:40 +00:00
timoore 7bc37651c3 add OSGVersion.hxx to VC7.1 project file 2008-06-02 20:26:07 +00:00
timoore 4fe43c3e50 OSG DatabasePager interface change in 2.5.1
Move OSG version macro from FlightGear to simgear
2008-06-02 20:22:16 +00:00
timoore 0826b7c3ca Replace header files istream and ostream with iosfwd 2008-06-02 20:21:50 +00:00
timoore d219c5c4c6 Don't include <iostream> and "using" declarations in header files
<iostream> sucks in expensive initialization of the standard streams
and isn't appropriate in a header file. Use <istream> and <ostream>
instead.

using declarations should never appear at global scope in a header
file; source files get to decide what they want to use in their
namespace.
2008-06-02 20:21:27 +00:00
timoore 367f1813de sg: move most scenery-related code to simgear
From Till Busch
2008-05-14 22:07:50 +00:00
timoore 569a29fbbc Fix new livery code
It turns out that the database pager causes the texture image to be
unloaded after it is applied, so the image and its file name may not
be available for doing the livery substitution. Ask a work around we
set the name of the texture to its file name.
2008-04-24 22:06:06 +00:00
timoore 8f46f2cac8 Rewrite livery texture replacement to copy StateSet objects
Also, add a NodeAndDrawableVisitor that descends into osg::Drawable.

That motivation for this is that it's a bad idea to modify state sets
that the osgDB::SharedStateManager might be keeping.
2008-04-23 18:13:50 +00:00
timoore c7dab4abea rewrite of sky dome code
Add more points to the dome, giving it a dome shape rather than a
dunce cap shape.

Represent as OpenGL DrawElements instead of as triangle strips.

Only calculate have the sky colors and reflect those across the dome.
2008-04-14 21:44:21 +00:00
timoore 9861d74221 Fixes for compiling with gcc 4.3
Include standard header files and qualify with std:: where needed.

Add "const" to various char parameters and variables.
2008-04-13 21:11:44 +00:00
timoore 09fb51189e Change the tile light group node mask to traverse VASI lights too.
The change to set the light group node mask to LIGHTS_BITS caused
VASI/PAPI lights to not be displayed during the day. This patch fixes
that and optimizes VASI creation a bit.
2008-03-24 21:41:30 +00:00
timoore 9dc1b5f6f5 model paging patch from Till Busch
Comments from Till:
I started the project at the end of february with a simple idea: move all
3d-model loading to the DatabasePager-thread. my first attempts looked
promising, though they were a little too optimistic (or naive?). the patch
has evolved a lot since.

currently it does the following things:
1. revive SGModelLib, move functions for xml-model-loading there

2. replace all calls to sgLoad3dModel with calls to either
SGModelLib::loadModel() or SGModelLib::loadPagedModel()
almost all models will be loaded by the DatabasePager. the few exceptions are:
your own plane, shared models in scenery, random objects, AIBallistic models.

3. simplify mode-loading functions (avoid passing around fg_root)

4. avoid supurious MatrixTransform nodes in loaded models

5. fix some memory leaks
2008-03-22 09:30:26 +00:00
timoore c12e6cdc09 rationalize node masks a bit 2008-03-17 08:46:23 +00:00
timoore 6322393782 From Till Busch: use install -p if possible 2008-03-11 13:44:43 +00:00
timoore 6d2f1ff81e cleanup of precipitation contribution
Reindent everything to Stroustrup style and make member variable style
consistent.

Remove unused header files.

SGPrecipitation is now a subclass of osg::Referenced.

Initialize snow and ice intensity to 0 directly. The methods that set
the intensities change the value slowly and so don't work when the
initial value is garbage.
2008-03-04 08:58:33 +00:00
timoore c724e5fb20 precipitation effects from Nicolas Vivien 2008-03-04 08:54:00 +00:00
timoore 600726976c Add methods to SGGeod to return OSG Matrix objects for local frames.
Methods have been added for Z down (simulation) and Z up frames.
2008-03-04 08:53:27 +00:00
timoore ac4245013f Cleanup of particles contribution
Put particles classes inside simgear namespace

Refactored some redundant code

Reworked local frame math to use OSG math classes as much as possible
2008-02-15 06:44:24 +00:00
timoore b09e484492 particles from Tiago_G 2008-02-15 06:44:05 +00:00
timoore dc63ddb010 Small cleanup of tree shader 2008-02-07 23:01:32 +00:00
timoore 09778a8eab Minor cleanup of Stuart Buchanan's tree patch.
Separate random objects and random trees for real.
2008-02-07 23:01:16 +00:00
timoore 8cbe9f1bd0 Second trees patch from Stuart Buchanan
Adds random variation of tree texture maps
2008-02-07 23:00:23 +00:00
timoore be61689458 Cleanup and performance tuning of the random trees code.
The QuadTreeBuilder class was completely revamped as a templated class
to support flexible creation of scene graph quad trees, and a major
bug was fixed as well. Now it actually generates quadtrees instead of
some weird striped thing.

One StateSet is shared among all the "forests." The trees are drawn
after normal terrain objects to minimize some of the transparency
related artifacts.

Lighting was implemented in the ShaderGeometry shader (for both
polygon sides). Ambient-diffuse values for trees are hard-coded in
TreeBin.cxx.

DotOsg wrappers were added for ShaderGeometry so it can be output in
the scene graph dump.
2008-02-02 23:01:27 +00:00
timoore 4b63bc051e Random trees from Stuart Buchanan
Stuart's new file SGTreeBin.hxx has been split into 4 files:
TreeBin.[ch]xx and ShaderGeometry.[ch]xx.
2008-02-02 23:01:05 +00:00
timoore a098ba5e79 Memory leak fixes from Till Busch 2008-01-24 23:05:18 +00:00
timoore 0c9013e60e fix memory leaks in random object code
Don't allocate mt structures (for the random number generator) on the heap.
2008-01-17 08:28:15 +00:00
timoore 605125c0e7 Random object support from Stuart Buchanan
In addition to Stuart's changes, there's an independent quad tree
builder class for constructing loose quad trees from scene graph nodes.

Stuart also implemented changes to the random number generator suggested by
Andy Ross.
2008-01-06 15:04:43 +00:00
timoore 4383fd3c45 Give the sky a BACKGROUND_BIT nodemask
Add a MODEL_BIT and tag clouds with that.

Remove vestigial post_root from sky code.
2008-01-04 07:33:42 +00:00
timoore b6be76b0ab background node mask 2008-01-04 07:33:23 +00:00
timoore 94be52886e Pass ReaderWriter options to SGMaterialAnimation
It needs to grab the path list from options in order to support the texture
change animation.
2007-12-23 23:33:04 +00:00
timoore 6646aa5644 Fix tiny bugs in sun constructor and repaint code 2007-12-22 23:01:36 +00:00
timoore d556eba296 Add StateAttributeFactory files to VS project file 2007-12-21 06:29:36 +00:00
timoore a5b573b2d3 optimize groups from .AC file optimizer run 2007-12-21 06:25:40 +00:00
timoore 18d30ea8fa Repaint 2D cloud layers using texture combiner
Don't change the color in the cloud layer geometry
2007-12-21 06:25:13 +00:00
timoore 4324ffccf4 Fix cloud layer - point lights visibility issue
Move point lights to render bin 8, clouds to render bin 9. Turn on
AlphaFunc for cloud layers.

Create a StateAttributeFactory object to create and share common state
objects.
2007-12-21 06:24:53 +00:00
timoore 68c1cfed46 Use node masks and shared state sets to manage ground lights
Do away with the switch in each terrain tile for the ground lights. They are
turned on by node masks now.

Share state sets among all the light nodes and manage the fog values through a
"GroundLightManager" instead of having separate state sets and callback
functions for each group in each tile.
2007-12-13 23:30:24 +00:00
timoore 1159784538 minor fix to ModelRegistry and syntax changes for Windows
Create the local path in the right order in OptionsPusher. When
OptionsPusher is used, put it inside a new code block so the order of
destruction with respect to the mutex on reader functions id clear.

Add #include <algorithm> to top of ModelRegistry.cxx.

Change include syntax in PathOptions.cxx
2007-12-11 11:07:21 +00:00
timoore e683b5fdec Check for null options before changing path in registry 2007-12-10 08:30:43 +00:00
timoore 3c409c5070 Work around osg Registry path list problems
The OSG reader plugins overwrite the path list passed in options with the local
directory of the file being read, forcing you to set the path list in
the Registry. I think this a bug, but in the meantime here's a workaround.
2007-12-09 22:38:10 +00:00
timoore 4b7361dfe7 Add operator!= to SGBucket 2007-12-07 23:35:04 +00:00
timoore 037d5c11a5 Add option to SGLoadTexture2D to load dynamic textures 2007-12-07 09:13:34 +00:00
timoore 4efa087cd1 Don't modify OSG Registry with file path
To set a path when loading model files, use an osg ReaderWriter::Options object.

Put locks in ModelRegistry::readNode and ModelRegistry::readImage to avoid
conflicts when files are loaded from both the pager and the main thread.
2007-12-04 22:38:40 +00:00
timoore fdb265cd6e Change the main ModelRegistry callback function to stash the substituted file in the cache. 2007-11-29 23:56:49 +00:00
timoore 34704a17f2 Avoid copying drawables and dirtying display lists.
For the alpha-test animation, use an OVERRIDE attribute on the state
set of the top level node instead of copying drawables and state sets
throughout the model.

As a temporary hack in the blend animation, don't use display lists in
the cloned drawables.

These changes are aimed at cutting down the number of display lists
that the pager needs to compile.
2007-11-29 23:56:31 +00:00
timoore 4a959ec2fd rewrite ModelRegistry callbacks as a template with pluggable policy classes
In a big effort to improve use of the object cache, provide a
ModelRegistryCallback template class with different policies for
substitution,  caching, optimization, etc.

Change SGTexDataVarianceVistor to make StateSets static too.
2007-11-29 23:56:09 +00:00
timoore f182886fce Start of cleanup of scene graph node masks 2007-11-29 23:55:35 +00:00
timoore 2fbaddbecf Move SGReadFileCallback from model.cxx to public class ModelRegistry
Move SGReadFileCallback and all its help classes into a new
ModelRegistry class that also provides an interface to add custom
callbacks for specific file extensions. SGReaderWriterBTG uses that to
keep any further processing from being done on .btg files. Various
namespace-releated cleanup was done on this code too.
2007-11-29 23:55:01 +00:00