Commit Graph

9102 Commits

Author SHA1 Message Date
Robert Osfield
77370910e2 Added ShaderGen wrapper 2009-03-23 15:10:36 +00:00
Robert Osfield
6b9cd89912 Removed PrintVisitor as it was causing problems with wrapper building. 2009-03-23 15:04:33 +00:00
Robert Osfield
3965bf8dd6 From Eric Sokolowsky, "osgviewer (and all other OSG-based utilities) fails to provide help for the OSG_NOTIFY_LEVEL environment variable. This submission fixes that problem." 2009-03-23 13:51:46 +00:00
Robert Osfield
1fd5eefbcf From Maciej Krol, "As promised to Roland I assembled simple shader generator. ShaderGenVisitor converts accumulated fixed function pipeline state sets to ones with shader programs. Generated state sets are attached to geometries and stored in ShaderGenCache for reuse.
Very simple cases of state configuration are supported (all the ones I really need):
- single per pixel not attenuated non spot light source ON/OFF
- exp2 fog ON/OFF
- diffuse texture in rgb + optional specular gloss in alpha (Texture unit 0) ON/OFF
- normal map texture (Texture unit 1 and Tangent in VertexAttribArray 6) ON/OFF
- blending and alpha testing (not in shader pipeline)

To view fixed function pipeline files and paged databases simply run >osgshadergen myfile.osg"
2009-03-23 11:53:06 +00:00
Robert Osfield
ffbed2b222 UPdated wrappers 2009-03-19 11:36:54 +00:00
Robert Osfield
e60db47c1b Inroduced simple PrintVisitor class for helping debug scene graph structures 2009-03-19 11:11:51 +00:00
Robert Osfield
26b55acf68 Fixed spacing 2009-03-19 10:56:38 +00:00
Robert Osfield
3626979bfa Added compressed to list of supported options 2009-03-19 10:55:51 +00:00
Robert Osfield
32ace364a0 Added debug message (commented out for now.) 2009-03-19 10:55:29 +00:00
Robert Osfield
1b3b69721f Added osgTerrain::Terrain support to the .osg format 2009-03-19 10:27:24 +00:00
Robert Osfield
e9d4f99409 From Adrian Egli, build fix for Win32 FFmpeg 2009-03-14 15:40:41 +00:00
Robert Osfield
628990e0a4 From Stephan Huber, clean up of Quicktime plugin 2009-03-13 15:56:19 +00:00
Robert Osfield
e153c9fbd8 Update AUTHORS file 2009-03-13 13:25:00 +00:00
Robert Osfield
6c5dd142ef Updated ChangeLog 2009-03-13 11:56:16 +00:00
Robert Osfield
f1053c52dc Warning fixes 2009-03-13 11:06:12 +00:00
Robert Osfield
a8aad71d03 Fixed for division by zero issue. 2009-03-13 11:01:11 +00:00
Robert Osfield
9a4e17b766 From Bryan Thrall, "The attached ReaderWriterGLSL.cpp conveniently sets the shader type when
the filename extension is "vert" or "frag" but still lets this be
overridden by the Options (for those crazy people who store their
fragment shaders in .vert files :) )."
2009-03-13 10:40:00 +00:00
Robert Osfield
f2fb93aeec From Frank Midgley, "I tried running osgconv --formats yesterday on OS X and got no results. Turns out the changes discussed in the "osgDB::listAllAvailablePlugins win32 fix" thread back in Sep '08 broke this. The OSG_PLUGIN_EXTENSION macro is being defined in src/osgDB/CMakeLists.txt from CMAKE_SHARED_LIBRARY_SUFFIX which is "dylib" on OS X. The problem is that all of the plug-ins are setup in OsgMacroUtils.cmake with:
ADD_LIBRARY(${TARGET_TARGETNAME} MODULE ${TARGET_SRC} ${TARGET_H})

which gives them .so extensions.  Since ".so" != ".dylib" osgDB::listAllAvailablePlugins finds no plug-ins.  I believe the correct solution is to use CMAKE_SHARED_MODULE_SUFFIX instead.  This builds and runs correctly on OS X but I have not tested on other platforms.

