Compare commits

...

512 Commits

Author SHA1 Message Date
Robert Osfield
a2f01f0ead Changed the OpenThreads extern to a specific OpenTreads tag 2008-04-03 15:28:21 +00:00
Robert Osfield
1d9eab8406 Release OpenSceneGraph-2.2.0 2007-10-04 11:24:29 +00:00
Robert Osfield
0d8673a9a4 Updated ChangeLog for 2.2 release 2007-10-04 11:24:09 +00:00
Robert Osfield
b62716d679 Added asView() method to GUIActionAdapter to help out with .NET wrappers. Updated wrappers 2007-10-04 11:20:18 +00:00
Robert Osfield
146c140be1 Updated version for 2.2 release 2007-10-04 10:05:20 +00:00
Robert Osfield
a7c67fe287 From Trajce Nikolov, added support for extract a region for geospatial imagery 2007-10-04 08:54:41 +00:00
Robert Osfield
ce24d0c76f Updated ChangeLog, NEWS and AUTHORS file for 2.1.15 release 2007-10-03 23:44:24 +00:00
Robert Osfield
28438c5dbf Updated version for 2.1.15 dev release 2007-10-03 23:27:59 +00:00
Robert Osfield
cf5f000ea1 From Panagiotis Papadakos, "Setting the maximum height of osgText doen't seem to work. If the text is
big enough, it exceeds the height that I gave as input to
setMaximumHeight. So check if cursor is out of -_maximumHeight."
2007-10-03 23:03:13 +00:00
Robert Osfield
c46db2fa15 Added support for defining an option OSG_GLU_TESS_CALLBACK_TRIPLEDOT within the
CMake build system, enabling this option will build the OSG against the (...) version
of the tesselation callback functions.

One can also set the default value of this option via the DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT
variable that is set locally to OFF for all platforms except AIX and OSX, but can
be overriden by setting it via command line option i.e.

  cmake . -DDDEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT=ON
2007-10-03 23:01:33 +00:00
Stephan Maximilian HUBER
a1ae24af83 updated XCode projects 2007-10-03 21:12:32 +00:00
Robert Osfield
73b5712a7a Added GLU_TESS_CALLBACK_TRIPLEDOT path into include/osg/GLU and enabled this
for AIX as reading the old paths this was required.  This looks like it is needed
under Xcode build as well.
2007-10-03 20:21:01 +00:00
Robert Osfield
38542c3986 Removed double return error 2007-10-03 19:54:30 +00:00
Robert Osfield
5fe003d1a2 Updated version, authors and change log for the 2.1.14 release 2007-10-03 12:49:02 +00:00
Robert Osfield
b3ecb8f38f From Mahai Radu, improvements to handling of spotlights 2007-10-03 12:48:23 +00:00
Robert Osfield
c40f395e22 Refactored the plugin and library naming to fix Cygwin plugin loaded issues. 2007-10-03 12:04:47 +00:00
Robert Osfield
3460fc5e26 Added preliminary press release 2007-10-03 10:38:26 +00:00
Robert Osfield
e928efc7a4 From Alberto Luaces, build fix for Cygwin. 2007-10-03 10:36:59 +00:00
Robert Osfield
90eaf41007 Added return 0 to fix warning 2007-10-03 08:34:51 +00:00
Robert Osfield
f0da77042a Updated wrappers 2007-10-02 21:45:55 +00:00
Robert Osfield
1dc06b4553 From Mihair Radu, "Most of the additions are small utility methods:
- set the resolution of the shadow map; it calls dirty() to
re-initialize at next update
- keep a list of Shader objects to use instead of the default ones, if
the list is empty, the default shaders are used
- explicitly create the Uniform variables, so that subsequent additions
that require more Uniforms can put them in a central place
- set a Light or LightSource to use explicitly for shadow casting,
allows multiple lights in the scene, with one casting shadows

There are two additions that do not ( yet ) function correctly, but in
the present usage they do not interfere with the regular usage of the
techique:
- support for using spotlights, it's using Light.spotCutoff to determine
if it's a spot-light and not point-light,
   there is an error in the setup of either the shadow camera or the
texgen, most likely due to the direction of the spotlight, since the
position is being used just like in point or directional lights.
- creation of a debugHUD
   the hud is created properly, ( the example included shows it ), but
it displays only white, there has been some discussion of displaying the
shadow map, but I could not find it, the addition of a simple fragment
shader with the appropriate color transform should get this going."
2007-10-02 21:45:09 +00:00
Robert Osfield
3b3776df85 Updated wrappers 2007-10-02 21:28:27 +00:00
Robert Osfield
55d5a4d28a Introduced a OSG_PLUGIN_PREFIX variable into CMake build system with it set to
"" for all platforms except Cygwin where its set to "cygwin_" and Mingw where
it is set to "mingw_".  Updated osgDB::Registry to look for these for the plugins.
Updated the osgintrospection example to search for these names as well.
2007-10-02 21:26:22 +00:00
Robert Osfield
441b0c34bd Updated to reflect new CompositeViewer threading models 2007-10-02 21:24:23 +00:00
Robert Osfield
caeed02f52 Merged the threading set up and rendering code from Viewer and CompositeViewer
into ViewerBase to allow CompositeViewer to inherit the same theading models
previously just supported by osgViewer::Viewer
2007-10-02 21:23:58 +00:00
Robert Osfield
43a243c161 Changed the search for Qt version to prevent problems when having both Qt3 and Qt4 installed on one machine. 2007-10-02 20:56:56 +00:00
Robert Osfield
ce79b7efd5 Added a #ifdef 0 code block to test setting of the StateSetManipulator's DataVariance to DYNAMIC
to solve a threading issue relating to mixing of StateSetManipulator and
DrawThreadPerContext.
2007-10-02 20:55:33 +00:00
Robert Osfield
f6c5cd184a Changed the GLU_TESS_CALLBACK in an attempt to avoid compile problems under OSX. 2007-10-02 20:54:12 +00:00
Robert Osfield
8ae27117d3 From Andy Skinner, changes the library linkage to just include osg and OpenThreads 2007-10-02 20:45:44 +00:00
Robert Osfield
e3e4f6614c Removed redundent malloc. 2007-10-01 15:11:54 +00:00
Robert Osfield
65e3591ed2 From David Callu, various fixes for window inheritance 2007-10-01 11:02:02 +00:00
Robert Osfield
0296cbf9c1 Updated AUTHORS for 2.1.13 release 2007-10-01 10:23:11 +00:00
Robert Osfield
d32effbdbc Updated Version number for 2.1.13 and updated ChangeLog. 2007-10-01 10:21:52 +00:00
Robert Osfield
65ac804b7d Changed requestWarpPointer to use _eventDislay to avoid crash in osghanglide example due
to async usage.
2007-10-01 09:41:05 +00:00
Robert Osfield
7086aeeebc Removed log2 and replaced the places where is was used with a new Image::computeNumberOfMipmapLevels method. 2007-10-01 08:50:58 +00:00
Stephan Maximilian HUBER
69eddaa7bb updated XCode-projects 2007-09-30 20:16:49 +00:00
Robert Osfield
c6fcb62ab1 Updated wrappers 2007-09-30 19:56:46 +00:00
Robert Osfield
38d33c7685 From Paul Martz, "here's the osgDB::Registry changes to add Options to the read*File() interface. As we discussed, this preserves the old interface for backwards compatibility.
osgconv also changed to use the new Registry::writeNode() interface. No other applications or examples were affected."
2007-09-30 19:53:02 +00:00
Robert Osfield
e55a992767 Updated wrappers 2007-09-30 19:39:36 +00:00
Robert Osfield
48f19b72bd Added support for CompositeViewer to WindowSizeHandler, ThreadingHandler, RecordCameraPathManipulator and HelpHandler. 2007-09-30 19:27:31 +00:00
Robert Osfield
4cf73d4c87 Changed HelpHandler so it supports use with CompositeViewer and Viewer 2007-09-30 19:15:32 +00:00
Robert Osfield
a5ed021066 Added hdwriter to CMake build 2007-09-30 18:43:42 +00:00
Robert Osfield
3c0e3af233 From David Spilling, "Please find attached an extension of the Radiance HDR (RGBE) image reader to support writing.
The options are intended to match the existing read options. By default it will only write RGB32F format; if the "RAW" option is selected, it will output 8 bit RGBA as "raw" RGBE. Note also that the writer inserts a flipVertical(); although the RGBE format, according to spec, should support top-to-bottom or bottom-to-top ordering, no software I've found, including that from the formats originator, actually respects this."
2007-09-30 18:42:20 +00:00
Robert Osfield
8907919fce From Jan Peciva, "I am submitting improved Inventor (iv) writer.
List of changes:
- added support for Billboards and LOD
- improved Material handling
"
2007-09-30 18:33:57 +00:00
Stephan Maximilian HUBER
368a45eec0 updated xcode-projects 2007-09-30 16:24:00 +00:00
Robert Osfield
7ca2f597e6 Updated wrappers 2007-09-30 15:24:43 +00:00
Robert Osfield
e99f94c5aa Updated wrappers 2007-09-30 15:07:17 +00:00
Robert Osfield
40ded29902 From Dan Minor, "osgText::Text does not currently have a getAxisAlignment method. The
attached code adds this, along with a member variable to keep track of
the setting.  It is based on the latest subversion version, and was
tested by creating a new text object with the same axis alignment as an
existing one (e.g.
new_text->setAxisAlignment(old_text->getAxisAlignment()); )."

From Robert Osfield, " I originally didn't add a getAxisAlignment()
as all setAxisAlignment does is set the Rotation member variable, and
potentially one could apply user defined Rotation setting after the
setAxisAlignment() which would bring it out of sync with the
setAxisAlignment.

Rather than reject your submission on the ground of potentially
getting out of sync and therefore misleading users I've added a
USED_DEFINED_ROTATION to AxisAlignment enum, and set this in the
serRotation and then override this setting of _axisAlignment in the
setAxisAlingment method.  I've also removed the lazy updating
optimization you've added to the top of setAxisAlignment to avoid
potential problems as well."
2007-09-30 15:06:59 +00:00
Robert Osfield
91900254f0 Moved ViewerBase class out into its own header and source file.
Improved the support for stats collection in CompositeViewer/StatsHandler.
2007-09-30 11:37:00 +00:00
Robert Osfield
f8729af8b2 Refactor Viewer/CompositeViewer so the both inherit from the a ViewerBase class 2007-09-29 16:46:08 +00:00
Robert Osfield
4ef1864432 From Stephan Huber, add basic support for CompositeViewer in StatsHandler 2007-09-29 11:41:57 +00:00
Robert Osfield
41ce67600e From Mattias Linde, "Nice, this almost gets the job done, one way communication into the plugin is possible.
I've done some additional small modification regarding constness in ReaderWriter and added
mutable on _pluginData so passing data back would be possible too.

Have updated the collada plugin (ReaderWriterDAE.cpp) to use the map to handle options and
have attached the changes.

The stuff in daeReader.h and daeWriter.h are just cosmetic changes to get rid of a warning."
2007-09-29 11:12:38 +00:00
Robert Osfield
7679b96b30 Fixed SphericalDisplay set up codes to properly manage display host/num 2007-09-28 13:42:41 +00:00
Robert Osfield
6eccf540e6 From Mathias Froehlich, "I had a chance to look into the remote display problems.
The screen resolution was queried for the wrong display."
2007-09-28 13:38:32 +00:00
Robert Osfield
9aab68b140 From Mattias Linde, "I've attached a modified ReaderWriter header which has some additions
to osgDB::ReaderWriter::Options to handle PluginData."
2007-09-28 13:35:51 +00:00
Robert Osfield
1df542c119 Andre Garneau, three fixes in one submissions:
"This is a fix for the issue reported by Anders a week ago (see \u201c[osg-users] BUG?: mouse coordinate changes after window move\u201d discussion thread on Sept. 20). The issue was that the initial implementation added a few months back was not converting the window coordinates to client-area coordinates resulting in a slight offset each time a decorated window was moved (caused by the window border). This was also causing windows to move out of their assigned screen."

and

"Attached is a fix for the taskbar repaint issue that occurs when a graphics window is toggled from full-screen mode to windowed mode (as identified by Gert van Maren a couple of weeks ago).
Also included is a fix derived from the \u201cEvents from the past\u201d discussion thread that took place on July 11."
2007-09-28 08:53:34 +00:00
Robert Osfield
5b263f583f Added record path manipulator 2007-09-28 08:52:00 +00:00
Robert Osfield
41efd25660 Changed across to using a GraphicsOperation as the base class for the RealizeOperation. 2007-09-27 13:49:56 +00:00
Robert Osfield
6df0110d0c From Adrian Egli, "update the PSSM, i did some bug fixes and added new features to move the camera virtual against the view direction by applaying a simple distance factor (a), which is calculated camera eye - camera center distance. and we can move the "light camera" against the light direction (b).
(a) some objects behind the camera can cast shadow
(b) object aboive the camera can cast shadow

then i fixed the shadow map orientation, now screen x coordinate alinged which improve the quality"
2007-09-27 12:47:34 +00:00
Robert Osfield
63789c81b9 From Mathias Froehlich, compile fix for HP-UX without large file support 2007-09-27 12:15:39 +00:00
Robert Osfield
b23316838a From Mathias Froehlich, "Some more file that needs some adjustment because of missing member templates
in suns stl."
2007-09-27 10:47:15 +00:00
Robert Osfield
5e504026a5 Changed copy constrcutor to a default constrcutor and std::copy to avoid
problems with dodge Sun compiler.
2007-09-27 10:42:56 +00:00
Robert Osfield
308bb5a797 Added support for selecting internal texture format via the internalFormat <numbits> entry in the .osg file 2007-09-27 10:22:09 +00:00
Stephan Maximilian HUBER
e485c780c1 updated XCode project-files 2007-09-26 16:17:46 +00:00
Robert Osfield
5c007029ae From Jean-Sebastien Guay, "Attached you will find an expanded FindOpenVRML.cmake file, as well as a fixed CMakeLists.txt file for the VRML plugin ." 2007-09-26 14:44:22 +00:00
Robert Osfield
af498b6e1f Updated wrappers 2007-09-26 14:31:10 +00:00
Robert Osfield
2640fd1456 Added IntensityMap reading in .view files 2007-09-26 14:02:40 +00:00
Robert Osfield
dcd7fd837f Tweaked the wrapping of osgViewer::Scene to fix build problems 2007-09-26 11:32:51 +00:00
Robert Osfield
bfbc73785a From Stephan Huber, "attached you'll find a first implementation for the obj-plugin to write
obj-files. It is not feature complete but usable.

Known issues:
* not all materials are handled correctly (especially when using
osg::StateAttribute::OVERRIDE), not all properties are supported
* could not test point and lines, all of my programs which are capable
to read obj-files only import triangle-meshes.
* only simple texture-handling"
2007-09-26 10:58:29 +00:00
Robert Osfield
1e9b4f7855 Added suprression of the reflection of osgViewer::Scene to avoid build
issues associated with the class.
2007-09-26 10:46:30 +00:00
Robert Osfield
92092d6996 Updated wrappers 2007-09-26 09:59:59 +00:00
Robert Osfield
18ad07160d From David Callu, adding support for GraphicsWindowX11 window inhertance and
setWindowName() method.
2007-09-26 09:50:32 +00:00
Robert Osfield
d743eb2d95 Added support for intensityMap and fix naming of --panoramic-sd and --3d-sd command line arguments 2007-09-25 19:14:29 +00:00
Robert Osfield
501b3241c6 Added --flip argument docs. 2007-09-25 17:02:22 +00:00
Robert Osfield
61d0bc4eaf Added --flip option to allow one to flip the source data about the x axis. 2007-09-25 17:01:16 +00:00
Robert Osfield
b8ddf1f786 Removed all dome distortion correction code as this is now part of the core osgViewer.
Added viewer mode where movies are made fullscreen.  One can use the old interactive
camera mode by using --interactive parameter on the command line.
2007-09-25 15:01:11 +00:00
Robert Osfield
43eacc4cbc Preliminary PanoramicSphericalScreen support 2007-09-25 13:51:03 +00:00
Robert Osfield
3a94dd7b25 Added --major/minor/path-number support 2007-09-25 12:34:01 +00:00
Robert Osfield
1c4b8a1d15 Fixed version number 2007-09-25 11:26:16 +00:00
Robert Osfield
d8cbd49471 Added thread unit test to test the create, start and destruction of threads 2007-09-25 10:18:50 +00:00
Robert Osfield
6d822cbf45 Updated Version and AUTHORS for 2.1.12 dev release 2007-09-24 16:34:28 +00:00
Robert Osfield
a6369fb617 Renamed packaging directory to pkgconfig 2007-09-24 16:30:59 +00:00
Robert Osfield
caad9d26e1 Updated ChangeLog for release 2007-09-24 16:28:58 +00:00
Robert Osfield
e725f30d81 Updated wrappers 2007-09-24 16:25:55 +00:00
Robert Osfield
d11d5b819a From Adrian Egli, further work on PSSM implementation. 2007-09-24 15:24:23 +00:00
Robert Osfield
a4f79e7a37 From Alberto Luaces, fixed typo of valid() in warning message 2007-09-24 10:36:39 +00:00
Robert Osfield
9f3783929a Changed iterator name to avoid warning 2007-09-24 10:31:35 +00:00
Robert Osfield
10d59e73f6 From Mirko Viviani, "attacched you'll find the updated xcode project for OpenSceneGraph
2.1.11. The one supplied in the archive does not build due to some missing
file references."
2007-09-24 09:39:30 +00:00
Robert Osfield
0726624a86 From Jose Delport: "have been using the new VIEW_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY mode
of the OverlayNode.

I change the overlay subgraph dynamically and when I remove all the
subgraph nodes that is inside the current main camera FOV (others
outside still exist), the overlay texture does not update because of the
early return in the traversal. I then get a kind of ghost texture moving
around the terrain.

The attached file fixed the problem for me, but I'm not sure if it is
the best way to address the problem."
2007-09-24 09:35:59 +00:00
Robert Osfield
bd68958877 From Art Tevs, "Following
two lines has to be included into the Image.cpp in the
computeNumComponents(...) method:

case(GL_RGBA16F_ARB): return 4;
case(GL_RGBA32F_ARB): return 4;"
2007-09-24 09:26:21 +00:00
Robert Osfield
cf2c9da74d Made ReaderWriter and ReaderWriter::Options use thread safe ref counting. 2007-09-24 09:05:42 +00:00
Robert Osfield
54c579fcae Improved the handling of OSG_CONFIG_FILE support. 2007-09-22 17:39:15 +00:00
Robert Osfield
da70320707 From David Callu, added getOrCreateScene method, made contractors protected.
From Robert Osfield, made getOrCreateScene protected and made View a friend
of Scene to all it to construct Scene objects itself.
2007-09-22 16:50:45 +00:00
Robert Osfield
82b0f004e9 From Adrian Egli, update to ParallelSplitShadowMap. 2007-09-22 16:46:38 +00:00
Robert Osfield
1dc8983a76 Added EXPORT 2007-09-22 13:06:07 +00:00
Robert Osfield
5c36fbb18f From David Callu, added findSlaveIndexForCamera method 2007-09-21 19:43:06 +00:00
Robert Osfield
6630dcf15c Added return 2007-09-21 19:04:02 +00:00
Robert Osfield
3bfaee3654 Added support for basic viewer configuration files 2007-09-21 15:34:25 +00:00
Robert Osfield
ece7b57df2 Further steps towards reading coniguration files. 2007-09-21 13:30:33 +00:00
Robert Osfield
609315caa5 From Luc Frauciel, "A few improvements to osgstereoimage:
- When using a large numbrer of files, the command line was too long;
Added a -files option that allow to store filenames in a file (one file
per line)
- Added some more intuitive key bindings for controls (left, right, + ,
-)
- Set the texture wrapping to CLAMP_TO_EDGE (it's cleaner now)
"
2007-09-21 09:02:03 +00:00
Robert Osfield
1e128aed1d Updated wrappers 2007-09-20 10:14:08 +00:00
Robert Osfield
55a9ea19d7 From Anders Backman, added bias and texture size methods.
From Robert Osfield, tweaks to the above for method parameters and indenting.
2007-09-20 10:12:58 +00:00
Robert Osfield
5fb9673382 Added supoort for OSG_WRITE_OUT_DEFAULT_VALUES env var 2007-09-19 16:53:40 +00:00
Robert Osfield
7ea3632dfc Added support for bool in ArgumentParser::Parameter.
Added support for using Input::read(...) methods using ArgumentParser::Paramter
to adapter to multiple paramter types.
2007-09-19 15:29:57 +00:00
Robert Osfield
cf69352873 From Adrian Egli, ParallelSplitShadowMap implmentation.
Changes by Robert Osfield - CMakeLists.txt and name change to ParallelSplitShadowMap.
2007-09-19 11:56:44 +00:00
Robert Osfield
1f7b27f851 Changed the simplifier so that it produces deterministic results, no longer
using memory pointers for sorting.
2007-09-19 10:14:52 +00:00
Robert Osfield
8bc8b6b5e9 Removed check for shaders/overlay_perspective_main.vert 2007-09-19 09:00:05 +00:00
Robert Osfield
c8fd1e4627 Commented out herror() as its not called anywhere in the code. 2007-09-18 16:00:21 +00:00
Robert Osfield
e091d65c91 Updated ChangeLog, AUTHORS and README for 2.1.11 release 2007-09-17 09:33:00 +00:00
Robert Osfield
acfa793032 Updated version numbers for 2.1.11 dev release 2007-09-17 09:26:02 +00:00
Robert Osfield
ae5883dd23 Fixed Locator::setTransform method so it takes a const Matrixd&, and improved
the setting of Locator in the gdal plugin.
2007-09-16 17:48:07 +00:00
Robert Osfield
41dc911166 Setting for new option for hinting whether to write out default values 2007-09-16 17:46:33 +00:00
Robert Osfield
4c787abfd7 Added option for controlling whether output code should write out default values 2007-09-16 17:45:53 +00:00
Robert Osfield
c583dbe3c5 Fixed warning 2007-09-16 17:43:00 +00:00
Robert Osfield
6a83c9e641 From Loic Dachary, pkg_config files 2007-09-16 07:55:58 +00:00
Robert Osfield
e19f23021f Introduced the use of a ReentrantMutex to avoid problems with findFontFile. 2007-09-15 17:40:08 +00:00
Robert Osfield
e433762105 From David Spilling, "Given no replies to my recent "does anybody use the DDS writer" query, I was emboldened to submit this very small patch. The bitmasks for RGBA and RGB have been modified in the writer portion of the code (line 765 onwards). This is now consistent with what the DDS plugin reads. In terms of testing, note that many 3rd party applications erroneously ignore the bitmasks in the file, and assume a BGRA order." 2007-09-15 17:36:03 +00:00
Robert Osfield
8051c48e56 Updated wrappers 2007-09-14 11:26:23 +00:00
Robert Osfield
f6eaa58c56 From Andy Skinner, added support for ot-soversion-OpenThreads.dll dll naming under Windows 2007-09-14 11:06:12 +00:00
Robert Osfield
97b66b877d Updated wrappers 2007-09-14 11:02:06 +00:00
Robert Osfield
69de74aedf Added TemplateRegisterDotOsgWrapperProxy. 2007-09-14 11:01:48 +00:00
Robert Osfield
cb1c916e25 Ran conversion of tabs to four spaces 2007-09-14 11:00:32 +00:00
Robert Osfield
d5cc0e966f Introduce GUIEventHandler::handleWithCheckAgainstIgnoreHandledEventsMask() methods
to help make it easier to get event handles to ingore events that have already been handled.
2007-09-14 10:44:46 +00:00
Robert Osfield
290adbe7ab From Ole-Morten Duesund, added IgnoreUsedEventsMask. 2007-09-14 10:26:14 +00:00
Robert Osfield
89428f743a Added _hudText->setDataVariance(osg::Object::DYNAMIC); to prevent from the
text being updated at the same time as being rendered.
2007-09-14 10:00:28 +00:00
Robert Osfield
d6e24c0dc2 Fix for build error during aggressive warning build 2007-09-13 11:00:12 +00:00
Robert Osfield
86ab5a2392 Fixed warning in wrappers 2007-09-13 10:42:26 +00:00
Robert Osfield
0b39152321 Fixed warnigns 2007-09-13 10:38:38 +00:00
Robert Osfield
c88bcc4506 Updated wrappers and READEME 2007-09-13 10:33:10 +00:00
Robert Osfield
5caf64e5c7 From Paul Martsz, changed the Texture clamping mode to CLAMP_TO_EDGE 2007-09-13 10:32:05 +00:00
Robert Osfield
2aff52be23 From Blake Williams, warning fixes 2007-09-13 10:21:47 +00:00
Robert Osfield
eac9831723 Add static_cast to fix warning. 2007-09-13 10:21:18 +00:00
Robert Osfield
34af300957 Removed unncessary typedefs 2007-09-13 10:16:19 +00:00
Robert Osfield
0c5d6da793 Fixed warnings of casting void* by refactoring the type and extensiosn setup. 2007-09-13 10:15:48 +00:00
Robert Osfield
b2fe3d475b Fixed uint/int comparison warning. 2007-09-13 10:10:35 +00:00
Robert Osfield
0f135d6d35 Created two PixelBufferX11::closeImplementation() one the real implementation and
a second non op one for GLX <1.3.
2007-09-13 09:30:30 +00:00
Robert Osfield
45e98d5f18 Added preliminary handling of cases where GLX version < 1.3 2007-09-12 17:01:47 +00:00
Robert Osfield
23945bb506 Removed debug messages 2007-09-12 17:01:09 +00:00
Robert Osfield
4d0e86f1e2 Moved the linking of OpenThreads from osgversion/CMakeLists.txt into applications/CMakeLists.txt 2007-09-12 16:28:50 +00:00
Robert Osfield
a933587753 Rejigged the casting to avoid warnings under Windows 2007-09-12 16:20:40 +00:00
Robert Osfield
c15ec121f4 Updated version, ChangeLog and AUTHORS file for 2.1.10 release 2007-09-12 10:43:49 +00:00
Robert Osfield
0137047429 From Jan Peciva, build fix 2007-09-12 10:04:36 +00:00
Robert Osfield
d8f875ec9e Added log2(int) and log2(uint) methods 2007-09-11 20:54:39 +00:00
Robert Osfield
b89a1480fc Removed int version of log2 to avoid possible errors in assuming log2(10) should ~= log2(10.0) 2007-09-11 20:24:48 +00:00
Robert Osfield
be33fbc66b Added OpenThreads to target libraries 2007-09-11 17:10:24 +00:00
Robert Osfield
b63ce0dee9 From Art Tevs, Added log2 function. 2007-09-11 17:08:06 +00:00
Robert Osfield
0bd4d303e3 From Art Tevs, build fix. 2007-09-11 16:59:19 +00:00
Robert Osfield
041afdc303 Replaced allocateMipmap code with warning message as mipmaps aren't support for TextureRectangle. 2007-09-11 16:56:21 +00:00
Robert Osfield
66cc306f18 Removed the output num_children from Group .osg output and
removed the output of "DataVaraince UNSPECIFIED" as this is redundent
considering the default value is UNSPECIFIED.
2007-09-11 13:47:06 +00:00
Robert Osfield
9819217136 Updated wrappers 2007-09-11 13:42:23 +00:00
Robert Osfield
291d253161 From Mathias Froenlich, "have a problem with the SunOS CC.
It does not like that the prototype of ClipNode::setStateSetModes() differs
from implementation of that function in  the constness of the second
parameter.
On SunOS it compiles fine, but I get link errors when the variant that is
declared in the header is referenced.

The attached src/osg/ClipNode.cpp file removes the const qualifier from the
implementation to match exactly the prototype in the header file.
The file is based on revision 7386 as of today.
"
2007-09-11 13:39:55 +00:00
Robert Osfield
175c3ce806 From Art Trevs, "File Changes:
- GL2Extensions, Program and Program.cpp

Features:
- Support for fragment output binding. (e.g. You can now specify in the fragment shader varying out vec3 fragOut; fragOut = vec3(1,0,1); to write to the fragOut variable. In your program you call glBindFragDataLocation(program, 1, "fragOut") to bind the fragOut variable with the MRT 1 - GL_COLOR_ATTACHMENT1_EXT)

- new methods Program::add/removeBindFragDataLocation Program::getFragDataBindingList

"
2007-09-11 13:34:41 +00:00
Robert Osfield
884b3b7aa2 Seperated out GeometryTechnique .osg support. 2007-09-11 13:32:46 +00:00
Robert Osfield
c51e893ba4 Changed the isTextureIntegerSupported method so that it no longer has the EXT entry in it
for forward compatability reasons.
2007-09-11 12:28:03 +00:00
Robert Osfield
5e83ae4821 From Art Trevs, "Features of the patch are:
- Implementation of integer textures as in EXT_texture_integer

- setBorderColor(Vec4) changed to setBorderColor(Vec4d) to pass double values
as border color. (Probably we have to provide an overloading function to
still support Vec4f ?)

- new method Texture::getInternalFormatType() added. Gives information if the
internal format normalized, float, signed integer or unsigned integer. Can
help people to write better code ;-)

"

Futher changes to this submission by Robert Osfield, changed the dirty mipmap
flag into a buffer_value<> vector to ensure safe handling of multiple contexts.
2007-09-11 12:04:58 +00:00
Robert Osfield
98763cc4c5 From Rafa Giatan, "Changed int to GLsizei in the input parameter of the method
osg::Texture2DArray::applyTexImage2DArray_subload inside
Texture2DArray (lines 214 and 257), Otherwise it gives a compile
error on MacOSX."
2007-09-11 10:16:21 +00:00
Robert Osfield
bea07b5f72 From Mike Wittman and Robert Osfield, added support for SO_VERSION number in
runtime version info.  Added checks for OpenThreads version.
2007-09-11 10:10:43 +00:00
Robert Osfield
269a3956e3 Maded versioning under Windows the default. 2007-09-10 16:06:23 +00:00
Robert Osfield
409cdd0b28 Intoduced a new setGLExtensions template method to do a copy of void* pointer to
local function pointer to avoid compiler warnings related to case void*.

Moved various OSG classes across to using setGLExtensions instead of getGLExtensions,
and changed them to use typedef declarations in the headers rather than casts in
the .cpp.

Updated wrappers
2007-09-10 15:19:23 +00:00
Robert Osfield
b9a4752694 Flesh out a bit more of the view IO support 2007-09-08 07:21:12 +00:00
Robert Osfield
91983cbe71 Fixed typo 2007-09-08 07:04:27 +00:00
Robert Osfield
8e7e6529be From David Callu, warning fixes 2007-09-07 15:03:56 +00:00
Robert Osfield
18e688ea5f Removed warning type not support by gcc 4.1.x 2007-09-07 13:54:32 +00:00
Robert Osfield
7409f1fb99 Updated wrappers for new Texture2DArray class 2007-09-07 13:37:28 +00:00
Robert Osfield
c747c7dbd6 Moved defined from Texture2DArray into Texture 2007-09-07 13:25:28 +00:00
Robert Osfield
c7a72c8435 From Art Tevs,
"A new texture class Texture2DArray derived from
Texture extends the osg to support the new
EXT_texture_array extensions. Texture arrays provides
a feature for people interesting in GPGPU programming.


Faetures and changes:

- Full support for layered 2D textures.

- New uniform types were added (sampler2DArray)

- FrameBufferObject implementation were changed to
support attaching of 2D array textures to the
framebuffer

- StateSet was slightly changed to support texture
arrays. NOTE: array textures can not be used in fixed
function pipeline. Thus using the layered texture as a
statemode for a Drawable produce invalid enumerant
OpenGL errors.

- Image class was extended to support handling of
array textures

Tests:
I have used this class as a new feature of my
application. It works for me without problems (Note:
Texture arrays were introduced only for shading
languages and not for fixed function pipelines!!!).
RTT with Texture2DArray works, as I have tested them
as texture targets for a camera with 6 layers/faces
(i.e. replacement for cube maps). I am using the array
textures in shader programming. Array textures can be
attached to the FBO and used as input and as output."
2007-09-07 11:21:02 +00:00
Robert Osfield
ed6322630f From Daniel Sjolie, "I patched the zip plugin to make use of my favorite zip/pack-application for windows if it is installed in the standard location..." 2007-09-07 10:50:13 +00:00
Robert Osfield
00e00f4e00 From Guillaume Millet, "Please find in attachment a small improvement to the pfb plugin
CmakeLists.txt and to the FindPerformer.cmake module.

Under Windows libs are: libpf.lib (we need to add the lib prefix) and
libpfdu-util.lib (libpfdu and libpfutil are compiled into one lib)
We need to add PFROOT to the search path for libs and includes (default
environment variable for Performer path)
And at last we need to put PFROOT/include and PFROOT/include/Performer
as include dir for compiling."
2007-09-07 10:15:39 +00:00
Robert Osfield
9704ded891 From Maria Ten, fix lat/long usage. 2007-09-07 09:53:40 +00:00
Robert Osfield
b13a1957b0 From Mattias Linde, "Have made the updates now. Added a std::map for easy lookup if a visual node
is targeted by a rigid body which is the reason why the .h-file was changed too.
So now there'll be Group as often as possible, otherwise PostitionAttitudeTransform."
2007-09-07 09:49:31 +00:00
Robert Osfield
14b0ef597b Added osg lib 2007-09-06 08:23:21 +00:00
Robert Osfield
b20d542317 From David Callu, improved consistency of Version strings and add version support
for osgIntrospection and osgManipulator.
2007-09-05 17:12:24 +00:00
Robert Osfield
92b1e7d53f Changed tabs to four spaces to make merges more straight forward 2007-09-05 17:03:43 +00:00
Robert Osfield
4b84acbec6 Added automatic removal of .qt extension that allows one to automatically select
the quicktime plugin.
2007-09-05 16:47:43 +00:00
Robert Osfield
0372825d9b Added setting of locator source 2007-09-05 16:36:36 +00:00
Robert Osfield
a2447d493c Added option to Locator to help specify here the locator value was defined from.
Update wrappers and Gdal plugin to use this new parameter
2007-09-05 14:15:55 +00:00
Robert Osfield
9e7a944639 Improved Terrain IO 2007-09-04 14:00:27 +00:00
Robert Osfield
c2156f12ff Added mutex to DefaultFont::instance(). 2007-09-04 12:38:42 +00:00
Robert Osfield
c9f6a3f7ca Added mutex into osgText::Font::GlphTexture to marshel adding to and reading
from glyph list
2007-09-04 12:32:47 +00:00
Robert Osfield
efc7ff6b02 Rearrange _stateset member variable to avoid compile warning 2007-09-04 09:00:38 +00:00
Robert Osfield
177a8ec2ec Updated AUTHORS and README to 2.1.9 dev release 2007-09-03 16:04:13 +00:00
Robert Osfield
dbf5e6c6f5 Updated ChangeLog 2007-09-03 16:02:00 +00:00
Robert Osfield
4330993f1f Updated wrappers 2007-09-03 15:47:28 +00:00
Robert Osfield
8414a16e52 From Sherman Wilcox, added extension checking support for compressed texture subloading. 2007-09-03 15:43:58 +00:00
Robert Osfield
be11672769 From Jan Peciva, build fix 2007-09-03 15:22:23 +00:00
Robert Osfield
d80632bc81 Updated version number for 2.1.9 dev release 2007-09-03 14:05:24 +00:00
Robert Osfield
39d0788d5b From Jan Peciva, improvement to the FindInventor. 2007-09-03 13:59:25 +00:00
Robert Osfield
bd845a7b23 From Jan Peciva, Added write support into Inventor plugin.
Note from Robert Osfield.  A couple of lines of code in ConvertToInventor.cpp
would not compile under g++ 4.1.2, so rather than hold back the dev release till
this is resolved I've optional compiled out the problem section.
The #define DISABLE_PROBLEM_COMPILE_SECTIONS is used to compile out the problem
section, this define is add via the CMakeLists.txt file.
2007-09-03 13:52:19 +00:00
Robert Osfield
7b73a58728 Added osgdepthpeeling example 2007-09-03 12:27:37 +00:00
Robert Osfield
de19fb3737 From Ralf Kern, "the attached color mapped TIFF file klink1_l.tif is incorrectly read as
GL_LUMINANCE data instead of GL_RGB data. You can easily check with
"osgViewer --image klink1_l.tif".

The bug is in ReaderWriterTIFF.cpp function simage_tiff_load, where
numComponents_ret is incorrectly set to 1 instead of 3 for color mapped
data."
2007-09-03 10:12:26 +00:00
Robert Osfield
07e94c8ce0 From Almalric Alexandre, "I've noticed that all osgViewerMFC example from osg 2.x.x are flickering when resizing 3D view, to avoid this only add OnEraseBkgnd callback in CMFC_OSG_MDIView class and do nothing in it. Just like the WxWidget example.
Attached the modified version of MFC_OSG_MDIView.cpp and MFC_OSG_MDIView.h."

Note from Robert Osfield, submission came with wrong header file, so have had
to guess at what it should be, fingers crossed it worn't break windows build... :-)
2007-09-03 10:04:34 +00:00
Robert Osfield
027158b441 From Laurens Voerman, "I hit a bug when making a copy of a PagedLOD node, the copy has lost
it's _databasePath and can no longer load it's childen. " 

Added _databasePath(plod._databasePath), in the copy copy construcutor.
2007-09-03 09:56:30 +00:00
Robert Osfield
d730559ade Fixed spacing. 2007-09-03 09:54:24 +00:00
Robert Osfield
c83bc830cd From Sherman Wilcox, "I modified texturerectangle.cpp to address this issue. I used a DXT5 DDS
file to test the change."
2007-09-03 09:50:50 +00:00
Robert Osfield
408eceac24 Updated wrapper 2007-09-03 09:47:43 +00:00
Robert Osfield
2415b8e4b1 Added default contructors to Operation 2007-09-03 09:43:33 +00:00
Robert Osfield
ecb8d5f8ab Fixed cancel loop. 2007-09-02 22:31:09 +00:00
Robert Osfield
a97afbb009 Added convinience methods for setting up 3d spherical displays. 2007-09-01 16:56:53 +00:00
Robert Osfield
3304646c4c Changed Font's mutex to become a static mutex shared between all instances of Font.
This ensures single threaded access of the freetype plugin.
2007-09-01 15:24:22 +00:00
Robert Osfield
13faad13e8 Changed mutex reference to a mutex pointer to avoid problems with wrappers 2007-08-31 20:30:45 +00:00
Robert Osfield
76063a94bd Updated wrappers 2007-08-31 20:21:45 +00:00
Robert Osfield
5ae1eb711a To solve creations with multi-threaded creation of text, added mutex to Font, and use of this mutex in Text, and added mutex to the reading
of fonts.
2007-08-31 20:16:02 +00:00
Robert Osfield
86e998f64c Added mutex locking add addParents/removeParents in Drawable, Node and StateSet. 2007-08-31 20:14:36 +00:00
Robert Osfield
1bc6d0bae4 Added mutex to protect the readFontFile calls 2007-08-31 18:56:22 +00:00
Robert Osfield
8d1ef9906a Added support for running multiple text generation threads 2007-08-31 16:59:32 +00:00
Robert Osfield
4ba3f3c1a1 Changed RenderLeaf and StateGraph so that they use ref_ptr<> by default for Drawable and StateSet. 2007-08-31 16:05:24 +00:00
Robert Osfield
99f6865d4d From Luigi Calori, fixed Windows install of wrappers 2007-08-31 15:49:17 +00:00
Robert Osfield
a8c3bc2116 Added export for Windows build 2007-08-31 12:14:39 +00:00
Robert Osfield
817f316e2a From Luigi Calori, added support for Win32 versioning/new buid placement. 2007-08-31 11:04:06 +00:00
Robert Osfield
f4d2d1241d Further work on osgTerrain::Locator and GDAL plugin 2007-08-30 19:26:52 +00:00
Robert Osfield
b0f21e9a39 From Luigi Calori, add osgText to geo plugin build 2007-08-30 12:18:45 +00:00
Robert Osfield
4328bdacc2 From Luigi Calori, introduction of versioning of dll's and placement of dll and plugins into bin directory during build. 2007-08-30 10:41:15 +00:00
Robert Osfield
712dbacda3 Updated wrappers 2007-08-30 10:17:34 +00:00
Robert Osfield
667be8bb57 Further refinement of ProxyLayer API 2007-08-30 10:15:35 +00:00
Robert Osfield
9a9ffbe229 Further work on new ProxyLayer 2007-08-29 16:29:05 +00:00
Robert Osfield
2f895b839e Added ProxyLayer support into osgTerrain plugin 2007-08-29 12:18:41 +00:00
Robert Osfield
63c283ad03 Added support for post fixing filenames with .gdal to force use of gdal plugin. 2007-08-29 11:51:22 +00:00
Robert Osfield
71e7a65cca Added preliminary ProxLayer and DataSetLayer in GDAL plugin to aid integration
of GDAL reading into osgTerrain.
2007-08-29 10:52:03 +00:00
Robert Osfield
f6650dd3bf Changed the error code reporting to use hex to match up with freetype headers 2007-08-28 16:12:10 +00:00
Robert Osfield
a98daccd03 Improved formatting. 2007-08-28 15:35:24 +00:00
Robert Osfield
bf8f2eec85 Removed the OSG_INCLUDE 2007-08-28 15:35:09 +00:00
Robert Osfield
fb3bd9c921 Tweeked settings 2007-08-28 15:31:43 +00:00
Robert Osfield
eabe2faf7e Added multi-threaded test path 2007-08-28 14:02:16 +00:00
Robert Osfield
5b1b648ef5 Replaced CartesianLocator and EllipsoidLocator by a single general purpose
Locator class
2007-08-27 16:59:51 +00:00
Robert Osfield
b74083ad15 From Brandon Hamm, changed WxWindows example to use double buffering 2007-08-27 13:33:58 +00:00
Robert Osfield
020d7a5651 Added support for controlling the draw order on Cameras on each GraphcisContext
via the Camera::setRenderOrder parameters
2007-08-27 13:29:09 +00:00
Robert Osfield
281437336c Updated ChangeLog and AUTHORS file for release 2007-08-27 10:37:08 +00:00
Robert Osfield
0ea44d5c6d Updated date on READEME 2007-08-27 10:29:22 +00:00
Robert Osfield
0a16f653ef Updated version numbers for 2.1.8 dev release 2007-08-27 10:28:47 +00:00
Robert Osfield
5ce34fd7f3 Cleaned up the getRotate implementation selection using #defines, and made the
COMPILE_getRotate_David_Spillings_Mk1 the default.
2007-08-27 10:00:09 +00:00
Robert Osfield
5817d4c83e From David Spilling, tweaked quat tests to reproduce getRotate errors. 2007-08-27 09:51:24 +00:00
Robert Osfield
cb5fb828d0 From Jan Ciger, warning fixes 2007-08-26 10:27:31 +00:00
Robert Osfield
06a0ca8d06 From Jean-Sebastien Guay, fixed comment 2007-08-26 10:24:18 +00:00
Robert Osfield
48f1291c7f Added dynamic_cast<GraphicsWindow> and extra doc commented just to force the
use of symbol from osgViewer so that it links properly and pulls in the platform
specific GraphcisWindow* implementation.
2007-08-26 10:19:12 +00:00
Robert Osfield
8a4db98e2b Change char* to const char* to fix warnings 2007-08-26 09:59:39 +00:00
Robert Osfield
b2d131c143 Updated wrappers, and change Renderer so that private: to proteccted:. 2007-08-26 09:46:49 +00:00
Robert Osfield
0798e64872 Updated links 2007-08-26 09:45:35 +00:00
Robert Osfield
f9ab446512 Changed debug comments to output to notify level and tweaked the handling of the .terrain file. 2007-08-24 19:16:35 +00:00
Robert Osfield
09f63eebbb Added support for reading a .osg style data from a file string when trailed by a .osgs extension i.e.
osgviewer "osgTerrain::Terrain { ElevationLayer { CartesianLocator 0 0 1000000 1000000 Image ps_height_512.tif } ColorLayer { CartesianLocator 0 0 1000000 1000000 Image ps_texture_1k.tif } }".osgs
2007-08-24 19:16:02 +00:00
Robert Osfield
b0bede80c5 Added writing out of Terrain, Layer and Locators, and reading in of .terrain string. 2007-08-24 18:48:26 +00:00
Robert Osfield
a981202953 Set the debug out to info notification level 2007-08-24 16:16:08 +00:00
Robert Osfield
1273c814d1 Added better handling of OSG_TEXT_INCREMENTAL_SUBLOADING env var. 2007-08-24 16:12:22 +00:00
Robert Osfield
9489eef1cf Added default disabling of incremental subload for ATI cards. 2007-08-24 16:10:43 +00:00
Robert Osfield
056a9bc491 Added support for setting DatabasePager thread priority via OSG_DATABASE_PAGER_PRIORITY. 2007-08-24 14:00:44 +00:00
Robert Osfield
54202aae0d Cleaned up the thread priority management in DatabasePager and added
support for paging stats.
2007-08-24 13:33:35 +00:00
Robert Osfield
cc6ac2704e Added setting of block into the ThreadSafeQueue's contructor. 2007-08-24 10:58:08 +00:00
Robert Osfield
5050b9b5b1 Disable the escape sets done on the viewer 2007-08-24 09:45:11 +00:00
Robert Osfield
607f92e1fa From Mario Valle,
osgviewerWX: "To make the example compile using a wx build non UNICODE based.
Tested on Linux with wxGTK 2.8.4"

osgviewerFOX: "Added removeChore() call in the FOX_OSG_MDIView destructor to get rid of a Trace/BPT trap
error on exit on Linux. BTW this is suggested also in the FOX documentation."
2007-08-24 09:42:11 +00:00
Robert Osfield
9a73a3f461 Made plugin build names lowercase 2007-08-23 16:56:06 +00:00
Robert Osfield
85ef819827 Changed the plugin name to openflight instead of OpenFlight to avoid problems
with osgDB looking for just lower case plugin names
2007-08-23 16:33:39 +00:00
Robert Osfield
0da0127857 Updated for 2.1.7 dev release 2007-08-23 15:36:45 +00:00
Robert Osfield
a3ce9f680a From Stephan Huber, fix for crash on exit 2007-08-23 14:35:04 +00:00
Robert Osfield
6827104532 From Galen Faidley," Please find attached the modifications to get the new checkerboard
stereo format to work.  It's a good thing I tested these on a TV
before submitting them since I did indeed have a bug.  One thing I
did not test was to see how this would work in windowed mode.  Does
the interlaced stereo code have support for 'absolute' positions?
For example a given pixel on the screen is always shown in a given
eye no matter where the graphics context is placed?
"
2007-08-23 14:31:23 +00:00
Robert Osfield
616f64cf2c From Jean-Sebastien Guay,"As discussed yesterday on the osg-users list, I have altered
src/osgDB/FileUtils.cpp to implement the official Windows DLL search
order as described on the page
http://msdn2.microsoft.com/en-us/library/ms682586.aspx . As mentioned,
the search order is now:
    1. The directory from which the application loaded.
    2. The system directory. (C:\Windows\System32 by default, gotten using the
       GetSystemDirectory function)
    3. The 16-bit system directory. (C:\Windows\System by default, gotten by
       adding "\System" to the path gotten in the next step...)
    4. The Windows directory. (C:\Windows by default, gotten using the
       GetWindowsDirectory function)
    5. The current directory. (".")
    6. The directories that are listed in the PATH environment variable. (as
       before)

The first four directories are obtained using Win32 API calls, so they
should work correctly even on non-standard Windows installs.

The changes are well commented and should be clear, even to someone
not familiar with the Win32 API.

I have tested in a few scenarios and it works as expected. Serge Lages
has also tested the changes and confirmed they worked as described. I
have not had any other reports though (positive or negative).

I also fixed the issue with a trailing semicolon on the PATH adding an
empty string to the end of the search paths, as this was an
inconsistent side effect rather than a desirable effect. This change
will take effect on other platforms as well, but since it tests for an
empty string in the last item added to the search paths, it should
have no adverse effect.
"
2007-08-23 14:10:31 +00:00
Robert Osfield
a86c3dd314 Updated wrappers 2007-08-23 11:06:16 +00:00
Robert Osfield
f8ac71d7e5 Addd control for serializing draw dispatch. 2007-08-23 11:00:12 +00:00
Robert Osfield
bdb2a6b9d7 From Jean-Sebastien Guay, "After a bit more testing, it was still not 100% robust, so this fix
will bring the change in line with what is done on other OSes (Linux)
and works in all tested cases.

For reference, this was tested with:

osgviewer <file>.wrl                (file in current directory)
osgviewer <dir>\<file>.wrl          (file in child directory, relative)
osgviewer .\<dir>\<file>.wrl        (file in child directory, specify current)
osgviewer <drive>:\<dir>\<file>.wrl (absolute path)
"
2007-08-22 19:31:58 +00:00
Robert Osfield
f6d342af6f Updated wrappers 2007-08-22 19:26:25 +00:00
Robert Osfield
9c4fd5ec82 Updated wrappers 2007-08-22 17:18:27 +00:00
Robert Osfield
1694cf9625 Refactored the implementation of cull/draw for DrawThreadPerContex and CullThreadPerCameraDrawThreadPerContex
and added an experimental draw serialization.
2007-08-22 17:17:25 +00:00
Eric WING
dee0c92ffc Documentation updates. 2007-08-22 14:32:06 +00:00
Robert Osfield
41d15384cc Updated wrappers 2007-08-22 12:33:39 +00:00
Robert Osfield
bb7368a321 Cleaned up the thread setup and fixed the CullThreadPerCameraDrawThreadPerContext path 2007-08-22 12:21:01 +00:00
Robert Osfield
4f97cdca96 Added thread safe ref/unref by default. 2007-08-22 12:14:15 +00:00
Eric WING
e043b0339b Fixes to DMG script to reflect removal of GDAL and external OpenThreads.
Support for OpenSceneGraph-Data repo aside OpenSceneGraph repo.

Added background image support to DMG. Pre-laid-out .DS_Store included.
2007-08-22 11:04:43 +00:00
Eric WING
120c9e54fe Removed missing shadow examples from Xcode project. 2007-08-22 10:56:20 +00:00
Robert Osfield
de4a4042f7 Set main scene graph elements to use thread safe ref/unref by default 2007-08-22 10:34:11 +00:00
Robert Osfield
ef4dafaea1 Cleaned up copy constructor and switched on thread safe ref/unref. 2007-08-22 09:50:09 +00:00
Robert Osfield
5196b09672 Added debug ENFORCE_THREADSAFE paths into osg::Referenced, these are off by default. 2007-08-22 09:48:39 +00:00
Robert Osfield
bb886e8c94 Simplified the thread set up. 2007-08-22 09:46:38 +00:00
Robert Osfield
94db040884 Added thread safe ref/unref 2007-08-22 09:45:20 +00:00
Robert Osfield
7f43f55a44 Added debug message to destructor 2007-08-22 09:44:55 +00:00
Robert Osfield
94af61ed01 Added setting of thread safe ref/unref. 2007-08-22 09:43:24 +00:00
Robert Osfield
57a18ff112 Added default setting of use of thread safe ref/unref. 2007-08-22 09:42:27 +00:00
Robert Osfield
0390243ed9 Changed ReadFileCallback and WriteFileCallback to use virtual inhertinace. 2007-08-22 09:05:34 +00:00
Robert Osfield
c1dc079f56 Added missing clear() implementation 2007-08-21 09:32:16 +00:00
Robert Osfield
502f1a3330 Fixed the install path of plugins under Windows. 2007-08-20 13:09:10 +00:00
Robert Osfield
6dee57bfee Updated README date 2007-08-20 10:15:07 +00:00
Robert Osfield
06b97c030b Updated AUTHORS file for 2.1.6 release 2007-08-20 10:14:33 +00:00
Robert Osfield
aa59790ce1 Updated ChangeLog 2007-08-20 10:06:36 +00:00
Robert Osfield
5e7a7f6b3c Updated version number for 2.1.6 release and updated wrappers 2007-08-20 09:28:03 +00:00
Robert Osfield
a8fd0ddfca Removed Makefile as this is autogenerated. 2007-08-20 09:27:31 +00:00
Robert Osfield
cde5e45ac7 From Antione Hue and Robert Osfield, moved prepend in front of lib entry. 2007-08-19 19:22:14 +00:00
Robert Osfield
ac6140a33d Fixed zfar setting 2007-08-17 16:10:45 +00:00
Robert Osfield
9d0e273a15 Changed ++_modifedCount cases to dirty(). 2007-08-17 09:37:49 +00:00
Robert Osfield
ffc8123a73 Changed the tolower of the file extension into the plugin name construction code.
Added support for CompositeLayer.
2007-08-16 18:49:46 +00:00
Robert Osfield
3c82058c68 Updated wrappers 2007-08-16 15:29:50 +00:00
Robert Osfield
2f41234793 From Maria Ten, "I divide the init method of the
geometrytechnique in submethods to made more easy the inheritance
between the user and osg-class. This is a first step to add more
functions in osgTerrain. Maybe the subdivision of the method have to
be in the terraintechnique because is the base class of
GeometryTechnique. If Robert or anyone think that this is better i
change this class too."
2007-08-16 14:13:10 +00:00
Robert Osfield
65ecea4e4a From Jan Ciger, "I am attaching a little hack from Jean-Sebastien Guay which allows
absolute paths to work on Windows."
2007-08-15 15:11:48 +00:00
Robert Osfield
fe66501c47 From Stephan Huber, "the softshadowmap-implementation does not compile on os x, to be more
precise, the shader does not compile on os x because of some
type-conflicts ala "can not convert from const int to const float"

So I changed the offending lines to force the type of the vars. It works
now on OS X (albeit very slowly, 3fps on a 7300), perhaps you find the
changes useful. Note: perhaps there is a better way in shaders to
cast/convert from int to float and viceversa."
2007-08-15 15:07:56 +00:00
Robert Osfield
57e7aa31fa From Brede Johansen, "The attached file updates the framestamp and traversal number of the
updatevisitor in osgViewer::Viewer.

The bug prevented DOF animations because osgSim::DOFTransform checks
the traversal number before doing any updates."
2007-08-15 15:03:26 +00:00
Robert Osfield
9291d9699f Changed the plugin name to lower case to be consistent with the way that osgDB::Registry
searches for only lower case plugin names.
2007-08-14 17:13:54 +00:00
Robert Osfield
17521f338a Added string to keyword map parser. 2007-08-14 17:04:27 +00:00
Stephan Maximilian HUBER
16d31fb85c From Stephan Huber: updating the XCode-project-files 2007-08-14 13:08:15 +00:00
Robert Osfield
a102361e81 Added Ben van Basten to list of authors. 2007-08-14 12:47:26 +00:00
Robert Osfield
e4e89101b6 Replaced uint with unsigned int 2007-08-14 08:41:43 +00:00
Robert Osfield
1c6d46d07c Removed osgdepthshadow and osgshadowtexture from build list 2007-08-13 14:02:16 +00:00
Robert Osfield
c931dd5fd9 Updated ChangeLog, AUTHORS and README files 2007-08-13 11:59:19 +00:00
Robert Osfield
f2925791ca Updated version for 2.1.5 dev release 2007-08-13 11:45:20 +00:00
Robert Osfield
d8d0f65e81 From Luc Frauciel, "I've done 2 main modifications :
1) added texture->setResizeNonPowerOfTwoHint(false); when loading an
image. It speeds up by 10 the loading of large images.
2) added a --disk option : only a filelist is read, images are only
loaded when needed. It allows to handle very large set of very large
images that would not fit in memory. Nothing change when the option is
not set."
2007-08-13 10:31:33 +00:00
Robert Osfield
21f65054a0 From Jan Ciger, "I am attaching an improved version of the OpenVRML plugin. It still uses
OpenVRML 0.14.3 and is without the Boost dependency.

The changes:
- - Fixed loading of textures and normals when no corresponding indices
are specified. It uses vertex indices now, compliant with the VRML spec.
- - Added colour per vertex support.
- - Added group node support.
- - Changed the code to use osg::ref_ptr instead of naked pointers to
avoid memory leaks.
- - Fixed breakage for loading files specified by relative path."
2007-08-13 10:27:35 +00:00
Robert Osfield
2cf3785e51 From J.P. Delport, fix of GDAL location search 2007-08-13 10:20:14 +00:00
Robert Osfield
4c443bf843 From Brad Christiansen, "I added the ability to set the render target implementaion on the
osgSim::OverlayNode. The attached changes were made against the 2.0
release."
2007-08-13 10:17:18 +00:00
Robert Osfield
856ec41610 Added gdal/gdal.h to header search path, and gdal1.4.1 to the lib search path. 2007-08-13 09:13:01 +00:00
Robert Osfield
60a62b11df Updated wrappers 2007-08-12 13:30:00 +00:00
Robert Osfield
c2930e5ec1 Added getStart()/getEnd() 2007-08-12 13:18:50 +00:00
Robert Osfield
113805c78a From Jean-Sebastien Guay, "adds osgUtil::LineSegmentIntersector::setStart(osg::Vec3d) and
setEnd(osg::Vec3d)."
2007-08-12 13:17:37 +00:00
Robert Osfield
abc2499e2d Removed now redundent osgshadowtexture and osgdepthshadow examples 2007-08-12 13:10:07 +00:00
Robert Osfield
2861ca6d1a Added support for SoftShadowMap into osgshadow example 2007-08-12 12:15:21 +00:00
Robert Osfield
768f248961 Added fix for typo of name in submission 2007-08-12 12:15:01 +00:00
Robert Osfield
932608f804 From Bruno Hebelin,
"I have adapted to osgShadow the soft shadow map technique described in  "Efficient Soft-Edged Shadows Using Pixel Shader Branching" by Yury Uralsky, Chapter 17 of GPU Gems 2 (Matt Pharr ed. Addison-Wesley).

Here is my code in attachment: basically, it works in the same way as osgShadow/ShadowMap (core code is copied from it) but implements a specific GLSL shader for the soft rendering of penumbra.

I have tested it under Linux with a NVidia graphic card, but there should be no dependency on platform nor on the graphics driver (as far as they support GLSL 2). Screenshots attached show the current results (frame rate bound to v-sync, but the shader takes actually not much time)."
2007-08-12 12:12:55 +00:00
Robert Osfield
babe9f6de0 Added preprending of osgPlugins-version to plugin names 2007-08-11 17:44:06 +00:00
Robert Osfield
d57a16e023 Added DisplaySetting::s/getCompileContextHint() and use of this hint in osgViewer::Viewer/CompositeViewer.
Removed the CustomViewer in osgterrain example as the above now removes the need for it.
2007-08-11 14:49:14 +00:00
Robert Osfield
4cd437d7d4 Refactored the use of the MasterOperation so that it now gets attached to the
Viewer via the new Viewer::addUpdateOperation() method, rather than need a 
custom Viewer::updateTraversal().
2007-08-11 12:43:31 +00:00
Robert Osfield
e5a365afee Added support for an update OperationQueue to Viewer and CompositeViewer to allow asyncrnous adding of operations to be added
to the view to be done during syncronous updateTraversal().

This feature can be used for doing things like merging subgraphs that have been loaded
in a background thread.
2007-08-11 10:28:14 +00:00
Robert Osfield
0e475106dc Updated wrappers 2007-08-10 17:44:54 +00:00
Robert Osfield
ece6c2f672 Updated wrappers 2007-08-10 10:58:25 +00:00
Robert Osfield
845fbf2358 Added View::setDatabasePager(..) 2007-08-10 10:57:00 +00:00
Robert Osfield
7366daca91 Refactored the way the Scene is used in Viewer and CompositeViewer to ensure
that only on Scene exists per scene graph.
2007-08-10 10:52:35 +00:00
Robert Osfield
9b04594126 Compile fix 2007-08-09 08:19:58 +00:00
Robert Osfield
8248b6fac9 Removed now redundent ReaderWriterTerrain.cpp 2007-08-09 08:15:38 +00:00
Robert Osfield
b778fcd994 Updated wrappers 2007-08-08 09:12:02 +00:00
Robert Osfield
e3b7b2f617 Added new statc prototype() and create() methods to CullVisitor and DatabasePager to allow overriding of the default implementations 2007-08-08 08:10:38 +00:00
Robert Osfield
58db6fd81a Removed unneeeded includes 2007-08-08 05:59:01 +00:00
Robert Osfield
8f03255f71 Updated wrappers 2007-08-07 22:56:09 +00:00
Robert Osfield
1049bd2939 Updated CMakeLists.txt to reflect renaming of TerrainNode. 2007-08-07 22:31:43 +00:00
Robert Osfield
1c6193ba78 Renamed osgTerrain::TerrainNode to osgTerrain::Terrain and introduced basic
.osg read support for osgTerrain::Terrain.
2007-08-07 19:53:57 +00:00
Robert Osfield
1fc50423c6 Removed TerrainNode.cpp from CMakeLists.txt 2007-08-07 15:51:49 +00:00
Robert Osfield
0ac8f5e556 Added preliminary shell of osgTerrain plugin 2007-08-07 15:30:05 +00:00
Robert Osfield
f4b549ba8f From Luc Fruciel, "Gdal plugins reads lots of information that is not taken into account in ReadHeigthField for example.
Attached a modification that read the HeigthField position and X,Yintervals.
I also removed the limitation to 1024*1024 to 4096*4096, because when you are preprocessing your data with OSG, it can be useful to read large images/heigthfields. Is there a reason (other than hardware limitations for textures) for this limit ?"
2007-08-07 14:49:37 +00:00
Robert Osfield
b34c3e3ba2 Re-introduceed GDAL plugin 2007-08-07 10:37:42 +00:00
Robert Osfield
2ec9fa7ea9 Re-introduced GDAL plugin. 2007-08-07 10:33:25 +00:00
Robert Osfield
f94bfa7589 Added preliminary code to allow build specification of glu tesscallback with ... parameter 2007-08-07 10:31:24 +00:00
Robert Osfield
eecd3e9257 From Andy Skinner, The attached file adds #include <stdlib.h> to GraphicsContext.cpp, so that it compiles with the solaris compiler we use. 2007-08-07 08:18:15 +00:00
Robert Osfield
80d17ca944 Updated README 2007-08-06 11:52:04 +00:00
Robert Osfield
3eb6e67bfa Updated ChangeLog, and AUTHORS file for release 2007-08-06 11:50:40 +00:00
Robert Osfield
c11f5a3441 Updated version numbers for release 2007-08-06 11:24:53 +00:00
Robert Osfield
81986f4387 Changed debug message to INFO level 2007-08-06 09:28:28 +00:00
Robert Osfield
0cad7018a6 Added support for enabling the stencil buffer when horizontal and vertical split stereo are used. 2007-08-05 17:06:16 +00:00
Robert Osfield
175bb58b58 From Tim More, "This patch causes GraphicsWindowX11 to not send key release events when a key
press / release is caused by auto-repeat. This is consistent with Windows and Mac
behavior, as well as other toolkits such as SDL."
2007-08-05 14:59:17 +00:00
Robert Osfield
4c3a13c3a1 From Andy Skinner, fixes for avoiding warnings about mixing c and c++ versions of c libs. 2007-08-05 14:51:56 +00:00
Robert Osfield
6d0f828524 Disable the selection of CullPerCameraDrawPerContext until I am able to fix this
threading model
2007-08-04 17:04:37 +00:00
Robert Osfield
f528ba8937 From John Shue, "Recent changes to sockstream.cpp and sockinet.cpp to better deal with
various operating system differences between socklen_t and int have
broken the FreeBSD build.  Change was to add __FreeBSD__ to the list of
defines that are checked."
2007-08-04 10:30:04 +00:00
Robert Osfield
2ab30dd1b8 Updated wrappers 2007-08-03 16:08:36 +00:00
Robert Osfield
9b9e4cd7c8 Added perlimnary support for reading the DISPLAY variable. 2007-08-03 14:50:58 +00:00
Robert Osfield
cb6640a65e Changed the projection matrix resize policy. 2007-08-02 16:23:40 +00:00
Robert Osfield
d9aa750f0d From Martin Lavery, XCode updates for the new Renderer class 2007-08-02 12:36:03 +00:00
Robert Osfield
5eb2bc4851 Added return 0; 2007-08-02 12:27:09 +00:00
Robert Osfield
c346f5b943 Introduce new osgViewer::Renderer class for implementing of the rendering
of cameras in viewers
2007-08-02 11:02:47 +00:00
Robert Osfield
1b36cfc928 Added save and restoring of the cull mask to Camera handling code 2007-08-02 08:50:39 +00:00
Robert Osfield
cc6740176f From Andy Skinner,adding c includes to avoid problems with mixing c and c++ versions
of c functions.
2007-07-31 17:28:09 +00:00
Robert Osfield
20131db751 Updated AUTHORS file for release 2007-07-30 16:02:03 +00:00
Robert Osfield
6be13512ff Updated ChangeLog for release 2007-07-30 15:56:52 +00:00
Robert Osfield
3111fccb3f Updated version number for 2.1.3 dev release 2007-07-30 15:25:21 +00:00
Robert Osfield
8fa79e8c7e Ported across Viewer's to use osgUtil::GLObjectOperation, added second option
in GLObjectOperation to handle cases when no subgraph is registered, in these
case the code now compile all Camera subgraphs.
2007-07-30 10:52:37 +00:00
Robert Osfield
59d3e0ceb7 From Andy Skinner, adding C includes to avoid issues when mixing C and C++ standard includes 2007-07-28 10:44:03 +00:00
Robert Osfield
6dec61842d Introduce Camera::s/getRenderer(). 2007-07-28 10:28:40 +00:00
Robert Osfield
f38be8c7a8 From David Callu, "After the mail of Emmanuel Roche to convert a void * in a known pointer (for example osg::Geode *), I has searched an elegant way to introduce this feature.
I just add ReinterpretCastConverter in the Reflector to convert void* in T* and T* in void*
    

    files joint :

        OpenSceneGraph/include/osgIntrospection/Reflector       // modified file
        OpenSceneGraph/src/osgIntrospection/Reflector.cpp      // modified file

"
2007-07-27 17:16:18 +00:00
Robert Osfield
5faeead2c6 From Bryan Thrall, added copying of boundingbox callback to copy constructor. 2007-07-27 17:14:51 +00:00
Robert Osfield
3d9d666b02 From Stephan Huber, added reset of _currentContext when graphics context is closed. 2007-07-27 17:07:44 +00:00
Robert Osfield
2faf38f68f From Stephan Huber, "attached you'll find a fix for the dead locks when closing a window
under OS X."
2007-07-27 16:48:31 +00:00
Robert Osfield
fc9efa2972 Updated svn::externals 2007-07-27 15:26:43 +00:00
Robert Osfield
1b9fac45e1 From Thibault Genessay, "Attached is an unitialized variable fix I spotted with Purify. The _currentCursor (of type HCURSOR) member of the graphics window was not properly initialized, causing potential problems if setCursor() was called before anything else set it." 2007-07-26 19:31:41 +00:00
Robert Osfield
c7821ddfe3 From Parag Chaudhur, "In daeRMaterials.cpp in the COLLADA plugin, in the processTexture function, Lines 519-522
of the source file:

The "delete [] path" appears before the "osg::notify", causing the data pointed to by
"filename" to be deleted before access causing an access violation.

...

I have put a comment on
line 521 where I have moved the "delete []path" below.
"
2007-07-25 10:12:45 +00:00
Robert Osfield
593dfe3193 Updated AUTHORS 2007-07-24 14:52:51 +00:00
Robert Osfield
5967236c06 Updated ChangeLog 2007-07-24 14:47:41 +00:00
Robert Osfield
4542c04046 Updated version for dev release 2007-07-24 14:43:46 +00:00
Robert Osfield
31ddff443a Fixed warning 2007-07-24 14:30:31 +00:00
Robert Osfield
6b4e2fbdf2 From Alexandre Amalric, Fox example
From Robert Osfield, CMake build support for FOX example
2007-07-24 14:02:53 +00:00
Robert Osfield
fee5bc9f8c From Michael Hartman, "Here is an update for the closing issue with the example osgviewerMFC where the MFC rendering thread would not exit before the application and the thread would be left running in the background and the user would have to use TaskManager to kill the process.
Changes:

MFC_OSG.cpp:

            Removed pixelformatdesciptor from the class initialization.

            Used setInheritedWindowPixelFormat to true so it will setup the pixelformat for the window.

            Added class destructor code.

MFC_OSG.h:

            Removed the ref_ptr on osgViewer::Viewer

MFC_OSG_MDIViewer.cpp:

            Changed the OnDestroy function code.

            Added WaitforSingleObject with thread handle for the MFC render handle.

MFC_OSG_MDIView.h:

            Added class variable for MFC Render Thread Handle for use with the WaitforSingleObject.
"
2007-07-23 20:37:49 +00:00
Robert Osfield
9394238720 From Andy Skinner, addition of standard c library includes to avoid issues with using STLport on some platforms. 2007-07-23 20:10:13 +00:00
Robert Osfield
952e644016 Converted tabs to four spaces 2007-07-23 20:08:16 +00:00
Robert Osfield
3740052c23 Updated wrappers 2007-07-23 18:19:02 +00:00
Robert Osfield
4a0a45ad92 From Mathias Froehlich, compile fix for OSX. 2007-07-23 18:13:16 +00:00
Robert Osfield
3eae87854b Added FlushDeletedGLObjectsOperation. 2007-07-23 16:42:25 +00:00
Robert Osfield
ff267d1ad6 Added support for using the CompileContext to do GL object deletion. 2007-07-22 20:33:20 +00:00
Robert Osfield
14fcf4f8b3 Converted usleep call to OpenThreads::Thread::microSleep() to avoid VS build problems 2007-07-21 20:11:16 +00:00
Robert Osfield
a4433e9af4 Added reset it to set block correctly before use. 2007-07-19 18:59:20 +00:00
Robert Osfield
1ed0e0a861 Improved the filtering of changes to master file to prevent using reading from
files that are still under going changes.
2007-07-19 17:02:37 +00:00
Robert Osfield
e8eec312a1 Updated wrappers 2007-07-19 16:42:36 +00:00
Robert Osfield
c3adce3ef4 Added osg::RefBlockCount subclassed from the new OpenThreads::BlockCount and used it into osgterrain example 2007-07-19 15:24:11 +00:00
Robert Osfield
fb1a34a8c5 Added support for using multiple load threads as a thread pool used by the MasterOperation 2007-07-19 12:09:25 +00:00
Robert Osfield
5ec2969330 Added setting of ThreadSafeRefUnref to true. 2007-07-18 16:48:25 +00:00
Robert Osfield
035f49c0b3 Refactored the viewer setup code to use a CustomViewer subclass of Viewer which
wraps up the set up of compile contexts and merging of changes.
2007-07-18 16:17:06 +00:00
Robert Osfield
8c60ea437f Commented out debug messages 2007-07-18 16:14:59 +00:00
Robert Osfield
de69a4a3d8 Added call to State::initializeExtensionsProcs() to prevent crashes before
these variables are initialized.
2007-07-18 14:54:27 +00:00
Robert Osfield
da95b907f1 Added missing export symbol. 2007-07-18 09:05:11 +00:00
Robert Osfield
51e07f1e66 Added traverse method implementation into GeometryTechnique. 2007-07-17 17:36:44 +00:00
Robert Osfield
ea5ca995e3 Merged the new master operation/operation thread code with older standard
terrain set up code.
2007-07-17 16:18:13 +00:00
Robert Osfield
04c1dee7a2 Fixed GraphcicsContext::getMaxContextID so it properly returns the current max contextID.
Fixed the osgviewer's compile context code to account for the above fix.

Added compile context support into osgterrain example.
2007-07-17 10:54:17 +00:00
Robert Osfield
610a76b210 Fixed typo 2007-07-17 09:15:08 +00:00
Robert Osfield
b132aed217 Work in progress on support for dynamically reading a master file in a background thread 2007-07-16 21:39:30 +00:00
Robert Osfield
e40d346fbb Added MasterOperation to do file querry and loading and background thread. 2007-07-16 17:40:38 +00:00
Robert Osfield
166ac4a7d3 Added custom colour support to TransferFunction setup. 2007-07-16 15:47:42 +00:00
Robert Osfield
d4aaa31549 Improvements to the .terrain file support 2007-07-16 15:13:47 +00:00
Robert Osfield
f9fab3c3b0 First steps at provide a .terrain file format to experiment with file
definitions of terrain subgraphs
2007-07-16 12:37:39 +00:00
Robert Osfield
06ad036da1 Updated wrappers 2007-07-14 17:16:09 +00:00
Robert Osfield
1f0edca631 Added support into osg::RenderInfo for a stack of Cameras that allow querries
of which camera is currently active to be querried from within the draw traversal.
2007-07-14 17:07:59 +00:00
Robert Osfield
af19e71024 Changed BarrierOperation so that it isn't limited to jut working within GraphicsContexts. 2007-07-14 09:17:18 +00:00
Robert Osfield
f7ce35c5ee Converted Operations to GraphicsOperations where apporpriate. 2007-07-13 19:24:50 +00:00
Robert Osfield
0a58c6e280 Removed all the plugins BUILD_OSG_* options as these just get in the way of
browsing standard CMake options.
2007-07-13 19:22:09 +00:00
Robert Osfield
a28588a84c Introduce GraphicsOperation subclass from osg::Operation, and osgUtil::GLObjectOperation
for compiling subgraphs.
2007-07-13 17:25:35 +00:00
Robert Osfield
65156475f6 Updated wrappers 2007-07-13 11:49:16 +00:00
Robert Osfield
ee470f2445 From Mathias Froehlich, "This patch removes the X11/Xmu/WinUtil.h header from GraphicsWindowX11.cpp.
That one is not used and appears not to be present on every platform we
compile on."
2007-07-13 11:42:02 +00:00
Robert Osfield
b1f943cef8 From Mathias Froehlich, "This change makes the net plugin compile on hp-ux.
It tries to unify some partly ugly ifdefs in the socket classes.
The change is also tested on a solaris 8, irix 6.5 and suse 9.0 machine."
2007-07-13 11:39:40 +00:00
Robert Osfield
6831940851 Added setCurrentEventState method 2007-07-13 11:31:56 +00:00
Robert Osfield
14ab33cc29 Updated wrappers 2007-07-13 11:22:44 +00:00
Robert Osfield
b2535d55c6 Introduced new GUIEventAdatper singleton for sharing the current state between
multiple GraphicsWindows, this singleton is accessable via GUIEventEvent::getAccumulatedEventState().

Added use of this new singleton in GraphicsWindow* implementations.

Added WindowSizeHandler to osgkeyboard to help with debugging of event state
between windows.
2007-07-13 11:17:41 +00:00
Robert Osfield
03749d5e34 Removed redundent TerrainGeometry classes, and adding double buffer of
internal data within GeometryTechinque in prep for support multi-threaded
set up and rendering of terrain.
2007-07-12 20:12:38 +00:00
Robert Osfield
92ffe6f74a Fixed spelling of cartesian. 2007-07-12 20:10:56 +00:00
Robert Osfield
f753ff6a5a From Martin Lavery, updates to Xcode projects 2007-07-12 16:37:06 +00:00
Robert Osfield
ecf0b58a19 Renamed include/osg/OperationsThread to OperationThread.
Created a new GraphicsThread subclass from OperationThread which allows the
GraphicsContext specific calls to be moved out of the base OperationThread class.

Updated the rest of the OSG to respect these changes.
2007-07-12 15:54:45 +00:00
Robert Osfield
4d7e8b12ae Renamed OperationsThread to OperationThread and add two way link between OperationQueue and OperationThread 2007-07-12 12:15:42 +00:00
Robert Osfield
751c638015 From Martin Lavery, Update to Packaging files for Xcode build 2007-07-12 09:03:43 +00:00
Robert Osfield
4ed9940e71 Added better description of TransferFunction. 2007-07-12 08:29:39 +00:00
Robert Osfield
35435c3146 Updated wrappers 2007-07-11 16:06:24 +00:00
Robert Osfield
095da72020 Fixed typo 2007-07-11 16:06:04 +00:00
Robert Osfield
691a49d0fa From Paul Melis, fixes to spelling mistakes/typos. 2007-07-11 15:51:17 +00:00
Robert Osfield
55f3b67dbb Updated version number in prep for 2.1.1 dev release 2007-07-11 15:50:05 +00:00
Robert Osfield
bdc8a72aae From Andre Garneau, minor warning fixes 2007-07-11 15:30:14 +00:00
Robert Osfield
8779813837 Added support for --sky-light and headlight with local position at 0,0,0 2007-07-11 14:16:02 +00:00
Robert Osfield
b93539ee09 Added setting of the Scene's FrameStamp on each CompositeViewer::updateTraversal() call to fix animation path issue. 2007-07-11 13:48:41 +00:00
Robert Osfield
c58a2235bb From Martin Lavery, update of Xcode projects to meet the latest SVN revision 2007-07-11 09:00:19 +00:00
Robert Osfield
0d38a66bbb Added OperationsThread 2007-07-10 19:29:11 +00:00
Robert Osfield
2e53a2e95e Added test code path which stress tests new thread pool support in OperationsThread 2007-07-10 17:36:33 +00:00
Robert Osfield
6a9551ebfb Wired up OperationsThread to use the new OperationQueue and thereby support
thread pooling where multiple OperationsThreads share a single OperationsQueue
2007-07-10 17:36:01 +00:00
Robert Osfield
44c07b9fad Separated OperationsThread out from the GraphicsThread header and introduced
new OperationQueue class.
2007-07-09 19:04:36 +00:00
Robert Osfield
4d04f3f645 Fixed unitialized variables. 2007-07-09 15:02:03 +00:00
Robert Osfield
aaa0b156ff Updated ChangeLog, osgversion and AUTHORS.txt for 2.1 dev release 2007-07-09 11:37:06 +00:00
Robert Osfield
26e8ba27ca Updated version number for 2.1.0 dev release 2007-07-09 11:05:24 +00:00
Robert Osfield
c407866f30 Added OpertionQueue 2007-07-09 11:05:04 +00:00
Robert Osfield
d70228c98d Added OperationQueue class for future work on support thread pools that share
a single OpeationQueue.
2007-07-09 11:03:33 +00:00
Robert Osfield
e8f8c0c147 Updated wrappers 2007-07-09 10:48:32 +00:00
Robert Osfield
f70b6d0993 Improved the consistency of setting of rotation and auto rotate modes in setAxisAlingment method 2007-07-09 10:47:06 +00:00
Robert Osfield
a4499b482b Fixed missinged intialization of the _threadsRunning variable. 2007-07-09 10:12:37 +00:00
Robert Osfield
7099068914 From Jean-Sebastien Guay and Jan Ciger, added search path can improved handling of backslashes/forward slashes 2007-07-07 16:05:05 +00:00
Robert Osfield
4c379a2848 Updared wrappers 2007-07-06 20:00:11 +00:00
Robert Osfield
50ec07b734 Added include of DeleteHandler 2007-07-06 16:54:45 +00:00
Robert Osfield
2b84aa7760 Added dirty count support to osgTerrain::Layer clases.
Added LayerHandler to osgterrain example that modifies the layers in 
response to pressing the 's' and 'q' keys
2007-07-06 16:47:08 +00:00
Robert Osfield
c4c165099c From Jea-Sebastien Guay and Robert Osfield, build fixes for Windows 2007-07-06 14:07:59 +00:00
Robert Osfield
9e2fe92ef1 From Rudolf Wiedemann, "I need to link OpenSceneGraph statically to my application, so I
completed the new registration of the plugin-readerwriters
("REGISTER_OSGPLUGIN") according to your osgstaticviewer-example (see
attachment, based on today's svn)."
2007-07-06 13:54:26 +00:00
Robert Osfield
a7de33ee55 From Brede Johansen, "Attached is a fix that returns a default color (white) if an invalid
index to the color palette is used."
2007-07-06 13:33:40 +00:00
Robert Osfield
6931ae4878 Added include/osg/GLObjects + .cpp which provide osg::flush*DeletedGLObjects() methods.
Added and cleaned up DeleteHandler calls in osgViewer to help avoid crashes on exit.

Changed DatabasePager across to dynamically checcking osg::getCompileContext(..)

Updated wrappers.
2007-07-06 13:08:51 +00:00
Robert Osfield
a484b95d3c Added #include<algorithm> 2007-07-06 09:06:37 +00:00
Robert Osfield
dedc99f036 Updated wrappers. 2007-07-05 18:41:54 +00:00
Robert Osfield
d1fa520349 Added support for managing a CompileContext. Rearranged the DeleteHandler::flushAll call. 2007-07-05 18:33:20 +00:00
Robert Osfield
7a98691704 Added debug messages to catch key modified state 2007-07-05 18:32:12 +00:00
Robert Osfield
5aa3db15a3 Improved the computation of the side vector 2007-07-05 18:30:57 +00:00
Robert Osfield
601217025f Improved the mapping of update and cull traversal 2007-07-05 18:30:20 +00:00
Robert Osfield
0434d29ad4 From Adndre Garneau, "Attached is a fix to prevent a cursor being shown in graphics windows when
traits specify that none should be used (a recent change forced a
left-pointer cursor as the default). "
2007-07-05 10:57:34 +00:00
Robert Osfield
70bbb06dd5 Commented out "fix" that explictly sets the key modifier state as this change
actually broke the key modifier state management.
2007-07-05 10:51:47 +00:00
Robert Osfield
afc722d43b From Thibault Genessay, "You'll find attached a fix for the comments of the osgwindows example. It fixes a typo in the comments which is quite disturbing for newbies trying to learn using the source (twice 'left' instead of 'left' and 'right').
I've also added a little offset to the windows' positions so that their decoration falls inside the desktop and we can manipulate them - it looks a bit less "made out of wood"."
2007-07-03 17:32:19 +00:00
Robert Osfield
7f0b3144ea Added checking of GUIEventAdpter::getHandled(). 2007-07-03 13:26:48 +00:00
Robert Osfield
dd628a9829 From Roger James, added GL_NORMALIZE mode to scaled models 2007-07-03 10:00:41 +00:00
Robert Osfield
e7d7c1dcc2 Changed the way that computeNearFar is computed to avoid inconsistencies when in stereo mode 2007-07-02 13:17:47 +00:00
Robert Osfield
1522002b47 Updated wrappers 2007-07-02 13:16:54 +00:00
Robert Osfield
e5a6b1a834 From Csaba Halasz, support reading "monochrome" option string and use of monocrhome FreetType support 2007-07-02 12:43:23 +00:00
Robert Osfield
19d1a563fe From Csaba Halasz and Robert Osfield, support for passing in ReaderWriter::Options object into readFontFile 2007-07-02 12:30:14 +00:00
Robert Osfield
c7a316e445 From Mike Connell, "This is a tiny fix for win32.
The current code takes the mouse cursor position and adds it to the
window (left,top) position, and sends the mouse cursor there. But this
doesn't take into account the window decoration.

The new code converts the given (x,y) coordinates from the client area
coordinate system to the screen instead using ClientToScreen. I think
this is the natural windows way to do it.

Tested on XP with osgviewer
"

Note from Robet Osfield, made a few changes to layout to make it more consistent 
with the rest of the OSG and used #if 0 instead if (0) blocks.
2007-06-30 16:19:56 +00:00
Robert Osfield
efda16ac56 From Stephan Huber, "attached you'll find a small fix for the 3ds-plugin, so 3ds-files
exported from cinema 4d are imported correctly. It's not cinema's fault,
because the 3ds-files show up correctly in 3dStudio Max."
2007-06-30 15:40:23 +00:00
Robert Osfield
3873f50214 Updated wrappers 2007-06-30 14:30:55 +00:00
Robert Osfield
aee902720e Added s/getUsage() method 2007-06-30 14:30:44 +00:00
Robert Osfield
bb94377f20 Added balancing of stack size on entry/exit from rendering nested camera. 2007-06-30 14:30:12 +00:00
Robert Osfield
7dd9ea7a30 Added debug path that creates the viewer on the heap. 2007-06-30 14:28:24 +00:00
Robert Osfield
c80313ccd0 From David Callu,
"
Found in the join file the fix for the bug found by Rafa.


    Problem :

        osgIntrospection::Value grp(new osg::Group);

        osgIntrospection::ValueList vlcall;
        vlcall.push_back(osgIntrospection::Value("toto"));

       const osgIntrospection::MethodInfo *m =
grp->getType.getCompatibleMethod("setName", vlcall, true);

       if (m)
       {
            m->invoke(grp, vlcall);      // ** SEGFAULT here
       }





    Algorithm explanation :

          The "invoke" method try to convert "grp", which reflect an
"osg::Group*", in a
          "osgIntrospection::Value", which reflect a "osg::Node*".
This because
          the "setName(const char *)" method found by
"grp->getType.getCompatibleMethod"
          is an "osg::Object" type method.

          When osgIntrospection do this conversion it try :
             - to found a "osgIntrospection::Converter"  to convert
               from "osg::Group*" to "osg::Node*"
             - to found a chain of "osgIntrospection::Converter" to convert
               from "osg::Group*" to "one or many type" to "osg::Node*"
             - to converte an Enum to int or unsigned int
             - to convert the value in its "value string representation",
               then converte this string in the destination value

          Else it throw a "TypeConversionException".







     Bug :

          1)
          When osgIntrospection try to found a chain of
"osgIntrospection::Converter"
          It could do any downcast or (Type to SuperType) or upcast
(SuperType to Type).
          This mean the the chain could be :
          osg::Group to osg::Transform to osg::Camera to
          osg::CullSettings to osg::CullStack to
osg::CollectOccludersVisitor to
          osg::NodeVisitor to osg::Referenced to osg::Object

         During the convertion with this chain, A METTRE failed and
the pointer in
         "grp" is set NULL. But the "grp" is always a valid
"osgIntrospection::Value"
         and so, osgIntrospection accept the conversion. Then it try
to use this pointer
         to call the "setName" function. And Bing SEGFAULT.


         2)
             In "bool Reflection::accum_conv_path( ... )"
             the convection path isn't accumulate in the recursive loop.
             this cause multi request of a conversion path, and a
slowdown in the
             conversion algorithm.

         3)
             Use of the last conversion way in a conversion from
pointer to pointer
             this mean you can do this :
             "osg::Node*" to " value string representation" to "osg::Material*"
             What a bad thing !!!




    Solution :

         1)
          Introduce the concept of dynamic_cast and static_cast.
          now, to do a conversion, osgIntrospection does this :

             - to found a "osgIntrospection::Converter"  to convert
               from "osg::Group*" to "osg::Node*"
             - to found a chain of "osgIntrospection::Converter" to convert
               from "osg::Group*" to "one or many type" to "osg::Node*"
               only with static_cast, downcast (Type to SuperType)

             - to found, if the source and the destination are two pointer,
               a chain of "osgIntrospection::Converter" to convert
               from "osg::Group*" to "one or many type" to "osg::Node*"
               only with dynamic_cast, upcast (SuperType to Type)

             - to convert an Enum to int or to unsigned int
             - to convert the value in its "value string representation",
               then convert this string in the destination value

          Else it throw a "TypeConversionException".


          Add the "enum CastType" to distinguish the static_cast or
dynamic_cast converter.
          Add file OpenSceneGraph/include/osgIntrospection/CastType

         2)
         add a line to accumulate converter in converter Path.

         3)
         add a line to check if source and destination are pointer.
"
2007-06-30 14:21:34 +00:00
Robert Osfield
79dddef778 From Sherman Wilcox, added check for Drawable cull callbck into apply(Billboard) 2007-06-30 09:27:11 +00:00
Robert Osfield
f2a50164b9 Removed the old references to files now removed 2007-06-30 07:09:30 +00:00
Robert Osfield
847a7c1644 Added Point::Extension::isPointSpriteCoordOriginSupported() method 2007-06-29 17:01:37 +00:00
Robert Osfield
604d1a6355 From Sherman Wilcox, added serach for freetype234 2007-06-29 16:37:11 +00:00
Robert Osfield
74af1b8351 From Paul Martz, "Attached is src/osg/CMakeLists.txt. Adding TemplatePrimitiveFunctor to the source code list for the project. This makes this header file show up in the VS IDE as part of this project, and therefore facilitates IDE searching of project-related files, as well as making other tasks easier." 2007-06-29 16:10:24 +00:00
Robert Osfield
ddc26afa16 Fixed indenting to use 4 spaces instead of tabs 2007-06-29 16:09:12 +00:00
Robert Osfield
87788c2360 From Jan Ciger, "I am attaching a fix for the COLLADA plugin on non-windows systems. The
COLLADA modules STLDatabase, LIBXMLPlugin and stdErrPlugin are
statically included in the main COLLADA library on Linux and shouldn't
be linked separately - those libraries do not exist in the default Linux
build and the compilation will fail.

Second issue - the current version of the COLLADA plugin (both current
HEAD in Subversion and the one in stable 2.0) do not work right with the
stable COLLADA DOM 1.4.1. I am getting the following error:
"
2007-06-29 16:06:52 +00:00
Robert Osfield
0ee2466f23 From Roger James, bug fix to counting of number geode with drawables 2007-06-29 16:00:53 +00:00
Robert Osfield
7d2efa886d From Brad Colbert, get/setVolume methods 2007-06-28 20:56:56 +00:00
Robert Osfield
15ff70d298 From Brad Colbert with ammendments by Robert Osfield, add set/getVolume support 2007-06-28 14:19:30 +00:00
Robert Osfield
4953e23ab5 From Trajce Nikolov, fixes to pbuffer setup 2007-06-28 12:59:04 +00:00
Robert Osfield
7a0442a388 From Nikolaus Hanekamp, added support for osg::Multisample 2007-06-28 09:51:47 +00:00
Robert Osfield
49c15572a9 From Stephan Huber, "attached you'll find a first implementation of pbuffer-support for os x.
I used osgprerender --pbuffer to test the carbon-implementation, for now
it works :)
"
2007-06-27 20:44:12 +00:00
Robert Osfield
eac3dc1963 From Paul Melis, "Here is a list of fixes to misspelled APIs. Unfortunately, more than one
of these are public APIs and therefore will break linkage to existing
shared libraries."

Note from Robert Osfield, updated wrappers.
2007-06-27 20:36:16 +00:00
Robert Osfield
64b8e3062f Added temporary reset of the RenderLeaf pointer for any internal calls to other graphics contexts. 2007-06-27 20:34:29 +00:00
Eric WING
a1952f2538 Minor build fixes. Changed/fixed GraphicsWindowCarbon to go into api/Carbon instead of just api/ 2007-06-27 19:51:06 +00:00
Robert Osfield
14470e12c4 From Andy Skinner, fixed return value. 2007-06-27 17:01:54 +00:00
Robert Osfield
60a0e13b2a Updated wrappers 2007-06-27 11:14:40 +00:00
Robert Osfield
97ff495a9c From Rajce Nickolov, improvements to PixelBufferWin32 and GraphicsWindowWin32 2007-06-27 10:37:30 +00:00
Robert Osfield
c0a8c9dd53 Added texture format into Traits. 2007-06-27 10:12:10 +00:00
Robert Osfield
8fea401d79 Fixed target setting bug in PixelBuffer RTT set up. 2007-06-27 09:44:35 +00:00
Robert Osfield
6321579050 Added missing cmake macros 2007-06-26 17:12:48 +00:00
Robert Osfield
746d916fce Reverted to using non silhouette computation. 2007-06-26 11:31:39 +00:00
Robert Osfield
1a78eb8159 Changed the RTT Camera so that it doesn't automatically recompute the near and far planes 2007-06-25 13:48:57 +00:00
Robert Osfield
350b25c49b From Trajce Nickolov, improvements to PixelBufferWin32. 2007-06-25 11:32:19 +00:00
Robert Osfield
77bf21eef7 Set the eol style on CMake .txt files to native 2007-06-25 08:35:06 +00:00
Robert Osfield
c4b3e32436 Updated wrappers 2007-06-24 10:55:43 +00:00
Robert Osfield
1e506da145 From Trajce Nikolov, PixelBufferWin32 implementation 2007-06-24 10:18:54 +00:00
Robert Osfield
b9947a8189 Simplified decoration code and added support for reading Traits::supportsResize 2007-06-23 21:55:35 +00:00
Robert Osfield
5f088ef914 Set the Traits::supportsResize flag to true in default constructor. 2007-06-23 21:54:56 +00:00
Robert Osfield
6c154441e2 Reorder the setProjectionMatrix.. mathod 2007-06-23 11:24:00 +00:00
Robert Osfield
581b1c322e Added setting of the Camera's projection matrix to fit the windowing aspect ratio. 2007-06-23 11:21:54 +00:00
Robert Osfield
4a315e47fe Added optional set up of pbuffers for background compilation of the OpenGL objects
when database paging.
2007-06-22 14:48:43 +00:00
Robert Osfield
1b3468413d Added ability to compile OpenGL objects via pbuffers in the DatabasePager/Viewer 2007-06-22 14:48:18 +00:00
Robert Osfield
1d78ea2983 Added explicit setting of updateText to have DYNAMIC data variance. 2007-06-21 16:14:54 +00:00
Robert Osfield
e8a65e4cff From Trajce Nikolov, windows build fixes 2007-06-21 11:20:54 +00:00
Robert Osfield
4677fe20a7 Added dummy init method 2007-06-20 12:34:37 +00:00
Robert Osfield
1de128de27 Added placeholder for PixelBufferWin32 2007-06-20 12:29:19 +00:00
Robert Osfield
69b778c2ad Corrected graphics context creation message 2007-06-20 12:01:14 +00:00
Robert Osfield
9f72c9392e Added code of support for contouring shaders 2007-06-20 12:00:29 +00:00
Robert Osfield
fadc115066 Updated wrappers 2007-06-20 11:59:53 +00:00
Robert Osfield
78b6ada743 Completed implementation of PixelBufferX11. 2007-06-20 11:59:27 +00:00
Robert Osfield
ac69f49b55 Added beginnings of osgViewer::PixelBufferX11 2007-06-19 17:12:05 +00:00
Robert Osfield
2f293ed60a Added passing of arguments into constructor. 2007-06-19 16:19:34 +00:00
Robert Osfield
5b4a7424f0 Removed OSGVIEWER_EXPORT 2007-06-19 09:16:36 +00:00
Robert Osfield
d4309ce69a Added use of GLSL filters 2007-06-18 12:10:46 +00:00
Robert Osfield
c8c1e1107e From Martin Lavery, Updates to Packages 2007-06-15 17:47:16 +00:00
636 changed files with 34576 additions and 11606 deletions

View File

@@ -1,6 +1,6 @@
OpenSceneGraph Library 1.9.9
OpenSceneGraph Library 2.2.0
264 Contributors:
281 Contributors:
Firstname Surname
-----------------
@@ -11,10 +11,11 @@ Mike Weiblen
Eric Wing
Brede Johansen
Geoff Michel
Farshid Lashkari
Paul Martz
Bob Kuehne
Farshid Lashkari
Stephan Huber
Bob Kuehne
Martin Lavery
Ulrich Hertlein
Eric Sokolowsky
Tree
@@ -22,25 +23,28 @@ Mike Wittman
Luigi Calori
Trajce Nikolov
Pavel Moloshtan
Martin Lavery
Tom Jolley
Mathias Fr<46>hlich
Norman Vine
David Callu
Alberto Farre
Roger James
Andr<EFBFBD> Garneau
Ruben Lopez
Randall Hopper
Roger James
Olaf Flebbe
Gideon May
Don Tidrow
Romano Jos<6F> Magacho da Silva
Michael Gronager
Daniel Sj<53>lie
Colin McDonald
Chris Hanson
Daniel Sj<53>lie
Jean-Sebastien Guay
David Spilling
Andy Skinner
Per Fahlberg
Mathias Fr<46>hlich
Joran Jessurun
Anr<EFBFBD> Garneau
Frederic Marmond
David Fries
Boris Bralo
@@ -48,30 +52,40 @@ Yefei He
Sondra Iverson
Rune Schmidt Jensen
Neil Salter
Mike Connell
Jeremy Moles
Jason Daly
Jason Beverage
David Spilling
David Callu
Ben Discoe
Sasa Bistrovic
Rainer Oder
Mike Connell
Paul Melis
Martin Naylor
Martin Aumueller
Markus Trenkwalder
Loic Dachary
Joakim Simonsson
Jeremy Moles
Jan Peciva
Jan Ciger
Gordon Tomlinson
Brad Colbert
Art Tevs
Andreas Ekstrand
Vivek Rajan
Stephane Simon
Sherman Wilcox
Sean Spicer
Ravi Mathur
Nikolaus Hanekamp
Michael Platings
Loic Dachary
Michael Hartman
Laurens Voerman
Joseph Steel
John Shue
David Guthrie
Corbin Holtz
Brad Christiansen
Adrian Egli
Toshiyuki Takahei
Thom DeCarlo
Terry Welsh
@@ -79,25 +93,24 @@ Simon Julier
Sebastien Grignard
Romano Magacho
Paul de Repentigny
Nikolaus Hanekamp
Michael Hartman
Mihai Radu
Luc Frauciel
Leandro Motta Barros
Laurens Voerman
Jos<EFBFBD> Delport
Carlo Camporesi
Bryan Thrall
Bruce Clay
Brad Colbert
Brad Christiansen
Alberto Barbati
Vladimir Shabanov
Uwe Woessner
Sohey Yamamoto
Serge Lages
Phil Atkin
Paul Melis
Mattias Linde
Mathieu Marache
Maria Ten
Ken Sewell
Julian Ortiz
John Shue
John Kelso
Jeremy Bell
James French
@@ -106,20 +119,23 @@ Donn Mielcarek
Domenico Mangieri
Daniel Larimer
Charles Cole
Bryan Thrall
Andre Garneau
Blake Williams
Antoine Hue
Anders Backman
Ali Botorabi
Zach Deedler
Yuzhong Shen
Tugkan Calapoglu
Tony Horrobin
Tim Daoust
Thibault Genessay
Terrex
Steve Lunsford
Stephan Eilemann
Stanislav Blinov
Roland Smeenk
Riccardo Corsi
Rafa Giatan
Philip Lowman
Peter Hrenka
Perry Miller
@@ -131,12 +147,9 @@ Mathew May
Martijn Kragtwijk
Kevin Moiule
Keith Steffen
Jos<EFBFBD> Delport
Joseph Winston
John Aughey
Johan Nouvel
Jean-Sebastien Guay
Jan Ciger
Igor Kravtchenko
Gerrick Bivins
George Tarantilis
@@ -145,13 +158,11 @@ Fabio Mierlo
Edgar Ellis
David Ergo
Daniel Trstenjak
Blake Williams
Antoine Hue
Andy Skinner
Csaba Halasz
Andrew Sampson
Andrew Lorino
Andreas Goebel
Anders Backman
Alberto Luaces
Zbigniew Sroczynski
Yuri Vilmanis
Wojciech Lewandowski
@@ -167,30 +178,32 @@ Vaclav Bilek
Tyge
Troy Yee
Tino Schwarze
Tim Moore
Thom Carlo
Tery Welsh
Tanguy Fautr<74>
Sylvan Marie
Sylvain Marie
Sherman Wilcox
Shane Arnott
Sebastien Kuntz
Rudolf Wiedemann
Ronny Krueger
Robert Swain
Rick Pingry
Reinhard Sainitzer
Rein Kadijk
Rafa Giatan
Radu Mihai
Ralf Kern
Qing Shen
Philipp Siemoleit
Paul Fredrikson
Parag Chaudhur
Orhun Birsoy
Ole-Morten Duesund
Nicolas Brodu
Nathan Cournia
Morné Pistorius
Morn<EFBFBD> Pistorius
Mirko Viviani
Mikkel Gjøl
Mihai Radu
Michael Polak
Michael Morrison
Michael Logan
@@ -199,13 +212,12 @@ Mauricio Hofmam
Matthew May
Matt Green
Matt Burke
Mathias Froelich
Mathia Walker
Mason Menninger
Martin Spott
Martin Amueller
Mario Valle
Marin Lavery
Maria Ten
Louis Hamilton
Lewis Harmon
Kristopher Bixler
@@ -220,16 +232,16 @@ Joakim Simmonsson
Jay Zuckerman
Jason Howlett
Jason Ballenger
Jan Peciva
J.E. Hoffmann
Henrique Bucher
Gustavo Wagner
Guillaume Millet
Graeme Harkness
Glenn Waldrom
Gian Lorenzetto
George Papagiannakis
Gary Quinn
Frauciel Luc
Galen Faidley
Frashid Lashkari
Frank Warmerdam
Frank Lindeman
@@ -248,23 +260,28 @@ Donny Cipperly
Dean Iverson
David Jung
David Gurhrie
Dan Minor
Clay Fowler
Chuck Sembroski
Chuck Seberion
Chris McGlone
Carlos Garcea
Bruno Herbelin
Brian Keener
Brandon Hamm
Brad Anderegg
Bora Utka
Blasius Czink
Ben van Basten
Bart Gallet
Axel Volley
Andrew Reyonolds
Andreas Jochens
Almalric Alexandre
Allen Bierbaum
Alexandre Amalric
Alberto Jaspe
Alan Purvis
Alan Ott
Alan Harris
Adrian Egli
Adam Richard

View File

@@ -15,14 +15,25 @@ ENDIF(WIN32)
PROJECT(OpenSceneGraph)
SET(OPENSCENEGRAPH_MAJOR_VERSION 2)
SET(OPENSCENEGRAPH_MINOR_VERSION 0)
SET(OPENSCENEGRAPH_MINOR_VERSION 2)
SET(OPENSCENEGRAPH_PATCH_VERSION 0)
SET(OPENSCENEGRAPH_SOVERSION 11)
SET(OPENSCENEGRAPH_SOVERSION 25)
SET(OPENSCENEGRAPH_VERSION ${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION}.${OPENSCENEGRAPH_PATCH_VERSION})
SET(OSG_PLUGINS osgPlugins-${OPENSCENEGRAPH_VERSION})
SET(OSG_PLUGIN_PREFIX "")
IF (CYGWIN)
SET(OSG_PLUGIN_PREFIX "cygwin_")
ENDIF(CYGWIN)
IF(MINGW)
SET(OSG_PLUGIN_PREFIX "mingw_")
ENDIF(MINGW)
# We want to build SONAMES shared librariess
SET(OPENSCENEGRAPH_SONAMES TRUE)
SET(OPENTHREADS_SONAMES TRUE)
@@ -87,14 +98,64 @@ INCLUDE_DIRECTORIES(
#ADD_DEFINITIONS(-D)
# Platform specific definitions
IF(NOT DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT)
SET(DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT OFF)
IF (CMAKE_SYSTEM MATCHES "AIX.*")
SET(DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT ON)
ENDIF(CMAKE_SYSTEM MATCHES "AIX.*")
IF (APPLE)
SET(DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT ON)
ENDIF(APPLE)
ENDIF(NOT DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT)
OPTION(OSG_GLU_TESS_CALLBACK_TRIPLEDOT "Set to ON to build build with (...) version of GLU tesselator callback" ${DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT})
IF (OSG_GLU_TESS_CALLBACK_TRIPLEDOT)
ADD_DEFINITIONS(-DGLU_TESS_CALLBACK_TRIPLEDOT)
ENDIF(OSG_GLU_TESS_CALLBACK_TRIPLEDOT)
IF(WIN32)
ADD_DEFINITIONS(-D_SCL_SECURE_NO_WARNINGS)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
#needed for net plugin
SET (OSG_SOCKET_LIBS wsock32.lib)
SET (OSG_SOCKET_LIBS wsock32)
# Both Cygwin and Msys need -DNOMINMAX ???
IF(UNIX)
ADD_DEFINITIONS(-DNOMINMAX)
ENDIF(UNIX)
########################################################################################################
# the foolowing options are MSVC specific,
# the first OSG_MSVC_VERSIONED_DLL activate a custom build-time layout that should allow to run examples and application
# fron bin folder without requiring installation step.
# it also prepend "osg${OPENSCENEGRAPH_SOVERSION}-" to only .dll files, leaving .lib files untouched in lib
# it also use a hack to get rid of Debug and Release folder in MSVC projects
# all the .dll and .pdb are in bin and all the .lib and .exp are in lib
#
# the second option disable incremental linking in debug build , that is enabled by default by CMake
##########################################################################################################
IF(MSVC)
IF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4 AND ${CMAKE_PATCH_VERSION} LESS 7)
MESSAGE("Warning: disabling versioned options 2.4.6 exibits inconsintencies in .pdb naming, at least under MSVC, suggested upgrading at least to 2.4.7")
SET(OSG_MSVC_VERSIONED_DLL OFF)
SET(OSG_MSVC_DEBUG_INCREMENTAL_LINK ON)
ELSE(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4 AND ${CMAKE_PATCH_VERSION} LESS 7)
OPTION(OSG_MSVC_VERSIONED_DLL "Set to ON to build OpenSceneGraph with versioned dll names" ON)
MARK_AS_ADVANCED(OSG_MSVC_VERSIONED_DLL)
OPTION(OSG_MSVC_DEBUG_INCREMENTAL_LINK "Set to OFF to build OpenSceneGraph without incremental linking in debug (release is off by default)" ON)
MARK_AS_ADVANCED(OSG_MSVC_DEBUG_INCREMENTAL_LINK)
IF(NOT OSG_MSVC_DEBUG_INCREMENTAL_LINK)
SET(CMAKE_MODULE_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO")
SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO")
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "/debug /INCREMENTAL:NO")
ENDIF(NOT OSG_MSVC_DEBUG_INCREMENTAL_LINK)
ENDIF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4 AND ${CMAKE_PATCH_VERSION} LESS 7)
ENDIF(MSVC)
ENDIF(WIN32)
########################################################################################################
@@ -140,6 +201,7 @@ FIND_PACKAGE(FreeType)
FIND_PACKAGE(FLTK)
FIND_PACKAGE(GLUT)
FIND_PACKAGE(SDL)
FIND_PACKAGE(FOX)
FIND_PACKAGE(Inventor)
FIND_PACKAGE(Jasper)
FIND_PACKAGE(COLLADA)
@@ -147,15 +209,33 @@ FIND_PACKAGE(Xine)
FIND_PACKAGE(OpenVRML)
FIND_PACKAGE(Performer)
FIND_PACKAGE(ZLIB)
# SET(DESIRED_QT_VERSION 3)
# FIND_PACKAGE(Qt)
FIND_PACKAGE(Qt3)
FIND_PACKAGE(Qt4)
FIND_PACKAGE(GDAL)
SET(wxWidgets_USE_LIBS base core gl net)
FIND_PACKAGE(wxWidgets)
# To select a specific version of QT define DESIRED_QT_VERSION
# via cmake -DDESIRED_QT_VERSION=4
IF (DESIRED_QT_VERSION)
IF (DESIRED_QT_VERSION MATCHES 4)
FIND_PACKAGE(Qt4)
ELSE(DESIRED_QT_VERSION MATCHES 4)
FIND_PACKAGE(Qt3)
ENDIF(DESIRED_QT_VERSION MATCHES 4)
ELSE(DESIRED_QT_VERSION)
FIND_PACKAGE(Qt4)
IF (NOT QT4_FOUND)
FIND_PACKAGE(Qt3)
ENDIF(NOT QT4_FOUND)
ENDIF(DESIRED_QT_VERSION)
# Platform specific:
# (We can approach this one of two ways. We can try to FIND everything
# and simply check if we found the packages before actually building
@@ -216,7 +296,9 @@ SET(EXECUTABLE_OUTPUT_PATH ${OUTPUT_BINDIR})
#SET(OUTPUT_LIBDIR ${PROJECT_BINARY_DIR}/lib/${CMAKE_SYSTEM_NAME})
SET(OUTPUT_LIBDIR ${PROJECT_BINARY_DIR}/lib)
MAKE_DIRECTORY(${OUTPUT_LIBDIR})
MAKE_DIRECTORY(${OUTPUT_LIBDIR}/${OSG_PLUGINS})
IF(NOT MSVC)
MAKE_DIRECTORY(${OUTPUT_LIBDIR}/${OSG_PLUGINS})
ENDIF(NOT MSVC)
SET(LIBRARY_OUTPUT_PATH ${OUTPUT_LIBDIR})
@@ -289,13 +371,15 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
# errors instead of warnings for certain issues, including superfluous
# semicolons and commas, and the use of long long. -fpermissive seems
# to be the workaround.
SET(OSG_AGGRESSIVE_WARNING_FLAGS "-Wall -Wparentheses -Wformat=2 -Wno-long-long -Wno-import -pedantic -Wnewline-eof -Wreturn-type -Wmissing-braces -Wunknown-pragmas -Wunused -fpermissive")
SET(OSG_AGGRESSIVE_WARNING_FLAGS "-Wall -Wparentheses -Wformat=2 -Wno-long-long -Wno-import -pedantic -Wreturn-type -Wmissing-braces -Wunknown-pragmas -Wunused -fpermissive")
ELSE(CMAKE_COMPILER_IS_GNUCXX)
IF(MSVC)
# FIXME: What are good aggressive warning flags for Visual Studio?
# And do we need to further subcase this for different versions of VS?
# CMake variables: MSVC60, MSVC70, MSVC71, MSVC80, CMAKE_COMPILER_2005
SET(OSG_AGGRESSIVE_WARNING_FLAGS "/Wall /W4")
ELSE(MSVC)
# CMake lacks an elseif, so other non-gcc, non-VS compilers need
# to be listed below. If unhandled, OSG_AGGRESSIVE_WARNING_FLAGS should

View File

@@ -52,7 +52,7 @@ ENDMACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES SEARCHPATHLIST DEBUGS
MACRO(SEARCH_3RDPARTY OSG_3RDPARTY_BIN)
FIND_DEPENDENCY(TIFF tiff.h libtiff ${OSG_3RDPARTY_BIN} "D")
FIND_DEPENDENCY(FREETYPE ft2build.h "freetype;freetype219;freetype234MT" ${OSG_3RDPARTY_BIN} "_D")
FIND_DEPENDENCY(FREETYPE ft2build.h "freetype;freetype219;freetype234;freetype234MT" ${OSG_3RDPARTY_BIN} "_D")
IF(FREETYPE_FOUND)
#forcing subsequent FindFreeType stuff to not search for other variables.... kind of a hack
SET(FREETYPE_INCLUDE_DIR_ft2build ${FREETYPE_INCLUDE_DIR} CACHE PATH "")

View File

@@ -0,0 +1,74 @@
# Locate gdal
# This module defines
# FOX_LIBRARY
# FOX_FOUND, if false, do not try to link to gdal
# FOX_INCLUDE_DIR, where to find the headers
#
# $FOX_DIR is an environment variable that would
# correspond to the ./configure --prefix=$FOX_DIR
#
# Created by Robert Osfield.
FIND_PATH(FOX_INCLUDE_DIR fx.h
$ENV{FOX_DIR}/include/fox-1.6
$ENV{FOX_DIR}/fox-1.6
$ENV{OSGDIR}/include/fox-1.6
$ENV{OSGDIR}/fox-1.6
$ENV{OSG_ROOT}/include/fox-1.6
~/Library/Frameworks/fox-1.6
/Library/Frameworks/fox-1.6
/usr/local/include/fox-1.6
/usr/include/fox-1.6
/sw/include/fox-1.6 # Fink
/opt/local/include/fox-1.6 # DarwinPorts
/opt/csw/include/fox-1.6 # Blastwave
/opt/include/fox-1.6
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include/fox-1.6
/usr/freeware/include/fox-1.6
$ENV{FOX_DIR}/include
$ENV{FOX_DIR}
$ENV{OSGDIR}/include
$ENV{OSGDIR}
$ENV{OSG_ROOT}/include
~/Library/Frameworks
/Library/Frameworks
/usr/local/include
/usr/include
/sw/include # Fink
/opt/local/include # DarwinPorts
/opt/csw/include # Blastwave
/opt/include
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
/usr/freeware/include
)
MACRO(FIND_FOX_LIBRARY MYLIBRARY MYLIBRARYNAME)
FIND_LIBRARY(${MYLIBRARY}
NAMES ${MYLIBRARYNAME}
PATHS
$ENV{FOX_DIR}/lib
$ENV{FOX_DIR}
$ENV{OSGDIR}/lib
$ENV{OSGDIR}
$ENV{OSG_ROOT}/lib
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
/usr/freeware/lib64
)
ENDMACRO(FIND_FOX_LIBRARY LIBRARY LIBRARYNAME)
FIND_FOX_LIBRARY(FOX_LIBRARY FOX-1.6)
SET(FOX_FOUND "NO")
IF(FOX_LIBRARY AND FOX_INCLUDE_DIR)
SET(FOX_FOUND "YES")
ENDIF(FOX_LIBRARY AND FOX_INCLUDE_DIR)

View File

@@ -0,0 +1,58 @@
# Locate gdal
# This module defines
# GDAL_LIBRARY
# GDAL_FOUND, if false, do not try to link to gdal
# GDAL_INCLUDE_DIR, where to find the headers
#
# $GDAL_DIR is an environment variable that would
# correspond to the ./configure --prefix=$GDAL_DIR
#
# Created by Robert Osfield.
FIND_PATH(GDAL_INCLUDE_DIR gdal.h
${GDAL_DIR}/include
$ENV{GDAL_DIR}/include
$ENV{GDAL_DIR}
$ENV{OSGDIR}/include
$ENV{OSGDIR}
$ENV{OSG_ROOT}/include
~/Library/Frameworks
/Library/Frameworks
/usr/local/include
/usr/include
/usr/include/gdal
/sw/include # Fink
/opt/local/include # DarwinPorts
/opt/csw/include # Blastwave
/opt/include
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
/usr/freeware/include
)
FIND_LIBRARY(GDAL_LIBRARY
NAMES gdal gdal_i gdal1.4.0 gdal1.3.2
PATHS
${GDAL_DIR}/lib
$ENV{GDAL_DIR}/lib
$ENV{GDAL_DIR}
$ENV{OSGDIR}/lib
$ENV{OSGDIR}
$ENV{OSG_ROOT}/lib
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
/usr/freeware/lib64
)
SET(GDAL_FOUND "NO")
IF(GDAL_LIBRARY AND GDAL_INCLUDE_DIR)
SET(GDAL_FOUND "YES")
ENDIF(GDAL_LIBRARY AND GDAL_INCLUDE_DIR)

View File

@@ -1,8 +1,9 @@
# - Locate Inventor
# This module defines:
# INVENTOR_FOUND, if false, do not try to link against Inventor.
# INVENTOR_LIBRARY, the library to link against.
# INVENTOR_INCLUDE_DIR, where to find headers.
# INVENTOR_LIBRARY, the library to link against.
# INVENTOR_LIBRARY_DEBUG, the debug library to link against.
FIND_PATH(INVENTOR_INCLUDE_DIR Inventor/So.h
/usr/local/include
@@ -11,10 +12,11 @@ FIND_PATH(INVENTOR_INCLUDE_DIR Inventor/So.h
/opt/local/include
/opt/csw/include
/opt/include
$ENV{COINDIR}/include
)
FIND_LIBRARY(INVENTOR_LIBRARY
NAMES Coin
NAMES coin2 Coin
PATHS
/usr/local/lib
/usr/lib
@@ -22,6 +24,7 @@ FIND_LIBRARY(INVENTOR_LIBRARY
/opt/local/lib
/opt/csw/lib
/opt/lib
$ENV{COINDIR}/lib
)
IF(NOT INVENTOR_LIBRARY)
# If we can't find libCoin try libInventor
@@ -37,6 +40,23 @@ IF(NOT INVENTOR_LIBRARY)
)
ENDIF(NOT INVENTOR_LIBRARY)
FIND_LIBRARY(INVENTOR_LIBRARY_DEBUG
NAMES coin2d
PATHS
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
$ENV{COINDIR}/lib
)
IF(NOT INVENTOR_LIBRARY_DEBUG)
IF(INVENTOR_LIBRARY)
SET(INVENTOR_LIBRARY_DEBUG INVENTOR_LIBRARY)
ENDIF(INVENTOR_LIBRARY)
ENDIF(NOT INVENTOR_LIBRARY_DEBUG)
SET(INVENTOR_FOUND "NO")
IF(INVENTOR_INCLUDE_DIR AND INVENTOR_LIBRARY)
SET(INVENTOR_FOUND "YES")

View File

@@ -0,0 +1,65 @@
# Locate gdal
# This module defines
# OSG_LIBRARY
# OSG_FOUND, if false, do not try to link to gdal
# OSG_INCLUDE_DIR, where to find the headers
#
# $OSG_DIR is an environment variable that would
# correspond to the ./configure --prefix=$OSG_DIR
#
# Created by Robert Osfield.
FIND_PATH(OSG_INCLUDE_DIR osg/Node
$ENV{OSG_DIR}/include
$ENV{OSG_DIR}
$ENV{OSGDIR}/include
$ENV{OSGDIR}
$ENV{OSG_ROOT}/include
~/Library/Frameworks
/Library/Frameworks
/usr/local/include
/usr/include
/sw/include # Fink
/opt/local/include # DarwinPorts
/opt/csw/include # Blastwave
/opt/include
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/include
/usr/freeware/include
)
MACRO(FIND_OSG_LIBRARY MYLIBRARY MYLIBRARYNAME)
FIND_LIBRARY(${MYLIBRARY}
NAMES ${MYLIBRARYNAME}
PATHS
$ENV{OSG_DIR}/lib
$ENV{OSG_DIR}
$ENV{OSGDIR}/lib
$ENV{OSGDIR}
$ENV{OSG_ROOT}/lib
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
/usr/freeware/lib64
)
ENDMACRO(FIND_OSG_LIBRARY LIBRARY LIBRARYNAME)
FIND_OSG_LIBRARY(OSG_LIBRARY osg)
FIND_OSG_LIBRARY(OSGUTIL_LIBRARY osgUtil)
FIND_OSG_LIBRARY(OSGDB_LIBRARY osgDB)
FIND_OSG_LIBRARY(OSGTEXT_LIBRARY osgText)
FIND_OSG_LIBRARY(OSGTERRAIN_LIBRARY osgTerrain)
FIND_OSG_LIBRARY(OSGFX_LIBRARY osgFX)
FIND_OSG_LIBRARY(OSGVIEWER_LIBRARY osgViewer)
SET(OSG_FOUND "NO")
IF(OSG_LIBRARY AND OSG_INCLUDE_DIR)
SET(OSG_FOUND "YES")
ENDIF(OSG_LIBRARY AND OSG_INCLUDE_DIR)

View File

@@ -8,6 +8,7 @@
# correspond to the ./configure --prefix=$OPENVRML_DIR
#
# Created by Robert Osfield.
# Modified for the debug library by Jean-S<>bastien Guay.
FIND_PATH(OPENVRML_INCLUDE_DIR openvrml/openvrml/common.h
$ENV{OPENVRML_DIR}/include
@@ -47,6 +48,26 @@ FIND_LIBRARY(OPENVRML_LIBRARY
/usr/freeware/lib64
)
FIND_LIBRARY(OPENVRML_LIBRARY_DEBUG
NAMES openvrmld
PATHS
$ENV{OPENVRML_DIR}/lib
$ENV{OPENVRML_DIR}
$ENV{OSGDIR}/lib
$ENV{OSGDIR}
$ENV{OSG_ROOT}/lib
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
/usr/freeware/lib64
)
SET(OPENVRML_FOUND "NO")
IF(OPENVRML_LIBRARY AND OPENVRML_INCLUDE_DIR)
SET(OPENVRML_FOUND "YES")

View File

@@ -10,6 +10,8 @@
# Created by Robert Osfield.
FIND_PATH(PERFORMER_INCLUDE_DIR Performer/pfdu.h
$ENV{PFROOT}/include
$ENV{PFROOT}
$ENV{PERFORMER_DIR}/include
$ENV{PERFORMER_DIR}
$ENV{OSGDIR}/include
@@ -27,25 +29,51 @@ FIND_PATH(PERFORMER_INCLUDE_DIR Performer/pfdu.h
/usr/freeware/include
)
FIND_LIBRARY(PERFORMER_LIBRARY
NAMES pf
PATHS
$ENV{PERFORMER_DIR}/lib
$ENV{PERFORMER_DIR}
$ENV{OSGDIR}/lib
$ENV{OSGDIR}
$ENV{OSG_ROOT}/lib
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
/usr/freeware/lib64
)
IF(MSVC)
FIND_LIBRARY(PERFORMER_LIBRARY
NAMES libpf
PATHS
$ENV{PFROOT}/lib
$ENV{PFROOT}
$ENV{PERFORMER_DIR}/lib
$ENV{PERFORMER_DIR}
$ENV{OSGDIR}/lib
$ENV{OSGDIR}
$ENV{OSG_ROOT}/lib
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
/usr/freeware/lib64
)
ELSE(MSVC)
FIND_LIBRARY(PERFORMER_LIBRARY
NAMES pf
PATHS
$ENV{PFROOT}/lib
$ENV{PFROOT}
$ENV{PERFORMER_DIR}/lib
$ENV{PERFORMER_DIR}
$ENV{OSGDIR}/lib
$ENV{OSGDIR}
$ENV{OSG_ROOT}/lib
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
/usr/freeware/lib64
)
ENDIF(MSVC)
SET(PERFORMER_FOUND "NO")
IF(PERFORMER_LIBRARY AND PERFORMER_INCLUDE_DIR)

View File

@@ -21,6 +21,9 @@ SOURCE_GROUP(
FILES ${LIB_PUBLIC_HEADERS}
)
IF(MSVC AND OSG_MSVC_VERSIONED_DLL)
HANDLE_MSVC_DLL()
ENDIF(MSVC AND OSG_MSVC_VERSIONED_DLL)
INSTALL(
TARGETS ${LIB_NAME}

View File

@@ -22,7 +22,17 @@ ENDMACRO(LINK_WITH_VARIABLES TRGTNAME)
MACRO(LINK_INTERNAL TRGTNAME)
FOREACH(LINKLIB ${ARGN})
IF(MSVC AND OSG_MSVC_VERSIONED_DLL)
#when using versioned names, the .dll name differ from .lib name, there is a problem with that:
#CMake 2.4.7, at least seem to use PREFIX instead of IMPORT_PREFIX for computing linkage info to use into projects,
# so we full path name to specify linkage, this prevent automatic inferencing of dependencies, so we add explicit depemdencies
#to library targets used
TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${OUTPUT_LIBDIR}/${LINKLIB}" debug "${OUTPUT_LIBDIR}/${LINKLIB}${CMAKE_DEBUG_POSTFIX}")
ADD_DEPENDENCIES(${TRGTNAME} ${LINKLIB})
ELSE(MSVC AND OSG_MSVC_VERSIONED_DLL)
TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${LINKLIB}" debug "${LINKLIB}${CMAKE_DEBUG_POSTFIX}")
ENDIF(MSVC AND OSG_MSVC_VERSIONED_DLL)
ENDFOREACH(LINKLIB)
ENDMACRO(LINK_INTERNAL TRGTNAME)
@@ -82,16 +92,21 @@ MACRO(SETUP_LINK_LIBRARIES)
ENDIF(TO_INSERT)
ENDFOREACH(LINKLIB)
FOREACH(LINKLIB ${TARGET_LIBRARIES})
TARGET_LINK_LIBRARIES(${TARGET_TARGETNAME} optimized ${LINKLIB} debug "${LINKLIB}${CMAKE_DEBUG_POSTFIX}")
ENDFOREACH(LINKLIB)
# FOREACH(LINKLIB ${TARGET_LIBRARIES})
# TARGET_LINK_LIBRARIES(${TARGET_TARGETNAME} optimized ${LINKLIB} debug "${LINKLIB}${CMAKE_DEBUG_POSTFIX}")
# ENDFOREACH(LINKLIB)
LINK_INTERNAL(${TARGET_TARGETNAME} ${TARGET_LIBRARIES})
FOREACH(LINKLIB ${TARGET_EXTERNAL_LIBRARIES})
TARGET_LINK_LIBRARIES(${TARGET_TARGETNAME} ${LINKLIB})
ENDFOREACH(LINKLIB)
IF(TARGET_LIBRARIES_VARS)
LINK_WITH_VARIABLES(${TARGET_TARGETNAME} ${TARGET_LIBRARIES_VARS})
ENDIF(TARGET_LIBRARIES_VARS)
IF(MSVC AND OSG_MSVC_VERSIONED_DLL)
#when using full path name to specify linkage, it seems that already linked libs must be specified
LINK_EXTERNAL(${TARGET_TARGETNAME} ${OPENGL_LIBRARIES})
ENDIF(MSVC AND OSG_MSVC_VERSIONED_DLL)
ENDMACRO(SETUP_LINK_LIBRARIES)
############################################################################################
@@ -121,9 +136,28 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME)
ADD_LIBRARY(${TARGET_TARGETNAME} STATIC ${TARGET_SRC} ${TARGET_H})
ENDIF(DYNAMIC_OPENSCENEGRAPH)
#not sure if needed, but for plugins only msvc need the d suffix
#not sure if needed, but for plugins only Msvc need the d suffix
IF(NOT MSVC)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES DEBUG_POSTFIX "")
ELSE(NOT MSVC)
IF(OSG_MSVC_VERSIONED_DLL)
#this is a hack... the build place is set to lib/<debug or release> by LIBARARY_OUTPUT_PATH equal to OUTPUT_LIBDIR
#the .lib will be crated in ../ so going straight in lib by the IMPORT_PREFIX property
#because we want dll placed in OUTPUT_BINDIR ie the bin folder sibling of lib, we can use ../../bin to go there,
#it is hardcoded, we should compute OUTPUT_BINDIR position relative to OUTPUT_LIBDIR ... to be implemented
#changing bin to something else breaks this hack
#the dll are placed in bin/${OSG_PLUGINS}
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "../../bin/${OSG_PLUGINS}/")
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES IMPORT_PREFIX "../")
ELSE(OSG_MSVC_VERSIONED_DLL)
#in standard mode (unversioned) the .lib and .dll are placed in lib/<debug or release>/${OSG_PLUGINS}.
#here the PREFIX property has been used, the same result would be accomplidhe by prepending ${OSG_PLUGINS}/ to OUTPUT_NAME target property
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "${OSG_PLUGINS}/")
ENDIF(OSG_MSVC_VERSIONED_DLL)
ENDIF(NOT MSVC)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL}")
@@ -131,7 +165,7 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME)
#the installation path are differentiated for win32 that install in bib versus other architecture that install in lib${LIB_POSTFIX}/${OSG_PLUGINS}
IF(WIN32)
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION bin )
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib/${OSG_PLUGINS} LIBRARY DESTINATION bin/${OSG_PLUGINS} )
ELSE(WIN32)
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} LIBRARY DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} )
ENDIF(WIN32)
@@ -189,7 +223,9 @@ MACRO(SETUP_EXE IS_COMMANDLINE_APP)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL}")
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES OUTPUT_NAME ${TARGET_NAME})
IF(MSVC AND OSG_MSVC_VERSIONED_DLL)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "../")
ENDIF(MSVC AND OSG_MSVC_VERSIONED_DLL)
SETUP_LINK_LIBRARIES()
ENDMACRO(SETUP_EXE)
@@ -240,3 +276,33 @@ MACRO(SETUP_COMMANDLINE_EXAMPLE EXAMPLE_NAME)
SETUP_EXAMPLE(${EXAMPLE_NAME} 1)
ENDMACRO(SETUP_COMMANDLINE_EXAMPLE)
# Takes two optional arguments -- osg prefix and osg version
MACRO(HANDLE_MSVC_DLL)
#this is a hack... the build place is set to lib/<debug or release> by LIBARARY_OUTPUT_PATH equal to OUTPUT_LIBDIR
#the .lib will be crated in ../ so going straight in lib by the IMPORT_PREFIX property
#because we want dll placed in OUTPUT_BINDIR ie the bin folder sibling of lib, we can use ../../bin to go there,
#it is hardcoded, we should compute OUTPUT_BINDIR position relative to OUTPUT_LIBDIR ... to be implemented
#changing bin to something else breaks this hack
#the dll are versioned by prefixing the name with osg${OPENSCENEGRAPH_SOVERSION}-
# LIB_PREFIX: use "osg" by default, else whatever we've been given.
IF(${ARGC} GREATER 0)
SET(LIB_PREFIX ${ARGV0})
ELSE(${ARGC} GREATER 0)
SET(LIB_PREFIX osg)
ENDIF(${ARGC} GREATER 0)
# LIB_SOVERSION: use OSG's soversion by default, else whatever we've been given
IF(${ARGC} GREATER 1)
SET(LIB_SOVERSION ${ARGV1})
ELSE(${ARGC} GREATER 1)
SET(LIB_SOVERSION ${OPENSCENEGRAPH_SOVERSION})
ENDIF(${ARGC} GREATER 1)
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../../bin/${LIB_PREFIX}${LIB_SOVERSION}-")
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES IMPORT_PREFIX "../")
# SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../../bin/osg${OPENSCENEGRAPH_SOVERSION}-")
# SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES IMPORT_PREFIX "../")
ENDMACRO(HANDLE_MSVC_DLL)

2680
ChangeLog

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,62 @@
OSG News
========
= OpenSceneGraph 2.2 release adds support for advanced displays, soft and parallel split shadow maps and easier builds =
PERTHSHIRE, Scotland - 4th October 2007 - !OpenSceneGraph Professional Services announces the release of !OpenSceneGraph 2.2, the industry's leading open-source scene graph technology, designed to accelerate application development and improve 3D graphics performance. !OpenSceneGraph 2.2 written entirely in Standard C++ and built upon OpenGL, offers developers working in the visual simulation, game development, virtual reality, scientific visualization and modeling markets - a real-time visualization tool which eclipses commercial scene graph toolkits in functionality, stability and performance. !OpenSceneGraph 2.2 runs on all Microsoft Windows platforms, Apple OS/X, GNU/Linux, IRIX, Solaris, HP-UX, AIX and !FreeBSD operating systems.
=== Open-source development delivers industry-leading features and performance ===
The !OpenSceneGraph 2.2 release is the culmination of 8 years of work by the lead developers and the open-source community that has grown up around the project. The real-time graphics industry and academia embraced it from the very beginning, deploying it in real-world applications, and actively participating in its development, testing and refinement. The end result is a high-quality library with a feature set relevant to application developers' needs.
=== Updates include: ===
* Improved build support under Windows including versioning of dll's to avoid problems with mixing !OpenSceneGraph versions on a single system.
* Support for Texture2DArray and integer texture OpenGL extensions.
* Support for spherical displays.
* Support for checkerboard stereo displays.
* Soft Shadows and Parallel Split Shadow Maps now supported.
* Viewer configuration file support
* Writer support for Inventor, OBJ 3D formats
* Writer support for HDR imagery
* Viewer Configuration file support
* Unification of threading models and viewer event handlers so that all now work for both Viewer and !CompositeViewer classes.
* GDAL plugin for support for a wide range of geospatial imagery and digital elevation maps formats.
* A wide range of build and bug fixes.
=== Downloads and Licensing ===
!OpenSceneGraph is open-source so full source code is provided, and can be copied, modified and used free of charge for commercial and non-commercial use. Access to the source allows end users greater flexibility in how they develop, debug and deploy their applications. They gain productivity and freedom by being able to leverage the tool chain in accordance with their own release cycles. Downloads of binaries and source can be found in the [http://www.openscenegraph.org/projects/osg/wiki/Downloads Downloads] section of the openscenegraph.org website. [Downloads Downloads]
!OpenSceneGraph is released under the [http://www.openscenegraph.org/projects/osg/wiki/Legal OpenSceneGraph Public License], which is based on the Lesser GNU Public License (LGPL), permitting the software to be used free of charge across the full spectrum of commercial and open-source applications. Furthermore, it allows both static and dynamic linking of the !OpenSceneGraph libraries without restricting the licensing of the user's software.
=== !OpenSceneGraph Books now available ===
The !OpenSceneGraph Quick Start Guide is now available in Chinese as well as English, and alongside the Reference Manual books can be found at [http://www.osgbooks.com OsgBooks].
=== Professional support and services ===
!OpenSceneGraph project is backed up with professional services by [http://openscenegraph.com OpenSceneGraph Professional Services], based in Scotland, and [http://www.skew-matrix.com Skew-Matrix] and [http://www.blue-newt.com Blue-Newt Software] both based in the USA.
* Confidential Professional Support
* Bespoke development
* Consultancy
* Training
=== Community support and contributions ===
The diverse and growing community of over 1700 developers is centered around the public osg-users mailing list, where members discuss how best to use !OpenSceneGraph, provide mutual support, and coordinate development of new features and bug fixes. Members of this community come from many different countries with backgrounds ranging from some of the world's largest aerospace companies, game companies, and visual simulation specialists to university researchers, students and hobbyists.
The !OpenSceneGraph project owes a great deal to the community for its development and support, in particular we wish to thank the [http://www.openscenegraph.org/projects/osg/wiki/Support/Contributors/TwoPointTwo 282 individuals] from around the world that have directly contributed to the development and refinement of the !OpenSceneGraph code base.
----
About !OpenSceneGraph:[[BR]]
!OpenSceneGraph Project was founded in September 1999 by Don Burns and Robert Osfield.
Further information, screenshots, downloads, documentation, and support links can be found on the !OpenSceneGraph project website http://www.openscenegraph.org.
About !OpenSceneGraph Professional Services:[[BR]]
!OpenSceneGraph Professional Services, founded by project lead Robert Osfield in April 2001, is based in Callander, Perhshire, Scotland, and provides professional services on top of !OpenSceneGraph. Further information about the services it provides can be found at http://www.openscenegraph.com.
--------------------------------------------------------------------------------
!!![=OpenSceneGraph=] 2.0 release improves ease-of-use and scalability, introducing new osgViewer, osgShadow and osgManipulator libraries, new build system, improved multi-core, multi-GPU support.
@@ -57,6 +113,8 @@ The [=OpenSceneGraph=] project owes a great deal to the community for its develo
Robert Osfield\\
Project Lead and Proprietor [=OpenSceneGraph=] Professional Services
--------------------------------------------------------------------------------
!!![=OpenSceneGraph=] 1.2 release introduces Windows 64bit and AIX support, COLLADA support, processor affinity and texture atlas builder.

View File

@@ -10,7 +10,7 @@ For the impatient, read the simplified build notes below.
Robert Osfield.
Project Lead.
15th June 2007.
3rd October 2007.
--
@@ -24,7 +24,10 @@ checks for installed dependenciesand then generates the appropriate
build system.
If you don't already have CMake installed on your system you can grab
it from http://www.cmake.org, use version 2.4.6 or later.
it from http://www.cmake.org, use version 2.4.6 or later. Details on the
OpenSceneGraph's CMake build can be found at:
http://www.openscenegraph.org/projects/osg/wiki/Build/CMake
Under unices (i.e. Linux, IRIX, Solaris, Free-BSD, HP-Ux, AIX, OSX)
use the cmake or ccmake command-line utils, or use the included tiny
@@ -32,10 +35,10 @@ configure script that'll run cmake for you. The configure script
simply runs 'cmake . -DCMAKE_BUILD_TYPE=Release' to ensure that you
get the best performance from your final libraries/applications.
cd OpenSceneGraph
./configure
make
sudo make install
cd OpenSceneGraph
./configure
make
sudo make install
Alternatively, you can create an out-of-source build directory and run
cmake or ccmake from there. The advantage to this approach is that the
@@ -44,22 +47,23 @@ source directory, and also makes it possible to have multiple
independent build targets by creating multiple build directories. In a
directory alongside the OpenSceneGraph use:
mkdir build
cd build
cmake ../OpenSceneGraph -DCMAKE_BUILD_TYPE=Release
make
sudo make install
mkdir build
cd build
cmake ../OpenSceneGraph -DCMAKE_BUILD_TYPE=Release
make
sudo make install
Under Windows use the GUI tool CMakeSetup to build your VisualStudio
files. The following page on our wiki dedicated to the CMake build
system should help guide you through the process:
http://www.openscenegraph.com/index.php?page=Build.CMake
http://www.openscenegraph.org/projects/osg/wiki/Support/PlatformSpecifics/VisualStudio
Under OSX you can either use the CMake build system above, or use the
Xcode projects that you will find in the OpenSceneGraph/Xcode
directory.
For further details on compilation, installation and platform-specific
information read "Getting Started" at http://www.openscenegraph.org,
under "Documentation".
information read "Getting Started" guide:
http://www.openscenegraph.org/projects/osg/wiki/Support/GettingStarted

View File

@@ -8,7 +8,7 @@
# script. This just copies all the already built binaries
# into a structure that is near-ready for distribution.
#
# Usage: You should run this from the directory above the 3-projects
# Usage: You should run this from the directory above the OSG-projects
# ("AnyDirectory" in the picture below)
# bash OpenSceneGraph/Xcode/Misc/ArrangeDMG.sh
#
@@ -40,12 +40,14 @@
# CpMac is deprecated now that cp works properly in Tiger
#COPY="/Developer/Tools/CpMac -r"
COPY="/bin/cp -R"
SVN="svn"
#COPY="mv -f"
#BUILDACTION="clean build"
#CONFIGURATION="Development"
CONFIGURATION="Deployment"
GDAL_LOCATION="/Library/Frameworks"
#GDAL_LOCATION="/Library/Frameworks"
# Clean up from previous builds?
echo "Deleteing PackageDir to begin anew"
@@ -65,17 +67,20 @@ mkdir -p PackageDir/XcodeTemplates
mkdir -p PackageDir/Resources
mkdir -p PackageDir/.background
# Everything should be built now. Move all the things to be distrubuted
# to the PackageDir with the appropriate layout.
echo "Copying Frameworks..."
$COPY OpenThreads/Xcode/OpenThreads/build/$CONFIGURATION/OpenThreads.framework PackageDir/Frameworks
$COPY OpenSceneGraph/Xcode/OpenSceneGraph/build/$CONFIGURATION/osg*.framework PackageDir/Frameworks/
#$COPY OpenThreads/Xcode/OpenThreads/build/$CONFIGURATION/OpenThreads.framework PackageDir/Frameworks
#$COPY OpenSceneGraph/Xcode/OpenSceneGraph/build/$CONFIGURATION/osg*.framework PackageDir/Frameworks/
$COPY OpenSceneGraph/Xcode/OpenSceneGraph/build/$CONFIGURATION/*.framework PackageDir/Frameworks/
# Copy the gdal framework
$COPY $GDAL_LOCATION/gdal.framework PackageDir/Frameworks
#$COPY $GDAL_LOCATION/gdal.framework PackageDir/Frameworks
echo "Copying PlugIns..."
$COPY OpenSceneGraph/Xcode/OpenSceneGraph/build/$CONFIGURATION/*.so PackageDir/PlugIns/
@@ -86,14 +91,18 @@ $COPY OpenSceneGraph/Xcode/OpenSceneGraph/build/$CONFIGURATION/*.app PackageDir/
echo "Copying Xcode templates..."
$COPY OpenSceneGraph/Xcode/XcodeTemplates PackageDir
# If we are in CVS, all the CVS junk got copied in so we need to remove it
find -d PackageDir/XcodeTemplates -name CVS -exec rm -rf {} \;
#find -d PackageDir/XcodeTemplates -name CVS -exec rm -rf {} \;
find -d PackageDir/XcodeTemplates -name .svn -exec rm -rf {} \;
echo "Copying License and ReadMe files..."
$COPY OpenThreads/COPYING.txt PackageDir/LICENSE_OpenThreads.txt
#$COPY OpenThreads/COPYING.txt PackageDir/LICENSE_OpenThreads.txt
$COPY OpenSceneGraph/LICENSE.txt PackageDir/LICENSE_OSG.txt
$COPY OpenSceneGraph/Xcode/OSX_OSG_README.rtf PackageDir
# Copy the background image and .DS_Store for 'fancy' DMG
$COPY OpenSceneGraph/Xcode/Packaging/Resources/instlogo.pdf PackageDir/.background
$COPY OpenSceneGraph/Xcode/Misc/DSStoreForDMG PackageDir/.DS_Store
# Sorry, I think this is bourne only
@@ -108,21 +117,40 @@ echo "Setting up symbolic links for the .app's..."
)
done
)
#echo ""
echo "Testing for OpenSceneGraph-Data..."
# Not sure how to find the OSG data, so it has to be done manually
# Would Spotlight help?
echo "Next, you must (manually) copy all the OSG-data to PackageDir/Resources and the LICENCE_GDAL.rtf to PackageDir."
# If OpenSceneGraph-Data/ resides next to OpenSceneGraph/, then use it
if [ -d OpenSceneGraph-Data ]; then
echo "Found OpenSceneGraph-Data and will copy into PackageDir/Resources."
# Determine if it is a subversion copy or not; we don't want the repo info
if [ -d OpenSceneGraph-Data/.svn ]; then
$SVN export --force OpenSceneGraph-Data PackageDir/Resources
else
$COPY OpenSceneGraph-Data PackageDir/Resources
fi
echo "Looking up location for OpenSceneGraph-Data"
#/usr/bin/perl OpenSceneGraph/Xcode/Misc/FindOSGData.pl
/usr/bin/perl OpenSceneGraph/Xcode/Misc/FindOSGData.pl --single
echo "Looking up location for LICENSE_GDAL.rtf"
/usr/bin/perl OpenSceneGraph/Xcode/Misc/FindOSGData.pl --single LICENSE_GDAL.rtf
echo "Creating DMG using:"
echo "hdiutil create -ov -fs HFS+ -volname OpenSceneGraph -srcfolder PackageDir OpenSceneGraph.dmg"
/usr/bin/hdiutil create -ov -fs HFS+ -volname OpenSceneGraph -srcfolder PackageDir OpenSceneGraph.dmg
echo "After you copy the remaining resources, you will want to package up the DMG. You can use the following line as the basis:"
echo "hdiutil create -ov -fs HFS+ -volname OpenSceneGraph -srcfolder PackageDir OpenSceneGraph.dmg"
else
# Not sure how to find the OSG data, so it has to be done manually
# Would Spotlight help?
#echo "Next, you must (manually) copy all the OSG-data to PackageDir/Resources and the LICENCE_GDAL.rtf to PackageDir."
echo "Did not find OpenSceneGraph-Data/ aside OpenSceneGraph/."
echo "Next, you must (manually) copy all the OSG-data to PackageDir/Resources."
echo "Looking up possible location for OpenSceneGraph-Data"
#/usr/bin/perl OpenSceneGraph/Xcode/Misc/FindOSGData.pl
/usr/bin/perl OpenSceneGraph/Xcode/Misc/FindOSGData.pl --single
#echo "Looking up location for LICENSE_GDAL.rtf"
#/usr/bin/perl OpenSceneGraph/Xcode/Misc/FindOSGData.pl --single LICENSE_GDAL.rtf
echo "After you copy the remaining resources, you will want to package up the DMG. You can use the following line as the basis:"
echo "hdiutil create -ov -fs HFS+ -volname OpenSceneGraph -srcfolder PackageDir OpenSceneGraph.dmg"
fi
# Now we want to package up everything into a .dmg

BIN
Xcode/Misc/DSStoreForDMG Normal file

Binary file not shown.

View File

@@ -1,4 +1,4 @@
{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf410
{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf440
{\fonttbl\f0\fswiss\fcharset77 Helvetica-Bold;\f1\fswiss\fcharset77 Helvetica;\f2\fswiss\fcharset77 Helvetica-Oblique;
\f3\fmodern\fcharset77 Courier;\f4\fnil\fcharset77 Monaco;}
{\colortbl;\red255\green255\blue255;}
@@ -15,24 +15,49 @@ This is the readme for the entire OpenThreads/OpenSceneGraph distribution for th
\
The source code is available at {\field{\*\fldinst{HYPERLINK "http://www.openscenegraph.org/"}}{\fldrslt http://www.openscenegraph.org/}}\
\
Also included is a framework for GDAL. You can get the source code and the full GDAL package at {\field{\*\fldinst{HYPERLINK "http://www.gdal.org/"}}{\fldrslt http://www.gdal.org/}}\
\
\
\f0\b What's New in this release:
\f0\b \
Quick Start:
\f1\b0 \
Screencasts of how to install and get going with OSG for Mac OS X can be found here:\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
{\field{\*\fldinst{HYPERLINK "http://www.openscenegraph.org/projects/osg/wiki/Support/TipsAndTricks"}}{\fldrslt \cf0 http://www.openscenegraph.org/projects/osg/wiki/Support/TipsAndTricks}}\
\
\
\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
\f0\b \cf0 What's New in this release:
\f1\b0 \
\pard\tx220\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\li720\fi-720\ql\qnatural\pardirnatural
\ls1\ilvl0\cf0 {\listtext \'a5 }Dwarf debugging format\
{\listtext \'a5 }osgsimpleviewerCocoa and osgsimpleviewerSDL\
\ls1\ilvl0\cf0 {\listtext \'a5 }OpenThreads now uses Subversion 'externals' to make it look like part of the OSG source distribution.\
{\listtext \'a5 }Producer has been removed from the distribution. osgViewer is supposed to replace it. The Mac OS X backend is currently Carbon based.\
{\listtext \'a5 }GDAL has been removed as it is no longer a dependency.\
{\listtext \'a5 }osgviewerCocoa (previously osgsimpleviewerCocoa in CVS) is an example program demonstrating tight integration between OpenSceneGraph and Cocoa. It demonstrates many of the things you should consider in building a first-class OS X application that uses OSG.\
{\listtext \'a5 }Dwarf debugging format\
{\listtext \'a5 }osgsimpleviewerSDL\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
\cf0 \
\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
\f0\b \cf0 Notes for 1.2 release:\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
\f0\b Notes for 2.0 release:\
\f1\b0 \cf0 1.2 was originally intended as a bug fix release for 1.1 (going for 1.1.1), but OSG broke ABI again so the number was bumped to 1.2. There are no significant changes to the Xcode projects or significant OS X specific changes.\
\f1\b0 OSG has changed its versioning number scheme. 2.0 is the stable release following 1.2.\
\
Producer has been removed from the distribution with osgViewer as its intended replacement.\
\
GDAL has also been removed from the distribution as it is no longer a dependency.\
\
OSG is in the process to moving to a new CMake based build system. Once the remaining Mac OS X support needed is implemented in CMake, the Xcode projects will be removed in favor of the new unified CMake system.\
\
With Leopard on the horizon, the need to deal with 64-bit readiness and deprecated APIs is becoming more critical. In a nutshell, we need a Cocoa based version of osgViewer, and the QuickTime plugin needs to be replaced. Currently, there is a new ImageIO based plugin to assume the image reading/writing duties of the old qt plugin. We are in need of a QTKit based plugin to assume the movie responsibilities of the old plugin. And we are in need of volunteers to write the Cocoa osgViewer backend. Currently, the example osgviewerCocoa demonstrates a lot of similar functionality and could be used as a reference. However, the example needs to be turned 'inside-out'. The example is an NSView class that contains OSG classes; the osgViewer needs to be the opposite where the OSG class needs to contain the NSView class.\
\
\
\
\f0\b Notes for 1.2 release:\
\f1\b0 1.2 was originally intended as a bug fix release for 1.1 (going for 1.1.1), but OSG broke ABI again so the number was bumped to 1.2. There are no significant changes to the Xcode projects or significant OS X specific changes.\
\
Since the 1.1 release, we have learned of serious problems (freezing of the window manager) on the (Intel) MacBook Pros using osgText. We believe the problem is with a serious driver bug for ATI in OS X 10.4.7. We believe the bug affects the ATI Radeon X1600. (You can get this string by calling glGetString(GL_RENDERER) when you have a valid OpenGL Context. The string returned to us on affected MacBook Pros is "ATI Radeon X1600 OpenGL Engine".)\
\
@@ -98,16 +123,16 @@ Don't forget to link against Carbon (-framework Carbon) if you use Gestalt.\
\
If you are affected by this, please file a bug report at {\field{\*\fldinst{HYPERLINK "https://bugreport.apple.com"}}{\fldrslt https://bugreport.apple.com}}. Apple lives and dies by the bug report system. If anything is to get done, it must be in the bug reporter. And they keep count of how many people file the same bug, so duplicates are good.\
\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
\f2\i (Note: We believe this has been fixed in 10.4.8)
\f2\i \cf0 (Note: We believe this has been fixed in 10.4.8)
\f1\i0 \
\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
\f0\b \cf0 Notes for 1.1 release:\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
\f1\b0 \cf0 We are now distributing Universal Binaries. These binaries were built using Xcode 2.3 and gcc 4.0.1.\
\f1\b0 We are now distributing Universal Binaries. These binaries were built using Xcode 2.3 and gcc 4.0.1.\
The Xcode projects are also set to build as Universal Binaries for both Development and Deployment\
targets. If you do not need this and want to save build time, you should change the architecture option\
to your desired setting (most likely to $(NATIVE_ARCH)). It is overridden in the top-level "OpenSceneGraph" project in the Group & Files panel. Don't forget to change OpenThreads \
@@ -128,9 +153,8 @@ PlugIns, the file size shrunk from about 1GB to about 100MB.\
We have stopped maintaining the Xcode 1.5/2.0 projects.\
\
\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
\f0\b \cf0 Notes for 1.0 release:
\f0\b Notes for 1.0 release:
\f1\b0 \
These projects were primarily developed with gcc 4.0.1 under Tiger 10.4.3 using Xcode 2.2. Starting with gcc 4.0, Apple no longer statically links in the C++ runtime. Apple has made available the g++ 4.0 dynamic runtime for Panther under the 10.3.9 release. To run under Panther, your system must have this update (or you must recompile the binaries for your system).\
\
@@ -230,9 +254,8 @@ Also remember that OSG will still respond to standard OSG environmental variable
\
\f0\b Prebinding Addresses:\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
\f1\b0 \cf0 \
\f1\b0 \
These are now obsolete. Prebinding is now disabled. The old addresses were:\
\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
@@ -315,9 +338,8 @@ If you are compiling under Xcode 1.5 and are using our Xcode 1.5/2.0 projects, t
{\listtext \'a5 }I noticed that for some reason, Xcode has problems compiling the Carbon header with the OpenThreads framework when autovectorization and precompiled headers were enabled. You might try disabling precompiled headers if it is not already. If the problem persists, you may also need to delete the entry that enables autovectorization. In the Groups and Files panel (left side panel), open the Info inspector for the project (top item) and click on the Build tab. Scroll down to the bottom, and remove the autovectorization option. \
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
\cf0 \
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
\f0\b \cf0 Universal Binaries:
\f0\b Universal Binaries:
\f1\b0 \
\
Be aware, when building you're own Universal Binaries and you use the 10.4 SDK, you must explicitly\
@@ -361,4 +383,4 @@ On the topic of feature requests, another potentially useful thing to have is a
ewing 2121 - at - yahoo (in the commercial domain)\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
{\field{\*\fldinst{HYPERLINK "http://www.create.ucsb.edu/OSG/"}}{\fldrslt \cf0 http://www.create.ucsb.edu/OSG/}}\
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,24 +1,24 @@
echo Copy Examples
cp -r ../OpenSceneGraph/build/Development/*.app Binary/Examples/
cp -r ../OpenSceneGraph/build/Deployment/*.app Binary/Examples/
echo Copy Applications
mv Binary/Examples/osgviewer.app Binary/Applications
mv Binary/Examples/osgarchive.app Binary/Applications
mv Binary/Examples/osgversion.app Binary/Applications
mv Binary/Examples/osgconv.app Binary/Applications
mv Binary/Applications/osgviewer.app/Contents/MacOS/osgviewer Binary/Applications
mv Binary/Applications/osgarchive.app/Contents/MacOS/osgarchive Binary/Applications
mv Binary/Applications/osgversion.app/Contents/MacOS/osgversion Binary/Applications
mv Binary/Applications/osgconv.app/Contents/MacOS/osgconv Binary/Applications
rm -rf Binary/Applications/osg*.app
cp Binary/Applications/*.app Binary/Applictions/Bundles/
cp Binary/Applications/osgviewer.app/Contents/MacOS/osgviewer Binary/Applications
cp Binary/Applications/osgarchive.app/Contents/MacOS/osgarchive Binary/Applications
cp Binary/Applications/osgversion.app/Contents/MacOS/osgversion Binary/Applications
cp Binary/Applications/osgconv.app/Contents/MacOS/osgconv Binary/Applications
mv Binary/Applications/osg*.app Binary/Applications/Bundles/
echo Copy Frameworks
cp -r ../OpenSceneGraph/build/Development/*.framework Binary/Frameworks/
cp -r ../OpenSceneGraph/build/Deployment/*.framework Binary/Frameworks/
echo Copy Plugins
cp ../OpenSceneGraph/build/Development/*.so Binary/Plugins/
cp ../OpenSceneGraph/build/Development/osgtext Binary/Plugins/
cp ../OpenSceneGraph/build/Development/osgpick Binary/Plugins/
cp ../OpenSceneGraph/build/Deployment/*.so Binary/Plugins/
echo Copying Complete
@@ -28,4 +28,5 @@ open OpenSceneGraph.pmproj
open Packages/Examples.pmproj
open Packages/PlugIns.pmproj
open Packages/Frameworks.pmproj
open Packages/Applications.pmproj
open Packages/ApplicationsBundles.pmproj
open Packages/ApplicationsCmdline.pmproj

Binary file not shown.

View File

@@ -11,7 +11,7 @@
\f0\b\fs24 \cf0 OpenSceneGraph on Mac OS X
\f1\b0 \
\
This is the readme for the entire OpenThreads/OpenSceneGraph distribution for the OS X frameworks and Xcode projects. This readme was originally written for the binary distribution, but there is a lot of useful information in here so it has also been included with the source code in the Xcode section. This was sync'd with the OSG 1.2 release.\
This is the readme for the entire OpenThreads/OpenSceneGraph distribution for the OS X frameworks and Xcode projects. This readme was originally written for the binary distribution, but there is a lot of useful information in here so it has also been included with the source code in the Xcode section. This was sync'd with the OSG 2.0 release.\
\
The source code is available at {\field{\*\fldinst{HYPERLINK "http://www.openscenegraph.org/"}}{\fldrslt http://www.openscenegraph.org/}}\
\
@@ -21,18 +21,42 @@ Also included is a framework for GDAL. You can get the source code and the full
\f0\b What's New in this release:
\f1\b0 \
\pard\tx220\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
\ls1\ilvl0\cf0 The theme for the 2.0 release has been making the OpenSceneGraph easier to use, yet more flexible and powerful.\
\pard\tx220\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\li720\fi-720\ql\qnatural\pardirnatural
\ls1\ilvl0\cf0 {\listtext \'a5 }Dwarf debugging format\
{\listtext \'a5 }osgsimpleviewerCocoa and osgsimpleviewerSDL\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
\cf0 \
\ls1\ilvl0\cf0 \
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
\cf0 Features include:\
\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li400\fi-400\ql\qnatural\pardirnatural
\cf0 * New unified build system using CMake, which simplifies the build process, automatically detecting installed dependencies and providing build configuration as well as support for a wide range of development tools.\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
\cf0 * New libraries:\
* osgViewer - replacing Producer as a windowing toolkit\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li760\fi-760\ql\qnatural\pardirnatural
\cf0 * osgManipulator - provides a set of interactive manipulators for scaling, rotating and moving objects in the scene.\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
\cf0 * osgShadow - provides an extensible framework for adding dynamic shadows to your scene. \
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li400\fi-400\ql\qnatural\pardirnatural
\cf0 * New low-level extensible intersection framework that includes support for line, plane and polytope intersections.\
* New high-level intersection classes that support paged databases, LineOfSight, HeightAboveTerrain and ElevationSlice.\
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural
\cf0 * View-dependent overlay\
* what does this do? \
* Plugins\
* Improvements to the OpenFlight, COLLADA and AC3D? plugins\
* New TXF texture font reader. \
* Easier 3rd party windowing integration\
* With examples showing integration with GLUT, SDL, Qt, WxWidgets and MFC. \
* OpenThreads is moved into the core of OpenSceneGraph and is no longer an external dependency.\
* Producer is no longer a dependency \
\
\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
\f0\b \cf0 Notes for 1.2 release:\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
\f1\b0 \cf0 1.2 was originally intended as a bug fix release for 1.1 (going for 1.1.1), but OSG broke ABI again so the number was bumped to 1.2. There are no significant changes to the Xcode projects or significant OS X specific changes.\
\f1\b0 1.2 was originally intended as a bug fix release for 1.1 (going for 1.1.1), but OSG broke ABI again so the number was bumped to 1.2. There are no significant changes to the Xcode projects or significant OS X specific changes.\
\
Since the 1.1 release, we have learned of serious problems (freezing of the window manager) on the (Intel) MacBook Pros using osgText. We believe the problem is with a serious driver bug for ATI in OS X 10.4.7. We believe the bug affects the ATI Radeon X1600. (You can get this string by calling glGetString(GL_RENDERER) when you have a valid OpenGL Context. The string returned to us on affected MacBook Pros is "ATI Radeon X1600 OpenGL Engine".)\
\
@@ -98,16 +122,16 @@ Don't forget to link against Carbon (-framework Carbon) if you use Gestalt.\
\
If you are affected by this, please file a bug report at {\field{\*\fldinst{HYPERLINK "https://bugreport.apple.com"}}{\fldrslt https://bugreport.apple.com}}. Apple lives and dies by the bug report system. If anything is to get done, it must be in the bug reporter. And they keep count of how many people file the same bug, so duplicates are good.\
\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
\f2\i (Note: We believe this has been fixed in 10.4.8)
\f2\i \cf0 (Note: We believe this has been fixed in 10.4.8)
\f1\i0 \
\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
\f0\b \cf0 Notes for 1.1 release:\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
\f1\b0 \cf0 We are now distributing Universal Binaries. These binaries were built using Xcode 2.3 and gcc 4.0.1.\
\f1\b0 We are now distributing Universal Binaries. These binaries were built using Xcode 2.3 and gcc 4.0.1.\
The Xcode projects are also set to build as Universal Binaries for both Development and Deployment\
targets. If you do not need this and want to save build time, you should change the architecture option\
to your desired setting (most likely to $(NATIVE_ARCH)). It is overridden in the top-level "OpenSceneGraph" project in the Group & Files panel. Don't forget to change OpenThreads \
@@ -128,9 +152,8 @@ PlugIns, the file size shrunk from about 1GB to about 100MB.\
We have stopped maintaining the Xcode 1.5/2.0 projects.\
\
\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
\f0\b \cf0 Notes for 1.0 release:
\f0\b Notes for 1.0 release:
\f1\b0 \
These projects were primarily developed with gcc 4.0.1 under Tiger 10.4.3 using Xcode 2.2. Starting with gcc 4.0, Apple no longer statically links in the C++ runtime. Apple has made available the g++ 4.0 dynamic runtime for Panther under the 10.3.9 release. To run under Panther, your system must have this update (or you must recompile the binaries for your system).\
\
@@ -230,9 +253,8 @@ Also remember that OSG will still respond to standard OSG environmental variable
\
\f0\b Prebinding Addresses:\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
\f1\b0 \cf0 \
\f1\b0 \
These are now obsolete. Prebinding is now disabled. The old addresses were:\
\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
@@ -315,9 +337,8 @@ If you are compiling under Xcode 1.5 and are using our Xcode 1.5/2.0 projects, t
{\listtext \'a5 }I noticed that for some reason, Xcode has problems compiling the Carbon header with the OpenThreads framework when autovectorization and precompiled headers were enabled. You might try disabling precompiled headers if it is not already. If the problem persists, you may also need to delete the entry that enables autovectorization. In the Groups and Files panel (left side panel), open the Info inspector for the project (top item) and click on the Build tab. Scroll down to the bottom, and remove the autovectorization option. \
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
\cf0 \
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
\f0\b \cf0 Universal Binaries:
\f0\b Universal Binaries:
\f1\b0 \
\
Be aware, when building you're own Universal Binaries and you use the 10.4 SDK, you must explicitly\
@@ -361,4 +382,4 @@ On the topic of feature requests, another potentially useful thing to have is a
ewing 2121 - at - yahoo (in the commercial domain)\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
{\field{\*\fldinst{HYPERLINK "http://www.create.ucsb.edu/OSG/"}}{\fldrslt \cf0 http://www.create.ucsb.edu/OSG/}}\
}
}

View File

@@ -8,8 +8,9 @@
\fs24 \
\
This installer will install the OpenSceneGraph Applications, Examples, Frameworks and Plugins in:\
/usr/local/bin\
/OpenSceneGraph/Examples\
/usr/local/bin (Executable Applications) \
/Applications/OpenSceneGraph/Applications/ (Bundled Applications)\
/Applications/OpenSceneGraph/Examples/\
/Library/Frameworks\
/Library/Application\\ Support/OpenSceneGraph/PlugIns/\
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural

View File

@@ -26,6 +26,7 @@
#include <OpenThreads/Mutex>
#include <OpenThreads/ScopedLock>
#include <OpenThreads/Thread>
#include <OpenThreads/ReentrantMutex>
#include <osg/AlphaFunc>
#include <osg/AnimationPath>
@@ -146,7 +147,6 @@
#include <osg/TriangleFunctor>
#include <osg/TriangleIndexFunctor>
#include <osg/Uniform>
#include <osg/UnitTestFramework>
#include <osg/Vec2>
#include <osg/Vec2b>
#include <osg/Vec2d>
@@ -186,7 +186,6 @@
#include <osgDB/ParameterOutput>
#include <osgDB/ReadFile>
#include <osgDB/ReaderWriter>
#include <osgDB/ReentrantMutex>
#include <osgDB/Registry>
#include <osgDB/SharedStateManager>
#include <osgDB/Version>
@@ -213,11 +212,9 @@
#include <osgGA/GUIActionAdapter>
#include <osgGA/GUIEventAdapter>
#include <osgGA/GUIEventHandler>
#include <osgGA/GUIEventHandlerVisitor>
#include <osgGA/KeySwitchMatrixManipulator>
#include <osgGA/MatrixManipulator>
#include <osgGA/NodeTrackerManipulator>
#include <osgGA/SetSceneViewVisitor>
#include <osgGA/StateSetManipulator>
#include <osgGA/TerrainManipulator>
#include <osgGA/TrackballManipulator>
@@ -319,8 +316,10 @@
* you should comment out this block.
*/
#include <osgTerrain/Export>
#include <osgTerrain/HeightFieldNode>
#include <osgTerrain/HeightFieldRenderer>
#include <osgTerrain/Layer>
#include <osgTerrain/Locator>
#include <osgTerrain/TerrainNode>
#include <osgTerrain/GeometryTechnique>
#include <osgTerrain/Version>
#include <osgText/Export>

View File

@@ -17,6 +17,7 @@ SET(OPENSCENEGRAPH_APPLICATION_DIR ${PROJECT_SOURCE_DIR})
SET(TARGET_DEFAULT_PREFIX "application_")
SET(TARGET_DEFAULT_LABEL_PREFIX "Applications")
SET(TARGET_COMMON_LIBRARIES
OpenThreads
osg
osgDB
osgUtil

View File

@@ -58,6 +58,12 @@ Node* OrientationConverter::convert( Node *node )
transform->setDataVariance(osg::Object::STATIC);
transform->setMatrix( C * R * S * T );
if (!S.isIdentity())
{
// Add a normalize state. This will be removed if the FlattenStaticTransformsVisitor works
transform->getOrCreateStateSet()->setMode(GL_NORMALIZE, osg::StateAttribute::ON);
}
root->addChild(transform);
transform->addChild(node);

View File

@@ -20,6 +20,8 @@
#include <osgUtil/Optimizer>
#include <osgUtil/SmoothingVisitor>
#include <osgViewer/GraphicsWindow>
#include <iostream>
#include "OrientationConverter.h"
@@ -51,12 +53,17 @@ class MyGraphicsContext {
}
if (_gc.valid())
{
_gc->realize();
_gc->makeCurrent();
std::cout<<"Realized window"<<std::endl;
if (dynamic_cast<osgViewer::GraphicsWindow*>(_gc.get()))
{
std::cout<<"Realized graphics window for OpenGL operations."<<std::endl;
}
else
{
std::cout<<"Realized pbuffer for OpenGL operations."<<std::endl;
}
}
}
@@ -664,7 +671,7 @@ int main( int argc, char **argv )
}
}
osgDB::ReaderWriter::WriteResult result = osgDB::Registry::instance()->writeNode(*root,fileNameOut);
osgDB::ReaderWriter::WriteResult result = osgDB::Registry::instance()->writeNode(*root,fileNameOut,osgDB::Registry::instance()->getOptions());
if (result.success())
{
osg::notify(osg::NOTICE)<<"Data written to '"<<fileNameOut<<"'."<< std::endl;

View File

@@ -1,7 +1,8 @@
#this file is automatically generated
SET(TARGET_SRC osgversion.cpp )
#### end var setup ###
SET(TARGET_COMMON_LIBRARIES
OpenThreads
osg
)
SETUP_COMMANDLINE_APPLICATION(osgversion)

View File

@@ -1,6 +1,7 @@
#include <osg/Version>
#include <osg/ArgumentParser>
#include <osg/ApplicationUsage>
#include <OpenThreads/Version>
#include <set>
#include <vector>
@@ -33,6 +34,7 @@ bool validName(const std::string& first)
if (first.size()>=2 && (first[1]<'a' || first[1]>'z') && (first[1]!='.') && (first[1]!=',')) return false;
if (first=="Xcode") return false;
if (first=="Added") return false;
if (first=="Camera") return false;
if (first=="CameraNode") return false;
@@ -49,6 +51,9 @@ bool validName(const std::string& first)
if (first=="SpotExponent") return false;
if (first=="Framstamp") return false;
if (first=="Stats") return false;
if (first=="Group") return false;
if (first=="Texture") return false;
if (first=="Texture2DArray") return false;
if (first=="Creator") return false;
if (first=="CullVisitor") return false;
if (first=="Drawable") return false;
@@ -198,6 +203,8 @@ bool validName(const std::string& first)
if (first=="CullVistor") return false;
if (first=="SimpleViewer") return false;
if (first=="TexMat(Matrix") return false;
if (first=="GraphicsWindowX11") return false;
if (first=="OperationThread") return false;
return true;
}
@@ -209,6 +216,17 @@ std::string typoCorrection(const std::string& name)
if (name=="") return "";
if (name=="") return "";
#endif
if (name=="Martsz") return "Martz";
if (name=="Froenlich") return "Fr<EFBFBD>hlich";
if (name=="Froelich") return "Fr<EFBFBD>hlich";
if (name=="Fruciel") return "Frauciel";
if (name=="Hebelin") return "Herbelin";
if (name=="Jea-Sebastien") return "Jean-Sebastien";
if (name=="Robet") return "Robert";
if (name=="Morné") return "Morn<EFBFBD>";
if (name=="Adndre") return "Andre";
if (name=="Mellis") return "Melis";
if (name=="Rajce") return "Trajce";
if (name=="Trastenjak") return "Trstenjak";
if (name=="Baverage") return "Beverage";
if (name=="Bistroviae") return "Bistrovic";
@@ -258,6 +276,7 @@ std::string typoCorrection(const std::string& name)
if (name=="Moloshton") return "Moloshtan";
if (name=="Moule") return "Moiule";
if (name=="Nicklov") return "Nikolov";
if (name=="Nickolov") return "Nikolov";
if (name=="Olad") return "Olaf";
if (name=="Olar") return "Olaf";
if (name=="Oritz") return "Ortiz";
@@ -283,9 +302,10 @@ std::string typoCorrection(const std::string& name)
if (name=="Yefrei") return "Yefei";
if (name=="Yfei") return "Yefei";
if (name=="Antonoine") return "Antoine";
if (name=="Antione") return "Antoine";
if (name=="Andew") return "Andrew";
if (name=="Daneil") return "Daniel";
if (name=="André") return "Anr<EFBFBD>";
if (name=="André") return "Andr<EFBFBD>";
if (name=="García") return "Garcea";
if (name=="Sjölie") return "Sj<EFBFBD>lie";
if (name=="José") return "Jos<EFBFBD>";
@@ -293,6 +313,9 @@ std::string typoCorrection(const std::string& name)
if (name=="Froehlich") return "Fr<EFBFBD>hlich";
if (name=="Eileman") return "Eilemann";
if (name=="Skinnder") return "Skinner";
if (name=="Mihair") return "Mihai";
if (name=="Mahai") return "Mihai";
if (name=="SimpleViewer") return "";
return name;
@@ -300,6 +323,26 @@ std::string typoCorrection(const std::string& name)
void nameCorrection(NamePair& name)
{
if (name.first=="Radu" && name.second=="Mihai")
{
name.first = "Mihai";
name.second = "Radu";
}
if (name.first=="Art" && name.second=="Trevs")
{
name.first = "Art";
name.second = "Tevs";
}
if (name.first=="Tim" && name.second=="More")
{
name.first = "Tim";
name.second = "Moore";
}
if (name.first=="Andre" && name.second=="Garneau")
{
name.first = "Andr<EFBFBD>";
name.second = "Garneau";
}
if (name.first=="Eric" && name.second=="Hammil")
{
name.first = "Chris";
@@ -377,6 +420,11 @@ void nameCorrection(NamePair& name)
name.first = "Trajce";
name.second = "Nikolov";
}
if (name.first=="Frauciel" && name.second=="Luc")
{
name.first = "Luc";
name.second = "Frauciel";
}
}
void lastValidCharacter(const std::string& name, unsigned int& pos,char c)
@@ -601,6 +649,7 @@ void buildContributors(NameMap& names)
++names[NamePair("Marco","Jez")];
++names[NamePair("Mike","Weiblen")];
++names[NamePair("Geoff","Michel")];
++names[NamePair("Ben","van Basten")];
// contributors that don't appear in the ChangeLog due to their contributions
// being before CVS started for the OSG, or before the name logging began.
@@ -620,6 +669,9 @@ int main( int argc, char **argv)
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
arguments.getApplicationUsage()->addCommandLineOption("--entries","Print out number of entries into the ChangeLog file for each contributor.");
arguments.getApplicationUsage()->addCommandLineOption("--version-number","Print out version number only");
arguments.getApplicationUsage()->addCommandLineOption("--soversion-number","Print out shared object version number only");
arguments.getApplicationUsage()->addCommandLineOption("--openthreads-version-number","Print out version number for OpenThreads only");
arguments.getApplicationUsage()->addCommandLineOption("--openthreads-soversion-number","Print out shared object version number for OpenThreads only");
arguments.getApplicationUsage()->addCommandLineOption("-r <file> or --read <file>","Read the ChangeLog to generate an estimated contributors list.");
if (arguments.read("--version-number"))
@@ -628,6 +680,63 @@ int main( int argc, char **argv)
return 0;
}
if (arguments.read("--major-number"))
{
std::cout<<OPENSCENEGRAPH_MAJOR_VERSION<<std::endl;
return 0;
}
if (arguments.read("--minor-number"))
{
std::cout<<OPENSCENEGRAPH_MINOR_VERSION<<std::endl;
return 0;
}
if (arguments.read("--patch-number"))
{
std::cout<<OPENSCENEGRAPH_PATCH_VERSION<<std::endl;
return 0;
}
if (arguments.read("--soversion-number"))
{
std::cout<<osgGetSOVersion()<<std::endl;
return 0;
}
if (arguments.read("--openthreads-version-number"))
{
std::cout<<OpenThreadsGetVersion()<<std::endl;
return 0;
}
if (arguments.read("--openthreads-major-number"))
{
std::cout<<OPENTHREADS_MAJOR_VERSION<<std::endl;
return 0;
}
if (arguments.read("--openthreads-minor-number"))
{
std::cout<<OPENTHREADS_MINOR_VERSION<<std::endl;
return 0;
}
if (arguments.read("--openthreads-patch-number"))
{
std::cout<<OPENTHREADS_PATCH_VERSION<<std::endl;
return 0;
}
if (arguments.read("--openthreads-soversion-number"))
{
std::cout<<OpenThreadsGetSOVersion()<<std::endl;
return 0;
}
std::cout<<osgGetLibraryName()<< " "<< osgGetVersion()<<std::endl<<std::endl;
bool printContributors = false;

View File

@@ -143,5 +143,8 @@ int main(int argc, char** argv)
viewer.setSceneData( loadedModel.get() );
return viewer.run();
viewer.realize();
viewer.run();
}

View File

@@ -29,7 +29,7 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgcubemap)
ADD_SUBDIRECTORY(osgdelaunay)
ADD_SUBDIRECTORY(osgdepthpartition)
ADD_SUBDIRECTORY(osgdepthshadow)
ADD_SUBDIRECTORY(osgdepthpeeling)
ADD_SUBDIRECTORY(osgdistortion)
ADD_SUBDIRECTORY(osgfadetext)
ADD_SUBDIRECTORY(osgforest)
@@ -70,7 +70,6 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgsequence)
ADD_SUBDIRECTORY(osgshaders)
ADD_SUBDIRECTORY(osgshaderterrain)
ADD_SUBDIRECTORY(osgshadowtexture)
ADD_SUBDIRECTORY(osgshadow)
ADD_SUBDIRECTORY(osgshape)
ADD_SUBDIRECTORY(osgsimplifier)
@@ -105,6 +104,10 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgviewerSDL)
ENDIF(SDL_FOUND)
IF (FOX_FOUND)
ADD_SUBDIRECTORY(osgviewerFOX)
ENDIF(FOX_FOUND)
IF (wxWidgets_FOUND)
ADD_SUBDIRECTORY(osgviewerWX)
ENDIF(wxWidgets_FOUND)

View File

@@ -34,6 +34,7 @@
#include <osgGA/TrackballManipulator>
#include <osgGA/FlightManipulator>
#include <osgGA/StateSetManipulator>
#include <osgViewer/ViewerEventHandlers>
#include <osgViewer/CompositeViewer>
@@ -136,15 +137,19 @@ int main( int argc, char **argv )
if (!scene) return 1;
// construct the viewer.
osgViewer::CompositeViewer viewer;
osgViewer::CompositeViewer viewer(arguments);
if (arguments.read("-1"))
{
{
osgViewer::View* view = new osgViewer::View;
view->setSceneData(osgDB::readNodeFile("fountain.osg"));
view->addEventHandler( new osgViewer::StatsHandler );
view->setUpViewAcrossAllScreens();
view->setCameraManipulator(new osgGA::TrackballManipulator);
viewer.addView(view);
@@ -179,6 +184,9 @@ int main( int argc, char **argv )
view->setSceneData(scene.get());
view->setCameraManipulator(new osgGA::TrackballManipulator);
view->addEventHandler( new osgViewer::StatsHandler );
// add the handler for doing the picking
view->addEventHandler(new PickHandler());
}
@@ -237,6 +245,12 @@ int main( int argc, char **argv )
statesetManipulator->setStateSet(view->getCamera()->getOrCreateStateSet());
view->addEventHandler( statesetManipulator.get() );
view->addEventHandler( new osgViewer::StatsHandler );
view->addEventHandler( new osgViewer::HelpHandler );
view->addEventHandler( new osgViewer::WindowSizeHandler );
view->addEventHandler( new osgViewer::ThreadingHandler );
view->addEventHandler( new osgViewer::RecordCameraPathHandler );
}
// view two
@@ -268,10 +282,11 @@ int main( int argc, char **argv )
}
}
while (arguments.read("-s")) { viewer.setThreadingModel(osgViewer::CompositeViewer::SingleThreaded); }
while (arguments.read("-g")) { viewer.setThreadingModel(osgViewer::CompositeViewer::ThreadPerContext); }
while (arguments.read("-c")) { viewer.setThreadingModel(osgViewer::CompositeViewer::ThreadPerCamera); }
while (arguments.read("-g")) { viewer.setThreadingModel(osgViewer::CompositeViewer::CullDrawThreadPerContext); }
while (arguments.read("-c")) { viewer.setThreadingModel(osgViewer::CompositeViewer::CullThreadPerCameraDrawThreadPerContext); }
// run the viewer's main frame loop
return viewer.run();

View File

@@ -0,0 +1,15 @@
SET(TARGET_SRC
DePee.cpp
DePeePass.cpp
Utility.cpp
osgdepthpeeling.cpp
)
SET(TARGET_H
DePee.h
DePeePass.h
Utility.h
)
#### end var setup ###
SETUP_EXAMPLE(osgdepthpeeling)

View File

@@ -0,0 +1,669 @@
/*
Steffen Frey
Fachpraktikum Graphik-Programmierung 2007
Institut fuer Visualisierung und Interaktive Systeme
Universitaet Stuttgart
*/
//export OSG_NOTIFY_LEVEL=DEBUG_INFO
#include "DePee.h"
#include <osg/GLExtensions>
#include <osg/Node>
#include <osg/MatrixTransform>
#include <osg/Projection>
#include <osg/Geode>
#include "Utility.h"
#include <osg/ShapeDrawable>
#include <osg/Geometry>
#include <assert.h>
#include <iostream>
DePee::DePee(osg::Group* parent, osg::Group* subgraph, unsigned width, unsigned height)
{
_renderToFirst = false;
_isSketchy =false;
_isColored = false;
_isEdgy = true;
_isCrayon = false;
_normalDepthMapProgram = Utility::createProgram("shaders/depthpeel_normaldepthmap.vert","shaders/depthpeel_normaldepthmap.frag");
_colorMapProgram = Utility::createProgram("shaders/depthpeel_colormap.vert","shaders/depthpeel_colormap.frag" );
_edgeMapProgram = Utility::createProgram("shaders/depthpeel_edgemap.vert", "shaders/depthpeel_edgemap.frag");
_parent = new osg::Group;
parent->addChild(_parent.get());
_subgraph = subgraph;
_width = width;
_height = height;
_texWidth = width;
_texHeight = height;
assert(parent);
assert(subgraph);
_fps = 0;
_colorCamera = 0;
_sketchy = new osg::Uniform("sketchy", false);
_colored = new osg::Uniform("colored", false);
_edgy = new osg::Uniform("edgy", true);
_sketchiness = new osg::Uniform("sketchiness", (float) 1.0);
_normalDepthMap0 = Utility::newColorTexture2D(_texWidth, _texHeight, 32);
_normalDepthMap1 = Utility::newColorTexture2D(_texWidth, _texHeight, 32);
_edgeMap = Utility::newColorTexture2D(_texWidth, _texHeight, 8);
_colorMap = Utility::newColorTexture2D(_texWidth, _texHeight, 8);
//create a noise map...this doesn't end up in a new rendering pass
(void) createMap(NOISE_MAP);
//the viewport aligned quad
_quadGeode = Utility::getCanvasQuad(_width, _height);
//!!!Getting problems if assigning unit to texture in depth peeling subraph and removing depth peeling steps!!!
//That's why it is done here
osg::StateSet* stateset = _parent->getOrCreateStateSet();
stateset->setTextureAttributeAndModes(1, _normalDepthMap0.get(), osg::StateAttribute::ON);
stateset->setTextureAttributeAndModes(2, _normalDepthMap1.get(), osg::StateAttribute::ON);
stateset->setTextureAttributeAndModes(3, _edgeMap.get(), osg::StateAttribute::ON);
stateset->setTextureAttributeAndModes(4, _colorMap.get(), osg::StateAttribute::ON);
stateset->setTextureAttributeAndModes(5, _noiseMap.get(), osg::StateAttribute::ON);
// render the final thing
(void) createFinal();
//take one step initially
addDePeePass();
//render head up display
(void) createHUD();
}
DePee::~DePee()
{
}
void DePee::setSketchy(bool sketchy)
{
_sketchy->set(sketchy);
_isSketchy = sketchy;
}
void DePee::setCrayon(bool crayon)
{
if(_isCrayon != crayon)
{
_isCrayon = crayon;
createMap(NOISE_MAP);
}
}
void DePee::setSketchiness(double sketchiness)
{
_sketchiness->set((float)sketchiness);
}
void DePee::setColored(bool colored)
{
if(colored == !_isColored)
{
if(colored)
{
(void) createMap(COLOR_MAP, false);
}
else
{
_dePeePasses.back()->remRenderPass(COLOR_MAP);
}
_colored->set(colored);
_isColored = colored;
}
}
void DePee::setEdgy(bool edgy)
{
if(edgy != _isEdgy)
{
_isEdgy = edgy;
unsigned int n = 0;
while(remDePeePass())
{
++n;
}
if(edgy)
{
(void) createMap(EDGE_MAP,_dePeePasses.size() == 1);
}
else
{
_dePeePasses.back()->remRenderPass(EDGE_MAP);
}
for(unsigned int i=0; i < n; i++)
{
addDePeePass();
}
}
_edgy->set(edgy);
}
void DePee::setFPS(double* fps)
{
_fps = fps;
}
unsigned int DePee::getNumberOfRenderPasses()
{
unsigned int n = 0;
for(unsigned int i=0; i < _dePeePasses.size();i++)
n += _dePeePasses.at(i)->Cameras.size();
// add one pass for final rendering pass and one for hud
return n+2;
}
bool DePee::addDePeePass()
{
if(_isColored)
{
//remove previous color pass
_dePeePasses.back()->remRenderPass(COLOR_MAP);
}
_dePeePasses.push_back(new DePeePass());
_parent->addChild(_dePeePasses.back()->root.get());
//need to create a depth map in every case
(void) createMap(NORMAL_DEPTH_MAP, _dePeePasses.size() == 1);
if(_isEdgy)
{
(void) createMap(EDGE_MAP,_dePeePasses.size() == 1);
}
if(_isColored)
{
(void) createMap(COLOR_MAP, false);
}
return true;
}
bool DePee::remDePeePass()
{
if(_dePeePasses.size() < 2)
return false;
_parent->removeChild(_dePeePasses.back()->root.get());
delete _dePeePasses.back();
_dePeePasses.pop_back();
_renderToFirst = !_renderToFirst;
if(_isColored)
{
(void) createMap(COLOR_MAP, false);
}
return true;
}
//create noise map with values ranging from 0 to 255
bool DePee::createNoiseMap()
{
{
osg::StateSet* stateset = _parent->getOrCreateStateSet();
_noiseMap = new osg::Texture2D;
_noiseMap->setTextureSize(_width, _height);
_noiseMap->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);
_noiseMap->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);
stateset->setTextureAttributeAndModes(5, _noiseMap.get(), osg::StateAttribute::ON);
}
osg::Image* image = new osg::Image;
unsigned char* data = new unsigned char[_width*_height];
unsigned char* tmpData = new unsigned char[_width*_height];
int random=rand() % 5000;
for(unsigned y=0; y < _height; y++)
for(unsigned x=0; x < _width; x++)
data[y*_width + x] = (unsigned char) (0.5 * 255.0 + Utility::getNoise(x, y, random) * 0.5 * 255.0);
//if style isn't crayon style, smooth the noise map
if(!_isCrayon)
{
for(unsigned i=0; i < 4; i++)
{
for(unsigned y=0; y < _height; y++)
for(unsigned x=0; x < _width; x++)
tmpData[y*_width + x] = (unsigned char)Utility::smoothNoise(_width, _height,x,y, data);
for(unsigned y=0; y < _height; y++)
for(unsigned x=0; x < _width; x++)
data[y*_width + x] = (unsigned char)Utility::smoothNoise(_width, _height, x,y, tmpData);
}
}
image->setImage(_width, _height, 1,
1, GL_LUMINANCE, GL_UNSIGNED_BYTE,
data,
osg::Image::USE_NEW_DELETE);
_noiseMap->setImage(image);
return true;
}
bool DePee::createHUD()
{
osg::Geode* geode = new osg::Geode();
std::string timesFont("fonts/arial.ttf");
// turn lighting off for the text and disable depth test to ensure its always ontop.
osg::StateSet* stateset = geode->getOrCreateStateSet();
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
stateset->setTextureAttributeAndModes(1, _normalDepthMap0.get(), osg::StateAttribute::OFF);
stateset->setTextureAttributeAndModes(2, _normalDepthMap1.get(), osg::StateAttribute::OFF);
stateset->setTextureAttributeAndModes(3, _edgeMap.get(), osg::StateAttribute::OFF);
stateset->setTextureAttributeAndModes(4, _colorMap.get(), osg::StateAttribute::OFF);
stateset->setTextureAttributeAndModes(5, _noiseMap.get(), osg::StateAttribute::OFF);
osg::Vec3 position(5.0f,7.0f,0.0f);
osg::Vec3 delta(0.0f,-120.0f,0.0f);
_hudText = new osgText::Text;
{
geode->addDrawable( _hudText );
_hudText->setDataVariance(osg::Object::DYNAMIC);
_hudText->setFont(timesFont);
_hudText->setPosition(position);
_hudText->setText("Head Up Display");
_hudText->setColor(osg::Vec4(0.5, 0.5, 0.5, 1.0));
_hudText->setCharacterSize(20.0);
position += delta;
}
{
osg::BoundingBox bb;
for(unsigned int i=0;i<geode->getNumDrawables();++i)
{
bb.expandBy(geode->getDrawable(i)->getBound());
}
osg::Geometry* geom = new osg::Geometry;
osg::Vec3Array* vertices = new osg::Vec3Array;
float depth = bb.zMin()-0.1;
vertices->push_back(osg::Vec3(bb.xMin(),bb.yMax(),depth));
vertices->push_back(osg::Vec3(bb.xMin(),bb.yMin(),depth));
vertices->push_back(osg::Vec3(bb.xMax(),bb.yMin(),depth));
vertices->push_back(osg::Vec3(bb.xMax(),bb.yMax(),depth));
geom->setVertexArray(vertices);
osg::Vec3Array* normals = new osg::Vec3Array;
normals->push_back(osg::Vec3(0.0f,0.0f,1.0f));
geom->setNormalArray(normals);
geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
osg::Vec4Array* colors = new osg::Vec4Array;
colors->push_back(osg::Vec4(0.0f,0.0,0.0f,0.3f));
geom->setColorArray(colors);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(GL_QUADS,0,4));
osg::StateSet* stateset = geom->getOrCreateStateSet();
stateset->setMode(GL_BLEND,osg::StateAttribute::ON);
stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
//geode->addDrawable(geom);
}
osg::Camera* camera = new osg::Camera;
// set the projection matrix
camera->setProjectionMatrix(osg::Matrix::ortho2D(0,1280,0,1024));
// set the view matrix
camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
camera->setViewMatrix(osg::Matrix::identity());
// only clear the depth buffer
camera->setClearMask(GL_DEPTH_BUFFER_BIT);
// draw subgraph after main camera view.
camera->setRenderOrder(osg::Camera::POST_RENDER);
camera->addChild(geode);
_parent->addChild(camera);
return true;
}
// then create the first camera node to do the render to texture
// render normal and depth map color map
bool DePee::createMap(MapMode mapMode, bool first)
{
switch(mapMode)
{
case EDGE_MAP:
return createEdgeMap(first);
case NOISE_MAP:
return createNoiseMap();
case NORMAL_DEPTH_MAP:
case COLOR_MAP:
return createNormalDepthColorMap(mapMode, first);
default:
std::cerr << "mapMode not recognized!!!\n";
return false;
}
}
bool DePee::createFinal()
{
osg::Projection* screenAlignedProjectionMatrix = new osg::Projection;
screenAlignedProjectionMatrix->setMatrix(osg::Matrix::ortho2D(0,_width,0,_height));
screenAlignedProjectionMatrix->setCullingActive(false);
osg::MatrixTransform* screenAlignedModelViewMatrix = new osg::MatrixTransform;
screenAlignedModelViewMatrix->setMatrix(osg::Matrix::identity());
// Make sure the model view matrix is not affected by any transforms
// above it in the scene graph:
screenAlignedModelViewMatrix->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
// new we need to add the texture to the Drawable, we do so by creating a
// StateSet to contain the Texture StateAttribute.
osg::StateSet* stateset = new osg::StateSet;
stateset->setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);
_quadGeode->setStateSet(stateset);
_parent->addChild(screenAlignedProjectionMatrix);
screenAlignedProjectionMatrix->addChild(screenAlignedModelViewMatrix);
screenAlignedModelViewMatrix->addChild(_quadGeode.get());
//setup shader
std::string vertSource;
if(!Utility::readFile("shaders/depthpeel_final.vert", vertSource))
{
printf("shader source not found\n");
return false;
}
std::string fragSource;
if(!Utility::readFile("shaders/depthpeel_final.frag", fragSource))
{
printf("shader source not found\n");
return false;
}
osg::ref_ptr<osg::Program> program = new osg::Program;
program->addShader( new osg::Shader( osg::Shader::VERTEX, vertSource.c_str() ) );
program->addShader( new osg::Shader( osg::Shader::FRAGMENT, fragSource.c_str() ) );
//choose map to display
stateset->addUniform( new osg::Uniform("normalDepthMap0", 1));
stateset->addUniform( new osg::Uniform("normalDepthMap1", 2));
stateset->addUniform(new osg::Uniform("edgeMap", 3));
stateset->addUniform( new osg::Uniform("colorMap", 4));
stateset->addUniform( new osg::Uniform("noiseMap", 5));
stateset->addUniform(_sketchy);
stateset->addUniform(_colored);
stateset->addUniform(_edgy);
stateset->addUniform(_sketchiness);
stateset->setAttributeAndModes( program.get(), osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON);
//switch lighting off
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OVERRIDE | osg::StateAttribute::OFF);
return true;
}
bool DePee::createEdgeMap(bool first)
//create the edge map of the first normal and depth map
{
_dePeePasses.back()->newRenderPass(EDGE_MAP);
// set up the background color and clear mask.
_dePeePasses.back()->Cameras[EDGE_MAP]->setClearColor(osg::Vec4(0.3,0.3f,0.3f,1.0f));
_dePeePasses.back()->Cameras[EDGE_MAP]->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
const osg::BoundingSphere& bs = _quadGeode->getBound();
if (!bs.valid())
{
return false;
}
float znear = 1.0f*bs.radius();
float zfar = 3.0f*bs.radius();
znear *= 0.9f;
zfar *= 1.1f;
// set up projection.
//_dePeePasses.back()->Cameras.top()->setProjectionMatrixAsFrustum(-proj_right,proj_right,-proj_top,proj_top,znear,zfar);
_dePeePasses.back()->Cameras[EDGE_MAP]->setProjectionMatrixAsOrtho(0,_width,0,_height,znear,zfar);
//set view
_dePeePasses.back()->Cameras[EDGE_MAP]->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
_dePeePasses.back()->Cameras[EDGE_MAP]->setViewMatrixAsLookAt(osg::Vec3(0.0f,0.0f,2.0f)*bs.radius(), osg::Vec3(0.0,0.0,0.0),osg::Vec3(0.0f,1.0f,0.0f));
// set viewport
_dePeePasses.back()->Cameras[EDGE_MAP]->setViewport(0,0,_texWidth,_texHeight);
// set the camera to render before the main camera.
_dePeePasses.back()->Cameras[EDGE_MAP]->setRenderOrder(osg::Camera::PRE_RENDER);
// tell the camera to use OpenGL frame buffer object
_dePeePasses.back()->Cameras[EDGE_MAP]->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER);
//switch lighting off
osg::ref_ptr<osg::StateSet> stateset = new osg::StateSet;
if(_renderToFirst)
{
stateset->addUniform(new osg::Uniform("normalDepthMap", 1));
}
else
{
stateset->addUniform(new osg::Uniform("normalDepthMap", 2));
}
_dePeePasses.back()->Cameras[EDGE_MAP]->attach(osg::Camera::COLOR_BUFFER, _edgeMap.get());
stateset->addUniform( new osg::Uniform("edgeMap", 3));
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OVERRIDE |
osg::StateAttribute::OFF);
//setup shader
stateset->setAttributeAndModes(_edgeMapProgram.get(), osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON);
stateset->addUniform(new osg::Uniform("width", (float) _width));
stateset->addUniform(new osg::Uniform("height", (float) _height));
if(first)
{
stateset->addUniform(new osg::Uniform("first", (float)1.0));
}
else
{
stateset->addUniform(new osg::Uniform("first", (float)0.0));
}
_dePeePasses.back()->settingNodes[EDGE_MAP]->setStateSet(stateset.get());
// add subgraph to render
assert(_dePeePasses.size() > 0);
_dePeePasses.back()->settingNodes[EDGE_MAP]->addChild(_quadGeode.get());
return true;
}
bool DePee::createNormalDepthColorMap(MapMode mapMode, bool first)
{
DePeePass* pass;
pass = _dePeePasses.back();
pass->newRenderPass(mapMode);
//
// setup camera
//
// set up the background color and clear mask
pass->Cameras[mapMode]->setClearColor(osg::Vec4(0.f,0.f,1.f,1.f));
pass->Cameras[mapMode]->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
const osg::BoundingSphere& bs = _subgraph->getBound();
if (!bs.valid())
{
return false;
}
float znear = 1.0f*bs.radius();
float zfar = 3.0f*bs.radius();
// 2:1 aspect ratio as per flag geomtry below.
float projTop = 0.25f*znear;
float projRight = projTop * ((double)_width/(double)_height);
znear *= 0.9f;
zfar *= 1.1f;
// set up projection.
pass->Cameras[mapMode]->setProjectionMatrixAsFrustum(-projRight,projRight,-projTop,projTop, znear,zfar);
// setup view
pass->Cameras[mapMode]->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
pass->Cameras[mapMode]->setViewMatrixAsLookAt(bs.center()-osg::Vec3(0.0f,2.0f,0.0f)*bs.radius(),
bs.center(),
osg::Vec3(0.0f,0.0f,1.0f));
// set viewport
pass->Cameras[mapMode]->setViewport(0,0,_texWidth,_texHeight);
// set the camera to render before the main camera.
pass->Cameras[mapMode]->setRenderOrder(osg::Camera::PRE_RENDER);
pass->Cameras[mapMode]->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
//
// setup stateset
//
//switch lighting off
osg::ref_ptr<osg::StateSet> stateset = new osg::StateSet;
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OVERRIDE |
osg::StateAttribute::OFF);
switch(mapMode)
{
case NORMAL_DEPTH_MAP:
_renderToFirst = !_renderToFirst;
if(_renderToFirst)
{
pass->Cameras[mapMode]->attach(osg::Camera::COLOR_BUFFER, _normalDepthMap0.get());
stateset->addUniform(new osg::Uniform("normalDepthMap", 2));
}
else
{
pass->Cameras[mapMode]->attach(osg::Camera::COLOR_BUFFER, _normalDepthMap1.get());
stateset->addUniform(new osg::Uniform("normalDepthMap", 1));
}
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OVERRIDE | osg::StateAttribute::OFF);
stateset->setAttributeAndModes(_normalDepthMapProgram.get(), osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON);
break;
case COLOR_MAP:
assert(pass == _dePeePasses.back());
pass->Cameras[mapMode]->attach(osg::Camera::COLOR_BUFFER, _colorMap.get());
if(_renderToFirst)
{
stateset->addUniform(new osg::Uniform("normalDepthMap", 1));
}
else
{
stateset->addUniform(new osg::Uniform("normalDepthMap", 2));
}
pass->Cameras[mapMode]->setClearColor(osg::Vec4(1.f,1.f,1.f,1.f));
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OVERRIDE | osg::StateAttribute::OFF);
stateset->setMode(GL_BLEND, osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE);
stateset->setAttributeAndModes(_colorMapProgram.get(), osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON);
stateset->addUniform(new osg::Uniform("tex", 0));
break;
default:
return false;
};
// add subgraph to render
pass->settingNodes[mapMode]->addChild(_subgraph.get());
stateset->addUniform(new osg::Uniform("first", first));
stateset->addUniform(new osg::Uniform("width", (float) _width));
stateset->addUniform(new osg::Uniform("height", (float) _height));
stateset->addUniform(new osg::Uniform("znear", znear));
stateset->addUniform(new osg::Uniform("zfar", zfar));
pass->settingNodes[mapMode]->setStateSet(stateset.get());
return true;
}
bool DePee::updateHUDText()
{
if(!_fps)
return false;
std::string str;
std::string tmp = Utility::toString(*_fps);
unsigned i = tmp.find_first_of('.');
tmp = tmp.substr(0, i + 3);
_hudText->setText(Utility::toString(_dePeePasses.size())
+ " Depth Peeling Pass" + (_dePeePasses.size() == 1 ? " " : "es ")
+ "((a)dd; (r)emove) "
+ (_isEdgy ? "+" : "-") + "(E)dgy " +
+ (_isSketchy ? "+" : "-") + "(S)ketchy " +
+ (_isColored ? "+" : "-") + "(C)olored " +
+ "-> "+Utility::toString(getNumberOfRenderPasses())+ " Rendering Passes "
+ "@ "
+ tmp + " fps");
return true;
}

View File

@@ -0,0 +1,170 @@
/*
Steffen Frey
Fachpraktikum Graphik-Programmierung 2007
Institut fuer Visualisierung und Interaktive Systeme
Universitaet Stuttgart
*/
#ifndef _DEPEE_H_
#define _DEPEE_H_
#include <osg/Node>
#include <osg/Camera>
#include <osg/Group>
#include <osg/Texture2D>
#include <osgText/Text>
#include <string>
#include <stack>
#include "DePeePass.h"
/*!
The DePee class is main class for setting up and managing depth peeling.
A DePee object can be seen as a virtual node, that has one parent and one child. The rendering of every child and subchil of this child is managed by the the DePee node. Besides that, it handles a head up display.
*/
class DePee : public osg::Referenced
{
public:
/*!
The constructor is initialized by giving it a parent and child node (subgraph), as well as the width and height in pixels of the output window. Additionally a subgraph can be added whose children aren't depth peeled but combined with de depth peeled scene
*/
DePee(osg::Group* parent, osg::Group* subgraph, unsigned width, unsigned height);
/*!
Takes care of clean removal of DePee
*/
~DePee();
/*!
The head up display shows information like internal status and current frames per second. This function needs to be called in the rendering loop to keep the information updated.
*/
bool updateHUDText();
/*!
Sets whether sketchiness is activated or deactivated
*/
void setSketchy(bool sketchy);
/*!
If sketchiness is enabled, sets whether a crayon should be used
*/
void setCrayon(bool crayon);
/*!
Sets whether color display is activated or deactivated
*/
void setColored(bool colored);
/*!
Sets whether edges are displayed or not
*/
void setEdgy(bool edgy);
/*!
Sets how sketchy lines and colors should be displayed (standard is 1.0)
*/
void setSketchiness(double sketchiness);
/*!
Set the pointer to the double variable containing the current fps for displaying it on the head up display
*/
void setFPS(double* fps);
/*!
Add a depth peeling pass and adjust the render passes accordingly
*/
bool addDePeePass();
/*!
Remove a depth peeling pass and adjust the render passes accordingly
*/
bool remDePeePass();
private:
/*!
Create a map. This is a function for convenience and calls either
createNoiseMap(), createEdgeMap() or createNormalDepthColorMap().
Apart from NOISE_MAP, for every texture generation
one rendering pass is needed.
The boolean first is used to indicate whether this rendering pass
belongs to the first depth peeling pass.
*/
bool createMap(MapMode mapMode, bool first=false);
/*!
Creates a two dimensional noise map and initalizes _noiseMap with it
*/
bool createNoiseMap();
/*!
Depending on the chosen MapMode, it either creates a new rendering
pass for creaeting a normal, depth or color map. The created rendering
pass is added to the current depth peeling pass.
*/
bool createNormalDepthColorMap(MapMode mapMode, bool first);
/*!
Create an edge map. A previous depth and normal rendering pass in this
depth peeling pass is required for that.
*/
bool createEdgeMap(bool first);
/*!
Creates the final rendering pass for depth peeling. Color and edge map are
added up here and sketchiness is applied.
*/
bool createFinal();
/*!
Create the rendering pass for the head up display
*/
bool createHUD();
/*
Returns the number of rendering passes of the depth peeling object
*/
unsigned int getNumberOfRenderPasses();
unsigned _texWidth;
unsigned _texHeight;
unsigned _width;
unsigned _height;
osg::ref_ptr<osg::Group> _parent;
osg::ref_ptr<osg::Group> _subgraph;
osg::ref_ptr<osg::Texture2D> _noiseMap;
osg::ref_ptr<osg::Texture2D> _normalDepthMap0;
osg::ref_ptr<osg::Texture2D> _normalDepthMap1;
osg::ref_ptr<osg::Texture2D> _edgeMap;
osg::ref_ptr<osg::Texture2D> _colorMap;
osg::ref_ptr<osg::Geode> _quadGeode;
osgText::Text* _hudText;
double* _fps;
std::vector<DePeePass*> _dePeePasses;
osg::Uniform* _sketchy;
osg::Uniform* _colored;
osg::Uniform* _edgy;
osg::Uniform* _sketchiness;
bool _isSketchy;
bool _isColored;
bool _isEdgy;
bool _isCrayon;
osg::Camera* _colorCamera;
//shader programs
osg::ref_ptr<osg::Program> _normalDepthMapProgram;
osg::ref_ptr<osg::Program> _colorMapProgram;
osg::ref_ptr<osg::Program> _edgeMapProgram;
bool _renderToFirst;
};
#endif

View File

@@ -0,0 +1,49 @@
/*
Steffen Frey
Fachpraktikum Graphik-Programmierung 2007
Institut fuer Visualisierung und Interaktive Systeme
Universitaet Stuttgart
*/
#include "DePeePass.h"
#include <iostream>
#include <assert.h>
DePeePass::DePeePass()
{
root = new osg::Group;
}
DePeePass::~DePeePass()
{
root->releaseGLObjects();
assert(Cameras.size() == settingNodes.size());
while(!Cameras.empty())
{
remRenderPass((*Cameras.begin()).first);
}
}
void DePeePass::newRenderPass(MapMode mapMode)
{
Cameras[mapMode] = new osg::Camera;
settingNodes[mapMode] = new osg::Group;
root->addChild(Cameras[mapMode].get());
Cameras[mapMode]->addChild(settingNodes[mapMode].get());
}
void DePeePass::remRenderPass(MapMode mapMode)
{
assert(Cameras.find(mapMode) != Cameras.end());
Cameras[mapMode]->releaseGLObjects();
settingNodes[mapMode]->releaseGLObjects();
Cameras[mapMode]->removeChild(settingNodes[mapMode].get());
//setting Nodes have exactly one child
assert(settingNodes[mapMode]->getNumChildren() == 1);
settingNodes[mapMode]->removeChild(0,1);
Cameras.erase(Cameras.find(mapMode));
settingNodes.erase(settingNodes.find(mapMode));
}

View File

@@ -0,0 +1,56 @@
/*
Steffen Frey
Fachpraktikum Graphik-Programmierung 2007
Institut fuer Visualisierung und Interaktive Systeme
Universitaet Stuttgart
*/
#ifndef _DEPEEPASS_H_
#define _DEPEEPASS_H_
#include <map>
#include <osg/Node>
#include <osg/Camera>
#include <osg/Group>
/*!
MapMode specifies the kind of texture maps that can be generated for later
usage
*/
enum MapMode {NORMAL_DEPTH_MAP, COLOR_MAP, EDGE_MAP, NOISE_MAP};
/*!
DePeePass can be seen as a mera data structure and typically used by
the class DePee. It represents one depth peeling pass and is initialized
by functions in the DePee class, but cleans itself up.
Please note, that no texture generation mode is allowed to appear twice
*/
class DePeePass
{
public:
/*!
Constructor
*/
DePeePass();
/*!
Desctructor cleans the whole depth peeling pass
*/
~DePeePass();
/*!
Make data structure ready for incorporating a new rendering pass
*/
void newRenderPass(MapMode mapMode);
/*!
Clean up the specified rendering pass
*/
void remRenderPass(MapMode mapMode);
osg::ref_ptr<osg::Group> root;
std::map<MapMode, osg::ref_ptr<osg::Camera> > Cameras;
std::map<MapMode, osg::ref_ptr<osg::Group> > settingNodes;
};
#endif

View File

@@ -0,0 +1,152 @@
/*
Steffen Frey
Fachpraktikum Graphik-Programmierung 2007
Institut fuer Visualisierung und Interaktive Systeme
Universitaet Stuttgart
*/
#include "Utility.h"
#include <assert.h>
#include <iostream>
#include <fstream>
#include <osg/Geometry>
#include <osg/Geode>
#include <osgDB/FileUtils>
bool Utility::readFile(char* fName, std::string& s)
{
std::string foundFile = osgDB::findDataFile(fName);
if (foundFile.empty()) return false;
std::ifstream is;//(fName);
is.open(foundFile.c_str());
if (is.fail())
{
std::cerr << "Could not open " << fName << " for reading.\n";
return false;
}
char ch = is.get();
while (!is.eof())
{
s += ch;
ch = is.get();
}
is.close();
return true;
}
std::string Utility::toString(double d)
{
std::stringstream ostr;
ostr << d;
return ostr.str();
}
osg::Program* Utility::createProgram(std::string vs, std::string fs)
{
//setup shader
std::string vertSource;
if(!readFile((char*)vs.c_str(), vertSource))
{
printf("shader source not found\n");
return false;
}
std::string fragSource;
if(!readFile((char*)fs.c_str(), fragSource))
{
printf("shader source not found\n");
return false;
}
osg::Program* program = new osg::Program;
program->addShader( new osg::Shader( osg::Shader::VERTEX, vertSource.c_str() ) );
program->addShader( new osg::Shader( osg::Shader::FRAGMENT, fragSource.c_str() ) );
return program;
}
double Utility::getNoise(unsigned x, unsigned y, unsigned random)
{
int n = x + y * 57 + random * 131;
n = (n<<13) ^ n;
double noise = (1.0f - ( (n * (n * n * 15731 + 789221) +
1376312589)&0x7fffffff)* 0.000000000931322574615478515625f);
return noise;
}
double Utility::smoothNoise(unsigned width, unsigned height, unsigned x, unsigned y, unsigned char* noise)
{
assert(noise);
if(x==0 || x > width -2
|| y==0 || y > height -2)
return noise[x + y*width];
double corners = (noise[x-1 + (y-1) *width]
+noise[x+1 + (y-1)*width]
+noise[x-1 + (y+1) * width]
+noise[x+1 + (y+1) * width]) / 16.0;
double sides = (noise[x-1 + y*width]
+noise[x+1 + y*width]
+noise[x + (y-1)*width]
+noise[x + (y+1)*width]) / 8.0;
double center = noise[x + y*width] / 4.0;
return corners + sides + center;
}
osg::Texture2D* Utility::newColorTexture2D(unsigned width, unsigned height, unsigned accuracy)
{
osg::Texture2D* texture2D = new osg::Texture2D;
texture2D->setTextureSize(width, height);
if(accuracy == 32)
{
texture2D->setInternalFormat(GL_RGBA32F_ARB);
texture2D->setSourceFormat(GL_RGBA);
}
else if(accuracy == 8)
{
texture2D->setInternalFormat(GL_RGBA);
}
texture2D->setSourceType(GL_FLOAT);
texture2D->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);
texture2D->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);
return texture2D;
}
osg::Geode* Utility::getCanvasQuad(unsigned width, unsigned height, double depth)
{
osg::Vec3Array* vertices = new osg::Vec3Array;
osg::Vec2Array* texCoords = new osg::Vec2Array;
vertices->push_back(osg::Vec3(0,0,depth));
texCoords->push_back(osg::Vec2(0,0));
vertices->push_back(osg::Vec3(width,0,depth));
texCoords->push_back(osg::Vec2(1,0));
vertices->push_back(osg::Vec3(0,height,depth));
texCoords->push_back(osg::Vec2(0,1));
vertices->push_back(osg::Vec3(width,height,depth));
texCoords->push_back(osg::Vec2(1,1));
osg::Geometry* quad = new osg::Geometry;
quad->setVertexArray(vertices);
quad->setTexCoordArray(1,texCoords);
quad->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUAD_STRIP,0,vertices->size()));
osg::Vec4Array* colors = new osg::Vec4Array;
colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
quad->setColorArray(colors);
quad->setColorBinding(osg::Geometry::BIND_OVERALL);
osg::Geode* geode = new osg::Geode();
geode->addDrawable(quad);
return geode;
}

View File

@@ -0,0 +1,57 @@
/*
Steffen Frey
Fachpraktikum Graphik-Programmierung 2007
Institut fuer Visualisierung und Interaktive Systeme
Universitaet Stuttgart
*/
#ifndef _UTILITY_H_
#define _UTILITY_H_
#include <string>
#include <sstream>
#include <osg/Program>
#include <osg/Texture2D>
namespace Utility
{
/*!
Reads a file and returns a string
*/
bool readFile(char* fName, std::string& s);
/*!
Converts a number to a string
*/
std::string toString(double d);
/*!
Create a osg shader program consisting of a vertex shader and a
fragment shader
*/
osg::Program* createProgram(std::string vs, std::string fs);
/*!
This is a random generator to generate noise patterns.
The returned values range from -1 to 1
*/
double getNoise(unsigned x, unsigned y, unsigned random);
/*!
Returns a smoothed noise version of the value that is read from the noise
texture
*/
double smoothNoise(unsigned width, unsigned height, unsigned x, unsigned y, unsigned char* noise);
/*!
Creates a two dimensional color texture and apply some standard settings
*/
osg::Texture2D* newColorTexture2D(unsigned width, unsigned height, unsigned accuracy);
/*!
Get a quad with screen size in order to show a texture full screen
*/
osg::Geode* getCanvasQuad(unsigned width, unsigned height, double depth=-1);
}
#endif

View File

@@ -0,0 +1,328 @@
/*
Steffen Frey
Fachpraktikum Graphik-Programmierung 2007
Institut fuer Visualisierung und Interaktive Systeme
Universitaet Stuttgart
*/
#include <osg/GLExtensions>
#include <osg/Node>
#include <osg/Geometry>
#include <osg/Notify>
#include <osg/MatrixTransform>
#include <osg/AnimationPath>
#include <osgDB/ReadFile>
#include <osgViewer/Viewer>
#include <osgGA/TrackballManipulator>
#include <iostream>
#include "DePee.h"
/*!
Handles keyboard events.
Maintains a copy of the DePee object and part of its internal state
Used for example to set sketchiness, color, add or remove a depth peeling pass
*/
class KeyboardEventHandler : public osgGA::GUIEventHandler
{
public:
KeyboardEventHandler(DePee* dePee)
{
_apc = 0;
_dePee = dePee;
_sketchy = false;
_sketchiness = 1.0;
_colored = false;
_edgy = true;
_crayon = false;
_dePee->setSketchy(_sketchy);
_dePee->setColored(_colored);
}
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&)
{
switch(ea.getEventType())
{
case(osgGA::GUIEventAdapter::KEYDOWN):
{
if (ea.getKey()==osgGA::GUIEventAdapter::KEY_Space)
{
if(_apc)
_apc->setPause(!_apc->getPause());
return true;
}
else if (ea.getKey() == 'a')
{
_dePee->addDePeePass();
return true;
}
else if (ea.getKey() == 'r')
{
_dePee->remDePeePass();
return true;
}
else if (ea.getKey() == 'c')
{
_colored = !_colored;
_dePee->setColored(_colored);
return true;
}
else if (ea.getKey() == 's')
{
_sketchy = !_sketchy;
_dePee->setSketchy(_sketchy);
return true;
}
else if (ea.getKey() == 'e')
{
_edgy = !_edgy;
_dePee->setEdgy(_edgy);
return true;
}
else if (ea.getKey() == 'f')
{
return true;
}
else if (ea.getKey() == '+')
{
_sketchiness += 0.5;
_dePee->setSketchiness(_sketchiness);
}
else if (ea.getKey() == '-')
{
_sketchiness -= 0.5;
if(_sketchiness < 0.0)
_sketchiness = 0.0;
_dePee->setSketchiness(_sketchiness);
}
else if (ea.getKey() == 'y')
{
_crayon = !_crayon;
_dePee->setCrayon(_crayon);
}
break;
}
default:
break;
}
return false;
}
void registerAnimationPathCallback(osg::AnimationPathCallback* apc)
{
_apc = apc;
}
private:
DePee* _dePee;
bool _sketchy;
bool _colored;
bool _edgy;
bool _crayon;
double _sketchiness;
osg::AnimationPathCallback* _apc;
};
/*!
Handles mouse events.
Maintains a copy of the DePee object and part of its internal state
Used to rotate the object
*/
class MouseEventHandler : public osgGA::GUIEventHandler
{
public:
MouseEventHandler(DePee* dePee)
{
_dePee = dePee;
}
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&)
{
switch(ea.getEventType())
{
//mouse
case(osgGA::GUIEventAdapter::DRAG):
{
rotate(ea.getXnormalized(), ea.getYnormalized());
break;
}
case(osgGA::GUIEventAdapter::MOVE):
_prevX = ea.getXnormalized();
_prevY = ea.getYnormalized();
break;
default:
break;
}
return false;
}
void registerModelGroupTransform(osg::MatrixTransform* modelGroupTransform)
{
_modelGroupTransform = modelGroupTransform;
_rotCenter = modelGroupTransform->getBound().center();
}
private:
void rotate(float x, float y)
{
osg::Matrixd baseMatrix = _modelGroupTransform->getMatrix();
osg::Matrixd preTransMatrix;
osg::Matrixd postTransMatrix;
osg::Matrixd rotMatrixX;
osg::Matrixd rotMatrixZ;
preTransMatrix.makeTranslate(_rotCenter);
postTransMatrix.makeTranslate(-_rotCenter);
rotMatrixZ.makeRotate((x - _prevX) * 3., osg::Vec3d(0.0, 0.0,1.0));
baseMatrix.preMult(preTransMatrix);
baseMatrix.preMult(rotMatrixZ);
baseMatrix.preMult(postTransMatrix);
rotMatrixX.makeRotate(-(y - _prevY) * 3., (baseMatrix * osg::Vec3d(1.0, 0.0,0.0)));
baseMatrix.preMult(preTransMatrix);
baseMatrix.preMult(rotMatrixX);
baseMatrix.preMult(postTransMatrix);
_modelGroupTransform->setMatrix(baseMatrix);
_prevX = x;
_prevY = y;
};
DePee* _dePee;
float _prevX;
float _prevY;
osg::Vec3 _rotCenter;
osg::MatrixTransform* _modelGroupTransform;
};
int main( int argc, char **argv )
{
// use an ArgumentParser object to manage the program arguments.
osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates Depth Peeling");
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" filename");
// construct the viewer
osgViewer::Viewer viewer(arguments);
// any option left unread are converted into errors to write out later.
arguments.reportRemainingOptionsAsUnrecognized();
// report any errors if they have occured when parsing the program aguments.
if (arguments.errors())
{
arguments.writeErrorMessages(std::cout);
return 1;
}
if (arguments.argc()<=1 || arguments.argc() > 3)
{
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
return 1;
}
//only displays a textured quad
viewer.getCamera()->setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);
// read the model to do depth peeling with
osg::Node* loadedModel = osgDB::readNodeFile(arguments.argv()[1]);
if (!loadedModel)
return 1;
// create a transform to spin the model.
osg::MatrixTransform* modelGroupTransform = new osg::MatrixTransform;
osg::Group* modelGroup = new osg::Group;
modelGroupTransform->addChild(modelGroup);
modelGroup->addChild(loadedModel);
osg::Group* rootNode = new osg::Group();
// add model to the viewer.
viewer.setSceneData(rootNode);
// Depth peel example only works on a single graphics context right now
// so open up viewer on single screen to prevent problems
viewer.setUpViewOnSingleScreen(0);
// create the windows and run the threads.
viewer.realize();
unsigned int width = 1280;
unsigned int height = 1280;
osgViewer::Viewer::Windows windows;
viewer.getWindows(windows);
if (!windows.empty())
{
width = windows.front()->getTraits()->width;
height = windows.front()->getTraits()->height;
}
osg::ref_ptr<DePee> dePee = new DePee(rootNode,
modelGroupTransform,
width,
height);
//create event handlers
KeyboardEventHandler* keyboardEventHandler = new KeyboardEventHandler(dePee.get());
MouseEventHandler* mouseEventHandler = new MouseEventHandler(dePee.get());
viewer.addEventHandler(keyboardEventHandler);
viewer.addEventHandler(mouseEventHandler);
//viewer.setCameraManipulator(new osgGA::TrackballManipulator);
osg::StateSet* stateset = modelGroupTransform->getOrCreateStateSet();
stateset->setMode(GL_BLEND, osg::StateAttribute::OFF);
//create new animation callback for autmatic object rotation
osg::AnimationPathCallback* apc = new osg::AnimationPathCallback(modelGroupTransform->getBound().center(),osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(45.0f));
apc->setPause(true);
modelGroupTransform->setUpdateCallback(apc);
keyboardEventHandler->registerAnimationPathCallback(apc);
mouseEventHandler->registerModelGroupTransform(modelGroupTransform);
//setup stuff that is necessary for measuring fps
osg::Timer_t current_tick, previous_tick = 1;
double* fps = new double;
dePee->setFPS(fps);
while(!viewer.done())
{
current_tick = osg::Timer::instance()->tick();
*fps = 1.0/osg::Timer::instance()->delta_s(previous_tick,current_tick);
dePee->updateHUDText();
previous_tick = current_tick;
// fire off the cull and draw traversals of the scene.
viewer.frame();
}
return 0;
}

View File

@@ -1,7 +0,0 @@
#this file is automatically generated
SET(TARGET_SRC osgdepthshadow.cpp )
SET(TARGET_ADDED_LIBRARIES osgShadow )
#### end var setup ###
SETUP_EXAMPLE(osgdepthshadow)

View File

@@ -1,521 +0,0 @@
/* OpenSceneGraph example, osgdepthshadow.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <osgViewer/Viewer>
#include <osg/Projection>
#include <osg/Geometry>
#include <osg/Texture>
#include <osg/TexGen>
#include <osg/Geode>
#include <osg/ShapeDrawable>
#include <osg/PolygonOffset>
#include <osg/Texture2D>
#include <osg/MatrixTransform>
#include <osg/Light>
#include <osg/LightSource>
#include <osg/PolygonOffset>
#include <osg/CullFace>
#include <osg/Material>
#include <osg/TexEnvCombine>
#include <osg/TexEnv>
#include <osg/AnimationPath>
#include <osg/TexGenNode>
#include <osgDB/ReadFile>
#include <osgShadow/ShadowedScene>
#include <osgShadow/ShadowMap>
#include <iostream>
using namespace osg;
class LightTransformCallback: public osg::NodeCallback
{
public:
LightTransformCallback(float angular_velocity, float height, float radius):
_angular_velocity(angular_velocity),
_height(height),
_radius(radius),
_previous_traversal_number(-1),
_previous_time(-1.0f),
_angle(0)
{
}
void operator()(Node* node, NodeVisitor* nv);
protected:
float _angular_velocity;
float _height;
float _radius;
int _previous_traversal_number;
double _previous_time;
float _angle;
};
void
LightTransformCallback::operator()(Node* node, NodeVisitor* nv)
{
MatrixTransform* transform = dynamic_cast<MatrixTransform*>(node);
if (nv && transform)
{
const FrameStamp* fs = nv->getFrameStamp();
if (!fs) return; // not frame stamp, no handle on the time so can't move.
double new_time = fs->getSimulationTime();
if (nv->getTraversalNumber() != _previous_traversal_number)
{
_angle += _angular_velocity * (new_time - _previous_time);
Matrix matrix = Matrix::rotate(atan(_height / _radius), -X_AXIS) *
Matrix::rotate(PI_2, Y_AXIS) *
Matrix::translate(Vec3(_radius, 0, 0)) *
Matrix::rotate(_angle, Y_AXIS) *
Matrix::translate(Vec3(0, _height, 0));
// update the specified transform
transform->setMatrix(matrix);
_previous_traversal_number = nv->getTraversalNumber();
}
_previous_time = new_time;
}
// must call any nested node callbacks and continue subgraph traversal.
traverse(node,nv);
}
ref_ptr<MatrixTransform> _create_lights()
{
ref_ptr<MatrixTransform> transform_0 = new MatrixTransform;
// create a spot light.
ref_ptr<Light> light_0 = new Light;
light_0->setLightNum(0);
light_0->setPosition(Vec4(0, 0, 0, 1.0f));
light_0->setAmbient(Vec4(0.0f, 0.0f, 0.0f, 1.0f));
light_0->setDiffuse(Vec4(1.0f, 0.8f, 0.8f, 1.0f));
light_0->setSpotCutoff(60.0f);
light_0->setSpotExponent(2.0f);
ref_ptr<LightSource> light_source_0 = new LightSource;
light_source_0->setLight(light_0.get());
light_source_0->setLocalStateSetModes(StateAttribute::ON);
transform_0->setUpdateCallback(new LightTransformCallback(inDegrees(90.0f), 8, 5));
transform_0->addChild(light_source_0.get());
ref_ptr<Geode> geode = new Geode;
ref_ptr<ShapeDrawable> shape;
ref_ptr<TessellationHints> hints = new TessellationHints;
hints->setDetailRatio(0.3f);
shape = new ShapeDrawable(new Sphere(Vec3(0.0f, 0.0f, 0.0f), 0.15f), hints.get());
shape->setColor(Vec4(1.0f, 0.5f, 0.5f, 1.0f));
geode->addDrawable(shape.get());
shape = new ShapeDrawable(new Cylinder(Vec3(0.0f, 0.0f, -0.4f), 0.05f, 0.8f), hints.get());
shape->setColor(Vec4(1.0f, 0.5f, 0.5f, 1.0f));
geode->addDrawable(shape.get());
geode->getOrCreateStateSet()->setMode(GL_LIGHTING, StateAttribute::OFF);
transform_0->addChild(geode.get());
return transform_0;
}
ref_ptr<Group> _create_scene()
{
ref_ptr<Group> scene = new Group;
ref_ptr<Geode> geode_1 = new Geode;
scene->addChild(geode_1.get());
ref_ptr<Geode> geode_2 = new Geode;
ref_ptr<MatrixTransform> transform_2 = new MatrixTransform;
transform_2->addChild(geode_2.get());
transform_2->setUpdateCallback(new osg::AnimationPathCallback(Vec3(0, 0, 0), Y_AXIS, inDegrees(45.0f)));
scene->addChild(transform_2.get());
ref_ptr<Geode> geode_3 = new Geode;
ref_ptr<MatrixTransform> transform_3 = new MatrixTransform;
transform_3->addChild(geode_3.get());
transform_3->setUpdateCallback(new osg::AnimationPathCallback(Vec3(0, 0, 0), Y_AXIS, inDegrees(-22.5f)));
scene->addChild(transform_3.get());
const float radius = 0.8f;
const float height = 1.0f;
ref_ptr<TessellationHints> hints = new TessellationHints;
hints->setDetailRatio(2.0f);
ref_ptr<ShapeDrawable> shape;
shape = new ShapeDrawable(new Box(Vec3(0.0f, -2.0f, 0.0f), 10, 0.1f, 10), hints.get());
shape->setColor(Vec4(0.5f, 0.5f, 0.7f, 1.0f));
geode_1->addDrawable(shape.get());
shape = new ShapeDrawable(new Sphere(Vec3(0.0f, 0.0f, 0.0f), radius * 2), hints.get());
shape->setColor(Vec4(0.8f, 0.8f, 0.8f, 1.0f));
geode_1->addDrawable(shape.get());
shape = new ShapeDrawable(new Sphere(Vec3(-3.0f, 0.0f, 0.0f), radius), hints.get());
shape->setColor(Vec4(0.6f, 0.8f, 0.8f, 1.0f));
geode_2->addDrawable(shape.get());
shape = new ShapeDrawable(new Box(Vec3(3.0f, 0.0f, 0.0f), 2 * radius), hints.get());
shape->setColor(Vec4(0.4f, 0.9f, 0.3f, 1.0f));
geode_2->addDrawable(shape.get());
shape = new ShapeDrawable(new Cone(Vec3(0.0f, 0.0f, -3.0f), radius, height), hints.get());
shape->setColor(Vec4(0.2f, 0.5f, 0.7f, 1.0f));
geode_2->addDrawable(shape.get());
shape = new ShapeDrawable(new Cylinder(Vec3(0.0f, 0.0f, 3.0f), radius, height), hints.get());
shape->setColor(Vec4(1.0f, 0.3f, 0.3f, 1.0f));
geode_2->addDrawable(shape.get());
shape = new ShapeDrawable(new Box(Vec3(0.0f, 3.0f, 0.0f), 2, 0.1f, 2), hints.get());
shape->setColor(Vec4(0.8f, 0.8f, 0.4f, 1.0f));
geode_3->addDrawable(shape.get());
// material
ref_ptr<Material> matirial = new Material;
matirial->setColorMode(Material::DIFFUSE);
matirial->setAmbient(Material::FRONT_AND_BACK, Vec4(0, 0, 0, 1));
matirial->setSpecular(Material::FRONT_AND_BACK, Vec4(1, 1, 1, 1));
matirial->setShininess(Material::FRONT_AND_BACK, 64.0f);
scene->getOrCreateStateSet()->setAttributeAndModes(matirial.get(), StateAttribute::ON);
return scene;
}
class UpdateCameraAndTexGenCallback : public osg::NodeCallback
{
public:
UpdateCameraAndTexGenCallback(osg::MatrixTransform* light_transform, osg::Camera* Camera, osg::TexGenNode* texgenNode):
_light_transform(light_transform),
_Camera(Camera),
_texgenNode(texgenNode)
{
}
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
// first update subgraph to make sure objects are all moved into postion
traverse(node,nv);
// now compute the camera's view and projection matrix to point at the shadower (the camera's children)
osg::BoundingSphere bs;
for(unsigned int i=0; i<_Camera->getNumChildren(); ++i)
{
bs.expandBy(_Camera->getChild(i)->getBound());
}
if (!bs.valid())
{
osg::notify(osg::WARN) << "bb invalid"<<_Camera.get()<<std::endl;
return;
}
osg::Vec3 position = _light_transform->getMatrix().getTrans();
float centerDistance = (position-bs.center()).length();
float znear = centerDistance-bs.radius();
float zfar = centerDistance+bs.radius();
float zNearRatio = 0.001f;
if (znear<zfar*zNearRatio) znear = zfar*zNearRatio;
#if 0
// hack to illustrate the precision problems of excessive gap between near far range.
znear = 0.00001*zfar;
#endif
float top = (bs.radius()/centerDistance)*znear;
float right = top;
_Camera->setReferenceFrame(osg::Camera::ABSOLUTE_RF);
_Camera->setProjectionMatrixAsFrustum(-right,right,-top,top,znear,zfar);
_Camera->setViewMatrixAsLookAt(position,bs.center(),osg::Vec3(0.0f,1.0f,0.0f));
// compute the matrix which takes a vertex from local coords into tex coords
// will use this later to specify osg::TexGen..
osg::Matrix MVPT = _Camera->getViewMatrix() *
_Camera->getProjectionMatrix() *
osg::Matrix::translate(1.0,1.0,1.0) *
osg::Matrix::scale(0.5f,0.5f,0.5f);
_texgenNode->getTexGen()->setMode(osg::TexGen::EYE_LINEAR);
_texgenNode->getTexGen()->setPlanesFromMatrix(MVPT);
}
protected:
virtual ~UpdateCameraAndTexGenCallback() {}
osg::ref_ptr<osg::MatrixTransform> _light_transform;
osg::ref_ptr<osg::Camera> _Camera;
osg::ref_ptr<osg::TexGenNode> _texgenNode;
};
//////////////////////////////////////////////////////////////////
// fragment shader
//
char fragmentShaderSource_noBaseTexture[] =
"uniform sampler2DShadow shadowTexture; \n"
"uniform vec2 ambientBias; \n"
"\n"
"void main(void) \n"
"{ \n"
" gl_FragColor = gl_Color * (ambientBias.x + shadow2DProj( shadowTexture, gl_TexCoord[0] ) * ambientBias.y); \n"
"}\n";
//////////////////////////////////////////////////////////////////
// fragment shader
//
char fragmentShaderSource_withBaseTexture[] =
"uniform sampler2D baseTexture; \n"
"uniform sampler2DShadow shadowTexture; \n"
"uniform vec2 ambientBias; \n"
"\n"
"void main(void) \n"
"{ \n"
" vec4 color = gl_Color * texture2D( baseTexture, gl_TexCoord[0].xy ); \n"
" gl_FragColor = color * (ambientBias.x + shadow2DProj( shadowTexture, gl_TexCoord[1] ) * ambientBias.y); \n"
"}\n";
osg::Group* createShadowedScene(osg::Node* shadowed,osg::MatrixTransform* light_transform, unsigned int unit)
{
osg::Group* group = new osg::Group;
unsigned int tex_width = 1024;
unsigned int tex_height = 1024;
osg::Texture2D* texture = new osg::Texture2D;
texture->setTextureSize(tex_width, tex_height);
texture->setInternalFormat(GL_DEPTH_COMPONENT);
texture->setShadowComparison(true);
texture->setShadowTextureMode(Texture::LUMINANCE);
texture->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);
texture->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);
// set up the render to texture camera.
{
// create the camera
osg::Camera* camera = new osg::Camera;
camera->setClearMask(GL_DEPTH_BUFFER_BIT);
camera->setClearColor(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
camera->setComputeNearFarMode(osg::Camera::DO_NOT_COMPUTE_NEAR_FAR);
// set viewport
camera->setViewport(0,0,tex_width,tex_height);
osg::StateSet* _local_stateset = camera->getOrCreateStateSet();
_local_stateset->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
float factor = 0.0f;
float units = 1.0f;
ref_ptr<PolygonOffset> polygon_offset = new PolygonOffset;
polygon_offset->setFactor(factor);
polygon_offset->setUnits(units);
_local_stateset->setAttribute(polygon_offset.get(), StateAttribute::ON | StateAttribute::OVERRIDE);
_local_stateset->setMode(GL_POLYGON_OFFSET_FILL, StateAttribute::ON | StateAttribute::OVERRIDE);
ref_ptr<CullFace> cull_face = new CullFace;
cull_face->setMode(CullFace::FRONT);
_local_stateset->setAttribute(cull_face.get(), StateAttribute::ON | StateAttribute::OVERRIDE);
_local_stateset->setMode(GL_CULL_FACE, StateAttribute::ON | StateAttribute::OVERRIDE);
// set the camera to render before the main camera.
camera->setRenderOrder(osg::Camera::PRE_RENDER);
// tell the camera to use OpenGL frame buffer object where supported.
camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
// attach the texture and use it as the color buffer.
camera->attach(osg::Camera::DEPTH_BUFFER, texture);
// add subgraph to render
camera->addChild(shadowed);
group->addChild(camera);
// create the texgen node to project the tex coords onto the subgraph
osg::TexGenNode* texgenNode = new osg::TexGenNode;
texgenNode->setTextureUnit(unit);
group->addChild(texgenNode);
// set an update callback to keep moving the camera and tex gen in the right direction.
group->setUpdateCallback(new UpdateCameraAndTexGenCallback(light_transform, camera, texgenNode));
}
// set the shadowed subgraph so that it uses the texture and tex gen settings.
{
osg::Group* shadowedGroup = new osg::Group;
shadowedGroup->addChild(shadowed);
group->addChild(shadowedGroup);
osg::StateSet* stateset = shadowedGroup->getOrCreateStateSet();
stateset->setTextureAttributeAndModes(unit,texture,osg::StateAttribute::ON);
stateset->setTextureMode(unit,GL_TEXTURE_GEN_S,osg::StateAttribute::ON);
stateset->setTextureMode(unit,GL_TEXTURE_GEN_T,osg::StateAttribute::ON);
stateset->setTextureMode(unit,GL_TEXTURE_GEN_R,osg::StateAttribute::ON);
stateset->setTextureMode(unit,GL_TEXTURE_GEN_Q,osg::StateAttribute::ON);
osg::Program* program = new osg::Program;
stateset->setAttribute(program);
if (unit==0)
{
osg::Shader* fragment_shader = new osg::Shader(osg::Shader::FRAGMENT, fragmentShaderSource_noBaseTexture);
program->addShader(fragment_shader);
osg::Uniform* shadowTextureSampler = new osg::Uniform("shadowTexture",(int)unit);
stateset->addUniform(shadowTextureSampler);
}
else
{
osg::Shader* fragment_shader = new osg::Shader(osg::Shader::FRAGMENT, fragmentShaderSource_withBaseTexture);
program->addShader(fragment_shader);
osg::Uniform* baseTextureSampler = new osg::Uniform("baseTexture",0);
stateset->addUniform(baseTextureSampler);
osg::Uniform* shadowTextureSampler = new osg::Uniform("shadowTexture",(int)unit);
stateset->addUniform(shadowTextureSampler);
}
osg::Uniform* ambientBias = new osg::Uniform("ambientBias",osg::Vec2(0.3f,1.2f));
stateset->addUniform(ambientBias);
}
// add the shadower and shadowed.
group->addChild(light_transform);
return group;
}
int main(int argc, char** argv)
{
// use an ArgumentParser object to manage the program arguments.
ArgumentParser arguments(&argc, argv);
// set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName() + " is the example which demonstrates using of GL_ARB_shadow extension implemented in osg::Texture class");
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName());
arguments.getApplicationUsage()->addCommandLineOption("-h or --help", "Display this information");
arguments.getApplicationUsage()->addCommandLineOption("--with-base-texture", "Adde base texture to shadowed model.");
arguments.getApplicationUsage()->addCommandLineOption("--no-base-texture", "Adde base texture to shadowed model.");
// construct the viewer.
osgViewer::Viewer viewer;
bool withBaseTexture = true;
while(arguments.read("--with-base-texture")) { withBaseTexture = true; }
while(arguments.read("--no-base-texture")) { withBaseTexture = false; }
// if user request help write it out to cout.
if (arguments.read("-h") || arguments.read("--help"))
{
arguments.getApplicationUsage()->write(std::cout);
return 1;
}
if (arguments.read("--sm"))
{
osgShadow::ShadowMap* sm = new osgShadow::ShadowMap;
sm->setTextureUnit( withBaseTexture ? 1 : 0 );
osg::ref_ptr<osgShadow::ShadowedScene> shadowedScene = new osgShadow::ShadowedScene(sm);
ref_ptr<Group> created_scene = _create_scene();
if (!created_scene.valid()) return 1;
shadowedScene->addChild(_create_scene().get());
ref_ptr<MatrixTransform> scene = new MatrixTransform;
scene->setMatrix(osg::Matrix::rotate(osg::DegreesToRadians(125.0),1.0,0.0,0.0));
scene->addChild(_create_lights().get());
scene->addChild(shadowedScene.get());
if (withBaseTexture)
{
scene->getOrCreateStateSet()->setTextureAttributeAndModes( 0, new osg::Texture2D(osgDB::readImageFile("Images/lz.rgb")), osg::StateAttribute::ON);
}
viewer.setSceneData(scene.get());
}
else
{
ref_ptr<MatrixTransform> scene = new MatrixTransform;
scene->setMatrix(osg::Matrix::rotate(osg::DegreesToRadians(125.0),1.0,0.0,0.0));
ref_ptr<Group> created_scene = _create_scene();
if (!created_scene.valid()) return 1;
ref_ptr<MatrixTransform> light_transform = _create_lights();
if (!light_transform.valid()) return 1;
ref_ptr<Group> shadowedScene;
if (withBaseTexture)
{
scene->getOrCreateStateSet()->setTextureAttributeAndModes( 0, new osg::Texture2D(osgDB::readImageFile("Images/lz.rgb")), osg::StateAttribute::ON);
shadowedScene = createShadowedScene(created_scene.get(),light_transform.get(),1);
}
else
{
shadowedScene = createShadowedScene(created_scene.get(),light_transform.get(),0);
}
scene->addChild(shadowedScene.get());
viewer.setSceneData(scene.get());
}
// viewer.setUpViewOnSingleScreen();
return viewer.run();
}

View File

@@ -698,6 +698,16 @@ int main(int argc, char** argv)
viewer.setSceneData( distortionNode );
}
while (arguments.read("--sky-light"))
{
viewer.setLightingMode(osg::View::SKY_LIGHT);
}
if (viewer.getLightingMode()==osg::View::HEADLIGHT)
{
viewer.getLight()->setPosition(osg::Vec4(0.0f,0.0f,0.0f,1.0f));
}
// load the nodes from the commandline arguments.
if (!viewer.getSceneData())

View File

@@ -38,9 +38,9 @@ std::string createLibraryNameForWrapper(const std::string& ext)
#if defined(WIN32)
// !! recheck evolving Cygwin DLL extension naming protocols !! NHV
#ifdef __CYGWIN__
return "cygosgwrapper_"+ext+".dll";
return "cygwin_osgwrapper_"+ext+".dll";
#elif defined(__MINGW32__)
return "libosgwrapper_"+ext+".dll";
return "mingw_osgwrapper_"+ext+".dll";
#else
#ifdef _DEBUG
return "osgwrapper_"+ext+"d.dll";

View File

@@ -17,6 +17,7 @@
*/
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osg/io_utils>
#include <osg/MatrixTransform>
@@ -358,6 +359,7 @@ void KeyboardModel::createKeyboard()
class KeyboardEventHandler : public osgGA::GUIEventHandler
{
public:
@@ -367,6 +369,34 @@ public:
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&)
{
#if 1
// osg::notify(osg::NOTICE)<<"Mouse "<<ea.getButtonMask()<<std::endl;
#define PRINT(mask) osg::notify(osg::NOTICE)<<#mask<<" ="<<(ea.getModKeyMask() & mask)<<std::endl;
switch(ea.getEventType())
{
case(osgGA::GUIEventAdapter::KEYDOWN):
case(osgGA::GUIEventAdapter::KEYUP):
{
osg::notify(osg::NOTICE)<<std::endl;
PRINT(osgGA::GUIEventAdapter::MODKEY_LEFT_SHIFT);
PRINT(osgGA::GUIEventAdapter::MODKEY_RIGHT_SHIFT);
PRINT(osgGA::GUIEventAdapter::MODKEY_LEFT_ALT);
PRINT(osgGA::GUIEventAdapter::MODKEY_RIGHT_ALT);
PRINT(osgGA::GUIEventAdapter::MODKEY_LEFT_CTRL);
PRINT(osgGA::GUIEventAdapter::MODKEY_RIGHT_CTRL);
PRINT(osgGA::GUIEventAdapter::MODKEY_LEFT_META);
PRINT(osgGA::GUIEventAdapter::MODKEY_RIGHT_META);
PRINT(osgGA::GUIEventAdapter::MODKEY_NUM_LOCK);
PRINT(osgGA::GUIEventAdapter::MODKEY_CAPS_LOCK);
break;
}
default:
break;
}
#endif
switch(ea.getEventType())
{
case(osgGA::GUIEventAdapter::KEYDOWN):
@@ -395,6 +425,8 @@ int main(int , char **)
osg::ref_ptr<KeyboardModel> keyboardModel = new KeyboardModel;
viewer.addEventHandler(new osgViewer::StatsHandler);
viewer.addEventHandler(new osgViewer::WindowSizeHandler());
viewer.addEventHandler(new KeyboardEventHandler(keyboardModel.get()));
viewer.setSceneData( keyboardModel->getScene() );

View File

@@ -237,7 +237,7 @@ int runApp(std::string xapp)
} // end printList()
void readConfFile(char* confFile) // read confFile 1
void readConfFile(const char* confFile) // read confFile 1
{
osg::notify(osg::INFO) << "Start reading confFile" << std::endl;
@@ -418,6 +418,7 @@ int main( int argc, char **argv )
osgViewer::Viewer viewer;
osg::ref_ptr<osgText::Text> updateText = new osgText::Text;
updateText->setDataVariance(osg::Object::DYNAMIC);
// add the handler for doing the picking
viewer.addEventHandler(new PickHandler(&viewer,updateText.get()));

View File

@@ -267,14 +267,16 @@ void MovieEventHandler::getUsage(osg::ApplicationUsage& usage) const
}
osg::Geometry* myCreateTexturedQuadGeometry(const osg::Vec3& pos,float width,float height, osg::Image* image, bool useTextureRectangle)
osg::Geometry* myCreateTexturedQuadGeometry(const osg::Vec3& pos,float width,float height, osg::Image* image, bool useTextureRectangle, bool xyPlane, bool option_flip)
{
bool flip = image->getOrigin()==osg::Image::TOP_LEFT;
if (option_flip) flip = !flip;
if (useTextureRectangle)
{
osg::Geometry* pictureQuad = osg::createTexturedQuadGeometry(pos,
osg::Vec3(width,0.0f,0.0f),
osg::Vec3(0.0f,0.0f,height),
xyPlane ? osg::Vec3(0.0f,height,0.0f) : osg::Vec3(0.0f,0.0f,height),
0.0f, flip ? image->t() : 0.0, image->s(), flip ? 0.0 : image->t());
osg::TextureRectangle* texture = new osg::TextureRectangle(image);
@@ -292,7 +294,7 @@ osg::Geometry* myCreateTexturedQuadGeometry(const osg::Vec3& pos,float width,flo
{
osg::Geometry* pictureQuad = osg::createTexturedQuadGeometry(pos,
osg::Vec3(width,0.0f,0.0f),
osg::Vec3(0.0f,0.0f,height),
xyPlane ? osg::Vec3(0.0f,height,0.0f) : osg::Vec3(0.0f,0.0f,height),
0.0f, flip ? 1.0f : 0.0f , 1.0f, flip ? 0.0f : 1.0f);
osg::Texture2D* texture = new osg::Texture2D(image);
@@ -309,324 +311,6 @@ osg::Geometry* myCreateTexturedQuadGeometry(const osg::Vec3& pos,float width,flo
}
}
class DomeModel
{
public:
DomeModel(osg::ArgumentParser& arguments):
sphere_radius(1.0),
collar_radius(0.45),
rotationDegrees(180.0),
distance(0.0),
flip(false),
texcoord_flip(false)
{
if (arguments.read("--radius", sphere_radius)) {}
if (arguments.read("--collar", collar_radius)) {}
if (arguments.read("--rotation", rotationDegrees)) {}
distance = sqrt(sphere_radius*sphere_radius - collar_radius*collar_radius);
if (arguments.read("--distance", distance)) {}
if (arguments.read("--flip")) { flip = true; }
}
double sphere_radius;
double collar_radius;
double rotationDegrees;
double distance;
bool flip;
bool texcoord_flip;
};
osg::Geometry* createDomeDistortionMesh(const osg::Vec3& origin, const osg::Vec3& widthVector, const osg::Vec3& heightVector, DomeModel& domeModel)
{
osg::Vec3d center(0.0,0.0,0.0);
osg::Vec3d eye(0.0,0.0,0.0);
bool centerProjection = false;
osg::Vec3d projector = eye - osg::Vec3d(0.0,0.0, domeModel.distance);
osg::notify(osg::NOTICE)<<"Projector position = "<<projector<<std::endl;
osg::notify(osg::NOTICE)<<"distance = "<<domeModel.distance<<std::endl;
// create the quad to visualize.
osg::Geometry* geometry = new osg::Geometry();
geometry->setSupportsDisplayList(false);
osg::Vec3 xAxis(widthVector);
float width = widthVector.length();
xAxis /= width;
osg::Vec3 yAxis(heightVector);
float height = heightVector.length();
yAxis /= height;
int noSteps = 160;
osg::Vec3Array* vertices = new osg::Vec3Array;
osg::Vec2Array* texcoords = new osg::Vec2Array;
osg::Vec4Array* colors = new osg::Vec4Array;
osg::Vec3 bottom = origin;
osg::Vec3 dx = xAxis*(width/((float)(noSteps-2)));
osg::Vec3 dy = yAxis*(height/((float)(noSteps-1)));
osg::Vec3 top = origin + yAxis*height;
osg::Vec3d screenCenter = origin + widthVector*0.5f + heightVector*0.5f;
float screenRadius = heightVector.length() * 0.5f;
double rotation = osg::DegreesToRadians(domeModel.rotationDegrees);
osg::Vec3 cursor = bottom;
int i,j;
int midSteps = noSteps/2;
for(i=0;i<midSteps;++i)
{
osg::Vec3 cursor = bottom+dy*(float)i;
for(j=0;j<midSteps;++j)
{
osg::Vec2 delta(cursor.x() - screenCenter.x(), cursor.y() - screenCenter.y());
double theta = atan2(delta.x(), -delta.y());
theta += 2*osg::PI;
double phi = osg::PI_2 * delta.length() / screenRadius;
if (phi > osg::PI_2) phi = osg::PI_2;
double f = domeModel.distance * sin(phi);
double e = domeModel.distance * cos(phi) + sqrt( domeModel.sphere_radius*domeModel.sphere_radius - f*f);
double l = e * cos(phi);
double h = e * sin(phi);
double gamma = atan2(h, l-domeModel.distance);
osg::Vec2 texcoord(theta/(2.0*osg::PI), 1.0-gamma/osg::PI);
// osg::notify(osg::NOTICE)<<"cursor = "<<cursor<< " theta = "<<theta<< "phi="<<phi<<" gamma = "<<gamma<<" texcoord="<<texcoord<<std::endl;
if (domeModel.flip)
vertices->push_back(osg::Vec3(cursor.x(), top.y()-(cursor.y()-origin.y()),cursor.z()));
else
vertices->push_back(cursor);
colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
texcoords->push_back( domeModel.texcoord_flip ? osg::Vec2(texcoord.x(), 1.0f - texcoord.y()) : texcoord);
if (j+1<midSteps) cursor += dx;
}
for(;j<noSteps;++j)
{
osg::Vec2 delta(cursor.x() - screenCenter.x(), cursor.y() - screenCenter.y());
double theta = atan2(delta.x(), -delta.y());
double phi = osg::PI_2 * delta.length() / screenRadius;
if (phi > osg::PI_2) phi = osg::PI_2;
double f = domeModel.distance * sin(phi);
double e = domeModel.distance * cos(phi) + sqrt( domeModel.sphere_radius*domeModel.sphere_radius - f*f);
double l = e * cos(phi);
double h = e * sin(phi);
double gamma = atan2(h, l-domeModel.distance);
osg::Vec2 texcoord(theta/(2.0*osg::PI), 1.0-gamma/osg::PI);
// osg::notify(osg::NOTICE)<<"cursor = "<<cursor<< " theta = "<<theta<< "phi="<<phi<<" gamma = "<<gamma<<" texcoord="<<texcoord<<std::endl;
if (domeModel.flip)
vertices->push_back(osg::Vec3(cursor.x(), top.y()-(cursor.y()-origin.y()),cursor.z()));
else
vertices->push_back(cursor);
colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
texcoords->push_back( domeModel.texcoord_flip ? osg::Vec2(texcoord.x(), 1.0f - texcoord.y()) : texcoord);
cursor += dx;
}
// osg::notify(osg::NOTICE)<<std::endl;
}
for(;i<noSteps;++i)
{
osg::Vec3 cursor = bottom+dy*(float)i;
for(j=0;j<noSteps;++j)
{
osg::Vec2 delta(cursor.x() - screenCenter.x(), cursor.y() - screenCenter.y());
double theta = atan2(delta.x(), -delta.y());
if (theta<0.0) theta += 2*osg::PI;
double phi = osg::PI_2 * delta.length() / screenRadius;
if (phi > osg::PI_2) phi = osg::PI_2;
double f = domeModel.distance * sin(phi);
double e = domeModel.distance * cos(phi) + sqrt( domeModel.sphere_radius*domeModel.sphere_radius - f*f);
double l = e * cos(phi);
double h = e * sin(phi);
double gamma = atan2(h, l-domeModel.distance);
osg::Vec2 texcoord(theta/(2.0*osg::PI), 1.0-gamma/osg::PI);
// osg::notify(osg::NOTICE)<<"cursor = "<<cursor<< " theta = "<<theta<< "phi="<<phi<<" gamma = "<<gamma<<" texcoord="<<texcoord<<std::endl;
if (domeModel.flip)
vertices->push_back(osg::Vec3(cursor.x(), top.y()-(cursor.y()-origin.y()),cursor.z()));
else
vertices->push_back(cursor);
colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
texcoords->push_back( domeModel.texcoord_flip ? osg::Vec2(texcoord.x(), 1.0f - texcoord.y()) : texcoord);
cursor += dx;
}
// osg::notify(osg::NOTICE)<<std::endl;
}
// pass the created vertex array to the points geometry object.
geometry->setVertexArray(vertices);
geometry->setColorArray(colors);
geometry->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
geometry->setTexCoordArray(0,texcoords);
for(i=0;i<noSteps-1;++i)
{
osg::DrawElementsUShort* elements = new osg::DrawElementsUShort(osg::PrimitiveSet::QUAD_STRIP);
for(j=0;j<noSteps;++j)
{
elements->push_back(j+(i+1)*noSteps);
elements->push_back(j+(i)*noSteps);
}
geometry->addPrimitiveSet(elements);
}
return geometry;
}
void setDomeCorrection(osgViewer::Viewer& viewer, osg::ArgumentParser& arguments)
{
// enforce single threading right now to avoid double buffering of RTT texture
viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded);
osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface();
if (!wsi)
{
osg::notify(osg::NOTICE)<<"Error, no WindowSystemInterface available, cannot create windows."<<std::endl;
return;
}
unsigned int screenNum = 0;
while (arguments.read("--screen",screenNum)) {}
unsigned int width, height;
wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(screenNum), width, height);
while (arguments.read("--width",width)) {}
while (arguments.read("--height",height)) {}
DomeModel domeModel(arguments);
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
traits->screenNum = screenNum;
traits->x = 0;
traits->y = 0;
traits->width = width;
traits->height = height;
traits->windowDecoration = false;
traits->doubleBuffer = true;
traits->sharedContext = 0;
osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get());
if (!gc)
{
osg::notify(osg::NOTICE)<<"GraphicsWindow has not been created successfully."<<std::endl;
return;
}
osg::Texture* texture = 0;
for(int i=1;i<arguments.argc() && !texture;++i)
{
if (arguments.isString(i))
{
osg::Image* image = osgDB::readImageFile(arguments[i]);
osg::ImageStream* imagestream = dynamic_cast<osg::ImageStream*>(image);
if (imagestream) imagestream->play();
if (image)
{
domeModel.texcoord_flip = image->getOrigin()==osg::Image::TOP_LEFT;
#if 1
texture = new osg::TextureRectangle(image);
#else
texture = new osg::Texture2D(image);
#endif
}
}
}
if (!texture)
{
return;
}
// distortion correction set up.
{
osg::Geode* geode = new osg::Geode();
geode->addDrawable( createDomeDistortionMesh(osg::Vec3(0.0f,0.0f,0.0f), osg::Vec3(width,0.0f,0.0f), osg::Vec3(0.0f,height,0.0f), domeModel) );
// new we need to add the texture to the mesh, we do so by creating a
// StateSet to contain the Texture StateAttribute.
osg::StateSet* stateset = geode->getOrCreateStateSet();
stateset->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON);
texture->setMaxAnisotropy(16.0f);
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
#if 1
osg::TexMat* texmat = new osg::TexMat;
texmat->setScaleByTextureRectangleSize(true);
stateset->setTextureAttributeAndModes(0, texmat, osg::StateAttribute::ON);
#endif
osg::ref_ptr<osg::Camera> camera = new osg::Camera;
camera->setGraphicsContext(gc.get());
camera->setClearMask(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT );
camera->setClearColor( osg::Vec4(0.1,0.1,1.0,1.0) );
camera->setViewport(new osg::Viewport(0, 0, width, height));
GLenum buffer = traits->doubleBuffer ? GL_BACK : GL_FRONT;
camera->setDrawBuffer(buffer);
camera->setReadBuffer(buffer);
camera->setReferenceFrame(osg::Camera::ABSOLUTE_RF);
camera->setAllowEventFocus(false);
//camera->setInheritanceMask(camera->getInheritanceMask() & ~osg::CullSettings::CLEAR_COLOR & ~osg::CullSettings::COMPUTE_NEAR_FAR_MODE);
//camera->setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);
camera->setProjectionMatrixAsOrtho2D(0,width,0,height);
camera->setViewMatrix(osg::Matrix::identity());
// add subgraph to render
// camera->addChild(geode);
camera->setName("DistortionCorrectionCamera");
viewer.addSlave(camera.get(), osg::Matrixd(), osg::Matrixd(), true);
viewer.setSceneData(geode);
}
viewer.getCamera()->setNearFarRatio(0.0001f);
}
int main(int argc, char** argv)
{
// use an ArgumentParser object to manage the program arguments.
@@ -639,13 +323,14 @@ int main(int argc, char** argv)
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
arguments.getApplicationUsage()->addCommandLineOption("--texture2D","Use Texture2D rather than TextureRectangle.");
arguments.getApplicationUsage()->addCommandLineOption("--shader","Use shaders to post process the video.");
arguments.getApplicationUsage()->addCommandLineOption("--dome","Use full dome distortion correction.");
arguments.getApplicationUsage()->addCommandLineOption("--interactive","Use camera manipulator to allow movement around movie.");
arguments.getApplicationUsage()->addCommandLineOption("--flip","Flip the movie so top becomes bottom.");
bool useTextureRectangle = true;
bool useShader = false;
// construct the viewer.
osgViewer::Viewer viewer;
osgViewer::Viewer viewer(arguments);
if (arguments.argc()<=1)
{
@@ -663,89 +348,89 @@ int main(int argc, char** argv)
return 1;
}
bool fullscreen = !arguments.read("--interactive");
bool flip = arguments.read("--flip");
osg::ref_ptr<osg::Geode> geode = new osg::Geode;
if (arguments.read("--dome") || arguments.read("--puffer") )
{
setDomeCorrection(viewer, arguments);
}
else
osg::StateSet* stateset = geode->getOrCreateStateSet();
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
if (useShader)
{
osg::ref_ptr<osg::Geode> geode = new osg::Geode;
osg::Vec3 pos(0.0f,0.0f,0.0f);
//useTextureRectangle = false;
osg::StateSet* stateset = geode->getOrCreateStateSet();
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
static const char *shaderSourceTextureRec = {
"uniform vec4 cutoff_color;\n"
"uniform samplerRect movie_texture;\n"
"void main(void)\n"
"{\n"
" vec4 texture_color = textureRect(movie_texture, gl_TexCoord[0]); \n"
" if (all(lessThanEqual(texture_color,cutoff_color))) discard; \n"
" gl_FragColor = texture_color;\n"
"}\n"
};
if (useShader)
static const char *shaderSourceTexture2D = {
"uniform vec4 cutoff_color;\n"
"uniform sampler2D movie_texture;\n"
"void main(void)\n"
"{\n"
" vec4 texture_color = texture2D(movie_texture, gl_TexCoord[0]); \n"
" if (all(lessThanEqual(texture_color,cutoff_color))) discard; \n"
" gl_FragColor = texture_color;\n"
"}\n"
};
osg::Program* program = new osg::Program;
program->addShader(new osg::Shader(osg::Shader::FRAGMENT,
useTextureRectangle ? shaderSourceTextureRec : shaderSourceTexture2D));
stateset->addUniform(new osg::Uniform("cutoff_color",osg::Vec4(0.1f,0.1f,0.1f,1.0f)));
stateset->addUniform(new osg::Uniform("movie_texture",0));
stateset->setAttribute(program);
}
osg::Vec3 pos(0.0f,0.0f,0.0f);
osg::Vec3 topleft = pos;
osg::Vec3 bottomright = pos;
bool xyPlane = fullscreen;
for(int i=1;i<arguments.argc();++i)
{
if (arguments.isString(i))
{
//useTextureRectangle = false;
osg::Image* image = osgDB::readImageFile(arguments[i]);
osg::ImageStream* imagestream = dynamic_cast<osg::ImageStream*>(image);
if (imagestream) imagestream->play();
static const char *shaderSourceTextureRec = {
"uniform vec4 cutoff_color;\n"
"uniform samplerRect movie_texture;\n"
"void main(void)\n"
"{\n"
" vec4 texture_color = textureRect(movie_texture, gl_TexCoord[0]); \n"
" if (all(lessThanEqual(texture_color,cutoff_color))) discard; \n"
" gl_FragColor = texture_color;\n"
"}\n"
};
static const char *shaderSourceTexture2D = {
"uniform vec4 cutoff_color;\n"
"uniform sampler2D movie_texture;\n"
"void main(void)\n"
"{\n"
" vec4 texture_color = texture2D(movie_texture, gl_TexCoord[0]); \n"
" if (all(lessThanEqual(texture_color,cutoff_color))) discard; \n"
" gl_FragColor = texture_color;\n"
"}\n"
};
osg::Program* program = new osg::Program;
program->addShader(new osg::Shader(osg::Shader::FRAGMENT,
useTextureRectangle ? shaderSourceTextureRec : shaderSourceTexture2D));
stateset->addUniform(new osg::Uniform("cutoff_color",osg::Vec4(0.1f,0.1f,0.1f,1.0f)));
stateset->addUniform(new osg::Uniform("movie_texture",0));
stateset->setAttribute(program);
}
for(int i=1;i<arguments.argc();++i)
{
if (arguments.isString(i))
if (image)
{
osg::Image* image = osgDB::readImageFile(arguments[i]);
osg::ImageStream* imagestream = dynamic_cast<osg::ImageStream*>(image);
if (imagestream) imagestream->play();
geode->addDrawable(myCreateTexturedQuadGeometry(pos,image->s(),image->t(),image, useTextureRectangle, xyPlane, flip));
bottomright = pos + osg::Vec3(static_cast<float>(image->s()),static_cast<float>(image->t()),0.0f);
if (image)
{
geode->addDrawable(myCreateTexturedQuadGeometry(pos,image->s(),image->t(),image, useTextureRectangle));
pos.z() += image->t()*1.5f;
}
else
{
std::cout<<"Unable to read file "<<arguments[i]<<std::endl;
}
pos.y() += image->t()*1.5f;
}
}
// set the scene to render
viewer.setSceneData(geode.get());
if (viewer.getSceneData()==0)
{
arguments.getApplicationUsage()->write(std::cout);
return 1;
else
{
std::cout<<"Unable to read file "<<arguments[i]<<std::endl;
}
}
}
// set the scene to render
viewer.setSceneData(geode.get());
if (viewer.getSceneData()==0)
{
arguments.getApplicationUsage()->write(std::cout);
return 1;
}
// pass the model to the MovieEventHandler so it can pick out ImageStream's to manipulate.
MovieEventHandler* meh = new MovieEventHandler();
@@ -762,10 +447,22 @@ int main(int argc, char** argv)
return 1;
}
if (fullscreen)
{
viewer.realize();
viewer.getCamera()->setViewMatrix(osg::Matrix::identity());
viewer.getCamera()->setProjectionMatrixAsOrtho2D(topleft.x(),bottomright.x(),topleft.y(),bottomright.y());
// create the windows and run the threads.
return viewer.run();
while(!viewer.done())
{
viewer.frame();
}
return 0;
}
else
{
// create the windows and run the threads.
return viewer.run();
}
}

View File

@@ -404,7 +404,7 @@ int main( int argc, char **argv )
arguments.getApplicationUsage()->addCommandLineOption("--texture-rectangle","Use osg::TextureRectangle for doing the render to texure to.");
// construct the viewer.
osgViewer::Viewer viewer;
osgViewer::Viewer viewer(arguments);
// if user request help write it out to cout.
if (arguments.read("-h") || arguments.read("--help"))

View File

@@ -258,20 +258,17 @@ osg::Node* createScene()
return scene;
}
class TestSupportOperation: public osg::Operation
class TestSupportOperation: public osg::GraphicsOperation
{
public:
TestSupportOperation():
osg::Operation("TestSupportOperation",false),
osg::GraphicsOperation("TestSupportOperation",false),
_supported(true),
_errorMessage() {}
virtual void operator () (osg::Object* object)
virtual void operator () (osg::GraphicsContext* gc)
{
osg::GraphicsContext* gc = dynamic_cast<osg::GraphicsContext*>(object);
if (!gc) return;
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
unsigned int contextID = gc->getState()->getContextID();

View File

@@ -39,6 +39,8 @@
#include <osgShadow/ShadowVolume>
#include <osgShadow/ShadowTexture>
#include <osgShadow/ShadowMap>
#include <osgShadow/SoftShadowMap>
#include <osgShadow/ParallelSplitShadowMap>
#include <osgDB/ReadFile>
#include <osgDB/WriteFile>
@@ -490,9 +492,22 @@ int main(int argc, char** argv)
arguments.getApplicationUsage()->addCommandLineOption("--noUpdate", "Disable the updating the of light source.");
arguments.getApplicationUsage()->addCommandLineOption("--base", "Add a base geometry to test shadows.");
arguments.getApplicationUsage()->addCommandLineOption("--sv", "Select ShadowVolume implementation.");
arguments.getApplicationUsage()->addCommandLineOption("--sm", "Select ShadowMap implementation.");
arguments.getApplicationUsage()->addCommandLineOption("--ssm", "Select SoftShadowMap implementation.");
arguments.getApplicationUsage()->addCommandLineOption("--sm", "Select ShadowMap implementation.");
// arguments.getApplicationUsage()->addCommandLineOption("--pssm", "Select ParallelSplitShadowMap implementation.");
arguments.getApplicationUsage()->addCommandLineOption("--pssm", "Select ParallelSplitShadowMap implementation.");//ADEGLI
arguments.getApplicationUsage()->addCommandLineOption("--mapcount", "ParallelSplitShadowMap texture count.");//ADEGLI
arguments.getApplicationUsage()->addCommandLineOption("--mapres", "ParallelSplitShadowMap texture resolution.");//ADEGLI
arguments.getApplicationUsage()->addCommandLineOption("--debug-color", "ParallelSplitShadowMap display debugging color (only the first 3 maps are color r=0,g=1,b=2.");//ADEGLI
arguments.getApplicationUsage()->addCommandLineOption("--minNearSplit", "ParallelSplitShadowMap shadow map near offset.");//ADEGLI
arguments.getApplicationUsage()->addCommandLineOption("--maxFarDist", "ParallelSplitShadowMap max far distance to shadow.");//ADEGLI
arguments.getApplicationUsage()->addCommandLineOption("--moveVCamFactor", "ParallelSplitShadowMap move the virtual frustum behind the real camera, (also back ground object can cast shadow).");//ADEGLI
arguments.getApplicationUsage()->addCommandLineOption("--NVidea", "ParallelSplitShadowMap set default PolygonOffset for NVidea.");//ADEGLI
arguments.getApplicationUsage()->addCommandLineOption("--PolyOffset-Factor", "ParallelSplitShadowMap set PolygonOffset factor.");//ADEGLI
arguments.getApplicationUsage()->addCommandLineOption("--PolyOffset-Unit", "ParallelSplitShadowMap set PolygonOffset unit.");//ADEGLI
arguments.getApplicationUsage()->addCommandLineOption("--CullFaceFront", "ParallelSplitShadowMap add a cull face: front.");//ADEGLI
arguments.getApplicationUsage()->addCommandLineOption("-1", "Use test model one.");
arguments.getApplicationUsage()->addCommandLineOption("-2", "Use test model two.");
arguments.getApplicationUsage()->addCommandLineOption("-3", "Use test model three.");
@@ -501,7 +516,7 @@ int main(int argc, char** argv)
// construct the viewer.
osgViewer::Viewer viewer;
osgViewer::Viewer viewer(arguments);
// if user request help write it out to cout.
if (arguments.read("-h") || arguments.read("--help"))
@@ -562,31 +577,8 @@ int main(int argc, char** argv)
// add stats
viewer.addEventHandler( new osgViewer::StatsHandler() );
osg::ref_ptr<osg::Node> model = osgDB::readNodeFiles(arguments);
if (model.valid())
{
model->setNodeMask(CastsShadowTraversalMask | ReceivesShadowTraversalMask);
}
else
{
model = createTestModel(arguments);
}
// get the bounds of the model.
osg::ComputeBoundsVisitor cbbv;
model->accept(cbbv);
osg::BoundingBox bb = cbbv.getBoundingBox();
osg::Vec4 lightpos;
if (postionalLight)
{
lightpos.set(bb.center().x(), bb.center().y(), bb.zMax() + bb.radius() ,1.0f);
}
else
{
lightpos.set(0.5f,0.25f,0.8f,0.0f);
}
// add the record camera path handler
viewer.addEventHandler(new osgViewer::RecordCameraPathHandler);
osg::ref_ptr<osgShadow::ShadowedScene> shadowedScene = new osgShadow::ShadowedScene;
@@ -612,18 +604,99 @@ int main(int argc, char** argv)
osg::ref_ptr<osgShadow::ShadowTexture> st = new osgShadow::ShadowTexture;
shadowedScene->setShadowTechnique(st.get());
}
#if 0
else if (arguments.read("--pssm"))
{
osg::ref_ptr<osgShadow::ParallelSplitShadowMap> pssm = new osgShadow::ParallelSplitShadowMap;
int mapcount = 3;
while (arguments.read("--mapcount", mapcount));
osg::ref_ptr<osgShadow::ParallelSplitShadowMap> pssm = new osgShadow::ParallelSplitShadowMap(NULL,mapcount);
int mapres = 1024;
while (arguments.read("--mapres", mapres))
pssm->setTextureResolution(mapres);
while (arguments.read("--debug-color")) { pssm->setDebugColorOn(); }
int minNearSplit=0;
while (arguments.read("--minNearSplit", minNearSplit))
if ( minNearSplit > 0 ) {
pssm->setMinNearDistanceForSplits(minNearSplit);
std::cout << "ParallelSplitShadowMap : setMinNearDistanceForSplits(" << minNearSplit <<")" << std::endl;
}
int maxfardist = 0;
while (arguments.read("--maxFarDist", maxfardist))
if ( maxfardist > 0 ) {
pssm->setMaxFarDistance(maxfardist);
std::cout << "ParallelSplitShadowMap : setMaxFarDistance(" << maxfardist<<")" << std::endl;
}
int moveVCamFactor = 0;
while (arguments.read("--moveVCamFactor", moveVCamFactor))
if ( maxfardist > 0 ) {
pssm->setMoveVCamBehindRCamFactor(moveVCamFactor);
std::cout << "ParallelSplitShadowMap : setMoveVCamBehindRCamFactor(" << moveVCamFactor<<")" << std::endl;
}
double polyoffsetfactor = -0.02;
double polyoffsetunit = 1.0;
while (arguments.read("--PolyOffset-Factor", polyoffsetfactor));
while (arguments.read("--PolyOffset-Unit", polyoffsetunit));
pssm->setPolygonOffset(osg::Vec2(polyoffsetfactor,polyoffsetunit)); //ATI Radeon
if (arguments.read("--NVidea")){
//pssm->setPolygonOffset(osg::Vec2(-0.02,1.0)); //ATI Radeon
pssm->setPolygonOffset(osg::Vec2(10.0f,20.0f)); //NVidea
}
if ( arguments.read("--CullFaceFront") ) {
pssm->forceFrontCullFace();
}
shadowedScene->setShadowTechnique(pssm.get());
}
#endif
else if (arguments.read("--ssm"))
{
osg::ref_ptr<osgShadow::SoftShadowMap> sm = new osgShadow::SoftShadowMap;
shadowedScene->setShadowTechnique(sm.get());
}
else /* if (arguments.read("--sm")) */
{
osg::ref_ptr<osgShadow::ShadowMap> sm = new osgShadow::ShadowMap;
shadowedScene->setShadowTechnique(sm.get());
int mapres = 1024;
while (arguments.read("--mapres", mapres))
sm->setTextureSize(osg::Vec2s(mapres,mapres));
}
osg::ref_ptr<osg::Node> model = osgDB::readNodeFiles(arguments);
if (model.valid())
{
model->setNodeMask(CastsShadowTraversalMask | ReceivesShadowTraversalMask);
}
else
{
model = createTestModel(arguments);
}
// get the bounds of the model.
osg::ComputeBoundsVisitor cbbv;
model->accept(cbbv);
osg::BoundingBox bb = cbbv.getBoundingBox();
osg::Vec4 lightpos;
if (postionalLight)
{
lightpos.set(bb.center().x(), bb.center().y(), bb.zMax() + bb.radius()*2.0f ,1.0f);
}
else
{
lightpos.set(0.5f,0.25f,0.8f,0.0f);
}
if ( arguments.read("--base"))
{
@@ -646,6 +719,22 @@ int main(int argc, char** argv)
osg::ref_ptr<osg::LightSource> ls = new osg::LightSource;
ls->getLight()->setPosition(lightpos);
bool spotlight = false;
if (arguments.read("--spotLight"))
{
spotlight = true;
osg::Vec3 center = bb.center();
osg::Vec3 lightdir = center - osg::Vec3(lightpos.x(), lightpos.y(), lightpos.z());
lightdir.normalize();
ls->getLight()->setDirection(lightdir);
ls->getLight()->setSpotCutoff(25.0f);
//set the LightSource, only for checking, there is only 1 light in the scene
dynamic_cast<osgShadow::ShadowMap*>(shadowedScene->getShadowTechnique())->setLight(ls.get());
}
if ( arguments.read("--coloured-light"))
{
ls->getLight()->setAmbient(osg::Vec4(1.0,0.0,0.0,1.0));
@@ -656,15 +745,34 @@ int main(int argc, char** argv)
ls->getLight()->setAmbient(osg::Vec4(0.2,0.2,0.2,1.0));
ls->getLight()->setDiffuse(osg::Vec4(0.8,0.8,0.8,1.0));
}
shadowedScene->addChild(model.get());
shadowedScene->addChild(ls.get());
viewer.setSceneData(shadowedScene.get());
// create the windows and run the threads.
viewer.realize();
// it is done after viewer.realize() so that the windows are already initialized
if ( arguments.read("--debugHUD"))
{
osgViewer::Viewer::Windows windows;
viewer.getWindows(windows);
if (windows.empty()) return 1;
osgShadow::ShadowMap* sm = dynamic_cast<osgShadow::ShadowMap*>(shadowedScene->getShadowTechnique());
osg::ref_ptr<osg::Camera> hudCamera = sm->makeDebugHUD();
// set up cameras to rendering on the first window available.
hudCamera->setGraphicsContext(windows[0]);
hudCamera->setViewport(0,0,windows[0]->getTraits()->width, windows[0]->getTraits()->height);
viewer.addSlave(hudCamera.get(), false);
}
// osgDB::writeNodeFile(*group,"test.osg");
while (!viewer.done())
@@ -674,13 +782,20 @@ int main(int argc, char** argv)
float t = viewer.getFrameStamp()->getSimulationTime();
if (postionalLight)
{
lightpos.set(bb.center().x()+sinf(t)*bb.radius(), bb.center().y() + cosf(t)*bb.radius(), bb.zMax() + bb.radius() ,1.0f);
lightpos.set(bb.center().x()+sinf(t)*bb.radius(), bb.center().y() + cosf(t)*bb.radius(), bb.zMax() + bb.radius()*3.0f ,1.0f);
}
else
{
lightpos.set(sinf(t),cosf(t),1.0f,0.0f);
}
ls->getLight()->setPosition(lightpos);
osg::Vec3f lightDir(-lightpos.x(),-lightpos.y(),-lightpos.z());
if(spotlight)
lightDir = osg::Vec3(bb.center().x()+sinf(t)*bb.radius()/2.0, bb.center().y() + cosf(t)*bb.radius()/2.0, bb.center().z())
- osg::Vec3(lightpos.x(), lightpos.y(), lightpos.z()) ;
lightDir.normalize();
ls->getLight()->setDirection(lightDir);
}
viewer.frame();

View File

@@ -1,8 +0,0 @@
#this file is automatically generated
SET(TARGET_SRC CreateShadowedScene.cpp osgshadowtexture.cpp )
SET(TARGET_H CreateShadowedScene.h )
SET(TARGET_ADDED_LIBRARIES osgShadow )
#### end var setup ###
SETUP_EXAMPLE(osgshadowtexture)

View File

@@ -1,224 +0,0 @@
/* OpenSceneGraph example, osgshadowtexture.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <osg/Texture2D>
#include <osg/Material>
#include <osg/LightSource>
#include <osg/Geode>
#include <osg/Geometry>
#include <osg/ShapeDrawable>
#include <osg/Camera>
#include <osg/TexGenNode>
#include <osg/Notify>
#include <osg/io_utils>
#include "CreateShadowedScene.h"
using namespace osg;
class UpdateCameraAndTexGenCallback : public osg::NodeCallback
{
public:
UpdateCameraAndTexGenCallback(const osg::Vec3& position, osg::Camera* Camera, osg::TexGenNode* texgenNode):
_position(position),
_Camera(Camera),
_texgenNode(texgenNode)
{
}
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
// first update subgraph to make sure objects are all moved into postion
traverse(node,nv);
// now compute the camera's view and projection matrix to point at the shadower (the camera's children)
osg::BoundingSphere bs;
for(unsigned int i=0; i<_Camera->getNumChildren(); ++i)
{
bs.expandBy(_Camera->getChild(i)->getBound());
}
if (!bs.valid())
{
osg::notify(osg::WARN) << "bb invalid"<<_Camera.get()<<std::endl;
return;
}
float centerDistance = (_position-bs.center()).length();
float znear = centerDistance-bs.radius();
float zfar = centerDistance+bs.radius();
float zNearRatio = 0.001f;
if (znear<zfar*zNearRatio) znear = zfar*zNearRatio;
float top = (bs.radius()/centerDistance)*znear;
float right = top;
_Camera->setReferenceFrame(osg::Camera::ABSOLUTE_RF);
_Camera->setProjectionMatrixAsFrustum(-right,right,-top,top,znear,zfar);
_Camera->setViewMatrixAsLookAt(_position,bs.center(),osg::Vec3(0.0f,1.0f,0.0f));
// compute the matrix which takes a vertex from local coords into tex coords
// will use this later to specify osg::TexGen..
osg::Matrix MVPT = _Camera->getViewMatrix() *
_Camera->getProjectionMatrix() *
osg::Matrix::translate(1.0,1.0,1.0) *
osg::Matrix::scale(0.5f,0.5f,0.5f);
_texgenNode->getTexGen()->setMode(osg::TexGen::EYE_LINEAR);
_texgenNode->getTexGen()->setPlanesFromMatrix(MVPT);
}
protected:
virtual ~UpdateCameraAndTexGenCallback() {}
osg::Vec3 _position;
osg::ref_ptr<osg::Camera> _Camera;
osg::ref_ptr<osg::TexGenNode> _texgenNode;
};
osg::Group* createShadowedScene(osg::Node* shadower,osg::Node* shadowed,const osg::Vec3& lightPosition,float radius,unsigned int unit)
{
osg::Group* group = new osg::Group;
// add light source
{
osg::LightSource* lightSource = new osg::LightSource;
lightSource->getLight()->setPosition(osg::Vec4(lightPosition,1.0f));
lightSource->getLight()->setLightNum(0);
group->addChild(lightSource);
osg::Geode* lightgeode = new osg::Geode;
lightgeode->getOrCreateStateSet()->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
lightgeode->addDrawable(new osg::ShapeDrawable(new osg::Sphere(lightPosition,radius)));
group->addChild(lightgeode);
}
osg::Vec4 ambientLightColor(0.2,0.2f,0.2f,1.0f);
// add the shadower and shadowed.
group->addChild(shadower);
group->addChild(shadowed);
unsigned int tex_width = 512;
unsigned int tex_height = 512;
osg::Texture2D* texture = new osg::Texture2D;
texture->setTextureSize(tex_width, tex_height);
texture->setInternalFormat(GL_RGB);
texture->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);
texture->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);
texture->setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::CLAMP_TO_BORDER);
texture->setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::CLAMP_TO_BORDER);
texture->setBorderColor(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
// set up the render to texture camera.
{
// create the camera
osg::Camera* camera = new osg::Camera;
camera->setClearColor(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
// set viewport
camera->setViewport(0,0,tex_width,tex_height);
// set the camera to render before the main camera.
camera->setRenderOrder(osg::Camera::PRE_RENDER);
// tell the camera to use OpenGL frame buffer object where supported.
camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
// attach the texture and use it as the color buffer.
camera->attach(osg::Camera::COLOR_BUFFER, texture);
// add subgraph to render
camera->addChild(shadower);
osg::StateSet* stateset = camera->getOrCreateStateSet();
// make the material black for a shadow.
osg::Material* material = new osg::Material;
material->setAmbient(osg::Material::FRONT_AND_BACK,osg::Vec4(0.0f,0.0f,0.0f,1.0f));
material->setDiffuse(osg::Material::FRONT_AND_BACK,osg::Vec4(0.0f,0.0f,0.0f,1.0f));
material->setEmission(osg::Material::FRONT_AND_BACK,ambientLightColor);
material->setShininess(osg::Material::FRONT_AND_BACK,0.0f);
stateset->setAttribute(material,osg::StateAttribute::OVERRIDE);
group->addChild(camera);
// create the texgen node to project the tex coords onto the subgraph
osg::TexGenNode* texgenNode = new osg::TexGenNode;
texgenNode->setTextureUnit(unit);
group->addChild(texgenNode);
// set an update callback to keep moving the camera and tex gen in the right direction.
group->setUpdateCallback(new UpdateCameraAndTexGenCallback(lightPosition, camera, texgenNode));
}
// set the shadowed subgraph so that it uses the texture and tex gen settings.
{
osg::StateSet* stateset = shadowed->getOrCreateStateSet();
stateset->setTextureAttributeAndModes(unit,texture,osg::StateAttribute::ON);
stateset->setTextureMode(unit,GL_TEXTURE_GEN_S,osg::StateAttribute::ON);
stateset->setTextureMode(unit,GL_TEXTURE_GEN_T,osg::StateAttribute::ON);
stateset->setTextureMode(unit,GL_TEXTURE_GEN_R,osg::StateAttribute::ON);
stateset->setTextureMode(unit,GL_TEXTURE_GEN_Q,osg::StateAttribute::ON);
}
// set hud to render shadow texture, just for interest
{
osg::Geode* geode = new osg::Geode;
osg::Geometry* geom = osg::createTexturedQuadGeometry(osg::Vec3(0,0,0),osg::Vec3(100.0,0.0,0.0),osg::Vec3(0.0,100.0,0.0));
geom->getOrCreateStateSet()->setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON);
geom->getOrCreateStateSet()->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
geode->addDrawable(geom);
osg::Camera* camera = new osg::Camera;
// set the projection matrix
camera->setProjectionMatrix(osg::Matrix::ortho2D(0,100,0,100));
// set the view matrix
camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
camera->setViewMatrix(osg::Matrix::identity());
camera->setViewport(50,50,100,100);
// only clear the depth buffer
camera->setClearMask(GL_DEPTH_BUFFER_BIT);
// draw subgraph after main camera view.
camera->setRenderOrder(osg::Camera::POST_RENDER);
camera->addChild(geode);
group->addChild(camera);
}
return group;
}

View File

@@ -1,32 +0,0 @@
/* -*-c++-*-
*
* OpenSceneGraph example, osgshadowtexture.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef CREATESHADOWEDSCENE_H
#define CREATESHADOWEDSCENE_H
#include <osg/Node>
#include <osg/Vec3>
// function to create a lightsource which contain a shadower and showed subgraph,
// the showadowed subgrph has a cull callback to fire off a pre render to texture
// of the shadowed subgraph.
extern osg::Group* createShadowedScene(osg::Node* shadower,osg::Node* shadowed,const osg::Vec3& lightPosition,float radius,unsigned int textureUnit=1);
#endif

View File

@@ -1,274 +0,0 @@
/* OpenSceneGraph example, osgshadowtexture.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <osg/Notify>
#include <osg/MatrixTransform>
#include <osg/ShapeDrawable>
#include <osg/PositionAttitudeTransform>
#include <osg/Geometry>
#include <osg/Texture2D>
#include <osg/Geode>
#include <osgUtil/Optimizer>
#include <osgDB/Registry>
#include <osgDB/ReadFile>
#include <osgViewer/Viewer>
#include <osgShadow/ShadowedScene>
#include <osgShadow/ShadowVolume>
#include <osgShadow/ShadowTexture>
#include <osgShadow/ShadowMap>
// include the call which creates the shadowed subgraph.
#include "CreateShadowedScene.h"
// for the grid data..
#include "../osghangglide/terrain_coords.h"
osg::AnimationPath* createAnimationPath(const osg::Vec3& center,float radius,double looptime)
{
// set up the animation path
osg::AnimationPath* animationPath = new osg::AnimationPath;
animationPath->setLoopMode(osg::AnimationPath::LOOP);
int numSamples = 40;
float yaw = 0.0f;
float yaw_delta = 2.0f*osg::PI/((float)numSamples-1.0f);
float roll = osg::inDegrees(30.0f);
double time=0.0f;
double time_delta = looptime/(double)numSamples;
for(int i=0;i<numSamples;++i)
{
osg::Vec3 position(center+osg::Vec3(sinf(yaw)*radius,cosf(yaw)*radius,0.0f));
osg::Quat rotation(osg::Quat(roll,osg::Vec3(0.0,1.0,0.0))*osg::Quat(-(yaw+osg::inDegrees(90.0f)),osg::Vec3(0.0,0.0,1.0)));
animationPath->insert(time,osg::AnimationPath::ControlPoint(position,rotation));
yaw += yaw_delta;
time += time_delta;
}
return animationPath;
}
osg::Node* createBase(const osg::Vec3& center,float radius)
{
osg::Geode* geode = new osg::Geode;
// set up the texture of the base.
osg::StateSet* stateset = new osg::StateSet();
osg::Image* image = osgDB::readImageFile("Images/lz.rgb");
if (image)
{
osg::Texture2D* texture = new osg::Texture2D;
texture->setImage(image);
stateset->setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON);
}
geode->setStateSet( stateset );
osg::HeightField* grid = new osg::HeightField;
grid->allocate(38,39);
grid->setOrigin(center+osg::Vec3(-radius,-radius,0.0f));
grid->setXInterval(radius*2.0f/(float)(38-1));
grid->setYInterval(radius*2.0f/(float)(39-1));
float minHeight = FLT_MAX;
float maxHeight = -FLT_MAX;
unsigned int r;
for(r=0;r<39;++r)
{
for(unsigned int c=0;c<38;++c)
{
float h = vertex[r+c*39][2];
if (h>maxHeight) maxHeight=h;
if (h<minHeight) minHeight=h;
}
}
float hieghtScale = radius*0.5f/(maxHeight-minHeight);
float hieghtOffset = -(minHeight+maxHeight)*0.5f;
for(r=0;r<39;++r)
{
for(unsigned int c=0;c<38;++c)
{
float h = vertex[r+c*39][2];
grid->setHeight(c,r,(h+hieghtOffset)*hieghtScale);
}
}
geode->addDrawable(new osg::ShapeDrawable(grid));
osg::Group* group = new osg::Group;
group->addChild(geode);
return group;
}
osg::Node* createMovingModel(const osg::Vec3& center, float radius)
{
float animationLength = 10.0f;
osg::AnimationPath* animationPath = createAnimationPath(center,radius,animationLength);
osg::Group* model = new osg::Group;
osg::Node* cessna = osgDB::readNodeFile("cessna.osg");
if (cessna)
{
const osg::BoundingSphere& bs = cessna->getBound();
float size = radius/bs.radius()*0.3f;
osg::MatrixTransform* positioned = new osg::MatrixTransform;
positioned->setDataVariance(osg::Object::STATIC);
positioned->setMatrix(osg::Matrix::translate(-bs.center())*
osg::Matrix::scale(size,size,size)*
osg::Matrix::rotate(osg::inDegrees(180.0f),0.0f,0.0f,2.0f));
positioned->addChild(cessna);
osg::MatrixTransform* xform = new osg::MatrixTransform;
xform->setUpdateCallback(new osg::AnimationPathCallback(animationPath,0.0f,2.0));
xform->addChild(positioned);
model->addChild(xform);
}
return model;
}
osg::Node* createModel(osg::ArgumentParser& arguments)
{
osg::Vec3 center(0.0f,0.0f,0.0f);
float radius = 100.0f;
osg::Vec3 lightPosition(center+osg::Vec3(0.0f,0.0f,radius));
// the shadower model
osg::Node* shadower = createMovingModel(center,radius*0.5f);
// the shadowed model
osg::Node* shadowed = createBase(center-osg::Vec3(0.0f,0.0f,radius*0.25),radius);
if (arguments.read("--sv"))
{
// hint to tell viewer to request stencil buffer when setting up windows
osg::DisplaySettings::instance()->setMinimumNumStencilBits(8);
osgShadow::ShadowedScene* shadowedScene = new osgShadow::ShadowedScene;
osg::ref_ptr<osgShadow::ShadowVolume> shadowVolume = new osgShadow::ShadowVolume;
shadowedScene->setShadowTechnique(shadowVolume.get());
shadowVolume->setDynamicShadowVolumes(true);
osg::ref_ptr<osg::LightSource> ls = new osg::LightSource;
ls->getLight()->setPosition(osg::Vec4(lightPosition,1.0));
shadowedScene->addChild(shadower);
shadowedScene->addChild(shadowed);
shadowedScene->addChild(ls.get());
return shadowedScene;
}
else if (arguments.read("--st"))
{
osgShadow::ShadowedScene* shadowedScene = new osgShadow::ShadowedScene;
osg::ref_ptr<osgShadow::ShadowTexture> shadowTexture = new osgShadow::ShadowTexture;
shadowedScene->setShadowTechnique(shadowTexture.get());
osg::ref_ptr<osg::LightSource> ls = new osg::LightSource;
ls->getLight()->setPosition(osg::Vec4(lightPosition,1.0));
shadowedScene->setReceivesShadowTraversalMask(0x1);
shadowed->setNodeMask(shadowedScene->getReceivesShadowTraversalMask());
shadowedScene->setCastsShadowTraversalMask(0x2);
shadower->setNodeMask(shadowedScene->getCastsShadowTraversalMask());
shadowedScene->addChild(shadower);
shadowedScene->addChild(shadowed);
shadowedScene->addChild(ls.get());
return shadowedScene;
}
else if (arguments.read("--sm"))
{
osgShadow::ShadowedScene* shadowedScene = new osgShadow::ShadowedScene;
osg::ref_ptr<osgShadow::ShadowMap> shadowMap = new osgShadow::ShadowMap;
shadowedScene->setShadowTechnique(shadowMap.get());
osg::ref_ptr<osg::LightSource> ls = new osg::LightSource;
ls->getLight()->setPosition(osg::Vec4(lightPosition,1.0));
shadowedScene->setReceivesShadowTraversalMask(0x1);
shadowed->setNodeMask(shadowedScene->getReceivesShadowTraversalMask());
shadowedScene->setCastsShadowTraversalMask(0x2);
shadower->setNodeMask(shadowedScene->getCastsShadowTraversalMask());
shadowedScene->addChild(shadower);
shadowedScene->addChild(shadowed);
shadowedScene->addChild(ls.get());
return shadowedScene;
}
else
{
// combine the models together to create one which has the shadower and the shadowed with the required callback.
osg::Group* root = createShadowedScene(shadower,shadowed,lightPosition,radius/100.0f,1);
return root;
}
}
int main(int argc, char ** argv)
{
osg::ArgumentParser arguments(&argc,argv);
// construct the viewer.
osgViewer::Viewer viewer;
// pass the model to the viewer.
viewer.setSceneData( createModel(arguments) );
viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded);
return viewer.run();
}

View File

@@ -658,7 +658,7 @@ int main(int argc, char **argv)
// construct the viewer.
osgViewer::Viewer viewer;
osgViewer::Viewer viewer(arguments);
// if user request help write it out to cout.
unsigned int testCase = 0;

View File

@@ -1,6 +1,6 @@
#this file is automatically generated
SET(TARGET_ADDED_LIBRARIES osgdb_ive osgdb_freetype )
SET(TARGET_ADDED_LIBRARIES osgdb_ive osgdb_freetype osgdb_OpenFlight osgdb_osg )
SET(TARGET_SRC osgstaticviewer.cpp )
#### end var setup ###

View File

@@ -39,6 +39,8 @@
// include the plugins we need
USE_OSGPLUGIN(ive);
USE_OSGPLUGIN(freetype);
USE_OSGPLUGIN(osg);
USE_OSGPLUGIN(OpenFlight);
// include the platform specific GraphicsWindow implementation.
USE_GRAPHICSWINDOW();

View File

@@ -32,6 +32,123 @@
typedef std::vector<std::string> FileList;
osg::Geode* createSectorForImage(osg::Image* image, osg::TexMat* texmat, float s,float t, float radius, float height, float length)
{
int numSegments = 20;
float Theta = length/radius;
float dTheta = Theta/(float)(numSegments-1);
float ThetaZero = height*s/(t*radius);
// set up the texture.
osg::Texture2D* texture = new osg::Texture2D;
texture->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);
texture->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);
texture->setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::CLAMP_TO_BORDER);
texture->setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::CLAMP_TO_BORDER);
texture->setResizeNonPowerOfTwoHint(false);
texture->setImage(image);
// set up the drawstate.
osg::StateSet* dstate = new osg::StateSet;
dstate->setMode(GL_CULL_FACE,osg::StateAttribute::OFF);
dstate->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
dstate->setTextureAttributeAndModes(0, texture,osg::StateAttribute::ON);
dstate->setTextureAttribute(0, texmat);
// set up the geoset.
osg::Geometry* geom = new osg::Geometry;
geom->setStateSet(dstate);
osg::Vec3Array* coords = new osg::Vec3Array();
osg::Vec2Array* tcoords = new osg::Vec2Array();
int i;
float angle = -Theta/2.0f;
for(i=0;
i<numSegments;
++i, angle+=dTheta)
{
coords->push_back(osg::Vec3(sinf(angle)*radius,cosf(angle)*radius,height*0.5f)); // top
coords->push_back(osg::Vec3(sinf(angle)*radius,cosf(angle)*radius,-height*0.5f)); // bottom.
tcoords->push_back(osg::Vec2(angle/ThetaZero+0.5f,1.0f)); // top
tcoords->push_back(osg::Vec2(angle/ThetaZero+0.5f,0.0f)); // bottom.
}
osg::Vec4Array* colors = new osg::Vec4Array();
colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
osg::DrawArrays* elements = new osg::DrawArrays(osg::PrimitiveSet::QUAD_STRIP,0,coords->size());
geom->setVertexArray(coords);
geom->setTexCoordArray(0,tcoords);
geom->setColorArray(colors);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->addPrimitiveSet(elements);
// set up the geode.
osg::Geode* geode = new osg::Geode;
geode->addDrawable(geom);
return geode;
}
osg::Group * loadImages(std::string image1, std::string image2, osg::TexMat* texmatLeft, osg::TexMat* texmatRight, float radius, float height, float length) {
osg::ref_ptr<osg::Image> imageLeft = osgDB::readImageFile(image1);
osg::ref_ptr<osg::Image> imageRight = osgDB::readImageFile(image2);
if (imageLeft.valid() && imageRight.valid())
{
float average_s = (imageLeft->s()+imageRight->s())*0.5f;
float average_t = (imageLeft->t()+imageRight->t())*0.5f;
osg::Geode* geodeLeft = createSectorForImage(imageLeft.get(),texmatLeft,average_s,average_t, radius, height, length);
geodeLeft->setNodeMask(0x01);
osg::Geode* geodeRight = createSectorForImage(imageRight.get(),texmatRight,average_s,average_t, radius, height, length);
geodeRight->setNodeMask(0x02);
osg::Group * imageGroup = new osg::Group;
imageGroup->addChild(geodeLeft);
imageGroup->addChild(geodeRight);
return imageGroup;
}
else
{
std::cout << "Warning: Unable to load both image files, '"<<image1<<"' & '"<<image2<<"', required for stereo imaging."<<std::endl;
return 0;
}
}
// create a switch containing a set of child each containing a
// stereo image pair.
osg::Switch* createScene(FileList fileList, osg::TexMat* texmatLeft, osg::TexMat* texmatRight, float radius, float height, float length)
{
osg::Switch* sw = new osg::Switch;
// load the images.
for(unsigned int i=0;i+1<fileList.size();i+=2)
{
osg::Group * imageGroup = loadImages(fileList[i],fileList[i+1],texmatLeft,texmatRight, radius, height, length);
if (imageGroup) sw->addChild(imageGroup);
}
if (sw->getNumChildren()>0)
{
// select first child.
sw->setSingleChildOn(0);
}
return sw;
}
class SlideEventHandler : public osgGA::GUIEventHandler
{
public:
@@ -43,6 +160,9 @@ public:
void set(osg::Switch* sw, float offsetX, float offsetY, osg::TexMat* texmatLeft, osg::TexMat* texmatRight, float timePerSlide, bool autoSteppingActive);
void set(FileList fileList, osg::Switch* sw, float offsetX, float offsetY, osg::TexMat* texmatLeft, osg::TexMat* texmatRight, float radius, float height, float length, float timePerSlide, bool autoSteppingActive);
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&);
virtual void getUsage(osg::ApplicationUsage& usage) const;
@@ -69,6 +189,9 @@ protected:
osg::ref_ptr<osg::Switch> _switch;
osg::ref_ptr<osg::TexMat> _texmatLeft;
osg::ref_ptr<osg::TexMat> _texmatRight;
float _radius;
float _height;
float _length;
bool _firstTraversal;
unsigned int _activeSlide;
double _previousTime;
@@ -78,6 +201,7 @@ protected:
float _currentSeperationX;
float _initSeperationY;
float _currentSeperationY;
FileList _fileList;
};
@@ -114,6 +238,35 @@ void SlideEventHandler::set(osg::Switch* sw, float offsetX, float offsetY, osg::
}
void SlideEventHandler::set(FileList fileList, osg::Switch* sw, float offsetX, float offsetY, osg::TexMat* texmatLeft, osg::TexMat* texmatRight, float radius, float height, float length, float timePerSlide, bool autoSteppingActive)
{
_switch = sw;
_switch->setUpdateCallback(this);
_fileList=FileList(fileList);
osg::ref_ptr<osg::Group> imageGroup = loadImages(fileList[0],fileList[1],texmatLeft,texmatRight, radius, height, length);
if (imageGroup.get())_switch->addChild(imageGroup.get());
_texmatLeft = texmatLeft;
_texmatRight = texmatRight;
_radius=radius;
_height=height;
_length=length;
_timePerSlide = timePerSlide;
_autoSteppingActive = autoSteppingActive;
_initSeperationX = offsetX;
_currentSeperationX = _initSeperationX;
_initSeperationY = offsetY;
_currentSeperationY = _initSeperationY;
initTexMatrices();
}
bool SlideEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&)
{
switch(ea.getEventType())
@@ -126,22 +279,22 @@ bool SlideEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAction
_previousTime = ea.getTime();
return true;
}
else if (ea.getKey()=='n')
else if ((ea.getKey()=='n') || (ea.getKey()==osgGA::GUIEventAdapter::KEY_Right))
{
nextSlide();
return true;
}
else if (ea.getKey()=='p')
else if ((ea.getKey()=='p') || (ea.getKey()==osgGA::GUIEventAdapter::KEY_Left))
{
previousSlide();
return true;
}
else if (ea.getKey()=='w')
else if ((ea.getKey()=='w') || (ea.getKey()==osgGA::GUIEventAdapter::KEY_KP_Add))
{
scaleImage(0.99f);
return true;
}
else if (ea.getKey()=='s')
else if ((ea.getKey()=='s') || (ea.getKey()==osgGA::GUIEventAdapter::KEY_KP_Subtract))
{
scaleImage(1.01f);
return true;
@@ -234,22 +387,38 @@ void SlideEventHandler::operator()(osg::Node* node, osg::NodeVisitor* nv)
void SlideEventHandler::nextSlide()
{
if (_switch->getNumChildren()==0) return;
++_activeSlide;
if (_activeSlide>=_switch->getNumChildren()) _activeSlide = 0;
_switch->setSingleChildOn(_activeSlide);
if (_fileList.size()>0) {
if (_activeSlide>= _fileList.size()/2 ) _activeSlide = 0;
osg::ref_ptr<osg::Group> images = loadImages(_fileList[2*_activeSlide],_fileList[2*_activeSlide+1],_texmatLeft.get(),_texmatRight.get(),_radius,_height,_length);
if (images.valid()) _switch->replaceChild(_switch->getChild(0),images.get());
} else {
if (_activeSlide>=_switch->getNumChildren()) _activeSlide = 0;
_switch->setSingleChildOn(_activeSlide);
}
}
void SlideEventHandler::previousSlide()
{
if (_switch->getNumChildren()==0) return;
if (_activeSlide==0) _activeSlide = _switch->getNumChildren()-1;
else --_activeSlide;
if (_fileList.size()>0) {
if (_activeSlide==0) _activeSlide = _fileList.size()/2-1;
else --_activeSlide;
osg::ref_ptr<osg::Group> images = loadImages(_fileList[2*_activeSlide],_fileList[2*_activeSlide+1],_texmatLeft.get(),_texmatRight.get(),_radius,_height,_length);
if (images.valid()) _switch->replaceChild(_switch->getChild(0),images.get());
} else {
if (_activeSlide==0) _activeSlide = _switch->getNumChildren()-1;
else --_activeSlide;
_switch->setSingleChildOn(_activeSlide);
_switch->setSingleChildOn(_activeSlide);
}
}
void SlideEventHandler::scaleImage(float s)
@@ -281,115 +450,6 @@ void SlideEventHandler::initTexMatrices()
}
osg::Geode* createSectorForImage(osg::Image* image, osg::TexMat* texmat, float s,float t, float radius, float height, float length)
{
int numSegments = 20;
float Theta = length/radius;
float dTheta = Theta/(float)(numSegments-1);
float ThetaZero = height*s/(t*radius);
// set up the texture.
osg::Texture2D* texture = new osg::Texture2D;
texture->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);
texture->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);
texture->setImage(image);
// set up the drawstate.
osg::StateSet* dstate = new osg::StateSet;
dstate->setMode(GL_CULL_FACE,osg::StateAttribute::OFF);
dstate->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
dstate->setTextureAttributeAndModes(0, texture,osg::StateAttribute::ON);
dstate->setTextureAttribute(0, texmat);
// set up the geoset.
osg::Geometry* geom = new osg::Geometry;
geom->setStateSet(dstate);
osg::Vec3Array* coords = new osg::Vec3Array();
osg::Vec2Array* tcoords = new osg::Vec2Array();
int i;
float angle = -Theta/2.0f;
for(i=0;
i<numSegments;
++i, angle+=dTheta)
{
coords->push_back(osg::Vec3(sinf(angle)*radius,cosf(angle)*radius,height*0.5f)); // top
coords->push_back(osg::Vec3(sinf(angle)*radius,cosf(angle)*radius,-height*0.5f)); // bottom.
tcoords->push_back(osg::Vec2(angle/ThetaZero+0.5f,1.0f)); // top
tcoords->push_back(osg::Vec2(angle/ThetaZero+0.5f,0.0f)); // bottom.
}
osg::Vec4Array* colors = new osg::Vec4Array();
colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
osg::DrawArrays* elements = new osg::DrawArrays(osg::PrimitiveSet::QUAD_STRIP,0,coords->size());
geom->setVertexArray(coords);
geom->setTexCoordArray(0,tcoords);
geom->setColorArray(colors);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->addPrimitiveSet(elements);
// set up the geode.
osg::Geode* geode = new osg::Geode;
geode->addDrawable(geom);
return geode;
}
// create a switch containing a set of child each containing a
// stereo image pair.
osg::Switch* createScene(const FileList& fileList, osg::TexMat* texmatLeft, osg::TexMat* texmatRight, float radius, float height, float length)
{
osg::Switch* sw = new osg::Switch;
// load the images.
for(unsigned int i=0;i+1<fileList.size();i+=2)
{
osg::ref_ptr<osg::Image> imageLeft = osgDB::readImageFile(fileList[i]);
osg::ref_ptr<osg::Image> imageRight = osgDB::readImageFile(fileList[i+1]);
if (imageLeft.valid() && imageRight.valid())
{
float average_s = (imageLeft->s()+imageRight->s())*0.5f;
float average_t = (imageLeft->t()+imageRight->t())*0.5f;
osg::Geode* geodeLeft = createSectorForImage(imageLeft.get(),texmatLeft,average_s,average_t, radius, height, length);
geodeLeft->setNodeMask(0x01);
osg::Geode* geodeRight = createSectorForImage(imageRight.get(),texmatRight,average_s,average_t, radius, height, length);
geodeRight->setNodeMask(0x02);
osg::ref_ptr<osg::Group> imageGroup = new osg::Group;
imageGroup->addChild(geodeLeft);
imageGroup->addChild(geodeRight);
sw->addChild(imageGroup.get());
}
else
{
std::cout << "Warning: Unable to load both image files, '"<<fileList[i]<<"' & '"<<fileList[i+1]<<"', required for stereo imaging."<<std::endl;
}
}
if (sw->getNumChildren()>0)
{
// select first child.
sw->setSingleChildOn(0);
}
return sw;
}
int main( int argc, char **argv )
{
@@ -403,6 +463,8 @@ int main( int argc, char **argv )
arguments.getApplicationUsage()->addCommandLineOption("-a","Enter auto advance of image pairs on start up.");
arguments.getApplicationUsage()->addCommandLineOption("-x <float>","Horizontal offset of left and right images.");
arguments.getApplicationUsage()->addCommandLineOption("-y <float>","Vertical offset of left and right images.");
arguments.getApplicationUsage()->addCommandLineOption("--disk","Keep images on disk");
arguments.getApplicationUsage()->addCommandLineOption("-files <filename>","Load filenames from a file");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
arguments.getApplicationUsage()->addCommandLineOption("--SingleThreaded","Select SingleThreaded threading model for viewer.");
arguments.getApplicationUsage()->addCommandLineOption("--CullDrawThreadPerContext","Select CullDrawThreadPerContext threading model for viewer.");
@@ -430,6 +492,22 @@ int main( int argc, char **argv )
float offsetY=0.0f;
while (arguments.read("-y",offsetY)) {}
bool onDisk=false;
while (arguments.read("--disk")) { onDisk=true;}
std::string filename="";
FileList fileList;
// extract the filenames from the a file, one filename per line.
while (arguments.read("-files",filename)) {
std::ifstream is(filename.c_str());
if (is) {
std::string line;
while (std::getline(is,line,'\n')) fileList.push_back(line);
is.close();
}
}
// if user request help write it out to cout.
if (arguments.read("-h") || arguments.read("--help"))
{
@@ -456,7 +534,6 @@ int main( int argc, char **argv )
}
// extract the filenames from the arguments list.
FileList fileList;
for(int pos=1;pos<arguments.argc();++pos)
{
if (arguments.isString(pos)) fileList.push_back(arguments[pos]);
@@ -487,8 +564,9 @@ int main( int argc, char **argv )
osg::TexMat* texmatRight = new osg::TexMat;
// creat the scene from the file list.
osg::ref_ptr<osg::Switch> rootNode = createScene(fileList,texmatLeft,texmatRight,radius,height,length);
osg::ref_ptr<osg::Switch> rootNode;
if (!onDisk) rootNode = createScene(fileList,texmatLeft,texmatRight,radius,height,length);
else rootNode=new osg::Switch();
//osgDB::writeNodeFile(*rootNode,"test.osg");
@@ -521,7 +599,8 @@ int main( int argc, char **argv )
viewer.setFusionDistance(osgUtil::SceneView::USE_FUSION_DISTANCE_VALUE,radius);
// set up the SlideEventHandler.
seh->set(rootNode.get(),offsetX,offsetY,texmatLeft,texmatRight,timeDelayBetweenSlides,autoSteppingActive);
if (onDisk) seh->set(fileList,rootNode.get(),offsetX,offsetY,texmatLeft,texmatRight,radius,height,length,timeDelayBetweenSlides,autoSteppingActive);
else seh->set(rootNode.get(),offsetX,offsetY,texmatLeft,texmatRight,timeDelayBetweenSlides,autoSteppingActive);
osg::Matrix homePosition;
homePosition.makeLookAt(osg::Vec3(0.0f,0.0f,0.0f),osg::Vec3(0.0f,1.0f,0.0f),osg::Vec3(0.0f,0.0f,1.0f));

View File

@@ -332,6 +332,22 @@ osg::Geode* createTeapot()
int main(int , char **)
{
#if 1
// create viewer on heap as a test, this looks to be causing problems
// on init on some platforms, and seg fault on exit when multi-threading on linux.
// Normal stack based version below works fine though...
// construct the viewer.
osg::ref_ptr<osgViewer::Viewer> viewer = new osgViewer::Viewer;
// add model to viewer.
viewer->setSceneData( createTeapot() );
return viewer->run();
#else
// construct the viewer.
osgViewer::Viewer viewer;
@@ -340,4 +356,6 @@ int main(int , char **)
// create the windows and run the threads.
return viewer.run();
#endif
}

View File

@@ -1,7 +1,8 @@
#this file is automatically generated
SET(TARGET_SRC osgterrain.cpp )
SET(TARGET_SRC osgterrain.cpp)
SET(TARGET_ADDED_LIBRARIES osgTerrain )
#### end var setup ###
SETUP_EXAMPLE(osgterrain)

View File

@@ -16,6 +16,8 @@
* THE SOFTWARE.
*/
#include <OpenThreads/Block>
#include <osg/Group>
#include <osg/Geode>
#include <osg/ShapeDrawable>
@@ -26,9 +28,12 @@
#include <osg/ClusterCullingCallback>
#include <osg/ArgumentParser>
#include <osgDB/FileUtils>
#include <osgDB/ReadFile>
#include <osgUtil/GLObjectsVisitor>
#include <osgText/FadeText>
#include <osgViewer/Viewer>
@@ -42,22 +47,539 @@
#include <osgGA/AnimationPathManipulator>
#include <osgGA/TerrainManipulator>
#include <osgTerrain/TerrainNode>
#include <osgTerrain/Terrain>
#include <osgTerrain/GeometryTechnique>
#include <osgTerrain/Layer>
#include <iostream>
typedef std::vector< osg::ref_ptr<osg::GraphicsThread> > GraphicsThreads;
class LoadAndCompileOperation : public osg::Operation
{
public:
LoadAndCompileOperation(const std::string& filename, GraphicsThreads& graphicsThreads, osg::RefBlockCount* block):
Operation("Load and compile Operation", false),
_filename(filename),
_graphicsThreads(graphicsThreads),
_block(block) {}
virtual void operator () (osg::Object* object)
{
// osg::notify(osg::NOTICE)<<"LoadAndCompileOperation "<<_filename<<std::endl;
_loadedModel = osgDB::readNodeFile(_filename);
if (_loadedModel.valid() && !_graphicsThreads.empty())
{
osg::ref_ptr<osgUtil::GLObjectsOperation> compileOperation = new osgUtil::GLObjectsOperation(_loadedModel.get());
for(GraphicsThreads::iterator gitr = _graphicsThreads.begin();
gitr != _graphicsThreads.end();
++gitr)
{
(*gitr)->add( compileOperation.get() );
// requiresBarrier = true;
}
}
if (_block.valid()) _block->completed();
// osg::notify(osg::NOTICE)<<"done LoadAndCompileOperation "<<_filename<<std::endl;
}
std::string _filename;
GraphicsThreads _graphicsThreads;
osg::ref_ptr<osg::Node> _loadedModel;
osg::ref_ptr<osg::RefBlockCount> _block;
};
class MasterOperation : public osg::Operation
{
public:
typedef std::set<std::string> Files;
typedef std::map<std::string, osg::ref_ptr<osg::Node> > FilenameNodeMap;
typedef std::vector< osg::ref_ptr<osg::Node> > Nodes;
MasterOperation(const std::string& filename):
Operation("Master reading operation",true),
_filename(filename)
{
}
/** Set the OperationQueue that the MasterOperation can use to place tasks like file loading on for other processes to handle.*/
void setOperationQueue(osg::OperationQueue* oq) { _operationQueue = oq; }
osg::OperationQueue* getOperationQueue() { return _operationQueue.get(); }
bool readMasterFile(Files& files) const
{
std::ifstream fin(_filename.c_str());
if (fin)
{
osgDB::Input fr;
fr.attach(&fin);
bool readFilename;
while(!fr.eof())
{
bool itrAdvanced = false;
if (fr.matchSequence("file %s") || fr.matchSequence("file %w") )
{
files.insert(fr[1].getStr());
fr += 2;
itrAdvanced = true;
readFilename = true;
}
if (!itrAdvanced)
{
++fr;
}
}
return readFilename;
}
return false;
}
bool open(osg::Group* group)
{
Files files;
readMasterFile(files);
for(Files::iterator itr = files.begin();
itr != files.end();
++itr)
{
osg::Node* model = osgDB::readNodeFile(*itr);
if (model)
{
osg::notify(osg::NOTICE)<<"open: Loaded file "<<*itr<<std::endl;
group->addChild(model);
_existingFilenameNodeMap[*itr] = model;
}
}
return true;
}
virtual void operator () (osg::Object* callingObject)
{
// decided which method to call according to whole has called me.
osgViewer::Viewer* viewer = dynamic_cast<osgViewer::Viewer*>(callingObject);
if (viewer) update(viewer->getSceneData());
else load();
}
void load()
{
//osg::notify(osg::NOTICE)<<"void load(Object)"<<std::endl;
Files filesA;
Files filesB;
readMasterFile(filesB);
// osg::notify(osg::NOTICE)<<"First read "<<filesA.size()<<std::endl;
// itererate until the master file is stable
do
{
OpenThreads::Thread::microSleep(100000);
filesB.swap(filesA);
filesB.clear();
readMasterFile(filesB);
// osg::notify(osg::NOTICE)<<"second read "<<filesB.size()<<std::endl;
} while (filesA!=filesB);
Files files;
files.swap(filesB);
// osg::notify(osg::NOTICE)<<"Now equal "<<files.size()<<std::endl;
Files newFiles;
Files removedFiles;
// find out which files are new, and which ones have been removed.
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
for(Files::iterator fitr = files.begin();
fitr != files.end();
++fitr)
{
if (_existingFilenameNodeMap.count(*fitr)==0) newFiles.insert(*fitr);
}
for(FilenameNodeMap::iterator litr = _existingFilenameNodeMap.begin();
litr != _existingFilenameNodeMap.end();
++litr)
{
if (files.count(litr->first)==0)
{
removedFiles.insert(litr->first);
}
}
}
#if 0
if (!newFiles.empty() || !removedFiles.empty())
{
osg::notify(osg::NOTICE)<<std::endl<<std::endl<<"void operator () files.size()="<<files.size()<<std::endl;
}
#endif
// first load the new files.
FilenameNodeMap nodesToAdd;
if (!newFiles.empty())
{
typedef std::vector< osg::ref_ptr<osg::GraphicsThread> > GraphicsThreads;
GraphicsThreads threads;
for(unsigned int i=0; i<= osg::GraphicsContext::getMaxContextID(); ++i)
{
osg::GraphicsContext* gc = osg::GraphicsContext::getCompileContext(i);
osg::GraphicsThread* gt = gc ? gc->getGraphicsThread() : 0;
if (gt) threads.push_back(gt);
}
bool requiresBarrier = false;
if (_operationQueue.valid())
{
// osg::notify(osg::NOTICE)<<"Using OperationQueue"<<std::endl;
_endOfLoadBlock = new osg::RefBlockCount(newFiles.size());
_endOfLoadBlock->reset();
typedef std::list< osg::ref_ptr<LoadAndCompileOperation> > LoadAndCompileList;
LoadAndCompileList loadAndCompileList;
for(Files::iterator nitr = newFiles.begin();
nitr != newFiles.end();
++nitr)
{
// osg::notify(osg::NOTICE)<<"Adding LoadAndCompileOperation "<<*nitr<<std::endl;
osg::ref_ptr<LoadAndCompileOperation> loadAndCompile = new LoadAndCompileOperation( *nitr, threads, _endOfLoadBlock.get() );
loadAndCompileList.push_back(loadAndCompile);
_operationQueue->add( loadAndCompile.get() );
}
#if 1
osg::ref_ptr<osg::Operation> operation;
while ((operation=_operationQueue->getNextOperation()).valid())
{
// osg::notify(osg::NOTICE)<<"Local running of operation"<<std::endl;
(*operation)(0);
}
#endif
// osg::notify(osg::NOTICE)<<"Waiting for completion of LoadAndCompile operations"<<std::endl;
_endOfLoadBlock->block();
// osg::notify(osg::NOTICE)<<"done ... Waiting for completion of LoadAndCompile operations"<<std::endl;
for(LoadAndCompileList::iterator litr = loadAndCompileList.begin();
litr != loadAndCompileList.end();
++litr)
{
if ((*litr)->_loadedModel.valid())
{
nodesToAdd[(*litr)->_filename] = (*litr)->_loadedModel;
requiresBarrier = true;
}
}
}
else
{
for(Files::iterator nitr = newFiles.begin();
nitr != newFiles.end();
++nitr)
{
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFile(*nitr);
if (loadedModel.get())
{
nodesToAdd[*nitr] = loadedModel;
osg::ref_ptr<osgUtil::GLObjectsOperation> compileOperation = new osgUtil::GLObjectsOperation(loadedModel.get());
for(GraphicsThreads::iterator gitr = threads.begin();
gitr != threads.end();
++gitr)
{
(*gitr)->add( compileOperation.get() );
requiresBarrier = true;
}
}
}
}
if (requiresBarrier)
{
_endOfCompilebarrier = new osg::BarrierOperation(threads.size()+1);
_endOfCompilebarrier->setKeep(false);
for(GraphicsThreads::iterator gitr = threads.begin();
gitr != threads.end();
++gitr)
{
(*gitr)->add(_endOfCompilebarrier.get());
}
// osg::notify(osg::NOTICE)<<"Waiting for Compile to complete"<<std::endl;
// wait for the graphics threads to complete.
_endOfCompilebarrier->block();
// osg::notify(osg::NOTICE)<<"done ... Waiting for Compile to complete"<<std::endl;
}
}
bool requiresBlock = false;
// pass the locally peppared data to MasterOperations shared data
// so that updated thread can merge these changes with the main scene
// graph. This merge is carried out via the update(..) method.
if (!removedFiles.empty() || !nodesToAdd.empty())
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
_nodesToRemove.swap(removedFiles);
_nodesToAdd.swap(nodesToAdd);
requiresBlock = true;
}
// now block so we don't try to load anything till the new data has been merged
// otherwise _existingFilenameNodeMap will get out of sync.
if (requiresBlock)
{
_updatesMergedBlock.block();
}
else
{
OpenThreads::Thread::YieldCurrentThread();
}
}
// merge the changes with the main scene graph.
void update(osg::Node* scene)
{
// osg::notify(osg::NOTICE)<<"void update(Node*)"<<std::endl;
osg::Group* group = dynamic_cast<osg::Group*>(scene);
if (!group)
{
osg::notify(osg::NOTICE)<<"Error, MasterOperation::update(Node*) can only work with a Group as Viewer::getSceneData()."<<std::endl;
return;
}
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
if (!_nodesToRemove.empty() || !_nodesToAdd.empty())
{
osg::notify(osg::NOTICE)<<"update().................. "<<std::endl;
}
if (!_nodesToRemove.empty())
{
for(Files::iterator itr = _nodesToRemove.begin();
itr != _nodesToRemove.end();
++itr)
{
FilenameNodeMap::iterator fnmItr = _existingFilenameNodeMap.find(*itr);
if (fnmItr != _existingFilenameNodeMap.end())
{
osg::notify(osg::NOTICE)<<" update():removing "<<*itr<<std::endl;
group->removeChild(fnmItr->second.get());
_existingFilenameNodeMap.erase(fnmItr);
}
}
_nodesToRemove.clear();
}
if (!_nodesToAdd.empty())
{
for(FilenameNodeMap::iterator itr = _nodesToAdd.begin();
itr != _nodesToAdd.end();
++itr)
{
osg::notify(osg::NOTICE)<<" update():inserting "<<itr->first<<std::endl;
group->addChild(itr->second.get());
_existingFilenameNodeMap[itr->first] = itr->second;
}
_nodesToAdd.clear();
}
_updatesMergedBlock.release();
}
// add release implementation so that any thread cancellation can
// work even when blocks and barriers are used.
virtual void release()
{
if (_operationQueue.valid()) _operationQueue->removeAllOperations();
_updatesMergedBlock.release();
if (_endOfCompilebarrier.valid()) _endOfCompilebarrier.release();
if (_endOfLoadBlock.valid()) _endOfLoadBlock.release();
}
std::string _filename;
OpenThreads::Mutex _mutex;
FilenameNodeMap _existingFilenameNodeMap;
Files _nodesToRemove;
FilenameNodeMap _nodesToAdd;
OpenThreads::Block _updatesMergedBlock;
osg::ref_ptr<osg::BarrierOperation> _endOfCompilebarrier;
osg::ref_ptr<osg::RefBlockCount> _endOfLoadBlock;
osg::ref_ptr<osg::OperationQueue> _operationQueue;
};
class FilterHandler : public osgGA::GUIEventHandler
{
public:
FilterHandler(osgTerrain::GeometryTechnique* gt):
_gt(gt) {}
bool handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa)
{
if (!_gt) return false;
switch(ea.getEventType())
{
case(osgGA::GUIEventAdapter::KEYDOWN):
{
if (ea.getKey() == 'g')
{
osg::notify(osg::NOTICE)<<"Gaussian"<<std::endl;
_gt->setFilterMatrixAs(osgTerrain::GeometryTechnique::GAUSSIAN);
return true;
}
else if (ea.getKey() == 's')
{
osg::notify(osg::NOTICE)<<"Smooth"<<std::endl;
_gt->setFilterMatrixAs(osgTerrain::GeometryTechnique::SMOOTH);
return true;
}
else if (ea.getKey() == 'S')
{
osg::notify(osg::NOTICE)<<"Sharpen"<<std::endl;
_gt->setFilterMatrixAs(osgTerrain::GeometryTechnique::SHARPEN);
return true;
}
else if (ea.getKey() == '+')
{
_gt->setFilterWidth(_gt->getFilterWidth()*1.1);
osg::notify(osg::NOTICE)<<"Filter width = "<<_gt->getFilterWidth()<<std::endl;
return true;
}
else if (ea.getKey() == '-')
{
_gt->setFilterWidth(_gt->getFilterWidth()/1.1);
osg::notify(osg::NOTICE)<<"Filter width = "<<_gt->getFilterWidth()<<std::endl;
return true;
}
else if (ea.getKey() == '>')
{
_gt->setFilterBias(_gt->getFilterBias()+0.1);
osg::notify(osg::NOTICE)<<"Filter bias = "<<_gt->getFilterBias()<<std::endl;
return true;
}
else if (ea.getKey() == '<')
{
_gt->setFilterBias(_gt->getFilterBias()-0.1);
osg::notify(osg::NOTICE)<<"Filter bias = "<<_gt->getFilterBias()<<std::endl;
return true;
}
break;
}
default:
break;
}
return false;
}
protected:
osg::observer_ptr<osgTerrain::GeometryTechnique> _gt;
};
class LayerHandler : public osgGA::GUIEventHandler
{
public:
LayerHandler(osgTerrain::Layer* layer):
_layer(layer) {}
bool handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa)
{
if (!_layer) return false;
float scale = 1.2;
switch(ea.getEventType())
{
case(osgGA::GUIEventAdapter::KEYDOWN):
{
if (ea.getKey() == 'q')
{
_layer->transform(0.0, scale);
return true;
}
else if (ea.getKey() == 'a')
{
_layer->transform(0.0, 1.0f/scale);
return true;
}
break;
}
default:
break;
}
return false;
}
protected:
osg::observer_ptr<osgTerrain::Layer> _layer;
};
int main(int argc, char** argv)
{
osg::ArgumentParser arguments(&argc, argv);
// construct the viewer.
osgViewer::Viewer viewer;
osgViewer::Viewer viewer(arguments);
// set up the camera manipulators.
{
@@ -92,14 +614,33 @@ int main(int argc, char** argv)
// add the stats handler
viewer.addEventHandler(new osgViewer::StatsHandler);
// add the record camera path handler
viewer.addEventHandler(new osgViewer::RecordCameraPathHandler);
double x = 0.0;
double y = 0.0;
double w = 1.0;
double h = 1.0;
osg::ref_ptr<osgTerrain::TerrainNode> terrain = new osgTerrain::TerrainNode;
osg::ref_ptr<osgTerrain::Locator> locator = new osgTerrain::EllipsoidLocator(-osg::PI, -osg::PI*0.5, 2.0*osg::PI, osg::PI, 0.0);
unsigned int numLoadThreads = 1;
while (arguments.read("--load-threads",numLoadThreads)) { }
osg::ref_ptr<MasterOperation> masterOperation;
std::string masterFilename;
while(arguments.read("-m",masterFilename))
{
masterOperation = new MasterOperation(masterFilename);
}
osg::ref_ptr<osgTerrain::Terrain> terrain = new osgTerrain::Terrain;
osg::ref_ptr<osgTerrain::Locator> locator = new osgTerrain::Locator;
osg::ref_ptr<osgTerrain::ValidDataOperator> validDataOperator = new osgTerrain::NoDataValue(0.0);
osg::ref_ptr<osgTerrain::Layer> lastAppliedLayer;
locator->setCoordinateSystemType(osgTerrain::Locator::GEOCENTRIC);
locator->setTransformAsExtents(-osg::PI, -osg::PI*0.5, osg::PI, osg::PI*0.5);
unsigned int layerNum = 0;
@@ -130,7 +671,8 @@ int main(int argc, char** argv)
else if (arguments.read(pos, "-e",x,y,w,h))
{
// define the extents.
locator = new osgTerrain::EllipsoidLocator(x,y,w,h,0);
locator->setCoordinateSystemType(osgTerrain::Locator::GEOCENTRIC);
locator->setTransformAsExtents(x,y,x+w,y+h);
readParameter = true;
}
@@ -140,11 +682,11 @@ int main(int argc, char** argv)
readParameter = true;
}
else if (arguments.read(pos, "--cartizian",x,y,w,h))
else if (arguments.read(pos, "--cartesian",x,y,w,h))
{
// define the extents.
locator = new osgTerrain::CartizianLocator(x,y,w,h,0);
readParameter = true;
locator->setCoordinateSystemType(osgTerrain::Locator::PROJECTED);
locator->setTransformAsExtents(x,y,x+w,y+h);
}
else if (arguments.read(pos, "--hf",filename))
@@ -169,6 +711,8 @@ int main(int argc, char** argv)
terrain->setElevationLayer(hfl.get());
lastAppliedLayer = hfl.get();
osg::notify(osg::NOTICE)<<"created osgTerrain::HeightFieldLayer"<<std::endl;
}
else
@@ -201,6 +745,8 @@ int main(int argc, char** argv)
terrain->setElevationLayer(imageLayer.get());
lastAppliedLayer = imageLayer.get();
osg::notify(osg::NOTICE)<<"created Elevation osgTerrain::ImageLayer"<<std::endl;
}
else
@@ -232,7 +778,9 @@ int main(int argc, char** argv)
}
terrain->setColorLayer(layerNum, imageLayer.get());
lastAppliedLayer = imageLayer.get();
osg::notify(osg::NOTICE)<<"created Color osgTerrain::ImageLayer"<<std::endl;
}
else
@@ -252,12 +800,12 @@ int main(int argc, char** argv)
if (filterName=="NEAREST")
{
osg::notify(osg::NOTICE)<<"--filter "<<filterName<<std::endl;
terrain->setColorFilter(layerNum, osgTerrain::TerrainNode::NEAREST);
terrain->setColorFilter(layerNum, osgTerrain::Terrain::NEAREST);
}
else if (filterName=="LINEAER")
else if (filterName=="LINEAR")
{
osg::notify(osg::NOTICE)<<"--filter "<<filterName<<std::endl;
terrain->setColorFilter(layerNum, osgTerrain::TerrainNode::LINEAR);
terrain->setColorFilter(layerNum, osgTerrain::Terrain::LINEAR);
}
else
{
@@ -294,16 +842,75 @@ int main(int argc, char** argv)
}
osg::ref_ptr<osgTerrain::GeometryTechnique> geometryTechnique = new osgTerrain::GeometryTechnique;
terrain->setTerrainTechnique(geometryTechnique.get());
if (!terrain) return 0;
// return 0;
osg::ref_ptr<osg::Group> scene = new osg::Group;
// add a viewport to the viewer and attach the scene graph.
viewer.setSceneData(terrain.get());
if (terrain.valid() && (terrain->getElevationLayer() || terrain->getColorLayer(0)))
{
osg::notify(osg::NOTICE)<<"Terrain created"<<std::endl;
scene->addChild(terrain.get());
osg::ref_ptr<osgTerrain::GeometryTechnique> geometryTechnique = new osgTerrain::GeometryTechnique;
terrain->setTerrainTechnique(geometryTechnique.get());
viewer.addEventHandler(new FilterHandler(geometryTechnique.get()));
viewer.addEventHandler(new LayerHandler(lastAppliedLayer.get()));
}
if (masterOperation.valid())
{
osg::notify(osg::NOTICE)<<"Master operation created"<<std::endl;
masterOperation->open(scene.get());
}
if (scene->getNumChildren()==0)
{
osg::notify(osg::NOTICE)<<"No model created, please specify terrain or master file on command line."<<std::endl;
return 0;
}
viewer.setSceneData(scene.get());
// start operation thread if a master file has been used.
osg::ref_ptr<osg::OperationThread> masterOperationThread;
typedef std::list< osg::ref_ptr<osg::OperationThread> > OperationThreadList;
OperationThreadList generalThreadList;
if (masterOperation.valid())
{
masterOperationThread = new osg::OperationThread;
masterOperationThread->startThread();
masterOperationThread->add(masterOperation.get());
// if (numLoadThreads>0)
{
osg::ref_ptr<osg::OperationQueue> operationQueue = new osg::OperationQueue;
masterOperation->setOperationQueue(operationQueue.get());
for(unsigned int i=0; i<numLoadThreads; ++i)
{
osg::ref_ptr<osg::OperationThread> thread = new osg::OperationThread;
thread->setOperationQueue(operationQueue.get());
thread->startThread();
generalThreadList.push_back(thread);
}
}
viewer.addUpdateOperation(masterOperation.get());
}
viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded);
// enable the use of compile contexts and associated threads.
osg::DisplaySettings::instance()->setCompileContextsHint(true);
// realize the graphics windows.
viewer.realize();
// run the viewers main loop
return viewer.run();
}

View File

@@ -23,11 +23,14 @@
#include <osgDB/Registry>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osg/Geode>
#include <osg/Camera>
#include <osg/ShapeDrawable>
#include <osg/Sequence>
#include <osg/PolygonMode>
#include <osg/io_utils>
#include <osgText/Font>
#include <osgText/Text>
@@ -474,13 +477,182 @@ osg::Group* create3DText(const osg::Vec3& center,float radius)
return rootNode;
}
int main(int , char **)
class UpdateTextOperation : public osg::Operation
{
// construct the viewer.
osgViewer::Viewer viewer;
public:
// prepare scene.
UpdateTextOperation(osg::Group* group):
Operation("UpdateTextOperation", true),
_maxNumChildren(200),
_maxNumTextPerGeode(10),
_group(group)
{
}
virtual void operator () (osg::Object* callingObject)
{
// decided which method to call according to whole has called me.
osgViewer::Viewer* viewer = dynamic_cast<osgViewer::Viewer*>(callingObject);
if (viewer) update();
else load();
}
void update()
{
// osg::notify(osg::NOTICE)<<"*** Doing update"<<std::endl;
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
if (_mergeSubgraph.valid())
{
_group->addChild(_mergeSubgraph.get());
_mergeSubgraph = 0;
if (_group->getNumChildren()>_maxNumChildren)
{
osg::Geode* geode = dynamic_cast<osg::Geode*>(_group->getChild(0));
if (geode)
{
_availableSubgraph.push_back(geode);
geode->removeDrawables(0,geode->getNumDrawables());
}
_group->removeChild(0,1);
}
_waitOnMergeBlock.release();
}
}
void load()
{
// osg::notify(osg::NOTICE)<<"Doing load"<<std::endl;
osg::ref_ptr<osg::Geode> geode;
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
if (!_availableSubgraph.empty())
{
geode = _availableSubgraph.front();
_availableSubgraph.pop_front();
}
}
if (!geode) geode = new osg::Geode;
for(unsigned int i=0; i<_maxNumTextPerGeode; ++i)
{
osg::Vec3 position(float(rand()) / float(RAND_MAX), float(rand()) / float(RAND_MAX), float(i)/float(_maxNumTextPerGeode));
std::string str;
unsigned int _numCharacters = 5;
for(unsigned int ni=0; ni<_numCharacters;++ni)
{
str.push_back(char(32.0 + (float(rand())/float(RAND_MAX))*128.0f));
}
osgText::Text* text = new osgText::Text;
text->setDataVariance(osg::Object::DYNAMIC);
text->setPosition(position);
text->setFont("times.ttf");
text->setText(str);
text->setCharacterSize(0.025f);
text->setAxisAlignment(osgText::Text::SCREEN);
geode->addDrawable(text);
}
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
_mergeSubgraph = geode;
}
// osg::notify(osg::NOTICE)<<"Waiting on merge"<<std::endl;
_waitOnMergeBlock.block();
}
virtual void release()
{
_waitOnMergeBlock.release();
}
typedef std::list< osg::ref_ptr<osg::Geode> > AvailableList;
unsigned int _maxNumChildren;
unsigned int _maxNumTextPerGeode;
OpenThreads::Mutex _mutex;
osg::ref_ptr<osg::Group> _group;
osg::ref_ptr<osg::Geode> _mergeSubgraph;
AvailableList _availableSubgraph;
OpenThreads::Block _waitOnMergeBlock;
unsigned int _counter;
};
int main(int argc, char** argv)
{
osg::ArgumentParser arguments(&argc, argv);
// construct the viewer.
osgViewer::Viewer viewer(arguments);
typedef std::list< osg::ref_ptr<osg::OperationThread> > Threads;
Threads operationThreads;
osg::ref_ptr<UpdateTextOperation> updateOperation;
unsigned int numThreads = 0;
if (arguments.read("--mt", numThreads) || arguments.read("--mt"))
{
// construct a multi-threaded text updating test.
if (numThreads==0) numThreads = 1;
// create a group to add everything into.
osg::Group* mainGroup = new osg::Group;
for(unsigned int i=0; i<numThreads; ++i)
{
osg::Group* textGroup = new osg::Group;
mainGroup->addChild(textGroup);
// create the background thread
osg::OperationThread* operationThread = new osg::OperationThread;
operationThreads.push_back(operationThread);
// create the operation that will run in the background and
// sync once per frame with the main viewer loop.
updateOperation = new UpdateTextOperation(textGroup);
// add the operation to the operation thread and start it.
operationThread->add(updateOperation.get());
operationThread->startThread();
// add the operation to the viewer to sync once per frame.
viewer.addUpdateOperation(updateOperation.get());
// add a unit cube for the text to appear within.
osg::Geode* geode = new osg::Geode;
geode->getOrCreateStateSet()->setAttribute(new osg::PolygonMode(osg::PolygonMode::FRONT_AND_BACK,osg::PolygonMode::LINE));
geode->addDrawable(new osg::ShapeDrawable(new osg::Box(osg::Vec3(0.5f,0.5f,0.5f),1.0)));
mainGroup->addChild(geode);
}
viewer.setSceneData(mainGroup);
}
else
{
// prepare scene.
osg::Vec3 center(0.0f,0.0f,0.0f);
float radius = 1.0f;
@@ -506,8 +678,22 @@ int main(int , char **)
viewer.setSceneData(group);
}
#if 0
osgDB::writeNodeFile(*viewer.getSceneData(),"text.osg");
#endif
return viewer.run();
viewer.addEventHandler(new osgViewer::StatsHandler());
viewer.run();
if (!operationThreads.empty())
{
for(Threads::iterator itr = operationThreads.begin();
itr != operationThreads.end();
++itr)
{
(*itr)->cancel();
}
}
}

View File

@@ -24,6 +24,8 @@
#include <osg/Timer>
#include <osg/io_utils>
#include <OpenThreads/Thread>
#include "UnitTestFramework.h"
#include "performance.h"
@@ -275,14 +277,20 @@ void testGetQuatFromMatrix(const osg::Vec3d& scale)
osg::Quat out_quat2;
out_quat2 = out_mat.getRotate();
// If the quaternion W is <0, then we should reflect
// to get it into the positive W
if(out_quat1.w()<0) out_quat1 = out_quat1 * -1.0;
if(out_quat2.w()<0) out_quat2 = out_quat2 * -1.0;
// if the output quat length is not one
// or if the component magnitudes do not match,
// or if the components do not match,
// something is amiss
if (fabs(1.0-out_quat2.length()) > eps ||
(fabs(out_quat1.x())-fabs(out_quat2.x())) > eps ||
(fabs(out_quat1.y())-fabs(out_quat2.y())) > eps ||
(fabs(out_quat1.z())-fabs(out_quat2.z())) > eps ||
(fabs(out_quat1.w())-fabs(out_quat2.w())) > eps) {
(fabs(out_quat1.x()-out_quat2.x())) > eps ||
(fabs(out_quat1.y()-out_quat2.y())) > eps ||
(fabs(out_quat1.z()-out_quat2.z())) > eps ||
(fabs(out_quat1.w()-out_quat2.w())) > eps) {
std::cout << __FUNCTION__ << " problem at: \n"
<< " r1=" << rol1
<< " p1=" << pit1
@@ -375,6 +383,26 @@ void testQuat(const osg::Vec3d& quat_scale)
osg::notify(osg::NOTICE)<<"Matrix = "<<matrix<<"rotation = "<<quat<<", expected quat = (0,0,0,1)"<<std::endl;
}
class MyThread : public OpenThreads::Thread {
public:
void run(void) { }
};
void testThreadInitAndExit()
{
std::cout<<"****** Running thread start and delete test ****** "<<std::endl;
{
MyThread thread;
thread.startThread();
}
// add a sleep to allow the thread start to fall over it its going to.
OpenThreads::Thread::microSleep(500000);
std::cout<<"pass thread start and delete test"<<std::endl<<std::endl;
}
int main( int argc, char** argv )
{
@@ -408,7 +436,10 @@ int main( int argc, char** argv )
while (arguments.read("sizeof")) printSizeOfTest = true;
bool printQuatTest = false;
while (arguments.read("quat")) printQuatTest = true;
while (arguments.read("quat")) printQuatTest = true;
bool doTestThreadInitAndExit = false;
while (arguments.read("thread")) doTestThreadInitAndExit = true;
osg::Vec3d quat_scale(1.0,1.0,1.0);
while (arguments.read("quat_scaled", quat_scale.x(), quat_scale.y(), quat_scale.z() )) printQuatTest = true;
@@ -495,6 +526,11 @@ int main( int argc, char** argv )
std::cout<<std::endl;
}
if (doTestThreadInitAndExit)
{
testThreadInitAndExit();
}
std::cout<<"****** Running tests ******"<<std::endl;
// Global Data or Context

View File

@@ -102,6 +102,7 @@ class ViewerFLTK : public osgViewer::Viewer, public AdapterWidget
AdapterWidget(x,y,w,h,label)
{
getCamera()->setViewport(new osg::Viewport(0,0,w,h));
getCamera()->setProjectionMatrixAsPerspective(30.0f, static_cast<double>(w)/static_cast<double>(h), 1.0f, 10000.0f);
getCamera()->setGraphicsContext(getGraphicsWindow());
setThreadingModel(osgViewer::Viewer::SingleThreaded);
}

View File

@@ -0,0 +1,9 @@
SET(TARGET_SRC FOX_OSG.cpp FOX_OSG_MDIView.cpp osgviewerFOX.cpp )
SET(TARGET_H FOX_OSG.h FOX_OSG_MDIView.h osgviewerFOX.h)
INCLUDE_DIRECTORIES( ${FOX_INCLUDE_DIR} )
SET(TARGET_EXTERNAL_LIBRARIES ${FOX_LIBRARY} )
#### end var setup ###
SETUP_EXAMPLE(osgviewerFOX)

View File

@@ -0,0 +1,193 @@
#include <iostream>
#include "FOX_OSG.h"
// Map
FXDEFMAP(GraphicsWindowFOX) GraphicsWindowFOX_Map[] = {
//________Message_Type_________ ___ID___ ________Message_Handler________
FXMAPFUNC(SEL_CONFIGURE, 0, GraphicsWindowFOX::onConfigure),
FXMAPFUNC(SEL_KEYPRESS, 0, GraphicsWindowFOX::onKeyPress),
FXMAPFUNC(SEL_KEYRELEASE, 0, GraphicsWindowFOX::onKeyRelease),
FXMAPFUNC(SEL_LEFTBUTTONPRESS, 0, GraphicsWindowFOX::onLeftBtnPress),
FXMAPFUNC(SEL_LEFTBUTTONRELEASE, 0, GraphicsWindowFOX::onLeftBtnRelease),
FXMAPFUNC(SEL_MIDDLEBUTTONPRESS, 0, GraphicsWindowFOX::onMiddleBtnPress),
FXMAPFUNC(SEL_MIDDLEBUTTONRELEASE, 0, GraphicsWindowFOX::onMiddleBtnRelease),
FXMAPFUNC(SEL_RIGHTBUTTONPRESS, 0, GraphicsWindowFOX::onRightBtnPress),
FXMAPFUNC(SEL_RIGHTBUTTONRELEASE, 0, GraphicsWindowFOX::onRightBtnRelease),
FXMAPFUNC(SEL_MOTION, 0, GraphicsWindowFOX::onMotion)
};
FXIMPLEMENT(GraphicsWindowFOX, FXGLCanvas, GraphicsWindowFOX_Map, ARRAYNUMBER(GraphicsWindowFOX_Map))
GraphicsWindowFOX::GraphicsWindowFOX(FXComposite *parent, FXGLVisual *vis,
FXObject *tgt, FXSelector sel,
FXuint opts, FXint x, FXint y,
FXint w, FXint h)
: FXGLCanvas(parent, vis, tgt, sel, opts, x, y, w, h)
{
// default cursor to standard
_oldCursor = new FXCursor(parent->getApp(),CURSOR_CROSS);
_traits = new GraphicsContext::Traits;
_traits->x = x;
_traits->y = y;
_traits->width = w;
_traits->height = h;
_traits->windowDecoration = false;
_traits->doubleBuffer = true;
_traits->sharedContext = 0;
init();
}
void GraphicsWindowFOX::init()
{
if (valid())
{
setState( new osg::State );
getState()->setGraphicsContext(this);
if (_traits.valid() && _traits->sharedContext)
{
getState()->setContextID( _traits->sharedContext->getState()->getContextID() );
incrementContextIDUsageCount( getState()->getContextID() );
}
else
{
getState()->setContextID( osg::GraphicsContext::createNewContextID() );
}
}
}
GraphicsWindowFOX::~GraphicsWindowFOX()
{
}
void GraphicsWindowFOX::grabFocus()
{
// focus this window
setFocus();
}
void GraphicsWindowFOX::grabFocusIfPointerInWindow()
{
// do nothing
}
void GraphicsWindowFOX::useCursor(bool cursorOn)
{
if (cursorOn) {
// show the old cursor
setDefaultCursor(_oldCursor);
}
else {
setDefaultCursor(NULL);
}
}
bool GraphicsWindowFOX::makeCurrentImplementation()
{
FXGLCanvas::makeCurrent();
return true;
}
bool GraphicsWindowFOX::releaseContext()
{
FXGLCanvas::makeNonCurrent();
return true;
}
void GraphicsWindowFOX::swapBuffersImplementation()
{
FXGLCanvas::swapBuffers();
}
long GraphicsWindowFOX::onConfigure(FXObject *sender, FXSelector sel, void* ptr)
{
// set GL viewport (not called by FXGLCanvas::onConfigure on all platforms...)
// update the window dimensions, in case the window has been resized.
getEventQueue()->windowResize(0, 0, getWidth(), getHeight());
resized(0, 0, getWidth(), getHeight());
return FXGLCanvas::onConfigure(sender, sel, ptr);
}
long GraphicsWindowFOX::onKeyPress(FXObject *sender, FXSelector sel, void* ptr)
{
int key = ((FXEvent*)ptr)->code;
getEventQueue()->keyPress(key);
return FXGLCanvas::onKeyPress(sender, sel, ptr);
}
long GraphicsWindowFOX::onKeyRelease(FXObject *sender, FXSelector sel, void* ptr)
{
int key = ((FXEvent*)ptr)->code;
getEventQueue()->keyRelease(key);
return FXGLCanvas::onKeyRelease(sender, sel, ptr);
}
long GraphicsWindowFOX::onLeftBtnPress(FXObject *sender, FXSelector sel, void* ptr)
{
handle(this,FXSEL(SEL_FOCUS_SELF,0),ptr);
FXEvent* event=(FXEvent*)ptr;
getEventQueue()->mouseButtonPress(event->click_x, event->click_y, 1);
return FXGLCanvas::onLeftBtnPress(sender, sel, ptr);
}
long GraphicsWindowFOX::onLeftBtnRelease(FXObject *sender, FXSelector sel, void* ptr)
{
FXEvent* event=(FXEvent*)ptr;
getEventQueue()->mouseButtonRelease(event->click_x, event->click_y, 1);
return FXGLCanvas::onLeftBtnRelease(sender, sel, ptr);
}
long GraphicsWindowFOX::onMiddleBtnPress(FXObject *sender, FXSelector sel, void* ptr)
{
handle(this,FXSEL(SEL_FOCUS_SELF,0),ptr);
FXEvent* event=(FXEvent*)ptr;
getEventQueue()->mouseButtonPress(event->click_x, event->click_y, 2);
return FXGLCanvas::onMiddleBtnPress(sender, sel, ptr);
}
long GraphicsWindowFOX::onMiddleBtnRelease(FXObject *sender, FXSelector sel, void* ptr)
{
FXEvent* event=(FXEvent*)ptr;
getEventQueue()->mouseButtonRelease(event->click_x, event->click_y, 2);
return FXGLCanvas::onMiddleBtnRelease(sender, sel, ptr);
}
long GraphicsWindowFOX::onRightBtnPress(FXObject *sender, FXSelector sel, void* ptr)
{
handle(this,FXSEL(SEL_FOCUS_SELF,0),ptr);
FXEvent* event=(FXEvent*)ptr;
getEventQueue()->mouseButtonPress(event->click_x, event->click_y, 3);
return FXGLCanvas::onRightBtnPress(sender, sel, ptr);
}
long GraphicsWindowFOX::onRightBtnRelease(FXObject *sender, FXSelector sel, void* ptr)
{
FXEvent* event=(FXEvent*)ptr;
getEventQueue()->mouseButtonRelease(event->click_x, event->click_y, 3);
return FXGLCanvas::onRightBtnRelease(sender, sel, ptr);
}
long GraphicsWindowFOX::onMotion(FXObject *sender, FXSelector sel, void* ptr)
{
FXEvent* event=(FXEvent*)ptr;
getEventQueue()->mouseMotion(event->win_x, event->win_y);
return FXGLCanvas::onMotion(sender, sel, ptr);
}

View File

@@ -0,0 +1,63 @@
#ifndef _FOXOSG_H_
#define _FOXOSG_H_
#include <osgViewer/Viewer>
#include <string>
#include <fx.h>
#include <fx3d.h>
using namespace FX;
class GraphicsWindowFOX: public FXGLCanvas, public osgViewer::GraphicsWindow{
FXDECLARE(GraphicsWindowFOX)
public:
GraphicsWindowFOX(FXComposite *parent, FXGLVisual *vis,
FXObject *tgt=NULL, FXSelector sel=0,
FXuint opts=0, FXint x=0, FXint y=0,
FXint w=0, FXint h=0);
virtual ~GraphicsWindowFOX();
// callback
long onConfigure(FXObject*, FXSelector, void*);
long onKeyPress(FXObject*, FXSelector, void*);
long onKeyRelease(FXObject*, FXSelector, void*);
long onLeftBtnPress(FXObject*, FXSelector, void*);
long onLeftBtnRelease(FXObject*, FXSelector, void*);
long onMiddleBtnPress(FXObject*, FXSelector, void*);
long onMiddleBtnRelease(FXObject*, FXSelector, void*);
long onRightBtnPress(FXObject*, FXSelector, void*);
long onRightBtnRelease(FXObject*, FXSelector, void*);
long onMotion(FXObject*, FXSelector, void*);
void init();
//
// GraphicsWindow interface
//
void grabFocus();
void grabFocusIfPointerInWindow();
void useCursor(bool cursorOn);
bool makeCurrentImplementation();
bool releaseContext();
void swapBuffersImplementation();
// note implemented yet...just use dummy implementation to get working.
virtual bool valid() const { return true; }
virtual bool realizeImplementation() { return true; }
virtual bool isRealizedImplementation() const { return true; }
virtual void closeImplementation() {}
virtual bool releaseContextImplementation() { return true; }
protected:
GraphicsWindowFOX(){};
private:
FXCursor* _oldCursor;
};
#endif // _FOXOSG_H_

View File

@@ -0,0 +1,77 @@
#include "FOX_OSG_MDIView.h"
#include <osgViewer/ViewerEventHandlers>
#include <osgGA/TrackballManipulator>
#include <osgDB/ReadFile>
// Map
FXDEFMAP(FOX_OSG_MDIView) FOX_OSG_MDIView_Map[] = {
//________Message_Type_________ ___ID___ ________Message_Handler________
FXMAPFUNC(SEL_CHORE, FOX_OSG_MDIView::ID_CHORE, FOX_OSG_MDIView::OnIdle)
};
FXIMPLEMENT(FOX_OSG_MDIView, FXMDIChild, FOX_OSG_MDIView_Map, ARRAYNUMBER(FOX_OSG_MDIView_Map))
FOX_OSG_MDIView::FOX_OSG_MDIView(FXMDIClient *p, const FXString &name,
FXIcon *ic, FXPopup *pup, FXuint opt,
FXint x, FXint y, FXint w, FXint h)
: FXMDIChild(p, name, ic, pup, opt, x, y, w, h)
{
// A visual to drag OpenGL in double-buffered mode; note the glvisual is
// shared between all windows which need the same depths and numbers of buffers
// Thus, while the first visual may take some time to initialize, each subsequent
// window can be created very quickly; we need to determine grpaphics hardware
// characteristics only once.
FXGLVisual* glVisual=new FXGLVisual(getApp(),VISUAL_DOUBLEBUFFER|VISUAL_STEREO);
m_gwFox = new GraphicsWindowFOX(this, glVisual, NULL, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y, x, y, w, h );
osgViewer::Viewer *viewer = new osgViewer::Viewer;
viewer->getCamera()->setGraphicsContext(m_gwFox);
viewer->getCamera()->setViewport(0,0,w,h);
viewer->setThreadingModel(osgViewer::Viewer::SingleThreaded);
// FOX example does not catch the close of the graphics window, so
// don't allow the default escape sets to done to be active.
viewer->setKeyEventSetsDone(0);
// load the scene.
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFile("cow.osg");
if (!loadedModel)
{
return ;
}
// add the stats handler
viewer->addEventHandler(new osgViewer::StatsHandler);
viewer->setSceneData(loadedModel.get());
viewer->setCameraManipulator(new osgGA::TrackballManipulator);
SetViewer(viewer);
getApp()->addChore(this,ID_CHORE);
}
FOX_OSG_MDIView::~FOX_OSG_MDIView()
{
getApp()->removeChore(this,ID_CHORE);
}
long FOX_OSG_MDIView::OnIdle(FXObject *sender, FXSelector sel, void* ptr)
{
m_osgViewer->frame();
getApp()->addChore(this, ID_CHORE);
return 1;
}
void FOX_OSG_MDIView::SetViewer(osgViewer::Viewer* viewer)
{
m_osgViewer = viewer;
}

View File

@@ -0,0 +1,41 @@
#ifndef _FOXOSGMDIVIEW_H_
#define _FOXOSGMDIVIEW_H_
#include "FOX_OSG.h"
#include <fx.h>
#include <osgViewer/Viewer>
using namespace FX;
class FOX_OSG_MDIView : public FXMDIChild{
FXDECLARE(FOX_OSG_MDIView)
public:
FOX_OSG_MDIView(FXMDIClient *p, const FXString &name,
FXIcon *ic=NULL, FXPopup *pup=NULL, FXuint opts=0,
FXint x=0, FXint y=0, FXint w=0, FXint h=0);
virtual ~FOX_OSG_MDIView();
enum{
ID_CHORE=FXMDIChild::ID_LAST,
ID_LAST
};
// callback
long OnIdle(FXObject* , FXSelector, void*);
void SetViewer(osgViewer::Viewer *viewer);
protected:
FOX_OSG_MDIView(){};
private:
osg::ref_ptr<osgViewer::Viewer> m_osgViewer;
GraphicsWindowFOX* m_gwFox;
};
#endif // _FOXOSGMDIVIEW_H_

View File

@@ -0,0 +1,75 @@
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "osgviewerFOX.h"
#include "FOX_OSG_MDIView.h"
/* My frame constructor */
MainFrame::MainFrame(FXApp *app, const FXString &name, FXIcon *ic, FXIcon *mi, FXuint opts, FXint x, FXint y, FXint w, FXint h, FXint pl, FXint pr, FXint pt, FXint pb, FXint hs, FXint vs) : FXMainWindow(app, name, ic, mi, opts, x, y, w, h, pl, pr, pt, pb, hs, vs)
{
// Site where to dock
FXDockSite* topdock=new FXDockSite(this,DOCKSITE_NO_WRAP|LAYOUT_SIDE_TOP|LAYOUT_FILL_X);
// Menubar 1
m_fxToolbarShell1=new FXToolBarShell(this,FRAME_RAISED);
FXMenuBar* menubar=new FXMenuBar(topdock,m_fxToolbarShell1,LAYOUT_DOCK_SAME|LAYOUT_SIDE_TOP|LAYOUT_FILL_X|FRAME_RAISED);
new FXToolBarGrip(menubar,menubar,FXMenuBar::ID_TOOLBARGRIP,TOOLBARGRIP_DOUBLE);
// Contents
FXHorizontalFrame *frame=new FXHorizontalFrame(this,LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0,0,0,0, 0,0,0,0, 4,4);
// Nice sunken box around GL viewer
FXVerticalFrame *box=new FXVerticalFrame(frame,FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_FILL_Y,0,0,0,0, 0,0,0,0);
// MDI Client
FXMDIClient* mdiclient=new FXMDIClient(box,LAYOUT_FILL_X|LAYOUT_FILL_Y);
// Make MDI Window Menu
FXMDIMenu* mdimenu=new FXMDIMenu(this,mdiclient);
// MDI buttons in menu:- note the message ID's!!!!!
// Normally, MDI commands are simply sensitized or desensitized;
// Under the menubar, however, they're hidden if the MDI Client is
// not maximized. To do this, they must have different ID's.
new FXMDIWindowButton(menubar,mdimenu,mdiclient,FXMDIClient::ID_MDI_MENUWINDOW,LAYOUT_LEFT|LAYOUT_CENTER_Y);
new FXMDIDeleteButton(menubar,mdiclient,FXMDIClient::ID_MDI_MENUCLOSE,FRAME_RAISED|LAYOUT_RIGHT|LAYOUT_CENTER_Y);
new FXMDIRestoreButton(menubar,mdiclient,FXMDIClient::ID_MDI_MENURESTORE,FRAME_RAISED|LAYOUT_RIGHT|LAYOUT_CENTER_Y);
new FXMDIMinimizeButton(menubar,mdiclient,FXMDIClient::ID_MDI_MENUMINIMIZE,FRAME_RAISED|LAYOUT_RIGHT|LAYOUT_CENTER_Y);
// Make an MDI Child
FOX_OSG_MDIView* mdichild=new FOX_OSG_MDIView(mdiclient,"FOX osgViewer", NULL, mdimenu,MDI_TRACKING|MDI_MAXIMIZED,30,30,300,200);
mdichild->setFocus();
// Make it active
mdiclient->setActiveChild(mdichild);
}
// Create and initialize
void MainFrame::create(){
FXMainWindow::create();
m_fxToolbarShell1->create();
show(PLACEMENT_SCREEN);
}
int main(int argc, char** argv){
// Make application
FXApp application("OSGViewer","FoxTest");
// Open the display
application.init(argc,argv);
// Make window
new MainFrame(&application, "Fox Toolkit OSG Sample", NULL, NULL, DECOR_ALL, 100, 100, 800, 600);
// Create the application's windows
application.create();
// Run the application
return application.run();
}

View File

@@ -0,0 +1,32 @@
#ifndef _FOXSIMPLEVIEWERFOX_H_
#define _FOXSIMPLEVIEWERFOX_H_
#include <fx.h>
using namespace FX;
class MainFrame : public FXMainWindow{
public:
MainFrame(FXApp *a, const FXString &name,
FXIcon *ic=NULL, FXIcon *mi=NULL,
FXuint opts=DECOR_ALL,
FXint x=0, FXint y=0,
FXint w=0, FXint h=0,
FXint pl=0, FXint pr=0, FXint pt=0, FXint pb=0,
FXint hs=0, FXint vs=0);
// Initialize
virtual void create();
protected:
MainFrame(){};
private:
// GUI elements
FXToolBarShell* m_fxToolbarShell1;
};
#endif // _FOXSIMPLEVIEWERFOX_H_

View File

@@ -5,49 +5,17 @@
cOSG::cOSG(HWND hWnd) :
m_hWnd(hWnd), mDone(false)
m_hWnd(hWnd)
{
//
// We must set the pixelformat before we can create the OSG Rendering Surface
//
PIXELFORMATDESCRIPTOR pixelFormat =
{
sizeof(PIXELFORMATDESCRIPTOR),
1,
PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER,
PFD_TYPE_RGBA,
24,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0,
24,
0,
0,
PFD_MAIN_PLANE,
0,
0, 0, 0
};
}
HDC hdc = ::GetDC(m_hWnd);
if (hdc==0)
{
::DestroyWindow(m_hWnd);
return;
}
cOSG::~cOSG()
{
mViewer->setDone(true);
Sleep(1000);
mViewer->stopThreading();
int pixelFormatIndex = ::ChoosePixelFormat(hdc, &pixelFormat);
if (pixelFormatIndex==0)
{
::ReleaseDC(m_hWnd, hdc);
::DestroyWindow(m_hWnd);
return;
}
if (!::SetPixelFormat(hdc, pixelFormatIndex, &pixelFormat))
{
::ReleaseDC(m_hWnd, hdc);
::DestroyWindow(m_hWnd);
return;
}
delete mViewer;
}
void cOSG::InitOSG(std::string modelname)
@@ -100,7 +68,7 @@ void cOSG::InitCameraConfig(void)
RECT rect;
// Create the viewer for this window
mViewer = new osgViewer::Viewer;
mViewer = new osgViewer::Viewer();
// Add a Stats Handler to the viewer
mViewer->addEventHandler(new osgViewer::StatsHandler);
@@ -122,6 +90,7 @@ void cOSG::InitCameraConfig(void)
traits->windowDecoration = false;
traits->doubleBuffer = true;
traits->sharedContext = 0;
traits->setInheritedWindowPixelFormat = true;
traits->inheritedWindowData = windata;
// Create the Graphics Context
@@ -183,6 +152,5 @@ void cOSG::Render(void* ptr)
// and you exit one then all stop rendering
AfxMessageBox("Exit Rendering Thread");
// Set Done to indicate that thread has exited
osg->Done(true);
_endthread();
}

View File

@@ -15,7 +15,7 @@ class cOSG
{
public:
cOSG(HWND hWnd);
~cOSG(){};
~cOSG();
void InitOSG(std::string filename);
void InitManipulators(void);
@@ -29,13 +29,13 @@ public:
bool Done(void) { return mDone; }
static void Render(void* ptr);
osgViewer::Viewer* getViewer() { return mViewer.get(); }
osgViewer::Viewer* getViewer() { return mViewer; }
private:
bool mDone;
std::string m_ModelName;
HWND m_hWnd;
osg::ref_ptr<osgViewer::Viewer> mViewer;
osgViewer::Viewer* mViewer;
osg::ref_ptr<osg::Group> mRoot;
osg::ref_ptr<osg::Node> mModel;
osg::ref_ptr<osgGA::TrackballManipulator> trackball;

View File

@@ -17,6 +17,7 @@ BEGIN_MESSAGE_MAP(CMFC_OSG_MDIView, CView)
ON_WM_CREATE()
ON_WM_DESTROY()
ON_WM_KEYDOWN()
ON_WM_ERASEBKGND()
END_MESSAGE_MAP()
CMFC_OSG_MDIView::CMFC_OSG_MDIView() :
@@ -74,21 +75,10 @@ int CMFC_OSG_MDIView::OnCreate(LPCREATESTRUCT lpCreateStruct)
void CMFC_OSG_MDIView::OnDestroy()
{
// Make sure OSG was created before we try to close it.
if(mOSG)
{
// Wait while the Viewer closes
while(!mOSG->Done())
{
Sleep(10); // Allow others processor time
}
// Remove mOSG
delete mOSG;
}
if(mOSG != 0) delete mOSG;
WaitForSingleObject(mThreadHandle, 1000);
// Destroy Window
CView::OnDestroy();
}
@@ -103,7 +93,7 @@ void CMFC_OSG_MDIView::OnInitialUpdate()
mOSG->InitOSG(csFileName.GetString());
// Start the thread to do OSG Rendering
_beginthread(&cOSG::Render, 0, mOSG);
mThreadHandle = (HANDLE)_beginthread(&cOSG::Render, 0, mOSG);
}
void CMFC_OSG_MDIView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
@@ -118,3 +108,9 @@ void CMFC_OSG_MDIView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
}
}
BOOL CMFC_OSG_MDIView::OnEraseBkgnd(CDC* pDC)
{
/* Do nothing, to avoid flashing on MSW */
return true;
}

View File

@@ -34,6 +34,7 @@ public:
protected:
cOSG* mOSG;
HANDLE mThreadHandle;
// Generated message map functions
protected:
@@ -42,6 +43,7 @@ protected:
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnDestroy();
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
};
#ifndef _DEBUG // debug version in MFC_OSG_MDIView.cpp

View File

@@ -146,7 +146,9 @@ class ViewerQT : public osgViewer::Viewer, public AdapterWidget
AdapterWidget( parent, name, shareWidget, f )
{
getCamera()->setViewport(new osg::Viewport(0,0,width(),height()));
getCamera()->setProjectionMatrixAsPerspective(30.0f, static_cast<double>(width())/static_cast<double>(height()), 1.0f, 10000.0f);
getCamera()->setGraphicsContext(getGraphicsWindow());
setThreadingModel(osgViewer::Viewer::SingleThreaded);
connect(&_timer, SIGNAL(timeout()), this, SLOT(updateGL()));

View File

@@ -32,23 +32,30 @@ bool wxOsgApp::OnInit()
int width = 800;
int height = 600;
int *attributes = new int[6];
attributes[0] = int(WX_GL_DOUBLEBUFFER);
attributes[1] = WX_GL_RGBA;
attributes[2] = WX_GL_DEPTH_SIZE;
attributes[3] = 8;
attributes[4] = WX_GL_STENCIL_SIZE;
attributes[5] = 8;
GraphicsWindowWX* gw = new GraphicsWindowWX(frame, wxID_ANY, wxDefaultPosition,
wxSize(width, height), wxSUNKEN_BORDER);
wxSize(width, height), wxSUNKEN_BORDER, wxT("osgviewerWX"), attributes);
osgViewer::Viewer *viewer = new osgViewer::Viewer;
viewer->getCamera()->setGraphicsContext(gw);
viewer->getCamera()->setViewport(0,0,width,height);
viewer->addEventHandler(new osgViewer::StatsHandler);
viewer->setThreadingModel(osgViewer::Viewer::SingleThreaded);
// load the scene.
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFile("cow.osg");
if (!loadedModel)
{
return false;
}
viewer->setSceneData(loadedModel.get());
viewer->setCameraManipulator(new osgGA::TrackballManipulator);
@@ -81,7 +88,7 @@ void MainFrame::SetViewer(osgViewer::Viewer *viewer)
void MainFrame::OnIdle(wxIdleEvent &event)
{
_viewer->frame();
event.RequestMore();
}
@@ -95,12 +102,12 @@ BEGIN_EVENT_TABLE(GraphicsWindowWX, wxGLCanvas)
END_EVENT_TABLE()
GraphicsWindowWX::GraphicsWindowWX(wxWindow *parent, wxWindowID id,
const wxPoint& pos, const wxSize& size, long style, const wxString& name)
: wxGLCanvas(parent, id, pos, size, style|wxFULL_REPAINT_ON_RESIZE, name)
const wxPoint& pos, const wxSize& size, long style, const wxString& name, int *attributes)
: wxGLCanvas(parent, id, pos, size, style|wxFULL_REPAINT_ON_RESIZE, name, attributes)
{
// default cursor to standard
_oldCursor = *wxSTANDARD_CURSOR;
_traits = new GraphicsContext::Traits;
_traits->x = pos.x;
_traits->y = pos.y;
@@ -108,7 +115,7 @@ GraphicsWindowWX::GraphicsWindowWX(wxWindow *parent, wxWindowID id,
_traits->height = size.y;
init();
}
void GraphicsWindowWX::init()
@@ -121,7 +128,7 @@ void GraphicsWindowWX::init()
if (_traits.valid() && _traits->sharedContext)
{
getState()->setContextID( _traits->sharedContext->getState()->getContextID() );
incrementContextIDUsageCount( getState()->getContextID() );
incrementContextIDUsageCount( getState()->getContextID() );
}
else
{
@@ -148,7 +155,7 @@ void GraphicsWindowWX::OnSize(wxSizeEvent& event)
// set GL viewport (not called by wxGLCanvas::OnSize on all platforms...)
int width, height;
GetClientSize(&width, &height);
// update the window dimensions, in case the window has been resized.
getEventQueue()->windowResize(0, 0, width, height);
resized(0,0,width,height);
@@ -161,12 +168,12 @@ void GraphicsWindowWX::OnEraseBackground(wxEraseEvent& WXUNUSED(event))
void GraphicsWindowWX::OnKeyDown(wxKeyEvent &event)
{
#if 1
#if wxUSE_UNICODE
int key = event.GetUnicodeKey();
#else
int key = event.GetKeyCode();
#endif
getEventQueue()->keyPress(key);
getEventQueue()->keyPress(key);
// propagate event
event.Skip();
@@ -174,12 +181,12 @@ void GraphicsWindowWX::OnKeyDown(wxKeyEvent &event)
void GraphicsWindowWX::OnKeyUp(wxKeyEvent &event)
{
#if 1
#if wxUSE_UNICODE
int key = event.GetUnicodeKey();
#else
int key = event.GetKeyCode();
#endif
getEventQueue()->keyRelease(key);
getEventQueue()->keyRelease(key);
// propagate event
event.Skip();

View File

@@ -8,13 +8,14 @@
#include <osgViewer/Viewer>
#include <string>
class GraphicsWindowWX: public wxGLCanvas, public osgViewer::GraphicsWindow
class GraphicsWindowWX : public wxGLCanvas, public osgViewer::GraphicsWindow
{
public:
GraphicsWindowWX(wxWindow *parent, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxString& name = wxT("TestGLCanvas"));
const wxString& name = wxT("TestGLCanvas"),
int *attributes = 0);
~GraphicsWindowWX();
@@ -30,7 +31,6 @@ public:
//
// GraphicsWindow interface
//
void grabFocus();
void grabFocusIfPointerInWindow();
void useCursor(bool cursorOn);

View File

@@ -44,12 +44,15 @@ int main( int argc, char **argv )
// construct the viewer.
osgViewer::Viewer viewer;
int xoffset = 40;
int yoffset = 40;
// left window + left slave camera
{
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
traits->x = 0;
traits->y = 0;
traits->width = 640;
traits->x = xoffset + 0;
traits->y = yoffset + 0;
traits->width = 600;
traits->height = 480;
traits->windowDecoration = true;
traits->doubleBuffer = true;
@@ -64,16 +67,16 @@ int main( int argc, char **argv )
camera->setDrawBuffer(buffer);
camera->setReadBuffer(buffer);
// add this slave camra to the viewer, with a shift left of the projection matrix
// add this slave camera to the viewer, with a shift left of the projection matrix
viewer.addSlave(camera.get(), osg::Matrixd::translate(1.0,0.0,0.0), osg::Matrixd());
}
// left window + left slave camera
// right window + right slave camera
{
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
traits->x = 640;
traits->y = 0;
traits->width = 640;
traits->x = xoffset + 600;
traits->y = yoffset + 0;
traits->width = 600;
traits->height = 480;
traits->windowDecoration = true;
traits->doubleBuffer = true;
@@ -88,7 +91,7 @@ int main( int argc, char **argv )
camera->setDrawBuffer(buffer);
camera->setReadBuffer(buffer);
// add this slave camra to the viewer, with a shift right of the projection matrix
// add this slave camera to the viewer, with a shift right of the projection matrix
viewer.addSlave(camera.get(), osg::Matrixd::translate(-1.0,0.0,0.0), osg::Matrixd());
}

View File

@@ -52,6 +52,11 @@ configure file /osg\/GraphicsContext/
"
end
configure file /osgViewer\/ViewerBase/
emit before "#include <osgViewer/View>
"
end
#############################################################################
# add <io_utils> header to Plane, Quat and Vec* files
@@ -179,22 +184,22 @@ end
configure file "osg/Array"
emit after "
STD_VECTOR_REFLECTOR(std::vector<osg::Vec2>);
STD_VECTOR_REFLECTOR(std::vector<osg::Vec3>);
STD_VECTOR_REFLECTOR(std::vector<osg::Vec4>);
STD_VECTOR_REFLECTOR(std::vector<osg::Vec2b>);
STD_VECTOR_REFLECTOR(std::vector<osg::Vec3b>);
STD_VECTOR_REFLECTOR(std::vector<osg::Vec4b>);
STD_VECTOR_REFLECTOR(std::vector<osg::Vec2s>);
STD_VECTOR_REFLECTOR(std::vector<osg::Vec3s>);
STD_VECTOR_REFLECTOR(std::vector<osg::Vec4s>);
STD_VECTOR_REFLECTOR(std::vector<osg::Vec4ub>);
STD_VECTOR_REFLECTOR(std::vector<GLubyte>);
STD_VECTOR_REFLECTOR(std::vector<GLbyte>);
STD_VECTOR_REFLECTOR(std::vector<GLushort>);
STD_VECTOR_REFLECTOR(std::vector<GLshort>);
STD_VECTOR_REFLECTOR(std::vector<GLuint>);
STD_VECTOR_REFLECTOR(std::vector<GLint>);
STD_VECTOR_REFLECTOR(std::vector<osg::Vec2>)
STD_VECTOR_REFLECTOR(std::vector<osg::Vec3>)
STD_VECTOR_REFLECTOR(std::vector<osg::Vec4>)
STD_VECTOR_REFLECTOR(std::vector<osg::Vec2b>)
STD_VECTOR_REFLECTOR(std::vector<osg::Vec3b>)
STD_VECTOR_REFLECTOR(std::vector<osg::Vec4b>)
STD_VECTOR_REFLECTOR(std::vector<osg::Vec2s>)
STD_VECTOR_REFLECTOR(std::vector<osg::Vec3s>)
STD_VECTOR_REFLECTOR(std::vector<osg::Vec4s>)
STD_VECTOR_REFLECTOR(std::vector<osg::Vec4ub>)
STD_VECTOR_REFLECTOR(std::vector<GLubyte>)
STD_VECTOR_REFLECTOR(std::vector<GLbyte>)
STD_VECTOR_REFLECTOR(std::vector<GLushort>)
STD_VECTOR_REFLECTOR(std::vector<GLshort>)
STD_VECTOR_REFLECTOR(std::vector<GLuint>)
STD_VECTOR_REFLECTOR(std::vector<GLint>)
"
end
@@ -203,7 +208,7 @@ end
# StateSet and related types need some advanced tweaking
configure reflector "std::map< osg::StateAttribute::GLMode, osg::StateAttribute::GLModeValue >"
replace with "STD_MAP_REFLECTOR_WITH_TYPES(std::map< osg::StateAttribute::GLMode COMMA osg::StateAttribute::GLModeValue >, osg::StateAttribute::GLMode, osg::StateAttribute::Values);"
replace with "STD_MAP_REFLECTOR_WITH_TYPES(std::map< osg::StateAttribute::GLMode COMMA osg::StateAttribute::GLModeValue >, osg::StateAttribute::GLMode, osg::StateAttribute::Values)"
end
configure reflector "osg::StateSet"
@@ -286,6 +291,10 @@ configure reflector "OpenThreads::Block"
object-type
end
configure reflector "OpenThreads::BlockCount"
object-type
end
configure reflector "OpenThreads::Barrier"
object-type
end
@@ -321,12 +330,12 @@ end
# Doxygen doesn't parse ReadFunc and WriteFunc correctly...
configure reflector "osgDB::DotOsgWrapper::ReadFunc"
replace with "TYPE_NAME_ALIAS(bool (*)(osg::Object&,osgDB::Input&), osgDB::DotOsgWrapper::ReadFunc);
replace with "TYPE_NAME_ALIAS(bool (*)(osg::Object&,osgDB::Input&), osgDB::DotOsgWrapper::ReadFunc)
"
end
configure reflector "osgDB::DotOsgWrapper::WriteFunc"
replace with "TYPE_NAME_ALIAS(bool (*)(const osg::Object&,osgDB::Output&), osgDB::DotOsgWrapper::WriteFunc);
replace with "TYPE_NAME_ALIAS(bool (*)(const osg::Object&,osgDB::Output&), osgDB::DotOsgWrapper::WriteFunc)
"
end
@@ -359,6 +368,87 @@ configure reflector "osg::Drawable::Extensions"
end
end
configure reflector "osg::BlendColor::Extensions"
configure method "__typedef__void__APIENTRY_P1"
replace with ""
end
configure method "__typedef__GLboolean__APIENTRY_P1"
replace with ""
end
end
configure reflector "osg::BlendEquation::Extensions"
configure method "__typedef__void__APIENTRY_P1"
replace with ""
end
configure method "__typedef__GLboolean__APIENTRY_P1"
replace with ""
end
end
configure reflector "osg::BlendFunc::Extensions"
configure method "__typedef__void__APIENTRY_P1"
replace with ""
end
configure method "__typedef__GLboolean__APIENTRY_P1"
replace with ""
end
end
configure reflector "osg::FragmentProgram::Extensions"
configure method "__typedef__void__APIENTRY_P1"
replace with ""
end
configure method "__typedef__GLboolean__APIENTRY_P1"
replace with ""
end
end
configure reflector "osg::Multisample::Extensions"
configure method "__typedef__void__APIENTRY_P1"
replace with ""
end
configure method "__typedef__GLboolean__APIENTRY_P1"
replace with ""
end
end
configure reflector "osg::Point::Extensions"
configure method "__typedef__void__APIENTRY_P1"
replace with ""
end
configure method "__typedef__GLboolean__APIENTRY_P1"
replace with ""
end
end
configure reflector "osg::ClampColor::Extensions"
configure method "__typedef__void__APIENTRY_P1"
replace with ""
end
configure method "__typedef__GLboolean__APIENTRY_P1"
replace with ""
end
end
configure reflector "osg::Texture::Extensions"
configure method "__typedef__void__APIENTRY_P1"
replace with ""
end
configure method "__typedef__GLboolean__APIENTRY_P1"
replace with ""
end
end
configure reflector "osg::Texture2DArray::Extensions"
configure method "__typedef__void__APIENTRY_P1"
replace with ""
end
configure method "__typedef__GLboolean__APIENTRY_P1"
replace with ""
end
end
configure reflector "osg::State"
configure method "__typedef__void__APIENTRY_P1"
replace with ""

View File

@@ -33,6 +33,7 @@ class OSG_EXPORT ArgumentParser
public:
enum ParameterType
{
BOOL_PARAMETER,
FLOAT_PARAMETER,
DOUBLE_PARAMETER,
INT_PARAMETER,
@@ -42,6 +43,7 @@ class OSG_EXPORT ArgumentParser
union ValueUnion
{
bool* _bool;
float* _float;
double* _double;
int* _int;
@@ -49,6 +51,8 @@ class OSG_EXPORT ArgumentParser
std::string* _string;
};
Parameter(bool& value) { _type = BOOL_PARAMETER; _value._bool = &value; }
Parameter(float& value) { _type = FLOAT_PARAMETER; _value._float = &value; }
Parameter(double& value) { _type = DOUBLE_PARAMETER; _value._double = &value; }
@@ -83,6 +87,9 @@ class OSG_EXPORT ArgumentParser
/** Return true if specified parameter is a number. */
static bool isNumber(const char* str);
/** Return true if specified parameter is a bool. */
static bool isBool(const char* str);
public:
ArgumentParser(int* argc,char **argv);

View File

@@ -81,21 +81,21 @@ class OSG_EXPORT BlendColor : public StateAttribute
void lowestCommonDenominator(const Extensions& rhs);
void setupGLExtenions(unsigned int contextID);
void setupGLExtensions(unsigned int contextID);
void setBlendColorSupported(bool flag) { _isBlendColorSupported=flag; }
bool isBlendColorSupported() const { return _isBlendColorSupported; }
void setBlendColorProc(void* ptr) { _glBlendColor = ptr; }
void glBlendColor(GLclampf red , GLclampf green , GLclampf blue , GLclampf alpha) const;
protected:
~Extensions() {}
bool _isBlendColorSupported;
void* _glBlendColor;
typedef void (APIENTRY * GLBlendColorProc) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
bool _isBlendColorSupported;
GLBlendColorProc _glBlendColor;
};

View File

@@ -103,25 +103,26 @@ class OSG_EXPORT BlendEquation : public StateAttribute
void lowestCommonDenominator(const Extensions& rhs);
void setupGLExtenions(unsigned int contextID);
void setupGLExtensions(unsigned int contextID);
void setBlendEquationSupported(bool flag) { _isBlendEquationSupported=flag; }
bool isBlendEquationSupported() const { return _isBlendEquationSupported; }
bool isSGIXMinMaxSupported() const { return _isSGIXMinMaxSupported; }
bool isLogicOpSupported() const { return _isLogicOpSupported; }
void setBlendEquationProc(void* ptr) { _glBlendEquation = ptr; }
void glBlendEquation(GLenum mode) const;
protected:
~Extensions() {}
bool _isBlendEquationSupported;
bool _isSGIXMinMaxSupported;
bool _isLogicOpSupported;
typedef void (APIENTRY * GLBlendEquationProc) (GLenum mode);
void* _glBlendEquation;
bool _isBlendEquationSupported;
bool _isSGIXMinMaxSupported;
bool _isLogicOpSupported;
GLBlendEquationProc _glBlendEquation;
};

View File

@@ -147,7 +147,6 @@ class OSG_EXPORT BlendFunc : public StateAttribute
void setBlendFuncSeparateSupported(bool flag) { _isBlendFuncSeparateSupported=flag; }
bool isBlendFuncSeparateSupported() const { return _isBlendFuncSeparateSupported; }
void setBlendFuncSeparateProc(void* ptr) { _glBlendFuncSeparate = ptr; }
void glBlendFuncSeparate(GLenum sfactorRGB,
GLenum dfactorRGB,
GLenum sfactorAlpha,
@@ -157,9 +156,13 @@ class OSG_EXPORT BlendFunc : public StateAttribute
~Extensions() {}
bool _isBlendFuncSeparateSupported;
void* _glBlendFuncSeparate;
typedef void (APIENTRY * GLBlendFuncSeparateProc) (GLenum sfactorRGB,
GLenum dfactorRGB,
GLenum sfactorAlpha,
GLenum dfactorAlpha);
bool _isBlendFuncSeparateSupported;
GLBlendFuncSeparateProc _glBlendFuncSeparate;
};

View File

@@ -93,6 +93,16 @@ class OSG_EXPORT BufferObject : public Object
virtual const char* libraryName() const { return "osg"; }
virtual const char* className() const { return "BufferObject"; }
/** Set what type of usage the buffer object will have. Options are:
* GL_STREAM_DRAW, GL_STREAM_READ, GL_STREAM_COPY,
* GL_STATIC_DRAW, GL_STATIC_READ, GL_STATIC_COPY,
* GL_DYNAMIC_DRAW, GL_DYNAMIC_READ, or GL_DYNAMIC_COPY.
*/
void setUsage(GLenum usage) { _usage = usage; }
/** Get the type of usage the buffer object has been set up for.*/
GLenum getUsage() const { return _usage; }
struct BufferEntry
{
BufferEntry(): dataSize(0),offset(0) {}
@@ -159,7 +169,7 @@ class OSG_EXPORT BufferObject : public Object
void lowestCommonDenominator(const Extensions& rhs);
void setupGLExtenions(unsigned int contextID);
void setupGLExtensions(unsigned int contextID);
bool isBufferObjectSupported() const { return _glGenBuffers!=0; }
bool isPBOSupported() const { return _isPBOSupported; }
@@ -281,8 +291,8 @@ class OSG_EXPORT ElementBufferObject : public BufferObject
META_Object(osg,ElementBufferObject);
typedef std::pair< BufferEntry, DrawElements* > BufferEntryDrawElementstPair;
typedef std::vector< BufferEntryDrawElementstPair > BufferEntryDrawElementsPairs;
typedef std::pair< BufferEntry, DrawElements* > BufferEntryDrawElementsPair;
typedef std::vector< BufferEntryDrawElementsPair > BufferEntryDrawElementsPairs;
unsigned int addDrawElements(osg::DrawElements* PrimitiveSet);
void removeDrawElements(osg::DrawElements* PrimitiveSet);

View File

@@ -352,13 +352,13 @@ class OSG_EXPORT Camera : public Transform, public CullSettings
void createCameraThread();
/** Assign a operation thread to the camera.*/
void setCameraThread(OperationsThread* gt);
void setCameraThread(OperationThread* gt);
/** Get the operation thread assigned to this camera.*/
OperationsThread* getCameraThread() { return _cameraThread.get(); }
OperationThread* getCameraThread() { return _cameraThread.get(); }
/** Get the const operation thread assigned to this camera.*/
const OperationsThread* getCameraThread() const { return _cameraThread.get(); }
const OperationThread* getCameraThread() const { return _cameraThread.get(); }
@@ -373,13 +373,23 @@ class OSG_EXPORT Camera : public Transform, public CullSettings
/** Set the Rendering object that is used to implement rendering of the subgraph.*/
void setRenderingCache(unsigned int contextID, osg::Object* rc) { _renderingCache[contextID] = rc; }
void setRenderer(osg::GraphicsOperation* rc) { _renderer = rc; }
/** Get the Rendering object that is used to implement rendering of the subgraph.*/
osg::Object* getRenderingCache(unsigned int contextID) { return _renderingCache[contextID].get(); }
osg::GraphicsOperation* getRenderer() { return _renderer.get(); }
/** Get the const Rendering object that is used to implement rendering of the subgraph.*/
const osg::Object* getRenderingCache(unsigned int contextID) const { return _renderingCache[contextID].get(); }
const osg::GraphicsOperation* getRenderer() const { return _renderer.get(); }
/** Set the Rendering cache that is used for cached objects associated with rendering of subgraphs.*/
void setRenderingCache(osg::Object* rc) { _renderingCache = rc; }
/** Get the Rendering cache that is used for cached objects associated with rendering of subgraphs.*/
osg::Object* getRenderingCache() { return _renderingCache.get(); }
/** Get the const Rendering cache that is used for cached objects associated with rendering of subgraphs.*/
const osg::Object* getRenderingCache() const { return _renderingCache.get(); }
/** Draw callback for custom operations.*/
@@ -467,11 +477,12 @@ class OSG_EXPORT Camera : public Transform, public CullSettings
RenderTargetImplementation _renderTargetFallback;
BufferAttachmentMap _bufferAttachmentMap;
ref_ptr<OperationsThread> _cameraThread;
ref_ptr<OperationThread> _cameraThread;
ref_ptr<GraphicsContext> _graphicsContext;
buffered_object< ref_ptr<Object> > _renderingCache;
ref_ptr<GraphicsOperation> _renderer;
ref_ptr<Object> _renderingCache;
ref_ptr<DrawCallback> _preDrawCallback;
ref_ptr<DrawCallback> _postDrawCallback;

View File

@@ -89,21 +89,20 @@ class OSG_EXPORT ClampColor : public StateAttribute
void lowestCommonDenominator(const Extensions& rhs);
void setupGLExtenions(unsigned int contextID);
void setupGLExtensions(unsigned int contextID);
void setClampColorSupported(bool flag) { _isClampColorSupported=flag; }
bool isClampColorSupported() const { return _isClampColorSupported; }
void setClampColorProc(void* ptr) { _glClampColor = ptr; }
void glClampColor(GLenum target, GLenum mode) const;
protected:
~Extensions() {}
bool _isClampColorSupported;
void* _glClampColor;
typedef void (APIENTRY * GLClampColorProc) (GLenum target, GLenum mode);
bool _isClampColorSupported;
GLClampColorProc _glClampColor;
};

View File

@@ -62,7 +62,7 @@ class OSG_EXPORT CollectOccludersVisitor : public osg::NodeVisitor, public osg::
void setCreateDrawablesOnOccludeNodes(bool flag) { _createDrawables=flag; }
bool getCreateDrawablesOnOccludeNodes() const { return _createDrawables; }
void setCollectedOcculderSet(const ShadowVolumeOccluderSet& svol) { _occluderSet = svol; }
void setCollectedOccluderSet(const ShadowVolumeOccluderSet& svol) { _occluderSet = svol; }
ShadowVolumeOccluderSet& getCollectedOccluderSet() { return _occluderSet; }
const ShadowVolumeOccluderSet& getCollectedOccluderSet() const { return _occluderSet; }

View File

@@ -85,7 +85,7 @@ class OSG_EXPORT CullSettings
unsigned int getInheritanceMask() const { return _inheritanceMask; }
/** Set the local cull settings values from specified CullSettings object.*/
void setCullSettings(const CullSettings& settings) { inheritCullSettings(settings, ALL_VARIABLES); }
void setCullSettings(const CullSettings& settings);
/** Inherit the local cull settings variable from specified CullSettings object, according to the inheritance mask.*/
virtual void inheritCullSettings(const CullSettings& settings) { inheritCullSettings(settings, _inheritanceMask); }

View File

@@ -31,6 +31,7 @@ class OSG_EXPORT CullStack : public osg::CullSettings
CullStack();
CullStack(const CullStack& cs);
~CullStack();

View File

@@ -37,7 +37,7 @@ class OSG_EXPORT DeleteHandler
DeleteHandler(int numberOfFramesToRetainObjects=0);
virtual ~DeleteHandler() { flushAll(); }
virtual ~DeleteHandler();
/** Set the number of frames to retain objects that are have been requested for deletion.
* When set to zero objects are deleted immediately, by set to 1 there are kept around for an extra frame etc.
@@ -71,7 +71,9 @@ class OSG_EXPORT DeleteHandler
protected:
DeleteHandler(const DeleteHandler&) {}
DeleteHandler(const DeleteHandler&):
_numFramesToRetainObjects(0),
_currentFrameNumber(0) {}
DeleteHandler operator = (const DeleteHandler&) { return *this; }
int _numFramesToRetainObjects;

View File

@@ -36,13 +36,15 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced
static DisplaySettings* instance();
DisplaySettings()
DisplaySettings():
Referenced(true)
{
setDefaults();
readEnvironmentalVariables();
}
DisplaySettings(ArgumentParser& arguments)
DisplaySettings(ArgumentParser& arguments):
Referenced(true)
{
setDefaults();
readEnvironmentalVariables();
@@ -92,7 +94,8 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced
LEFT_EYE,
RIGHT_EYE,
HORIZONTAL_INTERLACE,
VERTICAL_INTERLACE
VERTICAL_INTERLACE,
CHECKERBOARD
};
void setStereoMode(StereoMode mode) { _stereoMode = mode; }
@@ -125,8 +128,8 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced
void setSplitStereoVerticalSeparation(int s) { _splitStereoVerticalSeparation = s; }
int getSplitStereoVerticalSeparation() const { return _splitStereoVerticalSeparation; }
void setSplitStereoAutoAjustAspectRatio(bool flag) { _splitStereoAutoAdjustAspectRatio=flag; }
bool getSplitStereoAutoAjustAspectRatio() const { return _splitStereoAutoAdjustAspectRatio; }
void setSplitStereoAutoAdjustAspectRatio(bool flag) { _splitStereoAutoAdjustAspectRatio=flag; }
bool getSplitStereoAutoAdjustAspectRatio() const { return _splitStereoAutoAdjustAspectRatio; }
void setScreenWidth(float width) { _screenWidth = width; }
@@ -174,6 +177,12 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced
void setNumMultiSamples(unsigned int samples) { _numMultiSamples = samples; }
unsigned int getNumMultiSamples() const { return _numMultiSamples; }
bool getMultiSamples() const { return _numMultiSamples!=0; }
void setCompileContextsHint(bool useCompileContexts) { _compileContextsHint = useCompileContexts; }
bool getCompileContextsHint() const { return _compileContextsHint; }
void setSerializeDrawDispatch(bool serializeDrawDispatch) { _serializeDrawDispatch = serializeDrawDispatch; }
bool getSerializeDrawDispatch() const { return _serializeDrawDispatch; }
protected:
@@ -207,6 +216,9 @@ class OSG_EXPORT DisplaySettings : public osg::Referenced
unsigned int _maxNumOfGraphicsContexts;
unsigned int _numMultiSamples;
bool _compileContextsHint;
bool _serializeDrawDispatch;
};

View File

@@ -575,7 +575,7 @@ class OSG_EXPORT Drawable : public Object
void lowestCommonDenominator(const Extensions& rhs);
void setupGLExtenions(unsigned int contextID);
void setupGLExtensions(unsigned int contextID);
void setVertexProgramSupported(bool flag) { _isVertexProgramSupported=flag; }
bool isVertexProgramSupported() const { return _isVertexProgramSupported; }

View File

@@ -240,7 +240,7 @@ class OSG_EXPORT FragmentProgram : public StateAttribute
void lowestCommonDenominator(const Extensions& rhs);
void setupGLExtenions(unsigned int contextID);
void setupGLExtensions(unsigned int contextID);
void setFragmentProgramSupported(bool flag) { _isFragmentProgramSupported=flag; }
bool isFragmentProgramSupported() const { return _isFragmentProgramSupported; }
@@ -257,11 +257,17 @@ class OSG_EXPORT FragmentProgram : public StateAttribute
bool _isFragmentProgramSupported;
void* _glBindProgram;
void* _glGenPrograms;
void *_glDeletePrograms;
void* _glProgramString;
void* _glProgramLocalParameter4fv;
typedef void (APIENTRY * BindProgramProc) (GLenum target, GLuint id);
typedef void (APIENTRY * GenProgramsProc) (GLsizei n, GLuint *programs);
typedef void (APIENTRY * DeleteProgramsProc) (GLsizei n, GLuint *programs);
typedef void (APIENTRY * ProgramStringProc) (GLenum target, GLenum format, GLsizei len, const void *string);
typedef void (APIENTRY * ProgramLocalParameter4fvProc) (GLenum target, GLuint index, const GLfloat *params);
BindProgramProc _glBindProgram;
GenProgramsProc _glGenPrograms;
DeleteProgramsProc _glDeletePrograms;
ProgramStringProc _glProgramString;
ProgramLocalParameter4fvProc _glProgramLocalParameter4fv;
};
/** Function to call to get the extension of a specified context.

View File

@@ -44,6 +44,7 @@
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4
#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4
#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1
#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2
@@ -105,13 +106,16 @@ namespace osg
typedef void APIENTRY TglFramebufferTexture1DEXT(GLenum, GLenum, GLenum, GLuint, GLint);
typedef void APIENTRY TglFramebufferTexture2DEXT(GLenum, GLenum, GLenum, GLuint, GLint);
typedef void APIENTRY TglFramebufferTexture3DEXT(GLenum, GLenum, GLenum, GLuint, GLint, GLint);
typedef void APIENTRY TglFramebufferTextureLayerEXT(GLenum, GLenum, GLuint, GLint, GLint);
typedef void APIENTRY TglFramebufferRenderbufferEXT(GLenum, GLenum, GLenum, GLuint);
typedef void APIENTRY TglGenerateMipmapEXT(GLenum);
typedef void APIENTRY TglRenderbufferStorageMultisampleCoverageNV(GLenum, GLuint, GLuint, GLenum, GLuint, GLuint);
TglBindRenderbufferEXT* glBindRenderbufferEXT;
TglGenRenderbuffersEXT* glGenRenderbuffersEXT;
TglDeleteRenderbuffersEXT* glDeleteRenderbuffersEXT;
TglRenderbufferStorageEXT* glRenderbufferStorageEXT;
TglRenderbufferStorageMultisampleCoverageNV* glRenderbufferStorageMultisampleCoverageNV;
TglBindFramebufferEXT* glBindFramebufferEXT;
TglDeleteFramebuffersEXT* glDeleteFramebuffersEXT;
TglGenFramebuffersEXT* glGenFramebuffersEXT;
@@ -119,6 +123,7 @@ namespace osg
TglFramebufferTexture1DEXT* glFramebufferTexture1DEXT;
TglFramebufferTexture2DEXT* glFramebufferTexture2DEXT;
TglFramebufferTexture3DEXT* glFramebufferTexture3DEXT;
TglFramebufferTextureLayerEXT* glFramebufferTextureLayerEXT;
TglFramebufferRenderbufferEXT* glFramebufferRenderbufferEXT;
TglGenerateMipmapEXT* glGenerateMipmapEXT;
@@ -246,6 +251,7 @@ namespace osg
class Texture1D;
class Texture2D;
class Texture3D;
class Texture2DArray;
class TextureCubeMap;
class TextureRectangle;
@@ -259,6 +265,7 @@ namespace osg
explicit FrameBufferAttachment(Texture1D* target, int level = 0);
explicit FrameBufferAttachment(Texture2D* target, int level = 0);
explicit FrameBufferAttachment(Texture3D* target, int zoffset, int level = 0);
explicit FrameBufferAttachment(Texture2DArray* target, int layer, int level = 0);
explicit FrameBufferAttachment(TextureCubeMap* target, int face, int level = 0);
explicit FrameBufferAttachment(TextureRectangle* target);
explicit FrameBufferAttachment(Camera::Attachment& attachment);

View File

@@ -1,6 +1,7 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
* Copyright (C) 2003-2005 3Dlabs Inc. Ltd.
* Copyright (C) 2004-2005 Nathan Cournia
* Copyright (C) 2007 Art Tevs
*
* This application is open source and may be redistributed and/or modified
* freely and without restriction, both in commericial and non commericial
@@ -23,6 +24,14 @@
#include <string>
#ifndef GL_SAMPLER_2D_ARRAY_EXT
#define GL_SAMPLER_1D_ARRAY_EXT 0x8DC0
#define GL_SAMPLER_2D_ARRAY_EXT 0x8DC1
#define GL_SAMPLER_1D_ARRAY_SHADOW_EXT 0x8DC3
#define GL_SAMPLER_2D_ARRAY_SHADOW_EXT 0x8DC4
#endif
#ifndef GL_VERSION_2_0 //[
#define GL_VERSION_2_0 1
typedef char GLchar;
@@ -255,6 +264,11 @@ class OSG_EXPORT GL2Extensions : public osg::Referenced
bool getProgramInfoLog( GLuint program, std::string& result ) const;
bool getShaderInfoLog( GLuint shader, std::string& result ) const;
bool getAttribLocation( const char* attribName, GLuint& slot ) const;
bool getFragDataLocation( const char* fragDataName, GLuint& slot) const;
//EXT_gpu_shader4 to support frag data binding
void glBindFragDataLocation(GLuint program, GLuint colorNumber, const GLchar *name) const;
GLint glGetFragDataLocation(GLuint program, const GLchar *name) const;
protected:
~GL2Extensions() {}
@@ -365,6 +379,9 @@ class OSG_EXPORT GL2Extensions : public osg::Referenced
void* _glGetObjectParameterivARB;
void* _glDeleteObjectARB;
void* _glGetHandleARB;
void* _glBindFragDataLocation;
void* _glGetFragDataLocation;
};
}

Some files were not shown because too many files have changed in this diff Show More