Commit Graph

2064 Commits

Author SHA1 Message Date
Robert Osfield
3db6aa255f Removed redundent #if OSG_USE_BOUND block 2016-05-19 17:38:50 +01:00
Christian Buchner
2ef6909d9b I am hereby submitting a deferred rendering code sample, originally written by Michael Kapelko in 2013. I am submitting this code with his approval.
Deferred rendering is now the de-facto standard rendering technique in many modern game engines, hence I think it is important to have this technique demonstrated in an osg code example.

This particular sample adds soft shadows as well as bump mapping into the rendering pipeline. The image files whitemetal_diffuse.jpg and whitemetal_normal.jpg from OpenSceneGraph-Data images folder are required (The OSG_FILE_PATH environment variable must be set correctly)

Two additional osgt models are included with the demo (best to also put them into OpenSceneGraph-Data, I think.

The shaders are currently defined in separate .frag and .vert files.
2016-05-19 17:20:29 +01:00
Robert Osfield
fe6238d126 Added osg::GraphicsContext::WindowingSystemInterfaces singleton for managing multiple WIndowinSystemInterface
implementations being registered at the same time.

One usage case for this functionality to support usage of Wayland and X11 in the same version of the osgViewer.

As part of the new functionality there is now a osg::GraphicsContext::Traits::windowingSystemPreferrence string
that default to empty, but if defined will ensure that a specific WindowingSystemInterface is utilized when
you do a generic call like osg::createGraphicsContext().

Also implemented is standard proxy object for registering the new contexts and removing them automatically, and
declaration of standard graphicswindow_name() C entry point to help with static build linking.
2016-05-16 13:45:31 +01:00
Robert Osfield
cb2af961db From Jannik Heller, Wrong function call in setTextureAttributeAndModes
"From I think that this piece of code in StateSet::setTextureAttributeAndModes is a copy&paste mistake:

            OSG_NOTICE<<"Warning: non texture attribute '"<<attribute->className()<<"' passed to setTextureAttributeAndModes(unit,attr,value), "<<std::endl;
            OSG_NOTICE<<"         assuming setAttributeAndModes(attr,value) instead."<<std::endl;
            OSG_NOTICE<<"         please change calling code to use appropriate call."<<std::endl;
            setAttribute(attribute,value);

As per the warning message it should be calling setAttributeAndModes(attribute,value); ."
2016-03-11 15:35:07 +00:00
Robert Osfield
67202b2662 From Romain Ouabdelkader, "This is a fix for osgText to calculate kerning and to load glyph3D with the text's font resolution.
Font::getKerning(...), Font::getGlyph3D(...) doesn't ask for a font resolution so it uses the last font resolution requested by Font:: getGlyph(...).
This can leads to different results depending of the precedent call to Font::getGlyph(...).
See http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2016-January/271952.html for more infos.

This fix adds a font resolution parameter to Font::getKerning(...), Font::getGlyph3D(...) and to the font implementations.
This was made under the base revision r15182."
2016-02-15 13:30:39 +00:00
Robert Osfield
2e7cfe7efa From Ravi Mathur, OSX/Clang 7.0.0 build fix 2016-01-19 15:39:46 +00:00
Robert Osfield
55a8f4abbc Renamed DrawableUpdate/Event/Cull callbacks to use new include/osg/Callback versions 2016-01-19 11:39:28 +00:00
Robert Osfield
e8fd414661 Fixed line endings 2016-01-19 11:35:13 +00:00
Robert Osfield
30dc6a9428 Fixed line endings 2016-01-19 11:25:30 +00:00
Robert Osfield
e9179aaa4b Added window size, state and stats event handlers to viewer to help with QA'ing simplification results. 2016-01-18 11:49:18 +00:00
Robert Osfield
dd996a3289 Introduced CMake option OSG_PROVIDE_READFILE option that defaults to ON, but when switched to OFF disables the building of the osgDB::read*File() methods,
forcing users to use osgDB::readRef*File() methods.  The later is preferable as it closes a potential threading bug when using paging databases in conjunction
with the osgDB::Registry Object Cache.  This threading bug occurs when one thread gets an object from the Cache via an osgDB::read*File() call where only
a pointer to the object is passed back, so taking a reference to the object is delayed till it gets reassigned to a ref_ptr<>, but at the same time another
thread calls a flush of the Object Cache deleting this object as it's referenceCount is now zero.  Using osgDB::readREf*File() makes sure the a ref_ptr<> is
passed back and the referenceCount never goes to zero.

To ensure the OSG builds when OSG_PROVIDE_READFILE is to OFF the many cases of osgDB::read*File() usage had to be replaced with a ref_ptr<> osgDB::readRef*File()
usage.  The avoid this change causing lots of other client code to be rewritten to handle the use of ref_ptr<> in place of C pointer I introduced a serious of
templte methods in various class to adapt ref_ptr<> to the underly C pointer to be passed to old OSG API's, example of this is found in include/osg/Group:

    bool addChild(Node* child); // old method which can only be used with a Node*

    tempalte<class T> bool addChild(const osg::ref_ptr<T>& child) { return addChild(child.get()); } // adapter template method

These changes together cover 149 modified files, so it's a large submission. This extent of changes are warrent to make use of the Object Cache
and multi-threaded loaded more robust.



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15164 16af8721-9629-0410-8352-f15c8da7e697
2015-10-22 13:42:19 +00:00
Robert Osfield
161246d864 Refactored the GL object deletion management to use new osg::GraphicsObjectManager/GLObjectManager base classes, and osg::ContextData container.
This approach unifies much of the code handling the clean up of OpenGL graphics data, avoids lots of local mutexes and static variables that were previously required,
and enables the clean up scheme to be easily extended by users providing their own GraphicsObjectManager subclasses.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15130 16af8721-9629-0410-8352-f15c8da7e697
2015-09-23 09:47:34 +00:00
Robert Osfield
0dd625f17e Added explicit initialization of osg::Referenced(true) to osg::Operation subclasses as it uses virtual inhertiance from osg::Referenced.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15025 16af8721-9629-0410-8352-f15c8da7e697
2015-07-23 15:46:47 +00:00
Robert Osfield
2208303496 Warning fixes for Clang-3.6
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15016 16af8721-9629-0410-8352-f15c8da7e697
2015-07-23 11:11:58 +00:00
Robert Osfield
37d051af5e Added output of HUD scene graph to hud.osgt and hud.osgb for testing purposes.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14901 16af8721-9629-0410-8352-f15c8da7e697
2015-06-09 09:44:37 +00:00
Robert Osfield
fd806293be From KOS, build fix for osg::Uniform::Callback to osg::UniformCallback change
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14889 16af8721-9629-0410-8352-f15c8da7e697
2015-06-03 09:07:41 +00:00
Robert Osfield
80791c6972 Changed name of UniformCallback to UniformBufferCallback to avoid conflict with changes to come to the osg::Uniform::Callback -> osg::UniformCallback.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14884 16af8721-9629-0410-8352-f15c8da7e697
2015-06-02 09:18:19 +00:00
Robert Osfield
d14a602a59 From Jannik Heller, typo fixes
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14882 16af8721-9629-0410-8352-f15c8da7e697
2015-06-01 13:11:49 +00:00
Robert Osfield
820166b49d Rewrote the Text3D bevel implementation to automatically adjust bevel thickness to avoid overalapping and erronous tesselation.
Added osgText::Bevel::s/getRoundedConcaveJunctions(bool) to control how the bevel should be tessellated around concave junctions on the glyph boundary.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14871 16af8721-9629-0410-8352-f15c8da7e697
2015-05-26 10:05:47 +00:00
Robert Osfield
f66b430476 Comment out debug notification
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14857 16af8721-9629-0410-8352-f15c8da7e697
2015-04-23 12:58:27 +00:00
Robert Osfield
e08fd168f6 Build fix
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14850 16af8721-9629-0410-8352-f15c8da7e697
2015-04-20 10:36:42 +00:00
Robert Osfield
a583b306c5 Added --test-NodeMask option to test crash when a parent of osgmanipulator::AntiSquish node has a NodeMask set to 0x0.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14842 16af8721-9629-0410-8352-f15c8da7e697
2015-04-17 13:22:07 +00:00
Robert Osfield
87122ca369 Fixed typo of SEPARATE enums
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14833 16af8721-9629-0410-8352-f15c8da7e697
2015-04-13 11:48:28 +00:00
Robert Osfield
0a1db3d6fc From Jannik Heller, typo fixes
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14832 16af8721-9629-0410-8352-f15c8da7e697
2015-04-13 10:43:56 +00:00
Robert Osfield
0335ea3760 Added passing of command line arguments to viewer construction to allow one to specify extra controls for the viewer such as window size etc.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14829 16af8721-9629-0410-8352-f15c8da7e697
2015-04-13 08:55:08 +00:00
Robert Osfield
595a048319 Added WindowSizeHandler to osgmanipulator example
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14827 16af8721-9629-0410-8352-f15c8da7e697
2015-04-09 18:38:53 +00:00
Robert Osfield
70b5297575 From Jannik Heller, typo fixes
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14826 16af8721-9629-0410-8352-f15c8da7e697
2015-04-07 18:01:12 +00:00
Robert Osfield
abdb23e367 From Janik Heller, clean up of drawable/node usage
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14824 16af8721-9629-0410-8352-f15c8da7e697
2015-04-07 15:53:17 +00:00
Robert Osfield
31488eeba1 Removed unused ShapesToGeometriesVisitor.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14823 16af8721-9629-0410-8352-f15c8da7e697
2015-04-07 15:52:02 +00:00
Robert Osfield
5229280901 Added --subload command line option and test subload callback for testing purposes
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14812 16af8721-9629-0410-8352-f15c8da7e697
2015-03-31 19:29:02 +00:00
Robert Osfield
a7ba138dc7 Introduced osg::Camera::resize(..) method and associated enum thus:
enum ResizeMask
        {
            RESIZE_VIEWPORT=1,
            RESIZE_ATTACHMENTS=2,
            RESIZE_PROJECTIONMATRIX=4,
            RESIZE_DEFAULT=RESIZE_VIEWPORT|RESIZE_ATTACHMENTS
        };

        /** Resize, to the specified width and height, the viewport, attachments and projection matrix according to the resizeMask provided.
          * Note, the adjustment of the projection matrix is done if the RESIZE_PROJECTIONMATRIX mask to set and according to the rules specified in the ProjectionResizePolicy. */
        void resize(int width, int height, int resizeMask=RESIZE_DEFAULT);



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14811 16af8721-9629-0410-8352-f15c8da7e697
2015-03-31 16:23:43 +00:00
Robert Osfield
99f7bfab3b Introduced Camera::resizeAttachments(int width, int height) to resize all the Texture and Image assigned the the Camera attachments.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14810 16af8721-9629-0410-8352-f15c8da7e697
2015-03-31 15:08:13 +00:00
Robert Osfield
296c12a8e9 Refactor the RTT Camera resize code into a seperate Callback method in prep for this all being done by a single Camera API call.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14809 16af8721-9629-0410-8352-f15c8da7e697
2015-03-31 10:41:33 +00:00
Robert Osfield
06e6f368fc Added StatsHandler to osgtessellationshaders example to test out rendering bug associated with stats rendering.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14807 16af8721-9629-0410-8352-f15c8da7e697
2015-03-23 11:36:02 +00:00
Robert Osfield
890aea9537 Added event handle to alter the RTT Camera's dimensions to follow the windows resizes.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14806 16af8721-9629-0410-8352-f15c8da7e697
2015-03-20 17:58:34 +00:00
Robert Osfield
6854d2968f From Jannik Heller, "Fix for Qt4 multi-threaded crash. This patch adds the AA_X11InitThreads flag to the QApplication setup, meaning QT will call XInitThreads for us. This also bumps the required QT version to 4.8+, because the AA_X11InitThreads flag was introduced in that version. If that is not acceptable, we could add a QT_VERSION >= 0x040800 guard, or manually call XInitThreads() instead. Let me know what you think."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14804 16af8721-9629-0410-8352-f15c8da7e697
2015-03-20 11:48:21 +00:00
Robert Osfield
63a3595aab Added Texture wrap setting to CLAMP_TO_EDGE to fix rendering problem when running the default osgdistortion example
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14803 16af8721-9629-0410-8352-f15c8da7e697
2015-03-19 10:49:17 +00:00
Robert Osfield
e6e39e7924 Refactored the command line setup to enable better control of set up.
Added WindowSizeHandler to allow for adjustment of window size.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14791 16af8721-9629-0410-8352-f15c8da7e697
2015-03-16 12:13:44 +00:00
Robert Osfield
a88fa6f7b7 Added --play-mode [ONCE, STAY, LOOP, PPONG] to help with testing.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14788 16af8721-9629-0410-8352-f15c8da7e697
2015-03-16 10:07:13 +00:00
Robert Osfield
75b9cd3627 Completed support for assigning 3D osg::Image to osg::Texture2DArray.
Improved the osgtexture2DArray example to add --mipmap and --packed command line options to help with testing.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14775 16af8721-9629-0410-8352-f15c8da7e697
2015-03-11 17:27:08 +00:00
Robert Osfield
b6acb1a8d3 Updated the comments to be more relevant
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14774 16af8721-9629-0410-8352-f15c8da7e697
2015-03-11 15:44:23 +00:00
Robert Osfield
d97e01c520 Work in progress on new osgtexture2DArray example
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14772 16af8721-9629-0410-8352-f15c8da7e697
2015-03-10 18:07:17 +00:00
Robert Osfield
26d1679248 Removed the experiemental osgPresentation classes. These are only partially functional and not appropriate for the stable OSG-3.4 release
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14758 16af8721-9629-0410-8352-f15c8da7e697
2015-03-04 17:42:30 +00:00
Robert Osfield
1d9e7f144b From Michael McDonnel, "The tessellation shader example has a small bug.The middle of the
geometry is clipped as soon as it is tessellated. The clipping is
probably caused by rounding errors because it is only in one spot. The
clipping disappears when the camera is moved, and reappears when it is
moved back. Expanding the the bounding box fixed the clipping bug."

Tweaked by Robert Osfield to expand it to a -1 to 1 unit box.
Actual clipping bug is not due to rounding errors but the shaders creating vertices outside the bounding box of the original input vertices


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14747 16af8721-9629-0410-8352-f15c8da7e697
2015-03-02 12:09:25 +00:00
Robert Osfield
0a83632f0a Fixed StateSet::Define names to match OpenSceneGraph-Data/shaders.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14745 16af8721-9629-0410-8352-f15c8da7e697
2015-03-01 15:20:37 +00:00
Robert Osfield
d03b38dea8 Fixes for warnings
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14736 16af8721-9629-0410-8352-f15c8da7e697
2015-02-27 04:29:30 +00:00
Robert Osfield
30a62bc4ad From Jonathan Greig, "I was testing out the example and it works fine as a standalone example, but I found that it didn't work as expected when adding the class to some existing code I have to test it out. The osg widget was appearing but it didn't appear to be updating. After tweaking it to pass on the parent QWidget pointer from my code, it worked as expected. I added the WindowFlags to the attached file for good measure. If you look at the Qt Documentation for QWidget ( http://doc.qt.io/qt-5/qwidget.html#QWidget ), you'll see that is exactly where I got this from. When subclassing a widget as such, you should allow the user to pass in the parent at least, considering that has a major effect on how or if Qt may clean up the memory."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14718 16af8721-9629-0410-8352-f15c8da7e697
2015-02-25 19:19:37 +00:00
Robert Osfield
47db2da8b4 From Andreas Henne, Support for GL3 core profile in osgText
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14717 16af8721-9629-0410-8352-f15c8da7e697
2015-02-25 18:56:29 +00:00
Robert Osfield
7d50c8e634 From Michael McDonnell, "I have changed the code so that the plus key increases both the inner
and outer tessellation. The minus key decrease both the inner and
outer tessellation. You can still use the arrow keys to control inner
and outer tessellation separately."

From Robert Osfield, clean up the code to fix warnings and make the coding style more consistent with the rest of the OSG.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14716 16af8721-9629-0410-8352-f15c8da7e697
2015-02-25 16:59:43 +00:00
Robert Osfield
1320c923ca Changed the toggle of defines so that it works with assumed defaults now set up by the GeometryPool so that when toggling it doesn't have a delay in what the user would expect
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14708 16af8721-9629-0410-8352-f15c8da7e697
2015-02-20 15:12:57 +00:00