Attached is an updated src/osgDB/CMakeLists.txt based on rev 9915.  The change is at line 108.  To validate: build and then run bin/osgconv --formats.  You should get many screenfuls of plug-in features, extensions and options."
2009-03-12 17:54:58 +00:00
Robert Osfield
8194246ba3 From Konstantin Sinitsyn, "At this moment, I just introducing to OSG. When I reviewing optimizer code, I find a mistake in Optimizer::RemoveLoadedProxyNodesVisitor, as it seems. This optimizer removes proxy nodes that fully loaded and in some cases attach their childs to parrents directly (without creating of group). I dont understand how this works, because if proxy node doesn't have any attributes such as name, description, node mask and any callbacks, then new group does not created to hold proxy node childs. And code below trying to attach their children to all parents but seems like only first child beeing attached to all parents correctly.
"
2009-03-12 17:47:50 +00:00
Robert Osfield
f3ba8c8707 Introduced a releaseAllOperation after completeion of OperationThread::run() to enable CUDA integration (in osgCuda) to be able to free up its resources. Code drawn from a submission from Mick. 2009-03-12 17:26:21 +00:00
Robert Osfield
f6eae8dc3e Updated wrappers 2009-03-12 17:12:48 +00:00
Robert Osfield
7b5f3ec92a Moved IncrementalCompileOperation out of include-src/osgUtil/GLObjectVisitor into their own files.
Added support to IncrementCompileOperation for controlling how much time is alloted to compilation and flush
2009-03-12 15:21:04 +00:00
Robert Osfield
c3fc21fa82 Added support for tracking the time since the last clear() call to enable other
classes to be able to find out how long the current graphics frame has been running.
2009-03-12 15:18:51 +00:00
Robert Osfield
5a537261a6 From Michael Platings, "I've been looking at the discussion from 2006 ("[osg-users] osgDB/Reentrant Mutex not threadsafe ?") about this, and having looked closely at OpenThreads::ReentrantMutex it's still not thread safe in the following situation:
In my example case, there are 2 threads - one is a worker thread created by OpenThreads::Thread. The other thread is the main thread i.e. the thread that is intrinsically created when you execute the application. The crucial problem is that for the main thread, OpenThreads::Thread::CurrentThread() will return null.
 
I'll demonstrate this by breaking ReentrantMutex::lock() into sub-statements:
 
1.) if (_threadHoldingMutex==OpenThreads::Thread::CurrentThread())
 
2.) if (_lockCount>0){
 
3.)
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_lockCountMutex);
++_lockCount;
return 0;
 
4.)
int result = Mutex::lock();
if (result==0)
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_lockCountMutex);
 
5.)
_threadHoldingMutex = OpenThreads::Thread::CurrentThread();
_lockCount = 1;
return result;
 
 
An error will occur in the following case:
1) The worker thread calls lock(), it gets to the start of statement 5.
2) The main thread calls lock(). Statement 1 is evaluated as true as _threadHoldingMutex is null, and OpenThreads::Thread::CurrentThread() returns null.
3) The worker thread executes statement 5.
4) The main thread executes statement 2 and evaluates it as true, because the worker thread has set _lockCount to 1. The main thread executes statement 3, and now can access the mutexed-data at the same time as the worker thread!
 
The simple solution to this is to always protect access to _lockCount and _threadHoldingMutex using _lockCountMutex. I have done this in the file I am submitting."
2009-03-12 10:12:42 +00:00
Robert Osfield
1211fd1120 Changed audio playing so that it only happens for a single movie to avoid
problems with audio stalling.
2009-03-11 18:13:58 +00:00
Robert Osfield
73cffacf09 Added docs on getPixelAspectRatio and corrected usage of getPixelAspection in osgmovie.cpp 2009-03-11 17:57:33 +00:00
Robert Osfield
7994ed1eb7 changed debug info to output to INFO instaed of NOTICE. 2009-03-11 17:39:08 +00:00
Robert Osfield
5233a716c8 Added handling of Image::isImageTranslucent(), when it is enabling blending.
Added handling of Image::getPixelAspectRatio() in geometry sizing.
Added scaling of the projection matrix to ensure that aspect ratio is honoured with running in fullscreen mode
2009-03-11 15:43:13 +00:00
Robert Osfield
b6bffdd02f From Tanguy Fautre,
Clean up of the FFmpeg plugin's class API/AudioStream API. 
Implementation of isImageTransparent().
Implementation of Image:g/setPixelAspectRatio()
2009-03-11 15:12:46 +00:00
Robert Osfield
998cfec137 Added View::removeEventHandler(..) method and added check into addEventHandler() to prevent handlers being added twice. 2009-03-11 14:18:30 +00:00
Robert Osfield
d808149e05 From Philip Lowman, "At a cost of bumping the required version to CMake 2.4.4 (released all the way back on November 21, 2006)... this cmake script patch
1. Makes IF/ELSE/ENDIF code blocks easier to read by replacing code like this:

IF(FOO)
   MESSAGE("FOO is true")
ELSE(FOO)
  MESSAGE(" ??? ELSE(FOO)??? ")
ENDIF(FOO)

with this:

IF(FOO)
   MESSAGE("FOO is true")
ELSE()
  MESSAGE("FOO is clearly false")
ENDIF()

2. Also adds an ELSEIF() where it makes sense to do so (safe to use as of CMake 2.4.4)"
2009-03-11 14:08:43 +00:00
Robert Osfield
6791f65add From Neil Hughes, "I've spent the past four days playing with PNG files on 3DS objects, and I think I may have come across a small issue with the 3DS loader.
At the company where I work we model literally thousands of 3DS models for all types of objects. Most don't have transparent textures applied to them, but a few do. The issue is that a texture may have an alpha channel defined, yet its 3DS material definition is not marked as being an alpha source, or transparent. This can happen for any number of modelling reasons (so I'm told) but the net effect is that when a 3DS object is loaded with such a material applied, the stateset creation for the 3DS geometry omits to add the GL_BLEND attribute as neither of the conditions that it currently tests for are satisfied under this scenario.

However, one thing that is apparently an indication of transparency/alpha information that we do make use of when modelling, but that the 3DS reader omits to test, is that we assign to the transparent texture to the opacity_map of the 3DS material structure.

Now, having discussed with our modellers the theory behind the opacity map, it seems that it is safe to say that if an opacity map is specified, then the reader should really apply the GL_BLEND attribute as it is an indication of some form of blending being required between materials.

With this in mind, I have made a minor change to the function createStateSet below, from the ReaderWriter3DS.cpp file, that checks for an opacity map having been specified, and in such a scenario the GL_BLEND attribute is applied to the geometry. This fixed our issue, and thought it might be helpful to others."
2009-03-11 13:27:51 +00:00
Robert Osfield
ec63cfd930 From Mathias Froehlich, "small addition to osg::Texture to include all possible depth test variants for
the shadow depth comparison."
2009-03-11 13:08:12 +00:00
Robert Osfield
771f3a3238 From Stephan Huber, files were are missed by Robert in check in of changes to GraphicsWindowCarbon.cpp 2009-03-11 12:55:20 +00:00
Robert Osfield
d040b9f9d6 From Lionel Lagarde, "the attachment contains a correction of the Optimizer::MergeGeometryVisitor.
When 2 geometries are merged, the primitive sets of the second geometry
are copied to the first geometry.

The primitive sets were copied with a std::insert into the first geometry
primitive set vector. It doesn't work when the geometry is using VBOs (because
the element buffer object of the primitive set is not updated).

The correction replaces

lhs.getPrimitiveSetList().insert( lhs.getPrimitiveSetList().end(),
                                rhs.getPrimitiveSetList().begin(),
                                rhs.getPrimitiveSetList().end() );

by
 for( primItr=rhs.getPrimitiveSetList().begin();
   primItr!=rhs.getPrimitiveSetList().end();
   ++primItr )
{
  lhs.addPrimitiveSet(primItr->get());
}"
2009-03-11 12:08:24 +00:00
Robert Osfield
3e535d7456 Fixed crash due to Geometry::copyToAndOptimize(..) not handling cases where indices are present, but no arrays are assocaited with them. 2009-03-11 11:58:31 +00:00
Robert Osfield
31608b2559 From David Callu, "osgManipulator Object have not META_Object macro call in class definition.
> I add META_OSGMANIPULATOR_Object macro which define className, libraryName,
> isSameKindAs methods.
> Clone method is not appropriate for osgManipulator Object."
2009-03-11 11:29:00 +00:00
Robert Osfield
c58ff9b656 From Lionel Lagarde, "The copy constructor of the nodes and the drawables do :
Node::Node(Node &node, copyop) :
  _stateSet(copyop(node.getStateSet()),

It doesn't call the setStateSet method of osg::Node (or osg::Drawable). So the parent
list of the state set is not updated with the new node (drawable)."
2009-03-11 11:00:24 +00:00
Robert Osfield
06ef559d91 From Martin Beckett, added get/setScrollWheelZoomDelta() support for controlling the mouse scroll wheel zoom delta. 2009-03-11 10:50:03 +00:00
Robert Osfield
c3810e130b Converted tabs to four spaces 2009-03-11 10:34:29 +00:00
Robert Osfield
357d465d49 From Stephan Huber, "refactored the code and moved
some stuff out into DarwinUtils.h/.mm so both implementations can share
some of the code. There's even a bugfix for GraphicsWindowCarbon, which
fixes some issues with multiple windows on different screens."
2009-03-11 10:34:04 +00:00
Robert Osfield
529685c6b1 From Mathias Froehlich, "an other topic pointed out by some Microsoft verification tool:
On destruction of some static variables, the global referenced mutex is used
to lock access to the parent lists of state attributes, nodes and so on.
This even happens past the mutex is already destroyed.

This change to Referenced.cpp revision 9851 uses the same technique like the
DeleteHandlerPointer already in Referenced.cpp to return an zero pointer for
the global referenced lock if it is already destroyed."
2009-03-10 17:51:05 +00:00
Robert Osfield
5157f06bcd From Konstantin Matveyev, submitted by Valery Bickov:
"There is error in WoW shader, you can see it by this simple example:
osgviewer cessna.osg --wowvx-42 --clear-color 0,0,0

Clear color may be choosed any with at least one component equals to 0
or 1. In my case I see weird blinking between normal image and image
with depth map at right side on the screen."
2009-03-10 17:47:54 +00:00
Robert Osfield
9cccd087a8 From Martin Beckett, "Modified osgGA::TrackballManipulator so that osgGA::GUIEventAdapter::SCROLL performs a zoom.
Arbitrarily zooms 10% in/out for each click."

Note from Robert Osfield, flipped the orienation of the zoom to make the right mouse key zoom and the scroll wheel work in the same direction.
2009-03-10 17:39:46 +00:00
Robert Osfield
a0a06c8b2a Completed support for automatic detection of plugin features.
Cleaned up debug out of various plugins to ensure a clean osgconv --formats.
2009-03-10 17:27:39 +00:00
Robert Osfield
3ec2da76e8 quitened down debug info 2009-03-10 17:13:51 +00:00
Robert Osfield
c0863e96ca Made bool isImageTranslucent() const virtual to allow subclasses to provide their own implementation 2009-03-10 16:52:18 +00:00
Robert Osfield
287ff37b34 From Ralf Habacker, "The appended patch fixes this issue by adding a virtual method named supportedFeatures() to the class ReaderWriter, which could be overriden by a specific plugin to adjust the set of features.
Single features are implemented as bits asother enums in ReaderWriter class already does, so that combinations are possible and fast comparison operations are possible

By default all features are enabled.

I have added this virtual method to the dot plugin to get an idea how to use these features.

With this patch osgconv --formats shows an additional line 'features' for each plugin"
2009-03-10 15:00:39 +00:00
Robert Osfield
0669107287 From Roland Smeenk, "While working on the Collada plugin I noticed that all geometry created by the dae reader result in slow path geometry.
Because there already exists the option to convert slow path geometry to the fast path by computing an internal fast path alternative, I added a new optimizer option that automatically does this. To check the results I also made some changes to the statistics gathering and rendering.

Somewhat unrelated, but also part of the optimizer I disabled removal of CameraView nodes during RemoveRedundantNodes optimization.
As discussed on the ML, CameraViews were removed from the scenegraph. This solves that issue.

Summary:
-Geometry::areFastPathsUsed now also looks at internalOptimizedGeometry
-Added Optimize option to make all slow path geometry compute their internal fast path alternative
-Added fast geometry counter to the statistics
-Disabled removel of CameraViews in optimizer
"
2009-03-10 14:15:59 +00:00
Robert Osfield
9ddb8f65b6 Added copyright + fixed typo 2009-03-10 13:46:55 +00:00