Compare commits

...

1223 Commits

Author SHA1 Message Date
Robert Osfield
07d2adec5c Release OpenSceneGraph-3.2.2
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/tags/OpenSceneGraph-3.2.2@15052 16af8721-9629-0410-8352-f15c8da7e697
2015-08-04 16:03:33 +00:00
Robert Osfield
30fff3106d Updated version and NEWS for 3.2.2 stable release
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@15051 16af8721-9629-0410-8352-f15c8da7e697
2015-08-04 15:52:28 +00:00
Robert Osfield
23458666b8 Update NEWS to online Contributors list.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@15050 16af8721-9629-0410-8352-f15c8da7e697
2015-08-04 10:37:50 +00:00
Robert Osfield
c91bfcee21 Updated AUTHORS
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@15049 16af8721-9629-0410-8352-f15c8da7e697
2015-08-04 10:26:26 +00:00
Robert Osfield
d763feddda Updated ChangeLog and NEWS for 3.2.2 release
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@15048 16af8721-9629-0410-8352-f15c8da7e697
2015-08-04 10:25:40 +00:00
Robert Osfield
3b789fc6b0 Upated rc number to 4
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@15047 16af8721-9629-0410-8352-f15c8da7e697
2015-08-04 10:11:39 +00:00
Robert Osfield
110cf64c3b Build fix for Mingw
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@15045 16af8721-9629-0410-8352-f15c8da7e697
2015-08-04 09:35:00 +00:00
Robert Osfield
9d326917f0 From Pjotr Svetachov, buid fixes for VS2015.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@15023 16af8721-9629-0410-8352-f15c8da7e697
2015-07-23 14:42:39 +00:00
Robert Osfield
5ead09215e Added check for validity of OpenFlight shininess value.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@15000 16af8721-9629-0410-8352-f15c8da7e697
2015-07-21 14:22:12 +00:00
Robert Osfield
60838d0c42 Fixed typo
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14995 16af8721-9629-0410-8352-f15c8da7e697
2015-07-21 13:42:07 +00:00
Robert Osfield
bddbdfdefe Reinstated the TIFFSetField(image, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14987 16af8721-9629-0410-8352-f15c8da7e697
2015-07-19 09:51:27 +00:00
Robert Osfield
0744b6881f Updated release candidate nubmer
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14979 16af8721-9629-0410-8352-f15c8da7e697
2015-07-17 09:15:40 +00:00
Robert Osfield
3371ce640a Updated ChangeLog and AURHORS
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14976 16af8721-9629-0410-8352-f15c8da7e697
2015-07-17 09:03:49 +00:00
Robert Osfield
dff397f647 Updated ChangeLog and AUTHORS file
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14975 16af8721-9629-0410-8352-f15c8da7e697
2015-07-17 08:35:23 +00:00
Robert Osfield
1c833e2e4d Added cmake_policy setting for cmake-3.x to avoid warning with Qt usage.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14972 16af8721-9629-0410-8352-f15c8da7e697
2015-07-17 08:17:34 +00:00
Robert Osfield
cf268b4cfd From Patrick Neary, "To the tiff plugin, add the capability to write tiff images with unsigned short data"
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14971 16af8721-9629-0410-8352-f15c8da7e697
2015-07-17 08:13:01 +00:00
Robert Osfield
1d628eebfb From Patrick Neary, "Added some lesser used tokens that we use from GL_ARB_texture_rg to computeFormatDataType(), and computeNumComponents() in src/osg/Image.cpp"
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14968 16af8721-9629-0410-8352-f15c8da7e697
2015-07-16 19:19:29 +00:00
Robert Osfield
20401947bf Build fix for GLDAL>=2.0
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14926 16af8721-9629-0410-8352-f15c8da7e697
2015-06-30 08:38:53 +00:00
Robert Osfield
16ac602824 From Jannik Heller, fix to clearReferencesToDependentCameras().
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14923 16af8721-9629-0410-8352-f15c8da7e697
2015-06-19 09:54:05 +00:00
Robert Osfield
4f830fb0e2 From Farshid Lashkari, "I've modified some setter methods of TextBase to avoid unnecessary calls to computeGlyphRepresentation() if the value has not changed."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14911 16af8721-9629-0410-8352-f15c8da7e697
2015-06-12 08:04:38 +00:00
Robert Osfield
d4fc0ceba3 Philippe Renon, "Fixed potential divide by zero in NodeTrackerManipulator : The divide by zero happens when throwing a NodeTrackerManipulator.
The infinite result trickles down and later causes NaN in culling.

The fix was to use getThrowScale() as done everywhere else."


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14906 16af8721-9629-0410-8352-f15c8da7e697
2015-06-10 10:02:22 +00:00
Robert Osfield
825882be19 Fixed setReferenceTime() bug where a * eather than the correct / was being used. Bug and fix suggested Benjamin Richter.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14897 16af8721-9629-0410-8352-f15c8da7e697
2015-06-07 11:13:08 +00:00
Robert Osfield
bc473c4e0e Fixed memory error associated with reading over the end of container due to an unbounded while loop.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14867 16af8721-9629-0410-8352-f15c8da7e697
2015-05-21 14:11:54 +00:00
Robert Osfield
a430566596 Changed the CMP0020 check to > 2.8.10
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14863 16af8721-9629-0410-8352-f15c8da7e697
2015-05-05 11:04:05 +00:00
Robert Osfield
3d77abc06d Merged correction to coordinates from svn/trunk
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14853 16af8721-9629-0410-8352-f15c8da7e697
2015-04-20 10:43:00 +00:00
Robert Osfield
033e52b8ef Updated contributor fixes
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14852 16af8721-9629-0410-8352-f15c8da7e697
2015-04-20 10:42:28 +00:00
Robert Osfield
785ce9f679 Moved uniform substitution to infront of vertex attribute substituion to make sure gl_Vertex usage is replaced when required.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14847 16af8721-9629-0410-8352-f15c8da7e697
2015-04-20 09:38:49 +00:00
Robert Osfield
f26be0155c From Lionel Largarde, "fix for the Image::computeNumberOfMipmapLevels method. The method did use the float version of the log function and the / operator.
It works for most of the input sizes, but fails for 8192, 32768...
For 8192, the method returns 13 instead of 14."



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14815 16af8721-9629-0410-8352-f15c8da7e697
2015-04-01 09:37:53 +00:00
Robert Osfield
9eb02084a6 Removed unimplemented ComputeBoundingBoxCallback and ComputeBoundingSphereCallback
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14799 16af8721-9629-0410-8352-f15c8da7e697
2015-03-17 09:10:59 +00:00
Robert Osfield
bd82047acb Added missing references for static build
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14797 16af8721-9629-0410-8352-f15c8da7e697
2015-03-17 08:26:13 +00:00
Robert Osfield
f9a20d017a From Konstantin Matveyev, "Last update in the osgAnimation::Animation ONCE mode bug fix"
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14790 16af8721-9629-0410-8352-f15c8da7e697
2015-03-16 10:30:51 +00:00
Robert Osfield
5878a70ede Reverted merged from svn/trunk.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14787 16af8721-9629-0410-8352-f15c8da7e697
2015-03-13 08:13:59 +00:00
Robert Osfield
57d04290ab From Konstantin Matveyev, "Small fix for OSG 3.3.6.119 in the attachment.
One line added in osg/LibraryWrapper.cpp

USE_SERIALIZER_WRAPPER(Callback)
"



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14785 16af8721-9629-0410-8352-f15c8da7e697
2015-03-13 08:12:19 +00:00
Robert Osfield
ceda86b31b From Laurens Voerman, "attached is a zip with a modified version of:
OpenSceneGraph\CMakeModules\FindFBX.cmake

This version can find fbx sdk 2015.1 and will prefer it over older versions.

Tested with Visual Studio Express 2013 on 64bit windows 7"


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14783 16af8721-9629-0410-8352-f15c8da7e697
2015-03-12 15:12:57 +00:00
Robert Osfield
499e38ff98 Warning fixes
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14779 16af8721-9629-0410-8352-f15c8da7e697
2015-03-11 17:47:30 +00:00
Robert Osfield
3461d9e8b5 From Laurens Voerman, "The current version will not compile with SDL version 2, error
OpenSceneGraph\src\osgPlugins\sdl\JoystickDevice.cpp(42): error C2664: 'const char *SDL_JoystickName(SDL_Joystick *)' : cannot convert argument 1 from 'int' to 'SDL_Joystick *'
due to changes in the SDL api.

Tested with Visual Studio Express 2013; SDL 2.0.1"


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14777 16af8721-9629-0410-8352-f15c8da7e697
2015-03-11 17:37:33 +00:00
Robert Osfield
4a535fe426 Updated RC to 2.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14763 16af8721-9629-0410-8352-f15c8da7e697
2015-03-05 18:00:54 +00:00
Robert Osfield
fc7302ccba Updated AUTHORS file for next release candidate
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14762 16af8721-9629-0410-8352-f15c8da7e697
2015-03-05 18:00:16 +00:00
Robert Osfield
7f4d116391 Restructed the checks in the CollectLowestTransformsVisitor::removeTransforms() to avoid benign case being flagged as warning.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14754 16af8721-9629-0410-8352-f15c8da7e697
2015-03-03 12:56:10 +00:00
Robert Osfield
edf27e36ed Re-organized the #ifdef's to avoid usage of glPolyginMode under GLES
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14750 16af8721-9629-0410-8352-f15c8da7e697
2015-03-03 12:00:22 +00:00
Robert Osfield
c8d8a051ad From Michael McDonnell, Merged enchancements to osgtesselationshader example from OSG-svn/trunk to OSG-3.2 branch.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14746 16af8721-9629-0410-8352-f15c8da7e697
2015-03-02 11:08:59 +00:00
Robert Osfield
4c9e17fcc7 From Jannik Heller, "I noticed the rotation in the OrbitManipulator depends on the framerate. To reproduce this issue, start the osganimate example, rotate the model with the left mouse button, then let go of the mouse button while still moving. You will notice that with V-Sync enabled, the model rotates slower.
The OrbitManipulator calculates a scale to counteract the framerate dependency, but it turns out this scale wasn't used for the rotation yet."


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14743 16af8721-9629-0410-8352-f15c8da7e697
2015-03-01 11:08:51 +00:00
Robert Osfield
95853370e1 Updated AUTHROS, Controbitors and rc number in prep for the 3.2.2-rc1
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14741 16af8721-9629-0410-8352-f15c8da7e697
2015-02-27 10:15:45 +00:00
Robert Osfield
c90cc658a0 Updated AUTHORS
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14734 16af8721-9629-0410-8352-f15c8da7e697
2015-02-26 20:06:11 +00:00
Robert Osfield
7c8ab128a6 From Bradley Baker Searles, "We had someone replace a DDS texture with a GL_RGB/GL_UNSIGNED_SHORT_5_6_6 image, which would trigger a crash in Image.cpp while flipping the mipmap chain. The code was trying to flip the mipmaps using the rowStep for the full-size image (we have "dds_flip" set in the osgDB::ReaderWriter::Options in the osgDB::Registry)."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14731 16af8721-9629-0410-8352-f15c8da7e697
2015-02-26 19:13:46 +00:00
Robert Osfield
1185fbda34 From Bradley Baker Searles, "Small patch attached to handle DDS flip when s=4. Currently it will omit flipping and generate a warning: "Vertical flip was skipped. Image dimensions have to be multiple of 4."."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14730 16af8721-9629-0410-8352-f15c8da7e697
2015-02-26 18:07:25 +00:00
Robert Osfield
005e52144d Fixed typo
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14726 16af8721-9629-0410-8352-f15c8da7e697
2015-02-26 14:16:36 +00:00
Robert Osfield
b6f05114dc Fixed image allocation operations.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14713 16af8721-9629-0410-8352-f15c8da7e697
2015-02-23 20:28:37 +00:00
Robert Osfield
8bb91a5265 From Arjun Ramamurthy, fix for StatsHandler when being used in multiple view/windows
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14710 16af8721-9629-0410-8352-f15c8da7e697
2015-02-23 11:07:35 +00:00
Robert Osfield
13f2cb3f47 From Sebastian Messerschmidt,"Attached you find a version of the ReaderWriterDDS with info outputs set to OSG_INFO instead of OSG_NOTICE. The old version spams the console for each loaded DDS file."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14702 16af8721-9629-0410-8352-f15c8da7e697
2015-02-18 10:23:43 +00:00
Robert Osfield
dab3efadce Updated ChangeLog
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14649 16af8721-9629-0410-8352-f15c8da7e697
2015-01-06 15:10:48 +00:00
Robert Osfield
6f004ef7db From Julien Valentin, added missing initializer
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14648 16af8721-9629-0410-8352-f15c8da7e697
2015-01-06 14:55:10 +00:00
Robert Osfield
6895e29417 From Julien Valentin, typo fix
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14645 16af8721-9629-0410-8352-f15c8da7e697
2015-01-06 14:41:18 +00:00
Robert Osfield
6cf1db199c Added comment about using -DCMAKE_DISABLE_FINDPACKAGE_* command line.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14631 16af8721-9629-0410-8352-f15c8da7e697
2014-12-22 10:35:30 +00:00
Robert Osfield
d4e5c72ebc Added doxygen comment for ref_ptr<>::release().
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14629 16af8721-9629-0410-8352-f15c8da7e697
2014-12-22 09:50:08 +00:00
Robert Osfield
3dd2816414 From Mattias Helsing, "CMake have release 3.0 and 3.1 and we have some bad checks for cmake
major version when settings cmake policies in CMakeLists.txt. This fixes it"


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14619 16af8721-9629-0410-8352-f15c8da7e697
2014-12-18 15:59:06 +00:00
Robert Osfield
eeadbae72d Updated AUTHORS
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14618 16af8721-9629-0410-8352-f15c8da7e697
2014-12-18 11:37:54 +00:00
Robert Osfield
b203faaa22 From Adrian Clark, "Recently I tried compiling version 3.x of OpenSceneGraph for Android, using a recent Android NDK, only to run into problems with missing dependencies when trying to link my android project against the generated libraries.
After some exploration, I found the problem is because the APP_PLATFORM variable in Application.mk is set to a platform number which is no longer compatible with the Android NDK by the OSG CMake toolchain. This causes the Android to compile it using the most recent Android platform libraries which (for reasons I don't know) no longer provide functions which OSG relies (in particular rand and stat64).



This bug affects the current SVN repos for OSG 3.3.1, OSG 3.3.0, OSG 3.2.1 and OSG 3.2.0 (and possibly earlier).



I posted a longer discussion of what the problem is in this forum thread:

http://forum.openscenegraph.org/viewtopic.php?p=62012#62012





But essentially the fix is to change one line in OSG/PlatformSpecifics/Android/Application.mk.master.in from:



APP_PLATFORM := ${ANDROID_PLATFORM}



To



APP_PLATFORM := android-${ANDROID_PLATFORM}





The attached file will fix the bug in the 3.2.0 - 3.3.1 SVN repos for OSG.

"


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14612 16af8721-9629-0410-8352-f15c8da7e697
2014-12-18 09:20:40 +00:00
Robert Osfield
324dc573a0 From Farshid Lashkari, "The Collada loader would crash while processing textures on certain files. I've attached the fix."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14596 16af8721-9629-0410-8352-f15c8da7e697
2014-12-10 11:30:02 +00:00
Robert Osfield
750cd78178 Fixed memory leak in RenderStageCache.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14579 16af8721-9629-0410-8352-f15c8da7e697
2014-12-08 11:08:48 +00:00
Robert Osfield
b5179e247f Fixed warnigns
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14548 16af8721-9629-0410-8352-f15c8da7e697
2014-11-26 17:07:51 +00:00
Robert Osfield
84ec88cc25 Removed redundent line endings
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14547 16af8721-9629-0410-8352-f15c8da7e697
2014-11-26 17:07:07 +00:00
Robert Osfield
7a9e97877c Fixed deprecated warnings
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14544 16af8721-9629-0410-8352-f15c8da7e697
2014-11-26 16:29:43 +00:00
Robert Osfield
0bedd4c43a Fixed warning
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14543 16af8721-9629-0410-8352-f15c8da7e697
2014-11-26 16:15:50 +00:00
Robert Osfield
d1b9bdbbbe Fixed warnings
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14541 16af8721-9629-0410-8352-f15c8da7e697
2014-11-26 16:07:46 +00:00
Robert Osfield
c923584158 Removed redudent spaces
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14540 16af8721-9629-0410-8352-f15c8da7e697
2014-11-26 16:06:55 +00:00
Robert Osfield
c789f7bced Fixed warning
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14538 16af8721-9629-0410-8352-f15c8da7e697
2014-11-26 16:02:06 +00:00
Robert Osfield
18810de975 From Jan Klimke, "i noticed, that there are a couple of additional flaws when building osg for Mac OS X 10.10 Yosemite.
The mac os sdk version is recognized by the current CMAKE script as 10.1 instead of 10.10 since it cuts the version string from the 4th place. I introduced a more reliable version checking based on splitting the returned version code into MAJOR MINOR and PATCH parts and reassemble the OSG sdk version afterwards.

I replaced the existing CMake code against the following (returning now version 10.10 as expected):

 # Determine the canonical name of the selected Platform SDK
   EXECUTE_PROCESS(COMMAND "/usr/bin/sw_vers" "-productVersion"
                   OUTPUT_VARIABLE OSG_OSX_SDK_NAME
                   OUTPUT_STRIP_TRAILING_WHITESPACE)
   STRING(REPLACE "." ";" MACOS_VERSION_LIST ${OSG_OSX_SDK_NAME})
   LIST(GET MACOS_VERSION_LIST 0 MACOS_VERSION_MAJOR)
   LIST(GET MACOS_VERSION_LIST 1 MACOS_VERSION_MINOR)
   LIST(GET MACOS_VERSION_LIST 2 MACOS_VERSION_PATCH)

   SET(OSG_OSX_SDK_NAME "macosx${MACOS_VERSION_MAJOR}.${MACOS_VERSION_MINOR}")

Also i added the check for the new Version to some more find scripts.

Additionally the nil object in Objective C now seems to be equivalent with a null_ptr that cannot be passed as GLInt anymore. So i switched this in the PixelBufferCocoa.mm to pass a zero instead of nil.
"


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14528 16af8721-9629-0410-8352-f15c8da7e697
2014-11-24 15:24:31 +00:00
Robert Osfield
e3ba4c82e4 Fixed handling of viewer's Camera
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14525 16af8721-9629-0410-8352-f15c8da7e697
2014-11-24 14:10:40 +00:00
Robert Osfield
ce82cfd25f From Alberto Luaces,"the current code uses the preprocessor for generating the plugin path in
a way that when CMAKE_INSTALL_PREFIX contains something along the lines
of

/usr/x86_64-linux-gnu/

it gets substituted as

/usr/x86_64-1-gnu/

that is, the string is preprocessed again, thereby making changes to
anything that matches any defined symbol, as "linux" in this example
(https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=763816).

Quoting that path directly in CMake scripts solves that problem.
"



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14521 16af8721-9629-0410-8352-f15c8da7e697
2014-11-21 20:16:13 +00:00
Robert Osfield
9c42d8f0da From Björn Blissing, fix for ambiguous defines in Atomic.cpp when compiling with MinGW and GCC
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14512 16af8721-9629-0410-8352-f15c8da7e697
2014-11-21 10:21:44 +00:00
Robert Osfield
2b4221c211 Copied Contributors file from svn/trunk.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14511 16af8721-9629-0410-8352-f15c8da7e697
2014-11-21 09:28:20 +00:00
Robert Osfield
7d04c3457a From Claus Steuer, "XCode 6, IOs 8.1 SDK Compile fix : There are some undefined texture formats when compiling osg for IOs 8.1 with XCode 6 and OpenGLES2 enabled."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14509 16af8721-9629-0410-8352-f15c8da7e697
2014-11-20 17:37:50 +00:00
Robert Osfield
166a8b6ccf From Farshid Lashkari, "The obj loader was overriding the existing database path list with the file path of the model, instead of prepending the file path to the path list. The latter seems to be more common behavior for most of the existing loader plugins. Also, the local options weren't actually being used when processing the scene graph for textures. I've attached the fix for both issues."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14506 16af8721-9629-0410-8352-f15c8da7e697
2014-11-20 16:38:17 +00:00
Robert Osfield
5cc425cf99 From Marc Helbling, "here is a trivial fix in the Inventor plugin. In one code path, the pointer validity is checked after dereferencing a pointer that can be null (image->valid()) instead of calling ref_ptr::valid (image.valid())."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14504 16af8721-9629-0410-8352-f15c8da7e697
2014-11-20 10:52:20 +00:00
Robert Osfield
f19a63e50d From Marc Helbling, "I've come across scenes that contains geometries with initialized but empty vertex arrays and primitives and that would make some optimizers crash.
The submission therefore only contains a test on the size of the vertex array for the VertexCacheMissVisitor and the VertexAccessOrderVisitor visitors."



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14502 16af8721-9629-0410-8352-f15c8da7e697
2014-11-20 10:45:03 +00:00
Robert Osfield
506f26d292 From Sukender, "Fix for 3DS reader, which may read wrong triangles. Actually, indices may suffer a 'short int' overflow, in two places."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14499 16af8721-9629-0410-8352-f15c8da7e697
2014-11-20 09:55:48 +00:00
Robert Osfield
c8d3571efd Fixed segfalt in Texture2DArray copy constructor where it would apply images to an uninitialzed vector.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14497 16af8721-9629-0410-8352-f15c8da7e697
2014-11-20 09:41:22 +00:00
Robert Osfield
1fa34dbbcc From Marc Helbling, "patch adding support for ambient material in the FBX plugin. It's a straightfoward adaptation of the emissive support and has been tested on a proprietary model."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14496 16af8721-9629-0410-8352-f15c8da7e697
2014-11-20 09:32:40 +00:00
Robert Osfield
3cabbb5a5a Added default setting of build type to Release
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14494 16af8721-9629-0410-8352-f15c8da7e697
2014-11-20 09:31:47 +00:00
Robert Osfield
0c052ce2ed From Pjotr Svetachov, fix for build breakage with giflib 5.0.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14492 16af8721-9629-0410-8352-f15c8da7e697
2014-11-20 09:21:48 +00:00
Robert Osfield
60bafc2050 Fixed contributors names
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14488 16af8721-9629-0410-8352-f15c8da7e697
2014-11-19 17:31:45 +00:00
Robert Osfield
0dd978df7a From Clement Boesch, "Fix remaining bit of Giflib5 usage"
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14487 16af8721-9629-0410-8352-f15c8da7e697
2014-11-19 17:31:00 +00:00
Robert Osfield
0ec0b79d6c From Laurens Voerman, "I found a new way to crach the osgviewer:
osgviewer "ProxyNode { FileNameList { cow.osgt } num_children 1 }".osgs

The proxy node reader wrongly assumes options to be non NULL.

fixed in attached zip:
src\osgWrappers\deprecated-dotosg\osg\ProxyNode.cpp

applies to both the 3.2 branch and svn trunk"


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14483 16af8721-9629-0410-8352-f15c8da7e697
2014-11-19 11:37:33 +00:00
Robert Osfield
9f0f107c66 Build fixes for ffmpeg LIBAVCODEC_VERSION_MAJOR >= 56
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14463 16af8721-9629-0410-8352-f15c8da7e697
2014-11-04 16:29:37 +00:00
Robert Osfield
cceb63ed12 Fixed MD2 danglng pointer crash.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14412 16af8721-9629-0410-8352-f15c8da7e697
2014-08-19 09:27:44 +00:00
Robert Osfield
e5185937c8 From Ryan Kawicki, "There is an issue where the model insets of a terrex terrain are being removed during the loading process. The issue is described below.
- the issue here is that the plugin is removing group nodes if
      that group node only has one child.  becuase transforms are also
      group nodes, there were cases when the transform would have only
      one child under it and would cause it to remove the translation
      portion.  this would cause all the vertex data to be loaded around
      the last matrix operation, which in our case was the origin (0,0,0).

We work off of OSG 2.8.1 but see that this has not been addressed on latest yet.  I’ve tested this against 2.8.1 and have cleanly applied it to my local repository off of latest."



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14406 16af8721-9629-0410-8352-f15c8da7e697
2014-08-08 16:42:31 +00:00
Robert Osfield
9221cab9c5 From Tim George, "Currently there is a problem with using a camera with a viewport with a non 0 offset and also using an FBO. The problem is that only area made up of the viewports width and height is drawn based on an offset of 0,0 instead of using the viewports offset.
It is caused by line 991 in RenderStage.cpp:


Code:
fbo_ext->glBlitFramebuffer(
0, 0, static_cast<GLint>(_viewport->width()), static_cast<GLint>(_viewport->height()),
0, 0, static_cast<GLint>(_viewport->width()), static_cast<GLint>(_viewport->height()),
blitMask, GL_NEAREST);



which is not taking into account the viewport x and y when performing the blit. It probably should be:


Code:
fbo_ext->glBlitFramebuffer(
static_cast<GLint>(_viewport->x()), static_cast<GLint>(_viewport->y()),
static_cast<GLint>(_viewport->width()) + static_cast<GLint>(_viewport->x()), static_cast<GLint>(_viewport->height()) + static_cast<GLint>(_viewport->y()),
static_cast<GLint>(_viewport->x()), static_cast<GLint>(_viewport->y()),
static_cast<GLint>(_viewport->width()) + static_cast<GLint>(_viewport->x()), static_cast<GLint>(_viewport->height()) + static_cast<GLint>(_viewport->y()),
blitMask, GL_NEAREST);
"

Note from Robert Osfield, made small tweak to above on merge, changing the width+x to x+width to make it read more naturally.



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14404 16af8721-9629-0410-8352-f15c8da7e697
2014-08-08 16:34:09 +00:00
Robert Osfield
4b687b7a86 From Marc Helbling, "please find a fix for the vertex pretransform visitor (VertexAccessOrderVisitor).
The issue with current code is that arrays are collected *before* duplicating shared arrays which leads to arrays that are correctly duplicated but that are not reordered.

Also the submitted patch contains a small cleaning in GeometryArrayGathrer as the _useDrawElements variable is not used; it is only set in the GeometryArrayGathrer constructor and VertexAccessOrderVisitor already checks that primitives have indexed type."


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14402 16af8721-9629-0410-8352-f15c8da7e697
2014-08-08 16:09:38 +00:00
Robert Osfield
f32d30d033 Applied fix to Node::remove*Callback(NodeCallback*) inspired by fix from Glen Waldron that was applied to svn/trunk.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14400 16af8721-9629-0410-8352-f15c8da7e697
2014-08-08 15:45:48 +00:00
Robert Osfield
c931140eaf Added catch for NULL Transform pointers getting into the _transformMap.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14387 16af8721-9629-0410-8352-f15c8da7e697
2014-07-29 15:47:51 +00:00
Robert Osfield
21a2cf6ff1 Removed usage of _appliedProgramObjectSet as it's no longer used by OSG applications and was causing a threading crash.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14379 16af8721-9629-0410-8352-f15c8da7e697
2014-07-22 16:35:28 +00:00
Robert Osfield
3416f91704 Updated version to 3.2.2
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14378 16af8721-9629-0410-8352-f15c8da7e697
2014-07-22 16:34:44 +00:00
Robert Osfield
7126619e40 Added setting of glPixelStore before glTexSubImage2D call.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14373 16af8721-9629-0410-8352-f15c8da7e697
2014-07-21 13:45:57 +00:00
Robert Osfield
12cf202cfc I want to submit a bugfix for a crash occurring in osgText/Glyph.cpp if
the scene tree contains (large) 2D textures from images with STRIDE.

============================================================================
#0  0x00007fffe8ea4350 in __memmove_ssse3 () from /lib64/libc.so.6
#1  0x00007fffe52ced76 in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#2  0x00007fffe52d8e86 in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#3  0x00007fffe53dd8be in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#4  0x00007fffe53c2643 in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#5  0x00007fffe53c7fdd in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#6  0x00007fffe53cbabf in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#7  0x00007fffe53cc1fa in ?? () from /usr/lib64/libnvidia-glcore.so.310.44
#8  0x00007ffff30092fd in osgText::GlyphTexture::apply (this=0x1bb8cf0, state=
    ...)
    at /d43/jaap/dev/jaapOSG/build/OpenSceneGraph3.3.1/src/osgText/Glyph.cpp:234
#9  0x00007ffff56c30b6 in osg::State::applyAttributeOnTexUnit (this=0x125f180,
    unit=0, attribute=0x1bb8cf0, as=...)
    at /d43/jaap/dev/jaapOSG/build/OpenSceneGraph3.3.1/include/osg/State:1713
#10 0x00007ffff56c2f3f in osg::State::applyTextureAttribute (this=0x125f180,
    unit=0, attribute=0x1bb8cf0)
    at /d43/jaap/dev/jaapOSG/build/OpenSceneGraph3.3.1/include/osg/State:411
#11 0x00007ffff30204da in osgText::Text::drawTextWithBackdrop (this=0x1baed70,
    state=..., colorMultiplier=...)
==============================================================================

The crash disappears if I either (1) disable the use of images with stride
in the (public) osgGeo-library, or (2) add the following bugfix to Glyph.cpp.
This combination gives me the confidence that I understand where this problem
originates from, without trying to understand the full OpenGL details.

===============================================================================
@@ -221,7 +223,12 @@
             imageData[i] = 0;
         }

+        glPixelStorei(GL_UNPACK_ALIGNMENT,1);

+        #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
+        glPixelStorei(GL_UNPACK_ROW_LENGTH,getTextureWidth());
+        #endif
+
         // allocate the texture memory.
         glTexImage2D( GL_TEXTURE_2D, 0, GL_ALPHA,
                 getTextureWidth(), getTextureHeight(), 0,
================================================================================

I have copied (and adapted) the added lines above from the same source file,
where they were used in front of a similar call to glTexSubImage2D(.) around
line 515."



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14371 16af8721-9629-0410-8352-f15c8da7e697
2014-07-21 13:43:10 +00:00
Robert Osfield
ae81ca6b6e Updated ChangeLog and README for release
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14362 16af8721-9629-0410-8352-f15c8da7e697
2014-07-04 11:34:44 +00:00
Robert Osfield
27bfc09c7a Updated version number to 3.2.1 for release
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14361 16af8721-9629-0410-8352-f15c8da7e697
2014-07-04 11:29:02 +00:00
Robert Osfield
ea5857c8d5 Updated RC number
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14359 16af8721-9629-0410-8352-f15c8da7e697
2014-07-04 08:52:29 +00:00
Robert Osfield
fb7f800ba7 Updated release candidate number and ChangeLog for 3.2.1-rc6
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14354 16af8721-9629-0410-8352-f15c8da7e697
2014-07-03 14:20:46 +00:00
Robert Osfield
0ecaf90a7c Updated NEWS in prep for 3.2.1 release
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14353 16af8721-9629-0410-8352-f15c8da7e697
2014-07-03 14:13:01 +00:00
Robert Osfield
32fe2f09d4 Added vertical destructors
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14352 16af8721-9629-0410-8352-f15c8da7e697
2014-07-03 13:06:56 +00:00
Robert Osfield
46c52f2a97 Merged fix from svn/trunk to handlng of file type of nested files within a .osgx, .osgt and .osgb file.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14345 16af8721-9629-0410-8352-f15c8da7e697
2014-07-02 14:14:57 +00:00
Robert Osfield
dfd59cbfe1 Added #include <stdint.h> to address compile issue on some Linux distro's.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14342 16af8721-9629-0410-8352-f15c8da7e697
2014-07-01 07:31:48 +00:00
Robert Osfield
81b32a3d89 Add dds no flip on write option to prevent output of .dds volume from being flipped by the dds plugin.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14340 16af8721-9629-0410-8352-f15c8da7e697
2014-06-30 15:31:39 +00:00
Robert Osfield
98889b7331 Updated ChangeLog and AUTHORS file
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14336 16af8721-9629-0410-8352-f15c8da7e697
2014-06-30 10:22:37 +00:00
Robert Osfield
4fefd87b80 From Mikhail Izmestev, "Attached fix to avoid vector reallocs on push_back in StateGraph::moveStateGraph."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14335 16af8721-9629-0410-8352-f15c8da7e697
2014-06-30 10:13:22 +00:00
Robert Osfield
586c177db9 Updated ChangeLog and AUTHORS file
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14333 16af8721-9629-0410-8352-f15c8da7e697
2014-06-30 09:13:04 +00:00
Robert Osfield
b138fa8ab7 Updated RC number
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14330 16af8721-9629-0410-8352-f15c8da7e697
2014-06-30 08:55:36 +00:00
Robert Osfield
5aa7acd92b From Pjotr Svetachov, "Here is a small fix for a overflow when editing large 3d volume data."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14328 16af8721-9629-0410-8352-f15c8da7e697
2014-06-30 08:46:53 +00:00
Robert Osfield
a4a684cb07 Removed space from #include.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14327 16af8721-9629-0410-8352-f15c8da7e697
2014-06-30 08:20:31 +00:00
Robert Osfield
d009dec52f Merged librsvg-2.0>=2.35 version check from svn/trunk.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14325 16af8721-9629-0410-8352-f15c8da7e697
2014-06-30 07:39:16 +00:00
Robert Osfield
9d14c9908e From Alexander Sinditskiy, build fix to allow building against versions older than librsvg-2.36.2
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14324 16af8721-9629-0410-8352-f15c8da7e697
2014-06-30 07:37:09 +00:00
Robert Osfield
cd5e4a999b Removed unused method.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14317 16af8721-9629-0410-8352-f15c8da7e697
2014-06-27 15:55:02 +00:00
Robert Osfield
46e53047bc From Laurens Voerman, "attached is a modified version of src/osgUtil/Tessellator.cpp
current code checks for a Nullpointer and on notify level info or above will inform you with a crash, by dereferencing it."



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14316 16af8721-9629-0410-8352-f15c8da7e697
2014-06-27 15:48:41 +00:00
Robert Osfield
1d120f7814 Updated AUTHORS file
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14314 16af8721-9629-0410-8352-f15c8da7e697
2014-06-27 15:39:56 +00:00
Robert Osfield
2c25825800 Added a render order sort to the list of Cameras being tested by the *Viewer::generatePointerData(..) method to ensure that the highest Camera gets focus.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14311 16af8721-9629-0410-8352-f15c8da7e697
2014-06-27 15:38:48 +00:00
Robert Osfield
2f83db9442 Added a render order sort to the list of Cameras being tested by the *Viewer::generatePointerData(..) method to ensure that the highest Camera gets focus.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14308 16af8721-9629-0410-8352-f15c8da7e697
2014-06-27 15:30:50 +00:00
Robert Osfield
78a59c33bd Updated AUTHORS file
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14307 16af8721-9629-0410-8352-f15c8da7e697
2014-06-27 15:26:03 +00:00
Robert Osfield
ec8a784d90 Updated ChangeLog for 3.2.1-rc4
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14305 16af8721-9629-0410-8352-f15c8da7e697
2014-06-26 15:54:37 +00:00
Robert Osfield
949d6f20e5 Updated RC number to 4.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14304 16af8721-9629-0410-8352-f15c8da7e697
2014-06-26 15:18:56 +00:00
Robert Osfield
ce51923f87 From Sebastian Messerschmidt, "I've applied a simple fix for the backward animation support in osg::Sequence.
It will simply use the sign of the speed set in the getNextValue. Attached file is against trunk."


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14301 16af8721-9629-0410-8352-f15c8da7e697
2014-06-26 11:49:58 +00:00
Robert Osfield
1571ac72b7 From Laurens Voerman, "In order to speed up loading large scenes (especially from network disk) I added code to our viewer to setup multiple database-pagers and request the files trough a database-request:
databasePager->setUpThreads(16, 1);

We experienced problems with multiple databasepagers loading files in parallel, when two threads start to load the same file (usually a texture referenced by multiple models). The second thread to add the file to the cache (sometimes) manages to do so while the refcount from the cached object still is zero, causing the object loaded to be destroyed.
Sometimes the second thread manages to ref() the object before Referenced::signalObserversAndDelete does the final recount check, causing a warning:
    "Warning Referenced::signalObserversAndDelete(,,) doing delete with _refCount=1"

With a deleted object added to the scenegraph we get some undesired results, I think the program only crashes if the object was a Node, and just has some untextured surfaces if it was a texture, but I'm not completely sure.

Attached is a modified version of the Registry.cpp, returning the object in cache and let the duplicate loaded object to be destroyed.

A more efficient option would be to add some sort of blocking entry to the objectcache to stop the second thread from reading the file, and just wait until the first thread added it to the cache. If you think that's worthwile we would be happy to implement that version. A bit tricky to implement and test, that's why I submit a simple version that stops my program from crashing.
"


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14299 16af8721-9629-0410-8352-f15c8da7e697
2014-06-26 11:11:38 +00:00
Robert Osfield
64bef29848 Removed erroneous character
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14297 16af8721-9629-0410-8352-f15c8da7e697
2014-06-26 11:09:21 +00:00
Robert Osfield
fc0c2a76c1 From Farshid Lashkari,
"I noticed that Text3D objects would change there z alignment depending on the alignment mode. I'm not sure if this was intentional or just a simple mistake. My expectation was that the front of the object would always stay aligned to the 0 z-plane, regardless of the alignment mode. I've attached an updated version that retains a consistent z-alignment."
"I just now noticed another issue with Text3D objects. It was not properly computing the bounding box when non-axis aligned rotations were being applied. In this case all corners of the bounding box need to be transformed in order to get the correct containing box. I've attached the updated file."
"The incorrect bounding box problem also applies to regular Text objects. I've attached the fix for that as well as the original Text3D fix."



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14295 16af8721-9629-0410-8352-f15c8da7e697
2014-06-26 10:53:16 +00:00
Robert Osfield
fb09bd6c12 From Laurens Voerman, "while debugging ImageSequence I had a crash, due to the very large frametimes caused by halting the program. The problem is that when the frame time exceeds the length of the entire image sequence, a looping sequence will try to read it's _imageDataList beyond its size.
fix attached for  src/osg/ImageSequence.cpp"



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14292 16af8721-9629-0410-8352-f15c8da7e697
2014-06-26 10:24:39 +00:00
Robert Osfield
94e7f4e860 From Laurens Voerman, "while testing databasepager stuff I noticed that the various loaders (osg/ive/osgx) do not pass the current options to the imagePager, therefore the images cannot be found if not in the global OSG_FILE_PATH. Attached is a fix, containing modified versions of
From Robert Osfield, add check to only apply Options object when a valid Option object is assigned.

src\osgPlugins\ive\ImageSequence.cpp
src\osgWrappers\deprecated-dotosg\osg\ImageSequence.cpp
src\osgWrappers\serializers\osg\ImageSequence.cpp"


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14291 16af8721-9629-0410-8352-f15c8da7e697
2014-06-26 10:05:55 +00:00
Robert Osfield
1ca2ed9729 From Farshid Lashkari, "I've attached a small fix for the ply loader to support Windows style line endings when reading the header."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14289 16af8721-9629-0410-8352-f15c8da7e697
2014-06-26 09:39:16 +00:00
Robert Osfield
f86acab9b2 From Aurelien Albert, "This submission fix all my problems with reading / writing "osgb" files inside "osga" archive with final archive size > 2 Go, with Windows OS (didn't tested with Linux)"
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14286 16af8721-9629-0410-8352-f15c8da7e697
2014-06-26 09:33:54 +00:00
Robert Osfield
5461ca4b6f From Riccardo Corsi, "there's an inconsistency between the behavior of the method and the
debug message it prints out on the console.

Around line 1040 of Registry.cpp (see code below) the method returns
"simpleFileName" but prints about returning "filename".

In attachment the modified file, based on osg 3.2.0
ricky


<code>
if(fileExists(simpleFileName))
{
    OSG_DEBUG << "FindFileInPath(" << filename << "): returning " <<
filename << std::endl;
    return simpleFileName;
}
</code>
"



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14284 16af8721-9629-0410-8352-f15c8da7e697
2014-06-25 16:05:53 +00:00
Robert Osfield
0f797078f0 Refactored the way that hole are pruned from the occluder hole list.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14281 16af8721-9629-0410-8352-f15c8da7e697
2014-06-25 15:47:54 +00:00
Robert Osfield
14332e5ca1 From Laurens Voerman, "a minor patch for osgconv to make sure the helptext is printed if you run "osgconv -h" with OSG_NOTIFY_LEVEL set too low.
applys to both trunk and stable branch."


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14279 16af8721-9629-0410-8352-f15c8da7e697
2014-06-25 11:07:57 +00:00
Robert Osfield
2f8a4c654a From Mikhail Izmestev, "Attached fix to avoid vector usage in StateGraph::prune and reduce heap allocations."
Notes from Robert Osfield, ammended the erase so that it explictly increments the iterator before the erase call.



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14278 16af8721-9629-0410-8352-f15c8da7e697
2014-06-25 10:45:35 +00:00
Robert Osfield
832fb9798e From Björn Blissing, "I found a minor error in documentation in include/osg/Math.
Function: absolute() had the same description as the function minimum()

I removed the erroneous text."


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14274 16af8721-9629-0410-8352-f15c8da7e697
2014-06-25 08:21:40 +00:00
Robert Osfield
79b0f8c839 From Björn Blissing, "Fix to support correct shininess and transparency in FBX plugin
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14271 16af8721-9629-0410-8352-f15c8da7e697
2014-06-25 08:17:59 +00:00
Robert Osfield
8d41495014 From Pjotr Svetachov, "There were some modes missing when exporting to .ogst so I added them."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14270 16af8721-9629-0410-8352-f15c8da7e697
2014-06-24 19:57:45 +00:00
Robert Osfield
fb28e0ffa1 "I've attached a small for the osg ReaderWriter. It was performing a case sensitive comparison to the file extension to determine whether to write the file in ascii or binary. This meant that if the filename was "model.OSGT" it would be treated as binary, instead of ascii. I've updated the plugin to ignore case."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14268 16af8721-9629-0410-8352-f15c8da7e697
2014-06-24 14:59:04 +00:00
Robert Osfield
cb3ce747ca Fix to merge Geometries.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14266 16af8721-9629-0410-8352-f15c8da7e697
2014-06-24 11:24:48 +00:00
Robert Osfield
a6939bc46f Fixed check against number of vertices
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14263 16af8721-9629-0410-8352-f15c8da7e697
2014-06-16 16:18:02 +00:00
Robert Osfield
773d0a2ddf From Aurelien Albert, "I've got some issues using osgb files within an big osga archive (file size > 2Go).
Issue is described here : http://forum.openscenegraph.org/viewtopic.php?t=13914

Here is a fix, using "std::streampos" standard type for stream positions up to 64bits.
"



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14260 16af8721-9629-0410-8352-f15c8da7e697
2014-06-16 08:54:51 +00:00
Robert Osfield
1b3dba7860 Removed generation of scroll event on the X11 button release event as X11 was generating both a pair of press/release events for a single scroll when movement.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14256 16af8721-9629-0410-8352-f15c8da7e697
2014-06-12 16:00:20 +00:00
Robert Osfield
f127220582 Added if () blocks to State::convertVertexShaderSourceToOsgBuiltIns() to ensure that only parts of the shader than need replacing are replaced.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14254 16af8721-9629-0410-8352-f15c8da7e697
2014-06-12 15:24:31 +00:00
Robert Osfield
52abe9503f Updated release candidate for 3.2.1-rc3 2014-05-22 14:52:26 +00:00
Robert Osfield
95acbe55b5 Upated ChangeLog and AUTHORS in prep for release candidate 2014-05-22 14:43:30 +00:00
Robert Osfield
3a5d834643 From Sebastian Messershmidt, "There was some small error due to MS non-conformity handling comments correctly." 2014-05-15 14:58:43 +00:00
Robert Osfield
2ab66723d5 From Pjotr Svetachov, "Today I found a bug in the IutputStream class when saving array
attributes in vec3b format. It looks like my compiler takes the wrong
overload and outputs integers instead of characters. The problem is
that vec3b is of type signed char and that is not the same as char (
see http://stackoverflow.com/questions/436513/char-signed-char-char-unsigned-char
) and visual studio 2013 will promote it to integer when choosing an
overload.
It looks like that the InputStream class already takes care of this
issue (if it didn't it would have read everything ok and I would have
not even stumbled upon this bug. :) )"
2014-04-29 13:41:33 +00:00
Robert Osfield
044e20911b From Pjotr Svetachov, "I had the osgvolume example crash on me when loading large volume
datasets due to an overflow in image.cpp after a unneeded cast from
unsigned int to int. Here is a small fix."
2014-04-28 14:58:33 +00:00
Robert Osfield
a256eac9c5 From Jason Beverage, "Here is a fix for a small race condition in osgDB::makeDirectory. It attempts to create all the directories in the given path and stops attempting to make directories when one of them fails. I've added a check to see if the failure occurred b/c the directory was created by another thread or process.
We were running into issues occasionally in osgEarth where multiple threads were writing out files like /1/2/3.jpg and /1/3/4.jpg.  Both threads would try to create the /1 directory and only one of them would succeed.  So the first thread would write out the full /1/2/3.jpg while the second thread wouldn't create the /1/3 directory b/c /1 was already created and the writing of /1/3/4.jpg would fail.
"
2014-04-28 14:57:01 +00:00
Robert Osfield
14b978369e Fixed type error 2014-04-28 11:53:53 +00:00
Robert Osfield
25aeb1dadc From Farshid Lashkari, "I've attached a small fix to the Collada loader which prevents a null pointer access in some cases." 2014-04-24 17:26:44 +00:00
Robert Osfield
762f0819ff In the ::apply method, when the image data need to be re-uploaded, the Texture2DArray checks if the TextureObject can be re-used. The test was made using the constant 1 instead of the real texture depth, so the TextureObject was never re-used. 2014-04-24 17:23:15 +00:00
Robert Osfield
0d30acccf1 Fixed reference invalidation bug. 2014-04-24 10:39:03 +00:00
Robert Osfield
5c73224c36 Fixed comment 2014-04-14 16:16:22 +00:00
Robert Osfield
b65f0043ef Renamed FindFreeType.cmake to FindFreetype.cmake to enable CMake build to pick up on CMake's own FindFreetype.cmake when it's available. 2014-04-13 16:04:25 +00:00
Robert Osfield
283b9d4447 Merged changes from svn/trunk to add the REMOVE_CXX_FLAGS macro 2014-04-13 16:03:17 +00:00
Robert Osfield
2d8b521e33 Disabled warnings that FBX headers are generating that we can't fix 2014-04-09 17:21:26 +00:00
Robert Osfield
a6df790b64 Added extra search files for K/Ubuntu 14.04 new location for freetype headers 2014-04-08 19:44:29 +00:00
Robert Osfield
c0ef8b8264 From Remo Eichenberger, "I have extended the TIFF plugin that allows you to write LZW or JPEG compressed TIFF's. Options are:
tiff_compression = lzw | jpeg"
2014-04-08 12:00:59 +00:00
Robert Osfield
8c0413e293 From Pjotr Svetachov, "We had a small problem converting skeleton animations from fbx to osgt
format. Turned out that the serializer didn't handle bone names with
spaces very well (the 3ds studio max biped for instance has spaces by
default). Here is a small fix for the problem."
2014-04-08 11:17:55 +00:00
Robert Osfield
a3288ea19a From Pjotr Svetachov, previous obj "commit broke compilation under visual studio 2013. To use std::not1 you need to include the functional header. Here is a fix." 2014-04-08 11:07:57 +00:00
Robert Osfield
eeeb18926a Fixed build when using of double BoundingBox/BoundingSphere 2014-04-07 15:04:32 +00:00
Robert Osfield
dcb01cf3e5 From Jan Peciva, "I am sending four fixes to obj plugin:
- materialName used to be not stripped of whitespace, making number of models
fail to load materials; now fixed
- stripping was considering spaces only, thus models using tabs had problems
to load correctly; fixed
- fixed references to textures; they did not performed conversion to native
directory separators
- make d (dissolve) takes precedence over Tr (transparency); there seems to be
a confusion about the Tr item - some claiming 1 to be opaque and 0
transparent, while number of models uses exactly the opposite. d (dissolve),
if present in the model, does not suffer from this confusion, thus using it
instead fixes the problem for many many models.

I put many comments to the file concerning d and Tr item as others may further
investigate. Let me know in the case of any problems."
2014-04-07 14:18:17 +00:00
Robert Osfield
6077e19029 From Marcel Pursche, "The problem is that when OpenThreads is build with the Linux pthreads implementation all threads inherit the processor affinity from their parent thread.
This behavior is also described in the pthreads man page (http://man7.org/linux/man-pages/man3/pthread_create.3.html):

>
> Linux-specific details
> The new thread inherits copies of the calling thread's capability
> sets (see capabilities(7)) and CPU affinity mask (see
> sched_setaffinity(2)).
>

To prevent this behaviour I wrote a patch that explicitly sets the affinity mask to all cores of the system, if no specific affinity was defined with PThread::setProcessorAffinity(unsigned int) .

Thank you!
"
2014-04-07 14:11:11 +00:00
Robert Osfield
34911d071e From Bjorn Blessing, "I got bored of the constant reports of “missing chunk 0xA08A” when reading 3ds-files. After a bit of research I discovered that this property is related to the advanced transparency settings for the material in 3D studio. In this case the falloff parameter. These controls affect the opacity falloff of a transparent material. And the property chooses whether falloff is in or out. I have added the property to the file reader BUT no changes are made to make this property propagate into the osgMaterial. But at least we get rid of this annoying error message." 2014-04-07 14:03:54 +00:00
Robert Osfield
21acda6898 From Paul Martz, "We discussed the issue of GL_RED_SNORM and GL_RG_SNORM some time ago, but the issue was never completely resolved. Please see the attached submission to fix the issue.
osg/GL2Extensions was incorrectly defining GL_RED_SNORM and GL_RG_SNORM as part of the definitions for OpenGL v3.1. However, a quick review of the 3.1 spec indicates that these are not part of the 3.1 standard.

My attached change moves these definitions out of the #ifndef GL_VERSION_3_1 conditional block, and defines them conditionally if not already defined. This allows the DDS plugin to build for GL3.
"
2014-04-07 13:48:11 +00:00
Robert Osfield
cdf9886a9e Improved white space trimming 2014-02-05 11:06:39 +00:00
Robert Osfield
d91c8b81cd Replaced C cast to long with a static_cast<const void*>() to avoid a build error under Mingw 64. 2014-01-31 19:18:22 +00:00
Robert Osfield
5a8aee3ede Updated ChangeLog 2014-01-29 11:08:29 +00:00
Robert Osfield
abefc9d8a8 Fixed MingW build's handling of debug d postfix. 2014-01-28 16:48:27 +00:00
Robert Osfield
8cbee2664f Disabled the compiler invocation at runtime. 2014-01-28 16:47:53 +00:00
Robert Osfield
ebbf2d1653 From Laurens Voerman, "I experienced a crash in Geometry::fixDeprecatedData(), on certain files, and brought the problem down to a very simple test file, attached as test3.zip.
There are two problems:
1> for DrawElementsUShortPrimitiveType (and UInt) the source_pindex still equals -1 and causes a crash
     in DrawElementsUBytePrimitiveType source_pindex is incremented, and in DrawElementsU(Short/Int)PrimitiveType primitiveNum is incremented, but never used

2> The drawelements need to be rewritten as the vertices are reordered.

created a patch for osg stable branch(r14038): attached as Geometry-osg-3.2.zip
and for svn brach(r14044): attached as Geometry_osg_svn.zip"
2014-01-24 17:31:03 +00:00
Robert Osfield
aa81404a41 From Aurelien Albert, "In the "apply" method of osg::FrameBufferObject, the draw buffers are always enabled, even if the target is only "READ_FRAMEBUFFER".
This can lead to inconsistency if you bind a framebuffer with multiple attachments in DRAW mode and then a framebuffer with different attachment count in READ mode (for example to manually "blit" from a FBo to another).

On some ATI cards (at least RADEON HD) this also leads to an "incomplete " FBO status

I've added a test to enable drawbuffers only if target is "DRAW" or "READ_DRAW", this solves my problems on ATI cards."
2014-01-24 17:06:33 +00:00
Robert Osfield
a69d12af10 From Michael Schanne, "small fix for a duplicate OR operand in KdTree.cpp." 2014-01-24 16:45:46 +00:00
Robert Osfield
1102058f31 From Torben Dannahuer, "modified findcollada.cmake which can now detect Boost 1.55 libraries, which are used by Collada in my 3rdParty package" 2014-01-24 16:28:28 +00:00
Robert Osfield
684b4d8bf5 From Torben Dannhauer, VisualStudio 2013 build fixes 2014-01-24 16:24:59 +00:00
Robert Osfield
69fd9d7530 From Marc Helbling, "I am sending a small fix in the PLY pseudo-loader; the extension was checked in plyfile.cpp thus preventing the loading of any .PLY file (extension in uppercase). The extension filtering is already handled by ReaderWriter::acceptsExtension in a case unsensitive way." 2014-01-24 16:02:00 +00:00
Robert Osfield
6ffe11dda5 Fixed warnings 2014-01-23 19:55:35 +00:00
Robert Osfield
a8e7dbd9ce Cleaned up the Qt find package, and made changed the default threading model to SingleThreaded when using Qt5 to avoid crash due to regresssion since Qt4. 2014-01-23 10:09:57 +00:00
Robert Osfield
a2e1dc04bf Added clean up of osg::Program that are applied by the GLObjectsVisitor, which addresses a state leak that creates GL error once the main scene graph is rendered. 2014-01-23 09:41:16 +00:00
Robert Osfield
7b39cbddfd Added GL_TEXTURE_2D_MULTISAMPLE to texture mode list. 2014-01-23 07:59:53 +00:00
Robert Osfield
eaca0d3d3d From Stephan Huber, OSX build fix 2014-01-17 18:22:16 +00:00
Robert Osfield
2665191aed From Kristofer Tingdahl, "the patch I sent to src/osgQt/CMakeModules.txt did not do the work on windows. I have fixed that, and also made it more generic so there is no special handling of qt5.2, but all qt5 are the same.
I have tested this on:

mac/qt5.2
linux/qt5.2
windows/qt5.2, and
mac/qt5.1

All platforms perform as expected.

The previous fix removed the -f flag to the moc-pre-processor, but on windows, it turned out that -f "osgQt/QGraphicsViewer" was needed.

This becomes an include-statement in the file generated by moc which is needed for compiling it. I ask you consider this patch for the trunk and the 3.2 branch.


Secondly, I wonder if it would be possible to apply my patch for FindRSVG.cmake from 22nd November in the 3.2 branch.

In short, the version of librsvg must be equal or higher to 2.35:

PKG_CHECK_MODULES(RSVG librsvg-2.0>=2.35)
"
2014-01-17 14:02:46 +00:00
Robert Osfield
ed2b25e32c From Jordi Torres, "Fixed a typo in ReaderWriterCURL::ReaderWriterCURL() changed Psuedo for Pseudo." 2014-01-17 13:53:54 +00:00
Robert Osfield
acdebc99bc From Farshid Lashkari, "I've attached a fix for the Collada loader that prevents a crash with some files containing textures. I also converted an OSG_NOTICE to OSG_INFO to be consistent with other log messages within the loader." 2014-01-08 10:32:58 +00:00
Robert Osfield
574b3eb573 Removed more odd characters 2014-01-08 10:31:24 +00:00
Robert Osfield
d32d406019 Removed more odd characters 2014-01-08 10:28:11 +00:00
Robert Osfield
8b3a85e6bc Removed odd characters 2014-01-08 10:24:32 +00:00
Robert Osfield
91660974e2 Removed execute permissions using svn propdel svn:executable file 2014-01-07 16:43:49 +00:00
Robert Osfield
0f547585d3 From Farshid Lashkari, "I've attached a small change to the DAE writer to support writing out unknown transform types. It will essentially treat it as a matrix transform, using the the local to world matrix value." 2014-01-07 16:29:20 +00:00
Robert Osfield
3ba5f22604 From Sebastian Messerschmidt, "Original shader was not running on various NVidia cards due to old syntax in shader." 2014-01-07 16:16:25 +00:00
Robert Osfield
64707b12f2 Updated SO_VERSION of OpenThreads to avoid conflicts with Debian increments to the SO version they have bumped for OpenThreads 2014-01-07 11:02:39 +00:00
Robert Osfield
7da5ae26d0 Added State::getMaxTextureCoords() and State::getMaxTextureUnits() inline methods. 2014-01-07 11:01:27 +00:00
Robert Osfield
485776bf18 Renamed the OSGSIM cmake variable to OSGSIM_LIBRARY to be consistent with the rest of the variables. 2014-01-06 10:23:31 +00:00
Robert Osfield
3eddec871a From Kristofer Tingdahl, "the syntax of the moc executable has changed between 5.1.1 and 5.2.0 versions of qt (see below). The difference is that the <file> argument has become mandatory after the -f option.
Hence, moc will complain when osg throws in a -f without anything after it. Hence I propose removing the -f on Qt5 builds. I have tested building without -f on both qt520 and qt511, and that works well.

The attached src/osgQt/CMakeLists.txt that can be patched into 3.2 safely. For the trunk, I would consider dropping the check on the version, and simply remove the option on qt5. I have tested that on qt5.1.1, and that worked fine. Question is however if it works on qt5.0. Probably it does, so the question is simplicity of CMakeList.txt vs safety."
2013-12-19 17:13:23 +00:00
Robert Osfield
f8f04cb04c From Mike Krus, compile fix to enable compiling across a wider set of versions. 2013-12-06 09:36:02 +00:00
Robert Osfield
4f11db1653 From Stephan Huber, workaround for Clang bug under Apple 2013-11-22 10:33:57 +00:00
Robert Osfield
63bd3be9cd Warning fixes 2013-11-22 10:27:20 +00:00
Robert Osfield
4ca088dcf9 Clean up of line endings 2013-11-22 10:10:14 +00:00
Robert Osfield
3ef97ddeea From Stephan Huber, "attached you’ll find some minor ios-fixes/-enhancements
* force _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC for IOS device + simulator as the test does not pick the right implementation
* fixed a small compile-bug for iphone-example
* added a check to prevent multiple realization of a GraphicsWindowIOS-object
"
2013-11-21 14:09:20 +00:00
Robert Osfield
31c54aa3e4 From Farshid Lashkari, "I recently encountered an issue attempting to load an IVE file generated by an older version of OSG. The file contained dxt1 compressed image data with mipmaps. The loaded model would cause crashes when passing the mipmap data to glCompressedTexImage2D. It seems that the size of the data array within the IVE file did not match the computed size from Image::getTotalSizeInBytesIncludingMipmaps(). This essentially made the mipmap offsets invalid within the Image object.
I'm not sure if the IVE was simply generated incorrectly, or if the Image::getTotalSizeInBytesIncludingMipmaps() was modified since the file was generated. Either way, I added a simple check in the IVE loader so that it clears the mipmap offsets if the actual data size does not match the computed data size. This seems like a safe fallback since the mipmap data can be automatically generated, and it fixes the problem in my case.

Also, while looking into this issue, I noticed that the osgDB::InputStream class applies the serialized image allocation mode. However, since the serializer is allocating the image data itself, it seems like it should force the allocation mode to USE_NEW_DELETE.
"
2013-11-21 13:58:36 +00:00
Robert Osfield
76c45c7731 Changed std::max to osg::minimum to addres build error under VS2013. 2013-11-21 11:00:50 +00:00
Robert Osfield
5efce09451 Removed -fpermissive flag from GCC build, and fixed warning 2013-10-25 15:48:15 +00:00
Robert Osfield
3f8e6d0a74 Added explict setting of the PolygonMode to over the distion mesh being toggled to wireframe. 2013-10-25 15:47:41 +00:00
Robert Osfield
9433947d2a Fixed warning 2013-10-24 20:22:05 +00:00
Robert Osfield
6f9b82142a Removed deprecated glib call 2013-10-24 19:56:14 +00:00
Robert Osfield
1dcc2555e7 Fixed FileInfo self initialization bug 2013-10-24 19:31:41 +00:00
Robert Osfield
27f9021df7 Fixed warnings 2013-10-22 16:28:03 +00:00
Robert Osfield
9af08d6715 From Colin McDonald, two submissions merged from svn/trunk:
"The osgb file reader uses seek to position within the file.
But the nested stream implementation for osga archive files doesn't
support seeking.  So osgb files can't currently be used in an osga
archive e.g. if osgdem is used to output a osgb format database it
can't be packaged in an archive file, in the same manner that ive
files could.

I've added seek support to the osga nested stream implementation."


"The osgt/osgb file formats output a scenegraph node with the type
set to "SCENE" in the file header.  But if the file is stored and
then extracted again from an osga archive this header info is lost,
and the resulting file is just an "OBJECT".  Possibly other plugin
operations would have the same effect.  The osgt/osgb plugin won't
then return the scenegraph contents.

I have updated the osgt/osgb plugin to return a node from an "OBJECT"
file."
2013-10-22 11:33:45 +00:00
Robert Osfield
5c4800c774 Fixed handling of in scene graph osg::Program being overriden by shader composition. 2013-10-22 11:17:29 +00:00
Robert Osfield
dfd8594042 From Robert Milharcic, workaround for ShaderComposer clean up bug. 2013-10-21 17:44:24 +00:00
Robert Osfield
be2d80abca Build fixes for clang 2013-10-21 09:56:57 +00:00
Robert Osfield
ca8f3d5f8a From Farshid Lashkari, "previously discussed change to the dae loader which applies the node ID as a "dae_node_id" user value." 2013-10-18 09:57:53 +00:00
Robert Osfield
790c0091e6 From Vladimir Chebeav, fix for removal of nested callbacks 2013-10-18 08:37:19 +00:00
Robert Osfield
ce58131cfc From Konstantin Matveyev, "Multiple light fix in FBX-importer" 2013-10-18 07:54:59 +00:00
Robert Osfield
309da2fe07 From Colin McDonald, "Added some missing updates to the serializer static build support." 2013-10-18 07:52:00 +00:00
Robert Osfield
97d706c640 Build fix 2013-10-17 18:34:16 +00:00
Robert Osfield
f14f58c486 Fix for error in getting the uniform block max name length, fix suggested by Christopher Fennell. 2013-10-17 18:29:38 +00:00
Robert Osfield
7c9cbc5ff9 From Pjotr Svetachov, "With the new osg::Geometry the binding for arrays now default to undefined. This breaks previously working code in osgAnimation::RigTransformHardware where the arrays got an undefined bounding and because of this the bone indices and weights were not loaded by the shader. Here is a little patch to fix this." 2013-10-10 20:42:21 +00:00
Robert Osfield
2a70ea9f64 Updated rc number 2013-10-07 10:40:10 +00:00
Robert Osfield
2f71509ebf From Stephan Huber, "attached you’ll find a bunch of fixes + enhancements for iOS and OS X based on current trunk. I incorporated + tested the submission from Colin Cochran, so his submission is not needed anymore.
* fixed a bug with multi-touch and touch-id-generation on iOS and OS X. (will fix a bug reported by Colin Cochran, without ditching the existing logic)
* removed unnecessary warning-flagss when generating xcode-projects via cmake, will enable the usage of OSG_AGGRESSIVE_WARNING_FLAGS
* added support for 10.9 (OS X)
* new cmake-variable: IPHONE_VERSION_MIN, this will set the deployment-target (previously hard-coded) If you set the IPHONE_VERSION_MIN to something like 7.0 osg gets compiled also for 64bit (amd64)
* cmake defaults now to the clang compiler if IPHONE_VERSION_MIN > 4.2
* cmake now sets some xcode-settings so the compiler uses the c++98-standard (clang defaults to c++11, w/o this I got a lot of linking errors)
* removed include-dir for avfoundation-plugin as not needed on OSX/IOS.
* enhanced the ios-example, will now show multitouch-information on a hud (similar to the  osgmultitouch-example), and more importantly, will compile + link out of the box
* small enhancements for the osc-device-plugin (send only one msg for MOVE/DRAG, even if multiple msgs/event is enabled)
* better memory-handling for the zeroconf-plugin
* fixed a possible bug in the rest-http-plugin when receiving mouse-events.
* incorporated a fix from Colin Cochran "forwarded touch events are not transformed into the GL UIView“
"
2013-10-07 10:38:58 +00:00
Robert Osfield
320c51aa96 Updated Controbutors to fix errors 2013-10-03 16:13:54 +00:00
Robert Osfield
8de7ad3fa3 Updated AUTHORS and ChangeLog for 3.2.1-rc1 2013-10-03 15:40:08 +00:00
Robert Osfield
316726445d Updated versions in prep for 3.2.1-rc1 2013-10-03 15:29:26 +00:00
Robert Osfield
eac772a841 Updated AUTHORS for for rc 2013-10-03 15:24:07 +00:00
Robert Osfield
f2428e961f From Dmitry Marakasov, "These are FreeBSD bits for src/osgPlugins/osc/osc/OscHostEndianness.h,
required to build newever OSG on this OS. Also corrects file name
in the error message - I was confused not to find OSCHostEndianness.h
after I've got this error.

Tested by successfully building OSG 3.2.0 with this patch on FreeBSD
9.1."
2013-10-02 11:29:56 +00:00
Robert Osfield
d636e89f9a From Björn Hein, "it seems that for generating "per vertex normals" as stated in the
comment, two of them are missing. This results in wrong display of
STL-files regarding normals. Following simple fix seems to work:

Index: ReaderWriterSTL.cpp
===================================================================
--- ReaderWriterSTL.cpp    (Revision 13797)
+++ ReaderWriterSTL.cpp    (Arbeitskopie)
@@ -108,6 +108,8 @@
                     ++itr)
                 {
                     perVertexNormals->push_back(*itr);
+                    perVertexNormals->push_back(*itr);
+                    perVertexNormals->push_back(*itr);
                 }

                 geom->setNormalArray(perVertexNormals.get(),
osg::Array::BIND_PER_VERTEX);
"
2013-10-02 11:09:22 +00:00
Robert Osfield
cb67c10b5f From Björn Blissing, "I propose making the following outputs a little bit more silent. In my mind it would suffice with OSG_DEBUG (compared to OSG_NOTICE) for these information messages." 2013-10-01 16:20:18 +00:00
Robert Osfield
7990effc06 From Christopher Baker, submitted by Alberto Luacas, "there is a bug report in the Ubuntu tracker that points to a bug when
loading multiple VRML files in parallel.  Christopher R. Baker has
detected this bug and crafted a patch.  In addition, libcoin has to be
also built with the "--enable-threadsafe" option.

I copy here his report, extracted from
(https://bugs.launchpad.net/ubuntu/+source/openscenegraph/+bug/1211993)
and attach his fix.  All credit is due to him:

«
There are three instances of a classical method-local-static
multithreaded initialization bug in the Inventor plugin for OSG that
trigger various memory faults when reading multiple VRML files in
parallel via osgDB::readNodeFile. These bugs are of the form:

static std::map<Stuff,OtherStuff> myHandyMap;
static bool once = true;
if(once) { ...fill myHandyMap; once = false }
... use myHandyMap;

To repeat: try loading multiple VRML files from multiple threads. The
liklihood of the bug depends on many factors, but my application, which
parallel-loads some dozens of small (<100K) VRML files on startup,
triggers this problem 25% of the time or more.

The attached patch (inventor-plugin-multithread.patch) rectifies this
problem by:

1 - Inheriting MyHandyMap from std::map, then
2 - Moving the map initialization into the derived constructor, which
3 - Is intrinsically protected from multithread issues by g++ (and is
part of the C++ standard), unless you pass -fno-threadsafe-statics,
which is strongly discouraged by the man page.
»
"
2013-10-01 09:37:54 +00:00
Robert Osfield
8d2c3db14c From Adrien Grandemange, "On Windows 7 and 8, mouse messages are generated in addition to touch messages, which leads to duplicate PUSH, DRAG and RELEASE events in OSG. Besides, the mouse and touch messages referring to the same user input are not necessarily sent at the same time, due to gesture translation done by Windows by default, such as double-tap => double-click and long-push => right-click.
The delay between the 2 types of messages is more noticeable on Windows 8 and leads to serious disruptions in our application.

Mouse messages generated by touch input are only present for legacy support. I think they should be filtered out by OSG (real click events originating from a physical mouse will of course still go through).

This is what this patch does, according to this suggestion: http://msdn.microsoft.com/en-us/library/dd693088%28v=VS.85%29.aspx (third issue in this page)."
2013-10-01 09:11:23 +00:00
Robert Osfield
04ea3aa6a2 From Thomas Hogarth, "Attached is a small build fix for PointSprite when compiling under GLES2 (r13788)
GL_POINT_SPRITE_OES does not exist in GLES2, instead you just draw using GL_POINTS then use gl_PointSize in a vertex shader to set the size."
2013-10-01 09:05:42 +00:00
Robert Osfield
d30a94bf4c 2013-09-30 18:32:44 +00:00
Robert Osfield
8ff77c10f9 From Farshid Lashkari, "I have a scene that makes heavy use of the StateSet::compare method and my profiler showed that a lot of time was being spent inside it. I made a small change to the method so that it performs a quick size comparison between the attribute/mode lists and bin mode before iterating through all the attributes. This made a noticeable improvement in my scene. I've attached the change." 2013-09-30 18:16:08 +00:00
Robert Osfield
76edd07195 Refactored the epsilon code to use the same one now used in svn/trunk. 2013-09-30 10:45:24 +00:00
Robert Osfield
0ab211cb7c Removed unnceccesary setNumChildrenRequiringUpdateTraversal from VolumeTile constructor. 2013-09-20 15:43:22 +00:00
Robert Osfield
0cd6a935e0 From Giuseppe Donvito, "I'm using OSG 320 and I need to flush a DDS 3D texture on disk.
I found a bug on DDS ReaderWriter that generates a false positive on a guard for the size check on writing operation. This is due to a wrong imageSize computation that uses img->getImageSizeInBytes() method instead of img->getTotalSizeInBytes(), that actually ignores the r() dimension, contrariwise taken into account by the function ComputeImageSizeInBytes() later.

The line 1062 on file ReaderWriterDDS.cpp should be fixed with:
[code]unsigned int imageSize = img->getTotalSizeInBytes();[/code]"
2013-09-10 15:18:34 +00:00
Robert Osfield
cab0f50371 From Giuseppe Donvito, Fixed typo of "CLEAR_GLOBAL_STATESET = 0x16," to indended "CLEAR_GLOBAL_STATESET = "0x10". 2013-09-10 13:29:28 +00:00
Robert Osfield
c62a57c006 From Colin Cochran, OES support for point sprites 2013-09-09 14:58:08 +00:00
Robert Osfield
fefe87ec13 osg uses osg::FBOExtensions to check if Frame Buffer Objects are
available.  But this just checks if the fbo functions can be called.
It doesn't check if the OpenGL renderer supports fbos.  For indirect
rendering on linux the client side capability may be different from
the display server, which can lead to mipmapped textures failing to
render.  I've added a fbo extension check.
2013-09-09 13:33:11 +00:00
Robert Osfield
8fd8036e33 From Ulrich Hertlein, "Patch for FindAVFoundation to work with OS X 10.9" 2013-09-09 12:44:32 +00:00
Robert Osfield
f653048d5f From Wang Rui, "Some developers report that the osgviewerMFC example is broken in 3.2, in which depth test is not enabled by default so all models loaded look awkward. I submit this patch to make it work again. I haven't gone deep to check why previous example goes wrong in newer version but I believe the problem was because the newly created camera object missed some important global statesets before set as the main camera." 2013-09-09 12:37:55 +00:00
Robert Osfield
caf56902c3 From Laurens Voerman, "two minor fixes, both in a CMakeList.txt file,
1> osgmultiplemovies example does not use SDL so needs no link to SDL

2> Added header files to "Plugins osg" project, so visual studio can find the source of
   OSG_WARN <<  "AsciiInputIterator::readProperty(): Unmatched property "
"
2013-09-09 12:33:20 +00:00
Robert Osfield
48498a1517 From Colin McDonald, "Attached are some fixes to build osg using the Solaris Studio compiler.
I've also checked the modified files still build ok with other
compilers (Linux gcc, Windows Visual Studio).

osgDB/OutputStream.cpp and osgPlugins/lws/SceneLoader.cpp require
stdlib.h for atoi use.

In osg/Uniform.cpp the compiler complains that base_class is unknown
unless I add a class name qualifier.

Not a build fix, but I spotted a typo in osgUtil/SceneView."
2013-09-05 10:23:24 +00:00
Robert Osfield
b86e644542 From Laurens Voerman, "like the "Bug in ProxyNode serializer" Farshid Lashkari found (svn submit 13754) the PagedLOD serializer attempts to read begin and and brackets.
Fix is identical (don't read brackets when num_chidren is zero) and applies both to trunk and 3.2 branch."
2013-09-05 10:08:06 +00:00
Robert Osfield
97091aa96c Fixed warnings 2013-09-05 10:05:05 +00:00
Robert Osfield
9574f4c087 From Alberto Luaces, "current versions of ffmpeg render «url_feof» macro as obsolete. The fix
is very simple and it is contained in the attached file."
2013-09-05 08:41:58 +00:00
Robert Osfield
a5002123a9 From Farshid Lashkari, "The ProxyNode serializer was not correctly reading the "Children" field. It conditionally writes the begin/end brackets, depending on whether it has children. However, during input it unconditionally attempts to read the begin/end brackets. I've modified the code to only read the brackets if it has children." 2013-09-02 10:57:50 +00:00
Robert Osfield
bddb6e8eaa Merged from svn/trunk, fixed double copy in StackedTransform constructor 2013-09-02 09:13:20 +00:00
Robert Osfield
41b1fcffe6 From Aurelien Albert, "I've go some problem with the method "State_Utils::replace" : if the original_phrase is empty, it leads to an infinite loop.
Here is a path to prevent this."
2013-08-05 12:00:59 +00:00
Robert Osfield
044f16b8b9 From Anish Thomas, added catch for to an empty DrawElementsUInt creation. 2013-08-01 11:25:07 +00:00
Robert Osfield
d581806619 From Ulrich Hertlein, "Based on the exchange on osg-users I went ahead and reworked shp/XBaseParser to avoid
weird behaviour (closing stdin) and leaking file descriptors, as well as some const-ness."
2013-08-01 10:28:15 +00:00
Robert Osfield
48364df671 From Sebastian Messerschmidt, "Seems like your re-factoring didn't really produces the correct results.
You can check with the tester2.flt provided earlier and check with the result image.
I double checked this with OpenFlight creator, and it seems the yaw is broken.

With my initial quaternion version is seems correct and if I change the


float cos_yaw = cosf(osg::inDegrees(yaw));
float sin_yaw = sinf(osg::inDegrees(yaw));

to be
float cos_yaw = cosf(osg::inDegrees(-yaw));
float sin_yaw = sinf(osg::inDegrees(-yaw));

it seems to work as well."
2013-08-01 10:04:07 +00:00
Robert Osfield
981ed52356 From Tom Jolley, "I found a couple more bugs after closely looking at the small piece of deprecated geometry in my model. There were problems with more than one primitive in a couple places. The first was the number of vertices were not being accumulated for DrawArraysPrimitiveType (caused another crash). The second is I had to move target_vindex and source_pindex before the PrimitiveSetList loop so they don't get reset on the next primitive (otherwise you end up with a lot of zeros in per vertex lists)." 2013-08-01 10:00:31 +00:00
Robert Osfield
9a90ddd2d9 From Aurelien Albert, "Here is the code to get access to OpenGL handle of an osg::FrameBufferObject" 2013-07-31 07:11:05 +00:00
Robert Osfield
123058965c From Tom Jolly, "I ran across this error reading one of our older files. An iterator was being changed inside a loop that caused a crash." 2013-07-31 06:56:28 +00:00
Robert Osfield
1364329fc8 From Sergey Kurdakov, merged from svn/trunk fix for GLES2 runtime invalid enumerant warning. 2013-07-31 06:43:46 +00:00
Robert Osfield
07550df2f2 From svn/trunk merged "Changed default cull mask to match the left cull mask so that mono rendering of presentations with left/right stereo images/movies works fine." 2013-07-30 06:39:36 +00:00
Robert Osfield
45f463ccd2 Removed trailing spaces 2013-07-30 06:39:01 +00:00
Robert Osfield
789d435abe Updated ChangeLog 2013-07-24 17:29:50 +00:00
Robert Osfield
6b8db67c91 Changed default of serialize draw to OFF 2013-07-24 17:27:14 +00:00
Robert Osfield
2975f9c20a Updated README for 3.2 release 2013-07-24 14:23:37 +00:00
Robert Osfield
ebc855cf50 Removed release candidate number in prep for 3.2.0 release 2013-07-24 14:11:55 +00:00
Robert Osfield
c9547497cc Fixed typo 2013-07-24 14:05:08 +00:00
Robert Osfield
75d32b3af6 Updated ChangeLog 2013-07-24 13:29:22 +00:00
Robert Osfield
a844a278ab Added GL2Extensions::isDrawBuffersSupported() and usage with FrameBufferObject.cpp to prevent invalid MRT usage causing crash under GLES2 2013-07-24 13:01:38 +00:00
Robert Osfield
94dcfb4ec2 Updated NEWS for 3.2 release 2013-07-24 12:50:34 +00:00
Robert Osfield
8528449dff Fixed warning 2013-07-24 12:49:11 +00:00
Robert Osfield
8d7fd88d5f Added getCallbacks() methods 2013-07-24 12:17:10 +00:00
Robert Osfield
28dd1cf8a8 Updated ChangeLog, AUTHORS file, Release Candidate Number and SO version number for 3.2-rc4 2013-07-23 18:34:01 +00:00
Robert Osfield
14de2266ba From Rocco Martino, build fix for compiling against ffmpeg/trunk 2013-07-23 18:11:31 +00:00
Robert Osfield
cc02695822 Disabled the check for Asio for Windows 2013-07-23 15:36:45 +00:00
Robert Osfield
2c442c9e9a Added NOT ANDROID to force use of posix API when building for Android under Windows 2013-07-23 15:28:34 +00:00
Robert Osfield
ca44b9cbce Added lazy setting of the UserDataContainer to avoid unncessarily create a UserDataContain when an empty description list is passed to Node::setDescriptions(..) 2013-07-23 10:24:27 +00:00
Robert Osfield
0483912e32 Fixed crash when open(..) returns an error. 2013-07-23 09:54:28 +00:00
Robert Osfield
21b5109089 Updated ChangeLog and AUTHORS file for rc3 2013-07-23 05:45:34 +00:00
Robert Osfield
549e20fbe7 Fixed svn source to that it's relase candidates and final release made from the OpenSceneGraph-3.2 branch 2013-07-23 05:41:40 +00:00
Robert Osfield
b4b7a13063 From Torben Dannhauer, "Please find attached further changes to make library auto detection
functional again for some libraries:

    Find3rdPa..: Fix to find libxml2
    FindCollada: Rearranged to handle different MSVC versions more effective.
    This file is already prepared for the upcoming VS 2013.
    FindNVTT: introduced management of debug libraries (also auto detected).
    "
2013-07-23 05:25:45 +00:00
Robert Osfield
8b58890975 Updatected rc number 2, ChangeLog and AUTHORS file for OSG-3.2-rc2 release 2013-07-22 13:40:53 +00:00
Robert Osfield
871521cfea From Andreas Ekstrand, "Attached is a small modification of the Collada writer that protects from crashes due to valArray being NULL in some situations." 2013-07-22 13:31:32 +00:00
Robert Osfield
f19018a03d Added FRAME_BUFFER_OBJECT enum 2013-07-22 10:07:21 +00:00
Robert Osfield
2709a5e946 From Christian Ruzicka, "with the current touch implementation on iOS the touches are not forwarded to parent views because the base implementation is not called. Also see the "Best Practices" in the iOS documentation for event handling:
http://developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/multitouch_background/multitouch_background.html

"If you handle events in a subclass of any other UIKit responder class:
- You do not have to implement all of the event handling methods.
- In the methods you do implement, be sure to call the superclass implementation. For example, [super touchesBegan:touches withEvent:event]."

I added the missing lines and tested it with OSG 3.1.9 and iOS SDK 6.1."
2013-07-19 21:03:28 +00:00
Robert Osfield
52d5d80508 Added default setting of BIND_PER_VERTEX when applying Geometry::setTexCoordArray() 2013-07-19 20:59:14 +00:00
Robert Osfield
86e465d5d8 Updated OpenThreads version to be in sync with OSG version. 2013-07-19 17:00:08 +00:00
Robert Osfield
50ed5ebd1c Branch OpenSceneGraph-3.2 2013-07-19 14:08:08 +00:00
Robert Osfield
9416ef4791 Updated AUTHORS file for new 3.2 branch 2013-07-19 14:07:17 +00:00
Robert Osfield
95a5f3ed0f Updated version number to 3.2.0-rc1 in prep for create the 3.2 branch, and 3.2.0-rc1 2013-07-19 14:06:11 +00:00
Robert Osfield
8184798d40 Update ChangeLog and AUTHORS files for 3.1.10 dev release 2013-07-19 10:31:45 +00:00
Robert Osfield
170cbb9018 Updater version for 3.1.10 dev release 2013-07-19 10:17:26 +00:00
Robert Osfield
a1bda7d39e Removed #if 0 #endif block 2013-07-19 10:11:42 +00:00
Robert Osfield
e7b86099d1 Fixed problem with the osgviewerQt code override the default View::Camera without setting it's default state on it's StateSet like View does by default. 2013-07-19 09:43:54 +00:00
Robert Osfield
2f1d3626de From Johannes Scholz, "as we need to dynamically add and remove Effects to and from our Application, I created a small patch for osgFX/Registry to add the osgFX::Registry::removeEffect(effect*) method and extended osgFX::Registry::Proxy to call removeEffect upon its destruction." 2013-07-19 06:56:13 +00:00
Robert Osfield
a270a7635e From Wang Rui, "A very small clerical error in the src/osgViewer/CMakeLists.txt makes MinGW/Cygwin builds fail. Now it is fixed and now OSG works well again with Cygwin. :-) The OSC plugin also needs a small fix to compile with Cygwin, as attached file src/osgPlugins/osc/osc/OscHostEndianness.h shows." 2013-07-19 06:39:06 +00:00
Robert Osfield
0175c820af From Mathieu Marache, "we found that events where not caught when running in ON_DEMAND frame scheme : GraphicsWindow::checkEvents() always return false and GraphicsWindowQt doesn't overload it.
here is a simple fix that will return if the list is empty or not and will match the comment in checkEvents()
2013-07-19 06:20:46 +00:00
Robert Osfield
5255884fec Added a dirty() call to Image::setData(..) 2013-07-18 20:17:48 +00:00
Robert Osfield
bbf00cef01 From Torben Dannhauer, "after being absent for more than 12 month, I'm very pleased to present my
new 3rdparty package (V8).

 This package is compiled with Visual Studio 2012 Update 3. Some community
members complained that these package is very large (indeed), so I
introduced 2 versions:
- The small version contains the dependencies for several image file formats
( tiff, png, gif, jpeg), as well as zlib, minizip, curl, freetype,  glut,
gdal and openSSL
- The full version will include all libraries which were include in the
previous releases of my 3rd party package.

Some of the included libraries are released in newer versions, so I adapted
the attached CMake module to find these renamed files.

I hope you can merge this minor changes soon, since I plan to publish the
small 3rdparty package today.
"
2013-07-18 16:29:13 +00:00
Robert Osfield
82f7031ab5 From Lionel Lagarde, "The extension name is misspelled. It conflicts with GLEW." 2013-07-18 16:27:17 +00:00
Robert Osfield
2507c3974f Updated AUTHORS and ChangeLog for 3.1.9 dev release 2013-07-02 19:24:10 +00:00
Robert Osfield
ca4e840155 From Laurens Voerman, "With fstream inheritaince now removed the warning can be enabled again." 2013-07-02 14:35:29 +00:00
Robert Osfield
62374833dd From Laurens Voerman, "some of my ive files now generate a warning:
Warning, can't assign attribute binding as no has been array assigned to set binding for.

I think those are ive's with bumpmaps, but I have not checked yet. The problem is in
OpenSceneGraph\src\osgPlugins\ive\Geometry.cpp
where the code tries to set Normalize and Binding for a missing Array.
I think that code can safely be skipped, considering the write function has a hardcoded write when the array is missing. (introduced in svn rev 13488)

modified file (OpenSceneGraph\src\osgPlugins\ive\Geometry.cpp) attached  in Zip"
2013-07-02 14:17:44 +00:00
Robert Osfield
330de18eba From Laurens Voerman, "Recent changes cause a few warnings in MSVC 2012
svn 13587 From David Callu, warning fixes and removal of spaces at end of lines.

this can be fixed by adding a space before the comment opening /*.
full modified file (openscenegraph\src\osgplugins\osg\BinaryStreamOperator.h) attached in zip

Regards, Laurens.


openscenegraph\src\osgplugins\osg\BinaryStreamOperator.h(71): warning C4138: '*/' found outside of comment (OpenSceneGraph\src\osgPlugins\osg\ReaderWriterOSG2.cpp)
openscenegraph\src\osgplugins\osg\BinaryStreamOperator.h(73): warning C4138: '*/' found outside of comment (OpenSceneGraph\src\osgPlugins\osg\ReaderWriterOSG2.cpp)
openscenegraph\src\osgplugins\osg\BinaryStreamOperator.h(211): warning C4138: '*/' found outside of comment (OpenSceneGraph\src\osgPlugins\osg\ReaderWriterOSG2.cpp)
openscenegraph\src\osgplugins\osg\BinaryStreamOperator.h(213): warning C4138: '*/' found outside of comment (OpenSceneGraph\src\osgPlugins\osg\ReaderWriterOSG2.cpp)"
2013-07-02 14:02:06 +00:00
Robert Osfield
8420b158c1 Restructed handling of the _currentShaderCompositionUniformList in State::apply() and State::apply(const StateSet*) so that it can be used even when shader composition isn't enabled. 2013-07-02 13:45:23 +00:00
Robert Osfield
095b64dc41 From Aurelien Albert, "Recently I had to integrate a client OpenGL library with OSG. For textures and other StateAttribute I've done that by subclassing osg::StateAttribute and this works well.
But for glPrograms, in order to get all osg's uniform management system to work, I had to subclass osg::program::PerContextProgram.

Here is a modified version of this class, which add some "virtual" method to allow easy subclassing."
2013-07-02 10:32:53 +00:00
Robert Osfield
08f741bcd9 From Pjotr Svetachov, "The binding of arrays is always set to BIND_UNDEFINED when using the array constructor because the binding parameter is ignored. Here is a fix." 2013-07-02 09:44:46 +00:00
Robert Osfield
d3c2896651 Added SceneView::Options enum enetries APPLY_GLOBAL_DEFAULTS and CLEAR_GLOBAL_STATESET to control whether a _globalStateSet->clear() and _globalStateSet->setGlobalDefaults() should be called.
osgViewer::Renderer doesn't use these enum settings so now no longer has a calls StateSet::clear() or StateSet::setGlobalDefaults() on the osg::Camera's StateSet.  Previously these were being
called and breaking the ability to attached state to Camera's StateSet.
2013-07-02 09:27:14 +00:00
Robert Osfield
0abbef71e1 From Pjotr Svetachov, "In a submission on June 27th a lot of new array types were added. This modified the osg::Array::Type enum. Because of this s_ArrayNames array in Array.cpp is now not in sync. This can lead to corrupt exports or crashes when writing .osg files because the change added new types in the middle of the enum instead of at the end.
Attached is a new Array.cpp to reflect the new array types."
2013-07-01 16:15:25 +00:00
Robert Osfield
50f3b4a539 Updated AUTHORS, ChangeLog for dev release 2013-07-01 12:16:32 +00:00
Robert Osfield
ff3a6f4eb1 Removed BIND_INSTANCE_DIVISOR as they don't yet have any implementation backend to support them. 2013-07-01 10:22:34 +00:00
Robert Osfield
2768c1b170 From David Callu, "Here a fix for FindFBX.cmake
under linux, library name to look for must be fbxsdk instead of libfbxsdk."
2013-07-01 09:12:11 +00:00
Robert Osfield
5e89121152 From David Callu, "Here a CMakeLists.txt modified with OSG_AGGRESSIVE_WARNING_FLAGS defined when Clang compilator is used" 2013-07-01 09:10:11 +00:00
Robert Osfield
0289b05cd5 Fixed debug build compile problem 2013-07-01 09:09:49 +00:00
Robert Osfield
a64b412885 Reverted the usage of OSG_UNUSED and OT_UNUSED as in hindsight these should never have been merged. Adding code to quieten
inappropriate warnings is a bad programming practice and does not desrve a place in the OSG code base.
2013-07-01 08:21:13 +00:00
Robert Osfield
e876e0bad3 From John Kaniarz, "This patch modifies ReaderWriterPNG.cpp to
1. Check the bit depth of the passed Image and return an error if not 8 or 16. (not fully featured, but still an improvement over hard coded 8bit for everything)
2. Endian swap 16bit image data when on a little endian architecture.
"
2013-06-28 15:44:04 +00:00
Robert Osfield
9eba9df292 From Alberto Luaces, "Documentation for -p and --speed options in osgviewer" 2013-06-28 14:47:02 +00:00
Robert Osfield
88a8423802 From Marcel Pursche, fixed checking of destination dimensions in osg::copyImage. 2013-06-28 14:38:45 +00:00
Robert Osfield
d4e1a8d6a3 From Lilin Xiong, "When writing proxyNode to ive file, we forget "LoadingExternalReferenceMode ". Add some code to fix this.
if (out->getVersion() >= VERSION_0045)
{
    out->writeInt(getLoadingExternalReferenceMode());
}

if (in->getVersion() >= VERSION_0045)
{
   setLoadExternalReferenceFiles( (osg::ProxyNode::LoadingExternalReferenceMode)in->readInt() );
}
"
2013-06-28 14:32:12 +00:00
Robert Osfield
2e41e3f656 From Gill Peacegood, "fix for a memory leak in the DelaunayConstraint class" 2013-06-28 14:21:43 +00:00
Robert Osfield
4493cc817d From Laurens Voerman, "the current version of BufferObject causes a huge amount of warnings in Visual Studio 2012 like:
OpenSceneGraph/include\osg/BufferObject(701): warning C4138: '*/' found outside of comment (E:\osg\osgSvn\OpenSceneGraph\src\osg\Array.cpp)

adding a space before /* fixes the problem
        void removeClient(osg::Object * /*client*/) { --_numClients; }
"
2013-06-28 14:08:36 +00:00
Robert Osfield
5db57cfa34 Fixed handling of DISPLAY=127.0.0.1:2 usage. 2013-06-28 14:07:31 +00:00
Robert Osfield
353b18b27b From Aurelien Albert, Added support for glPrimitiveRestartIndex.
"The idea of this new OpenGL feature is :

- set RestartIndex = "n"
- draw elements strip
  -> when the index is "n", the strip is "stopped" and restarted

It's very usefull for drawing tiles with a single strip and a "restart" at the end of each row.

The idea a an OSG StateAttribute is :

Usually we use to build geometry from code, because software modelers rarely support it (and 3d file formats doesn't support it) :

-RootNode <= "PrimitiveRestartIndex=0"     // So now, we know that our restart index is 0 for all drawables under this node
|
- Drawable 1 : triangles => as usual
|
- Drawable 2 : triangles strip => as usual
|
- Drawable 3 : triangles strip + "GL_PRIMITIVE_RESTART" mode = ON => use the restart index
|
- Drawable 4 : triangles strip + "GL_PRIMITIVE_RESTART" mode = ON => use the restart index
|
- Drawable 5 : triangles strip => as usual


With a StateAttribute, it's easy for the developper to say "0 will be my restart index for all this object" and then activate the mode only on some nodes.

The main problem is if you set and restart index value which is not included in the vertex array (for exemple set restart index = 100 but you have only 50 vertex). There is no problem with OpenGL, but some OSG algorithms will try to access the vertex[100] and will segfault.

To solve this, I think there is two ways :

1/ add restart index in osg::PrimitiveSet and use this value in all algorithms. It's a lot of work, maybe dangerous, and it concern only a few situations : developpers who use this extension should be aware of advanced OpenGL (and OSG) data management

2/ use a StateAttribute, and choose a "correct" restart index. In my applications, I always use "0" as a restart index and duplicate the first vertex (vertex[0] = vertex[1]). So there is no difference for OpenGL and all OSG algorithms works properly.
"
2013-06-28 13:43:46 +00:00
Robert Osfield
b2c838033d Added handling of an odd number rows in the capsule rendering and primitive calculation. 2013-06-28 12:45:39 +00:00
Robert Osfield
097aedf23c From David Callu, warning fixes and removal of spaces at end of lines. 2013-06-28 12:00:43 +00:00
Robert Osfield
d82768417d From David Callu, "in osgViewer::WoWVxDisplay::WoWVxDisplay(unsigned int type=20, unsigned int screenNum=0)
screenNum is unused.

fix attached.
"
2013-06-28 10:59:01 +00:00
Robert Osfield
db1f2c5eb1 From David Callu, added support for glVertexAttribLPointer and glVertexAttribIPointer, utilized via osg::Array::setPreserveDataType(true); 2013-06-28 10:51:22 +00:00
Robert Osfield
4fd6566e00 From David Callu, serializer support for new Vec* and Vec*Array classes 2013-06-28 08:57:42 +00:00
Robert Osfield
f2c1a7597c 2013-06-28 08:11:46 +00:00
Robert Osfield
775c1443eb From David Callu, "Added Vec3ub, Vec3us, Vec4us, Vec2ub and Vec2us classes" 2013-06-27 17:37:03 +00:00
Robert Osfield
9f13e2fcb9 From Lionel Lagarde, "Support for paging and shared PBO"
"The attached file contains:
- a per-context read counter in GLBufferObject::BufferEntry
- a global client counter in BufferData
- the glue between Texture* and Image client counter
"
2013-06-27 16:44:32 +00:00
Robert Osfield
57947ea75c From Aurelien Albert, added passing on of the gl array normalize to OpenGL when uses vertex attribute aliasing. 2013-06-27 15:18:38 +00:00
Robert Osfield
90ceb88c12 Replaced deprecatated osg::Geometry::get*Binding() calls. 2013-06-27 14:46:16 +00:00
Robert Osfield
dfc1a899db Added Geometry::containsDeprecatedData() / fixDeprecatedData() 2013-06-27 13:37:26 +00:00
Robert Osfield
092dd93be8 Removed deprecated usage of osg::Geometry::get*Binding() 2013-06-27 10:58:26 +00:00
Robert Osfield
592c580721 Replaced deprecated osg::Geometry::set*Binding() usage. 2013-06-27 09:59:33 +00:00
Robert Osfield
87add5f508 Replaced deprecated osg::Geometry::set*Binding() usage 2013-06-27 09:54:45 +00:00
Robert Osfield
4b9aa1fd24 Replaced deprecated osg::Geometry::set*Binding() usage. 2013-06-27 09:54:12 +00:00
Robert Osfield
c1ebc3ac0c Replaced deprecated osg::Geometry::set*Binding() usage 2013-06-27 08:44:15 +00:00
Robert Osfield
38bb71460a Replaced deprecated Geometry::set*Binding() 2013-06-27 08:30:51 +00:00
Robert Osfield
8e65ab7e45 Replaced deprecated Geometry::set*Binding() usage 2013-06-26 18:06:09 +00:00
Robert Osfield
5a25a93bdd Removed deprecated Geometry::set*Binding() usage 2013-06-26 17:58:57 +00:00
Robert Osfield
9f0bbbf831 Added osg::getBinding(osg::Array* array) convinience function that returns the Array::getBinding() is the array is not NULL, otherwise returns BIND_OFF. 2013-06-26 17:54:35 +00:00
Robert Osfield
7ee05a345a Replaced deprecated osg::Geometry::set*Binding() usage 2013-06-26 17:45:19 +00:00
Robert Osfield
55416d83b3 Replaced deprecated osg::Geometry::set*Binding() calls. 2013-06-26 17:44:30 +00:00
Robert Osfield
a459033eff From Sebastian Messerschmidt, "I've taken some time and refactored some places where the old set*Binding were used." 2013-06-26 16:16:23 +00:00
Robert Osfield
bead0740f2 From Aurelien Albert, "This submission allow the user to specify how to setup VertexAttributeAliasing.
I think this is necessary on OpenGL 3.2+ since this is no more "default" locations in the OpenGL specs.

The default behaviour stay the same.

There is a few new methods on osg::State :

- resetVertexAttributeAlias : reset all vertex alias to osg's default ones
- set**Alias : set a vertex attribute alias configuration
- setAttributeBindingList : set the attribute binding list (allow to specify an empty list if you're using "layout" qualifier in glsl code to specify the bindings. This save some CPU operations)"
2013-06-26 13:00:12 +00:00
Robert Osfield
831a552dfa Removed unused methods 2013-06-26 12:59:40 +00:00
Robert Osfield
ea2cbee347 Removed spaces from end of line 2013-06-26 12:33:40 +00:00
Robert Osfield
71c1fc87bb Fixed bug in TemplateTargetAttributeDispatch that was causing a crash with the osgsimplegl3 example 2013-06-26 12:33:14 +00:00
Robert Osfield
6377e37e88 From Pjotr Svetachov and Robert Osfield, "the index mesh and vertex pre-transform optimizers can rearrange or change the size of arrays assigned to a geometry. This leads to crashes or corrupt geometry when using shared arrays.
Attached a fix that duplicates shared geometry arrays."
2013-06-26 09:04:20 +00:00
Robert Osfield
b70dfd40aa Removed Geometry::fixDeprecatedData() as it won't work on const Geometry 2013-06-26 08:53:56 +00:00
Robert Osfield
36f48f2227 From Mathias Froehlich, "The attached file replaces the deprecated geometry use in osgSim.
The per primitive use is changed to full per vertex arrays."
2013-06-26 07:08:26 +00:00
Robert Osfield
3de0ec1904 Removed #include<osg/Notify> as it's nolonger required in the header 2013-06-25 16:19:00 +00:00
Robert Osfield
1793466442 With assistance from Sukender, moved the depreacted osg::Geometry vertex indices and AttributeBinding definitions out into a separated namespace/class so to use
deprecated features you should now use deprecated_osg::Geometry in place of osg::Geometry.
2013-06-25 16:10:24 +00:00
Robert Osfield
ceb97fe230 From Christian Buchner, "Here is a strongly overhauled version of the original osgoit ("order independent transparency") by Mathias Fröhlich. I called this version myosgoit. It looks very nice, just build and run it!
This version adds:

- an encapsulation of the entire Depth Peeling procedure into a class (not currently a scene graph node) for easier integration in other projects.

- compositing with opaque (solid) geometry is possible and the opaque model is only rendered once. This needs to performs some depth buffer blitting between FBOs.

- mix and match with GLSL shaders in the transparent objects is possible, as demonstrated with a 3D heat map intersecting an opaque truck model.


Some Drawbacks:

- the display framebuffer does not receive any depth information from the compositing camera. This could be fixed by compositing with a GLSL shader and writing to FragDepth."

From Robert Osfield, ported the code to work under Linux and without the automatic ref_ptr to C* conversion.
2013-06-25 11:13:50 +00:00
Robert Osfield
00acf55571 From Alberto Luacas, "current Doxygen warns against the use of obsolete fields:
DETAILS_AT_TOP, SHOW_DIRECTORIES, HTML_ALIGN_MEMBERS.

I have removed those in the configuration files."
2013-06-25 09:52:38 +00:00
Robert Osfield
ba9ccd91a1 From Cedric Pinson, "I fixed a little issue with the lightwave scene loader. On the version 5 there are id on the command LoadObjectLayer in the scene file and of this version the current code use this field as a part of the filename, and it fails because the file is not found.
I just added a field version_ to read it at the beginning and added extra code to check it and read the extra field if needed and read the good filename"
2013-06-24 12:51:02 +00:00
Robert Osfield
84d7d9a056 From Christian Ruzicka, "when MSAA is activated on iOS, the stencil attachment is not added (Stencil buffer is not working at all). Attached are the needed changes to make MSAA + stencil working on iOS.
Tested with OSG 3.1.7 and iOS SDK 6.1."
2013-06-24 12:31:48 +00:00
Robert Osfield
addf8b1d2d Updatd SO_VERSION to reflect changes in ABI from merging submissions. 2013-06-24 12:30:08 +00:00
Robert Osfield
1e715b6877 From Sukender, "I recently pulled from the GIT mirror and found that "OSG_USE_DEPRECATED_GEOMETRY_METHODS=OFF" hides a little mistake: there is a "#include <osg/Notify>" inside the "osg" namespace, in inlude/osg/Geometry.
"
2013-06-24 12:27:19 +00:00
Robert Osfield
ba2242decb From Mourad Boufarguine, "Attached is a fix for the ply reader to use the output of osgDB::findDataFile.
"
2013-06-24 11:40:16 +00:00
Robert Osfield
6331a54a68 From Luc Frauciel, "You'll find attached a modification of DXWriter to support Material color:
If a material is present, the diffuse color is affected to current layer."
2013-06-24 11:39:26 +00:00
Robert Osfield
0896bd17bd From Lars Nillson, "The change in this submission is to take care of the setting given by a call to
setMaximumNumOfObjectsToCompilePerFrame(…).


Sometimes if you give a low number, more than the expected number of objects are compiled."
2013-06-24 11:14:13 +00:00
Robert Osfield
ca2688b046 Convert usage to use const versions of containers 2013-06-24 11:03:59 +00:00
Robert Osfield
864e5cb6f0 From Frederic Morin, "Current behaviour uses SDKSettings.plist to determine osx version but
this file is only available when XCode is installed.

This version works also when Command Line Tools for XCode are
installed (minimum build env for osx without XCode)

See https://github.com/openscenegraph/osg/pull/8 for patch details
Patch: https://github.com/openscenegraph/osg/pull/8/files"
2013-06-24 09:59:22 +00:00
Robert Osfield
261db64a9e From Farshid Lashkari, "I've attached a small patch that extends the Image::readImageFromCurrentTexture method to support more depth texture pixel formats (16, 24, 32, 32F). In order to compile, I moved some depth pixel format definitions from FrameBufferObject to Image.
"
2013-06-24 09:51:30 +00:00
Robert Osfield
3c1a89604b From Christian Noon, "Got a simple patch for correcting a problem with the USE_COMPRESSOR_WRAPPER() macro in the osgDB::Registry. The problem is that the wrapper declaration doesn't match the one defined in the REGISTER_COMPRESSOR() method in the osgDB::ObjectWrapper method. This patch fixes the wrapper declaration so they both match properly. I ran into this problem using compressed files in an iOS application where all the libraries and plugins need to be built statically." 2013-06-24 09:31:34 +00:00
Robert Osfield
70ae69648d From Nick Black, "Hey there! avcodec_open() has been deprecated for some time, and indeed has
been removed in the most recent versions of libavcodec/ffmpeg. You're
already using avcodec_open2() elsewhere, but one appears to have been
missed. The change is trivial:

[skynet](0) $ svn diff
Index: src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp
===================================================================
--- src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp        (revision 13355)
+++ src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp        (working copy)
@@ -109,7 +109,7 @@
         //    m_context->flags |= CODEC_FLAG_TRUNCATED;

         // Open codec
-        if (avcodec_open(m_context, p_codec) < 0)
+        if (avcodec_open2(m_context, p_codec, NULL) < 0)
             throw std::runtime_error("avcodec_open() failed");
     }

[skynet](0) $

I've applied similar changes this year to many other packages, including
cheese, blender, linphone, ad nauseam. It's been tested by verifying that
with my patch, OSG builds against the newest libavcodec and ffmpeg, whereas
otherwise it does not.

The modified src/osgPlugins/ffmpeg/FFmpegDecoderAudio.cpp is attached. It
originates in svn trunk revision 13355. Thanks!"
2013-06-24 09:12:58 +00:00
Robert Osfield
48020eed9e Introduced typedef's to make the code more readble and maintanable 2013-06-24 09:02:32 +00:00
Robert Osfield
4044fd5a74 From Wang Rui, "The file attached includes two new features for the serialization IO functionality. First, custom serializer version control should work now, just by defining a new REGISTER_CUSTOM_OBJECT_WRAPPER macro. For example:
// A custom class
namespace CustomDomain {

class MyGroup : public osg::Group
{
public:
    META_Node( CustomDomain, MyGroup );

    void setMyName( const std::string& n );
    const std::string& getMyName() const;

    void setMyID( int id );
    int getMyID() const;

    ...
};

}

// The serialization wrapper using a custom domain name
REGISTER_CUSTOM_OBJECT_WRAPPER( MyDomain,
                                CustomDomain_MyGroup,
                                new CustomDomain::MyGroup,
                                CustomDomain::MyGroup,
                                "osg::Object osg::Node osg::Group CustomDomain::MyGroup" )
{
    ADD_STRING_SERIALIZER( MyName, std::string() );
    {
        UPDATE_TO_VERSION_SCOPED( 1 );  // Updated for a new domain version
        ADD_INT_SERIALIZER( MyID, 0 );
    }
}

Save the class instance as follows:
osgDB::writeNodeFile( *myGroup, "serializer_test.osgt", new osgDB::Options("CustomDomains=MyDomain:1") );

The output file will include the domain version definition and all the class data, and can be read back. We can also force setting the domain version by the CustomDomains option while reading the saved files. If we save the class instance without any options, MyID will be ignored because the default domain version is 0.

This may help third-party libraries like osgEarth to maintain their own serializers without regarding to the OSG soversion changes.

Another feature added is a more robust binary format, which in fact adds a size-offset at each block's beginning. When there are problems or unsupported data types while reading, we can now directly jump to the block end indicated by the offset value. So a .osgb file will automatically ignore bad data and read remains as normal (at present it will fail at all). This feature will not break the backward compatibility, and can be disabled by setting "RobustBinaryFormat=false" while writing out.

Hope these changes can work smoothly with present and future community projects. Maybe we should also consider have an osgserializer example to test and demonstrate all things we can do now."
2013-06-24 08:48:55 +00:00
Robert Osfield
b3f0479118 From Wang Rui, "Sorry for my very slow response because of some personal issues. I found that new Geometry serializers can't work with old .osgb files. The modified FastPathHint serializer doesn't correctly read from the stream and thus jumbles following inputs. The file attached can be placed in osgWrappers/serializers/osg to fix that problem.
"
2013-06-24 08:22:50 +00:00
Robert Osfield
340a47dc66 From Wang Rui, "The osgdb_ffmpeg plugin may not work with latest ffmpeg windows sdk and will say "The procedure entry point xxx could not be located in xxx.dll" instead. The following link describes the reason (maybe a certain optimization problem of the VS compiler):
http://forum.videolan.org/viewtopic.php?f=32&t=98097

After adding the /OPT:NOREF, the problem has gone.

"
2013-06-24 08:19:34 +00:00
Robert Osfield
db4b7584fb From Farshid Lashkari, "In many game engines it is common to set the W component of the tangent vector to -1 if the UVs are mirrored and 1 if not. I've updated the osgUtil::TangentSpaceGenerator class to do the same." 2013-06-24 08:18:08 +00:00
Robert Osfield
0a4bf71fbb Updated version number after dev release 2013-06-21 19:35:56 +00:00
Robert Osfield
b40c3fc0aa Removed spaces from end of lines 2013-06-21 19:35:26 +00:00
Robert Osfield
df3626be27 Fixed author name error introduced by xxdiff 2013-06-21 14:37:35 +00:00
Robert Osfield
d707983905 Reapplied AUTHORS changes 2013-06-21 14:30:45 +00:00
Robert Osfield
717c4f785c Update ChangeLog and AUTHORS.txt for release 2013-06-21 14:29:00 +00:00
Robert Osfield
59d53b40a1 Removed unneccessary handling of BIND_PER_PRIMITIVE on output code 2013-06-21 14:17:42 +00:00
Robert Osfield
9d9543ca0a From Pjotr Svetachov, introduced use of osg::observer_ptr<osg::Camera> in place of osg::Camera* 2013-06-21 13:59:18 +00:00
Robert Osfield
da134aa8ed From Stephan Huber, "attached you'll find the missing readObject-implementations for the imageio-plugin as suggested by Remo Eichenberger." 2013-06-21 13:41:03 +00:00
Robert Osfield
cb09fff797 From Laurens Voerman, build fix 2013-06-21 12:10:44 +00:00
Robert Osfield
18d6d298bf Build fixes for new osg::Geometry 2013-06-21 10:59:03 +00:00
Robert Osfield
deb074120e Converted osg::Geometry::ArrayData usage across to osg::Array. 2013-06-21 10:14:18 +00:00
Robert Osfield
25f0d2ccde From Laurens Voerman, "I just tested openGL quadbuffered stereo with the osgviewer, the mouse works again, so does the keystonecorrection, but the right-eye render to texture camera appears not to clear it's color buffer.
I found the problem in src\osgViewer\View.cpp, fix attached."
2013-06-21 10:03:49 +00:00
Robert Osfield
5a93c9100b From Mathieu Marache, I needed to modify the FindCOLLADA.cmake to enable its compilation under macosx. 2013-06-21 09:53:57 +00:00
Robert Osfield
6eabca211b Converted ArrayData usage across to set*Array() usage with new binding parameter 2013-06-21 09:47:04 +00:00
Robert Osfield
15fea448d8 Added new osg::Array::Binding parameter to osg::Geometry::set*Array(osg::Array* array, osg::Array::Binding binding=osg::Array::BIND_UNDEFINED) methods to make it easier for the user
to set the binding without the need to call the deprecated osg::Geometry::set*Binding(osg::Geometry::AttributeBinding)
2013-06-21 09:43:15 +00:00
Robert Osfield
d82c62a03b Removed spaces at ends of lines 2013-06-21 09:40:43 +00:00
Robert Osfield
d0f4086a57 From FrancoisTigeot, "OpenSceneGraph 3.0.1 doesn't build out of the box on DragonFly and needs
a few modifications to these files:
  - applications/present3D/Cluster.cpp
  - src/osgDB/FileUtils.cpp

The changes are needed to fix a few platform specific things such as the
absence of stat64, int/socklen_t differences, etc... and are in the same
line as Linux, Apple and FreeBSD specific checks.

I have attached the modified files; the original patches to 3.0.1 are
also visible here if you find it more convenient:
http://dl.wolfpond.org/dports/graphics.osg/dragonfly/patch-applications_present3D_Cluster.cpp
http://dl.wolfpond.org/dports/graphics.osg/dragonfly/patch-src_osgDB_FileUtils.cpp

With these changes, osg 3.0.1 is able to be built and packaged on DragonFly
whereas it previously failed to compile."
2013-06-21 09:17:28 +00:00
Robert Osfield
c3f28a52e4 From Matthias Helsing, "Here is the changed source to prefer using _NET_WM_STATE_ABOVE but fall back to XRaiseWindow should the Atoms not be supported. I'm not sure how many might be using the raiseWindow feature but I needed it for a splash on Ubuntu 12.04." 2013-06-21 08:56:24 +00:00
Robert Osfield
4738a2607b From Farshid Lashkari, "I've updated the dds, png, and jpeg plugins to support writing images with the GL_DEPTH_COMPONENT pixel format. They will simply treat it the same as the GL_LUMINANCE pixel format." 2013-06-21 08:37:47 +00:00
Robert Osfield
fe461c77fc From Jan Ciger, " I have put there in the comment a nicer way of doing version
checks, but that needs at least CMake 2.6.2."
2013-06-21 08:03:56 +00:00
Robert Osfield
715dd4e930 Fixed the handling the mouse min/max ranges of slave Cameras that have a parent Camera with a viewport. 2013-06-20 16:44:14 +00:00
Robert Osfield
a2b2ba5860 Temporarily commented out call to view.assignStereoOrKeystoneToCamera() for implementing stereo as this was causing problem in trackball manipulation 2013-06-20 15:48:14 +00:00
Robert Osfield
603c280b62 Added local namespace for util functions, and fixed the return type of checkDeprecatedData() 2013-06-20 15:18:51 +00:00
Robert Osfield
64b0e1afd0 From Vladimir Chebaev, "I worked with osg::Particle and see that this class has setter osgParticle::setTextureTileRange and has no getters for startTile and endTile. This can be very uncomfortable.
I attached file with two getters."
2013-06-20 12:15:57 +00:00
Robert Osfield
eaa3afcd21 Commented out verbose debug messages for shader composition 2013-06-20 10:59:00 +00:00
Robert Osfield
04bd10ab92 Updated ChangeLog and AUTHORS file 2013-06-20 10:42:24 +00:00
Robert Osfield
7d2f9f3a0d From Juan Manuel Alvarez, "When handling keyboard events on osgQt, if a key is kept pressed, multiple sequences of KEYDOWN -> KEYUP events are fired.
This is because Qt auto repeats keyboard events, so multiple calls are made to GLWidget::keyPressEvent and GLWidget::keyReleaseEvent by Qt, and subsequently translated to OSG events.

The way to solve this is ignoring key released auto repeated events (see http://qt-project.org/doc/qt-4.8/qkeyevent.html#isAutoRepeat), so multiple KEYDOWN events are fired, but only one KEYUP.

I attach a modified osgQt/GraphicsWindowQt.cpp with this change."
2013-06-20 10:05:56 +00:00
Robert Osfield
bab56f9854 From Jan Ciger, compilation fix for Qt 5.0.2 2013-06-20 09:30:31 +00:00
Robert Osfield
9b095b2936 From Laurens Voerman, build fix for VS. 2013-06-20 09:27:50 +00:00
Robert Osfield
2ab3a1e316 Removed svn:executable property. 2013-06-19 17:28:28 +00:00
Robert Osfield
47c4c7c389 Removed svn:executable property 2013-06-19 17:26:59 +00:00
Robert Osfield
083c0f97d2 Removed svn:executable property. 2013-06-19 17:25:55 +00:00
Robert Osfield
df075ef9bb Cleaned up usage of BIND_PER_PRIMITIVE where possible. 2013-06-19 16:24:59 +00:00
Robert Osfield
9c127c2bca From Magnus Kessler, typo fixes to doxygen docs and comments 2013-06-19 12:32:40 +00:00
Robert Osfield
935b4de15d From Magnus Kessler, "gcc-4.8 flagged this:
src/osgUtil/tristripper/src/tri_stripper.cpp:375:40: warning: typedef
‘tri_node_iter’ locally defined but not used [-Wunused-local-typedefs]
  typedef triangle_graph::node_iterator tri_node_iter;
                                        ^
---
 src/osgUtil/tristripper/src/tri_stripper.cpp | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/osgUtil/tristripper/src/tri_stripper.cpp
b/src/osgUtil/tristripper/src/tri_stripper.cpp
index 2f5a7f3..3396881 100644
--- a/src/osgUtil/tristripper/src/tri_stripper.cpp
+++ b/src/osgUtil/tristripper/src/tri_stripper.cpp
@@ -372,7 +372,6 @@ inline tri_stripper::const_link_iterator
tri_stripper::BackLinkToNeighbour(const

 void tri_stripper::MarkTriAsTaken(const size_t i)
 {
-       typedef triangle_graph::node_iterator tri_node_iter;
        typedef triangle_graph::out_arc_iterator tri_link_iter;

        // Mark the triangle node"
2013-06-19 12:28:06 +00:00
Robert Osfield
002ea7ebdd Converted tabs to four spaces 2013-06-19 12:27:28 +00:00
Robert Osfield
c8fa3244c2 From Jan Ciger, "I have found a problem when building OSG with Qt 5 support. Qt has the
following in the qopengl.h header:

# include <QtGui/qopengles2ext.h>
# ifndef GL_DOUBLE
#  define GL_DOUBLE GL_FLOAT
# endif
# ifndef GLdouble
typedef GLfloat GLdouble;
# endif

Unfortunately, when building for normal OpenGL (not GL/ES!) on Windows
with MSVC2012, GLdouble is not defined (it is not a macro but typedef)
and the code above produces a conflicting definition, making the
compile fail. I am attaching a bit hackish workaround for this problem
in osg/GL "
2013-06-19 12:19:28 +00:00
Robert Osfield
744960bbf2 Build fixes for new deprecated osg::Geometry functions 2013-06-19 10:56:31 +00:00
Robert Osfield
297a8a221b Added #define OSG_USE_DEPRECATED_GEOMETRY_METHODS usage into code to allow code to compile enen when CMake configuration has set the #define to off in include/osg/Config. 2013-06-18 19:09:33 +00:00
Robert Osfield
b2fa36f02b Moved the assignment of the normal binding to after the setNormalArray call 2013-06-18 17:49:57 +00:00
Robert Osfield
de1eb14f8d Moved the Geometry::set*Binding to after the set*Array() to prevent problems when using the deprecated functionality. 2013-06-18 17:48:43 +00:00
Robert Osfield
1d1cfda1d7 Removed BIND_PER_PRIMITIVE reference 2013-06-18 15:54:38 +00:00
Robert Osfield
55ae5b1c5f Moved the set binding and normalize for VertexAttrib to after the VertexAttrib array assignment 2013-06-18 15:03:26 +00:00
Robert Osfield
635993038a Changed header guard back to original, and removed deprecated enum 2013-06-18 14:52:26 +00:00
Robert Osfield
f5496ea3c5 Fixed order of binding. 2013-06-18 14:22:43 +00:00
Robert Osfield
390316e579 Removed experiment GeometryNew as it's no longer required. 2013-06-18 11:49:03 +00:00
Robert Osfield
7d40c7258f Clean up up osg::Geometry, removing long deprecated support for array indices and BIND_PER_PRIMITIVE binding that forced OpenGL slow paths. osg::Geometry is now smaller and only supports OpenGL fasts paths.
New methods osg::Geometry::containsDeprecatedData() and osg::Geometry::fixDeprecatedData() provide a means for converting geometries that still use the array indices and BIND_PER_PRIMITIVE across to complient
versions.

Cleaned up the rest of the OSG where use of array indices and BIND_PER_PRIMITIVE were accessed or used.
2013-06-18 11:18:28 +00:00
Robert Osfield
05b72e9b4c Fixed TextBase::computeBound() so it take into account all corners of the text box thus ensuring proper handling of rotated text 2013-06-14 09:43:04 +00:00
Robert Osfield
b4bfc3a451 From Martin Naylor, replace osgDB::fstream with an osgDB::open() call. 2013-06-12 12:49:18 +00:00
Robert Osfield
1a7f2fcb3e Introduced new osg::PatchParameter StateAttribute class to wrap up glPatchParameter associated state.
Note, osg::Program::setParameter(GL_PATCH_VERTICES,num); is nolonger support and should be replaced by using the new PatchParameter class.
2013-06-11 10:52:37 +00:00
Robert Osfield
4623c251bb Fixed indentation 2013-06-11 10:49:57 +00:00
Robert Osfield
b0a28a5b2c Refactored the way the ReadResult/WriteResult lists are handled, with them now being sorted so that the Read/WriteResult with highest numerical value ReadStatus/WriteStatus is returned.
Changed the enum order of ReadStatus/WriteStatus to ensure that the more relevant errors are last and with the highest numerical value
2013-06-11 09:05:35 +00:00
Robert Osfield
bdfd18dc03 From Kristofer Tingdahl, with additions from Riccardo Corsi and Robert Milharcic, support for Qt5 build 2013-06-10 14:34:25 +00:00
Robert Osfield
8cf9600e2c Fixed remove and add callback so they properly handle nested callbacks 2013-06-10 10:37:08 +00:00
Robert Osfield
eb556797e2 From Marcin Prus, "I don't know if you seen my second reply to your information about merging my Image and dds plugin changes. I found one problem in your latest submit. In ReaderWriterDDS::ComputeImageSizeInBytes pixelFormat and pixelType are not passed into osg::Image::computeImageSizeInBytes.
It's
return osg::Image::computeImageSizeInBytes(width, height, depth, packing, slice_packing, image_packing);
but I think it should be
return osg::Image::computeImageSizeInBytes(width, height, depth, pixelFormat, pixelType, packing, slice_packing, image_packing);"
2013-06-07 10:54:55 +00:00
Robert Osfield
a6e57026b2 From Mathias Froehlich, "attached is a change to osgsharedarray to move completely to the fast geometry
path. Also the arrays are moved back to static storage since this is the data
that is actually referenced in draw. So the change moving this onto the stack
that happend somewhere before broke this."
2013-06-07 10:52:29 +00:00
Robert Osfield
d66ee2c698 Replaced OpenThreads::Mutex with a OpenThreads::ReentrantMutex to allow draw callbacks to use Renderer. 2013-06-06 08:23:37 +00:00
Robert Osfield
49cfece9d4 Reorder member variables to ensure better packing in memory. 2013-06-05 07:55:05 +00:00
Robert Osfield
4f1e6b28e8 Moved the Array::AttribDivisor into the Array::Binding enum to avoid conflicts in settings between Binding and AttribDivisor.
Removed the vertify bindings/shared arrays handling from GeometryNew
2013-06-05 07:27:35 +00:00
Robert Osfield
eb693f6a92 Updates to GeometryNew, Array and ArraDispatchers to clean up GeometryNew so that is no longer uses ArrayData. 2013-06-04 19:04:26 +00:00
Robert Osfield
cbea97009c Added s/getNormalize(), s/getPreserveDataType(), s/getAttribDivisor() and s/getBinding() to osg::Array base class in preperation for refactor of osg::Geometry and introduction of new features. 2013-06-04 14:55:57 +00:00
Robert Osfield
a70318fbd5 Removed now redundent osggeodemo 2013-06-04 14:43:19 +00:00
Robert Osfield
c0c5fc13b1 Removed geo plugin as the modelling tool it was assocaited is long defunct. 2013-06-04 13:29:44 +00:00
Robert Osfield
bab251fc59 Cleaned up BIND_PER_PRIMITIVE and array indice usage 2013-06-04 10:06:19 +00:00
Robert Osfield
caa3a06c70 Introduced GeometryNew which is a cleaned up version of Geometry that removes support for array indices.
GeometryNew is only temporary and will be renamed to Geometry on the completion of refactoring work and feedback from community.
Ported osggeometry across to use GeometryNew.
2013-06-04 09:32:59 +00:00
Robert Osfield
4cca5c1d1c Removed deprecated usage of osg::Geometry indices and BIND_PER_PRIMITIVE 2013-06-04 09:29:37 +00:00
Robert Osfield
2dc53ceabb From Aurelien Albert, Added support for texture swizzle. 2013-06-03 15:10:53 +00:00
Robert Osfield
9b67578c47 Updated version and so_version in prep for 3.1.8 developer release 2013-06-03 14:38:23 +00:00
Robert Osfield
82ecbe98da From Laurens Voerman, "Autodesk released a new version of their FBX Software Development Kit (web page http://usa.autodesk.com/adsk/servlet/pc/item?siteID=123112&id=10775847).
The API has changed quite a bit, so lots of changes had to be made in the osg readerwriter. The preious version of the FBX SDK (2013.3) already deprecated a lot of the names and functions. The code I submit now still compiles against 2013.3 (possibly needs a #define FBX_NEW_API). Not sure if that's useful, but it might ease the transition."
2013-06-03 14:27:14 +00:00
Robert Osfield
375e7c2d57 From Laurens Voerman, "while updating dependencies I found a problem with libgif 5 from http://sourceforge.net/projects/giflib/
a change in version 5.0.0 required a call to the fuction "DGifOpen" to pass an int ref for an error code.
My fix ignores the error, just fixes the compile."
2013-06-03 14:04:02 +00:00
Robert Osfield
05a1084e5c From Sergey Polischuk, "this patch fixes light id in gl modes for osg::LightSource's readed from fbx (previously all lightsources were setting GL_LIGHT0 mode, while osg::Lights were using different id's), and enables GL_LIGHT# on root node for all lights contained in model
"
2013-06-03 14:01:13 +00:00
Robert Osfield
ae2b6669ea Added Vec*b, Vec4ub, Vec*s, Vec*i, Vec*ui serializers 2013-06-03 13:13:18 +00:00
Robert Osfield
2244f6a371 Added Vec2i, Vec2ui, Vec3i, Vec3ui, Vec4i and Vec4ui headers to CMake header list 2013-06-03 12:19:06 +00:00
Robert Osfield
4697b3c68b From Art Tevs, int and uint Vec classes 2013-06-03 11:38:20 +00:00
Robert Osfield
efe52842fa From Aurelien Albert, "This submission is made against trunk version and add the loading of "glVertexAttribDivisor" extension." 2013-06-03 09:19:46 +00:00
Robert Osfield
56dc8fee01 From Laurens Voerman, "I made some changes to the top level CMakeLists.txt that might be usefull to other visualstudio users.
1> Disable project grouping for VCExpress users:  the version I proposed previously in
     Re: [osg-submissions] Cmake patch to support folders in IDE (29 Feb 2012)

2> Remove FIND_PACKAGE(OpenAL): not used in any project

3> add /wd4250 for Visual Studio 2012:
     suppress the errors caused by a microsoft fix for a bugfix.
     ref: "Warning messages VS2012..." on osg-users (30 May 2012)
"
2013-05-31 10:28:39 +00:00
Robert Osfield
9921c77136 From Ulrich Hertlein, "attached is a patch that fixes another clang++ compiler warning when returning
std::vector::size() as 'unsigned int'.
"
2013-05-31 10:23:49 +00:00
Robert Osfield
b6579c5c4a From Wang Rui, "The osgdb_nvtt plugin needs to be updated to work with the latest NVTT library, which changes the interface slightly (adding a new pure virtual method endImage()). I've modified the source file and attached it here." 2013-05-30 09:07:46 +00:00
Robert Osfield
ae4d87a3be Renamed PanoramicSphericalDisplay.cpp to fix a typo 2013-05-28 19:16:59 +00:00
Robert Osfield
6cb9115170 Updated ChangeLog and Contributors list 2013-05-28 16:39:48 +00:00
Robert Osfield
3722f46aff From Farshid Lashkari, "The logic for handling opacity maps in the 3ds reader seems to be incorrect. It checks whether the diffuse texture contains transparency, instead of the opacity texture. If the diffuse does not contain an alpha channel it outputs the warning:
The plugin does not support images without alpha channel for opacity

This seems to indicate that the check for alpha should be against the opacity map. I've attached the updated file.

"
2013-05-28 15:43:12 +00:00
Robert Osfield
4b223c770b From Michael Bach Jensen and Robert Osfield, "As discussed (http://forum.openscenegraph.org/viewtopic.php?t=12027) here is my submission :-)
The following change to State.cpp fixes the case where textures in a stateset along with a compute shader program did not make those textures available to the shader, since it got evaluated before the texture bind(s)."

Note from Robert, Michael only change State::apply(StateSet*) so I also applied the same reversal in apply of texutre modes/state into the State::apply() method for consistency.
2013-05-28 15:40:28 +00:00
Robert Osfield
fed4d91ecc Replaced the initialization of the strarray to use reseve instead of a initial size provided in the constructor as this was leading to a bug in output. 2013-05-28 15:18:59 +00:00
Robert Osfield
f730396f0a Fixed date typo 2013-05-28 14:40:36 +00:00
Robert Osfield
382c3322c9 From Farshid Lashkari, "I just started looking into the shader composition feature. I enabled shader composition on the osg::State object and noticed a 6x increase in draw time. I figured that the default composer might have performance issues, so I created a custom ShaderComposer that overrides "getOrCreateProgram" and does nothing. This still resulted in a performance drop.
I looked into the "State::applyShaderComposition" method and noticed that it will print debug information to the osg::INFO stream. I commented that line out and the performance drop was gone.

I'm not sure if the printing was accidentally left in or is meant to be enabled. I've modified the function to only call the print function if INFO logging is enabled. I've attached the change."
2013-05-28 14:35:44 +00:00
Robert Osfield
47f574429a From Marcin Prus and Robert Osfield, moved the key parts of the .dds plugins computeRowWidthInBytes implementation into the osg::Image::computeImageSizeInBytes(..) to
address bugs in the computation of image size.
2013-05-28 14:14:45 +00:00
Robert Osfield
d024444140 From Sukender, "Added ".dds" file deletion on writing failure." 2013-05-28 11:47:08 +00:00
Robert Osfield
492459e4dc From Sukender, "Added vertical flipping to the writer depending on the Image::getOrigin() value (= flip the image when Image::BOTTOM_LEFT). Most of the time this will not change DDS writing (= no v-flip), as it seems images are rarely "BOTTOM_LEFT". To skip this behaviour, the "ddsNoAutoFlipWrite" option was added.
I also moved a few lines of code about "dds_flip" option, and made options reading more like in other ReaderWriters."
2013-05-28 11:46:01 +00:00
Robert Osfield
53fd801088 From Diane Delallée & Sukender, "Added some support of non-modulus-4 dimensions in S3TC-DXTC images (previous implementation seem just not to handle these properly).
- Added missing packing value on S3TC images. Images are coded with 4x4 blocs, whatever the image size. So there is an horizontal packing of 4 pixels (2 bytes in DXT1, 4 bytes in DXT2-5).
- Added crash guard against writing corrupted S3TC images.
Notes:
- What is missing is a support of "lines packing" in osg::Image (see code comments).
- S3TC-DXTC vertical flipping crashes (access violation) with some unusual dimensions (see code). I could not implement missing cases, so I added guards to avoid crashing."
2013-05-28 11:44:36 +00:00
Robert Osfield
39b9351153 From Diane Delallée and Sukender, "1. Image.cpp
Failure to perform a vertical flip on S3TC-DXTC now simply leaves the original image instead of corrupting it.
Image.cpp was sometimes performing a "normal" (= for uncompressed images) vertical flip on S3TC-DXTC images, producing weird results.
Actually, code was trying a "DXTC vertical flip" and relied on the result to call a "normal vertical flip". But when the "DXTC v-flip" encounters an error, this is is not necessarily because the image is not S3TC (ex: unhandled image dimensions)!
So now the code simply does "if dxtc, then flip_dxtc; else flip_normal;".

Note from Robert Osfield, moved the isDXT function into the dxt_tool file and namespace.
2013-05-28 11:25:13 +00:00
Robert Osfield
81b6c82d9a Fixed the computation of the spot light direction. 2013-05-28 10:46:47 +00:00
Robert Osfield
d7931e3024 Fixed View::setUpViewInWindow() parameter 2013-05-28 09:20:48 +00:00
Robert Osfield
aa33d213dd Added an OSG_INIT_SINGLETON_PROXY(..) to initialize the static s_GLExtensionDisableString variable 2013-05-28 08:38:09 +00:00
Robert Osfield
267802c928 Updated AUTHORS file 2013-05-27 09:10:18 +00:00
Robert Osfield
f5508d35f9 Updated AUTHORS file 2013-05-27 09:07:53 +00:00
Robert Osfield
ac77a1e224 Updated ChangeLog and AUTHORS file 2013-05-27 09:05:14 +00:00
Robert Osfield
02e4aef5cb From Martin Naylor, "I am receiving 1 build error whilst building the SVN, its in osgforest as follows:
error C2065: 'GL_RGBA32F' : undeclared identifier

Shoudlnt that be GL_RGBA32F_ARB as defined in texture header?

Attached is the easy fix :)."
2013-05-27 08:13:23 +00:00
Robert Osfield
18c37d14cd Moved quad buffer definitions into include/osg/Camera 2013-05-27 08:10:42 +00:00
Robert Osfield
29f3393275 Updated AUTHORS file 2013-05-26 10:44:11 +00:00
Robert Osfield
ab69c1f9d4 Updated ChangeLog 2013-05-26 10:27:07 +00:00
Robert Osfield
f3d21bd285 From Farshid Lashkari, " small update to TangentSpaceGenerator to support QUAD_STRIP primitive types." 2013-05-25 10:09:23 +00:00
Robert Osfield
0eb95f01d8 Resrtuctured the use of static's in the Uniform::getNameID() method to avoid problems under Android. 2013-05-24 17:16:57 +00:00
Robert Osfield
2923c8014a From Jordi Torres, "We must use JNI_FALSE instead of false in JNI code. Otherwise the examples will not compile. This patch should be applied to osgAndroidExampleGLES1/jni and osgAndroidExampleGLES2/jni. the osgNativeLib.cpp is the same. " 2013-05-24 17:06:08 +00:00
Robert Osfield
88bbcaecd2 Removed redudent code 2013-05-24 09:43:08 +00:00
Robert Osfield
fb3178106a Fixed panning bug, when using RUN_ON_DEMAND, that resulted in the camera being thrown off towards infinity.
The solution for to refactor the way that events are checked so I add a bool return type to checkEvents() method across osgViewer::GraphcisWindow, osgGA::Devive and osgViewer::Viewer/CompositeViewer classes
2013-05-24 09:35:58 +00:00
Robert Osfield
1cd73f0238 Added repolation of the _deadparts stack which would otherwise been invalidatd by the depth sort of particles. 2013-05-23 18:29:47 +00:00
Robert Osfield
5de095cb1d From Pawel Ksiezopolski, Added example of using osg::TextureBuffer + GLSL to render forest. 2013-05-23 15:55:22 +00:00
Robert Osfield
2a32bcaca6 From David Fries, "This updates the CMakeLists.txt instructions for the commands
to make the doxygen documentation."
2013-05-23 14:14:51 +00:00
Robert Osfield
5e14865877 Refactored the idle mechanism to fix problems with the vnc thread going idle when it shouldn't have. 2013-05-23 12:29:55 +00:00
Robert Osfield
71874c2dc5 Added assigned of the InteractiveImageHandler as a cull callback to enable the interactive image to know when it's being actively used as part of rendering a frame. 2013-05-23 10:25:03 +00:00
Robert Osfield
448c93dbe9 Quitened down debug messages 2013-05-22 15:48:42 +00:00
Robert Osfield
544ef8be5a Removed debug messages 2013-05-22 13:16:44 +00:00
Robert Osfield
b72faed804 From Nico Kruithof, "For the VNC server, it seems that the wrong include path is used.
Instead of 
INCLUDE_DIRECTORIES(${LIBVNCCLIENT_INCLUDE_DIR})
the CMake variable 
INCLUDE_DIRECTORIES(${LIBVNCSERVER_INCLUDE_DIR})
should be used.

Attached is a fix for src/osgPlugins/vnc/CMakeLists.txt"
2013-05-22 13:09:38 +00:00
Robert Osfield
1284a0dd40 From Pawel Ksiezopolski, first email: "This submission adds texture buffer object ( defined in GL_ARB_texture_buffer_object extension ) to the osg::Texture* family.
TextureBuffer objects may use osg::Texture::bindToImageUnit(), so GLSL shaders are able to use not only texelFetch() function , but also functions defined in GL_ARB_shader_image_load_store extension : imageLoad(), imageStore(), imageAtomicAdd() etc."

second email: "After a while I found that osg::Texture::applyTexParameters() used with TextureBuffer may cause some OpenGL errors ( applying texture filters and wraps to TextureBuffer makes no sense ) so I fixed it."
2013-05-22 12:49:46 +00:00
Robert Osfield
7bd050e431 From Jan Ciger, "Here is a little patch to fix a bug in the InfluenceMap serialization. The names of the maps weren't quoted properly and therefore it was breaking loading of rigged models exported from e.g. Blender. Also names that contained spaces wouldn't have been parsed properly. " 2013-05-22 11:06:12 +00:00
Robert Osfield
9b77e757f2 From David Callu, "ust a simple IF ENDIF mismatch in last commit (I use git so no available SVN commit number ) :
CMake Warning (dev) in CMakeLists.txt:
  A logical block opening on the line

    /home/ledocc/work/perso/osg_Workspace/osg/CMakeLists.txt:823 (IF)

  closes on the line

    /home/ledocc/work/perso/osg_Workspace/osg/CMakeLists.txt:893 (ENDIF)

  with mis-matching arguments.

I remove ENDIF argument, it is no longer needed by cmake"
2013-05-22 10:28:07 +00:00
Robert Osfield
94fe9b5fd5 From Farshid Lashkari, "I'm working on a custom ShaderComposer and I need access to the full StateSetStack of the State object within the getOrCreateProgram() method. The problem is that "State::apply(const StateSet* dstate)" does not add the specified stateset to the stack. I'm not sure if this was intentional, but I've updated the function to push/pop the stateset.
I hope the change seems reasonable. I searched the entire code base for code that accesses the StateSetStack, and noticed RenderBin and RenderStage use it. However, I don't think that code would ever be called from within the State::apply() function, so I'm fairly confident the change should be safe."
2013-05-21 17:41:07 +00:00
Robert Osfield
2daff56860 From Valeriy Dubov, fix for Android build under OSX 2013-05-21 10:22:54 +00:00
Robert Osfield
255432f76b From Alexander Sinditskiy, "I just noticed that Dragger allways handle events even when
handle(const PointerInfo&, const osgGA::GUIEventAdapter&, osgGA::GUIActionAdapter&)
returns false.I think it is not correct...i think handled should be changed only when it is really handled."
2013-05-21 09:48:16 +00:00
Robert Osfield
9f66a10aa2 Added use of SingleWindow for when only one screen is used 2013-05-21 09:44:26 +00:00
Robert Osfield
455ebbc5f1 Refactored the support for stereo and keystone RTT setup so that it can be applied to an existing Camera. 2013-05-20 19:24:34 +00:00
Robert Osfield
acb4ba8554 Added support for controlling border and override redirect to the SingleWindow View::Config 2013-05-20 14:17:43 +00:00
Robert Osfield
086ffd1672 Added a dedicated RTT texture for each of the left and right eyes when doing ANAGLYPHIC stereo to avoid issues with scene graphs containing ClearNode's such as when using in Present3D 2013-05-20 10:23:03 +00:00
Robert Osfield
482581feb0 Added support for setting the left/right cull masks 2013-05-16 15:52:29 +00:00
Robert Osfield
6926cec135 Changed the default of OSG_SPLIT_STEREO_AUTO_ADJUST_ASPECT_RATIO to OFF 2013-05-16 14:51:07 +00:00
Robert Osfield
f54f4e40ed Fixed stereo offsets of HORIZONTAL_SPLIT and VERTICAL_SPLIT stereo modes 2013-05-16 14:11:23 +00:00
Robert Osfield
6cb26321a9 Reverted back to changes before experiements with ViewConfig 2013-05-16 14:07:35 +00:00
Robert Osfield
79ec0e863d Cleaned up the WoWVxDisplay command line parsing 2013-05-16 10:28:01 +00:00
Robert Osfield
3b6c2b636a Renamed osgViewer::Config osgViewer::ViewConfig and moved it's declaration into include/osgViewer. 2013-05-16 10:11:06 +00:00
Robert Osfield
e3ed763c15 Added WoWVxDisplay view config 2013-05-16 09:08:27 +00:00
Robert Osfield
625821a91a Created a dedicated include/osgViewer/config and src/osgViewer/config directories to place all the Config classes. 2013-05-15 16:15:38 +00:00
Robert Osfield
9552567cd4 Added support for osgViewer::Config in osgViewer::Viewer command line parsing 2013-05-15 12:50:38 +00:00
Robert Osfield
bcbaaefa02 Introduced osgViewer::Config base class and beginnigs of various Config implementations.
Introduced osgViewer serializers plugin for serialization support for osgViewer::Config implementations and Keystone
2013-05-15 11:31:49 +00:00
Robert Osfield
07499f6658 From Lionel Lagarde, "When a function do:
OSG_DEBUG << "Hello world!\n";

the underlying stream is not automatically flushed. It is flushed
if endl is queued instead of \n:

OSG_DEBUG << "Hello world!" << std::endl;


The notify macros do:
stream->setCurrentSeverity(severity);
return *stream;

So, if a function do:

OSG_DEBUG << "This is a debug message\n";
OSG_NOTICE << "This is a notice message" << std::endl;

the debug message will be classified as a notice message.

It is a problem when the application uses a NotifyHandler. The notify
method of the handler is called with:

severity = NOTICE
message = "This is a debug message\nThis is a notice message"

The attached Notify.cpp contains an automatic flush of the stream when
the current severity changes.

"
2013-05-14 16:23:53 +00:00
Robert Osfield
c238a7cca2 From Michael Kapelko, "The provided patch (against SVN revision 13380) adds missing constness to returning calls (without it the user code does not compile)." 2013-05-14 16:18:41 +00:00
Robert Osfield
0b2c3a9ddb From Farshid Lashkari, "The tga image loader was not properly reading in 16-bit images. Fix is attached." 2013-05-14 16:15:01 +00:00
Robert Osfield
1a683e2f83 From Ulrich Hertlein, "Attached is a patch that introduces 'static_cast<unsigned int>' on some instances where
the code returns '.size()' of a std::vector.  This caused some warnings when using clang++
on OS X."
2013-05-14 16:12:21 +00:00
Robert Osfield
93eb471d99 Updated ChangeLog 2013-05-14 13:35:10 +00:00
Robert Osfield
f1d5ba4278 Updated version after dev release 2013-05-14 13:34:54 +00:00
Robert Osfield
191cf8f5aa Added OSGUTIL_EXPORT for Windows build 2013-05-13 13:12:13 +00:00
Robert Osfield
1b599fc5ae Updated version number for dev release 2013-05-13 12:08:05 +00:00
Robert Osfield
127f3f6396 Updated ChangeLog for dev release 2013-05-13 11:59:34 +00:00
Robert Osfield
7b9cace094 Updated links to svn repository 2013-05-13 11:51:44 +00:00
Robert Osfield
01e8287b7d Fixed build for when automatic type conversion isn't enabled for ref_ptr<> 2013-05-13 11:02:40 +00:00
Robert Osfield
9249a59db2 Fixed the render order to the Render To Texture cameras used in stereo keystoning. 2013-05-13 09:53:54 +00:00
Robert Osfield
e9388d5ad8 Improved the use of the Keystone's defined in the DisplaySettings object. 2013-05-13 09:49:54 +00:00
Robert Osfield
4e34cadee2 Added to Viewer::realize() automatic setup using Keystone when available and enabled, and when no other window setup has been selected. 2013-05-13 09:18:37 +00:00
Robert Osfield
9402efe38e Added DisplaySettings::KeystoneHint flag that can be set via --keystone-on and --keystone-off command line parameters, and the OSG_KEYSTONE env var 2013-05-10 17:59:07 +00:00
Robert Osfield
5dd07e4d1c Added keystone file handling 2013-05-10 16:06:10 +00:00
Robert Osfield
9eb5465ff5 Added --keystone <filename> command line support into DisplaySettings, and added OSG_KEYSTONE_FILES env var support into osg::DisplaySettings. 2013-05-10 11:56:09 +00:00
Robert Osfield
9c1c34d765 Moved Keystone support from osgkeystone example into osgViewer::View 2013-05-10 10:00:38 +00:00
Robert Osfield
e545627571 Moved Keystone class into osgViewer library. 2013-05-09 15:18:14 +00:00
Robert Osfield
046c3fca7a Cleaned up event handler and namespaces in prep for integrating keystone functionality into osgViewer 2013-05-07 14:43:36 +00:00
Robert Osfield
8810d27f7c Added keystone support for left eye, right eye and quad buffer stereo 2013-05-07 13:34:47 +00:00
Robert Osfield
9bb4ed08e1 Added keystone setup to vertical split stereo suport and cleaned up the horizontal split stereo code 2013-05-07 11:13:50 +00:00
Robert Osfield
f30160a5a4 Commented out debug output 2013-05-03 20:12:15 +00:00
Robert Osfield
668d351765 Introduced new scheme for handling mouse events with osgViewer. The new scheme enables robust event handling even when using distortion correction render to texture Cameras. 2013-05-03 19:26:27 +00:00
Robert Osfield
63088ab63e As a test of new repository updated date in README.txt 2013-04-26 10:00:16 +00:00
Robert Osfield
a2615388db Refactored Keystone setup as a step toward integrating Keystone correction with stereo 2013-04-18 17:02:57 +00:00
Robert Osfield
adea6c9329 Implemented stereo support into osgkeystone as a testbed for moving stereo support from SceneView into osgViewer 2013-04-18 09:47:28 +00:00
Robert Osfield
65f23ba9af Implemented initial cut of anaglyphic stereo 2013-04-17 11:04:12 +00:00
Robert Osfield
5ce1ba67fb Changed point to osg::ref_ptr<> to prevent memory leaks. 2013-04-16 09:26:40 +00:00
Robert Osfield
34a6b38983 Preperation for adding stereo support direclty into osgViewer. 2013-04-15 14:21:32 +00:00
Robert Osfield
bc288d23dc Added support for enable/disabling the keystone editing using the Ctrl-g key to toggle the UI and grid on/off. 2013-04-12 13:01:51 +00:00
Robert Osfield
efbf05cd59 Moved keystone event handler onto the keystone distortion Camera. 2013-04-12 09:05:11 +00:00
Robert Osfield
835a80ae90 Refactoed the grid rendering so that it's now implemented as part of the distortion mesh pass, leaving the main scene graph alone. 2013-04-12 08:52:21 +00:00
Robert Osfield
f79d89e0ce Add support for a finer grained mesh on the distortion mesh for higher quality results. 2013-04-11 17:12:32 +00:00
Robert Osfield
7ff4be954b Moved the keystone geometry computation into a Keystone::compute3DPositions(..) method 2013-04-11 16:07:49 +00:00
Robert Osfield
830d21471b Removed old experimental keystone code to clean up the example 2013-04-10 16:36:49 +00:00
Robert Osfield
18d14065a5 Changed the way that the keystone geometry is calculated. 2013-03-28 10:46:24 +00:00
Robert Osfield
3cccecb79d Added keypad control of corner points 2013-03-27 16:29:01 +00:00
Robert Osfield
6a4741cf54 Moved local variable into local scope to avoid it being created when not used. 2013-03-26 17:03:22 +00:00
Robert Osfield
b1c342c027 Introduced shearing of the image 2013-03-26 16:47:52 +00:00
Robert Osfield
a5cea75d47 Improved the setup of the keystone distortion correction mesh. 2013-03-26 11:00:05 +00:00
Robert Osfield
dd8d7c2839 Updated developer release number 2013-03-21 16:42:09 +00:00
Robert Osfield
ed35a0a07a Added check against isVertexBufferObjectSupported() in set*Pointer() methods 2013-03-21 16:22:30 +00:00
Robert Osfield
6c723df2d6 Added keystone grid to aid editing 2013-03-21 11:35:21 +00:00
Robert Osfield
bc3cff2406 Added arrow key support. Added support for using ctrl and shift keys to modulate how senstive the mouse and key movement is when modifying the keystone parameters. 2013-03-20 14:03:28 +00:00
Robert Osfield
7aad7dfd78 Improve corner point tracking/keystone computation 2013-03-19 16:43:27 +00:00
Robert Osfield
1dba64ac6c Added event handle for interactive setting of keystone variables 2013-03-19 12:44:03 +00:00
Robert Osfield
890ecb6abb Experiments with modifying the projection matrix to provide keystoning. 2013-03-15 17:35:43 +00:00
Robert Osfield
ab55668ff3 Initial skeleton of new osgkeystone example 2013-03-14 16:24:22 +00:00
Robert Osfield
93e6a59c9a From Aurelien Albert, "There is a little bug in the osg::Group::insertChild method :
If the index is more than the size of _children vector, the new child is pushed at the end of the vector, but the index value is unmodified, so an incorrect value is passed to the "childInserted" method."
2013-03-11 17:16:32 +00:00
Robert Osfield
5d7049dd9c From Chris Hanson, " Adds missing copy for _bbox member variable to copy constructor:
LightPointNode::LightPointNode(const LightPointNode& lpn,const osg::CopyOp& copyop):
    osg::Node(lpn,copyop),
    _bbox(lpn._bbox),
    _lightPointList(lpn._lightPointList),
    _minPixelSize(lpn._minPixelSize),
    _maxPixelSize(lpn._maxPixelSize),
    _maxVisibleDistance2(lpn._maxVisibleDistance2),
    _lightSystem(lpn._lightSystem),
    _pointSprites(lpn._pointSprites)
{
}


  Lacking this causes _bbox to be uninitialized after LOD changes when paged databases refer to shared subgraphs.

"
2013-02-22 17:42:47 +00:00
Robert Osfield
68fdae5761 From Lukasz Izdebski,"added support for gl_SampleMaski." 2013-02-13 16:29:03 +00:00
Robert Osfield
3efcc51d76 From Jordi Torres, "This error occurs when compiling current OSG with the NDK >=r8c:
android-ndk-r8d/build/gmsl/__
gmsl:512: *** non-numeric second argument to `wordlist' function: ''. Stop.

This is discussed in this thread[1].
The solution is to add <uses-sdk android:minSdkVersion="8" /> to the manifest as the OSG library will only run in devices with Android>=2.2 (Froyo) with API level 8 [2].

The fix does not affect to older sdk's.

Thanks to Jan Ciger for spotting the bug and find a possible solution. "
2013-02-13 16:03:35 +00:00
Robert Osfield
63cd217c77 From Jordi Torres, Android build fix 2013-02-12 15:44:52 +00:00
Robert Osfield
21676c4db0 From Jordi Torres, fix for Android build 2013-02-12 15:40:21 +00:00
Robert Osfield
bce2e7d71d From Stephan Huber, fixed bug in setting _numMessagesPerEvent and added more debug information 2013-02-12 15:18:06 +00:00
Robert Osfield
f549a9cb38 From Mike Connell, "3 smaller fixes for the 3DS loader (against trunk)
1. Respect "noMatrixTransforms" option for matrices attached to meshes, not only those attached to nodes

2. traverse_nodes variable did the exact opposite of it's description.

3. Always try to load referenced textures, even if we can't find the files (in order to the the registry's ReadFileCallback have a stab at it)
"
2013-02-07 19:16:07 +00:00
Robert Osfield
b7ccf3f377 From Lukasz Izdebski , "I added write and read numInstances in PrimitiveSet." 2013-02-07 11:10:24 +00:00
Robert Osfield
2700c9d5e5 Updated SO version in prep for serialization foramt change 2013-02-07 11:08:34 +00:00
Robert Osfield
3d4aaacd14 Updated AUTHORS list 2013-02-07 08:46:44 +00:00
Robert Osfield
0e9d969c84 From Wee See, Support for importing OpenFlight Surface Material Codes using osg::Object::UserValue. Notes from Wee See:
See attached my ported code, which fulfills:

- using of setUserValue()/getUserValue()
- user-value will be attached to Geode or Drawable
- actually 3 values will be added: SMC (surface), FID (feature) and IRC (IRcolor). Its UserValue-names are < UA:SMC >, < UA:FID > and < UA:IRC > (without spaces!)
- user-value will be attached to Geode or Drawable
- has an option (named preserveNonOsgAttrsAsUserData) for control whether the UserValues should be attached (Default: no UserValues will be attached)

Reading out this values is very simple. Here is an example (uservalue-name without spaces!):

signed short smc;
if (myGeode.getUserValue("< UA:SMC >", smc))
{
  doSomethingWithTheGeodeAndItsSmc(myGeode, smc);
}
else
{
  // geode has no SMC
}
2013-02-06 16:04:13 +00:00
Robert Osfield
00c7e5e552 From Aurelien Albert, "This line,I use the "useVertexAttributeAliasing" mode in my application, and color arrays are not normalized, so shaders get [0.0-255.0] values instead of [0.0-1.0] values.
This patch fix this."

and those below, will be ignored
----

M    include/osg/State
2013-02-06 14:50:37 +00:00
Robert Osfield
c89d1968fd Added TODO note about RGB -> RGBA 2013-02-06 14:49:48 +00:00
Robert Osfield
29eb65c77d From David Longest, "I have updated the FFmpeg plugin to support the 1.0 release version of FFmpeg. The files attached were modified in order to facilitate the update. Below are the details for all changes made.
Header update

FindFFmpeg.cmake has been changed in order to support the new header include format for FFmpeg. In the 1.0 release, a new file had been added with the name “time.h” in the avutil library. The previous method of adding includes caused conflicts with the ANSI C “time.h” file. Now the include directive will only use the main include folder. All files using the old include format have been updated to reflect the change.



Added __STDC_CONSTANT_MACROS define to CMakeLists.txt

Since there is no guarantee that FFmpegHeaders.hpp will be included before stdint.h is included, the define has been moved from FFmpegHeaders.hpp to be part of the CMakeLists.txt for the FFmpeg plugin. This will allow the define to work on all compilers regardless of include order.



Replaced AVFormatParameters with AVDictionary

AVFormatParameters is no longer supported in FFmpeg and has been replaced with a key/value map of strings for each setting. FFmpegParameters and FFmpegDecoder has been updated to reflect this.



Replaced av_open_input_file with avformat_open_input

FFmpeg now opens files using avformat_open_input. Since the av_open_input_file method is deprecated, the FFmpegDecoder class has been updated to reflect this change.



Added custom AVIOContext field to options

Since some formats and inputs may not be supported by FFmpeg, I have added a new parameter that allows a user to allocate their own AVIOContext. This class will allow for creating a read, seek, and write callback if they desire.



Checking for start_time validity

It is possible for some file formats to not provide a start_time to FFmpeg. This would cause stuttering in the video since the clocks class would be incorrect.



Removed findVideoStream and findAudioStream

The new FFmpeg release already has a function that will find the best audio and video stream. The code has been replaced with this function.



Updated error reporting

Some functions would not log an error when opening a file or modifying a file failed. New logs have been added as well as a function to convert error numbers to their string descriptions.



decode_video has been replaced

The old decode_video function would remove extra data that some decoders use in order to properly decode a packet. Now av_codec_decode_video2 has replaced that function.



Picture format changed from RGBA32 to RGB24

Since most video will not contain an alpha channel, using a 24 bit texture will use less memory."
2013-02-06 12:46:03 +00:00
Robert Osfield
19bfa92c91 Simplified include/osg/Math to use Standard C++ maths headers - <cmath> and <cfloat> 2013-02-06 12:02:05 +00:00
Robert Osfield
0b3da415ef Fixed warning 2013-02-06 11:16:29 +00:00
Robert Osfield
09f42e1411 From Stephan Huber, fixed for Windows 64bit build 2013-02-06 09:20:10 +00:00
Robert Osfield
8ed0780967 Added .get()'s to fix compilation when ref_ptr<> type conversion is disabled 2013-02-05 18:22:46 +00:00
Robert Osfield
f9356603cf Updated ChangeLog 2013-02-04 16:25:52 +00:00
Robert Osfield
5297502a38 Updated version number after 3.1.4 developer release 2013-02-04 14:42:44 +00:00
Robert Osfield
aa6ace649b From Jordi Torres, "The info about cdash reports was outdated. Now it points to the right URL.
BTW I have checked it out and the cdash server is working ok again. "
2013-02-04 13:28:45 +00:00
Robert Osfield
796bced555 Fixed warning 2013-02-04 13:28:05 +00:00
Robert Osfield
f64feb783f Fixed warnings 2013-02-04 13:27:46 +00:00
Robert Osfield
39a3227397 Fixed warning 2013-02-04 13:11:13 +00:00
Robert Osfield
df6e752077 Fixed warning and converted tabs to four spaces 2013-02-04 12:50:51 +00:00
Robert Osfield
0781685b6c Fixed warnings 2013-02-04 12:38:08 +00:00
Robert Osfield
63575f53e1 Fixed warning 2013-02-04 12:01:26 +00:00
Robert Osfield
6ec15736cd Standardized use of GL_HALF_FLOAT_NV and GL_HALF_FLOAT_ARB to GL_HALF_FLOAT 2013-01-31 16:26:06 +00:00
Robert Osfield
9bc3b3316a From Stephan Huber, introduction of message id scheme were osc messages are sent with an unique id, and can be dispatched multiple times to workaround network packet losses. 2013-01-31 11:09:03 +00:00
Robert Osfield
5339864c17 Added handling of movies into Timeout 2013-01-30 11:31:27 +00:00
Robert Osfield
f5bd6b0487 Added disabling of the traversal of the Timeout in update when the timout is not displayed and disabled traversal by the SlideEventHandler. 2013-01-30 10:49:18 +00:00
Robert Osfield
1937cc6f14 Fixed the erronous header so that it is OSGPL like the rest of the osgAnimation. 2013-01-30 10:40:26 +00:00
Robert Osfield
366fcbf59b From Stephan Huber, "As I have not all referenced image-data, SlideShowConstructor crashed on my end. Attached is a fix for that crash." 2013-01-30 10:21:45 +00:00
Robert Osfield
84c857d24d From Wang Rui, "I've fixed the bug of writing/reading scenes including the ImageSequence serializer. Current trunk version will fail when handing image sequences because it forces to set className to "osg::Image" in InputStream.cpp. I have to read a value saved in file instead so I must add a hardhanded version checking for backward compatibility.
Now we can work with ImageSequence objects, in both osgt and osgb files."
2013-01-28 14:56:52 +00:00
Robert Osfield
45585b78fb From Laurens Voerman, "I have implemented and tested (on windows only) your suggestion for resetCullingMask(), it's far less intrusive than my previous submission.
attached are the changes to current svn (28 Jan 2013 / rev :13312).
"
2013-01-28 14:30:21 +00:00
Robert Osfield
0e7ae7319b From Thomas Hogarth, "Attached are two minor modifications to the master CMakeLists.txt file.
It now points to sdk version 6.0 (I do intend to make this configurable my command line)

It also added a search for libtiff to Apple builds mainly for use with osg earth."
2013-01-25 16:54:30 +00:00
Robert Osfield
26a8f63212 From Wang Rui, "In the attached files I've added the Compute Shader support for OSG, as well as serializer updates and a new osgcomputeshaders example. My submission also include a setComputeGroups() function in Program for setting compute-shader work groups, and a bindToImageUnit() function in Texture for binding textures as image variables in shaders.
All code are tested on Windows 7 + NVIDIA GFX 570 with the latest GeForce 310.70 Driver (BETA), which could support OpenGL 4.3.

Compute shader information can be found at "http://www.opengl.org/registry/specs/ARB/compute_shader.txt"
"
2013-01-25 11:54:03 +00:00
Robert Osfield
f6450a1123 From Lukasz Izdebski, "Adding this GL mode makes possibly to use this GL Modes (added in core OpenGL 3.2) in Windows." 2013-01-25 11:08:32 +00:00
Robert Osfield
a9fff529c7 Fixed compile warning 2013-01-25 10:36:42 +00:00
Robert Osfield
390b546389 Added debug message for Timout 2013-01-25 10:24:11 +00:00
Robert Osfield
5aa1234fa4 Fixed usage of META_NodeVisitor so it doesn't include "" 2013-01-24 18:48:34 +00:00
Robert Osfield
bada884342 From Pjotr Svetachov, "when you restart threading
with startThreading/stopThreading the _drawQueue and _availableQueue
are not reset properly. This can lead to a deadlock when threading is
started again. So before threading is started again the queues must be
reset. This deadlock is also reported earlier by someone else in here:
http://forum.openscenegraph.org/viewtopic.php?p=43415#43415"
2013-01-23 17:38:28 +00:00
Robert Osfield
d3e9b61f2b From Pjotr Svetachov, "small bug which I have found in the
FlattenStaticTransformsDuplicatingSharedSubgraphsVisitor: the visitor
will replace part of the tree when visiting the nodes but it does not
update the current node path to reflect this. If you then have
multiple nested transform nodes it will usually crash and sometimes it
won't crash but the resulting mesh will miss some nodes."
2013-01-23 17:37:26 +00:00
Robert Osfield
cd34312ea3 From Mathias Froehlich, "I have extended the dds loader by some newer DX10 texture formats. Especially
the float texture formats.
I need a few of these formats somewhere but have extended everything that I
found plausible and was easy to find a GL texture type/format for.
For some float32 type of texture the files the implementation seem to work fine.
The rest lacks testing.
The writer side is not implemented."
2013-01-23 16:27:22 +00:00
Robert Osfield
0b1605ed08 From Wang Rui with edits from Robert Osfield, additional GLenums for cross platform build 2013-01-23 16:22:45 +00:00
Robert Osfield
233a0a1782 From Lionel Lagarde, fixed typo bug 2013-01-23 15:54:20 +00:00
Robert Osfield
6f7570d4ac Removed redundent code block 2013-01-23 11:50:45 +00:00
Robert Osfield
9a7c9b2a50 From Lukasz Izdebski, "I found problem with rgb plugin.
Internal format of rgb image is wrongly set ( diffrent then in other images type  plugin ), because of that using rgb images in osg::Texture2DArray causes a bug."
2013-01-23 11:45:31 +00:00
Robert Osfield
e5ce3489a2 From Mathias Froehlich, "Attached is a patch that includes the stereo cameras in
Renderer::*etCameraRequiresSetUp.

I am not sure if the getter needs to be changed, but this is currently
included for consistency."
2013-01-23 11:20:00 +00:00
Robert Osfield
44002e77d2 From Alessandro Terenzi, "I've modified the avfoundation plugin to copy the preferredTransform matrix into the UserData property of the corresponding imagestream: by doing so, we can realize if the video should be transformed when applied as a texture (this should be the case, for instance, when we record a movie using an iOS device with any orientation different than 'landscape left')." 2013-01-22 16:53:50 +00:00
Robert Osfield
128eeb9b30 Added <template_layer name="layerbase_1"> and <layer inherit="layerbase_1"> functionality to .p3d functionality. 2013-01-22 16:13:59 +00:00
Robert Osfield
9b08c37373 Added extra check against whether node needs to be traversed in update and event traversals to prevent osgPresentation::Timeout being classified as a node that can be removed. 2013-01-22 10:33:19 +00:00
Robert Osfield
83f9d0f3e6 Added Options support to ImageSequence LOAD_* functionality 2013-01-18 17:11:49 +00:00
Robert Osfield
5fb8cd6a9c Update SO_VERSION to reflect new API changes 2013-01-18 16:30:55 +00:00
Robert Osfield
a0980734ac Added LOAD_AND_RETAIN_IN_UPDATE_TRAVERSAL and LOAD_AND_DISCARD_IN_UPDATE_TRAVERSAL ImageSequence::Mode's to allow for ImageSequence usage without using background paging threads, instead loading all the images on demand in the update traversal. 2013-01-18 16:21:17 +00:00
Robert Osfield
e7e517f2d0 Added <display_broadcast_event> and <dismiss_broadcast_event> support to <timeout> to allow the different timeout statges to be broadcast. 2013-01-17 13:51:52 +00:00
Robert Osfield
7129fce278 Changed the defaults of the Timeout to be DBL_MAX by default. 2013-01-17 11:57:18 +00:00
Robert Osfield
dd189f22e5 Completed <timeout> support, to use it with p3d use it along the lines:
<slide>
    <layer>
        <paragraph>Test</paragraph>
        <timeout>
            <idle_duration_before_timeout>3.0</idle_duration_before_timeout>
            <idle_duration_before_action>5.0</idle_duration_before_action>
            <key_starts_timeout_display>A</key_starts_timeout_display>
            <key_dismiss_timeout_display>S</key_dismiss_timeout_display>
            <key_run_action>D</key_run_action>
            <timeout_jump slide="0" layer="1"></timeout_jump>
            <timeout_event>w</timeout_event>
            <timeout_broadcast_event>t</timeout_broadcast_event>
            <image width="0.5">Images/lz.rgb</image>
        </timeout>
    </layer>
    <layer>
        <model>cow.osg</model>
    </layer>
</slide>
2013-01-17 11:48:20 +00:00
Robert Osfield
1fcadcf514 Added support for <timeout_jump> to Timeout support. 2013-01-17 09:51:15 +00:00
Robert Osfield
b8b8365c06 Implemented basic Timeout display and timing codes 2013-01-16 16:13:30 +00:00
Robert Osfield
81008c24df Added shell of Timeout class 2013-01-15 11:31:44 +00:00
Robert Osfield
93334e7df0 Added movie volume animation control to <image> and <stereo_image> tags to be used in the form:
<slide>
        <properties>
            <property name="volume" type="float">0.20</property>
        </properties>

        <property_animation>
            <key_frame time="0.0">
                <property name="volume" type="float">0.0</property>
            </key_frame>
            <key_frame time="2.0">
                <property name="volume" type="float">1.0</property>
            </key_frame>
            <key_frame time="10.0">
                <property name="volume" type="float">1.0</property>
            </key_frame>
            <key_frame time="12.0">
                <property name="volume" type="float">0.0</property>
            </key_frame>
        </property_animation>

        <layer>
              <image volume="$volume" looping="ON">big_buck_bunny_1080p_stereo.ogg</image>
       </layer>
    </slide>
2013-01-11 11:30:44 +00:00
Robert Osfield
4f8847dd50 Added support for <image delay="time" stop="time"> properties that works in conjunction with the start="time" property support checked in in previous submission,
together these control the delay, start position and stop position of movies.
2013-01-10 19:55:50 +00:00
Robert Osfield
e569671d13 Added support for <image "start=10"> property that tells a video to start specificied number of sections into a video. 2013-01-10 14:37:52 +00:00
Robert Osfield
c367e0771a From Stephan Huber, "thanks for your input, unfortunately I could not get it working with packing, but setting the row-length works now. Seems I had it wrong the first time.
Attached are both files. This should fix the video-bug mentioned on the dlf-wiki.

"
2013-01-10 10:53:22 +00:00
Robert Osfield
2391b42000 Changed the named colours back to having a alpha value of 1.0 to avoid problems with text not appearing. 2013-01-09 16:29:28 +00:00
Robert Osfield
f9736c4cf0 Added reset of the cursorFileName when hideCursor is activated to prevent the custom cursor being enabled. 2013-01-09 16:03:22 +00:00
Robert Osfield
7cc88c6e06 Added case for FORWARD_EVENT to address warning 2013-01-08 10:21:13 +00:00
Robert Osfield
da2efd5feb From Aurelien Albert, "I get a compile error on Windows VS2008 wih new DAE plugin, here is a fix :
_document = _dae->openFromMemory(fileURI, buffer.data());

"data" method is unknow for std::vector with VS2008

I've replaced it with :

    _document = _dae->openFromMemory(fileURI, &buffer[0]);
"
2013-01-07 15:03:22 +00:00
Robert Osfield
04ae78ac9b Added support for --show-cursor and --hide-cursor command line options, and P3D_SHOW_CURSOR env var that can be set to YES or NO. 2013-01-07 12:41:16 +00:00
Robert Osfield
e76e3a7b1b From Stephan Huber, "* osgGA: fixed a small bug regarding emulating mouse-events from touch-events
* resthttp/osc: encapsulate RequestHandler-classes in their own namespaces to prevent class-name-lookup-errors in the debugger/code (had some weird crashes)
* QTKit: fixed a compile-bug for gcc and blocks
* osgPresentation: click_to_* will fire on RELEASE, only if the drawable received a PUSH beforehand
* p3d/osgPresentation: implemented "forward_mouse_event_to_device"-tag, which will forward mouse-events to all registered devices of a viewer, if an intersection occurs. The mouse-coordinates get reprojected
* present3d: all devices get registered with the viewer
* osgViewer: only devices which are capable of receiving events are queried for new events.
* GraphicWindowIOS: added a flag to GraphicWindowIOS::WindowData to set up a retained backing buffer (defaults to false) This will enable read-back of the render-buffer with glReadPixels even after the renderbuffer got presented
* curl: added an optimized check for file-existance, now only the headers are requested and checked, instead of reading the whole file and handle it with a ReaderWriter
* p3d: fixed a bug, where the existence of a local file may prevent the remote loading of a file with the same name.

"
2013-01-07 12:17:26 +00:00
Robert Osfield
521625b343 Made UpdateVisitor::TravesalMode default to TRAVERSE_ACTIVE_CHILDREN 2012-12-20 16:16:07 +00:00
Robert Osfield
6d0e1bd50b Added region="$xmin $ymin $zmin $xmax $ymax $zmax" support to <model> tag, along with animation support via the <property_animation> support. 2012-12-20 12:14:53 +00:00
Robert Osfield
0aef0c2f20 Removed lighting of trk lines 2012-12-19 17:14:29 +00:00
Robert Osfield
16e54a00fb Changed the colour calculation and added gl_ClipVertex to enable clipping. 2012-12-19 12:38:17 +00:00
Robert Osfield
9f0906984b Removed erroneous region setting 2012-12-18 11:20:20 +00:00
Robert Osfield
634f597feb From Juergen Rensen, "This is a fix for the latest SVN version (rev 13269). The ‘destroyFrameBuffer’ method in ‘GraphicsWindowIOS.mm’ had ‘glDeleteFramebuffersOES’ calls for the stencil buffer, MSAA render buffer and MSAA depth buffer instead of ‘glDeleteRenderbuffersOES’. The fix changes the mismatched calls to ‘glDeleteRenderbuffersOES’.
The impact of the bug was a memory leak that would affect multi-sampling iOS apps that allow for device rotation or window resizing in general. For our app, the leak ranged from ca. 10 MB to 40 MB per device rotation, depending on device, for the MSAA buffers. I have not been able to confirm impact for the stencil buffer. "
2012-12-18 09:49:01 +00:00
Robert Osfield
c15d07caa1 Added support for RGBA colour buffer in osgframerenderer using the --rgba command line option (--rgb selects the standard non colour frame buffer which is the default). 2012-12-17 15:58:57 +00:00
Robert Osfield
f7bee82e99 Added handling of aspect ratio for vertical/horizontal split stereo. 2012-12-16 17:10:37 +00:00
Robert Osfield
d200ef90a7 From Stephan Hunber, "* now you can create a transparent opengl-view (see GraphicWindowIOS::WindowData)
* changes of the view's bound are reported via osg's event-system more reliably

"
2012-12-14 16:31:07 +00:00
Robert Osfield
4a0ce866c0 Updated SO version 2012-12-14 16:30:28 +00:00
Robert Osfield
32c0bc3b39 From Lionel Lagarde, "Here is a correction on the PixelBufferObject getter methods of Image.
The set method modify the buffer object of the BufferData while the get method returned the buffer object of the Image.

I've also removed the _bufferObject member of Image (not used anymore)."
--This line, Lionel Lagardeand those below, will be ignored--

M    include/osg/Image
2012-12-13 17:35:27 +00:00
Robert Osfield
c4b83d2b0c Added colouring and lighting of track using shader 2012-12-13 16:23:38 +00:00
Robert Osfield
a00c5e3a20 Fixed handling of image colour space conversion when pixel format changes 2012-12-11 17:45:20 +00:00
Robert Osfield
68c1360c96 Added automatic conversion of RGB to RGBA when doing REPLACE_ALPHA_WITH_LUMINANCE colour space conversion. 2012-12-11 17:27:22 +00:00
Robert Osfield
d86849fc35 Disabled lighting and set the colour to white 2012-12-11 10:44:00 +00:00
Robert Osfield
84d8eeb7cb First cut of generating lines from .trk data 2012-12-11 09:55:48 +00:00
Robert Osfield
e57e6c5409 Added setting of the fusion distance. 2012-12-10 11:11:19 +00:00
Robert Osfield
8d999a07cf Added --flip and --no-flip command line options to enable/disable a vertical flip of the captured image before writing out to disk. 2012-12-08 16:11:00 +00:00
Robert Osfield
22868bce4f From Stephan Huber, "attached you'll find a zip containing some bug-fixes and some refactored + new code.
* ZeroConfDevice does now return FILE_NOT_HANDLED instead of FILE_NOT_FOUND
* present3D supports multiple devices per env-var P3D_DEVICE, separate multiple device with a space

I refactored parts the p3d-plugin, the curl-plugin and parts of Registry and ReaderWriter. Currently the p3d-plugin tries to open all remote files with the help of the curl-plugin.

I added a new method to Registry called getReaderWriterForProtocolAndExtension. which will return a ReaderWriter which is capable in handling the remote file for the given protocol and extension. If no readerwriter is found for the given extension, a list is built of all readerwriters supporting the given protocol and this list is checked for support of wildcards (extension = "*"). If anything matches it get returned.

I added this principle also to the Registry, so now it's possible to register a generic ReaderWriter which can handle all filetypes for a given protocol, similar what curl is doing. All you have to do is to load the plugin at startup. The curl-fallback is still in place.

With these changes it is now possible to reference a movie inside a presentation without a server-address, read the presentation (with curl) and stream the movie with the correct plugin (e.g. QTKit)

"
2012-12-07 19:05:47 +00:00
Robert Osfield
e64d5e5eca Added template swapBytes method 2012-12-07 19:04:49 +00:00
Robert Osfield
8df5440a26 Added naming of root of presentation and used this in the setup of the position of the camera. 2012-12-07 13:59:57 +00:00
Robert Osfield
ccdca3d9bf Fixed handling of window size/projection matrix 2012-12-07 12:47:42 +00:00
Robert Osfield
aa3634979a From Stephan Huber, attached is a fix for the bug of present3D not loading fonts across http. I pass SlideShowConstructor's options-object to readFontFile when constructing any text-objects so freetype can pick up the font-data from the curl-plugin. It works fine now on my end. 2012-12-07 10:19:05 +00:00
Robert Osfield
363633a81d Intial shell of .trk plugin 2012-12-06 19:09:17 +00:00
Robert Osfield
6fa6de8593 From Stephan Huber, build fix 2012-12-06 18:12:00 +00:00
Robert Osfield
9ebf35cf05 Added default value for initialization of port number 2012-12-06 14:42:36 +00:00
Robert Osfield
d4c9ecf370 Fixed typo 2012-12-06 11:36:35 +00:00
Robert Osfield
66a11037ae Added creation of directory path for ouput if one is required 2012-12-06 11:36:13 +00:00
Robert Osfield
4cb5d59d35 From Stephan Huber, ZerConfDevice plugin for Windows and Apple 2012-12-06 08:02:08 +00:00
Robert Osfield
eed71f647d From Stephan Huber, "* imageio: removed ReaderWriterImageIO_IOS.cpp, refactored ReaderWriterImageIO to work on OS X and IOS
* avfoundation: added support for IOS (CoreVideo-support is still in development, works only for SDK >= 6.0, set IPHONE_SDKVER in cMake accordingly)
* zeroconf: added ZeroConf-device-plugin (Mac/Win only, linux implementation missing) to advertise and discover services via ZeroConf/Bonjour, on windows you'll need the Bonjour SDK from Apple
* osgosc: modified the example to demonstrate the usage of the ZeroConf-plugin (start the example with the command-line-argument --zeroconf)
* SlideShowConstructor: enable/disable CoreVideo via a environment variable (P3D_ENABLE_CORE_VIDEO)
* RestHttp: mouse-motion-events get interpolated
* RestHttp: unhandled http-requests get sent as an user-event to the event-queue, all arguments get attached as user-values to the event
* modified some CMakeModules to work correctly when compiling for IOS
* fixed a compile-error for IOS in GraphicsWindowIOS
* some minor bugfixes"
2012-12-05 17:15:53 +00:00
Robert Osfield
ce0f928f6f Added --screen-distance <distance>, --screen-height <height> and --screen-width <width> command line support and associated settings to the configuration file. 2012-12-05 11:41:27 +00:00
Robert Osfield
5a88734598 Moved the expansion of the key codes into ApplicationUsage so that help is only generated for non zero keycodes. 2012-12-05 10:13:51 +00:00
Robert Osfield
ea00708026 Fixed default camera position 2012-12-04 19:02:45 +00:00
Robert Osfield
761229f8f4 Changed the -w and -h options to --width and --height respectively. 2012-12-04 18:51:21 +00:00
Robert Osfield
32cffe2094 Cleaned up command line usage 2012-12-04 18:30:33 +00:00
Robert Osfield
b4af638af9 Tidied up command line docs. 2012-12-04 18:28:28 +00:00
Robert Osfield
9363aa5a89 Tidied up CaptureSettings and added command line docs 2012-12-04 18:21:53 +00:00
Robert Osfield
b6d19d1052 Added CameraProperty and associated command line parameters for controlling camera position and animation.
--center x y z
  --eye x y z
  --up x y z 
  --rotation-center x y z
  --rotation-axis x y z
  --rotation-speed degreesPerSecond
2012-12-04 12:47:46 +00:00
Robert Osfield
cbf6745da5 Added missing break; 2012-12-04 09:11:17 +00:00
Robert Osfield
24c612a2bd From Stephan Huber, "I've found a bug in SlideShowConstructor::findFileAndRecordPath which does return an empty string if the file was not found, and this empty string got added to the fileNames-vector, so the curl-plugin tried to load only an empty file-name, the directory-prefix. I fixed findFileAndRecordPath, so it returns the unmodified filename, which can then be loaded by the curl-plugin. Please review my fix, as I am not sure if it has any side effects, as I know the code not that well.
The file includes another small compile-fix when using float-matrices."
2012-12-03 16:49:47 +00:00
Robert Osfield
35d17d4654 Renamed souce file 2012-12-03 11:31:13 +00:00
Robert Osfield
7d947d79ff From Wang Rui, "I've found a very covert bug in current VDSM implementation. It makes the computation of positional texgen incorrect if the shadow scene is under one or more child cameras with view/proj offsets. Using current stage instead will fix it." 2012-12-03 10:10:46 +00:00
Robert Osfield
e4a42fa65c Fixed error in Unfiform set method 2012-12-03 09:50:41 +00:00
Robert Osfield
e6141b984d Added include of osc plugin directory to help with Windows build 2012-12-03 09:35:12 +00:00
Robert Osfield
9a2f7c7d8e From Wang Rui, build fix 2012-12-02 11:45:57 +00:00
Robert Osfield
3e32d9c8af Fixed crash when no CameraManipulator is assigned to the viewer 2012-11-30 20:03:31 +00:00
Robert Osfield
d831f1b538 Added support for 0x and numeric defintion of keys to be used with <click_to_event> functionality. 2012-11-30 16:52:59 +00:00
Robert Osfield
6eb3b2f091 Added support for pausing and restart the property_animation. 2012-11-30 15:43:31 +00:00
Robert Osfield
236e75b2be Added xml defined property/property animation to .p3d format for <volume> propeties:
alpha="$alphaname"
   cutoff="$cutoffname"
   region="$minx $miny $minz $maxx $maxy $maxz"
   sampleDensity="$densityname"
   sampleDensityWhenMoving="$densityname"
2012-11-30 14:21:45 +00:00
Robert Osfield
7ffde8abce From Stephan Huber, New OscSendingDevice and OscReceivingDevice classes 2012-11-28 13:28:20 +00:00
Robert Osfield
8b231ba8e3 From Stephan Huber, added event sending support into osgGA::Device along with implementation on this into the osc plugin. Added osgoscdevice example to demonstate this in action. 2012-11-28 10:43:58 +00:00
Robert Osfield
694e603d15 Added support for <properties> tag for <presentation>, <slide> and <layer> scope to compliment the scope of <property_animation> 2012-11-27 16:00:43 +00:00
Robert Osfield
42529ca415 Added preliminary support for <property_animation> 2012-11-27 15:09:44 +00:00
Robert Osfield
a31d603f9a From Stephan Huber, "Attached you'll find a new ImageSequence.cpp which will fix an issue I had when moving the mouse cursor over the left window-border, as the index becomes negative. And I added a UdpSocket.cpp-file with more debuggin-output via some sprinkled printf-calls. " 2012-11-22 15:13:46 +00:00
Robert Osfield
1f50f23f86 Simplified CMakeLists and adjusted OscHostEndianness to automatically detect the endian at compile time 2012-11-22 11:55:38 +00:00
Robert Osfield
9ef448c7b1 From Stephan Huber, updates to explictly set the HOST Endian using Cmake 2012-11-22 11:47:03 +00:00
Robert Osfield
56bc0b14bc Added explict handling of osg::Image, osg::HeightField, osg::Shader and osg::Node when doing writes to the archive. 2012-11-22 09:49:24 +00:00
Robert Osfield
f0b3a47735 From Stephan Huber, further work on osc plugin 2012-11-21 15:19:58 +00:00
Robert Osfield
4b4327aaae Moved static for local to global scope in Uniform.cpp and removed the local static usage in Registry.cpp 2012-11-21 14:27:54 +00:00
Robert Osfield
3a67eefd9f Refactored osgDB::Input::readObjectOfType to use a template, and updated associated wrappers to avoid using local static's 2012-11-21 13:38:11 +00:00
Robert Osfield
ea9e13a0c6 From Paul Martz, fix for Windows build 2012-11-20 18:41:30 +00:00
Robert Osfield
7e67ac7a34 From Stephan Huber, added missing windows dependency 2012-11-20 13:01:57 +00:00
Robert Osfield
f3e9967f47 Added ws2_32 library to Win32 build 2012-11-20 10:37:42 +00:00
Robert Osfield
8b30807ef1 From Paul Martz, build fixes 2012-11-19 11:25:52 +00:00
Robert Osfield
e2ee774705 Frm Stephan Huber, osc plugin that supports send and recieving events via UDP packets. 2012-11-19 10:48:37 +00:00
Robert Osfield
c005e6997c Added first cut implememtation of PropertyAnimation class 2012-11-16 15:40:41 +00:00
Robert Osfield
10c43a3052 Moved PropertyManager related classes out from SlideEventHandler into their own dedicated header/source file. 2012-11-15 12:11:19 +00:00
Robert Osfield
c48335baf7 Added support for P3D_UPDATE env var for setting the UpdateVisitor::TRAVERSAL_MODE. Accepted settings are "active", "Active", "ACTIVE", or "all", "All", "ALL". 2012-11-13 16:15:20 +00:00
Robert Osfield
e70ece8f10 Added --update-active and --update-all command line options that set the UpdateVisitor::TraversalMode to TRAVERSE_ACTIVE_CHILDREN and TRAVERSE_ALL_CHILDREN respecively. 2012-11-13 15:26:06 +00:00
Robert Osfield
057f8a8b3b Added support for <image blending="ON" or blending="OFF"> to allow user definition of when to enable OpenGL blending for an image or not. 2012-11-13 14:22:37 +00:00
Robert Osfield
0c02ef358f From Stephan Huber, fixed warning 2012-11-13 13:52:33 +00:00
Robert Osfield
933baf5db4 Changed COLOUR to COLOR to be consistent with OpenGL spelling 2012-11-13 13:32:01 +00:00
Robert Osfield
92975a01fd Moved colour space conversion of volumes from the osgvolume example into osg/ImageUtils and added support for colorSpaceConversion="MODULATE_ALPHA_BY_LUMINANCE","MODULATE_ALPHA_BY_COLOUR","REPLACE_ALPHA_WITH_LUMINANCE" and "REPLACE_RGB_WITH_LUMINANCE" to .p3d <volume> tag 2012-11-13 13:16:10 +00:00
Robert Osfield
e72af02c2b Added first step to adding pruning of expired image requests. 2012-11-13 11:45:20 +00:00
Robert Osfield
ad1cec1b2e From Stephan Huber, introduced syncornization of osgGA::Device 2012-11-13 11:20:36 +00:00
Robert Osfield
bf4daf11ff Cleaned up reported of events and added assigned of <volume> tag region properities when using the wildcard definition of the volume. 2012-11-12 16:46:08 +00:00
Robert Osfield
79ae9cd8a3 Added osgframerenderer example 2012-11-12 15:26:30 +00:00
Robert Osfield
e9a7b2a6e5 Changed the default settings to fix a jump problems 2012-11-12 10:36:21 +00:00
Robert Osfield
e8b86dc4ec Added missing files in support of key_jump and key_run tags 2012-11-10 12:12:24 +00:00
Robert Osfield
ff476e9c15 Added support for naming slides and layers with slide_name and layer_name properties respectively.
Added support for creating events based on key presses using a <key_to_run> and <key_to_jump> tags.
2012-11-09 21:32:54 +00:00
Robert Osfield
fd4126dc59 Added Node::getName() and getUserDataContainer() to check to see if an node can be removed or not. 2012-11-09 21:23:42 +00:00
Robert Osfield
36f6ef7242 From Alexander Sinditskiy, "I found issue with capturing mouse buttons.
This issue can be reproduced:
1. Create osgViewer window,
2. Push right&left mouse buttons on the osgViewer window,
3. Move mouse out of window, and release right&left mouse buttons.

osgViewer window handle only first mouse release, as result window thinks that we did not released second mouse button.

I attached fix for this issue."
2012-11-08 17:19:51 +00:00
Robert Osfield
1b871a822d Added support for <imagesequence interaction_mode="USE_MOUSE_Y_POSITION"> 2012-11-08 15:45:23 +00:00
Robert Osfield
b6c6885a97 Changed the way the mouse position is update to handle the remote device control. 2012-11-08 15:28:24 +00:00
Robert Osfield
b51bbaa406 Added check to avoid doing update when the imagesequence is empty. 2012-11-08 14:15:59 +00:00
Robert Osfield
014f13f774 Refactored ImageSequence to better handle random access usage. 2012-11-08 11:19:31 +00:00
Robert Osfield
17b372ec38 Tweaked casts/types to fix build under Linux 2012-11-06 17:49:32 +00:00
Robert Osfield
679956e79a Added f qualifer to 1.0 to fix build problem under MSVS 2012-11-06 14:25:28 +00:00
Robert Osfield
4fa32ee0b8 From Stephan Huber, improved performance by using native apple functions for flipping image 2012-11-06 11:18:33 +00:00
Robert Osfield
f09b9576c6 From Stephan Huber, "Attached you'll find a fix for the image-io-plugin to handle out-of-memory situations more gracefully as before (don't crash)" 2012-11-05 17:22:34 +00:00
Robert Osfield
7cb6e103f4 Quitened down debug output 2012-11-05 12:21:34 +00:00
Robert Osfield
d7ce523529 From Stephan Huber, updated to debug output to RestHttpDevice and tweaks to ImageIO and QTKit plugins 2012-11-05 12:03:50 +00:00
Robert Osfield
18d66619b0 Added static cast to float to avoid compile error under MSV 2012-11-05 09:36:00 +00:00
Robert Osfield
e45bdb60d7 From David Longest, "When drawing, a transform with an absolute reference frame will ignore the
calculated model / view matrices up to that point. The IntersectionVisitor would instead keep the
view matrices calculated up to that point even though the Transform class will throw out the
calculated model matrix via “computeLocalToWorldMatrix.”

The change I made will push an identity matrix as the view matrix when running into a transform
with an absolute reference frame and will pop the matrix off after the traverse.

To test this, I created a camera with a perspective view and added a transform with some geometry
in it. Afterwards, I set the transform’s reference frame to ABSOLUTE_RF and spun the camera around
using the trackball manipulator. When trying to pick with a LineSegmentIntersector, it would not
pick the geometry in the transform with the reference frame set to ABSOLUTE_RF."
2012-11-01 18:06:46 +00:00
Robert Osfield
2e1f90f7e8 Changed the PropertyEventCallback to only respond to mouse releated events. 2012-11-01 16:11:13 +00:00
Robert Osfield
9271b53c56 2012-11-01 14:29:26 +00:00
Robert Osfield
98e9f187b3 Added reading of the P3D_DEVICE env var for setting up the --device entry. 2012-10-31 17:06:29 +00:00
Robert Osfield
a6f3e0af78 Added event and update callbacks to pass up changes to the mouse position to the ImageSequence::seek() to control which images is selected based on mouse x position 2012-10-31 16:07:23 +00:00
Robert Osfield
fa2fb07609 From Stephan Huber, RestHttpDevice plugin for support of remote application control via Rest http. 2012-10-30 12:31:27 +00:00
Robert Osfield
d879cd7715 Intial work towards support an interaction <imagesequence> tag in Present3D. 2012-10-29 15:58:02 +00:00
Robert Osfield
ce623c697e From Luc Frauciel, "Compile Fix - KTX plugin with Visual Studio, <stdint.h>not defined under MSVC" 2012-10-26 15:31:18 +00:00
Robert Osfield
cebb9f6103 Fixed bug in click_to_run feature where events would be handled by hidden labels 2012-10-24 16:10:38 +00:00
Robert Osfield
f9fd4342ba From Stephan Huber, "attached you'll find the latest versions of the QTKit + the AVFoundation-plugin, some changes to osgPresentation and a small enhancement für ImageIO.
I fixed some bugs and did some more tests with both of the video-plugins. I integrated CoreVideo with osgPresentation, ImageStream has a new virtual method called createSuitableTexture which returns NULL for default implementations. Specialized implementations like the QTKit-plugin return a CoreVideo-texture. I refactored the code in SlideShowConstructor::createTexturedQuad to use a texture returned from ImageStream::createSuitableTexture.

I did not use osgDB::readObjectFile to get the texture-object, as a lot of image-related code in SlideShowConstructor had to be refactored to use a texture.  My changes are minimal and should not break existing code.

There's one minor issue with CoreVideo in general: As the implementation is asynchronous, there might be no texture available, when first showing the video the first frame. I am a bit unsure how to tackle this problem, any input on this is appreciated.

Back to the AVFoundation-plugin: the current implementation does not support CoreVideo as the QTKit-plugin supports it. There's no way to get decoded frames from AVFoundation stored on the GPU, which is kind of sad. I added some support for CoreVideo to transfer decoded frames back to the GPU, but in my testings the performance was worse than using the normal approach using glTexSubImage. This is why I disabled CoreVideo for AVFoundation. You can still request a CoreVideoTexture via readObjectFile, though.
"
2012-10-24 10:43:01 +00:00
Robert Osfield
1591fe09f3 Added osgGA::Device class for integration of both physical and virtual devices.
Added template readFile(..) function to make it more convinient to cast to a specific object type.

Added support for osgGA::Device to osgViewer.

Added sdl plugin to provides very basic joystick osgGA::Device integration.
2012-10-23 16:15:03 +00:00
Robert Osfield
f9ad1e5673 Added mutex lock to Uniform::addParent()/removeParent(). 2012-10-22 16:21:04 +00:00
Robert Osfield
1872137d88 Added serializers for osgGA 2012-10-12 14:51:08 +00:00
Robert Osfield
ad926d7265 Removed the insert of requests in the ImageSequence::_filesRequested data structure so that it always requests files, leaving it up the ImagePager to decide to track duplicates 2012-10-09 16:14:21 +00:00
Robert Osfield
9fab99ddd9 From Wang Rui, "I modified the Serializer header to add a UPDATE_TO_VERSION_SCOPED
macro, which could set version within brackets and reset it after
that. All related serializers are also modified so that the
backward-compatibility bug reported by Farshid can be fixed.
"

From Robert Osfield, removed the use of osg::Referenced and creating the proxy object on the heap.
2012-10-09 16:05:50 +00:00
Robert Osfield
16de7e9f33 From Wang Rui, "I've added CDATA tag support to XmlParser so that we can keep user
data (e.g., GLSL shader texts) in XML files without parsing them. This
will be necessary for the coming-soon effect compositor submission.
:-)"
2012-10-08 16:14:23 +00:00
Robert Osfield
94e8c42569 Added a static_cast to avoid build issues under Windows 2012-10-08 16:12:59 +00:00
Robert Osfield
03a9786b11 Fixed warning 2012-10-08 16:03:16 +00:00
Robert Osfield
7244e97850 From Aurelein Albert, "Under some Visual Studio configuration, I get compile error on "lib3ds_io.c" due to use of these kind of conversion :
b[1] = uint8_t((w & 0xFF00) >> 8);

I replaced it with :

    b[1] = (uint8_t)((w & 0xFF00) >> 8);

And it compiles fine
"
2012-10-08 15:10:56 +00:00
Robert Osfield
4235169d41 From Gill Peacegood, "In the attached file I have changed the colour space used for writing images to match the one used for reading images. Also this color space does not make subtle changes to the original colours which i think is probably what most people intend when writing an image and is more consistent with other plugins.
The effect is that an image that is written does not have a noticeably different colour when it is read back."
2012-10-08 12:00:53 +00:00
Robert Osfield
232bda3828 From Oren Fromberg, ""
--This line, and thosAttached is an update to ReaderWriterDAE.cpp/h and daeReader.cpp/h that implements

osgDB::ReaderWriter::ReadResult

ReaderWriterDAE::readNode (std::istream&, const osgDB::ReaderWriter::Options*)

This virtual function had never been implemented in ReaderWriterDAE. I implemented this function because the DAE plugin could not load files from other ReaderWriter derived objects that use protocol handlers.

I have updated function declarations in the header to have identical signatures with the base class declarations that include the default parameter.


readNode (std::istream&, …) is nearly identical to readNode(const std::string &, …) except it uses a new private function to convert the file from standard input:

bool daeReader::convert( std::istream& fin )

When this function is called fileURI is the string “from std::istream” to make the user aware where the file is coming from. Then instead of calling

_dae->open(fileURI)

we call

_dae->openFromMemory(fileURI, buffer.data())

Where buffer.data() is a pointer to the dae file text in memory.


Other changes include private functions to clear caches and to consolidate redundant code that appears between the two convert functions.


e below, will be ignored--

M    src/osgPlugins/dae/ReaderWriterDAE.cpp
M    src/osgPlugins/dae/daeReader.cpp
M    src/osgPlugins/dae/ReaderWriterDAE.h
M    src/osgPlugins/dae/daeReader.h
2012-10-08 11:54:40 +00:00
Robert Osfield
b742a9e71a From James Athey, "I've attached a new osgDB ReaderWriter that can read Khronos Texture Files
(KTX).  The KTX file format is straightforward and designed to be easy to
use in OpenGL.

http://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/
http://www.khronos.org/opengles/sdk/tools/KTX/

The attached plugin can read:

* 1D, 2D, and 3D textures
* uncompressed and compressed images
* mipmapped and non-mipmapped textures
* little-endian and big-endian files
* textures from files as well as seekable istream objects

It does not handle:

* array textures (not supported by the ReaderWriter API)
* cubemap textures (not supported by the ReaderWriter API)
* the "KTXorientation" key-value pair; support could be added later (see
the file format spec for more information)
* non-seekable istream objects (would require more complicated memory
management)
"
2012-10-08 11:10:25 +00:00
Robert Osfield
740f660ef1 Made TouchData and osg::Object to aid with serialization. 2012-10-05 16:31:23 +00:00
Robert Osfield
47c5ddbce5 Improved ImageSequence's handling of seek() and added a simply hack to ImagePager to prevent the number of requests accumulating. 2012-10-05 10:37:36 +00:00
Robert Osfield
77bd6cbfe9 From Stephan Huber and Robert Osfield, addded interactive setting of the ImageSequence::seek() based on the mouse x position. 2012-10-05 10:35:06 +00:00
Robert Osfield
2e79a0e2d4 Added set methods to assist with serialization support 2012-10-05 10:07:09 +00:00
Robert Osfield
23786604c6 From Stephan Huber, "attached you'll find a fix for Registry.cpp not using the QTKit-plugin for video-files. W/o this fix you had to preload the plugin to open movie-files." 2012-10-04 13:45:54 +00:00
Robert Osfield
1796d55bea From Stephan Huber, OSX and iOS Video support via a QTKit plugin from OSX 10.7 and before, and an AVFoundation plugin for iOS and OSX10.8 and later. 2012-10-02 14:07:12 +00:00
Robert Osfield
0dbafcc316 From Leigh Stivers, "We had this problem which shows up with nVidia's latest Quadro driver, 305.93 - and older drivers when the nVidia's setting "Thread Optimization" was turned on, running Windows 7. The symptom, is that after creating a first view and using it, and then creating a second view, the first view will never render anything but black.
What happens is this:
A view is created, and then the viewers thread is created and runs.
The setReleaseContextAtEndOfFrameHint is true.
To create a second view, the viewer is setDone(true), and we wait for the thread exit.

At this point, inside the ViewerBase::RenderingTraversals code, there are places where it reads "if(_done) return;"

The problem, is that it won't reach the code that will releaseContext().

Apparently, this driver won't let any other thread to makeCurrent(), if another thread (dead or not) has ownership.  So when the Viewers is re-started, the first view won't be able to use the gc.

The change attached (against rev 13153) corrects this."
2012-09-28 16:36:42 +00:00
Robert Osfield
4896edda56 From Thomas Hogarth, "Apple have decided in their eternal wisdom to do away with separate depth and stencil buffers on iOS from version 5 and above.
Attached are changes to GraphicsWindowIOS.mm to support setting up the new buffer type when compiling for iOS5,
also attached is a small change to FrameBufferObject.cpp to report support for packed depth stencil via the
GL_OES_packed_depth_stencil extension.

For anyone reading this you can attach a packed depth stencil to your FBO like so

_rttCamera->attach( osg::Camera::PACKED_DEPTH_STENCIL_BUFFER, GL_DEPTH24_STENCIL8_EXT );

Luckily GL_DEPTH24_STENCIL8_EXT happens to have the same value as iOSs GL_DEPTH24_STENCIL8_OES"
2012-09-27 08:34:56 +00:00
Robert Osfield
03047f3e7f From Paul Martz, "This change to include/osg/GL correctly includes the OpenGL header on OSX 10.7 when building OSG trunk for GL3. It also adds some CPP defines for compatibility." 2012-09-26 08:42:04 +00:00
Robert Osfield
86a37616f7 Changed dispatch to virtual 2012-09-25 11:04:11 +00:00
Robert Osfield
0e8bcc9027 From Frederic Bouvier, "fix PNG write for images with bits per components different than 8 that was hard coded." 2012-09-24 10:10:28 +00:00
Robert Osfield
ea631c777d From Aurelien Albert, "In the DXF plugin, DXF layers are decoded and each layer is added in a separate group, which is very usefull to retrieve a layer or display a list of all layers in the aplication.
But the layers are not always children of the "model root" node : there can be a matrix transform between "model root" and "layers parent", so I've added the name "Layers" on the node which contains all layers to easily retrieve the layers groups from application code."
2012-09-20 14:06:01 +00:00
Robert Osfield
b3f8679b69 From Luc Frauciel, Added sRGB FrameBuffer string 2012-09-20 14:03:47 +00:00
Robert Osfield
f804d7dd81 From Vladimir Cheaev, "
I worked with a osg::Constraint and found strange part of code:
class OSGMANIPULATOR_EXPORT Constraint : public osg::Referenced
{
    public:
...
        virtual bool constrain(ScaleUniformCommand& command) const     { return constrain((MotionCommand&)command); }
        virtual bool constrain(const Rotate3DCommand& command)         { return constrain((MotionCommand&)command); }
...

If i use osgManipulator::Rotate3DCommand then method Rotate3DCommand::accept(const Constraint& constraint) calls Constraint::constrain(MotionCommand&) instead Constraint:: constrain(const Rotate3DCommand&).

If you replace
        virtual bool constrain(const Rotate3DCommand& command)         { return constrain((MotionCommand&)command); }
on to
        virtual bool constrain(Rotate3DCommand& command) const         { return constrain((MotionCommand&)command); }
then all works correctly.
"
2012-09-20 11:27:57 +00:00
Robert Osfield
01c7d87b1a From Farshid Lashkari, Added GLBeginEndAdapter::reset(), and _overallNormalAssigned, _overallColorAssigned flags to avoid the GLBeginEndAdapter adapter setting colour and normals when none has been assigned. 2012-09-20 11:18:19 +00:00
Robert Osfield
d511288718 From Ulrich Hertlein, "attached is a patch to src/osgViewer/CMakeLists.txt that inverts the logic of when to use
Cocoa and when to use the old Carbon interface for the windowing system.

The old code had to be modified for every new OS X release to default to Cocoa.
The new code uses Carbon for <= OS X 10.4 and Cocoa on everything else."
2012-09-20 11:16:02 +00:00
Robert Osfield
b32cf216a7 Added ReadQueue::size() method to help with debugging. 2012-09-20 11:14:10 +00:00
Robert Osfield
67abc66d8a Added handling of directory names in osgimagesequence commandline.
From Stephan Huber, added support for controlling the ImageSequence seek position via mouse x position, toggled on/off via 'i' key.
2012-09-12 16:35:12 +00:00
Robert Osfield
5d5cf26138 Added osgDB::getSortedDirectoryContents and osgDB::FileNameComparator to help with sorting directory contents into alphabetic and numerical order. 2012-09-12 16:02:02 +00:00
Robert Osfield
cfe36876d4 Converted sorting of directory contents across to use the new osgDB::FileNameComparator and osgDB::getSortedDirectoryContents() 2012-09-12 11:09:41 +00:00
Robert Osfield
7fe5db073b Updated version after 3.1.3 dev release 2012-09-10 08:24:49 +00:00
Robert Osfield
7233b2117c Updated ChangeLog for 3.1.3 dev release 2012-09-07 17:04:31 +00:00
Robert Osfield
f288f9e996 From Wojciech Lewandowski, "With current trunk I had an error while compiling osg/Image.cpp for IOS simulator / GLES2. Symbol GL_RGBA16 was missing. Adding #define GL_RGBA16 0x805B to Image header solves the problem. " 2012-09-07 14:55:09 +00:00
Robert Osfield
55d03d5b34 Added setting of the input range of the event state based on the master cameras viewport. 2012-09-07 09:31:26 +00:00
Robert Osfield
53405c118a Added check so not intialization is down when you select the current camera manipulator 2012-09-07 08:33:24 +00:00
Robert Osfield
0b778533c8 From Piotr Domagalski, "I've added reading of node names ('DEF' element) to the VRML reading plugin. The changes were based on trunk's version of the plugin." 2012-09-06 13:53:58 +00:00
Robert Osfield
46104008c7 From Piotr Domagalski, "I've rewritten some bits of the STL plugin in order to support ASCII STL files with multiple named solids (reading and writing). The names are also used as OSG nodes names.
- Also, a 'dontSaveNormals' was added. It allows to ignore normals when writing an STL file. For example, it is useful for me when writing an STL file for CFD simulations.

- Some comments and code formatting were improved (to be consistent with the formatting already used in the plugin).

- With 'separateFiles' option files are now named fooX.stl instead of foo.stlX

The changes have been tested on various STL, both ASCII and binary found on the net. The change was based on the trunk branch."

From Robert Osfield, changed assert in Piotr's code to a runtime check warning report.
2012-09-06 13:48:17 +00:00
Robert Osfield
3b8802c5aa From Piotr Domagalski, "Currently, code using OpenSceneGraph doesn't build with clang due to the way __sync_bool_compare_and_swap() is used in OpenThreads/Atomic header file.
I tested it with clang 3.1 and it seems that clang is enforcing the use of the same type for all parameters in this builtin. Looking at the function declaration [1]

bool __sync_bool_compare_and_swap (type *ptr, type oldval type newval, ...)

it seems to be doing the right thing: here the same type is used for *ptr, oldval and newval.

[1] http://gcc.gnu.org/onlinedocs/gcc/_005f_005fsync-Builtins.html#g_t_005f_005fsync-Builtins
"
2012-09-06 10:52:28 +00:00
Robert Osfield
5a99e4672e From Fredric Bouvier, fix to CMake build selection of FLTK 2012-09-06 10:32:07 +00:00
Robert Osfield
39dcea9ebb From Colin McDonald and Robert Osfield, converted Traits::sharedContext from GraphicsContext* to osg:observer_ptr<GraphicsContext> to prevent dangling pointer issues. 2012-09-05 21:03:41 +00:00
Robert Osfield
63444f648f Fixed inappropriate comment 2012-09-05 13:51:34 +00:00
Robert Osfield
f5a3c40934 Moved the OSG_INIT_SINGLETON_PROXY macro into include/osg/Object to make it more generally useful and added it's usage into the RenderBinPrototypeList initialization. 2012-09-05 13:48:23 +00:00
Robert Osfield
3c9a0cdfd7 From Thomas Hogarth, "I submitted a change for the IOS CMake system a few weeks back which hasn't made it into the trunk. I've just made the modifications again against the latest trunk and have attached the file
It basically accounts for the fact that XCode has changed it's default install location.

"
2012-09-05 10:27:08 +00:00
Robert Osfield
e8c4a6785c From Andreas Ekstrand, The attached ESRIShape.cpp contains fixes for comparing calculated byte sizes with the content length from the record header. According to the ESRI Shape documentation (http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf), the content length is specified in 16 bit words, which is why I have multiplied it by 2 when comparing to byte sizes. Note that the comparison in line 813 is made with a fix number of 16-bit words so it hasn't been changed.
This fixes problems with PolygonZ records where the previous code was reading past the end of the record since it thought it had M values even if it didn't. I suspect the problem that James McGlone had back in 2006 was the same but reversed, when he tried to simply comment out the check, which was a (correctly) refused submission.""
2012-09-05 10:24:10 +00:00
Robert Osfield
a5478cf910 From Nico Kruithof, "There is a small typo in the ShapeDrawable code for a sphere. There was a gl.Begin(GL_QUAD_STRIP) that was never closed, nor used.
"
2012-09-05 10:19:01 +00:00
Robert Osfield
fd2ee19b62 Updated SO version number to avoid collision with new additions to serializers 2012-09-05 09:30:33 +00:00
Robert Osfield
5c9a302beb Added GL_RGBA8 and GL_RGBA16 entries to the Image::computePixelFormat() and improved he readability of the method by inserting line spacing. 2012-09-05 09:08:25 +00:00
Robert Osfield
e93a838222 From Ulrich Hertlein, "fixes a typo and adds support for OS X 10.8" 2012-09-05 08:48:10 +00:00
Robert Osfield
bc533022ae Added deprecated note to indices entry. 2012-09-05 08:42:14 +00:00
Robert Osfield
0172bacdf4 From Brad Christiansen, changed OSG_INFO to OSG_DEBUG to quieten down volume of messages in INFO 2012-09-04 08:21:09 +00:00
Robert Osfield
568aeef975 From Brad Christiansen, "fix for the NVTTImageProcessor. When the code was updated in revision 12912 a couple of typos where made. These cause a crash when compressing transparent images and mangled colours when compressing rgb images. " 2012-09-03 15:19:00 +00:00
Robert Osfield
30c35cb407 Adjusted the #define's to help GLES2 build 2012-09-03 09:08:16 +00:00
Robert Osfield
0ce9407c69 From Lilin Xiong, " there is a small bug in osgDB::readNodeFiles(std::vector<std::string>& fileList,const Options* options) in file ReadFile.cpp line 85:
osg::Node *node = osgDB::readNodeFile( *itr , Registry::instance()->getOptions() );
   It should be:
   osg::Node *node = osgDB::readNodeFile( *itr , options );"
2012-09-03 08:30:01 +00:00
Robert Osfield
f13dd3d75d Added a fix for a multi-threading bug that occured when TerrainTiles were accessed via the Terrain::_updateTerrainTileSet that were being deleted at the same time by the DatabasePager thread. 2012-08-31 16:00:55 +00:00
Robert Osfield
8961d45ebf From Wang Rui, "This patch fixes a problem of the osg::Program serializers that can't
save/load GeometryInputType data correctly. The bug is initially found
by John Kelso."
2012-08-29 16:48:27 +00:00
Robert Osfield
794e0e71f4 From Johannes Scholz, fix for writing out of hexidecimal numbers 2012-08-24 15:05:03 +00:00
Robert Osfield
e489767f71 Fixed bug in GLBufferObjectSet::discardAllDeletedGLBufferObjects() and GLBufferObjectSet::flushDeletedGLBufferObjects(double currentTime, double& availableTime)
where the NumberActiveGLBufferObjects was errneously being incremented by numDiscarded.

M    osg/BufferObject.cpp
2012-08-23 15:06:27 +00:00
Robert Osfield
583401970a Fixed typo 2012-08-22 16:39:47 +00:00
Robert Osfield
58b66be7b7 Added check against the Camera NodeMask to decide whether it's appropriate to test for events on that camera. 2012-08-21 09:45:24 +00:00
Robert Osfield
284f410436 Added ShadowSettings::s/getMaximumShadowMapDistance(double) property, usage of these property in ViewDependentShadowMap,
and setting of it with --max-shadow-distance <double> in the osgshadow example.
2012-08-15 12:40:48 +00:00
Robert Osfield
52861ecbb0 Added a mutex to protect the removal and addition of Uniform and Program to StateSet to avoid parents being invalidated when multi-threading. 2012-08-14 20:15:00 +00:00
Robert Osfield
fb83c2b061 Introduced --near-far-mode into osgshadow and ShadowSettings::setComputeNearFarModeOverride(..) to allow user control of how the cull traversal is optimized for computing the depth range of the shadow map. 2012-08-03 16:14:14 +00:00
Robert Osfield
35816e6b25 Removed the erronous creation of a local ShadowSettings object 2012-08-03 15:23:44 +00:00
Robert Osfield
42cb311f41 Added FireGL to prefernce list for use glGenerateMipMap 2012-07-24 09:05:04 +00:00
Robert Osfield
2e611be9c9 Fixed build 2012-07-23 08:15:57 +00:00
Robert Osfield
0a746faa2d Introduced Texture::Extensions::s/getPreferGenerateMipmapSGISForPowerOfTwo() flag that defaults to false for Radeon, true elsewhere.
This is used to workaround mipmapping bugs with ATI/AMD cards.
2012-07-12 16:41:53 +00:00
Robert Osfield
2f86ac1896 Fixed indentation 2012-07-11 14:36:14 +00:00
Robert Osfield
283c2d3ed0 Fixed parameter default value to avoid warning 2012-07-11 08:39:11 +00:00
Robert Osfield
86db687bce Replaced use of now deprecated methods. 2012-07-10 16:20:32 +00:00
Robert Osfield
269d360484 Enabled the use the getReceivesShadowTraversalMask(). 2012-07-10 16:11:40 +00:00
Robert Osfield
ec3ad89041 Changed settings of masks to use ShadowSettings. 2012-07-10 16:11:15 +00:00
Robert Osfield
b4d397cfd7 Moved mask settings into ShadowSettings 2012-07-10 15:50:46 +00:00
Robert Osfield
4b220d4fd7 Changed updateCamera(Camera*) to updateCamera(Camera&) to make it clear that a valid Camera object should be passed in. 2012-07-09 17:49:04 +00:00
Robert Osfield
65ab874143 From Riccardo Corsi, introduced CameraManipulator::updateCamera() method that allows more Camera properties to be controlled by the CameraManipulator. 2012-07-09 17:32:13 +00:00
Robert Osfield
f784884fd1 Refactored the way that the static Scene cache is managed by moving all the functionality into a SceneSingleton 2012-06-25 16:31:36 +00:00
Robert Osfield
a821a1cbbc Restructed the way that the global notify variables are initialized to avoid problems with multi-threaded initialization of these variables. 2012-06-22 16:21:08 +00:00
Robert Osfield
fc4aeac75b Fixed spelling of FileNameComparator 2012-06-16 09:08:05 +00:00
Robert Osfield
59133b43d3 Moved the frame() event into the event traversal after then events and their state have been accumulated. 2012-06-15 09:04:32 +00:00
Robert Osfield
1dc215a1da Added FileNameComparator to sort the filenames in an ImageSequence into alphanumerical order so that it can handle the numerical ordering found in screenshot numbered sets of files 2012-06-12 20:15:58 +00:00
Robert Osfield
4ab8cdb746 Enabled 6 ImageThreads in the ImagePager 2012-06-12 18:29:03 +00:00
Robert Osfield
c1a3ab2a5b Commented out the disabling of use of PBO's in ImageStream, and disabled the use ClientStoreHint in Present3D. 2012-06-12 10:31:50 +00:00
Robert Osfield
2faeaf553b Added support for setting the <image> paging_mode property to PRE_LOAD_ALL_IMAGES, PAGE_AND_RETAIN_IMAGES or PAGE_AND_DICARD_IMAGE for osg::ImageStream,
with PAGE_AND_DICARD_IMAGE set as the default.
2012-06-11 19:54:07 +00:00
Robert Osfield
c39ee015d6 Added ImageStream support to <image> and <stereo_image> tags in .p3d 2012-06-08 10:26:23 +00:00
Robert Osfield
5d3cb4f754 Added osg::ImageSequence support into osgPresentation::SlideShowConstructor and the associated <image> tag in .p3d. 2012-06-08 04:18:28 +00:00
Robert Osfield
4d86f8dc79 Added --fps support 2012-06-07 10:08:42 +00:00
Robert Osfield
9282a367e9 Added typdef for Win32 2012-05-31 14:45:24 +00:00
Robert Osfield
2200ebfbe1 From Wang Rui, "A very small but maybe fatal problem was found when I saved models with shader and uniforms (with new double types support) to osgb format and tried to read it again. The application will crash here. And the serializer file should be slightly changed to fix it. Please replace the original file in osgWrappers/serializers/osg/Uniform.cpp." 2012-05-25 16:07:11 +00:00
Robert Osfield
1dbb0a7a82 Added Dragger::get/setActivationMouseButtonMask(uint). 2012-05-25 15:32:51 +00:00
Robert Osfield
c21f1f488f From Jaap Glas, "Added a default parameter to the following constructor in TabPlaneDragger
and TabPlaneDragger.cpp:

TabPlaneDragger(float handleScaleFactor=20.0f);

The reason for this is that the default OSG tab sizes are way bigger than
those we used in our application so far. And since handleScaleFactor_
is already a (constant) class member, I see no objection against making
it user defined."
2012-05-25 08:56:25 +00:00
Robert Osfield
a28907a67f From Jaap Gas, added missing break, and missing removeDraggerCallback. 2012-05-24 18:15:44 +00:00
Robert Osfield
759a889468 Removed -ftree-vectorize from OSX 10.7 build to avoid warning when building with clang. 2012-05-21 09:12:13 +00:00
Robert Osfield
aea3d6855b Removed trailing spaces 2012-05-02 14:13:29 +00:00
Robert Osfield
476dbf1c33 Fixed for including cmath before osg/Math. 2012-05-02 13:58:34 +00:00
Robert Osfield
d32160abde Added using base_class::set to the Matrix*Template class to enable the set() method from the base class to be used. 2012-04-27 09:43:25 +00:00
Robert Osfield
b86c87d1a8 From Christophe Herreman, Added viewer.setCameraManipulator( keyswitchManipulator.get() ) to fix problem with master Camera not being updated 2012-04-26 10:07:36 +00:00
Robert Osfield
45c6ba0b73 From Mathias Froehlich,"Attached is a change to the ac3d model loader as of rev 11498, that uses
indexed draws instead of plain array draws to save some amount of main memory.
Draw performance does not change with the nvidia binary blob as well as with
the open source drivers."
2012-04-20 10:01:50 +00:00
Robert Osfield
18b5e2a9b8 From John Kaniarz, "Here's a patch to add new extensions for tessellation shaders to the GLSL
plugin." "I went with .tctrl and .teval for the shader extensions."
2012-04-20 09:53:41 +00:00
Robert Osfield
d37eff5c2b Ran dos2unx on file 2012-04-20 09:40:29 +00:00
Robert Osfield
b0c510ab08 From John Kaniarz, "Here is an example of using tessellation shaders in osg. With permission from the author, I adapted it from this tutorial:
http://prideout.net/blog/?p=48"
2012-04-20 09:38:51 +00:00
Robert Osfield
de05dd22a8 Restructed how the GL_SAMPLER_* #define's are placed to avoid build problems under GLES. 2012-04-19 14:58:35 +00:00
Robert Osfield
a5cd9c0630 Changed #ifdef __IPHONE_4_0 to #if defined(__IPHONE_4_0) to fix error that Clang compile warning highlighted 2012-04-19 14:34:28 +00:00
Robert Osfield
c3bfa67576 Fixed build with OSG_USE_REF_PTR_IMPLICIT_OUTPUT set to OFF. 2012-04-19 13:18:58 +00:00
Robert Osfield
9f93b005cc From David Callu, "Here the fix for Matrix{2,3,4}x{2,3,4}{fd} defined in Uniform header.
My previous patch for Atomic Counter Uniform provide new template implementation
of Matrix{2,3,4}x{2,3,4}{fd}. This new implementation use Column-Major Matrix.
Original code define matrix as Row-Major matrix like other Matrix in OSG, and
my matrix implementation break compatibility with previous code.
For example osg_normalMatrix define in osg::State report by Roland Hill.
Thanks to Paul Martz to spot me when the bug appear."
2012-04-19 10:27:58 +00:00
Robert Osfield
9045813aab Added missing getUniformBlocks implmentation 2012-04-19 10:10:26 +00:00
Robert Osfield
c6a4fde917 From Jorge Izquierdo Ciges, "Mostly small changes to add more compile options, and shared linking (still testing that capability, but this enables on a compile basis if the user wants). Robert, when you give the Ok I'll update/rewrite the Android section in the old/new wiki you'll say where is better. Mostly to be clear for the future users what options can configure and what are their purpose." 2012-04-19 09:50:10 +00:00
Robert Osfield
97e4ad473b Refactored the handling of GLES adaptations of the 1,2,3,4 internal formats and added handling of GL_RGB8_OES and GL_RGBA8_OES. 2012-04-18 10:16:09 +00:00
Robert Osfield
01beb82041 From Mathias Froehlich, "Attached is a change to the slow path geometry dispatch tables that allows the
use of 3 component float color vectors."
2012-04-18 09:56:00 +00:00
Robert Osfield
25989e73f5 From Martin Naylor, "I have been experiencing a crash in the example osgtexture2D.
Not sure why my system seems to be so sensitive to these problems.

But attached is a fix which seems to stabilise the example.
Note: it only seems to crash intermittently when spinning the object with
your mouse.

So I assume this is a threading issue because of the data variance missing
in some of the text node setups in the example.
"
2012-04-18 09:51:39 +00:00
Robert Osfield
b882467217 Updated version number 2012-04-18 09:50:23 +00:00
Robert Osfield
96effb3690 From Martin Naylor, "Please find attached a fix for the STD library(tested under Windowsx64
VS2008) when atomiccounter is found but not used."
2012-04-06 11:29:29 +00:00
Robert Osfield
95cac0b549 From Ulrich Hertlein, Fix for MatrixTemplate compile errors 2012-04-06 10:42:17 +00:00
Robert Osfield
5e315d5fab From Wang Rui, "I'd like to submit the changes that will put ObjectProperty and ObjectMark variables into the InputStream/OutputStream class instead of static ones. This should avoid the threading problem and won't repeatedly reallocate memory for the properties. Some of the wrappers will be slightly modified to use the property variable stored in the InputStream/OutputStream as well." 2012-04-05 13:53:47 +00:00
Robert Osfield
28a9a235b6 Update AUTHORS for release 2012-03-30 17:08:21 +00:00
Robert Osfield
bac5e760da Updated ChangeLog for dev release 2012-03-30 16:58:24 +00:00
Robert Osfield
6a40df7b7d Added check to avoid accessing pointer past the end of the string. 2012-03-30 10:10:27 +00:00
Robert Osfield
c0bd5cda99 From Magnus Kessler, typo and documentation fixes 2012-03-29 15:08:15 +00:00
Robert Osfield
ba2432ca45 From Cedric Pinson, "I Updated the ply plugin to support alpha color in files. Plus I updated it to use by default an alpha of 1.0 instead of 0 when no alpha is specified.
Last changes is to divide byte color by 255.0 instead of 256.0."
2012-03-29 14:58:00 +00:00
Robert Osfield
68412a1784 From Magnus Kessler, "remove unecessary conversion from float in double precision method" 2012-03-29 09:57:47 +00:00
Robert Osfield
aab27e106c From David Callu, "Here an update of osg::Uniform :
- add non square matrix
- add double
- add all uniform type available in OpenGL 4.2
- backward compatibility for Matrixd to set/get an float uniform matrix
- update of IVE / Wrapper ReadWriter

implementation of AtomicCounterBuffer based on BufferIndexBinding

add example that use AtomicCounterBuffer and show rendering order of fragments,
original idea from geeks3d.com."
2012-03-29 09:43:12 +00:00
Robert Osfield
59d6931b59 Added int packing parameter to Image::readPixels(..) 2012-03-29 08:27:21 +00:00
Robert Osfield
055e1258ea Removed trailing spaces 2012-03-23 16:09:30 +00:00
Robert Osfield
695e08ec8c Updated ChangeLog and AUTHORS for 3.1.2 dev release 2012-03-23 11:32:10 +00:00
Robert Osfield
eb9f545d67 Fixed potential memory leak 2012-03-23 11:20:17 +00:00
Robert Osfield
1feea279a5 From Luc Frauciel, "I've encoutered a nasty group of dae which are incompatible with dae plugins (and probably collada schema ) in 4 different ways :
1)  they use direct link to texture

-> this is already handle by current plugin : OK

2)  they defined colors with only 3 color components

->  it leads to a crash when trying to acces to the fourth component
 I fixed that

3)  they contain empty primitive lists

-> reading is ok, but osgviewer crashes when trying to display the geometries
The reason is that osg assume that  DrawElementsare never empty (blunt acces to DrawElements.front() in PrimitiveSet.cpp)
I corrected this (on the plugin side), but I wonder :
Is it the responsability of plugins to create non empty DrawElements, or of osg core not to crash when they occur ?
If the responsability is on the osg core side, I can submit a patch to PrimitiveSet.cpp regarding that aspect.

4)  they use a material binding scheme not supported by the plugin

->I've implemented a mechanism to handle this binding scheme

You will also find in the patch an example of these evil dae and comments on the offending elements.
They seems to be produced by ComputaMaps (www.computamaps.com)
They load well in Google Earth
"
2012-03-23 11:16:01 +00:00
Robert Osfield
1227f3f620 From Ulrich Hertlein, "as discussed on osg-users there is an issue with clang++ on OS X and iOS that results in
the following error:

Users/stephan/Documents/Projekte/cefix/cefix/ios/../../libs/ios/include/OpenThreads/Atomic:244:48:
error: cannot initialize a parameter of type 'void *' with an lvalue of
type 'const void *const'
   return __sync_bool_compare_and_swap(&_ptr, ptrOld, ptrNew);

This can be solved by a cast to '(void*)ptrOld'.  This should be benign since both
'ptrOld' and 'ptrNew' are only read and the cast is in fact in place for all other
implementations as well.

On OS X the cast compiles cleanly on both g++ (i686-apple-darwin11-llvm-g++-4.2 (GCC)
4.2.1) and clang++ (Apple clang version 3.1 (tags/Apple/clang-318.0.54)).
"
2012-03-23 10:24:50 +00:00
Robert Osfield
5fc6f0a796 As per Ulrich Hertlrein's suggestion, changed APPLE_PLATFORM_SDK_CANONICAL_NAME to OSG_OSX_SDK_NAME. 2012-03-23 10:21:51 +00:00
Robert Osfield
c2ae14f94d From Erik den Dekker, "
IF(${CMAKE_OSX_SYSROOT} STREQUAL "/Developer/SDKs/MacOSX10.7.sdk")
...

            ELSEIF(${CMAKE_OSX_SYSROOT} STREQUAL "/Developer/SDKs/MacOSX10.5.sdk" OR ${CMAKE_OSX_SYSROOT} STREQUAL "/Developer/SDKs/MacOSX10.6.sdk")

...

ELSEIF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk)
...

            ELSE()

...

            ENDIF()


Which is fragile because XCode could be installed into another directory than /Developer. (In case XCode is not installed into the /Developer directory CMake can automatically resolve the path via command line utility ${CMAKE_XCODE_SELECT} --print-path)

This issue bites me currently because the latest XCode (Version 4.3.1 - 4E1019) installed through the Mac App Store is per default installed in "/Applications/Xcode.app/Contents/Developer" and hence the 10.7 SDK in "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"

Searching the web to find the proper way to determine the version of the Platform SDK programmatically, I found no standard way. I came up with 2 options myself:

1) Parse the path string to extract the version number

2) Read a value from the SDKSettings.plist found in the root of each SDK  (e.g., "defaults read ${CMAKE_OSX_ROOT}/SDKSettings.plist CanonicalName" gives "macosx10.7")

I implemented the last option and verified that at least the following Mac OS SDKs (10.3.9, 10.4, 10.5, 10.6, 10.7) support this method. It also looks reasonably future proof. An additional benefit of this method is that it also seems to be compatible with iOS and iOS Simulator SDKs (at least for version 5.1, but I assume this also applies to older versions). This is interesting because the CMake infrastructure to build OSG for iOS currently still contains similar hard-coded paths and even requires you to manually change the cmake file to build for another iOS SDK version. In the near future I hope to address these issues, but I haven't been able to try this yet."
2012-03-23 10:18:27 +00:00
Robert Osfield
14a563dc9f Ran script to remove trailing spaces and tabs 2012-03-21 17:36:20 +00:00
Robert Osfield
1e35f8975d For all OSG_GL*_FEATURE #defines changed 1's to true and 0's to false. 2012-03-21 16:02:32 +00:00
Robert Osfield
f551c3dcec From David Callu, "just a typo fix that break the compilation under windows" 2012-03-21 14:08:07 +00:00
Robert Osfield
c3a0a8ddc3 Added Traits::getContextVersion(uint,uint) 2012-03-21 11:36:54 +00:00
Robert Osfield
cee53f6adc Updated version number 2012-03-21 11:26:09 +00:00
Robert Osfield
2f2908b7eb Removed inappropriate warning 2012-03-20 12:01:02 +00:00
Robert Osfield
f51bb8bc70 Replaced && with & to address error in handling bitmask 2012-03-20 11:18:45 +00:00
Robert Osfield
41863ecbb6 From Lukasz Izdebski, Added StencilTwoSided support to ive plugin 2012-03-19 09:49:41 +00:00
Robert Osfield
9c04527cbe Fixed the order of setting of CenterMode 2012-03-16 13:22:20 +00:00
Robert Osfield
e5b5494fe1 From Wang Rui, "I'd like to submit a slightly modified version of the ViewDependentShadowMap. It includes two fixes: one is in ComputeLightSpaceBounds::update(), which changes the statement "if (v.z()<0.0f)" to "if (v.z()<-1.0f)" as clipping space coordinates should be transformed to [-1, 1] and should not be discarded unless they go beyond the range; the other is in ViewDependentShadowMap::computeShadowCameraSettings(), in which I changed the line:
viewMatrix.makeLookAt(frustum.center+positionedLight.lightDir*zMin, frustum.center, lightUp);
to
viewMatrix.makeLookAt(frustum.center+positionedLight.lightDir*zMin, frustum.center+positionedLight.lightDir*zMax, lightUp);

The reason I've done such a change is that for huge scenes like a city on the earth, the values of frustum.center can be extremely large, but zMin may be very small (e.g., when model depth in light coords equals the model radius by chance) in some cases so the result of (eye - center) might jiggle while moving around the shadow scene and thus make the shadow map suddenly disappear some time. The small change here also considers the effect of zMax to avoid such problems.

"
2012-03-14 16:42:07 +00:00
Robert Osfield
7977b31577 Moved static initializers into global scope to prevent problems with using exit(). 2012-03-12 14:22:48 +00:00
Cedric Pinson
df82754203 Changed osgAnimation::StackedTransform::update(t). It can now be used for custom usage 2012-03-11 22:05:29 +00:00
Robert Osfield
d546f95412 Updated ChangeLog and AUTHORS file for 3.1.1 dev release 2012-03-09 13:16:39 +00:00
Robert Osfield
5e105d2fc4 From Chuck Seberino, "Attached are modified versions of RotateCylinderDragger and Projector files that clean up the use of _onCylinder / isProjectionOnCylinder().
I have also made changes to the RotateCylinderDragger to provide a cylinder ring with a thickness.   It is totally optional, but IMHO makes the default behavior work better than a solid cylinder (which typically obscures the geometry you are trying to drag).  Gives it a bit more to grab, especially in the case where eyepoint and cylinder axis are near parallel.
"
2012-03-09 10:20:23 +00:00
Robert Osfield
fc6fdeaa2c Updated version number for 3.1.1 dev release 2012-03-08 16:33:44 +00:00
Robert Osfield
fef2628d00 From Farshid Lashkari, "I've added support for reading contents of cubemap textures to the osg::Image::readImageFromCurrentTexture method. I added a new parameter to the method for specifying which face of the cubemap to read." 2012-03-08 16:05:17 +00:00
Robert Osfield
71893c46e5 From Olaf Flebbe, "Appended now a bugfixed proposition for the Win7 Multitouch Support.
Now examples/osgmultitouch really works ;-)

Based on yesterdays trunk.

* It should now work with all Visual Studio Versions.
* WIN_VER is left as-is
* I added the missing declarations from a recent SDK, if not supplied by the SDK
* If someone chooses to update WIN_VER, the declarations should not break.
* All API Calls are runtime detected.
* No CMake Variable, Support is enabled automatically ."
2012-03-07 09:32:38 +00:00
Robert Osfield
17ba6f0a24 From Guillaume Millet, "Please find a small fix to avoid crash of texture Atlas builder in case of textures with NULL image.
If an object is comming with texture and NULL image, the texture atlas builder crash when sorting textures according to texture height.
The fix is to skip textures with NULL image when inserting textures in the builder texture list.
"
2012-03-06 10:35:57 +00:00
Robert Osfield
ecbe4b1058 From Farshild Laskari, "The vertex shader for the point stateset of PrecipitationEffect was not properly computing the clip vertex. It needed to apply a modelview transformation to the clip vertex. Attached is the fix." 2012-03-06 10:33:20 +00:00
Robert Osfield
7c278ce5d6 From Christian Buchner, "The attached openscenegraph example is much simpler than
osgshaders.cpp and demonstrates the use of GLSL vertex and fragment
shaders with a simple animation callback. I found the osgshaders.cpp
too complex to serve as a starting point for GLSL programming"
2012-03-06 10:29:47 +00:00
Robert Osfield
fd97a9a800 From Chuck Seberino, "Here is a fix for the RotateCylinderDragger. This patch fixes the case where the picking direction is close to the cylinder axis. The current behavior is this:
* If the eyepoint and cylinder axis are close to parallel (given some tolerance), then it uses a plane perpendicular to the cylinder axis.
* Otherwise it uses a plane parallel to the cylinder axis oriented towards the eyepoint (previous behavior).  This gives decent behavior and is the only path that was taken in the previous code.   I kept with previous behavior and that allowed a good bit of code to be removed, simplifying things.  There is now no need for the _onCylinder flag, but since there is a public accessor, I wasn't sure how to handle it for backwards compatibility, so I left it in.  NOTE - there is no default initialized value, so if it is kept in, it should be set to 'false' to keep same behavior as before.  I am not quite sure how the _onCylinder case was supposed to behave as even forcing that path gave undesirable behavior, even with carefully controlled dragging.
"
2012-03-06 10:08:49 +00:00
Robert Osfield
8d3790d594 Added RotateCylinderDragger and RotateSphereDragger to list of manipulators for testing purposes 2012-03-06 10:06:00 +00:00
Robert Osfield
f59f4d2929 From Paul Martz, "Just a minor update and typo fix.
"
2012-03-05 14:17:01 +00:00
Robert Osfield
51f3a02f73 From Luc Frauciel, "I've modified dxf writer :
- correction to writeFace : the fourth point was defined with an incorrect code (http://www.autodesk.com/techpubs/autocad/acad2000/dxf/3dface_dxf_06.htm)
- if no layer name was found, an empty string was used, with is incorrect according to dxf specifications and was rejected by Autodesk DWG TrueView
- the plugin was writting polygons and triangles as LINE, as if PolygonMode GL_LINE was active, and didn't use 3DFACE primitive.
   I changed this behaviour to write 3DFACE  as default, and LINE when  PolygonMode GL_LINE is active.
  when reading back the file with osg, the result is now consistent with the source

Tested with osg plugin, FME (Safe software), Autodesk DWG TrueView
"
2012-03-01 11:33:31 +00:00
Robert Osfield
ac2be18fbc From Luc Frauciel, "In 3ds plugin, asGeometry() is used on a drawable but the resulting pointer is not tested for nullity.
It leads to a crash when writing osgText::Text or Shapes"
2012-03-01 11:03:18 +00:00
Robert Osfield
2c7b82b401 From David Callu, "I found a bug in osg::Program.
in osg::Program::PerContextProgram :

typedef std::vector<UniformModifiedCountPair> LastAppliedUniformList;
should be
typedef std::map<unsigned int, UniformModifiedCountPair> LastAppliedUniformList;

Intel driver can use index uniform value > 200000.
With a std::vector, this index uniform value generate an out of memory error

Nothing in OpenGL or GLSL specification define index uniform value rules.
And all other implementation that deal with uniform index in osg::Program
use a std::map.
This fix could have a little performance impact but this is the cost
to pay to work with
all driver."
2012-03-01 10:38:28 +00:00
Robert Osfield
2907284d00 Removed redudent spaces at ends of lines 2012-03-01 10:14:55 +00:00
Robert Osfield
1744617988 Updated ChangeLog and AUTHORS for dev release 2012-02-29 14:01:44 +00:00
Robert Osfield
9c5774defb Improved the handling of endian swap of osg::Array 2012-02-29 10:22:56 +00:00
Robert Osfield
7bcf5e3b36 From Glenn Waldron, "Attached are modifications to ZipArchive to make it safe for mutli-threaded access.
Here's a summary:

* Uses a separate ZIP file handle per thread
* Maintains a single shared (read-only) index, created the first time through
* Stress-tested with the DatabasePager using 24 threads under osgEarth

I also updated the member variables to use OSG's leading-underscore convention."
2012-02-29 10:22:18 +00:00
Robert Osfield
33e7857af9 From Guillaume Millet, "When using the texture Atlas builder, it will convert from REPEAT to
CLAMP all textures using only texcoord between [-0.001 1.001] to give a
chance to create an Atlas.
If the atlas creation failed for other reason (texture size, only one
compatible texture, ...) the texture remain modified in CLAMP mode.

But if you use texcoords between [0.0 1.0] using CLAMP mode instead
REPEAT it is not safe because you will have a blend to the border color
at extremities.
If we want to have exactly the same rendering after changing mode from
REPEAT to CLAMP we should use the CLAMP_TO_EDGE mode instead of CLAMP to
avoid blending to border color at extremities.

Please find as attachment the proposed patch against latest svn version.
"
2012-02-28 12:03:48 +00:00
Robert Osfield
84ca21655e Added build problem with using float Matrix. 2012-02-28 11:37:09 +00:00
Robert Osfield
11c9ec4f7d From Thomas Hogarth, build fix for IOS build 2012-02-28 10:21:21 +00:00
Robert Osfield
1a080dfa6a Added fin.imbue(std::locale::classic()); to avoid problems with parsing of .obj files 2012-02-27 09:50:47 +00:00
Robert Osfield
e8ac276451 Added s/getByteSwap to teh InputStreamOperator base class and use of this method in the InputStream::start(InputStreamOperator*) method to ensure the bytes are swapped consistently. 2012-02-24 21:07:02 +00:00
Robert Osfield
c3fb8dc714 Added support for using glGenerateMipmap instead of GL_GENERATE_MIPMAP_SGIS on GLES2 2012-02-24 12:15:15 +00:00
Robert Osfield
3ca30736b4 Added support for checking the possible endian reversal the OSG_HEADER_LOW and OSG_HEADER_HIGH when reading binary files written out from systems that have a different endian to the system reading it. 2012-02-24 11:43:35 +00:00
Robert Osfield
f86efdcd31 Cleaned up CMake warning 2012-02-24 10:56:48 +00:00
Robert Osfield
b4155dd817 Moved the
state.applyTextureMode(0,GL_TEXTURE_2D,osg::StateAttribute::ON);

into the #if defined(OSG_GL_FIXED_FUNCTION_AVAILABLE) block to solve problems under GLES and GL3.x/GL4.x
2012-02-23 17:51:40 +00:00
Robert Osfield
6d351ba237 From Mathieu Marache, "I was trying to play with the configuratiion files from the data but
couldn't load them with osgviewer's -c CLI switch, this correction
should make the alias work :-)
"
2012-02-23 15:55:30 +00:00
Robert Osfield
949c635d5d From Sergey Polischuk, "In and Out control points were computed incorrectly for some animation channels with cubic bezier interpolation" 2012-02-22 10:50:38 +00:00
Robert Osfield
caceb94db8 From Miha Ravsel, "While trying to create my custom serializer class, i created some dummy data which accidentally popped-up bug in InputStream readObjectFields function.
Bug description:
 Let's say we have class A
namespace Bug
{
class A : public osg::Object
{
public:
  //...
  typedef std::vector<osg::ref_ptr<A> > AList;

protected:
  AList _alist;
  //...
}
}

REGISTER_OBJECT_WRAPPER( A,
                        new Bug::A,
                        Bug::A,
                        "osg::Object Bug::A" )
{
       ADD_LIST_SERIALIZER(A,Bug::A::AList);
}


Bug:
We create say 3 instances of class A: A1,A2,A3 and then we add A2 and A3 and A1 as child instances of A1 so we get next structure:
A1
 |- A2,A3,A1

we call osgDB::writeObjectFile(A1,"/data/a.osgt") -> saved correctly( third element in list is saved as unique id that references parentClass

now we call
A1 = osgDB::readObjectFile("/data/a.osgt");

Everything is deserialized correctely except last element in list which should be same instance as parent A1.

The attached code resolves this issue by passing UniqueID in readObjectFields method and saving object in _identifierMap as soon as we have valid object instance so we can make reference to parent object from any child instance.
"
2012-02-22 10:46:35 +00:00
Robert Osfield
da44e4f4b6 From Paul Martz, "The attached fixes a few issues that are present when ref_ptr implicit casting is disabled." 2012-02-21 17:20:58 +00:00
Robert Osfield
0b88ad24b2 From Olaf Flebbe, "Macos X cleanup:
I added AFAIK proper defaults for several Macos X Version API targets.

* In order to determine which defaults to apply, consult the  CMAKE_OSX_SYSROOT variable pointing to the used SDK, not the pure existence of an SDK.

* Defaults are now:
10.7: Support Intel 32 and 64 Bit Cocoa with imageio picture reader
10.6 + 10.5: Support Cocoa with imageio on Intel and PowerPC
10.4: Carbon, Quicktime and PowerPC

Now OSG compiles out of the box for MacOSX  10.7. , tested with gcc and clang with FlightGear."
2012-02-21 11:30:07 +00:00
Robert Osfield
f56ab3a04e From Chris Denham, "ReaderWriter3DS smoothing group handling corrections" 2012-02-21 11:13:25 +00:00
Robert Osfield
aea4d1a261 Fixed warnings 2012-02-21 10:42:59 +00:00
Robert Osfield
67ce0d5244 Fixed erroneous use #if !defined(OSG_GLES1_FEATURES) && !defined(OSG_GLES2_FEATURES) which should have been #if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) 2012-02-21 10:38:12 +00:00
Robert Osfield
ec89769e6b From Luc Frauciel, "When dae plugin is used with daeUseSequencedTextureUnitsoption, the transparency processing is done with the wrong texture unit
I've remplaced the unused parameter diffuseColorName by the diffuseTextureUnit effectively used."
2012-02-20 16:00:46 +00:00
Robert Osfield
b213f6030e From Alexander Sinditskiy, "Fix loading small monochrome bmp images" 2012-02-20 12:36:53 +00:00
Robert Osfield
5ac0181cdc From Dietmar Funck, "in order to use a customized database thread it's necessary to use a customized database pager, which creates such customized database threads, too.
I think the best way to achieve this is to overwrite the DatabasePager::addDatabaseThread() method within the customized database pager. However this method is not 'virtual' yet, so I propose to make the method 'virtual'."
2012-02-20 12:33:17 +00:00
Robert Osfield
acb48db89e From Farshid Lashkari, "I've attached a small optimization to osgDB::Registry::removeExpiredObjectsInCache that removes the expired items while iterating over the cache, instead of saving to a temporary vector and then removing." 2012-02-20 12:23:36 +00:00
Robert Osfield
041dd7a871 From Riccardo Corsi, Added passing of EventVisitor pointer to event handlers. 2012-02-20 12:18:50 +00:00
Robert Osfield
2a97715239 From Riccardo Corsi, "please find attached a small patch for HDR plugin,
which simply set by default the internal pixel format to GL_RGB32F_ARB where appropriate.

In the current version there's a comment saying that the plugin set it to GL_RGB8 (even when reading from float) to support old graphics cards,
but the comment dates back to 2004...
What's more I believe that it's correct to expect a floating texture format if you're loading an hdr image.
It was quite troublesome for us to discover why our background image wasn't showing hdr data...

In case you accept the submission, I've removed the comment as it would be misleading to leave it there."
2012-02-20 12:12:43 +00:00
Robert Osfield
48b9b25805 From Johannes Baeurele, "The osg::Image class now contains a 'supportsTextureSubloading()' method that is used inside the Texture2D::apply method. For now it only checks for the etc1 format in which case it returns 'false'. All other formats lead to a return value of 'true'.
Without the change the application does not work properly. First I get the notification that an OpenGL error occured. After some more of this error messages I see broken textures on the screen. With the changes attached to this message my application works as intended."

Note from Robert Osfield, changed the Image::supportsTextureSubloading() to be const and to be implemented in the .cpp rather than inline.
2012-02-20 12:03:14 +00:00
Robert Osfield
981182fb01 From Kim Bale, "The application description for osg2cpp was cut and pasted from osgconv and not changed.
I've added a more relevant description."
2012-02-17 16:51:10 +00:00
Robert Osfield
5a396c91e6 From Martin Lambers, "It adds a new ReaderWriter plugin for the GTA file format
(http://gta.nongnu.org). This allows to read and write floating point
image data. Unlike other formats, GTA also allows very good compression
ratios for floating point data. The compression method can be selected
with the COMPRESSION option of the plugin.
"
2012-02-17 16:45:49 +00:00
Robert Osfield
2f5e19447c Added usage of OSG_CPP_EXCEPTIONS_AVAILABLE for plugins that use std::exceptions. 2012-02-17 16:13:16 +00:00
Robert Osfield
d393604846 From Stephan Huber, "
Here's another small submission for IOS, which adds unique ids to the
touchpoints, so the ids stay the same during a touch-sequence.

(and some minor code enhancements)"
2012-02-10 17:24:08 +00:00
Robert Osfield
4457d2a145 From Colin McDonald, "Upgrading to OpenSceneGraph 3.0.1, texture mip mapping stopped
working on some junk low-end graphics cards which I still have to
support.  They worked ok with osg 2.8 and earlier.

The problem turned out to be with gl proxy textures, which are
unreliable on those devices.  Proxy textures are used by the glu
mipmap build routines to determine if a texture size is
supported. The external glu library had a nice fallback
behaviour, so that if proxy textures didn't work then the mipmap
texture was still created.  But in the work on the new embedded
glu routines that fallback behaviour has been inadvertently
lost.  I have restored the fallback in
src/osg/glu/libutil/mipmap.cpp.  It doesn't add any extra
complexity."
2012-02-10 17:20:43 +00:00
Robert Osfield
d507a54456 From Domenico Mangieri, "Implementation for MoveRight and MoveUp methods in FirstPersonManipulator is missing.
I'm using the manipulator, so I added it."
2012-02-10 16:12:28 +00:00
Robert Osfield
bd81dd5ff8 From Stephan Huber, attached you'll find a compile fix for the new introduced rowlength-feature on IOS/OpenGL ES builds 2012-02-10 15:57:51 +00:00
Robert Osfield
06e88f3b91 From Luc Frauciel, "osgUtil Tessellator : beginTessellation() made virtual to allow configuration of tessellation:
The initialisation of glu low level tessellator is done in  osgUtil::Tessellator::beginTessellation()
This function is not virtual, preventing any customization of the tesselation.
In particular, there in an option in glu tesselator that force the generated primitives to be triangles and that I'd like to use (GLU_TESS_EDGE_FLAG).
"
2012-02-09 18:10:52 +00:00
Robert Osfield
9b6e10ddf0 From Torben Dannhauer, "Modification to osgfilecache: Now source data can also be local.:
find attached my modifications to osgfilecache.

It now allows also the caching of LOCAL terrain databases. In combination with the extends and level cmd parameter it allows to extract parts of terrain databases and write it in a new "Sub database".
I also modified osgDB::FileCache to create correct filenames if the data source is local."
2012-02-09 17:52:13 +00:00
Robert Osfield
0b73ee7933 Updated ChangeLog, AUTHORS and Contriburos.cpp files 2012-02-09 17:45:23 +00:00
Robert Osfield
2dbd24b52d From Martin von Gagern, "The xine osg plugin won't compile against xine-lib-1.2.0:
OpenSceneGraph-3.0.1/src/osgPlugins/xine/video_out_rgb.c:2772:25:
error: ?video_driver_class_t? has no member named ?get_identifier?
OpenSceneGraph-3.0.1/src/osgPlugins/xine/video_out_rgb.c:2773:25:
error: ?video_driver_class_t? has no member named ?get_description?

This has been reported on Gentoo: https://bugs.gentoo.org/397643
The relevant commit to the xine-lib repository is
http://anonscm.debian.org/hg/xine-lib/xine-lib-1.2/diff/806b590a4d38/src/xine-engine/video_out.h

This change addresses the issue. I'm sending the full modified file as
an attachment. It is based on the 3.0.1 release of OSG. I'll also paste
a diff below. You will find a colorized view in the Gentoo bugzilla.

The xine-lib API changed in the following way: the identifier and
description members are now "const char*" strings instead of "char*
(*)(video_driver_class_t*)" getter function. As the functions in the osg
plugin will always simply return a string literal, without accessing
their argument, it is safe to simply call them with a NULL argument and
use the returned string. This makes it easy to support both API
versions. When you drop support for older xine one day, you might want
to move the string literals to the assignment, getting rid of the
functions in the process.

The modified code compiles for me. I'm not sure how to test it, as I've
only got OSG around in order to build (and hopefully one day even use)
Flightgear.

I'm assigning my copyright in this change to the osg project leads.
"
2012-02-09 16:42:47 +00:00
Robert Osfield
5743d30dc1 From Olaf Flebbe, "there are two ocurrences where pointer to bool is mixed with bool. Fixes warnings on MacOSX with llvm.
diff --git a/src/osg/State.cpp b/src/osg/State.cpp
index 0b88d63..2137bbd 100644
--- a/src/osg/State.cpp
+++ b/src/osg/State.cpp
@@ -109,7 +109,7 @@ State::State():
        }
    }

-    _abortRenderingPtr = false;
+    _abortRenderingPtr = NULL;

    _checkGLErrors = ONCE_PER_FRAME;

@@ -689,7 +689,7 @@ bool State::getLastAppliedTextureMode(unsigned int unit,Stat

 const StateAttribute* State::getLastAppliedTextureAttribute(unsigned int unit,S
 {
-    if (unit>=_textureAttributeMapList.size()) return false;
+    if (unit>=_textureAttributeMapList.size()) return NULL;
    return getLastAppliedAttribute(_textureAttributeMapList[unit],type,member);
 }

"
2012-02-09 15:54:13 +00:00
Robert Osfield
9244ea7603 From Paul Martz, a simple GL3 example 2012-02-09 15:51:20 +00:00
Robert Osfield
0a78919807 From Colin McDonald, "The bounding box returned by getBound() for Text which is not
auto-rotated (e.g. HUD text) is not always correct, because it
doesn't take account of the base line offsets added by the
various alignment options such as CENTER_TOP, CENTER_BOTTOM etc.

The attached src/osgText/TextBase.cpp fixes the problem."
2012-02-09 15:08:30 +00:00
Robert Osfield
359fc46757 From Colin McDonald, fix for Solaris build. 2012-02-09 14:40:07 +00:00
Robert Osfield
4935efc1a9 From Filip Arlet,"I ran into problem with osg::Text _BASE_LINE alignment. It didn't account line spacing. Btw. same problem in 3D text
Changed _offset from: -_characterHeight*(_lineCount-1)
to: -_characterHeight*(1.0 + _lineSpacing)*(_lineCount-1)"
2012-02-09 14:33:13 +00:00
Robert Osfield
5f4c155d6b Added back in support for checking the current working directory by default, but now do the check
after the Options and Registry DataFilePathLists have been checked, which will allow users to better control
over where files are searched for.
2012-02-09 14:28:39 +00:00
Robert Osfield
89cf88f2a9 From Chris Denham, "This is a submission to fix a problem with use of mode GL_RESCALE_NORMAL for geometries below a scaling transform which is not equal in X, Y & Z components. In this case, the 'slow' method of mode GL_NORMALIZE should be used to perform the normalization.
I have attached a correction to daeRTransforms.cpp based on trunk at [12892] which corrects this problem.

This is the changed section:

Code:
       if (scale.x() == scale.y() && scale.y() == scale.z())
       {
           // This mode may be quicker than GL_NORMALIZE, but ONLY works if x, y & z components of scale are the same.
           ss->setMode(GL_RESCALE_NORMAL, osg::StateAttribute::ON|osg::StateAttribute::OVERRIDE);
       }
       else
       {
           // This mode may be slower than GL_RESCALE_NORMAL, but does work if x, y & z components of scale are not the same.
           ss->setMode(GL_NORMALIZE, osg::StateAttribute::ON|osg::StateAttribute::OVERRIDE);
       }"
2012-02-09 14:11:36 +00:00
Robert Osfield
ba4dde81bb From Thorsten Brehm, "attached update changes OSG's src/osgDB/Registry.cpp, so it doesn't (accidentally) resolve relative paths against the current working directory when searching for resources. So far, such paths were always resolved against the cwd first.
I guess the previous behaviour of giving the cwd precedence over any path configured in the "database path list" (osgDB::Options) wasn't intentional. Otherwise, if it was intentional after all, it'd be good to add another feature instead, to make this configurable - e.g. a flag in osgDB::Options to disable this, if an application doesn't want the cwd being considered.
"

Note from Robert Osfield, this submission will change the default behaviour of searching for files so can potentially break existing applications as it
won't search the current working direction unless it's included in the DataFilePathList entry in the Options or Registy.  I'll add a follow
up submission to add back in this feature.
2012-02-09 12:50:42 +00:00
Robert Osfield
c533c33457 From Hartmut Seichter, "attached a revised CMakeLists.txt file for Android that avoids the problems with a ARM gcc bug that appears in the NDK. It only overrides the optimization level for one file. As it resides only in the cfg parser this should not have side effects on performance." 2012-02-08 17:12:58 +00:00
Robert Osfield
e867f6bcd7 From Paul Martz, "This change clarifies the description for OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE." 2012-02-08 10:50:04 +00:00
Robert Osfield
f537ece404 From Leandro Motto Barros,
"I've made a few changes to osgUtil::PolytopeIntersector so that it
actually uses double precision floating point numbers everywhere (as
long as OSG_USE_FLOAT_PLANE is not defined).

I needed double precision intersections in a project I am working on.
These changes fixed the problems I was having -- this is all testing I
have done.

Notice that I have changed
osgUtil::PolytopeIntersector::Intersection's members to use doubles
(osg::Vec3d, instead of osg::Vec3). I could have added #ifdef's there
too, but I think it is better to not change the types of stuff in the
public interface depending on some preprocessor definition.

The modified files are attached. A diff also follows, for those who like it."

With the following changes from Robert Osfield:

"I've just reviewed your changes and have just tweaked them a little to
streamline them.  What I have done in the PolytopeIntersector header
is add:

       typedef osg::Plane::Vec3_type Vec3_type;

And then use this typedef in the definition of the vertices rather
then Vec3d as you did.  Next changes were to PolytopeInteresector.cpp
where to the PolytopeIntersectorUtils defintions of the Vec3_type, and
value_type which now simply read:

   typedef osg::Plane::Vec3_type Vec3_type;
   typedef Vec3_type::value_type value_type;

This way I was able to complete avoid any if def's and have essential
the same implementation as you achieved.  Changes now checked into
svn/trunk."
2012-02-08 10:06:58 +00:00
Robert Osfield
ce4890fa7a From Claus Scheiblauer, "in GraphicsWindowQt.cpp the GLWidget::keyReleaseEvent was implemented slightly different to the GLWidget::keyPressEvent, which caused the cursor keys values to be not correctly mapped from an QKeyEvent value to an osg key value when releasing a cursor key." 2012-02-08 09:34:44 +00:00
Robert Osfield
1432d4d54b Fixed build issues when compile with OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION set to OFF. 2012-02-07 16:14:13 +00:00
Robert Osfield
a9baf19f32 From Alexander Irion, "Added missing format GL_ALPHA to Image::computeFormatDataType()." 2012-02-07 12:37:48 +00:00
Robert Osfield
4d69577228 From Johannes Baeuerle, "The first problem is wrong value of the block size of etc1 textures in the getCompressedSize call in Texture.cpp. With the current block size of 16 the target application crashes with a GL_INVALID_VALUE. The reason is that the calculated size passed to OpenGL does not match the size of the passed data(data pointer,texture width,texture height,spec of etc1).
With a block size of 8 in the getCompressedSize call this error dissapears."
2012-02-07 12:02:04 +00:00
Robert Osfield
2a36e51eed From Nico Kruithof, "I found that Collada wasn't found correctly with visual studio 2010." 2012-02-07 11:43:42 +00:00
Robert Osfield
06f7fd4f48 From Marius Kintel, "GraphicsWindowQt::WindowData no longer requires the parent widget of a graphics window to be of type GLWidget." 2012-02-07 11:41:20 +00:00
Robert Osfield
52270c9656 From David Fries, "Of the two ways to use the Tessellator object, only
retessellatePolygons was applying the winding and boundary option.
Moved the gluTessProperty calls into beginTessellation().

There's a comment typo fix, removing an unused VertexPointList
typedef, and allocates one _tobj instead of one per tesellation.
Protections were added to check that _tobj was allocated in the few
remaining places it wasn't being checked.

---
On a side note, I would like to avoid the 'new Vec3d' in
Tessellator::addVertex for each call to
gluTessVertex(tess, location, data).
The RedBook leaves it ambiguous if the location pointer must
remain valid after gluTessVertex or not.
http://www.opengl.org/sdk/docs/man/xhtml/gluTessVertex.xml
says that changing location is not safe, so being conservative, I'll
leave it as is, even though the Mesa GLU library copies the data not
the pointer, so it is currently safe."
2012-02-07 11:29:47 +00:00
Robert Osfield
0775483b7c From Lionel Lagarde, "The setNormal method of osg::Billboard has side effects (it calls updateCache and update the normal to Z rotation matrix). When cloning billboards, copying the normal vector is not enough. In the correction, the copy constructor calls setNormal to update the internal members." 2012-02-07 11:21:11 +00:00
Robert Osfield
3ae53557b1 From Wojciech Lewandowski, "This is a one line modification of StatsHandler.cpp to work correctly while dumping states to console when ViewerStats getEarliesFrameNumber() and getLatestFrameNumber() return zeroes. If that happened in current version, printing loop was iterating between 0 and 0xFFFF FFFF indices and that was hanging our system.
"
2012-02-07 10:57:19 +00:00
Robert Osfield
1454e9c760 From Tamer Fahmy, Fix for bug when scrolling down and using render on demand.
"Currently issuing a mouse scroll DOWN event would stop updating
animations in progress.

The fix consists of changing the line
 us.requestContinuousUpdate( false );
to:
 us.requestContinuousUpdate( isAnimating() || _thrown );

in OrbitManipulator::handleMouseWheel() as has been done for the
GUIEventAdapter::SCROLL_UP case a couple of lines earlier or in
src/osgGA/FirstPersonManipulator.cpp."
2012-02-07 10:51:22 +00:00
Robert Osfield
89417ee47f From Rudolf Wiedemann, "the file attached fixes the incomplete implementation of "osg::DefaultUserDataContainer"'s copy constructor.
Copying user objects was missing."

Note from Robert Osfield, in submission changed
    _objectList.push_back((*itr)->clone(copyop));
to
    _objectList.push_back(copyop(*itr));
2012-02-07 10:40:04 +00:00
Robert Osfield
7d5d742070 From Sukender, "I just fixed using UTF8 paths in JP2 readerwriter under Windows. Jpeg2000 plugin could not handle UTF8 paths as it was using an Japser open() function which seems to be based on the standard fopen(). The fix simply opens the file beforehand and only gives a FILE* to the Jasper lib (and then closes the file, of course).
"
2012-02-07 10:33:09 +00:00
Robert Osfield
251827c994 From Mathias Froehlich, "In Optimizer.cpp a nodes update callback is checked twice and the cull
callback is checked never for the decision of a node being redundant.
The change replaces one of the update callback tests with a cull callback
test."
2012-02-06 13:45:20 +00:00
Robert Osfield
5d50913722 From Mathias Froehlich, "Attached is a change to the stats handler so that the aspect ratio of the
viewer stats coordinates always stay about 1:1 to the pixels.
This helps for more readable stats with very wide windows for example."
2012-02-06 13:40:01 +00:00
Robert Osfield
af01a9e984 From Mathias Froehlich, "The attached change to the default font makes the baseline correctly working
and makes the glyphs aspect ratio match their 12x8 bitmaps.
I am not exactly sure about osgTexts current internals but it matches the
changes that happened lately to the txf font.
"
2012-02-06 13:35:45 +00:00
Robert Osfield
ec08c4dfea From Cory Riddell, "I've been using the dot plugin and found that our application which sets
the global locale was generating bad dot files. Specifically, the node
numbers had comma separators in them (like 1,234 rather than 1234).

The attached file simply forces the stringstreams used to build up the
dot file to use the "C" locale."
2012-02-06 13:29:38 +00:00
Robert Osfield
2298cc520c From Robert Milharcic, "In attached file I implemented LOAD_IMMEDIATELY mode for new osg ProxyNode wrapper. Current version of proxynode loading uses DatabasePager for both modes(DEFER_LOADING_TO_DATABASE_PAGER and LOAD_IMMEDIATELY).
Immediate loading of external references begins after ProxyNode has been deserialized in ProxyNodeFinishedObjectReadCallback."
2012-02-06 13:27:25 +00:00
Robert Osfield
55c4f9b401 From Paul Palumbo, "This change seems to fix a problem reading 32-bit Floating point tiff images. Without this fix, I'm only getting half my image displayed in "osgviewer --image"." 2012-02-06 12:42:52 +00:00
Robert Osfield
d21280785c From Jason Beverage, "Attached is a patch to the SVG plugin to use cairo_surface_destroy
instead of free.  This was causing a crash on Windows.
"
2012-02-06 12:38:11 +00:00
Robert Osfield
38b17bc5fa From Jan Peciva, "attaching improved StatsVisitor. Changes:
- apply() and reset() methods made virtual to allow overriding
- added apply(StateSet&) to make more easier to gather StateAttribute
statistics in user-derived classes
"
2012-02-06 12:36:25 +00:00
Robert Osfield
6ebe48d6bb Fixed indendation and line endings 2012-02-06 12:29:29 +00:00
Robert Osfield
db49c23944 From Brad Christiansen, "The attached files add the ability to control when a paged child becomes eligible for expiry based on time and/or elapsed frames.
I found that some of the items that had been paged in were being expired on the first frame that they were not visible (as the cache was full). This resulted in excessive paging every time the view was moved. With the following changes I could only allow children to be expired if they had not been used for e.g. 30 seconds or 60 frames."
2012-02-06 12:06:40 +00:00
Robert Osfield
3b4333ec9a Fixed silly compiler warning that was being produced in error. 2012-02-06 12:05:36 +00:00
Robert Osfield
ae27f1e210 From Alexander Sinditskiy, "looks like GlyphGeometries _glyphGeometries; should be removed because Glyph3D have the same named local variable." 2012-02-06 11:17:12 +00:00
Robert Osfield
0e3de701d9 From Stephan Huber, "attached you'll find a first version of multi-touch-support for OS X (>=
10.6), which will forward all multi-touch events from a trackpad to the
corresponding osgGA-event-structures.

The support is switched off per default, but you can enable multi-touch
support via a new flag for GraphicsWindowCocoa::WindowData or directly
via the GraphicsWindowCocoa-class.

After switching multi-touch-support on, all mouse-events from the
trackpad get ignored, otherwise you'll have multiple events for the same
pointer which is very confusing (as the trackpad reports absolute
movement, and as a mouse relative movement).

I think this is not a problem, as multi-touch-input is a completely
different beast as a mouse, so you'll have to code your own
event-handlers anyway.

While coding this stuff, I asked myself if we should refactor
GUIEventAdapter/EventQueue and assign a specific event-type for
touch-input instead of using PUSH/DRAG/RELEASE. This will make it
clearer how to use the code, but will break the mouse-emulation for the
first touch-point and with that all existing manipulators. What do you
think? I am happy to code the proposed changes.

Additionally I created a small (and ugly) example osgmultitouch which
makes use of the osgGA::MultiTouchTrackballManipulator, shows all
touch-points on a HUD and demonstrates how to get the touchpoints from
an osgGA::GUIEventAdapter.

There's even a small example video here: http://vimeo.com/31611842"
2012-02-03 15:15:37 +00:00
Robert Osfield
85bce8b8ad From Stephan Huber, "attached you'll find a first version of multi-touch-support for OS X (>=
10.6), which will forward all multi-touch events from a trackpad to the
corresponding osgGA-event-structures.

The support is switched off per default, but you can enable multi-touch
support via a new flag for GraphicsWindowCocoa::WindowData or directly
via the GraphicsWindowCocoa-class.

After switching multi-touch-support on, all mouse-events from the
trackpad get ignored, otherwise you'll have multiple events for the same
pointer which is very confusing (as the trackpad reports absolute
movement, and as a mouse relative movement).

I think this is not a problem, as multi-touch-input is a completely
different beast as a mouse, so you'll have to code your own
event-handlers anyway.

While coding this stuff, I asked myself if we should refactor
GUIEventAdapter/EventQueue and assign a specific event-type for
touch-input instead of using PUSH/DRAG/RELEASE. This will make it
clearer how to use the code, but will break the mouse-emulation for the
first touch-point and with that all existing manipulators. What do you
think? I am happy to code the proposed changes.

Additionally I created a small (and ugly) example osgmultitouch which
makes use of the osgGA::MultiTouchTrackballManipulator, shows all
touch-points on a HUD and demonstrates how to get the touchpoints from
an osgGA::GUIEventAdapter.

There's even a small example video here: http://vimeo.com/31611842"
2012-02-03 14:25:08 +00:00
Robert Osfield
e5a16de7d4 Improved handling of archives 2012-02-03 11:10:17 +00:00
Robert Osfield
1ed3833556 From Terry Welsh, improved support for handling archives 2012-02-03 11:09:45 +00:00
Robert Osfield
fe61dcac69 From Colin McDonald, "I have an application with multiple windows. They share GL objects
between the contexts, using the GraphicsContext::Traits sharedContext
and setting the same contextID.

When one of these shared contexts is closed, GraphicsContext::close
deletes all GLObjects for that contextID, regardless of the fact that
they are shared.  This means that all of the other contexts sharing the
objects have to recompile them.

The attached tweak makes GraphicsContext::close a bit less brutal for
shared contexts.  I have also changed a misleading diagnostic message.
"
2012-02-01 17:42:42 +00:00
Robert Osfield
43f9a76169 From Luc Frauciel, "FBX plugin was locked on version 2012.1 of FBX SDK which is not available anymore on Autodesk website.
This patch allows version of FBX >= 2012.1, which includes current one : 2012.2
"
2012-02-01 17:38:37 +00:00
Robert Osfield
95f93e3bf5 Renamed selection to transform to make it clear to understand what is being done. 2012-02-01 17:16:44 +00:00
Robert Osfield
c3b7f6debe Added example usage of teh new DraggerTransforCallback's HandleCommandMask which is tied to the TabPlaneDragger example. 2012-02-01 17:10:48 +00:00
Robert Osfield
487ee0f8e7 Added DraggerTransformCallback::HandleCommandMask to DraggerTransformCallback to allow applications to select which
commands they want the dragger callback to respond to why updating the transform.
2012-02-01 13:55:38 +00:00
Robert Osfield
7664d90504 Improved the handling of osgManipulator::Constraint, DraggerCallbacks and Command so that they now use a Visitor Pattern
to ensure the correct methods on constraints and callbaks are called for each Command.  Also fixed the handling of
Constraints when applied to composite Draggers.
2012-01-31 10:56:52 +00:00
Robert Osfield
0381914b42 Added support for Scale1DDragger, Scale2DDragger and TranslatePlaneDragger to --dragger command line option 2012-01-30 12:26:28 +00:00
Robert Osfield
ad0872a783 From Kristofer Tingdahl, Added missing core OSG libraries. 2012-01-27 09:49:06 +00:00
Robert Osfield
a0df35b580 From Stephan Huber, "a recent submission added a 10.6-feature to GraphicsWindowCocoa. I added
some ifdefs around, so it compiles again with 10.5 SDK"
2012-01-26 18:03:26 +00:00
Robert Osfield
eb2e4d313a Quietend down debug message 2012-01-26 14:26:59 +00:00
Robert Osfield
167b6e69e4 From J.P. Delport, "when switching from windowed mode to fullscreen (with the 'f' key) in X11, no RESIZE event is generated. This confuses handlers that perform some processing on the RESIZE event, e.g. the InteractiveImageHandler.
To reproduce the problem I attach a minimally modified osgviewer that just prints resize events. You can check what's printed in the console when you go fullscreen and windowed a few times.

The attached version of GraphicsWindowX11 fixes the problem for me, but I'm not sure this is the right approach. Maybe you can see a fix for the problem clearer.

The only place where the RESIZE event is generated in GraphicsWindowX11 is in CheckEvents and it then depends on the ConfigureNotify message. For some reason, either ConfigureNotify is not sent when going fullscreen or the traits already reflect the latest window size."
2012-01-26 13:08:19 +00:00
Robert Osfield
8ecd0dea87 From J.P. Delport, "this fall-through had me scratching my head for a while...
It made InteractiveImageHandler eat keypresses outside its image."
2012-01-25 17:37:55 +00:00
Robert Osfield
45998e9ce1 From J.P. Delport, "GraphicsWindowX11 typo, I believe X/Y's should match." 2012-01-25 17:35:17 +00:00
Robert Osfield
5feb203d79 From Luc Frauciel, "Ati FirePro is as much crippled as other Ati drivers.
This patch add "FirePro" to the black list of renderers in State.cpp / initializeExtensionProcs

It allows to avoid an OpenGL error on Viewer initialization.
Tested on FirePro  M7740 / Windows7 x64  Driver 8.85.7.2"
2012-01-25 17:31:07 +00:00
Robert Osfield
b20abdb819 Changed the KeyEventToggleTexturing to 'e' to avoid conflict with 't' used for transparency. 2012-01-25 15:38:31 +00:00
Robert Osfield
737da5f23a Made the cursor state protected. 2012-01-24 17:57:01 +00:00
Robert Osfield
7fc23467f1 From Tobias Ottenweller, "this is a fix for the problem where all input freezes for a quarter second when calling requestWarpPointer under Mac OS X (described here: http://forum.openscenegraph.org/viewtopic.php?t=3933 ).
I used the latest version available via subversion.

My fix is using some API only available on 10.4 and later. I used some preprocessor statements to gain compatibility with 10.3 and earlier using (now) deprecated API.

Only tested on OS X Lion (10.7). Please do some testing as well since I'm fairly new to OpenSceneGraph. Someone should also test the code for 10.3 and earlier."
2012-01-24 17:49:18 +00:00
Robert Osfield
3c414c7962 Fixed indentation and spaces at ends of lines. 2012-01-24 17:47:04 +00:00
Robert Osfield
68f776e2cc From Paulk Martz, "Looks like the ClipNode::setReferenceFrame comment block came from LightSource. Fixing the comment block to refer to ClipNode instead of light source." 2012-01-24 17:40:31 +00:00
Robert Osfield
9da901e11b Chris Denham, fixed type of parameters to ensure they are longs where appropriate. 2012-01-24 17:38:23 +00:00
Robert Osfield
d350ea5395 Moved setEndBarrierOperation(..) implementation into .cpp and added support for stoppig and starting threading if required. 2012-01-24 17:30:44 +00:00
Robert Osfield
b0b98d49b8 From Paul Martz, Added ViewerBase::s/getEndBarrierOperation(..) method to allow user control of how viewers are sync'd. 2012-01-24 17:21:14 +00:00
Robert Osfield
884f480202 Fixed compile error 2012-01-24 15:44:58 +00:00
Robert Osfield
6d66e1abaa Added support for using GL_UNPACK_ROW_LENGTH in conjunction with texture's + osg::Image via new RowLength
parameter in osg::Image.  To support this Image::setData(..) now has a new optional rowLength parameter which
defaults to 0, which provides the original behaviour, Image::setRowLength(int) and int Image::getRowLength() are also provided.

With the introduction of RowLength support in osg::Image it is now possible to create a sub image where
the t size of the image are smaller than the row length, useful for when you have a large image on the CPU
and which to use a small portion of it on the GPU.  However, when these sub images are created the data
within the image is no longer contiguous so data access can no longer assume that all the data is in
one block.  The new method Image::isDataContiguous() enables the user to check whether the data is contiguous,
and if not one can either access the data row by row using Image::data(column,row,image) accessor, or use the
new Image::DataIterator for stepping through each block on memory assocatied with the image.

To support the possibility of non contiguous osg::Image usage of image objects has had to be updated to
check DataContiguous and handle the case or use access via the DataIerator or by row by row.  To achieve
this a relatively large number of files has had to be modified, in particular the texture classes and
image plugins that doing writing.
2012-01-24 14:34:02 +00:00
Robert Osfield
6aa6e9a38c Refactored the click_to_run implementation to avoid bug associated with running the first click_to_run entry in a layer when
subsequent click to run's are called.
2012-01-24 14:27:17 +00:00
Robert Osfield
76b1c8e20e Changed float QuicktimeImageStream::getCurrentTime() to double QuicktimeImageStream::getCurrentTime() to keep it consistent with
the type of the virtual function ImageStream::getCurrentTime(), and with this fixing a compile and runtime error.

Changed time variables all to use doubles rather than float to be consist with the change to getCurrentTime().
2012-01-23 18:48:18 +00:00
Robert Osfield
fa5100cc2c From Alberto Luacus, "The ffmpeg plugin fails to compile with the upcoming libav 0.8 because
the required header mathematics.h is not being included explicitly.

I have just included it, and verified that this also works with current
version 0.7, since the header is also available there."
2012-01-05 14:07:56 +00:00
Robert Osfield
329f98c83b Fixed the return value of SlideEventHandler::selectLayer() so that the 'n' now works correctly. 2012-01-03 15:59:19 +00:00
Robert Osfield
b828f5c083 From Farshid Lashkari, "Attached is a simple fix to osg::Sequence that allows it to load properly with the serializer formats (osgt/osgb). The problem was that the internal _nrepsRemain member was not being initialized properly if the number of repeats was equal to the default value of -1. When the number of repeats is explicitly set using setNumRepeats(), _nrepsRemain is set to the same value. However, in the constructor of osg::Sequence, it was not being initialized to the same value as _nreps. This fix simply changes the initial value of _nrepsRemain to the same as _nreps." 2012-01-02 16:54:05 +00:00
Robert Osfield
d9fd29d996 From Chris Denham, Implementation of write functions in CURL plugin 2012-01-02 16:38:01 +00:00
Robert Osfield
3aab31f198 From Paul Martz and David Glenn,
"From David Glenn and Paul Martz. This change adds support for the NO_COLOR bit in the Vertex records' flags field. If NO_COLOR is set, and PACKED_COLOR is not set, the code will now properly default to using the face color at those vertices. See the osg-users thread "Open Flight characteristic not reflected in the current OSG" for more info."

and

"In consultation with David Glenn, it appears we needed to change a second file to correct how OpenFlight handles transparency when vertices have NO_COLOR. "
2011-12-23 17:40:31 +00:00
Robert Osfield
a53308f7e8 Gunnar Holm, "After upgrading from 2.8.3 to 3.0.1 we experienced a lock in the Mutex
functionality when using Terrain::setVerticalScale. This was caused by
the following call sequence resulting in a lockup:

void Terrain::setVerticalScale(float scale)
  CALLS    dirtyRegisteredTiles();


void Terrain::dirtyRegisteredTiles(int dirtyMask)
 SETS LOCK    OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
 and CALLS (on every tile)   setDirtyMask(dirtyMask);


void TerrainTile::setDirtyMask(int dirtyMask)
 CALLS _terrain->updateTerrainTileOnNextFrame(this);


void Terrain::updateTerrainTileOnNextFrame(TerrainTile* terrainTile)
 SETS LOCK   OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
******* PROBLEM - since lock has already been set! ********


The suggested fix submitted changes from using Mutex to ReentrantMutex.
"
2011-12-23 17:34:07 +00:00
Robert Osfield
c7698c1334 From Aurelien Albert, "I made a modification in the Dragger class :
You can now set a "intersection mask" and it will be used when looking for intersections.

So you can now easily "hide" some objects from manipulators."
2011-12-23 17:21:59 +00:00
Robert Osfield
50c7a31d62 From Brad Christiansen, "I have added an implementation for set/getVolume in the direct show plug-in." 2011-12-23 17:16:06 +00:00
Robert Osfield
f3ce66aa8b From Glenn Waldron, "Attached is a change to ClusterCullingCallback to make it work properly under an RTT camera with an INHERIT_VIEWPOINT reference frame." 2011-12-23 17:15:06 +00:00
Robert Osfield
dc55068db1 From James Turner, "Testing FlightGear with Cocoa osgViewer, encountered some problems with hiding / re-showing the cursor. Attached version fixes this, by tracking the current cursor value, and ensuring we don't nest calls to [NSCursor hide] or [NSCursor unhide]." 2011-12-23 16:57:34 +00:00
Robert Osfield
fa2e8b22c5 From Ulrich Hertlein, "attached is a patch for osgPlugins/mdl/MDLReader.cpp that improves its functionality on
Unix filesystems.  It also includes code cleanups/refactoring."
2011-12-23 16:29:51 +00:00
Robert Osfield
4e834dfc73 From Brad Christiansen, "Attached are some small changes to the ImageStream interface and the DirectShow and FFMPEG plugins to provide the current time being displayed in the image stream.
I don’t have access to an OSX or Linux dev machine to make the changes required to the quick time plugin. This plugin will just default to returning 0."
2011-12-23 16:27:25 +00:00
Robert Osfield
f6ace4a7d0 From Ulrich Hertlein, typo fixes 2011-12-23 16:14:51 +00:00
Robert Osfield
c9d19d7bff Added handling of an empty filename when writing out an image file. 2011-12-23 12:42:18 +00:00
Robert Osfield
0af31eff5d Removed inappropriate static usage 2011-12-19 16:18:18 +00:00
Robert Osfield
c86e2361d2 Moved the createSpotLightImage function into include/osg/ImageUtils 2011-12-19 09:37:57 +00:00
Robert Osfield
c225f2758c Added --num-sm and --parallel-split and --cascaded command line options to set the appriopriate ViewDependentShadowMap settings. 2011-12-19 09:09:30 +00:00
Robert Osfield
74fb1f42d9 Moved osgshaders example across to use the new osgUtil::PerlinNoise example 2011-12-13 21:14:33 +00:00
Robert Osfield
22e309e8fb Created new PerlinNoise class from the Noise.h+Noise.cpp code in the osgshaders example. 2011-12-13 21:12:00 +00:00
Robert Osfield
22ef706e32 Fixed build under Tiny Core. 2011-11-30 19:14:14 +00:00
Robert Osfield
16c2bb5a2f To fix problems in tight bound computation of the shadow map made the ComputeLightSpaceBounds usage always used when the
CastShadowMask is active.  Changed the ComputeLightSpaceBounds to use just VIEW_FRUSTUM_CULLING.
2011-11-25 12:48:03 +00:00
Robert Osfield
2b2c1b5671 From Jean-Sebastien Guay, fix for handling texture unit >= 8 and negative LigthNum. 2011-11-25 09:24:50 +00:00
Robert Osfield
92ed903a7f Added prelimanary support for parallel split shadow maps into ViewDependentShadowMap. 2011-11-22 21:55:30 +00:00
Robert Osfield
116b9a978c From Trajce Nikolov, "Here is extended version of the osgforest example - technique with geometry shader added, was doing it for a project so I thought might be useful to update the example as well
"
2011-11-18 08:20:04 +00:00
Robert Osfield
c7542d5cd8 Fixed indentation 2011-11-18 08:15:36 +00:00
Robert Osfield
ce021df661 Added .get() to fix build 2011-11-17 18:45:18 +00:00
Robert Osfield
862c1c4af3 Updated built in volume shaders to honour the osg::Matierial setting 2011-11-11 10:36:17 +00:00
Robert Osfield
d13bfb522b Enabled blending for the iso surface rendering to enable fade in/fade out of volume. 2011-11-11 10:25:20 +00:00
Robert Osfield
85418bf7ba Added handling of osgGA::GUIEventAdapter::getMouseYOrientation() in the orientation of mouse y position.
Added updating of properties on both mouse move/drag and keydown.
2011-11-10 15:50:22 +00:00
Robert Osfield
a548daa4be Added a check against OSX 10.6 to enable better selection of when to provide custom cosf etc. definition.
This change has been introduced to address recurcsion problems in 10.7 in the ac3d plugin.
2011-11-07 14:36:50 +00:00
Robert Osfield
693d79c638 Implement presentation update feature that reloads the presentation on pressing 'u'. 2011-11-04 12:50:05 +00:00
Robert Osfield
e8bae33143 Improved the handling of setStartTick() being called mid app, such as when idirectly called when doing a Viewer::setSceneData().
Improved the setting the the initial event state.
2011-11-04 12:47:24 +00:00
Robert Osfield
0329ca5cea Improved handling of resetting of the EventQueue::startTick(). 2011-11-04 12:45:32 +00:00
Robert Osfield
747654fb6d Added removeFromObjectCache method. 2011-11-04 12:44:01 +00:00
Robert Osfield
3c461dd706 Add check to filter out the return of FILE_NOT_FOUND from archive results to prevent these from prematurely exiting the Registry::read(..) method
bofore it loads plugins to try and load requested file.
2011-11-02 10:57:17 +00:00
Robert Osfield
04f9341161 Replaced the use of PrtScrn with 'm' for taking screenshots, replaced the use of 'm' with 'M' for taking movies. 2011-11-01 16:13:24 +00:00
Robert Osfield
1bcd36f5ed From Stephan Huber, "A recent commit
(41e23f466d)
for GraphicWindowsIOS.mm broke the compilation for OpenGL ES 1.x as
GL_DEPTH_COMPONENT32_OES is not defined for 1.x. I added a #define-guard."
2011-11-01 13:41:48 +00:00
Robert Osfield
76396d0c12 Added screen capture handler to present3D, with the PrtScn button used for a single frame capture and 'm' for continuous frame capture.
The --screenshot filename command line option can be used to configure the name of the screen capture.
2011-11-01 13:36:07 +00:00
Robert Osfield
215512647c Added setting of the sampleDensityWhenMovingProperty at the same time as when setting the sampleDensityProperty 2011-11-01 11:08:48 +00:00
Robert Osfield
3cad9d0962 Fixed the use DCM_SeriesDescription 2011-11-01 10:30:18 +00:00
Robert Osfield
14a4aa9a19 Improved the handling of multiple datasets being read at once, with all the images in a series being group according to Series UID and SeriesDescription and orientation. 2011-11-01 10:27:12 +00:00
Robert Osfield
ca582c708d Adding missing checks against View's Camera and SceneData for any update callbacks that need calling. 2011-10-31 15:29:49 +00:00
Robert Osfield
d95801f6a8 Changed the notification level to INFO. 2011-10-28 11:00:55 +00:00
Robert Osfield
bbf081695b Changed the setting of Traits::sampleBuffers so that it's set to 1 when DisplaySettings::getMultiSamples() is set to a non zero value. 2011-10-28 11:00:08 +00:00
Robert Osfield
3e7900c39e Changed the default for SampleBuffers to be 1 when set. 2011-10-28 10:36:29 +00:00
Robert Osfield
20ffed1fa1 Removed OSX codepath for setting the depth value to 32 as this turned out to be unneccesary. 2011-10-28 09:45:51 +00:00
Robert Osfield
24ff8796d5 Changed the default depth to 24. 2011-10-28 09:11:21 +00:00
Robert Osfield
98d50250ff Updated volume shaders to use the GL_LIGHT 0 values to control the direction of the light source 2011-10-27 16:33:18 +00:00
Robert Osfield
3a64805d20 Reimplement the light direction controls so that they now work correctly with osgViewer::Viewer.
Improved the computation of the light direction from non-dimensional mouse coords so that they now project onto a hemisphere making
the interaction more intuitive.
2011-10-27 13:11:20 +00:00
Robert Osfield
7bcfb3c130 Added support for ignore returns as white space. 2011-10-27 09:24:34 +00:00
Robert Osfield
c403c052db Added support for American spelling of swap and add supportOptions(..) documentation for the new options. 2011-10-27 08:34:53 +00:00
Robert Osfield
881078289d Added support into the .p3d format for specifying the osgDB::Options::OptionString via the <tag options="value">.
Added support into .vnc plugin for passing in the keywords "swap", "RGB", "RGBA", "BGR", "BGRA" as OptionString values to allow .p3d presentations to control
whether the pixelformat should be swapped or set to a specific format.
2011-10-26 14:25:56 +00:00
Robert Osfield
5d26d16fd3 Added password support into present3D's vnc support via the tag usage : <vnc password="mypassword">hostname</vnc> 2011-10-26 12:48:57 +00:00
Robert Osfield
9995cb70a9 Added password support into osgvnc example and vnc plugin 2011-10-26 12:29:38 +00:00
Robert Osfield
b9d7989b44 Implement a simply attempt at detecting when the pixel format needs to be swapped. 2011-10-26 09:34:50 +00:00
Robert Osfield
2dc271d85f Added support for 32bit depth buffer 2011-10-25 15:55:33 +00:00
Robert Osfield
4b655d9c46 Added hack of using a 32bit depth buffer default setting for Traits when compiling under Apple. 2011-10-25 15:31:46 +00:00
Robert Osfield
9b380c8d49 Moved switching off of the cursor till after the slide event handler has had a chance to switch off the scene. 2011-10-24 13:40:29 +00:00
Robert Osfield
1538ecf113 Fixed handling of slide with no layers. 2011-10-24 11:09:35 +00:00
Robert Osfield
e04ca06fc8 Fixed build of StreamOperator 2011-10-22 09:02:18 +00:00
Robert Osfield
9e903861a2 Fixed handling of Vec3dArray in GLBeginEdnAdapter/ArrayDispatchers. 2011-10-21 15:39:51 +00:00
Robert Osfield
d7cba048f5 Added support for using negative scale_x, scale_y and scale_z values in the <volume> tag to allow presentations to flip the imagery 2011-10-21 11:00:29 +00:00
Robert Osfield
d3cebab9a3 Added flipDepth() method 2011-10-21 10:59:42 +00:00
Robert Osfield
088d00c651 Fixed handling of scale.x, scale.y and scale.z paramters so that all of them now take an effect. 2011-10-21 09:31:56 +00:00
Robert Osfield
6607b373d5 Fixed handling of reading/writing of osgVolume::VolumeTile tiles 2011-10-20 16:49:08 +00:00
Robert Osfield
affe0b4a6d Added support for calling throwException() from InputIterator and added a check for negative string sizes. 2011-10-20 16:35:50 +00:00
Robert Osfield
62888dba38 Added check against build type to avoid the build of the osgviewerWX example with debug build as this fails with unresolved symbols within the internals of WxWidgets. 2011-10-20 11:50:04 +00:00
Robert Osfield
aa14f603d1 From Ulrich Hertlein, fixed build problem due to cmake_policy CMP0017 being only available from cmake-2.8.4, added guard to prevent build problems 2011-10-20 10:52:32 +00:00
Robert Osfield
3fd407a60e Improved handling of recent Cmake versions 2011-10-20 09:23:26 +00:00
Robert Osfield
2c4eb8d181 Fixed typo in command line output, and add an explanation message for when createTexture3D fails to create an osg::Image from a list of input osg::Image. 2011-10-20 08:59:47 +00:00
Robert Osfield
61b2659fab Fixed typo 2011-10-17 15:39:46 +00:00
Robert Osfield
33479c7768 Improvements to the compute near/far 2011-10-17 14:41:49 +00:00
Robert Osfield
bdb0dfe27d Improvements to osgShadow::ViewDependentShadowMap and ShadowSettings 2011-10-17 14:40:29 +00:00
Robert Osfield
0fc0c642bf Quitened down debug message 2011-10-17 11:12:05 +00:00
Robert Osfield
4992f798d7 From Jean-Sebastien Guay, add --mapres size option to ViewDependentShadowMap settings. 2011-10-17 10:25:28 +00:00
Robert Osfield
d9dbff18a2 Add catch for when shadows are enabled between the update and draw traversals. 2011-10-03 15:57:06 +00:00
Robert Osfield
e8e25e82a9 From Jean-Sebastien Guay, changed the border colour for the shadow map to be 1 rather the 0 used for debugging so that areas outside the shadow map default to being unshadowed rather than shadowed.
changed the shadow map texture assigment to StateSet so that it doesn't use OVERRIDE, enabling subgraphs to use the same texture unit for other textures if they so required.
                          tidied up indentation.
2011-10-03 15:25:16 +00:00
Robert Osfield
78ad56f76c Changed getVertical(..) so it uses the same coord scale as the getGlyph 2011-10-03 14:57:39 +00:00
Robert Osfield
951a437c0c Fixed handling of ShadowSetting LightNum 2011-10-03 14:56:38 +00:00
Robert Osfield
bb48cef38c Added Font::getVertical(float& ascender, float& descender) methods. 2011-10-03 10:36:18 +00:00
Robert Osfield
db329cf943 Added catch for NaN vertices that were being generated by osgText, these NaN vertices were causing glu tesselation functions to crash. 2011-09-28 11:52:27 +00:00
Robert Osfield
b32d8e0151 Added computation of the extents, in light space, of the shadow maps RenderStage contents and use of this to produce a tighter bound light space projection. 2011-09-28 10:54:30 +00:00
Robert Osfield
12e8d09ed1 Added a half second sleep after calling system command when the command is run in the background so
that this command has a chance to run and open a window before the calling present3D moves on to the next frame.
2011-09-20 11:46:45 +00:00
Robert Osfield
0b7dbc68c9 Added better error reporting and handling when <key> tag contents are not valid. 2011-09-20 10:59:18 +00:00
Robert Osfield
845d33b353 Added handling of <!DOCTYPE...> tag and "" options. 2011-09-20 10:01:07 +00:00
Robert Osfield
2c1b6789db From Ulrich Hertlein, "attached is a patch that cleans up compiler warnings and common functionality." 2011-09-19 10:42:54 +00:00
Robert Osfield
e557d4f28b From Wojciech Lewandowski, "There was a bug in reading modifier keys when focus to GraphicsWindowWin32 was restored. Handler of WM_SETFOCUS was reading pressed keys and sending WM_KEYDOWN messages to fill initial keyboard state. But WM_KEYDOWN messages sent had 0 on lParam and adaptKey method computing state of modifier mask was using lParam to find which modifier keys are down. Obviously when lParam was 0 it was not recording proper modifier masks.
This patch fixes this code sending proper lParam and also makes sure LEFT_CONTROL will be not confused with RIGHT_CONTROL."
2011-09-19 10:39:19 +00:00
Robert Osfield
8a230d42ed From Luc Frauciel, "You'll find attached a new option that allow, when using LOD in USER_DEFINED_CENTER mode to expand the radius of the node by the radius of loaded objets.
Motivation ;
When using PagedLODs, you don't always know the real size of loaded children,
If it occurs that they  are out of predefined bounds, picking on the parts that are out of bound will fail
They also can be culled out too soon.
The problem often  occurs with long object (roads).
I've modified LOD and ProxyNode to include this option."

and later email:

"Attached the UNION_OF_BOUNDING_SPHERE_AND_USER_DEFINED version
There are impacts on some serializers (dae, osgWrapper).
I haven't modified deprecated osg, since it's deprecated"
2011-09-19 10:34:31 +00:00
Robert Osfield
6e01f05853 Added removal of [..] from names returned from glGetActiveUniform results to avoid issues with name lookups when the driver add the [..] for uniform arrays. 2011-09-19 10:12:53 +00:00
Robert Osfield
f9dffdba2c Copya and Paste Anti-Pattern strikes again! Renamed FreeType usage to Revisions to correct previous mistake when copying and modifying the ReaderWriter. 2011-09-19 09:44:29 +00:00
Robert Osfield
3279e9a5f5 Fixed memory leak 2011-09-14 10:45:11 +00:00
Robert Osfield
420d8f6acf Added missing forward declaration 2011-09-14 10:22:04 +00:00
Robert Osfield
8345c85c3c Added asCamera() methods into osg::Camera and osg::Node 2011-09-14 10:02:11 +00:00
Robert Osfield
0f30c08701 From Laurens Voerman, "attached is a zipped
OpenSceneGraph\src\osgPlugins\ffmpeg\FFmpegDecoderAudio.cpp

It solves a wrong sample format being set for audiostreams type S32 and F32, for the
enum AVSampleFormat (in include/avutil/samplefmt.h) doesn't match
enum SampleFormat   (in include/osg/AudioStream) for anything but
SAMPLE_FORMAT_U8 and SAMPLE_FORMAT_S16
"

and follow up that address versioning issue

"I can find the change, avutil version 50.38.0 introduced a new header file:
libavutil/samplefmt.h
older versions use
libavcodec/avcodec.h
with the sampleformats without AV_

an intermideate fix with the FF_API_OLD_SAMPLE_FMT is removed from ffmpeg 0.8.3 so
I think this is the correct fix:

#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(50,38,0)
#define AV_SAMPLE_FMT_NONE SAMPLE_FMT_NONE
#define AV_SAMPLE_FMT_U8   SAMPLE_FMT_U8
#define AV_SAMPLE_FMT_S16  SAMPLE_FMT_S16
#define AV_SAMPLE_FMT_S32  SAMPLE_FMT_S32
#define AV_SAMPLE_FMT_FLT  SAMPLE_FMT_FLT
#define AV_SAMPLE_FMT_DBL  SAMPLE_FMT_DBL
#define AV_SAMPLE_FMT_NB   SAMPLE_FMT_NB
#endif
"
2011-09-14 09:49:28 +00:00
Robert Osfield
c1af863f78 From Morten Hauknes, "I have been using the getLastVisiblePixelCount on pre 3.0 osg. I believe maybe this was a private function that we made public in our side. I use(d) this method to make a simple algorithm to tell how much visible an object was in percent.
So with the 3.0 api change we propose the following change:
- put OSG_EXPORT on the QueryGeometry class so that we get access to the getNumPixels method.
- Create a function called getQueryGeometry that returns a casted _queryGeode->getDrawable(). Or a function called getQueryGeode that returns _queryGeode."
2011-09-13 13:38:26 +00:00
Robert Osfield
6c46956918 From Jean-Sebastien Guay, removed unneccessary BUILD_QT_EXAMPLES cmake option 2011-09-13 13:33:41 +00:00
Robert Osfield
41924dfc14 From Sukender, "I just fount that writing double precision values (eg. Vec3dArray for vertices) works with .osg but not .osgt/.osgx. So here is the fix (SVN trunk r12712). I suppose .osgb works as expected on this point and did not change anything.
So, as for .osg, if you add "precision 16" (for instance) to the optionString, then you'll get double precision vertices written correctly.
"
2011-09-13 11:48:06 +00:00
Robert Osfield
64fa6aec43 From Robert Milharcic, "This will hopefully fix some issues with osgQt, more precisely with GLWidget event handling. There are at least two current GL context braking events, QEvent::Hide and QEvent::ParentChange. When running in a multithreaded mode they both try to change current GL context in a wrong thread (main GUI thread). The QEvent::ParentChange is also problematic when running in a single threaded model because Qt is going to release current contex then delete it, and then it will create new one, and as a result the osg will continue to render to an invalid deleted context. This changes workaround above problems by deferring execution of the problematic evens. These events has to be enqueued and executed later. The enqueued event processing is currently done right after swap in a swapBuffersImplementation of GraphicsWindowQt while code is running in a render thread by calling QGLWidget handler directly. In principle the deferred events queue should be executed while in GUI thread but I couldn't find any reliable way to do this, that is without risking a deadlock. For now it is assumed, Qt is not going to execute any GUI thread only operations inside the QGLWidget handler." 2011-09-13 11:09:39 +00:00
Robert Osfield
098bc6df5e From Farshid Lashkari, "
The osgUtil::CullVisitor class will display an OSG_INFO notification when attempting to clamp the projection matrix with invalid near/var values. This usually appears when the scene graph is empty or all objects are culled. I don't think this scenario warrants having this message appear every frame. It makes it very difficult to debug other issues when this notification floods the output window.

I'd prefer to have the notification removed, but there might be legitimate cases where you want this displayed. Instead, I just disabled the output if the near/far values are equal to FLT_MAX (their initial values). This should at least prevent the notification for the common case where everything was culled."
2011-09-13 10:15:07 +00:00
Robert Osfield
408c2a2267 From Paul Martz, "Here's my proposed change regarding the osg-users post "small feature culling threshold". I've updated the comments and brought the default values into agreement, but didn't bother to add the environment variable support." 2011-09-13 09:59:21 +00:00
Robert Osfield
c35fdf7333 From Jean-Sebastien Guay, "I added a simple setting in OSG's CMakeLists.txt to be able to disable building anything related to Qt. It just skips the FindPackage(...) for Qt3 and Qt4, so since they are not found nothing related to Qt will be generated by CMake. The default is to build the Qt related stuff, so current behavior is unchanged." 2011-09-13 09:53:34 +00:00
Robert Osfield
698a284da8 From Sukender, "I added a tiny check to avoid an integer divide-by-zero, when image is invalid (ie. all values are 0)." 2011-09-13 09:46:22 +00:00
Robert Osfield
abb7228d56 From Sukender, "I added a crash-guard against corrupted 3DS files, having faces indexes out of the range of existing vertices." 2011-09-13 09:43:45 +00:00
Robert Osfield
6d1ba5b06d From Farshild Lashkari, "Attached is a simple patch that avoids the depth write pass in Text::renderWithDelayedDepthWrites if the current osg::State object has GL_DEPTH_TEST disabled." 2011-09-13 09:21:07 +00:00
Robert Osfield
43483408f3 Reverted Paul Idstein warning fix as this was breaking the build 2011-09-13 09:17:21 +00:00
Robert Osfield
757d00c3c8 From Ulrich Hertlein, Added some error checks and memory cleanup. 2011-09-12 16:24:08 +00:00
Robert Osfield
cd6e174a5c From Stephan Huber, fixed build for OSX 10.6 and earlier 2011-09-12 16:20:45 +00:00
Robert Osfield
cc37579392 From Johannes Baeuerle, opptimization of ES support of osg/BufferObject 2011-09-12 16:17:33 +00:00
Robert Osfield
140a04aebc From Bjorn Blissing, "Found a minor (probably a copy & paste) bug in ViewerEventHandlers.
Line 251:
int getKeyEventWindowedResolutionDown() const { return _keyEventWindowedResolutionUp; }

Should be replaced with:
int getKeyEventWindowedResolutionDown() const { return _keyEventWindowedResolutionDown; }"
2011-09-12 12:38:41 +00:00
Robert Osfield
6e6dafcd3e From Luc Frauciel, "When osgUtil::DelaunayTriangulator triangulate() function ends with no triangle generated, it crashes.
This patch fixes that"
2011-09-12 12:26:55 +00:00
Robert Osfield
ca51a1113b From Magnus Kessler, documentation fixes 2011-09-12 12:14:17 +00:00
Robert Osfield
22dd9df78b Improved the clarity of doxygen comments 2011-09-12 12:04:46 +00:00
Robert Osfield
4b6593b211 Fixed typos in the documentation 2011-09-12 11:51:14 +00:00
Robert Osfield
796ccd14c8 From Cedric Pinson, from three submissions:
"Here a patch that correct like the previous assign collada material name
to stateset."

and

"I changed how the collada reader set object name in osg. Current
implementation use collada ID to setup name. with this patch I use
collada name to setup name in osg object and if collada provide no name
I use as fallback ID. I am not sure we want this fallback.

The motivation of this change is that when an artist set names to its
objects and export to collada, I am not able to use those names in osg
to retrieve the node."

and

"Here the update of the file that fix the light id stuff"
2011-09-12 11:28:14 +00:00
Robert Osfield
19b8b1f474 From Bob Kuehne, build fix for OSX 10.7 SDK. 2011-09-12 11:24:52 +00:00
Robert Osfield
edd83a03fe From Paul Idstein, warning fixes for OSX 10.7 2011-09-12 11:24:24 +00:00
Robert Osfield
9be4a1a1c8 From Magnus Kessler, typo fixes 2011-09-12 10:52:16 +00:00
Robert Osfield
5162fcc108 From Wang Rui, "I've encountered a strange problem that osgviewerMFC doesn't work well
with the StatsHandler. When the 's' key is pressed, the rendering
window will be halted. I tried solving the problem by commenting a
line in CMFC_OSG_MDIView::OnKeyDown() and it seems to work now.

Another improvement here is to use a thread class derived from
OpenThreads to replace the old _beginthread(). It helps a lot in
keeping a high frame rate when you open more than one MDI child
windows. And the application using OpenThreads in my opinion will be
more compatible and portable."
2011-09-12 10:47:59 +00:00
Robert Osfield
c8de3b70ca Updated SO version number to 90 to allow for recent changes to the ABI, and to set the base for the 3.1.0 series. 2011-09-12 10:46:42 +00:00
Robert Osfield
94777c4ef5 From Sukender, "I added private constructors to osg::ValueObject & TemplatedValueObject, to avoid allocation on the stack and ugly things like:
TemplatedValueObject<int> value(....);
 container->addUserObject(value);"
2011-09-12 10:43:24 +00:00
Robert Osfield
83524f958e Added handling the ShadowSettings::LightNum for selecting which light to use. 2011-09-07 20:05:25 +00:00
Robert Osfield
b2fd8f4059 Added handling of the case when RenderLeaf::_modelview matrix is NULL, such as when LightPointNode is used in the scene graph. 2011-09-07 16:26:57 +00:00
Robert Osfield
3a79bc343d Moved ViewDependetShadowMap parameter settings into a dedicated ShadowSettings object in prep for making it possible to scale the API to handle multiple lights and multiple shadow maps per light. 2011-09-07 15:55:54 +00:00
Robert Osfield
772c7d75c5 Added setting of the shadow map Camera's name to "ShadowCamera" to improve integration with osgOcean. 2011-09-06 17:26:27 +00:00
Robert Osfield
f26ef2d9e0 Added optimization of the mutliple cessna shadow model to address peformance issues when rendering 100 cessna's. 2011-09-06 14:13:13 +00:00
Robert Osfield
f95f43dbc6 Added -5 model option using Wang Rui's test demo as a base 2011-09-06 11:42:54 +00:00
Robert Osfield
ecbca83c01 Fixed the heights of the trees and houses 2011-09-06 11:11:38 +00:00
Robert Osfield
f83722d62b Added s/getPerspectiveShadowMapCutOffAngle() and use of this when setting up light space to avoid sigularaties when
the light and view directions are co-incident.
2011-09-06 10:12:45 +00:00
Robert Osfield
15ad6eda63 Added support for setting whether ViewDependentShadowMap should provide it's own vertex and fragment shaders. 2011-09-05 12:36:47 +00:00
Robert Osfield
454ccad3b9 Replaced use of ShapeDrawable with osgTerrain for the terrain tile 2011-09-05 12:27:20 +00:00
Robert Osfield
52c2bc3ff5 Added s/getTextureSize() method for setting the shadow map texture size. 2011-09-02 10:16:16 +00:00
Robert Osfield
f476406ae1 Disabled the use of the ReceivesShadowTraversalMask() mask 2011-09-02 07:46:08 +00:00
Robert Osfield
ec3b2ba2d3 Added test line for COMPUTE_NEAR_USING_PRIMITIVES 2011-09-01 18:49:33 +00:00
Robert Osfield
1fd3c84287 Added fine grained computation of the far plane when using the COMPUTE_NEAR_FAR_USING_PRIMITIVES ComputeNearFarMode.
Added COMPUTE_NEAR_FAR_USING_PRIMITIVES option that provides the original functionality where only the near plane
is computed in a fine grained way, with the far plane being computed simply from bound volumes.
2011-09-01 18:48:21 +00:00
Robert Osfield
b21d206d3a From Tony Horrobin, build fix 2011-08-29 16:01:02 +00:00
Robert Osfield
47db350da1 Added fallback base texture 2011-08-29 10:26:05 +00:00
Robert Osfield
2d71a390d3 Added support for setting the MinimumShadowMapNearFarRatio. 2011-08-29 09:59:47 +00:00
Robert Osfield
771075084b Fixed bug in computaton of the min/max x/z ratios. 2011-08-26 15:40:09 +00:00
Robert Osfield
ef91a87e23 Added names to models to help with debugging. 2011-08-26 15:36:33 +00:00
Robert Osfield
0f14f53698 Added releaseGLObjects/resizeGLObjectBuffers support 2011-08-26 10:52:25 +00:00
Robert Osfield
966981f100 Improved the handling of depth partitioning and orthographic datasets 2011-08-25 17:21:38 +00:00
Robert Osfield
1ad9979cea Added event handling for toggling on/off the light source animation. 2011-08-25 15:39:09 +00:00
Robert Osfield
0d3169f645 Added support for user defined setting of the shadow texture unit 2011-08-24 19:38:58 +00:00
Robert Osfield
26e2106636 Changed new ViewDependentShadowMap to default to a perspective shadow map with automatic detection of a spot light/perspetive light projection
matrix to prevent inappropriate usage of perspective shadow map.
2011-08-24 13:57:15 +00:00
Robert Osfield
622cfb524c Imorovements to the new perspective/lispsm style shadow implementation. 2011-08-24 12:32:03 +00:00
Robert Osfield
3db0557ed5 Quitened down and fixed warning 2011-08-24 12:31:35 +00:00
Robert Osfield
3a70830e89 Quitended down debug messages and added passing of RenderStage to LispSM code 2011-08-19 12:42:51 +00:00
Robert Osfield
7c4fb17298 Improved the LispSM computation 2011-08-19 10:43:38 +00:00
Robert Osfield
36fea2bd60 Changed the local variable near/far type 2011-08-19 10:43:15 +00:00
Robert Osfield
c71a0c72e4 Added back in control of the backface culling. 2011-08-17 17:06:55 +00:00
Robert Osfield
1d54065646 intermin check-in of work on new LispSM implementation 2011-08-17 16:09:17 +00:00
Robert Osfield
04ffdf1801 Added missing assignement of _simulationTime. 2011-08-15 14:37:16 +00:00
Robert Osfield
1625f61812 From Paul Martz, "Recent changes to osgShadow on trunk were apparently not yet tested with ref_ptr implicit casting disabled. Attached is a fix. " 2011-08-13 19:09:58 +00:00
Robert Osfield
b15317481c Added public interface for selecting use of perspective and light space perspective shadow maps. Implementation
of backends not implemented yet so will follow.
2011-08-12 20:29:14 +00:00
Robert Osfield
6b7175baac Implemented first pass at shaders for new ViewDepedentShadow map class 2011-08-12 14:53:40 +00:00
Robert Osfield
675a61ea87 Implemented ViewDependentShadowMap::setDebugDraw(bool) to allow osgshadow to enable/disable the debug display via the
standard --debugHUD option.
2011-08-09 15:57:37 +00:00
Robert Osfield
c14516d5f6 Changed RTT Camera to use depth. 2011-08-09 15:20:25 +00:00
Robert Osfield
4aa16bc8e3 Implemented caching of Camera, Texture and TexGen 2011-08-09 13:39:57 +00:00
Robert Osfield
e4a73d121e Added replacement of the placeholder StateSet in the StateGraph with custom StateSet implemented just for the
needs of that particular frame.
2011-08-09 06:54:44 +00:00
Robert Osfield
4238629ebf Further work on basic ViewDependentShadowMaps, adding implementation of RTT camera and texgen setup. 2011-08-08 17:00:55 +00:00
Robert Osfield
31cb490c75 From Jean-Sebestien Guay and Robert Osfield, mixture of two sets of change - one from JS that adds more controls for specifying positional and spot lights, and from RO adding support for the new ViewDepedentShadowMap 2011-08-07 15:54:21 +00:00
Robert Osfield
cbb6f1c92c Preliminary work on new ViewDependentShadowMap base class 2011-08-07 15:51:54 +00:00
Robert Osfield
ceb8d62636 Commented out the colorAmbientEmissive += gl_FrontLightProduct[0].ambient; line from the fragment shader as it was
causing problems with the shadowed region being sporadically lit when using a spotlight.
2011-07-29 11:22:32 +00:00
Robert Osfield
164cd6e9b9 Fixed comment on end barrier position. 2011-07-29 07:42:55 +00:00
Robert Osfield
ed27e55b60 Improved handling of the scaling of dicom imagery. 2011-07-28 16:40:28 +00:00
Robert Osfield
3abbba693c Refectored the EGL setup so that it's honours the Traits values. 2011-07-28 12:07:22 +00:00
Robert Osfield
dcaf9b02ce Reverted the change to the default setting of _resizeNonPowerOfTwoHint back to true for all platforms to ensure the
same behaivour across platforms, something that can be achieved now thanks to the integrated GLU library.

Corrected the default of the ResizeNonPowerOfTwoHint to true to reflect the actual default setting set by the
Texture default constructor.
2011-07-28 11:05:10 +00:00
Robert Osfield
27cc718251 From Johannes Baeuerle, "in the file src/osgDB/ObjectWrapper.cpp, where the GlobalLookupTable for gl enums for serialization purposes is defined, some of the compressed texture formats are missing. I added enums for the pvr and etc formats." 2011-07-28 08:19:29 +00:00
Robert Osfield
302c5a7e92 From Jason Beverage, "Here is a small fix for getCameraContainingPosition. getXMin was
being used in a case where getYMin should be used instead."
2011-07-28 07:46:05 +00:00
Robert Osfield
35ccc1efa5 Fixed stats bug where not all stats fields were being collected by the cull_draw() method used in the SingleThreaded and CullDrawThreadPerContext threading models. 2011-07-25 17:07:56 +00:00
Robert Osfield
8d77126e2e From Alexander Irion, "Texture borders are not supported in ES.
_isTextureBorderClampSupported is set to "TRUE" in Texture.cpp, because of the version number check (GL VERSION >= 1.3).

This leads to an invalid enum error, when GL_TEXTURE_BORDER_COLOR is tried to set.
"
2011-07-22 09:27:41 +00:00
Robert Osfield
6128300bc5 In the RecordCameraPathhandler fixed the handling of pressing 'Z' before 'z' which was causing the view
to be reset to 0,0,0 by AnimationPathManipualtor with an empty AnimationPath.
2011-07-22 08:25:29 +00:00
Robert Osfield
5efea79689 Fixed typo 2011-07-21 09:55:03 +00:00
Robert Osfield
9f4fee5fd3 From Mathias Froehlich, "I have attached an updated version of the VRML2 loader.
That change is the result of the '[osgPlugins] VRML plugin - "file" url'
discussion on osg-users.

The attached change avoids rewriting file names into some kind of file urls
and then use the url for opening an fstream. Instead just use the given file
name to open the stream.
Also this change adds some Notify output for the error paths.
"
2011-07-21 09:07:22 +00:00
Robert Osfield
eb72bd6556 From Wang Rui, "This fixes a small problem in the FindFBX file. In CMake scripts,
VS2010 is not marked as MSVC100 but MSVC10. And CMake defines
MSVC_VERSION instead of MSVC_VER to indicate the version number. The
modification can find fbx sdk for VS2010 automatically now.
"
2011-07-21 08:52:02 +00:00
Robert Osfield
f07a1a91c8 From Claus Scheiblauer, fixed handling of horizontal mouse wheel events. 2011-07-20 10:17:19 +00:00
Robert Osfield
1838707627 Introduced workaround for problem of text that is scaled in screen coords, but hasn't been rendered yet
so doesn't have knowledge of screen space yet, so assume that scaling is 1 rather than 0 as was previously
assumed in the previous handling of screen space text.
2011-07-20 09:10:32 +00:00
Robert Osfield
695fcda726 Added doxygen comments explaining read file callback functionality. 2011-07-18 12:41:22 +00:00
Robert Osfield
09b5e95d65 Changed the HAVE_CONFIG_H guard so that it uses #ifndef _MSC_VER rather than _WIN32 to avoid problems with Mingw and Cygwin builds of DCMTK. 2011-07-18 09:40:58 +00:00
Robert Osfield
b59ab789a3 From Alberto Luacas, typo fixes 2011-07-17 16:24:47 +00:00
Robert Osfield
9c876964a5 From Wang Rui, improved the handling of the _preReadString within the readWrappedString method by factoring the
reading of the next character into a dedicated getCharacter(..) method.
2011-07-17 10:30:40 +00:00
Robert Osfield
f0bdbea926 From Wang Rui, "I've found that the latest ffmpeg made some functions and macros
deprecated, which led to compilation errors in the OSG plugin. I tried
fixing them and tested with the version ffmpeg-git-5d4fd1d (ffmpeg
version > 0.8, libavcodec = 53.7.0) under Windows.
"
2011-07-15 10:24:23 +00:00
Cedric Pinson
147455866f Fix crash in osgAnimation when keyframe container are empty 2011-07-15 10:22:44 +00:00
Robert Osfield
0da1daca15 From Sukender, Fix for compile errors "public: static char const * const osg::ValueObjectClassNameTrait< xxx >::s_className" already defined in xxx.obj" 2011-07-15 09:47:34 +00:00
Robert Osfield
fb29f83255 From Wang Rui,"The files attached should be separately put into the directories
src/osgPlugins/osg and src/osgWrappers/serializers/osgSim. They fix a
serious infinite loop problem that may be caused by the stream buffer
mechanism under Windows and some osgSim wrapper bugs pointed by
Andreas. I've asked the community to help test them and hope now we
can solve these recent .osgt file reading issues."
2011-07-15 09:14:16 +00:00
Robert Osfield
5bfa112183 From Ryan Pavlik, "Fix inventor state copy constructor.
Clang warning:
    In file included from src/osgPlugins/Inventor/ConvertToInventor.cpp:80:
    src/osgPlugins/Inventor/ConvertToInventor.h:117:71: warning: field is uninitialized when used here [-Wuninitialized]
            osgTexGenS(s.osgTexGenS), osgTexGenT(s.osgTexGenT), osgTexGen(osgTexGen),
                                                                          ^"
2011-07-15 08:43:47 +00:00
Robert Osfield
a53dd7d744 From Philip Lamp, submitted by Stephan Huber, "Modify the ReaderWriteImageIO_IOS to correctly handle relative paths
when reading from a file. This means that no longer do all image files
have to live at the root of the Resources folder inside the app bundle,
but can now be organized inside folders. Also improved error handling
and fixed a potential leak of a CGColorSpaceRef each once per image load."
2011-07-15 08:32:04 +00:00
Robert Osfield
b6fa087fe2 Converted tabs to four spaces 2011-07-15 08:16:58 +00:00
Robert Osfield
9133a4c36a Merged the OSG-3.0 branch versions of into svn/trunk. 2011-06-28 07:54:00 +00:00
Robert Osfield
ae2b8c4130 Added #if lib curl version check around #include <curl/types.h> as this header was deprecated and now
removed entirely from libcurl-7.21.7.
2011-06-28 07:23:52 +00:00
Robert Osfield
2de3f08fd3 From Wang Rui, "I've found a small problem which causes crashes in the 3ds plugin
while trying to load a model. The fix here will ensure that the
texture map is valid and everything could work well then."
2011-06-28 07:22:09 +00:00
Robert Osfield
e1bae2701a Tweaked the comments 2011-06-27 21:33:38 +00:00
Robert Osfield
0f9f891f72 From Jean-Sebestien Guay, workaround for bug under windows with the seek implementation when handling ascii files with unix file endings. 2011-06-27 21:32:20 +00:00
Robert Osfield
26375c38ef Updated NEWS and fixed typo in Contributors. 2011-06-27 15:43:33 +00:00
Robert Osfield
d3d536f0a5 Fixed typo 2011-06-27 10:20:37 +00:00
Robert Osfield
7b97a70c22 Improved the setContextID doxygen comment. 2011-06-27 10:19:44 +00:00
Robert Osfield
3979eb7755 From Andreas Eskland, "I found that a binary PNM file couldn't be read by the PNM plugin in the 3.0 branch. Attached is a small fix in ReaderWriterPNM.cpp, simply opening the file in binary mode." 2011-06-25 20:51:58 +00:00
Robert Osfield
eed9e9f7e1 Fixed memory growth issue when using Texture2D::SubloadCallbacks that don't set the TextureObjects sizes. 2011-06-25 11:00:33 +00:00
Robert Osfield
913e159114 Tightened up float usage. 2011-06-25 07:07:16 +00:00
Robert Osfield
8620c4af7e Tightened up the float/double usage 2011-06-24 19:17:25 +00:00
Robert Osfield
a9658dbd4d Removed redundent assert and associated variables to fix warnings. 2011-06-24 16:15:47 +00:00
Robert Osfield
d6a3ac647b Implemented missing writeShader 2011-06-24 15:04:16 +00:00
Robert Osfield
f68c2246fc From Martin Innus, fixed erroneous change of INTEGER to UNKNOWN, reverting back to INTEGER. 2011-06-24 13:35:20 +00:00
Robert Osfield
5fd1ece440 Implemented missing Archive::readShader/writeShader, and added searching of the archive list in Registr::read() so that files
that are stored in the archives can be found.
2011-06-24 12:40:18 +00:00
Robert Osfield
0a48e99a25 From Ulrich Hertlein, "While we're on osgSim/ShapeAttribute, here's a fix that fixes the 'UNKNOW' typo and some
doxygen"
2011-06-24 08:32:25 +00:00
Robert Osfield
41a6d949c2 From Wang Rui, "I've modified the code to handle -1.#IND and other kinds of infinite
values. Please see the attachments for details"
2011-06-24 08:13:58 +00:00
Robert Osfield
e79d51713f Added operator ==, != and < to fix VS build 2011-06-24 08:05:54 +00:00
Robert Osfield
8e2857905f Fixed warnings generated by clang,
src/osgAnimation/Skeleton.cpp:25:87: warning: addition of default argument on redeclaration makes this constructor a copy constructor [-Wdefault-arg-special-member]
Skeleton::UpdateSkeleton::UpdateSkeleton(const UpdateSkeleton& us, const osg::CopyOp& copyop= osg::CopyOp::SHALLOW_COPY) : osg::Object(us, copyop), osg::NodeCallback(us, copyop)

/src/OpenThreads/pthreads/PThread.cpp:1024:15: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
    if (cpunum<0) return -1;

src/osgDB/ExternalFileWriter.cpp:221:122: warning: expression result unused [-Wunused-value]
    _objects.insert(ObjectsSet::value_type(&obj, ObjectData(absoluteDestinationPath, relativeDestinationPath, written))).first;

src/osgManipulator/Dragger.cpp:175:18: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
        if (*itr = constraint) return;

src/osgManipulator/Dragger.cpp:187:18: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
        if (*itr = constraint)
2011-06-23 19:58:52 +00:00
Robert Osfield
fa40366ae4 Warning fixes for:
OpenSceneGraph/src/osgPlugins/Inventor/ConvertFromInventor.cpp: In member function ?virtual SbBool SoVRMLImageTextureOsg::readInstance(SoInput*, short unsigned int)?:
OpenSceneGraph/src/osgPlugins/Inventor/ConvertFromInventor.cpp:1264:16: warning: variable ?retval? set but not used [-Wunused-but-set-variable]
OpenSceneGraph/src/osgPlugins/ac/Geode.cpp: In member function ?void ac3d::Geode::ProcessGeometry(std::ostream&, unsigned int)?:
OpenSceneGraph/src/osgPlugins/ac/Geode.cpp:806:35: warning: variable ?fRep_s? set but not used [-Wunused-but-set-variable]
OpenSceneGraph/src/osgPlugins/ac/Geode.cpp:806:43: warning: variable ?fRep_t? set but not used [-Wunused-but-set-variable]
OpenSceneGraph/src/osgPlugins/ac/Geode.cpp:807:35: warning: variable ?fOffset_s? set but not used [-Wunused-but-set-variable]
OpenSceneGraph/src/osgPlugins/ac/Geode.cpp:807:46: warning: variable ?fOffset_t? set but not used [-Wunused-but-set-variable]
OpenSceneGraph/src/osgViewer/GraphicsWindowX11.cpp: In member function ?virtual void osgViewer::GraphicsWindowX11::checkEvents()?:
OpenSceneGraph/src/osgViewer/GraphicsWindowX11.cpp:1181:10: warning: variable ?destroyWindowRequested? set but not used [-Wunused-but-set-variable]
2011-06-23 18:24:07 +00:00
Robert Osfield
c617ea0163 Fixed virtual method mismtaches between subclasses and parent classes. 2011-06-23 16:36:36 +00:00
Robert Osfield
ee7668fe6c From Ulrich Hertlein, build fix for OSX. 2011-06-23 15:42:45 +00:00
Robert Osfield
00cf10be35 Added better handling of archives in ReaderWriterZip::readNode() so that if there is no master file definition it
loads all the available nodes in the zip archive and returns an osg::Group containing all the nodes if there is more
than one, or just returns the node if there is just one.  Also implemented this functionality for ReaderWriterZip::readImage().
2011-06-23 15:37:35 +00:00
Robert Osfield
97e4451b16 Fixed typo in name 2011-06-23 12:24:47 +00:00
Robert Osfield
fe0232ffba Updated ChangeLog and AUTHORS file 2011-06-23 11:27:23 +00:00
Robert Osfield
58291f986c Fixed name typo 2011-06-23 11:26:51 +00:00
Robert Osfield
7455f6265c Fixed warnings.
OpenSceneGraph/src/osgGA/NodeTrackerManipulator.cpp:32:1: warning: base class ?class osg::Object? should be explicitly initialized in the copy constructor
OpenSceneGraph/src/osgGA/TerrainManipulator.cpp:31:1: warning: base class ?class osg::Object? should be explicitly initialized in the copy constructor
OpenSceneGraph/include/osgSim/ShapeAttribute:99:9: warning: base class ?class std::vector<osgSim::ShapeAttribute>? should be explicitly initialized in the copy constructor
OpenSceneGraph/src/osgPlugins/zip/unzip.cpp:3102:14: warning: missing initializer for member ?unz_s::gi?
OpenSceneGraph/src/osgPlugins/zip/unzip.cpp:3102:14: warning: missing initializer for member ?unz_s::byte_before_the_zipfile?
OpenSceneGraph/src/osgPlugins/zip/unzip.cpp:3102:14: warning: missing initializer for member ?unz_s::num_file?
OpenSceneGraph/src/osgPlugins/zip/unzip.cpp:3102:14: warning: missing initializer for member ?unz_s::pos_in_central_dir?
OpenSceneGraph/src/osgPlugins/zip/unzip.cpp:3102:14: warning: missing initializer for member ?unz_s::current_file_ok?
OpenSceneGraph/src/osgPlugins/zip/unzip.cpp:3102:14: warning: missing initializer for member ?unz_s::central_pos?
OpenSceneGraph/src/osgPlugins/zip/unzip.cpp:3102:14: warning: missing initializer for member ?unz_s::size_central_dir?
OpenSceneGraph/src/osgPlugins/zip/unzip.cpp:3102:14: warning: missing initializer for member ?unz_s::offset_central_dir?
OpenSceneGraph/src/osgPlugins/zip/unzip.cpp:3102:14: warning: missing initializer for member ?unz_s::cur_file_info?
OpenSceneGraph/src/osgPlugins/zip/unzip.cpp:3102:14: warning: missing initializer for member ?unz_s::cur_file_info_internal?
OpenSceneGraph/src/osgPlugins/zip/unzip.cpp:3102:14: warning: missing initializer for member ?unz_s::pfile_in_zip_read?
OpenSceneGraph/src/osgViewer/CompositeViewer.cpp:30:1: warning: base class ?class osg::Object? should be explicitly initialized in the copy constructor
OpenSceneGraph/src/osgViewer/View.cpp:159:1: warning: base class ?class osg::Object? should be explicitly initialized in the copy constructor
OpenSceneGraph/src/osgViewer/Viewer.cpp:196:1: warning: base class ?class osg::Object? should be explicitly initialized in the copy constructor
OpenSceneGraph/src/osgViewer/Viewer.cpp:196:1: warning: base class ?class osgViewer::ViewerBase? should be explicitly initialized in the copy constructor
OpenSceneGraph/include/osgManipulator/Dragger:47:9: warning: base class ?class osg::Object? should be explicitly initialized in the copy constructor
2011-06-23 11:09:49 +00:00
Robert Osfield
8570c37ed5 From Ryan Pavlik, "I have successfully compiled OpenSceneGraph trunk using the Clang compiler (using a recent trunk build of llvm and clang, haven't tested an older release). The attached files contain the change shown in the diff below, which was required to finish the build with Clang. It fixes an issue with two-phase name lookup - there's more information here http://blog.llvm.org/2009/12/dreaded-two-phase-name-lookup.html
"
2011-06-23 09:26:27 +00:00
Robert Osfield
5ee864ff25 From Dimi Christopoulos, "I attach a fixed version of mipmap.cpp which produced a lot of warning on my gcc
compiler."
2011-06-23 09:22:23 +00:00
Robert Osfield
fa26facba9 Converted tabs to four spaces 2011-06-23 07:13:13 +00:00
Robert Osfield
c34fe4255b From Magnus Kessler, "I have recently installed the latest version of collada-dom on Linux, and
found that the include path has changed. By default, collada-dom now installs
its header files under /usr/local/include/collada-dom or/usr/include/collada-
dom. The attached FindCollada.cmake has been updated to look for these
locations in addition to the previous candidate locations."
2011-06-22 16:18:34 +00:00
Robert Osfield
30becd5ed3 Resolved warnings reported by g++ 4.6's -Wunused-but-set-variable.
Warnings were:

/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osg/ShapeDrawable.cpp: In member function ‘void PrimitiveShapeVisitor::createHalfSphere(unsigned int, unsigned int, float, int, float, const Matrix&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osg/ShapeDrawable.cpp:1409:11: warning: variable ‘nzBase’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osg/ShapeDrawable.cpp:1410:11: warning: variable ‘nRatioBase’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgUtil/DelaunayTriangulator.cpp: In function ‘osgUtil::Triangle_list osgUtil::fillHole(osg::Vec3Array*, std::vector<unsigned int, std::allocator<unsigned int> >)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgUtil/DelaunayTriangulator.cpp:569:27: warning: variable ‘ptest’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgUtil/DelaunayTriangulator.cpp: In member function ‘bool osgUtil::DelaunayTriangulator::triangulate()’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgUtil/DelaunayTriangulator.cpp:979:45: warning: variable ‘curp’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgUtil/RenderStage.cpp: In member function ‘void osgUtil::RenderStage::runCameraSetUp(osg::RenderInfo&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgUtil/RenderStage.cpp:631:18: warning: variable ‘stencilAttached’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgText/FadeText.cpp: In member function ‘void FadeTextPolytopeData::buildPolytope()’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgText/FadeText.cpp:74:20: warning: variable ‘edge23’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgText/FadeText.cpp:75:20: warning: variable ‘edge30’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgText/Text.cpp: In member function ‘void osgText::Text::computeBackdropPositions(unsigned int) const’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgText/Text.cpp:747:10: warning: variable ‘is_valid_size’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgGA/NodeTrackerManipulator.cpp: In member function ‘virtual bool osgGA::NodeTrackerManipulator::performMovementLeftMouseButton(double, double, double)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgGA/NodeTrackerManipulator.cpp:257:21: warning: variable ‘lookVector’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgGA/NodeTrackerManipulator.cpp:259:21: warning: variable ‘upVector’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgGA/TerrainManipulator.cpp: In member function ‘virtual bool osgGA::TerrainManipulator::performMovementMiddleMouseButton(double, double, double)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgGA/TerrainManipulator.cpp:217:11: warning: variable ‘lookVector’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgGA/TerrainManipulator.cpp:219:11: warning: variable ‘upVector’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgVolume/FixedFunctionTechnique.cpp: In member function ‘virtual void osgVolume::FixedFunctionTechnique::init()’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgVolume/FixedFunctionTechnique.cpp:124:30: warning: variable ‘tf’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgParticle/FluidProgram.cpp: In member function ‘virtual void osgParticle::FluidProgram::execute(double)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgParticle/FluidProgram.cpp:38:23: warning: variable ‘velBefore’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgShadow/ParallelSplitShadowMap.cpp: In member function ‘virtual void osgShadow::ParallelSplitShadowMap::cull(osgUtil::CullVisitor&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgShadow/ParallelSplitShadowMap.cpp:593:22: warning: variable ‘bb’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgTerrain/GeometryTechnique.cpp: In member function ‘virtual void osgTerrain::GeometryTechnique::generateGeometry(osgTerrain::GeometryTechnique::BufferData&, osgTerrain::Locator*, const osg::Vec3d&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgTerrain/GeometryTechnique.cpp:777:12: warning: variable ‘i_sampleFactor’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgTerrain/GeometryTechnique.cpp:778:12: warning: variable ‘j_sampleFactor’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/dds/ReaderWriterDDS.cpp: In function ‘osg::Image* ReadDDSFile(std::istream&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/dds/ReaderWriterDDS.cpp:314:10: warning: variable ‘is3dImage’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/dds/ReaderWriterDDS.cpp: In function ‘bool WriteDDSFile(const osg::Image*, std::ostream&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/dds/ReaderWriterDDS.cpp:721:10: warning: variable ‘is3dImage’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/hdr/hdrloader.cpp: In static member function ‘static bool HDRLoader::load(const char*, bool, HDRLoaderResult&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/hdr/hdrloader.cpp:101:10: warning: variable ‘cmd’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/vtf/ReaderWriterVTF.cpp: In function ‘osg::Image* ReadVTFFile(std::istream&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/vtf/ReaderWriterVTF.cpp:360:23: warning: variable ‘base’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/jp2/ReaderWriterJP2.cpp: In function ‘int putdata(jas_stream_t*, jas_image_t*, int)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/jp2/ReaderWriterJP2.cpp:41:13: warning: variable ‘linelen’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/Inventor/ConvertToInventor.cpp: In member function ‘void ConvertToInventor::processGeometry(const osg::Geometry*, ConvertToInventor::InventorState*)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/Inventor/ConvertToInventor.cpp:1639:10: warning: variable ‘ok’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/Inventor/ConvertFromInventor.cpp: In member function ‘virtual SbBool SoVRMLImageTextureOsg::readInstance(SoInput*, short unsigned int)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/Inventor/ConvertFromInventor.cpp:1264:16: warning: variable ‘retval’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/OpenFlight/GeometryRecords.cpp: In member function ‘virtual void flt::Face::readRecord(flt::RecordInputStream&, flt::Document&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/OpenFlight/GeometryRecords.cpp:369:19: warning: variable ‘secondaryPackedColor’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/OpenFlight/GeometryRecords.cpp: In member function ‘virtual void flt::Mesh::readRecord(flt::RecordInputStream&, flt::Document&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/OpenFlight/GeometryRecords.cpp:942:19: warning: variable ‘secondaryPackedColor’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/OpenFlight/ReaderWriterFLT.cpp: In member function ‘virtual osgDB::ReaderWriter::ReadResult FLTReaderWriter::readNode(std::istream&, const Options*) const’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/OpenFlight/ReaderWriterFLT.cpp:427:40: warning: variable ‘pos’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/ive/ShapeAttributeList.cpp: In member function ‘void ive::ShapeAttributeList::write(ive::DataOutputStream*)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/ive/ShapeAttributeList.cpp:31:48: warning: variable ‘it’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/ac/Geode.cpp: In member function ‘void ac3d::Geode::ProcessGeometry(std::ostream&, unsigned int)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/ac/Geode.cpp:806:35: warning: variable ‘fRep_s’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/ac/Geode.cpp:806:43: warning: variable ‘fRep_t’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/ac/Geode.cpp:807:35: warning: variable ‘fOffset_s’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/ac/Geode.cpp:807:46: warning: variable ‘fOffset_t’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/ac/Geode.cpp:932:38: warning: variable ‘primLength’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/txp/trpage_geom.cpp: In member function ‘virtual bool trpgGeometry::Write(trpgWriteBuffer&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/txp/trpage_geom.cpp:615:19: warning: variable ‘u’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/txp/trpage_material.cpp: In member function ‘int trpgMatTable::AddMaterial(const trpgMaterial&, bool)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/txp/trpage_material.cpp:103:10: warning: variable ‘spaceInTable’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/txp/trpage_rarchive.cpp: In member function ‘virtual bool trpgr_Archive::ReadHeader(bool)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/txp/trpage_rarchive.cpp:261:14: warning: variable ‘headerHasTexTable’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/zip/unzip.cpp: In member function ‘ZRESULT TUnzip::Get(int, ZIPENTRY*)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/zip/unzip.cpp:4055:8: warning: variable ‘hidden’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/zip/unzip.cpp:4055:22: warning: variable ‘system’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/zip/unzip.cpp:4055:36: warning: variable ‘archive’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/zip/ZipArchive.cpp: In member function ‘virtual bool ZipArchive::getFileNames(osgDB::Archive::FileNameList&) const’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/zip/ZipArchive.cpp:91:37: warning: variable ‘iterEnd’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/pvr/ReaderWriterPVR.cpp: In member function ‘osgDB::ReaderWriter::ReadResult ReaderWriterPVR::readPVRStream(std::istream&) const’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/pvr/ReaderWriterPVR.cpp:155:14: warning: variable ‘hasAlpha’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgViewer/View.cpp: In function ‘osg::Geometry* create3DSphericalDisplayDistortionMesh(const Vec3&, const Vec3&, const Vec3&, double, double, osg::Image*, const Matrix&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgViewer/View.cpp:737:15: warning: variable ‘cursor’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgViewer/View.cpp: In function ‘osg::Geometry* createParoramicSphericalDisplayDistortionMesh(const Vec3&, const Vec3&, const Vec3&, double, double, osg::Image*, const Matrix&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgViewer/View.cpp:1130:19: warning: variable ‘cursor’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgViewer/View.cpp:1118:15: warning: variable ‘dx’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgViewer/GraphicsWindowX11.cpp: In member function ‘virtual void osgViewer::GraphicsWindowX11::checkEvents()’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgViewer/GraphicsWindowX11.cpp:1181:10: warning: variable ‘destroyWindowRequested’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/cfg/ConfigParser.cpp: In member function ‘bool osgProducer::CameraConfig::parseFile(const string&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/cfg/ConfigParser.cpp:2247:13: warning: variable ‘result’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgQt/QGraphicsViewAdapter.cpp: In member function ‘bool osgQt::QGraphicsViewAdapter::handlePointerEvent(int, int, int)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgQt/QGraphicsViewAdapter.cpp:344:17: warning: variable ‘viewportGeometry’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgdistortion/osgdistortion.cpp: In function ‘osg::Node* createDistortionSubgraph(osg::Node*, const Vec4&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgdistortion/osgdistortion.cpp:125:19: warning: variable ‘cursor’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgdistortion/osgdistortion.cpp:126:19: warning: variable ‘texcoord’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgdistortion/osgdistortion.cpp: In function ‘osg::Geometry* createDomeDistortionMesh(const Vec3&, const Vec3&, const Vec3&, osg::ArgumentParser&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgdistortion/osgdistortion.cpp:358:15: warning: variable ‘cursor’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgposter/osgposter.cpp: In function ‘int main(int, char**)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgposter/osgposter.cpp:253:31: warning: variable ‘outputTiles’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgthreadedterrain/osgthreadedterrain.cpp: In function ‘int main(int, char**)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgthreadedterrain/osgthreadedterrain.cpp:669:10: warning: variable ‘readParameter’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgtext3D/TextNode.cpp: In member function ‘virtual void osgText::Layout::layout(osgText::TextNode&) const’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgtext3D/TextNode.cpp:80:11: warning: variable ‘characterHeightScale’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgvolume/osgvolume.cpp: In function ‘int main(int, char**)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgvolume/osgvolume.cpp:678:38: warning: variable ‘internalFormatMode’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgwidgetcanvas/osgwidgetcanvas.cpp: In function ‘bool windowMouseOver(osgWidget::Event&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgwidgetcanvas/osgwidgetcanvas.cpp:27:24: warning: variable ‘xy’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgwidgetcanvas/osgwidgetcanvas.cpp: In function ‘bool widgetMouseOver(osgWidget::Event&)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/examples/osgwidgetcanvas/osgwidgetcanvas.cpp:35:24: warning: variable ‘xy’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/p3d/ReaderWriterP3D.cpp: In member function ‘osg::Node* ReaderWriterP3DXML::parseXmlGraph(osgDB::XmlNode*, bool, osgDB::Options*) const’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/src/osgPlugins/p3d/ReaderWriterP3D.cpp:2121:10: warning: variable ‘readSlide’ set but not used [-Wunused-but-set-variable]
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/applications/present3D/present3D.cpp: In function ‘int main(int, char**)’:
/home/stephan/Dev/LibSources/OpenSceneGraph-3.0.0-rc2/applications/present3D/present3D.cpp:639:10: warning: variable ‘sizesSpecified’ set but not used [-Wunused-but-set-variable]
2011-06-22 12:30:01 +00:00
Robert Osfield
6783dcff17 Fixed regression in --run-on-demand feature 2011-06-22 09:12:12 +00:00
Robert Osfield
99b9eff9f4 Removed assert() that always evaluated to true. 2011-06-21 17:26:40 +00:00
Robert Osfield
aab458da93 From Torben Dannhauer, "originally I posted the addendum of 'freetype244MT', but that was wrong.
I updated it to the correct addendum of 'freetype244' yesterday, but supposedly that was not forwarded to you by the forum-to-mail-gateway.

Find attached the corrected CMake module. "
2011-06-21 13:01:23 +00:00
Robert Osfield
1b7b0b8cd2 Updated ChangeLog 2011-06-21 10:15:03 +00:00
Robert Osfield
111a4a9274 Added returns to end of files 2011-06-21 09:54:57 +00:00
Robert Osfield
e3c89d7f60 Added return to end of file 2011-06-21 09:54:23 +00:00
Robert Osfield
f38a855a73 Conveted tabs to four spaces and added a return to end of file 2011-06-21 09:53:34 +00:00
Michael PLATINGS
dc123461c7 Fixed redundant "enumeration not handled in switch" warnings.
Fixed a warning about a comparison between different enums - EUnifiedMappingType was being compared with EMappingType. In general the FBX SDK is moving away from Get & Set functions to giving direct access to properties, so I have changed GetMappingType() to CurrentMappingType.Get()
2011-06-21 09:29:32 +00:00
Robert Osfield
90a88488d3 Disabled VisualStudio warning warning C4611: interaction between '_setjmp' and C++ object destruction is non-portable 2011-06-21 09:00:01 +00:00
Robert Osfield
7f9e1c5a6f Fixed a range of issues reported by cppcheck:
[examples/osgphotoalbum/PhotoArchive.cpp:56]: (error) Memory leak: fileIndentifier
[examples/osgphotoalbum/PhotoArchive.cpp:257]: (error) Deallocating a deallocated pointer: newData
[examples/osgphotoalbum/PhotoArchive.cpp:318]: (error) Deallocating a deallocated pointer: newData
[src/osg/ImageUtils.cpp:116]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/ImageUtils.cpp:307]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/ImageUtils.cpp:312]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/ImageUtils.cpp:367]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/ImageUtils.cpp:399]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/ImageUtils.cpp:400]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/ImageUtils.cpp:482]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/ImageUtils.cpp:483]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/ImageUtils.cpp:484]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/ImageUtils.cpp:519]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/ImageUtils.cpp:536]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/OcclusionQueryNode.cpp:71]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/OcclusionQueryNode.cpp:74]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/OcclusionQueryNode.cpp:77]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/OcclusionQueryNode.cpp:82]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/OcclusionQueryNode.cpp:102]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/OcclusionQueryNode.cpp:107]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/OcclusionQueryNode.cpp:599]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/OcclusionQueryNode.cpp:600]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/OcclusionQueryNode.cpp:601]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/OcclusionQueryNode.cpp:602]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/OcclusionQueryNode.cpp:603]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/OcclusionQueryNode.cpp:604]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/OcclusionQueryNode.cpp:605]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/OcclusionQueryNode.cpp:606]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osgDB/ExternalFileWriter.cpp:134]: (portability) Extra qualification 'osgDB::' unnecessary and considered an error by many compilers.
[src/osgDB/ExternalFileWriter.cpp:135]: (portability) Extra qualification 'osgDB::' unnecessary and considered an error by many compilers.
[src/osgDB/ExternalFileWriter.cpp:136]: (portability) Extra qualification 'osgDB::' unnecessary and considered an error by many compilers.
[src/osgDB/ExternalFileWriter.cpp:137]: (portability) Extra qualification 'osgDB::' unnecessary and considered an error by many compilers.
[src/osgDB/ExternalFileWriter.cpp:139]: (portability) Extra qualification 'osgDB::' unnecessary and considered an error by many compilers.
[src/osgDB/ExternalFileWriter.cpp:177]: (portability) Extra qualification 'osgDB::' unnecessary and considered an error by many compilers.
[src/osgDB/ExternalFileWriter.cpp:178]: (portability) Extra qualification 'osgDB::' unnecessary and considered an error by many compilers.
[src/osgDB/ExternalFileWriter.cpp:195]: (portability) Extra qualification 'osgDB::' unnecessary and considered an error by many compilers.
[src/osgDB/ExternalFileWriter.cpp:198]: (portability) Extra qualification 'osgDB::' unnecessary and considered an error by many compilers.
[src/osgDB/ExternalFileWriter.cpp:203]: (portability) Extra qualification 'osgDB::' unnecessary and considered an error by many compilers.
[src/osgDB/ExternalFileWriter.cpp:205]: (portability) Extra qualification 'osgDB::' unnecessary and considered an error by many compilers.
[src/osgDB/ExternalFileWriter.cpp:253]: (portability) Extra qualification 'osgDB::' unnecessary and considered an error by many compilers.
[src/osgDB/InputStream.cpp:553]: (error) Memory leak: data
[src/osgDB/OutputStream.cpp:393]: (error) Memory leak: data
[src/osgPlugins/Inventor/ConvertToInventor.cpp:656]: (error) Mismatching allocation and deallocation: tmpArray
[src/osgPlugins/Inventor/ReaderWriterIV.cpp:237]: (error) Common realloc mistake: 'buf' nulled but not freed upon failure
[src/osgPlugins/OpenFlight/expGeometryRecords.cpp:167]: (portability) Extra qualification 'flt::' unnecessary and considered an error by many compilers.
[src/osgPlugins/OpenFlight/expGeometryRecords.cpp:373]: (portability) Extra qualification 'flt::' unnecessary and considered an error by many compilers.
[src/osgPlugins/cfg/CameraConfig.cpp:635]: (error) Unusual pointer arithmetic
[src/osgPlugins/freetype/FreeTypeLibrary.cpp:122]: (error) Memory leak: buffer
[src/osgPlugins/geo/ReaderWriterGEO.cpp:210]: (error) Possible null pointer dereference: gfd - otherwise it is redundant to check if gfd is null at line 211
[src/osgPlugins/geo/ReaderWriterGEO.cpp:227]: (error) Possible null pointer dereference: gfd - otherwise it is redundant to check if gfd is null at line 228
[src/osgPlugins/geo/ReaderWriterGEO.cpp:903]: (error) Possible null pointer dereference: gfd - otherwise it is redundant to check if gfd is null at line 904
[src/osgPlugins/geo/osgGeoNodes.h:180]: (error) Memory leak: geoHeaderGeo::intVars
[src/osgPlugins/geo/osgGeoNodes.h:181]: (error) Memory leak: geoHeaderGeo::useVars
[src/osgPlugins/geo/osgGeoNodes.h:182]: (error) Memory leak: geoHeaderGeo::extVars
[src/osgPlugins/md2/ReaderWriterMD2.cpp:180]: (error) Memory leak: mapbase
[src/osgPlugins/md2/ReaderWriterMD2.cpp:166]: (error) Resource leak: file_fd
[src/osgPlugins/pic/ReaderWriterPIC.cpp:152]: (error) Mismatching allocation and deallocation: tmpbuf
[src/osgPlugins/pic/ReaderWriterPIC.cpp:153]: (error) Mismatching allocation and deallocation: buffer
[src/osgPlugins/ply/plyfile.cpp:843]: (error) Memory leak: plyfile
[src/osgPlugins/pvr/ReaderWriterPVR.cpp:179]: (error) Memory leak: imageData
[src/osgPlugins/shp/ESRIShapeParser.cpp:29]: (error) Resource leak: fd
[src/osgPlugins/shp/XBaseParser.cpp:96]: (error) Resource leak: fd
[src/osgPlugins/zip/unzip.cpp:3158]: (error) Possible null pointer dereference: s - otherwise it is redundant to check if s is null at line 3159
[src/osgPlugins/zip/unzip.cpp:4155]: (error) Dangerous usage of 'rd' (strncpy doesn't always 0-terminate it)
[src/osgShadow/MinimalCullBoundsShadowMap.cpp:334]: (error) Possible null pointer dereference: rl - otherwise it is redundant to check if rl is null at line 331
[src/osgViewer/ScreenCaptureHandler.cpp:617]: (error) Possible null pointer dereference: camera - otherwise it is redundant to check if camera is null at line 611
[src/osgViewer/ScreenCaptureHandler.cpp:632]: (error) Possible null pointer dereference: camera - otherwise it is redundant to check if camera is null at line 626
[src/osgVolume/Locator.cpp:209]: (error) Dangerous iterator usage after erase()-method.
[src/osgVolume/RayTracedTechnique.cpp:274]: (error) Possible null pointer dereference: imageLayer - otherwise it is redundant to check if imageLayer is null at line 259
[src/osgVolume/RayTracedTechnique.cpp:275]: (error) Possible null pointer dereference: imageLayer - otherwise it is redundant to check if imageLayer is null at line 259
[src/osgWrappers/serializers/osg/ShaderBinary.cpp:28]: (error) Mismatching allocation and deallocation: data
2011-06-20 19:15:53 +00:00
Robert Osfield
20f334b6f8 Removed unneccesary namespace qualifiers, and issue picked out by cppcheck. 2011-06-20 14:09:49 +00:00
Robert Osfield
9781fe55ea From Farshid Lashkari, BGR write support for BMP, PNG and TGA 2011-06-20 12:36:53 +00:00
Robert Osfield
0392efafea Added catch for window manager doesn't set the window size to full screen. 2011-06-20 11:25:52 +00:00
Robert Osfield
0ff97d1350 Added check against Traits::overrideRedirct to prevent the fullscreen workaround being run when overrideRedirect
is on as overrideRedirect switches off the window managers ability to manage the fullscreen so the problem doesn't
need working around.
2011-06-20 09:28:39 +00:00
Robert Osfield
47146017ae Introduced a workaround for fullscreen toggle issues under modern X11 window managers. 2011-06-20 09:22:57 +00:00
Robert Osfield
8c37336fdc Added sleep before window resizing to make it less likely that the previous frames rendering traversal is still
running when the window(s) is resized, something that creates what looks like a glitch in rendering.
2011-06-20 09:20:39 +00:00
Robert Osfield
058eef0555 From Torben Dannhauer, "Just in time for OSG 3.0 I will present an updated 3rdParty package for VS2008 , which includes some updated libraries (libcurl, freetype, jpeg). It also provides now all debug databases (*.pdb), so all the annoying compile warnings about missing .pdb files are gone.
I extended the CMAKE module to find the new library."
2011-06-19 19:16:49 +00:00
Robert Osfield
389c2e6407 Updated version to 3.1.0 in prep for the first developer release for 3.x series 2011-06-17 16:55:49 +00:00
2014 changed files with 112299 additions and 104924 deletions

View File

@@ -1,6 +1,6 @@
OpenSceneGraph Library 3.0.0
OpenSceneGraph Library 3.2.2
463 Contributors:
529 Contributors:
Firstname Surname
-----------------
@@ -8,122 +8,137 @@ Robert Osfield
Don Burns
Stephan Huber
Paul Martz
Marco Jez
Mathias Fr<46>hlich
Mike Weiblen
Jean-Sebastien Guay
Farshid Lashkari
Eric Wing
Ulrich Hertlein
Cedric Pinson
Marco Jez
Wang Rui
Jean-S<>bastien Guay
Ulrich Hertlein
Mike Weiblen
Sukender
Eric Wing
Cedric Pinson
Brede Johansen
Sukender
Michael Platings
Bob Kuehne
Michael Platings
Geoff Michel
Eric Sokolowsky
Wojciech Lewandowski
Eric Sokolowsky
David Callu
Laurens Voerman
Colin McDonald
Trajce Nikolov
Tim Moore
Martin Lavery
Colin McDonald
Tree
Tree
Luigi Calori
Mike Wittman
Jason Beverage
Chris Hanson
Roland Smeenk
Roger James
Jeremy Moles
Chris Hanson
Mattias Helsing
Jason Beverage
Jeremy Moles
Jan Peciva
Andy Skinner
Paul Melis
Alberto Luaces
J.P. Delport
Magnus Kessler
David Fries
Andy Skinner
Tom Jolley
Paul Melis
Luc Frauciel
Pavel Moloshtan
Brad Christiansen
Olaf Flebbe
Mathieu Marache
Jason Daly
Aurelien Albert
Art Tevs
Philip Lowman
Per Fahlberg
Norman Vine
Art Tevs
Alberto Luaces
Serge Lages
Laurens Voerman
Alberto Farre
Lionel Lagarde
Terry Welsh
Serge Lages
Romano Jos<6F> Magacho da Silva
Pjotr Svetachov
Chris Denham
Alberto Farre
Torben Dannhauer
Sherman Wilcox
Robert Milharcic
Olaf Flebbe
Mathieu Marache
Magnus Kessler
Robert Michael
Mourad Boufarguine
Andr<EFBFBD> Garneau
Adrian Egli
Ruben Lopez
Randall Hopper
Mourad Boufarguine
Brad Christiansen
Jan Ciger
Glenn Waldron
Gideon May
Don Tidrow
Chris Denham
Stephane Lamoliatte
Romano Jos<6F> Magacho da Silva
Michael Gronager
Martin Naylor
Joakim Simonsson
David Spilling
Daniel Sj<53>lie
Bryan Thrall
Glenn Waldron
Fabien Lavignotte
Andreas Ekstrand
Riccardo Corsi
Mike Connell
Melchior Franz
Lionel Lagarde
Jan Ciger
Johannes Baeuerle
Thomas Hogarth
Sebastian Messerschmidt
Rafa Gaitan
Neil Hughes
Mike Connell
Martin Beckett
Joran Jessurun
Gino van den Bergen
Frederic Marmond
David Guthrie
Csaba Halasz
Cory Riddell
Chuck Seberino
Boris Bralo
Yefei He
Torben Dannhauer
Sondra Iverson
Simon Julier
Rune Schmidt Jensen
Rainer Oder
Martin Naylor
Nico Kruithof
Martin Aumueller
Mario Valle
Luc Frauciel
Lukasz Izdebski
Jorge Izquierdo Ciges
Gordon Tomlinson
Cory Riddell
Frederic Bouvier
Carlo Camporesi
Ben Discoe
Andreas Ekstrand
Thibault Genessay
Sasa Bistrovic
Ravi Mathur
Ralf Habacker
Neil Groves
Mikhail Izmestev
Markus Trenkwalder
Loic Dachary
Joseph Steel
Jorge Izquierdo
Jordi Torres
John Shue
Chuck Seberino
Brad Colbert
Bj<EFBFBD>rn Blissing
Alexander Sinditskiy
Vivek Rajan
Uwe Woessner
Tony Horrobin
Thom DeCarlo
Tatsuhiro Nishioka
Tanguy Fautr<74>
Sean Spicer
Ryan Kawicki
Richard Schmidt
Peter Hrenka
Paul de Repentigny
@@ -132,31 +147,32 @@ Neil Salter
Mihai Radu
Michael Hartman
Martins Innus
Marc Helbling
Maciej Krol
Johannes Baeuerle
Lilin Xiong
Leandro Motta Barros
Johan Nouvel
Hartwig Wiesmann
Frederic Bouvier
Donn Mielcarek
Corbin Holtz
Blasius Czink
Alexander Irion
Toshiyuki Takahei
Tony Horrobin
Sebastien Grignard
Ryan Kawicki
Romano Magacho
Riccardo Corsi
Nico Kruithof
Mikhail Izmestev
Rudolf Wiedemann
Robert Milharcic
Maria Ten
Liang Aibin
Leandro Motta Barros
Kristofer Tingdahl
Konstantin Matveyev
Katharina Plugge
John Vidar Larring
John Kelso
John Ivar
Gustav Haapalahti
Erik den Dekker
Emmanuel Roche
Domenico Mangieri
Daniel Larimer
Colin Dunlop
Bruce Clay
@@ -166,37 +182,42 @@ Alok Priyadarshi
Alberto Barbati
Alan Dickinson
Vladimir Shabanov
Vladimir Chebaev
Tugkan Calapoglu
Tim Daoust
Thomas Hogarth
Sohey Yamamoto
Sergey Leontyev
Santosh Gaikwad
Rudolf Wiedemann
Ryan Pavlik
Rene Molenaar
Piotr Domagalski
Phil Atkin
Nathan Monteleone
Miguel Escriva
Mattias Linde
Mark Sciabica
Lilin Xiong
Marcin Prus
Lee Butler
Lars Nilsson
Konstantin Sinitsyn
Ken Sewell
Julian Ortiz
John Kaniarz
Jim Vaughan
Jeremy Bell
Jaromir Vitek
James French
Guillaume Millet
Gary Quinn
Garrett Potts
Gabor Dorka
Fabio Mierlo
Erik den Dekker
Doug McCorkle
Donald Cipperly
Don Leich
Domenico Mangieri
Dietmar Funck
Colin Cochran
Christian Buchner
Charles Cole
Blake Williams
Antoine Hue
@@ -204,27 +225,32 @@ Andrew Bettison
Anders Backman
Ali Botorabi
Alexander Wiebel
Alexander Irion
Alessandro Terenzi
Zach Deedler
Yuzhong Shen
Wee See
Warren Macchi
Vincent Bourdier
Terrex
Terrex
Tassilo Glander
Sylvain Marie
Steve Lunsford
Stephane Simon
Stephan Eilemann
Stanislav Blinov
Sebastian Messerschmidt
Sergey Polischuk
Raymond de Vries
Ralf Kern
Piotr Gwiazdowski
Pierre Haritchabalet
Perry Miller
Pawel Ksiezopolski
Paul Palumbo
Paul Obermeier
Patrick Neary
Nguyen Van Truong
Nathan Cournia
Morten Haukness
Morn<EFBFBD> Pistorius
Michael Henheffer
Michael Guerrero
@@ -232,22 +258,28 @@ Maya Leonard
Max Bandazian
Mathias Fiedler
Mathew May
Martin von Gargern
Martin Spott
Martin Lambers
Martijn Kragtwijk
Marius Heise
Marcin Hajder
Lukasz Izdebski
Marcel Pursche
Lilith Bryant
Lars Nilsson
Kevin Moiule
Keith Steffen
Julien Valentin
Julen Garcia
Joseph Winston
John Aughey
Johannes Scholz
Joachim Pouderoux
Jean-Christophe Lombardo
Javier Taibo
Jannik Heller
Jan Klimke
James Moliere
Jaap Glas
Igor Kravtchenko
Himar Carmona
He Sicong
@@ -255,23 +287,30 @@ Guy Volckaert
Gustavo Wagner
Guillaume Taze
Guillaume Chouvenc
Giuseppe Donvito
Gill Peacegood
Gerrick Bivins
George Tarantilis
Ferdi Smit
Eric Buehler
Eduardo Poyart
Edgar Ellis
Dietmar Funck
Dimi Christopoulos
Diane Delall<6C>e
David Longest
David Ergo
Daniel Trstenjak
Craig Bosma
Claus Scheiblauer
Christophe Loustaunau
Christian Ruzicka
Bradley Baker Searles
Brad Anderegg
Bj<EFBFBD>rn Hein
Aric Aumann
Andrew Sampson
Andrew Lorino
Alexandre Amalric
Alessandro Terenzi
Zbigniew Sroczynski
Yuri Vilmanis
Xin Li
@@ -285,15 +324,20 @@ Vincent Vivanloc
Vincent Gadoury
Vasily Radostev
Valery Bickov
Valeriy Dubov
Vaclav Bilek
Tyge L<>vset
Troy Yee
Tomas Hogarth
Tomas Hnilica
Todd Furlong
Tobias Ottenweller
Tino Schwarze
Tim George
Thorsten Brehm
Thomas Weidner
Tan Dunning
Tamer Fahmy
Stewart Andreason
Steven Thomas
Simon Hammett
@@ -302,20 +346,22 @@ Simon Buckley
Sid Byce
Shuxing Xiao
Shane Arnott
Sergey Kurdakov
Sebastien Kuntz
Ryan Pavlik
Ruth Lang
Ruben Smelik
Ross Anderson
Ronny Krueger
Ronald van Maarseveen
Romain Charbit
Rocco Martino
Robert Swain
Rob Smith
Rob Radtke
Rob Bloemkool
Rick Pingry
Rick Appleton
Remo Eichenberger
Reinhard Sainitzer
Rein Kadijk
Ragnar Hammarqvist
@@ -325,10 +371,11 @@ Pierre Bourdin
Philipp Svehla
Philipp Siemoleit
Philipp M<>chler
Philip Lamb
Petr Salinger
Peter Bear
Peter Amstutz
Paul Palumbo
Paul Idstein
Paul Fredrikson
Paul Fotheringham
Pau Garcia
@@ -337,17 +384,24 @@ Parag Chaudhur
Panagiotis Papadakos
Panagiotis Koutsourakis
Orhun Birsoy
Oren Fromberg
Oliver Neumann
Ole-Morten Duesund
Nicolas Brodu
Morten Haukness
Nick Black
Mojtaba Fathi
Mirko Viviani
Mikkel Gjøl
Mikkel Gj<EFBFBD>l
Mike Krus
Mike Garrity
Miha Rav<61>elj
Michael Schanne
Michael Polak
Michael Morrison
Michael Mc Donnell
Michael Logan
Michael Kapelko
Michael Bach Jensen
Max Rhiener
Max Behensky
Mauricio Hofmam
@@ -358,28 +412,30 @@ Matt Burke
Mathias Walker
Mathias Goldau
Mason Menninger
Martin von Gargern
Martin Scheffler
Martin Lambers
Martin Innus
Martin Beck
Marius Kintel
Mario Guimaraes
Marco Sciabica
Marco Lehmann
Marcin Prus
Maik Keller
Lukas Diduch
Louis Hamilton
Lewis Harmon
Leigh Stivers
Laurence Muller
Laura Cerritelli
Kyle Centers
Kristopher Bixler
Konstantin Matveyev
Kim Seokhwan
Kim Bale
Karsten Weiss
Karl Heijdenberg
Jutta Sauer
Julian Scheid
Juergen Rensen
Juan Manuel Alvarez
Juan Hernando
Josh Portway
John Tan
@@ -394,14 +450,15 @@ Jeroen den Dekker
Jay Zuckerman
Jason Howlett
Jason Ballenger
Jan Klimke
James Turner
James Killian
James Athey
J.E. Hoffmann
Holger Helmich
Henrique Bucher
Hautio Jari
Hartmut Seichter
Gunter Huber
Guillaume Millet
Gregory Jaegy
Graeme Harkness
Gian Lorenzetto
@@ -409,10 +466,13 @@ George Papagiannakis
Galen Faidley
Frida Schlaug
Frederic Smith
Frederic Morin
Frank Warmerdam
Frank Midgley
Frank Lindeman
Frank Lichtenheld
Francois Tigeot
Filip Arlet
Ferdinand Cornelissen
Fajran Iman
Fabien Dachicourt
@@ -424,7 +484,7 @@ Duvan Cope
Duncan Cavens
Drew Whitehouse
Douglas A. Pouk
Dimi Christop
Dmitry Marakasov
Dean Iverson
David Jung
Danny Valente
@@ -432,12 +492,16 @@ Daniel Stien
Dan Minor
C<EFBFBD>sar L. B. Silveira
Cyril Brulebois
Cl<EFBFBD>ment B<>sch
Clay Fowler
Claus Steuer
Chuck Sembroski
Christopher Blaesius
Christopher Baker
Christophe Herreman
Christian Noon
Christian Kaser
Christian Ehrlicher
Christian Buchner
Chris McGlone
Carlos Garcea
Bryce Eldridge
@@ -445,7 +509,6 @@ Bruno Herbelin
Brian Keener
Brandon Hamm
Bora Utka
Bj<EFBFBD>rn Hein
Bill Prendergast
Bernardt Duvenhage
Benoit Laniel
@@ -453,7 +516,9 @@ Benjamin Wasty
Ben van Basten
Bart Gallet
Axel Volley
Arjun Ramamurthy
Anthousis Andreadis
Anish Thomas
Andy Preece
Andrew Reyonolds
Andreas Roth
@@ -461,9 +526,10 @@ Andreas Jochens
Andre Normann
Almalric Alexandre
Allen Bierbaum
Alexander Sinditskiy
Alberto Jaspe
Alan Purvis
Alan Ott
Alan Harris
Adrien Grandemange
Adrian Clark
Adam Richard

View File

@@ -20,23 +20,45 @@ if(COMMAND cmake_policy)
# statements.
cmake_policy(SET CMP0005 NEW)
# tell CMake to prefer CMake's own CMake modules when available
# only available from cmake-2.8.4
if(${CMAKE_MAJOR_VERSION} GREATER 2 OR
(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 8) OR
(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 8 AND ${CMAKE_PATCH_VERSION} GREATER 3))
cmake_policy(SET CMP0017 NEW)
endif()
# cmake-2.6.1 introduces policy cmp0008 decide how to treat full path libraries that do not appear to be valid library file names
# quote from cvslog "Such libraries worked by accident in the VS IDE and Xcode generators in CMake 2.4 and below."
if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4 AND ${CMAKE_PATCH_VERSION} GREATER 0)
if(${CMAKE_MAJOR_VERSION} GREATER 2 OR
(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 6) OR
(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 6 AND ${CMAKE_PATCH_VERSION} GREATER 0))
cmake_policy(SET CMP0008 OLD)
endif()
# disable autolinking to qtmain as we have our own main() functions (new in Qt 5.1)
if(${CMAKE_MAJOR_VERSION} GREATER 2 OR
(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 8) OR
(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 8 AND ${CMAKE_PATCH_VERSION} GREATER 10))
cmake_policy(SET CMP0020 OLD)
endif()
# nicer version check - but needs at least CMake 2.6.2? Worth upgrading the requirements?
#if("${CMAKE_VERSION}" VERSION_GREATER 2.8.10)
# or even easier (available in cmake-2.6)
#if(POLICY CMPxyzw)
endif()
PROJECT(OpenSceneGraph)
SET(OPENSCENEGRAPH_MAJOR_VERSION 3)
SET(OPENSCENEGRAPH_MINOR_VERSION 0)
SET(OPENSCENEGRAPH_PATCH_VERSION 0)
SET(OPENSCENEGRAPH_SOVERSION 78)
SET(OPENSCENEGRAPH_MINOR_VERSION 2)
SET(OPENSCENEGRAPH_PATCH_VERSION 2)
SET(OPENSCENEGRAPH_SOVERSION 100)
# set to 0 when not a release candidate, non zero means that any generated
# set to 0 when not a release candidate, non zero means that any generated
# svn tags will be treated as release candidates of given number
SET(OPENSCENEGRAPH_RELEASE_CANDIDATE 1)
SET(OPENSCENEGRAPH_RELEASE_CANDIDATE 0)
SET(OPENSCENEGRAPH_VERSION ${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION}.${OPENSCENEGRAPH_PATCH_VERSION})
@@ -63,6 +85,13 @@ SET(OpenThreads_SOURCE_DIR ${OpenSceneGraph_SOURCE_DIR})
# Maybe this can be used override existing behavior if needed?
SET(CMAKE_MODULE_PATH "${OpenSceneGraph_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}")
# Change the default build type to Release
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)
## Option to enable Android build using AndroidNDK
OPTION(OSG_BUILD_PLATFORM_ANDROID OFF)
IF(OSG_BUILD_PLATFORM_ANDROID)
@@ -71,17 +100,48 @@ IF(OSG_BUILD_PLATFORM_ANDROID)
INCLUDE(OsgAndroidMacroUtils)
SET(ANDROID TRUE)
SET(ANDROID_PLATFORM 5)
FIND_PACKAGE(AndroidNDK REQUIRED)
IF(NOT ANDROID_PLATFORM)
MESSAGE("Warning Android Platform version NOT defined, Default selected version: 5")
SET(ANDROID_PLATFORM 5)
ENDIF()
IF(NOT ANDROID_ABI)
MESSAGE("Warning Android ABI version NOT defined, Default selection: armeabi armeabi-v7a")
SET(ANDROID_ABI "armeabi armeabi-v7a")
ENDIF()
IF(NOT ANDROID_STL)
MESSAGE("Warning Android STL NOT defined, Default selection: gnustl_static")
SET(ANDROID_STL "gnustl_static")
ENDIF()
IF(ANDROID_DEBUG)
MESSAGE("Warning Android Build is in debug mode")
SET(ANDROID_RELEASE_OPTIM "debug")
ELSE()
MESSAGE("Warning Android Build is in release mode")
SET(ANDROID_RELEASE_OPTIM "release")
ENDIF()
IF(ANDROID_NEON)
MESSAGE("Warning Android NEON optimizations enabled, this will not be available on all armeabi-v7a devices ie. Tegra2")
SET(ANDROID_OPTIM_NEON true)
ELSE()
SET(ANDROID_OPTIM_NEON false)
ENDIF()
IF(ANDROID_ARM32)
MESSAGE("Warning ARM 32bit instruction set will be used")
SET(ANDROID_OPTIM_ARM32 true)
ELSE()
SET(ANDROID_OPTIM_ARM32 false)
ENDIF()
FIND_PACKAGE(AndroidNDK REQUIRED)
SET(OSG_ANDROID_TEMPLATES "${CMAKE_SOURCE_DIR}/PlatformSpecifics/Android")
SET(J "4" CACHE STRING "how many processes for make -j <J>")
ADD_CUSTOM_COMMAND(
OUTPUT Android-OpenSceneGraph
DEPENDS ${CMAKE_BINARY_DIR}/Android.mk
COMMAND "${ANDROID_NDK}/ndk-build"
COMMAND "${ANDROID_NDK}/ndk-build"
ARGS --directory=${CMAKE_BINARY_DIR} NDK_APPLICATION_MK=Application.mk -j${J} NDK_LOG=1
)
@@ -126,17 +186,17 @@ ENDIF()
OPTION(OSG_MAINTAINER "Enable OpenSceneGraph maintainer build methods, such as making svn branches, tags, updating ChangeLog." OFF)
IF (OSG_MAINTAINER)
SET(OPENSCENEGRAPH_SVN "trunk")
#SET(OPENSCENEGRAPH_SVN "branches")
#SET(OPENSCENEGRAPH_SVN "trunk")
SET(OPENSCENEGRAPH_SVN "branches")
SET(OPENSCENEGRAPH_BRANCH OpenSceneGraph-${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION})
#
# Provide target for tagging a release
#
SET(SVNCOMMAND svn)
SET(SVNTRUNKDIR http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk)
SET(SVNTAGDIR http://www.openscenegraph.org/svn/osg/OpenSceneGraph/tags)
SET(SVNBRANCHDIR http://www.openscenegraph.org/svn/osg/OpenSceneGraph/branches)
SET(SVNTRUNKDIR http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk)
SET(SVNTAGDIR http://svn.openscenegraph.org/osg/OpenSceneGraph/tags)
SET(SVNBRANCHDIR http://svn.openscenegraph.org/osg/OpenSceneGraph/branches)
IF (OPENSCENEGRAPH_SVN STREQUAL "trunk")
SET(SVNSOURCEDIR ${SVNTRUNKDIR})
@@ -177,11 +237,22 @@ IF (OSG_MAINTAINER)
COMMAND ${SVNCOMMAND} update
COMMAND ${GENERATELOGS} ${SVNSOURCEDIR}
)
ENDIF(OSG_MAINTAINER)
IF(NOT ANDROID)
IF(APPLE)
# Determine the canonical name of the selected Platform SDK
EXECUTE_PROCESS(COMMAND "/usr/bin/sw_vers" "-productVersion"
OUTPUT_VARIABLE OSG_OSX_SDK_NAME
OUTPUT_STRIP_TRAILING_WHITESPACE)
STRING(REPLACE "." ";" MACOS_VERSION_LIST ${OSG_OSX_SDK_NAME})
LIST(GET MACOS_VERSION_LIST 0 MACOS_VERSION_MAJOR)
LIST(GET MACOS_VERSION_LIST 1 MACOS_VERSION_MINOR)
LIST(GET MACOS_VERSION_LIST 2 MACOS_VERSION_PATCH)
SET(OSG_OSX_SDK_NAME "macosx${MACOS_VERSION_MAJOR}.${MACOS_VERSION_MINOR}")
# Trying to get CMake to generate an XCode IPhone project, current efforts are to get iphoneos sdk 3.1 working
# Added option which needs manually setting to select the IPhone SDK for building. We can only have one of the below
# set to true. Should realy have an OSG_BUILD_PLATFORM variable that we set to our desired platform
@@ -191,21 +262,24 @@ IF(APPLE)
IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
#you need to manually set the default sdk version here
SET (IPHONE_SDKVER "3.2")
SET (IPHONE_SDKVER "6.0" CACHE STRING "IOS SDK-Version")
SET (IPHONE_VERSION_MIN "4.2" CACHE STRING "IOS minimum os version, use 7.0 or greater to get 64bit support")
#the below is taken from ogre, it states the gcc stuff needs to happen before PROJECT() is called. I've no clue if we even need it
# Force gcc <= 4.2 on iPhone
include(CMakeForceCompiler)
CMAKE_FORCE_C_COMPILER(gcc-4.2 GNU)
CMAKE_FORCE_CXX_COMPILER(gcc-4.2 GNU)
SET(GCC_THUMB_SUPPORT NO)
IF(IPHONE_VERSION_MIN LESS "6.0")
include(CMakeForceCompiler)
CMAKE_FORCE_C_COMPILER(llvm-gcc-4.2 GNU)
CMAKE_FORCE_CXX_COMPILER(llvm-gcc-4.2 GNU)
SET(GCC_THUMB_SUPPORT NO)
ENDIF()
#set either the device sdk or the simulator sdk. Can't find away to separate these in the same project
IF(OSG_BUILD_PLATFORM_IPHONE)
SET (IPHONE_DEVROOT "/Developer/Platforms/iPhoneOS.platform/Developer")
SET (IPHONE_DEVROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer")
SET (IPHONE_SDKROOT "${IPHONE_DEVROOT}/SDKs/iPhoneOS${IPHONE_SDKVER}.sdk")
ELSE()
SET (IPHONE_DEVROOT "/Developer/Platforms/iPhoneSimulator.platform/Developer")
SET (IPHONE_DEVROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer")
SET (IPHONE_SDKROOT "${IPHONE_DEVROOT}/SDKs/iPhoneSimulator${IPHONE_SDKVER}.sdk")
ENDIF()
@@ -302,7 +376,13 @@ IF(WIN32 AND NOT ANDROID)
STRING(REGEX REPLACE "/STACK:[0-9]+" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
STRING(REGEX REPLACE "/STACK:[0-9]+" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}")
ENDIF(MSVC_USE_DEFAULT_STACK_SIZE)
get_filename_component( CMAKE_MAKE_PROGRAM_NAME ${CMAKE_MAKE_PROGRAM} NAME)
IF (CMAKE_MAKE_PROGRAM_NAME STREQUAL "VCExpress.exe")
OPTION(MSVC_BUILD_USE_SOLUTION_FOLDERS "Enable project grouping in VS - VCExpress detected, not supported in VCExpress )" OFF)
ELSE()
OPTION(MSVC_BUILD_USE_SOLUTION_FOLDERS "Enable project grouping in VS" ON)
ENDIF()
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ${MSVC_BUILD_USE_SOLUTION_FOLDERS})
ENDIF()
#needed for net plugin
@@ -385,6 +465,7 @@ MARK_AS_ADVANCED(OSG_DISABLE_MSVC_WARNINGS)
OPTION(OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION "Set to ON to use the ref_ptr<> T* operator() output conversion. " ON)
OPTION(OSG_GL1_AVAILABLE "Set to OFF to disable use of OpenGL 1.x functions library." ON)
OPTION(OSG_GL2_AVAILABLE "Set to OFF to disable use of OpenGL 2.x functions library." ON)
OPTION(OSG_GL3_AVAILABLE "Set to OFF to disable use of OpenGL 3.x functions library." OFF)
@@ -403,7 +484,7 @@ SET(OPENGL_egl_LIBRARY CACHE STRING "Set the OpenGL egl library.")
OPTION(OSG_GL_DISPLAYLISTS_AVAILABLE "Set to OFF to disable use of OpenGL display lists." ${OSG_GL1_AVAILABLE})
OPTION(OSG_GL_MATRICES_AVAILABLE "Set to OFF to disable use of OpenGL built-in matrices." ${OSG_GL1_AVAILABLE})
OPTION(OSG_GL_VERTEX_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertex/glColor etc." ${OSG_GL1_AVAILABLE})
OPTION(OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertex/glColor etc." ${OSG_GL1_AVAILABLE})
OPTION(OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertexPointer/glColorPointer etc." ${OSG_GL1_AVAILABLE})
OPTION(OSG_GL_FIXED_FUNCTION_AVAILABLE "Set to OFF to disable use of OpenGL fixed function pipeline." ${OSG_GL1_AVAILABLE})
OPTION(OSG_CPP_EXCEPTIONS_AVAILABLE "Set to OFF to disable compile of OSG components that use C++ exceptions." ON)
@@ -446,11 +527,17 @@ IF(WIN32 AND NOT ANDROID)
INCLUDE(Find3rdPartyDependencies)
ENDIF()
#
# If you want to prevent CMake from picking up on any of the following optional 3rd Party dependencies in CMake 2.8 onwards
# you can use the following style of command line option when invoking Cmake (here illustrating ignoring PythonLibs) :
# cmake -DCMAKE_DISABLE_FIND_PACKAGE_PythonLibs=1 .
#
IF(ANDROID)
ANDROID_3RD_PARTY()
ELSE()
# Common to all platforms except android:
FIND_PACKAGE(FreeType)
FIND_PACKAGE(Freetype)
FIND_PACKAGE(Inventor)
FIND_PACKAGE(Jasper)
FIND_PACKAGE(OpenEXR)
@@ -461,11 +548,10 @@ ELSE()
FIND_PACKAGE(OpenVRML)
FIND_PACKAGE(Performer)
FIND_PACKAGE(GDAL)
FIND_PACKAGE(GTA)
FIND_PACKAGE(CURL)
FIND_PACKAGE(ITK)
FIND_PACKAGE(LibVNCServer)
FIND_PACKAGE(OurDCMTK)
FIND_PACKAGE(OpenAL)
FIND_PACKAGE(FFmpeg)
FIND_PACKAGE(DirectShow)
FIND_PACKAGE(SDL)
@@ -474,17 +560,30 @@ ELSE()
FIND_PACKAGE(GtkGl)
FIND_PACKAGE(DirectInput)
FIND_PACKAGE(NVTT)
IF (NOT WIN32)
FIND_PACKAGE(Asio)
ENDIF()
FIND_PACKAGE(ZeroConf)
ENDIF()
IF(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 8)
FIND_PACKAGE(ITK)
ENDIF()
# Include macro utilities here
INCLUDE(OsgMacroUtils)
IF(NOT ANDROID)
# To select a specific version of QT define DESIRED_QT_VERSION
# via cmake -DDESIRED_QT_VERSION=4
IF (DESIRED_QT_VERSION)
OPTION(OSG_USE_QT "Enable to use Qt (build Qt-dependent libraries, plugins and examples)" ON)
IF (DESIRED_QT_VERSION MATCHES 4)
IF(OSG_USE_QT AND NOT ANDROID)
# To select a specific version of QT define DESIRED_QT_VERSION
# via cmake -DDESIRED_QT_VERSION=5
# QUIET option disables messages if the package cannot be found.
IF (DESIRED_QT_VERSION)
IF (DESIRED_QT_VERSION MATCHES 5)
FIND_PACKAGE(Qt5Widgets)
ELSEIF (DESIRED_QT_VERSION MATCHES 4)
FIND_PACKAGE(Qt4)
ELSE()
FIND_PACKAGE(Qt3)
@@ -492,14 +591,44 @@ IF(NOT ANDROID)
ELSE()
FIND_PACKAGE(Qt4)
FIND_PACKAGE(Qt5Widgets QUIET)
IF (NOT QT4_FOUND)
FIND_PACKAGE(Qt3)
IF ( Qt5Widgets_FOUND )
# CMake 2.8.8 or greater required
BUILDER_VERSION_GREATER(2 8 7)
IF(NOT VALID_BUILDER_VERSION)
MESSAGE(
SEND_ERROR
"Qt5 requires CMake version 2.8.8 or greater!\n"
"Update CMake or set DESIRED_QT_VERSION to less than 5
or disable OSG_USE_QT."
)
ENDIF( )
ENDIF( )
IF ( NOT Qt5Widgets_FOUND )
FIND_PACKAGE(Qt4)
IF (NOT QT4_FOUND)
FIND_PACKAGE(Qt3)
ENDIF()
ENDIF()
ENDIF()
ENDIF(NOT ANDROID)
#If we have found Qt5, let's try to top off by getting the webkit as well
IF ( Qt5Widgets_FOUND )
FIND_PACKAGE(Qt5WebKitWidgets QUIET)
IF(COMMAND cmake_policy)
IF(${CMAKE_MAJOR_VERSION} GREATER 2)
# Qt5 qt5_use_modules usage was causing "Policy CMP0043 is not set: Ignore COMPILE_DEFINITIONS_<Config> properties." warnings
cmake_policy(SET CMP0043 NEW)
ENDIF()
ENDIF()
ENDIF()
ENDIF()
#optional example related dependencies
IF (BUILD_OSG_EXAMPLES AND NOT ANDROID)
@@ -534,16 +663,19 @@ IF(NOT ANDROID)
FIND_PACKAGE(JPEG)
FIND_PACKAGE(PNG)
FIND_PACKAGE(TIFF)
# QuickTime is required for OS X, but optional for Windows.
IF(WIN32)
FIND_PACKAGE(QuickTime)
ENDIF()
ELSE()
FIND_PACKAGE(TIFF)
FIND_PACKAGE(QuickTime)
FIND_PACKAGE(QTKit)
FIND_PACKAGE(CoreVideo)
FIND_PACKAGE(CoreMedia)
FIND_PACKAGE(QuartzCore)
FIND_PACKAGE(AVFoundation)
ENDIF()
ENDIF()
@@ -692,28 +824,31 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
# returns too many hits.
# FYI, if we do implement GNUCC, then -Wmissing-prototypes in another
# interesting C-specific flag.
# Also, there is a bug in gcc 4.0. Under C++, -pedantic will create
# 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 -Wno-long-long -Wno-import -pedantic -Wreturn-type -Wmissing-braces -Wunknown-pragmas -Wunused -fpermissive)
SET(OSG_AGGRESSIVE_WARNING_FLAGS -Wall -Wparentheses -Wno-long-long -Wno-import -pedantic -Wreturn-type -Wmissing-braces -Wunknown-pragmas -Wunused)
# Previous included -Wformat=2 in OSG_AGGRESSIVE_WARNING_FLAGS but had to remove it due to standard library errors
ELSE()
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
ELSEIF(MSVC)
#disable specific warning level 4 warnings:
#C4100 'identifier' : unreferenced formal parameter
#C4127 Error Message conditional expression is constant
#C4706 assignment within conditional expression
SET(OSG_AGGRESSIVE_WARNING_FLAGS /W4 /wd4706 /wd4127 /wd4100)
ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
SET(OSG_AGGRESSIVE_WARNING_FLAGS -Wall -Wparentheses -Wno-long-long -Wno-import -pedantic -Wreturn-type -Wmissing-braces -Wunknown-pragmas -Wunused -Wno-overloaded-virtual)
ELSE()
# CMake lacks an elseif, so other non-gcc, non-VS compilers need
# to be listed below. If unhandled, OSG_AGGRESSIVE_WARNING_FLAGS should
# remain unset.
ENDIF()
IF (APPLE)
# set standard lib, clang defaults to c++0x
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++98")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libstdc++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98 -stdlib=libstdc++ -Wno-overloaded-virtual -Wno-conversion")
set(WARNING_CFLAGS "")
ENDIF()
ENDIF()
# This part is for the CMake menu option to toggle the warnings on/off.
@@ -766,15 +901,21 @@ IF (BUILD_OSG_EXAMPLES)
ENDIF()
IF(APPLE)
IF(APPLE AND NOT ANDROID)
#Here we check if the user specified IPhone SDK
IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
#set iphone arch and flags taken from http://sites.google.com/site/michaelsafyan/coding/resources/how-to-guides/cross-compile-for-the-iphone/how-to-cross-compile-for-the-iphone-using-cmake
IF(OSG_BUILD_PLATFORM_IPHONE)
SET(CMAKE_OSX_ARCHITECTURES "armv6;armv7" CACHE STRING "Build architectures for iOS" FORCE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -miphoneos-version-min=3.1 -mno-thumb -arch armv6 -pipe -no-cpp-precomp" CACHE STRING "Flags used by the compiler during all build types." FORCE)
IF(${IPHONE_VERSION_MIN} LESS "7.0")
SET(CMAKE_OSX_ARCHITECTURES "armv6;armv7" CACHE STRING "Build architectures for iOS" FORCE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -miphoneos-version-min=${IPHONE_VERSION_MIN} -mno-thumb -pipe -no-cpp-precomp" CACHE STRING "Flags used by the compiler during all build types." FORCE)
ELSE()
SET(CMAKE_OSX_ARCHITECTURES "armv7;armv7s;arm64" CACHE STRING "Build architectures for iOS" FORCE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -miphoneos-version-min=${IPHONE_VERSION_MIN} -pipe -no-cpp-precomp" CACHE STRING "Flags used by the compiler during all build types." FORCE)
ENDIF()
ELSE()
#simulator uses i386 architectures
SET(CMAKE_OSX_ARCHITECTURES "i386" CACHE STRING "Build architectures for iOS Simulator" FORCE)
@@ -806,18 +947,23 @@ IF(APPLE)
# FORCE is used because the options are not reflected in the UI otherwise.
# Seems like a good place to add version specific compiler flags too.
IF(NOT OSG_CONFIG_HAS_BEEN_RUN_BEFORE)
# This is really fragile, but CMake doesn't provide the OS system
# version information we need. (Darwin versions can be changed
# independently of OS X versions.)
# It does look like CMake handles the CMAKE_OSX_SYSROOT automatically.
IF(EXISTS /Developer/SDKs/MacOSX10.5.sdk)
# 64-bit compiles are not supported with Carbon. We should enable
# 64-bit compilation by default once osgviewer has been
# rewritten with Cocoa.
#SET(CMAKE_OSX_ARCHITECTURES "ppc;i386;ppc64;x86_64" CACHE STRING "Build architectures for OSX" FORCE)
IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.8" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.9" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.10")
SET(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "imageio" CACHE STRING "Forced imageio default image plugin for OSX" FORCE)
# 64 Bit Works, i386,ppc is not supported any more
SET(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Build architectures for OSX" FORCE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.8 -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE)
ELSEIF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.7")
SET(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "imageio" CACHE STRING "Forced imageio default image plugin for OSX" FORCE)
# 64 Bit Works, PPC is not supported any more
SET(CMAKE_OSX_ARCHITECTURES "i386;x86_64" CACHE STRING "Build architectures for OSX" FORCE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.7 -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE)
ELSEIF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.6" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.5")
SET(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "imageio" CACHE STRING "Forced imageio default image plugin for OSX" FORCE)
# 64-bit compiles are not supported with Carbon.
SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" FORCE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.5 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE)
ELSEIF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk)
ELSEIF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.4")
SET(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "quicktime" CACHE STRING "Forced imageio default image plugin for OSX" FORCE)
SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" FORCE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.4 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE)
ELSE()
@@ -825,21 +971,21 @@ IF(APPLE)
# Should break down further to set the -mmacosx-version-min,
# but the SDK detection is too unreliable here.
ENDIF()
ENDIF(NOT OSG_CONFIG_HAS_BEEN_RUN_BEFORE)
ENDIF()
OPTION(OSG_BUILD_APPLICATION_BUNDLES "Enable the building of applications and examples as OSX Bundles" OFF)
ENDIF()
ENDIF(APPLE)
ENDIF()
# For Doxygen
INCLUDE(${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL)
OPTION(BUILD_DOCUMENTATION "Build OpenSceneGraph reference documentation using doxygen (use: make DoxygenDoc)" OFF)
OPTION(BUILD_DOCUMENTATION "Build OpenSceneGraph reference documentation using doxygen (use: make doc_openscenegraph doc_openthreads)" OFF)
MARK_AS_ADVANCED(CLEAR BUILD_DOCUMENTATION)
# To build the documention, you will have to enable it
# and then do the equivalent of "make DoxygenDoc".
# and then do the equivalent of "make doc_openscenegraph doc_openthreads".
IF(BUILD_DOCUMENTATION)
OPTION(BUILD_REF_DOCS_SEARCHENGINE "Enable doxygen's search engine (requires that documentation to be installed on a php enabled web server)" OFF)
@@ -861,19 +1007,19 @@ IF(BUILD_DOCUMENTATION)
ELSE()
SET(HAVE_DOT NO)
ENDIF()
# If html help generation was requested. DOCUMENTATION_HTML_HELP is defined by Documentation.cmake
SET(GENERATE_HTMLHELP "NO")
IF(DOCUMENTATION_HTML_HELP)
# on windows Documentation.cmake finds the html help workshop fi it exists. On u*ix we might have it with wine but no way to point it out
# on windows Documentation.cmake finds the html help workshop if it exists. On u*ix we might have it with wine but no way to point it out
IF(NOT WIN32)
SET(HTML_HELP_COMPILER "" CACHE FILEPATH "Enter location of the HTML help compiler to let doxygen compile html")
MARK_AS_ADVANCED(HTML_HELP_COMPILER)
ENDIF()
# this var sets a proper value in .doxygen files when coniguring them below
# this var sets a proper value in .doxygen files when configuring them below
SET(GENERATE_HTMLHELP "YES")
endif()
# This processes our doxyfile.cmake and substitutes paths to generate
# a final Doxyfile
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/Doxyfiles/doxyfile.cmake
@@ -909,7 +1055,7 @@ IF(BUILD_DOCUMENTATION)
${PROJECT_BINARY_DIR}/doc/auto_Doxyfile)
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/Doxyfiles/core_Doxyfile
${PROJECT_BINARY_DIR}/doc/core_Doxyfile)
# This creates a new target to build documentation.
# It runs ${DOXYGEN} which is the full path and executable to
# Doxygen on your system, set by the FindDoxygen.cmake module
@@ -920,17 +1066,17 @@ IF(BUILD_DOCUMENTATION)
${PROJECT_BINARY_DIR}/doc/openscenegraph.doxyfile
)
SET_TARGET_PROPERTIES(doc_openscenegraph PROPERTIES FOLDER "Documentation")
ADD_CUSTOM_TARGET(doc_openthreads ${DOXYGEN}
${PROJECT_BINARY_DIR}/doc/openthreads.doxyfile
)
SET_TARGET_PROPERTIES(doc_openthreads PROPERTIES FOLDER "Documentation")
ENDIF(BUILD_DOCUMENTATION)
OPTION(BUILD_DASHBOARD_REPORTS "Set to ON to activate reporting of OpenSceneGraph builds here http://www.cdash.org/CDashPublic/index.php?project=OpenSceneGraph" OFF)
OPTION(BUILD_DASHBOARD_REPORTS "Set to ON to activate reporting of OpenSceneGraph builds here http://cdash.openscenegraph.org/index.php?project=OpenSceneGraph" OFF)
IF(BUILD_DASHBOARD_REPORTS)
# The following are required to uses Dart and the Cdash dashboard
# viewable here : http://www.cdash.org/CDashPublic/index.php?project=OpenSceneGraph
# viewable here : http://cdash.openscenegraph.org/index.php?project=OpenSceneGraph
INCLUDE(Dart)
ENDIF()
@@ -963,9 +1109,9 @@ SET(PKGCONFIG_FILES
openscenegraph-osgVolume
)
IF(QT4_FOUND)
IF(QT4_FOUND OR Qt5Widgets_FOUND )
SET(PKGCONFIG_FILES ${PKGCONFIG_FILES} openscenegraph-osgQt)
ENDIF(QT4_FOUND)
ENDIF()
FOREACH(PKGCONFIG_FILE ${PKGCONFIG_FILES})
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/packaging/pkgconfig/${PKGCONFIG_FILE}.pc.in
@@ -997,7 +1143,7 @@ IF(REQUIRES_LIBPATH_MESSAGE)
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/packaging/ld.so.conf.d/openscenegraph.conf.in
${PROJECT_BINARY_DIR}/packaging/ld.so.conf.d/openscenegraph.conf
)
ADD_CUSTOM_TARGET(install_ld_conf ${CMAKE_COMMAND} -E copy_if_different
ADD_CUSTOM_TARGET(install_ld_conf ${CMAKE_COMMAND} -E copy_if_different
${PROJECT_BINARY_DIR}/packaging/ld.so.conf.d/openscenegraph.conf
/etc/ld.so.conf.d/openscenegraph.conf
COMMAND ldconfig

View File

@@ -1,4 +1,4 @@
# Check for availability of atomic operations
# Check for availability of atomic operations
# This module defines
# OPENTHREADS_HAVE_ATOMIC_OPS
@@ -15,123 +15,143 @@ IF (OPENTHREADS_ATOMIC_USE_MUTEX)
SET(_OPENTHREADS_ATOMIC_USE_MUTEX 1)
ELSE()
# as the test does not work for IOS hardcode the ATOMIC implementation
IF(OSG_BUILD_PLATFORM_IPHONE_SIMULATOR OR OSG_BUILD_PLATFORM_IPHONE)
SET(_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS 0)
SET(_OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS 0)
SET(_OPENTHREADS_ATOMIC_USE_SUN 0)
SET(_OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED 0)
SET(_OPENTHREADS_ATOMIC_USE_MUTEX 0)
INCLUDE(CheckCXXSourceRuns)
SET(_OPENTHREADS_ATOMIC_USE_BSD_ATOMIC 1)
# Do step by step checking,
CHECK_CXX_SOURCE_RUNS("
#include <cstdlib>
ELSE()
INCLUDE(CheckCXXSourceRuns)
int main()
{
unsigned value = 0;
void* ptr = &value;
__sync_add_and_fetch(&value, 1);
__sync_synchronize();
__sync_sub_and_fetch(&value, 1);
if (!__sync_bool_compare_and_swap(&value, 0, 1))
return EXIT_FAILURE;
# Do step by step checking,
CHECK_CXX_SOURCE_RUNS("
#include <cstdlib>
if (!__sync_bool_compare_and_swap(&ptr, ptr, ptr))
return EXIT_FAILURE;
int main()
{
unsigned value = 0;
void* ptr = &value;
__sync_add_and_fetch(&value, 1);
__sync_synchronize();
__sync_sub_and_fetch(&value, 1);
if (!__sync_bool_compare_and_swap(&value, 0, 1))
return EXIT_FAILURE;
return EXIT_SUCCESS;
}
" _OPENTHREADS_ATOMIC_USE_GCC_BUILTINS)
if (!__sync_bool_compare_and_swap(&ptr, ptr, ptr))
return EXIT_FAILURE;
CHECK_CXX_SOURCE_RUNS("
#include <stdlib.h>
return EXIT_SUCCESS;
}
" _OPENTHREADS_ATOMIC_USE_GCC_BUILTINS)
int main(int, const char**)
{
unsigned value = 0;
void* ptr = &value;
__add_and_fetch(&value, 1);
__synchronize(value);
__sub_and_fetch(&value, 1);
if (!__compare_and_swap(&value, 0, 1))
return EXIT_FAILURE;
CHECK_CXX_SOURCE_RUNS("
#include <stdlib.h>
if (!__compare_and_swap((unsigned long*)&ptr, (unsigned long)ptr, (unsigned long)ptr))
return EXIT_FAILURE;
int main(int, const char**)
{
unsigned value = 0;
void* ptr = &value;
__add_and_fetch(&value, 1);
__synchronize(value);
__sub_and_fetch(&value, 1);
if (!__compare_and_swap(&value, 0, 1))
return EXIT_FAILURE;
return EXIT_SUCCESS;
}
" _OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS)
if (!__compare_and_swap((unsigned long*)&ptr, (unsigned long)ptr, (unsigned long)ptr))
return EXIT_FAILURE;
CHECK_CXX_SOURCE_RUNS("
#include <atomic.h>
#include <cstdlib>
return EXIT_SUCCESS;
}
" _OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS)
int main(int, const char**)
{
uint_t value = 0;
void* ptr = &value;
atomic_inc_uint_nv(&value);
membar_consumer();
atomic_dec_uint_nv(&value);
if (0 != atomic_cas_uint(&value, 0, 1))
return EXIT_FAILURE;
CHECK_CXX_SOURCE_RUNS("
#include <atomic.h>
#include <cstdlib>
if (ptr != atomic_cas_ptr(&ptr, ptr, ptr))
return EXIT_FAILURE;
int main(int, const char**)
{
uint_t value = 0;
void* ptr = &value;
atomic_inc_uint_nv(&value);
membar_consumer();
atomic_dec_uint_nv(&value);
if (0 != atomic_cas_uint(&value, 0, 1))
return EXIT_FAILURE;
return EXIT_SUCCESS;
}
" _OPENTHREADS_ATOMIC_USE_SUN)
if (ptr != atomic_cas_ptr(&ptr, ptr, ptr))
return EXIT_FAILURE;
CHECK_CXX_SOURCE_RUNS("
#include <windows.h>
#include <intrin.h>
#include <cstdlib>
return EXIT_SUCCESS;
}
" _OPENTHREADS_ATOMIC_USE_SUN)
#pragma intrinsic(_InterlockedAnd)
#pragma intrinsic(_InterlockedOr)
#pragma intrinsic(_InterlockedXor)
CHECK_CXX_SOURCE_RUNS("
#include <windows.h>
#include <intrin.h>
#include <cstdlib>
int main(int, const char**)
{
volatile long value = 0;
long data = 0;
long* volatile ptr = &data;
#pragma intrinsic(_InterlockedAnd)
#pragma intrinsic(_InterlockedOr)
#pragma intrinsic(_InterlockedXor)
InterlockedIncrement(&value);
MemoryBarrier();
InterlockedDecrement(&value);
int main(int, const char**)
{
volatile long value = 0;
long data = 0;
long* volatile ptr = &data;
if (0 != InterlockedCompareExchange(&value, 1, 0))
return EXIT_FAILURE;
InterlockedIncrement(&value);
MemoryBarrier();
InterlockedDecrement(&value);
if (ptr != InterlockedCompareExchangePointer((PVOID volatile*)&ptr, (PVOID)ptr, (PVOID)ptr))
return EXIT_FAILURE;
if (0 != InterlockedCompareExchange(&value, 1, 0))
return EXIT_FAILURE;
return EXIT_SUCCESS;
}
" _OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED)
if (ptr != InterlockedCompareExchangePointer((PVOID volatile*)&ptr, (PVOID)ptr, (PVOID)ptr))
return EXIT_FAILURE;
CHECK_CXX_SOURCE_RUNS("
#include <libkern/OSAtomic.h>
return EXIT_SUCCESS;
}
" _OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED)
int main()
{
volatile int32_t value = 0;
long data = 0;
long * volatile ptr = &data;
CHECK_CXX_SOURCE_RUNS("
#include <libkern/OSAtomic.h>
OSAtomicIncrement32(&value);
OSMemoryBarrier();
OSAtomicDecrement32(&value);
OSAtomicCompareAndSwapInt(value, 1, &value);
OSAtomicCompareAndSwapPtr(ptr, ptr, (void * volatile *)&ptr);
}
" _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC)
int main()
{
volatile int32_t value = 0;
long data = 0;
long * volatile ptr = &data;
OSAtomicIncrement32(&value);
OSMemoryBarrier();
OSAtomicDecrement32(&value);
OSAtomicCompareAndSwapInt(value, 1, &value);
OSAtomicCompareAndSwapPtr(ptr, ptr, (void * volatile *)&ptr);
}
" _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC)
IF(NOT _OPENTHREADS_ATOMIC_USE_GCC_BUILTINS AND
NOT _OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS AND
NOT _OPENTHREADS_ATOMIC_USE_SUN AND
NOT _OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED AND
NOT _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC)
SET(_OPENTHREADS_ATOMIC_USE_MUTEX 1)
ENDIF()
# MinGW can set both WIN32_INTERLOCKED and GCC_BUILTINS to true which results in compliation errors
IF (_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS AND _OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED)
# In this case we prefer the GCC_BUILTINS
SET(_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS 1)
SET(_OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED 0)
ENDIF()
IF(NOT _OPENTHREADS_ATOMIC_USE_GCC_BUILTINS AND
NOT _OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS AND
NOT _OPENTHREADS_ATOMIC_USE_SUN AND
NOT _OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED AND
NOT _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC)
SET(_OPENTHREADS_ATOMIC_USE_MUTEX 1)
ENDIF()
ENDIF()

View File

@@ -54,12 +54,12 @@ ENDMACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES_BASE SEARCHPATHLIST D
################################################################################################
# this Macro is tailored to Mike dependencies
# this Macro is tailored to Mike and Torbens dependencies
################################################################################################
MACRO(SEARCH_3RDPARTY OSG_3RDPARTY_BIN)
FIND_DEPENDENCY(TIFF tiff.h libtiff ${OSG_3RDPARTY_BIN} "D" "_i")
FIND_DEPENDENCY(FREETYPE ft2build.h "freetype;freetype2311MT;freetype234;freetype234MT;freetype235;freetype237;freetype238;" ${OSG_3RDPARTY_BIN} "d" "")
FIND_DEPENDENCY(FREETYPE ft2build.h "freetype;freetype2311MT;freetype234;freetype234MT;freetype235;freetype237;freetype238;freetype244;freetype250;" ${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 "" FORCE)
@@ -79,21 +79,21 @@ MACRO(SEARCH_3RDPARTY OSG_3RDPARTY_BIN)
FIND_DEPENDENCY(GIFLIB gif_lib.h "ungif;libungif;giflib" ${OSG_3RDPARTY_BIN} "D" "")
FIND_DEPENDENCY(ZLIB zlib.h "z;zlib;zlib1" ${OSG_3RDPARTY_BIN} "D" "")
IF(ZLIB_FOUND)
FIND_DEPENDENCY(PNG png.h "libpng;libpng13;libpng15" ${OSG_3RDPARTY_BIN} "D" "")
FIND_DEPENDENCY(PNG png.h "libpng;libpng13;libpng15;libpng16" ${OSG_3RDPARTY_BIN} "D" "")
IF(PNG_FOUND)
#forcing subsequent FindPNG stuff to not search for other variables.... kind of a hack
SET(PNG_PNG_INCLUDE_DIR ${PNG_INCLUDE_DIR} CACHE FILEPATH "")
MARK_AS_ADVANCED(PNG_PNG_INCLUDE_DIR)
ENDIF(PNG_FOUND)
ENDIF(ZLIB_FOUND)
FIND_DEPENDENCY(LIBXML2 libxml "libxml2" ${OSG_3RDPARTY_BIN} "D" "")
FIND_DEPENDENCY(LIBXML2 libxml2 "libxml2" ${OSG_3RDPARTY_BIN} "D" "")
IF(LIBXML2_FOUND)
# The CMAKE find libxml module uses LIBXML2_LIBRARIES -> fill it.... kind of a hack
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARY} CACHE FILEPATH "" FORCE)
SET(LIBXML2_XMLLINT_EXECUTABLE ${OSG_3RDPARTY_BIN}/bin/xmllint.exe CACHE FILEPATH "Path to xmllint executable" FORCE)
ENDIF(LIBXML2_FOUND)
#FIND_DEPENDENCY(DEPNAME INCLUDEFILE LIBRARY_NAMES_BASE SEARCHPATHLIST DEBUGSUFFIX EXSUFFIX)
FIND_Package(NVTT)
FIND_Package(NVTT)
#luigi#INCLUDE(FindOSGDepends.cmake)
ENDMACRO(SEARCH_3RDPARTY OSG_3RDPARTY_BIN)

View File

@@ -0,0 +1,40 @@
# Locate Apple AVFoundation (next-generation QTKit)
# This module defines
# AV_FOUNDATION_LIBRARY
# AV_FOUNDATION_FOUND, if false, do not try to link to gdal
#
# $AV_FOUNDATION_DIR is an environment variable that would
# correspond to the ./configure --prefix=$AV_FOUNDATION_DIR
#
# Created by Stephan Maximilian Huber
IF(APPLE)
FIND_LIBRARY(AV_FOUNDATION_LIBRARY AVFoundation)
ENDIF()
SET(AV_FOUNDATION_FOUND "NO")
IF(AV_FOUNDATION_LIBRARY)
SET(AV_FOUNDATION_FOUND "YES")
ENDIF()
IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
# AVFoundation exists ON iOS, too -- good support for SDK 6.0 and greater
IF(${IPHONE_SDKVER} LESS "6.0")
SET(AV_FOUNDATION_FOUND "NO")
ELSE()
SET(AV_FOUNDATION_FOUND "YES")
ENDIF()
ELSE()
IF(APPLE)
# AVFoundation exists since 10.7, but only 10.8 has all features necessary for OSG
# so check the SDK-setting
IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.8" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.9" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.10")
# nothing special here ;-)
ELSE()
MESSAGE("AVFoundation disabled for SDK < 10.8")
SET(AV_FOUNDATION_FOUND "NO")
ENDIF()
ENDIF()
ENDIF()

View File

@@ -0,0 +1,20 @@
# Locate ASIO-headers (http://think-async.com/Asio)
# This module defines
# ASIO_FOUND, if false, do not try to link to gdal
# ASIO_INCLUDE_DIR, where to find the headers
#
# Created by Stephan Maximilian Huber
FIND_PATH(ASIO_INCLUDE_DIR
NAMES
asio.hpp
PATHS
/usr/include
/usr/local/include
)
SET(ASIO_FOUND "NO")
FIND_PACKAGE( Boost 1.37 )
IF(Boost_FOUND AND ASIO_INCLUDE_DIR)
SET(ASIO_FOUND "YES")
ENDIF()

View File

@@ -28,6 +28,12 @@ IF(APPLE)
SET(COLLADA_BUILDNAME "mac")
ELSEIF(MINGW)
SET(COLLADA_BUILDNAME "mingw")
ELSEIF(MSVC12)
SET(COLLADA_BUILDNAME "vc12")
ELSEIF(MSVC11)
SET(COLLADA_BUILDNAME "vc11")
ELSEIF(MSVC10)
SET(COLLADA_BUILDNAME "vc10")
ELSEIF(MSVC90)
SET(COLLADA_BUILDNAME "vc9")
ELSEIF(MSVC80)
@@ -46,8 +52,11 @@ FIND_PATH(COLLADA_INCLUDE_DIR dae.h
/opt/local/Library/Frameworks #macports
/usr/local/include
/usr/local/include/colladadom
/usr/local/include/collada-dom
/opt/local/include/collada-dom
/usr/include/
/usr/include/colladadom
/usr/include/collada-dom
/sw/include # Fink
/opt/local/include # DarwinPorts
/opt/csw/include # Blastwave
@@ -233,7 +242,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
)
FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY
NAMES libboost_filesystem boost_filesystem libboost_filesystem-vc90-mt libboost_filesystem-vc100-mt
NAMES libboost_filesystem boost_filesystem boost_filesystem-mt libboost_filesystem-${COLLADA_BUILDNAME}0-mt libboost_filesystem-${COLLADA_BUILDNAME}0-mt-1_54 libboost_filesystem-${COLLADA_BUILDNAME}0-mt-1_55
PATHS
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
@@ -241,7 +250,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
)
FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY_DEBUG
NAMES libboost_filesystem-d boost_filesystem-d libboost_filesystem-vc90-mt-gd libboost_filesystem-vc100-mt-gd
NAMES libboost_filesystem-d boost_filesystem-d boost_filesystem-mt-d libboost_filesystem-${COLLADA_BUILDNAME}0-mt-gd libboost_filesystem-${COLLADA_BUILDNAME}0-mt-gd-1_54 libboost_filesystem-${COLLADA_BUILDNAME}0-mt-gd-1_55
PATHS
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
@@ -249,7 +258,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
)
FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY
NAMES libboost_system boost_system libboost_system-vc90-mt libboost_system-vc100-mt
NAMES libboost_system boost_system boost_system-mt libboost_system-${COLLADA_BUILDNAME}0-mt libboost_system-${COLLADA_BUILDNAME}0-mt-1_54 libboost_system-${COLLADA_BUILDNAME}0-mt-1_55
PATHS
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
@@ -257,7 +266,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
)
FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY_DEBUG
NAMES libboost_system-d boost_system-d libboost_system-vc90-mt-gd libboost_system-vc100-mt-gd
NAMES libboost_system-d boost_system-d boost_system-mt-d libboost_system-${COLLADA_BUILDNAME}0-mt-gd libboost_system-${COLLADA_BUILDNAME}0-mt-gd-1_54 libboost_system-${COLLADA_BUILDNAME}0-mt-gd-1_55
PATHS
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw

View File

@@ -0,0 +1,23 @@
# Locate Apple CoreMedia
# This module defines
# COREMEDIA_LIBRARY
# COREMEDIA_FOUND, if false, do not try to link to gdal
# COREMEDIA_INCLUDE_DIR, where to find the headers
#
# $COREMEDIA_DIR is an environment variable that would
# correspond to the ./configure --prefix=$COREMEDIA_DIR
#
# Created by Stephan Maximilian Huber.
IF(APPLE)
FIND_PATH(COREMEDIA_INCLUDE_DIR CoreMedia/CoreMedia.h)
FIND_LIBRARY(COREMEDIA_LIBRARY CoreMedia)
ENDIF()
SET(COREMEDIA_FOUND "NO")
IF(COREMEDIA_LIBRARY AND COREMEDIA_INCLUDE_DIR)
SET(COREMEDIA_FOUND "YES")
ENDIF()

View File

@@ -16,8 +16,12 @@ ELSEIF(MSVC80)
SET(FBX_LIBDIR "vs2005")
ELSEIF(MSVC90)
SET(FBX_LIBDIR "vs2008")
ELSEIF(MSVC100 OR MSVC_VER>1600)
ELSEIF(MSVC10)
SET(FBX_LIBDIR "vs2010")
ELSEIF(MSVC11)
SET(FBX_LIBDIR "vs2012")
ELSEIF(MSVC12 OR MSVC_VERSION>1800)
SET(FBX_LIBDIR "vs2013")
ENDIF()
IF(APPLE)
@@ -30,22 +34,29 @@ ELSE()
SET(FBX_LIBDIR ${FBX_LIBDIR}/x86)
ENDIF()
#try to use 2015.1 or 2014.2 version
IF(APPLE)
SET(FBX_LIBNAME "fbxsdk-2012.1-static")
SET(FBX_LIBNAME "libfbxsdk")
ELSEIF(CMAKE_COMPILER_IS_GNUCXX)
SET(FBX_LIBNAME "fbxsdk-2012.1-static")
SET(FBX_LIBNAME "fbxsdk")
ELSE()
SET(FBX_LIBNAME "fbxsdk-2012.1-md")
SET(FBX_LIBNAME "libfbxsdk-md")
ENDIF()
SET(FBX_LIBNAME_DEBUG ${FBX_LIBNAME}d)
SET( FBX_SEARCH_PATHS
$ENV{FBX_DIR}
$ENV{ProgramW6432}/Autodesk/FBX/FbxSdk/2012.1
$ENV{PROGRAMFILES}/Autodesk/FBX/FbxSdk/2012.1
/Applications/Autodesk/FBXSDK20121
"$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2015.1"
"$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2015.1"
/Applications/Autodesk/FBXSDK20151
"$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2014.2"
"$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2014.2"
/Applications/Autodesk/FBXSDK20142
/Applications/Autodesk/FBXSDK20141
)
#I think the last line in the search path is an old typo, but let's search for 2014.1 anyway - LV
# search for headers & debug/release libraries
FIND_PATH(FBX_INCLUDE_DIR "fbxsdk.h"
@@ -53,7 +64,14 @@ FIND_PATH(FBX_INCLUDE_DIR "fbxsdk.h"
PATH_SUFFIXES "include")
FIND_LIBRARY( FBX_LIBRARY ${FBX_LIBNAME}
PATHS ${FBX_SEARCH_PATHS}
PATH_SUFFIXES "lib/${FBX_LIBDIR}")
PATH_SUFFIXES "lib/${FBX_LIBDIR}/release" "lib/${FBX_LIBDIR}")
#Once one of the calls succeeds the result variable will be set and stored in the cache so that no call will search again.
#no debug d suffix, search in debug folder only
FIND_LIBRARY( FBX_LIBRARY_DEBUG ${FBX_LIBNAME}
PATHS ${FBX_SEARCH_PATHS}
PATH_SUFFIXES "lib/${FBX_LIBDIR}/debug")
FIND_LIBRARY( FBX_LIBRARY_DEBUG ${FBX_LIBNAME_DEBUG}
PATHS ${FBX_SEARCH_PATHS}
PATH_SUFFIXES "lib/${FBX_LIBDIR}")
@@ -63,3 +81,79 @@ IF(FBX_LIBRARY AND FBX_LIBRARY_DEBUG AND FBX_INCLUDE_DIR)
ELSE()
SET(FBX_FOUND "NO")
ENDIF()
IF(NOT FBX_FOUND)
#try to use 2014.1 version
IF(APPLE)
SET(FBX_LIBNAME "fbxsdk-2014.1")
ELSEIF(CMAKE_COMPILER_IS_GNUCXX)
SET(FBX_LIBNAME "fbxsdk-2014.1")
ELSE()
SET(FBX_LIBNAME "fbxsdk-2014.1")
ENDIF()
SET(FBX_LIBNAME_DEBUG ${FBX_LIBNAME}d)
SET( FBX_SEARCH_PATHS
$ENV{FBX_DIR}
$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2014.1
$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2014.1
/Applications/Autodesk/FBXSDK20141
)
# search for headers & debug/release libraries
FIND_PATH(FBX_INCLUDE_DIR "fbxsdk.h"
PATHS ${FBX_SEARCH_PATHS}
PATH_SUFFIXES "include")
FIND_LIBRARY( FBX_LIBRARY ${FBX_LIBNAME}
PATHS ${FBX_SEARCH_PATHS}
PATH_SUFFIXES "lib/${FBX_LIBDIR}")
FIND_LIBRARY( FBX_LIBRARY_DEBUG ${FBX_LIBNAME_DEBUG}
PATHS ${FBX_SEARCH_PATHS}
PATH_SUFFIXES "lib/${FBX_LIBDIR}")
IF(FBX_LIBRARY AND FBX_LIBRARY_DEBUG AND FBX_INCLUDE_DIR)
SET(FBX_FOUND "YES")
ELSE()
SET(FBX_FOUND "NO")
ENDIF()
ENDIF()
IF(NOT FBX_FOUND)
#try to use 2013.3 version
IF(APPLE)
SET(FBX_LIBNAME "fbxsdk-2013.3-static")
ELSEIF(CMAKE_COMPILER_IS_GNUCXX)
SET(FBX_LIBNAME "fbxsdk-2013.3-static")
ELSE()
SET(FBX_LIBNAME "fbxsdk-2013.3-md")
ENDIF()
SET(FBX_LIBNAME_DEBUG ${FBX_LIBNAME}d)
SET( FBX_SEARCH_PATHS
$ENV{FBX_DIR}
$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2013.3
$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2013.3
/Applications/Autodesk/FBXSDK20133
)
# search for headers & debug/release libraries
FIND_PATH(FBX_INCLUDE_DIR "fbxsdk.h"
PATHS ${FBX_SEARCH_PATHS}
PATH_SUFFIXES "include")
FIND_LIBRARY( FBX_LIBRARY ${FBX_LIBNAME}
PATHS ${FBX_SEARCH_PATHS}
PATH_SUFFIXES "lib/${FBX_LIBDIR}")
FIND_LIBRARY( FBX_LIBRARY_DEBUG ${FBX_LIBNAME_DEBUG}
PATHS ${FBX_SEARCH_PATHS}
PATH_SUFFIXES "lib/${FBX_LIBDIR}")
IF(FBX_LIBRARY AND FBX_LIBRARY_DEBUG AND FBX_INCLUDE_DIR)
SET(FBX_FOUND "YES")
ELSE()
SET(FBX_FOUND "NO")
ENDIF()
ENDIF()

View File

@@ -11,7 +11,8 @@
#In ffmpeg code, old version use "#include <header.h>" and newer use "#include <libname/header.h>"
#In OSG ffmpeg plugin, we use "#include <header.h>" for compatibility with old version of ffmpeg
#In OSG ffmpeg plugin, we used "#include <header.h>" for compatibility with old version of ffmpeg
#With the new version of FFmpeg, a file named "time.h" was added that breaks compatability with the old version of ffmpeg.
#We have to search the path which contain the header.h (usefull for old version)
#and search the path which contain the libname/header.h (usefull for new version)
@@ -131,20 +132,17 @@ IF (FFMPEG_LIBAVFORMAT_FOUND AND FFMPEG_LIBAVDEVICE_FOUND AND FFMPEG_LIBAVCODE
SET(FFMPEG_FOUND "YES")
SET(FFMPEG_INCLUDE_DIRS
${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS} ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}/libavformat
${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS} ${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS}/libavdevice
${FFMPEG_LIBAVCODEC_INCLUDE_DIRS} ${FFMPEG_LIBAVCODEC_INCLUDE_DIRS}/libavcodec
${FFMPEG_LIBAVUTIL_INCLUDE_DIRS} ${FFMPEG_LIBAVUTIL_INCLUDE_DIRS}/libavutil
${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}
${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS}
${FFMPEG_LIBAVCODEC_INCLUDE_DIRS}
${FFMPEG_LIBAVUTIL_INCLUDE_DIRS}
)
# Using the new include style for FFmpeg prevents issues with #include <time.h>
IF (FFMPEG_STDINT_INCLUDE_DIR)
SET(FFMPEG_INCLUDE_DIRS
${FFMPEG_INCLUDE_DIRS}
${FFMPEG_STDINT_INCLUDE_DIR}
${FFMPEG_STDINT_INCLUDE_DIR}/libavformat
${FFMPEG_STDINT_INCLUDE_DIR}/libavdevice
${FFMPEG_STDINT_INCLUDE_DIR}/libavcodec
${FFMPEG_STDINT_INCLUDE_DIR}/libavutil
)
ENDIF()

View File

@@ -48,7 +48,7 @@ FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
/opt/csw
/opt
/usr/freeware
PATH_SUFFIXES include
PATH_SUFFIXES include include/freetype2
)
FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h
@@ -74,6 +74,20 @@ FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h
/usr/freeware/include/freetype2
)
FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 config/ftheader.h
/usr/local/include/freetype2
/usr/include/freetype2
/usr/local/X11R6/include/freetype2
/usr/local/X11/include/freetype2
/usr/X11R6/include/freetype2
/usr/X11/include/freetype2
/sw/include/freetype2
/opt/local/include/freetype2
/opt/csw/include/freetype2
/opt/include/freetype2
/usr/freeware/include/freetype2
)
FIND_LIBRARY(FREETYPE_LIBRARY
NAMES freetype libfreetype freetype219
PATHS

View File

@@ -0,0 +1,56 @@
# Locate libgta
# This module defines
# GTA_FOUND, if false, do not try to link to libgta
# GTA_INCLUDE_DIRS, where to find the headers
# GTA_LIBRARIES
#
# $GTA_DIR is an environment variable that would
# correspond to the ./configure --prefix=$GTA_DIR
# used in building libgta.
INCLUDE(FindPkgConfig OPTIONAL)
IF(PKG_CONFIG_FOUND)
INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(GTA gta)
ELSE(PKG_CONFIG_FOUND)
FIND_PATH(GTA_INCLUDE_DIRS gta/gta.hpp
$ENV{GTA_DIR}/include
$ENV{GTA_DIR}
~/Library/Frameworks
/Library/Frameworks
/usr/local/include
/usr/include
/sw/include # Fink
/opt/local/include # DarwinPorts
/opt/csw/include # Blastwave
/opt/include
/usr/freeware/include
)
FIND_LIBRARY(GTA_LIBRARIES
NAMES gta libgta
PATHS
$ENV{GTA_DIR}/lib
$ENV{GTA_DIR}
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
SET(GTA_FOUND "NO")
IF(GTA_LIBRARIES AND GTA_INCLUDE_DIRS)
SET(GTA_FOUND "YES")
ENDIF(GTA_LIBRARIES AND GTA_INCLUDE_DIRS)
ENDIF(PKG_CONFIG_FOUND)

View File

@@ -15,6 +15,7 @@ FIND_PATH(NVTT_INCLUDE_DIR nvtt/nvtt.h
PATH_SUFFIXES include
)
# NVTT
FIND_LIBRARY(NVTT_LIBRARY
NAMES nvtt
PATHS
@@ -25,6 +26,17 @@ FIND_LIBRARY(NVTT_LIBRARY
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
)
FIND_LIBRARY(NVTT_LIBRARY_DEBUG
NAMES nvtt_d
PATHS
/usr/local
/usr
$ENV{NVTT_DIR}
${3rdPartyRoot}
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
)
# NVIMAGE
FIND_LIBRARY(NVIMAGE_LIBRARY
NAMES nvimage
PATHS
@@ -35,6 +47,17 @@ FIND_LIBRARY(NVIMAGE_LIBRARY
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
)
FIND_LIBRARY(NVIMAGE_LIBRARY_DEBUG
NAMES nvimage_d
PATHS
/usr/local
/usr
$ENV{NVTT_DIR}
${3rdPartyRoot}
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
)
# NVMATH
FIND_LIBRARY(NVMATH_LIBRARY
NAMES nvmath
PATHS
@@ -45,6 +68,17 @@ FIND_LIBRARY(NVMATH_LIBRARY
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
)
FIND_LIBRARY(NVMATH_LIBRARY_DEBUG
NAMES nvmath_d
PATHS
/usr/local
/usr
$ENV{NVTT_DIR}
${3rdPartyRoot}
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
)
# NVCORE
FIND_LIBRARY(NVCORE_LIBRARY
NAMES nvcore
PATHS
@@ -54,6 +88,18 @@ FIND_LIBRARY(NVCORE_LIBRARY
${3rdPartyRoot}
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
)
FIND_LIBRARY(NVCORE_LIBRARY_DEBUG
NAMES nvcore_d
PATHS
/usr/local
/usr
$ENV{NVTT_DIR}
${3rdPartyRoot}
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
)
SET(NVTT_FOUND "NO")
IF(NVTT_LIBRARY AND NVTT_INCLUDE_DIR)

View File

@@ -1,13 +1,13 @@
# Locate gdal
# This module defines
# OSG_LIBRARY
# OSG_FOUND, if false, do not try to link to gdal
# 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.
# Created by Robert Osfield.
FIND_PATH(OSG_INCLUDE_DIR osg/Node
${OSG_DIR}/include
@@ -59,7 +59,7 @@ MACRO(FIND_OSG_LIBRARY MYLIBRARY MYLIBRARYNAME)
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
/usr/freeware/lib64
)
FIND_LIBRARY(${MYLIBRARY}
NAMES "${MYLIBRARYNAME}${CMAKE_RELEASE_POSTFIX}"
PATHS
@@ -96,13 +96,18 @@ MACRO(FIND_OSG_LIBRARY MYLIBRARY MYLIBRARYNAME)
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib
/usr/freeware/lib64
)
IF( NOT ${MYLIBRARY}_DEBUG)
IF(MYLIBRARY)
SET(${MYLIBRARY}_DEBUG ${MYLIBRARY})
ENDIF(MYLIBRARY)
ENDIF( NOT ${MYLIBRARY}_DEBUG)
ENDIF(MYLIBRARY)
ELSE()
IF( NOT MYLIBRARY )
SET(${MYLIBRARY} ${${MYLIBRARY}_DEBUG} )
ENDIF(NOT MYLIBRARY)
ENDIF( NOT ${MYLIBRARY}_DEBUG )
ENDMACRO(FIND_OSG_LIBRARY LIBRARY LIBRARYNAME)
FIND_OSG_LIBRARY(OSG_LIBRARY osg)
@@ -111,12 +116,20 @@ FIND_OSG_LIBRARY(OSGUTIL_LIBRARY osgUtil)
FIND_OSG_LIBRARY(OSGDB_LIBRARY osgDB)
FIND_OSG_LIBRARY(OSGTEXT_LIBRARY osgText)
FIND_OSG_LIBRARY(OSGWIDGET_LIBRARY osgWidget)
FIND_OSG_LIBRARY(OSGQT_LIBRARY osgQt)
FIND_OSG_LIBRARY(OSGTERRAIN_LIBRARY osgTerrain)
FIND_OSG_LIBRARY(OSGFX_LIBRARY osgFX)
FIND_OSG_LIBRARY(OSGVIEWER_LIBRARY osgViewer)
FIND_OSG_LIBRARY(OSGVOLUME_LIBRARY osgVolume)
FIND_OSG_LIBRARY(OSGMANIPULATOR_LIBRARY osgManipulator)
FIND_OSG_LIBRARY(OSGANIMATION_LIBRARY osgAnimation)
FIND_OSG_LIBRARY(OSGPARTICLE_LIBRARY osgParticle)
FIND_OSG_LIBRARY(OSGSHADOW_LIBRARY osgShadow)
FIND_OSG_LIBRARY(OSGPRESENTATION_LIBRARY osgPresentation)
FIND_OSG_LIBRARY(OSGSIM_LIBRARY osgSim)
FIND_OSG_LIBRARY(OPENTHREADS_LIBRARY OpenThreads)
SET(OSG_FOUND "NO")
IF(OSG_LIBRARY AND OSG_INCLUDE_DIR)
SET(OSG_FOUND "YES")

View File

@@ -0,0 +1,23 @@
# Locate Apple QuartzCore
# This module defines
# QUARTZCORE_LIBRARY
# QUARTZCORE_FOUND, if false, do not try to link to QUARTZCORE
# QUARTZCORE_INCLUDE_DIR, where to find the headers
#
# $QUARTZCORE_DIR is an environment variable that would
# correspond to the ./configure --prefix=$QUARTZCORE_DIR
#
# Created by Stephan Maximilian Huber.
IF(APPLE)
FIND_PATH(QUARTZCORE_INCLUDE_DIR QuartzCore/QuartzCore.h)
FIND_LIBRARY(QUARTZCORE_LIBRARY QuartzCore)
ENDIF()
SET(QUARTZCORE_FOUND "NO")
IF(QUARTZCORE_LIBRARY AND QUARTZCORE_INCLUDE_DIR)
SET(QUARTZCORE_FOUND "YES")
ENDIF()

View File

@@ -49,18 +49,24 @@ ENDIF()
IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
SET(QUICKTIME_FOUND "NO")
ENDIF()
ELSE()
IF(APPLE)
#Quicktime is not supported under 64bit OSX build so we need to detect it and disable it.
#First check to see if we are running with a native 64-bit compiler (10.6 default) and implicit arch
IF(NOT CMAKE_OSX_ARCHITECTURES AND CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(QUICKTIME_FOUND "NO")
ELSE()
#Otherwise check to see if 64-bit is explicitly called for.
LIST(FIND CMAKE_OSX_ARCHITECTURES "x86_64" has64Compile)
IF(NOT has64Compile EQUAL -1)
SET(QUICKTIME_FOUND "NO")
ENDIF()
ENDIF()
# Disable quicktime for >= 10.7, as it's officially deprecated
IF(APPLE)
#Quicktime is not supported under 64bit OSX build so we need to detect it and disable it.
#First check to see if we are running with a native 64-bit compiler (10.6 default) and implicit arch
IF(NOT CMAKE_OSX_ARCHITECTURES AND CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(QUICKTIME_FOUND "NO")
ELSE()
#Otherwise check to see if 64-bit is explicitly called for.
LIST(FIND CMAKE_OSX_ARCHITECTURES "x86_64" has64Compile)
IF(NOT has64Compile EQUAL -1)
SET(QUICKTIME_FOUND "NO")
ENDIF()
ENDIF()
IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.7" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.8" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.9" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.10")
MESSAGE("disabling quicktime because it's not supported by the selected SDK ${OSG_OSX_SDK_NAME}")
SET(QUICKTIME_FOUND "NO")
ENDIF()
ENDIF()
ENDIF()

View File

@@ -5,7 +5,9 @@ IF(PKG_CONFIG_FOUND)
INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(RSVG librsvg-2.0)
#Version 2.35 introduces the rsvg_cleanup function which is used
PKG_CHECK_MODULES(RSVG librsvg-2.0>=2.35)
PKG_CHECK_MODULES(CAIRO cairo)
IF (RSVG_FOUND AND NOT CAIRO_FOUND)

View File

@@ -0,0 +1,47 @@
# Locate ZeroConf / Bonjour
# This module defines
# ZEROCONF_LIBRARY
# ZEROCONF_FOUND, if false, do not try to link to gdal
# ZEROCONF_INCLUDE_DIR, where to find the headers
#
# $ZEROCONF_DIR is an environment variable that would
# correspond to the ./configure --prefix=$ZEROCONF_DIR
# Created by Stephan Maximilian Huber
SET(ZEROCONF_FOUND "NO")
IF(APPLE)
# bonjour is part of the system on os x / ios
SET(ZEROCONF_FOUND "YES")
ELSE()
IF(WIN32)
# find the Bonjour SDK
FIND_PATH(ZEROCONF_INCLUDE_DIR dnssd.h
$ENV{ZEROCONF_DIR}/include
$ENV{ZEROCONF_DIR}
NO_DEFAULT_PATH
)
FIND_PATH(ZEROCONF_INCLUDE_DIR dnssd.h
PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this.
NO_DEFAULT_PATH
PATH_SUFFIXES include
)
FIND_PATH(ZEROCONF_INCLUDE_DIR dnssd.h)
FIND_LIBRARY(ZEROCONF_LIBRARY dnssd
PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this.
NO_DEFAULT_PATH
PATH_SUFFIXES lib64 lib
)
FIND_LIBRARY(ZEROCONF_LIBRARY dnssd)
SET(ZEROCONF_FOUND "NO")
IF(ZEROCONF_LIBRARY AND ZEROCONF_INCLUDE_DIR)
SET(ZEROCONF_FOUND "YES")
ENDIF()
ELSE()
# TODO find AVAHI on linux
ENDIF()
ENDIF()

View File

@@ -1,12 +1,15 @@
MACRO(SETUP_ANDROID_LIBRARY LIB_NAME)
foreach(arg ${TARGET_LIBRARIES})
set(MODULE_LIBS "${MODULE_LIBS} -l${arg}")
endforeach(arg ${TARGET_LIBRARIES})
#foreach(arg ${TARGET_LIBRARIES})
# set(MODULE_LIBS "${MODULE_LIBS} -l${arg}")
#endforeach(arg ${TARGET_LIBRARIES})
foreach(arg ${TARGET_SRC})
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" n_f ${arg})
set(MODULE_SOURCES "${MODULE_SOURCES} ${n_f}")
IF ("${arg}" MATCHES ".*\\.c$" OR "${arg}" MATCHES ".*\\.cpp$")
#We only include source files, not header files, this removes anoying warnings
set(MODULE_SOURCES "${MODULE_SOURCES} ${n_f}")
ENDIF()
endforeach(arg ${TARGET_SRC})
#SET(MODULE_INCLUDES "${CMAKE_SOURCE_DIR}/include include")
@@ -35,7 +38,8 @@ MACRO(SETUP_ANDROID_LIBRARY LIB_NAME)
ELSEIF(OSG_GLES2_AVAILABLE)
SET(OPENGLES_LIBRARY -lGLESv2)
ENDIF()
set(MODULE_LIBS "${MODULE_LIBS} ${OPENGLES_LIBRARY} -ldl")
#${MODULE_LIBS}
set(MODULE_LIBS_FLAGS "${OPENGLES_LIBRARY} -ldl")
if(NOT CPP_EXTENSION)
set(CPP_EXTENSION "cpp")
endif()
@@ -44,8 +48,12 @@ MACRO(SETUP_ANDROID_LIBRARY LIB_NAME)
ENDIF()
IF("MODULE_USER_STATIC_OR_DYNAMIC" MATCHES "STATIC")
SET(MODULE_BUILD_TYPE "\$\(BUILD_STATIC_LIBRARY\)")
SET(MODULE_LIBS_SHARED " ")
SET(MODULE_LIBS_STATIC ${TARGET_LIBRARIES})
ELSE()
SET(MODULE_BUILD_TYPE "\$\(BUILD_DYNAMIC_LIBRARY\)")
SET(MODULE_BUILD_TYPE "\$\(BUILD_SHARED_LIBRARY\)")
SET(MODULE_LIBS_SHARED ${TARGET_LIBRARIES})
SET(MODULE_LIBS_STATIC " ")
ENDIF()
set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} ${LIB_NAME}")
set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${CMAKE_CURRENT_BINARY_DIR}/Android.mk \n")

View File

@@ -5,7 +5,7 @@
# NAME of the variables, so the macro gets as arguments the target name and the following list of parameters
# is intended as a list of variable names each one containing the path of the libraries to link to
# The existance of a variable name with _DEBUG appended is tested and, in case it' s value is used
# for linking to when in debug mode
# for linking to when in debug mode
# the content of this library for linking when in debugging
#######################################################################################################
@@ -87,12 +87,12 @@ MACRO(LINK_CORELIB_DEFAULT CORELIB_NAME)
SET(ALL_GL_LIBRARIES ${ALL_GL_LIBRARIES} ${OPENGL_egl_LIBRARY})
ENDIF()
LINK_EXTERNAL(${CORELIB_NAME} ${ALL_GL_LIBRARIES})
LINK_EXTERNAL(${CORELIB_NAME} ${ALL_GL_LIBRARIES})
LINK_WITH_VARIABLES(${CORELIB_NAME} OPENTHREADS_LIBRARY)
IF(OPENSCENEGRAPH_SONAMES)
SET_TARGET_PROPERTIES(${CORELIB_NAME} PROPERTIES VERSION ${OPENSCENEGRAPH_VERSION} SOVERSION ${OPENSCENEGRAPH_SOVERSION})
ENDIF(OPENSCENEGRAPH_SONAMES)
ENDMACRO(LINK_CORELIB_DEFAULT CORELIB_NAME)
@@ -112,11 +112,11 @@ MACRO(SETUP_LINK_LIBRARIES)
######################################################################
#
# This set up the libraries to link to, it assumes there are two variable: one common for a group of examples or plugins
# kept in the variable TARGET_COMMON_LIBRARIES and an example or plugin specific kept in TARGET_ADDED_LIBRARIES
# they are combined in a single list checked for unicity
# kept in the variable TARGET_COMMON_LIBRARIES and an example or plugin specific kept in TARGET_ADDED_LIBRARIES
# they are combined in a single list checked for unicity
# the suffix ${CMAKE_DEBUG_POSTFIX} is used for differentiating optimized and debug
#
# a second variable TARGET_EXTERNAL_LIBRARIES hold the list of libraries not differentiated between debug and optimized
# a second variable TARGET_EXTERNAL_LIBRARIES hold the list of libraries not differentiated between debug and optimized
##################################################################################
SET(TARGET_LIBRARIES ${TARGET_COMMON_LIBRARIES})
@@ -151,7 +151,7 @@ MACRO(SETUP_LINK_LIBRARIES)
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} ${ALL_GL_LIBRARIES})
LINK_EXTERNAL(${TARGET_TARGETNAME} ${ALL_GL_LIBRARIES})
ENDIF(MSVC AND OSG_MSVC_VERSIONED_DLL)
ENDMACRO(SETUP_LINK_LIBRARIES)
@@ -213,7 +213,7 @@ ENDMACRO(SET_OUTPUT_DIR_PROPERTY_260 TARGET_TARGETNAME RELATIVE_OUTDIR)
MACRO(SETUP_LIBRARY LIB_NAME)
IF(ANDROID)
SETUP_ANDROID_LIBRARY(${LIB_NAME})
SETUP_ANDROID_LIBRARY(${LIB_NAME})
ELSE()
SET(TARGET_NAME ${LIB_NAME} )
SET(TARGET_TARGETNAME ${LIB_NAME} )
@@ -224,10 +224,13 @@ MACRO(SETUP_LIBRARY LIB_NAME)
${TARGET_SRC}
)
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES FOLDER "OSG Core")
IF(APPLE)
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES XCODE_ATTRIBUTE_WARNING_CFLAGS "")
ENDIF()
IF(TARGET_LABEL)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL}")
ENDIF(TARGET_LABEL)
IF(TARGET_LIBRARIES)
LINK_INTERNAL(${LIB_NAME} ${TARGET_LIBRARIES})
ENDIF()
@@ -238,14 +241,14 @@ MACRO(SETUP_LIBRARY LIB_NAME)
LINK_WITH_VARIABLES(${LIB_NAME} ${TARGET_LIBRARIES_VARS})
ENDIF(TARGET_LIBRARIES_VARS)
LINK_CORELIB_DEFAULT(${LIB_NAME})
ENDIF()
INCLUDE(ModuleInstall OPTIONAL)
ENDMACRO(SETUP_LIBRARY LIB_NAME)
MACRO(SETUP_PLUGIN PLUGIN_NAME)
IF(ANDROID)
SETUP_ANDROID_LIBRARY(${TARGET_DEFAULT_PREFIX}${PLUGIN_NAME})
SETUP_ANDROID_LIBRARY(${TARGET_DEFAULT_PREFIX}${PLUGIN_NAME})
ELSE()
SET(TARGET_NAME ${PLUGIN_NAME} )
@@ -268,38 +271,33 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME)
SET(PACKAGE_COMPONENT libopenscenegraph)
ENDIF(${ARGC} GREATER 1)
# Add the VisualStudio versioning info
# Add the VisualStudio versioning info
SET(TARGET_SRC ${TARGET_SRC} ${OPENSCENEGRAPH_VERSIONINFO_RC})
# here we use the command to generate the library
# here we use the command to generate the library
IF (DYNAMIC_OPENSCENEGRAPH)
ADD_LIBRARY(${TARGET_TARGETNAME} MODULE ${TARGET_SRC} ${TARGET_H})
ELSE (DYNAMIC_OPENSCENEGRAPH)
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
IF(NOT MSVC)
IF(NOT UNIX)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES DEBUG_POSTFIX "")
ENDIF(NOT UNIX)
ELSE(NOT MSVC)
IF(MSVC)
IF(NOT CMAKE24)
SET_OUTPUT_DIR_PROPERTY_260(${TARGET_TARGETNAME} "${OSG_PLUGINS}") # Sets the ouput to be /osgPlugin-X.X.X ; also ensures the /Debug /Release are removed
ELSE(NOT CMAKE24)
IF(OSG_MSVC_VERSIONED_DLL)
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}
#the dll are placed in bin/${OSG_PLUGINS}
IF(NOT MSVC_IDE)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "../bin/${OSG_PLUGINS}/")
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "../bin/${OSG_PLUGINS}/")
ELSE(NOT MSVC_IDE)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "../../bin/${OSG_PLUGINS}/" IMPORT_PREFIX "../")
ENDIF(NOT MSVC_IDE)
@@ -313,16 +311,18 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME)
ENDIF(OSG_MSVC_VERSIONED_DLL)
ENDIF(NOT CMAKE24)
ENDIF(NOT MSVC)
ENDIF(MSVC)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL}")
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES FOLDER "Plugins")
IF(APPLE)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES XCODE_ATTRIBUTE_WARNING_CFLAGS "")
ENDIF()
SETUP_LINK_LIBRARIES()
#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}
INSTALL(TARGETS ${TARGET_TARGETNAME}
RUNTIME DESTINATION bin COMPONENT ${PACKAGE_COMPONENT}
ARCHIVE DESTINATION lib/${OSG_PLUGINS} COMPONENT libopenscenegraph-dev
LIBRARY DESTINATION bin/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT})
@@ -350,11 +350,11 @@ MACRO(SETUP_EXE IS_COMMANDLINE_APP)
ENDIF(NOT TARGET_LABEL)
IF(${IS_COMMANDLINE_APP})
ADD_EXECUTABLE(${TARGET_TARGETNAME} ${TARGET_SRC} ${TARGET_H})
ELSE(${IS_COMMANDLINE_APP})
IF(APPLE)
# SET(MACOSX_BUNDLE_LONG_VERSION_STRING "${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION}.${OPENSCENEGRAPH_PATCH_VERSION}")
# Short Version is the "marketing version". It is the version
@@ -363,6 +363,8 @@ MACRO(SETUP_EXE IS_COMMANDLINE_APP)
# Bundle version is the version the OS looks at.
SET(MACOSX_BUNDLE_BUNDLE_VERSION "${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION}.${OPENSCENEGRAPH_PATCH_VERSION}")
SET(MACOSX_BUNDLE_GUI_IDENTIFIER "org.openscenegraph.${TARGET_TARGETNAME}" )
# replace underscore by hyphen
STRING(REGEX REPLACE "_" "-" MACOSX_BUNDLE_GUI_IDENTIFIER ${MACOSX_BUNDLE_GUI_IDENTIFIER})
SET(MACOSX_BUNDLE_BUNDLE_NAME "${TARGET_NAME}" )
# SET(MACOSX_BUNDLE_ICON_FILE "myicon.icns")
# SET(MACOSX_BUNDLE_COPYRIGHT "")
@@ -382,7 +384,7 @@ MACRO(SETUP_EXE IS_COMMANDLINE_APP)
ENDIF(APPLE)
ADD_EXECUTABLE(${TARGET_TARGETNAME} ${PLATFORM_SPECIFIC_CONTROL} ${TARGET_SRC} ${TARGET_H})
ENDIF(${IS_COMMANDLINE_APP})
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL}")
@@ -396,7 +398,11 @@ MACRO(SETUP_EXE IS_COMMANDLINE_APP)
SET_OUTPUT_DIR_PROPERTY_260(${TARGET_TARGETNAME} "") # Ensure the /Debug /Release are removed
ENDIF(MSVC_IDE AND OSG_MSVC_VERSIONED_DLL)
SETUP_LINK_LIBRARIES()
IF(APPLE)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES XCODE_ATTRIBUTE_WARNING_CFLAGS "")
ENDIF()
SETUP_LINK_LIBRARIES()
ENDMACRO(SETUP_EXE)
@@ -410,11 +416,11 @@ MACRO(SETUP_APPLICATION APPLICATION_NAME)
ELSE(${ARGC} GREATER 1)
SET(IS_COMMANDLINE_APP 0)
ENDIF(${ARGC} GREATER 1)
SETUP_EXE(${IS_COMMANDLINE_APP})
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES FOLDER "Applications")
IF(APPLE)
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION bin BUNDLE DESTINATION bin)
ELSE(APPLE)
@@ -439,13 +445,13 @@ MACRO(SETUP_EXAMPLE EXAMPLE_NAME)
ELSE(${ARGC} GREATER 1)
SET(IS_COMMANDLINE_APP 0)
ENDIF(${ARGC} GREATER 1)
SETUP_EXE(${IS_COMMANDLINE_APP})
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES FOLDER "Examples")
IF(APPLE)
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION share/OpenSceneGraph/bin BUNDLE DESTINATION share/OpenSceneGraph/bin )
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION share/OpenSceneGraph/bin BUNDLE DESTINATION share/OpenSceneGraph/bin )
ELSE(APPLE)
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION share/OpenSceneGraph/bin COMPONENT openscenegraph-examples )
ENDIF(APPLE)
@@ -483,7 +489,7 @@ MACRO(HANDLE_MSVC_DLL)
ENDIF(${ARGC} GREATER 1)
SET_OUTPUT_DIR_PROPERTY_260(${LIB_NAME} "") # Ensure the /Debug /Release are removed
IF(NOT MSVC_IDE)
IF(NOT MSVC_IDE)
IF (NOT CMAKE24)
BUILDER_VERSION_GREATER(2 8 0)
IF(NOT VALID_BUILDER_VERSION)
@@ -516,8 +522,12 @@ MACRO(HANDLE_MSVC_DLL)
ELSE (NOT CMAKE24)
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../../bin/${LIB_PREFIX}${LIB_SOVERSION}-" IMPORT_PREFIX "../")
ENDIF (NOT CMAKE24)
ENDIF(NOT MSVC_IDE)
ENDIF(NOT MSVC_IDE)
# SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../../bin/osg${OPENSCENEGRAPH_SOVERSION}-")
# SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES IMPORT_PREFIX "../")
ENDMACRO(HANDLE_MSVC_DLL)
MACRO(REMOVE_CXX_FLAG flag)
STRING(REPLACE "${flag}" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
ENDMACRO()

83910
ChangeLog

File diff suppressed because it is too large Load Diff

945
NEWS.txt

File diff suppressed because it is too large Load Diff

View File

@@ -1,27 +1,36 @@
#ANDROID makefile ${MODULE_NAME}
#ANDROID makefile ${MODULE_NAME}
LOCAL_PATH := ${MODULE_DIR}
LOCAL_PATH := ${MODULE_DIR}
include $(CLEAR_VARS)
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
LOCAL_ARM_NEON := true
ifeq (${ANDROID_OPTIM_NEON},true)
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
LOCAL_ARM_NEON := true
endif
endif
LOCAL_CPP_EXTENSION := ${CPP_EXTENSION}
ifeq (${ANDROID_OPTIM_ARM32},true)
LOCAL_ARM_MODE := arm
endif
LOCAL_LDLIBS := ${MODULE_LIBS}
LOCAL_MODULE := ${MODULE_NAME}
LOCAL_CPP_EXTENSION := ${CPP_EXTENSION}
LOCAL_SRC_FILES := ${MODULE_SOURCES}
LOCAL_LDLIBS := ${MODULE_LIBS_FLAGS}
LOCAL_C_INCLUDES := ${MODULE_INCLUDES}
LOCAL_MODULE := ${MODULE_NAME}
LOCAL_CFLAGS := ${MODULE_FLAGS_C}
LOCAL_SRC_FILES := ${MODULE_SOURCES}
LOCAL_CPPFLAGS := ${MODULE_FLAGS_CPP}
LOCAL_C_INCLUDES := ${MODULE_INCLUDES}
LOCAL_CFLAGS := ${MODULE_FLAGS_C}
LOCAL_CPPFLAGS := ${MODULE_FLAGS_CPP}
LOCAL_SHARED_LIBRARIES := ${MODULE_LIBS_SHARED}
LOCAL_STATIC_LIBRARIES := ${MODULE_LIBS_STATIC}
#include $(BUILD_STATIC_LIBRARY)
include ${MODULE_BUILD_TYPE}

View File

@@ -3,5 +3,5 @@
package="com.openscenegraph"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
</manifest>

View File

@@ -2,14 +2,14 @@
APP_BUILD_SCRIPT := $(call my-dir)/Android.mk
APP_PROJECT_PATH := $(call my-dir)
APP_OPTIM := release
APP_OPTIM := ${ANDROID_RELEASE_OPTIM}
APP_PLATFORM := android-5
APP_STL := gnustl_static
APP_PLATFORM := android-${ANDROID_PLATFORM}
APP_STL := ${ANDROID_STL}
APP_CPPFLAGS := -fexceptions -frtti
#APP_CPPFLAGS := -Os -mthumb-interwork -fno-short-enums
#APP_CPPFLAGS := -Wl,--no-undefined
APP_ABI := armeabi armeabi-v7a
APP_ABI := ${ANDROID_ABI}
APP_MODULES := $ENV{AND_OSG_LIB_NAMES}

View File

@@ -1,18 +1,14 @@
Welcome to the OpenSceneGraph (OSG).
For up-to-date information on the project, in-depth details on how to
compile and run libraries and examples, see the documentation on the
For up-to-date information on the project, in-depth details on how to
compile and run libraries and examples, see the documentation on the
OpenSceneGraph website:
http://www.openscenegraph.org
For support subscribe to our public mailing list:
http://www.openscenegraph.org/index.php/documentation
http://www.openscenegraph.org/projects/osg/wiki/MailingLists
For support subscribe to our public mailing list or forum, details at:
or forum:
http://forum.openscenegraph.org/
http://www.openscenegraph.org/index.php/support
For the impatient, we've included quick build instructions below, these
are are broken down is three parts:
@@ -27,41 +23,41 @@ more indepth instructions.
Robert Osfield.
Project Lead.
17th June 2011.
4th July 2014.
--
Section 1. How to build the OpenSceneGraph
==========================================
The OpenSceneGraph uses the CMake build system to generate a
platform-specific build environment. CMake reads the CMakeLists.txt
files that you'll find throughout the OpenSceneGraph directories,
checks for installed dependenciesand then generates the appropriate
The OpenSceneGraph uses the CMake build system to generate a
platform-specific build environment. CMake reads the CMakeLists.txt
files that you'll find throughout the OpenSceneGraph directories,
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. Details on the
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. 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
configure script that'll run cmake for you. The configure script
simply runs 'cmake . -DCMAKE_BUILD_TYPE=Release' to ensure that you
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
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
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
temporary files created by CMake won't clutter the OpenSceneGraph
source directory, and also makes it possible to have multiple
independent build targets by creating multiple build directories. In a
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
temporary files created by CMake won't clutter the OpenSceneGraph
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
@@ -70,22 +66,22 @@ directory alongside the OpenSceneGraph use:
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
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.org/projects/osg/wiki/Support/PlatformSpecifics/VisualStudio
http://www.openscenegraph.org/index.php/documentation/platform-specifics/windows
Under OSX you can either use the CMake build system above, or use the
Xcode projects that you will find in the OpenSceneGraph/Xcode
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. See release notes on OSX CMake build below.
For further details on compilation, installation and platform-specific
For further details on compilation, installation and platform-specific
information read "Getting Started" guide:
http://www.openscenegraph.org/projects/osg/wiki/Support/GettingStarted
http://www.openscenegraph.org/index.php/documentation/10-getting-started
Section 2. Release notes on OSX build, by Eric Sokolowsky, August 5, 2008
=========================================================================
@@ -169,11 +165,11 @@ Section 3. Release notes on iOS build, by Thomas Hoghart
* Check that CMAKE_OSX_ARCHITECTURE is i386 for the simulator or armv6;armv7 for the device
* Disable DYNAMIC_OPENSCENEGRAPH, DYNAMIC_OPENTHREADS
This will give us the static build we need for iPhone.
* Disable OSG_GL1_AVAILABLE, OSG_GL2_AVAILABLE, OSG_GL3_AVAILABLE,
* Disable OSG_GL1_AVAILABLE, OSG_GL2_AVAILABLE, OSG_GL3_AVAILABLE,
OSG_GL_DISPLAYLISTS_AVAILABLE, OSG_GL_VERTEX_FUNCS_AVAILABLE
* Enable OSG_GLES1_AVAILABLE *OR* OSG_GLES2_AVAILABLE
* Ensure OSG_WINDOWING_SYSTEM is set to IOS
* Change FREETYPE include and library paths to an iPhone version
* Change FREETYPE include and library paths to an iPhone version
(OpenFrameworks has one bundled with its distribution)
* Ensure that CMake_OSX_SYSROOT points to your iOS SDK.
* Generate the Xcode project
@@ -206,9 +202,9 @@ $ cmake -G Xcode \
Known issues:
* When Linking final app against ive plugin, you need to add -lz to
* When Linking final app against ive plugin, you need to add -lz to
the 'Other linker flags' list.
* Apps and exes don't get created
* You can only select Simulator, or Device projects. In the XCode
project you will see both types but the sdk they link will
* You can only select Simulator, or Device projects. In the XCode
project you will see both types but the sdk they link will
be the same.

View File

@@ -29,7 +29,7 @@ int main( int argc, char **argv )
// set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is an application for collecting a set of seperate files into a single archive file that can be later read in OSG applications..");
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is an application for collecting a set of separate files into a single archive file that can be later read in OSG applications..");
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
// if user request help write it out to cout.
@@ -139,7 +139,15 @@ int main( int argc, char **argv )
if (obj.valid())
{
std::cout<<" write to archive "<<*itr<<std::endl;
archive->writeObject(*obj, *itr);
osg::Image* image = dynamic_cast<osg::Image*>(obj.get());
osg::HeightField* hf = dynamic_cast<osg::HeightField*>(obj.get());
osg::Node* node = dynamic_cast<osg::Node*>(obj.get());
osg::Shader* shader = dynamic_cast<osg::Shader*>(obj.get());
if (image) archive->writeImage(*image, *itr);
else if (hf) archive->writeHeightField(*hf, *itr);
else if (node) archive->writeNode(*node, *itr);
else if (shader) archive->writeShader(*shader, *itr);
else archive->writeObject(*obj, *itr);
}
}
}

View File

@@ -51,12 +51,12 @@ class MyGraphicsContext {
if (!_gc)
{
osg::notify(osg::NOTICE)<<"Failed to create pbuffer, failing back to normal graphics window."<<std::endl;
traits->pbuffer = false;
_gc = osg::GraphicsContext::createGraphicsContext(traits.get());
}
if (_gc.valid())
if (_gc.valid())
{
_gc->realize();
_gc->makeCurrent();
@@ -70,9 +70,9 @@ class MyGraphicsContext {
}
}
}
bool valid() const { return _gc.valid() && _gc->isRealized(); }
private:
osg::ref_ptr<osg::GraphicsContext> _gc;
};
@@ -95,8 +95,7 @@ public:
{
osg::ref_ptr< osg::Vec3Array > newnormals = new osg::Vec3Array;
newnormals->push_back( osg::Z_AXIS );
geometry->setNormalArray( newnormals.get() );
geometry->setNormalBinding( osg::Geometry::BIND_OVERALL );
geometry->setNormalArray( newnormals.get(), osg::Array::BIND_OVERALL );
}
}
}
@@ -121,20 +120,20 @@ public:
if (node.getStateSet()) apply(*node.getStateSet());
traverse(node);
}
virtual void apply(osg::Geode& node)
{
if (node.getStateSet()) apply(*node.getStateSet());
for(unsigned int i=0;i<node.getNumDrawables();++i)
{
osg::Drawable* drawable = node.getDrawable(i);
if (drawable && drawable->getStateSet()) apply(*drawable->getStateSet());
}
traverse(node);
}
virtual void apply(osg::StateSet& stateset)
{
// search for the existence of any texture object attributes
@@ -147,7 +146,7 @@ public:
}
}
}
void compress()
{
MyGraphicsContext context;
@@ -164,21 +163,21 @@ public:
++itr)
{
osg::Texture* texture = const_cast<osg::Texture*>(itr->get());
osg::Texture2D* texture2D = dynamic_cast<osg::Texture2D*>(texture);
osg::Texture3D* texture3D = dynamic_cast<osg::Texture3D*>(texture);
osg::ref_ptr<osg::Image> image = texture2D ? texture2D->getImage() : (texture3D ? texture3D->getImage() : 0);
if (image.valid() &&
if (image.valid() &&
(image->getPixelFormat()==GL_RGB || image->getPixelFormat()==GL_RGBA) &&
(image->s()>=32 && image->t()>=32))
{
texture->setInternalFormatMode(_internalFormatMode);
// need to disable the unref after apply, other the image could go out of scope.
bool unrefImageDataAfterApply = texture->getUnRefImageDataAfterApply();
texture->setUnRefImageDataAfterApply(false);
// get OpenGL driver to create texture from image.
texture->apply(*state);
@@ -199,10 +198,10 @@ public:
++itr)
{
osg::Texture* texture = const_cast<osg::Texture*>(itr->get());
osg::Texture2D* texture2D = dynamic_cast<osg::Texture2D*>(texture);
osg::Texture3D* texture3D = dynamic_cast<osg::Texture3D*>(texture);
osg::ref_ptr<osg::Image> image = texture2D ? texture2D->getImage() : (texture3D ? texture3D->getImage() : 0);
if (image.valid())
{
@@ -215,11 +214,11 @@ public:
}
}
}
typedef std::set< osg::ref_ptr<osg::Texture> > TextureSet;
TextureSet _textureSet;
osg::Texture::InternalFormatMode _internalFormatMode;
};
@@ -243,7 +242,7 @@ public:
{
std::cout<<"Running FixTransparencyVisitor..."<<std::endl;
}
~FixTransparencyVisitor()
{
std::cout<<" Number of Transparent StateSet "<<_numTransparent<<std::endl;
@@ -256,20 +255,20 @@ public:
if (node.getStateSet()) isTransparent(*node.getStateSet());
traverse(node);
}
virtual void apply(osg::Geode& node)
{
if (node.getStateSet()) isTransparent(*node.getStateSet());
for(unsigned int i=0;i<node.getNumDrawables();++i)
{
osg::Drawable* drawable = node.getDrawable(i);
if (drawable && drawable->getStateSet()) isTransparent(*drawable->getStateSet());
}
traverse(node);
}
virtual bool isTransparent(osg::StateSet& stateset)
{
bool hasTranslucentTexture = false;
@@ -289,15 +288,15 @@ public:
for (unsigned int im=0;im<texture->getNumImages();++im)
{
osg::Image* image = texture->getImage(im);
if (image && image->isImageTranslucent()) hasTranslucentTexture = true;
if (image && image->isImageTranslucent()) hasTranslucentTexture = true;
}
}
}
if (hasTranslucentTexture || hasBlendFunc || hasTransparentRenderingHint || hasDepthSortBin)
{
++_numTransparent;
bool makeNonTransparent = false;
switch(_mode)
@@ -315,7 +314,7 @@ public:
makeNonTransparent = false;
break;
}
if (makeNonTransparent)
{
stateset.removeAttribute(osg::StateAttribute::BLENDFUNC);
@@ -335,7 +334,7 @@ public:
}
unsigned int _numTransparent;
unsigned int _numOpaque;
unsigned int _numOpaque;
unsigned int _numTransparentMadeOpaque;
FixTransparencyMode _mode;
};
@@ -350,7 +349,7 @@ public:
{
std::cout<<"Running PruneStateSet..."<<std::endl;
}
~PruneStateSetVisitor()
{
std::cout<<" Number of StateState removed "<<_numStateSetRemoved<<std::endl;
@@ -365,7 +364,7 @@ public:
}
traverse(node);
}
virtual void apply(osg::Geode& node)
{
if (node.getStateSet())
@@ -373,7 +372,7 @@ public:
node.setStateSet(0);
++_numStateSetRemoved;
}
for(unsigned int i=0;i<node.getNumDrawables();++i)
{
osg::Drawable* drawable = node.getDrawable(i);
@@ -383,10 +382,10 @@ public:
++_numStateSetRemoved;
}
}
traverse(node);
}
unsigned int _numStateSetRemoved;
};
@@ -408,8 +407,7 @@ public:
{
osg::Vec4Array* colours = new osg::Vec4Array(1);
(*colours)[0].set(1.0f,1.0f,1.0f,1.0f);
geometry->setColorArray(colours);
geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
geometry->setColorArray(colours, osg::Array::BIND_OVERALL);
}
}
}
@@ -545,7 +543,7 @@ 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()->setApplicationName(arguments.getApplicationName());
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is a utility for converting between various input and output databases formats.");
@@ -558,18 +556,19 @@ int main( int argc, char **argv )
// if user request help write it out to cout.
if (arguments.read("-h") || arguments.read("--help"))
{
{
osg::setNotifyLevel(osg::NOTICE);
usage( arguments.getApplicationName().c_str(), 0 );
//arguments.getApplicationUsage()->write(std::cout);
return 1;
}
if (arguments.read("--help-env"))
{
{
arguments.getApplicationUsage()->write(std::cout, osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE);
return 1;
}
if (arguments.read("--plugins"))
{
osgDB::FileNameList plugins = osgDB::listAllAvailablePlugins();
@@ -580,23 +579,23 @@ int main( int argc, char **argv )
std::cout<<"Plugin "<<*itr<<std::endl;
}
return 0;
}
}
std::string plugin;
if (arguments.read("--plugin", plugin))
{
osgDB::outputPluginDetails(std::cout, plugin);
return 0;
}
}
std::string ext;
if (arguments.read("--format", ext))
{
plugin = osgDB::Registry::instance()->createLibraryNameForExtension(ext);
osgDB::outputPluginDetails(std::cout, plugin);
return 0;
}
}
if (arguments.read("--formats"))
{
osgDB::FileNameList plugins = osgDB::listAllAvailablePlugins();
@@ -607,8 +606,8 @@ int main( int argc, char **argv )
osgDB::outputPluginDetails(std::cout,*itr);
}
return 0;
}
}
if (arguments.argc()<=1)
{
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
@@ -637,7 +636,7 @@ int main( int argc, char **argv )
std::string libName = osgDB::Registry::instance()->createLibraryNameForExtension(ext);
osgDB::Registry::instance()->loadLibrary(libName);
}
std::string libName;
while (arguments.read("-l",libName))
{
@@ -672,7 +671,7 @@ int main( int argc, char **argv )
oc.setRotation( from, to );
do_convert = true;
}
}
}
while (arguments.read("-s",str))
{
@@ -717,7 +716,7 @@ int main( int argc, char **argv )
do_convert = true;
}
FixTransparencyVisitor::FixTransparencyMode fixTransparencyMode = FixTransparencyVisitor::NO_TRANSPARANCY_FIXING;
std::string fixString;
while(arguments.read("--fix-transparency")) fixTransparencyMode = FixTransparencyVisitor::MAKE_OPAQUE_TEXTURE_STATESET_OPAQUE;
@@ -726,7 +725,7 @@ int main( int argc, char **argv )
if (fixString=="MAKE_OPAQUE_TEXTURE_STATESET_OPAQUE") fixTransparencyMode = FixTransparencyVisitor::MAKE_OPAQUE_TEXTURE_STATESET_OPAQUE;
if (fixString=="MAKE_ALL_STATESET_OPAQUE") fixTransparencyMode = FixTransparencyVisitor::MAKE_ALL_STATESET_OPAQUE;
};
bool pruneStateSet = false;
while(arguments.read("--prune-StateSet")) pruneStateSet = true;
@@ -739,7 +738,7 @@ int main( int argc, char **argv )
bool smooth = false;
while(arguments.read("--smooth")) { smooth = true; }
bool addMissingColours = false;
while(arguments.read("--addMissingColours") || arguments.read("--addMissingColors")) { addMissingColours = true; }
@@ -805,13 +804,13 @@ int main( int argc, char **argv )
if ( root.valid() )
{
if (smooth)
{
osgUtil::SmoothingVisitor sv;
root->accept(sv);
}
}
if (addMissingColours)
{
AddMissingColoursToGeometryVisitor av;
@@ -821,10 +820,10 @@ int main( int argc, char **argv )
// optimize the scene graph, remove rendundent nodes and state etc.
osgUtil::Optimizer optimizer;
optimizer.optimize(root.get());
if( do_convert )
root = oc.convert( root.get() );
if (internalFormatMode != osg::Texture::USE_IMAGE_DATA_FORMAT)
{
std::string ext = osgDB::getFileExtension(fileNameOut);

View File

@@ -130,40 +130,6 @@ struct Extents
osg::Vec2d _max;
};
class CheckValidVisitor : public osg::NodeVisitor
{
public:
CheckValidVisitor():
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN),
_numInvalidGeometries(0) {}
void apply(osg::Geode& geode)
{
unsigned int local_numInvalidGeometries = 0;
for(unsigned int i=0; i<geode.getNumDrawables(); ++i)
{
osg::Geometry* geometry = dynamic_cast<osg::Geometry*>(geode.getDrawable(i));
if (geometry)
{
if (!geometry->verifyArrays(_errorReports)) ++local_numInvalidGeometries;
}
}
if (local_numInvalidGeometries)
{
_errorReports<<"Geode "<<geode.getName()<<" contains problem geometries"<<std::endl;
_numInvalidGeometries += local_numInvalidGeometries;
}
}
bool valid() const { return _numInvalidGeometries==0; }
unsigned int _numInvalidGeometries;
std::stringstream _errorReports;
};
class LoadDataVisitor : public osg::NodeVisitor
{
public:
@@ -309,7 +275,7 @@ public:
osg::Node* readNodeFileAndWriteToCache(const std::string& filename)
{
osg::Node* node = 0;
if (_fileCache.valid() && osgDB::containsServerAddress(filename))
if (_fileCache.valid() )
{
if (_fileCache->existsInCache(filename))
{
@@ -334,17 +300,6 @@ public:
osg::notify(osg::NOTICE)<<"reading : "<<filename<<std::endl;
node = osgDB::readNodeFile(filename);
}
if (node)
{
CheckValidVisitor cvv;
node->accept(cvv);
if (!cvv.valid())
{
OSG_NOTICE<<"Warning, errors in geometry found in file "<<filename<<std::endl;
OSG_NOTICE<<cvv._errorReports.str()<<std::endl;
}
}
return node;
}
@@ -451,7 +406,7 @@ int main( int argc, char **argv )
// set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is an application for collecting a set of seperate files into a single archive file that can be later read in OSG applications..");
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is an application for collecting a set of separate files into a single archive file that can be later read in OSG applications..");
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-l level","Read down to level across the whole database.");
arguments.getApplicationUsage()->addCommandLineOption("-e level minX minY maxX maxY","Read down to <level> across the extents minX, minY to maxY, maxY. Note, for geocentric datase X and Y are longitude and latitude respectively.");

View File

@@ -122,6 +122,7 @@ const char* invalidNames[] =
"LineStipple",
"Logos",
"LongIDRecord",
"InputIterator",
"Make",
"Makefile",
"Material",
@@ -246,7 +247,20 @@ const char* invalidNames[] =
"Billboard",
"UpdateSkeleton",
"Vec3",
"Plugin"
"Plugin",
"Get",
"LightSource",
"SlideEventHandler",
"GraphicsContext*",
"Apple",
"GeometryNew",
"FrameBufferObject",
"Lua",
"VolumeTile",
"PushStackValueVisitor",
"RayIntersector",
"OpenSceneGraph-Data",
"Node"
};
@@ -258,6 +272,7 @@ struct TypoCorrection
TypoCorrection typoCorrections[] =
{
{"Cheaev", "Chebaev"},
{"Alaxandre", "Alexandre"},
{"Aderian", "Adrian"},
{"Adndre", "Andre"},
@@ -267,6 +282,7 @@ TypoCorrection typoCorrections[] =
{"André", "Andr<EFBFBD>"},
{"Antione", "Antoine"},
{"Antonoine", "Antoine"},
{"Aurelein", "Aurelien"},
{"Atr", "Art"},
{"Baverage", "Beverage"},
{"Bistroviae", "Bistrovic"},
@@ -285,6 +301,7 @@ TypoCorrection typoCorrections[] =
{"Fabian", "Fabien"},
{"Fautre", "Fautr<EFBFBD>"},
{"Frashid", "Farshid"},
{"Farshild", "Farshid"},
{"Fred", "Frederic"},
{"Fredrick", "Frederic"},
{"Fredric", "Frederic"},
@@ -310,14 +327,19 @@ TypoCorrection typoCorrections[] =
{"Happalahti", "Haapalahti"},
{"Hertlien", "Hertlein"},
{"Hatwig", "Hartwig"},
{"Hauknes", "Haukness"},
{"Hunber", "Huber"},
{"Hi", "He"},
{"Hooper", "Hopper"},
{"Inverson", "Iverson"},
{"Iversion", "Iverson"},
{"Jean-Sebastein", "Jean-Sebastien"},
{"Jean-Sebastian", "Jean-Sebastien"},
{"Jean-Sebastirn", "Jean-Sebastien"},
{"Jea-Sebastien", "Jean-Sebastien"},
{"Jean-Sebastein", "Jean-S<EFBFBD>bastien"},
{"Jean-Sebastian", "Jean-S<EFBFBD>bastien"},
{"Jean-Sebastirn", "Jean-S<EFBFBD>bastien"},
{"Jea-Sebastien", "Jean-S<EFBFBD>bastien"},
{"Jean-Sebasien", "Jean-S<>bastien"},
{"Jean-Sebastien", "Jean-S<>bastien"},
{"Jean-Sebestien", "Jean-S<>bastien"},
{"Johhansen", "Johansen"},
{"Johnansen", "Johansen"},
{"Johnasen", "Johansen"},
@@ -331,6 +353,7 @@ TypoCorrection typoCorrections[] =
{"Krulthof", "Kruithof"},
{"Lagrade", "Lagarde"},
{"Largade", "Lagarde"},
{"Largarde", "Lagarde"},
{"Larshkari", "Lashkari"},
{"Lashakari", "Lashkari"},
{"Lashari", "Lashkari"},
@@ -376,6 +399,7 @@ TypoCorrection typoCorrections[] =
{"Oritz", "Ortiz"},
{"Osfeld", "Osfield"},
{"Osfied", "Osfield"},
{"Paulk", "Paul"},
{"Pail", "Paul"},
{"Perciva", "Peciva"},
{"Pecvia", "Peciva"},
@@ -430,13 +454,34 @@ TypoCorrection typoCorrections[] =
{"Fielder", "Fiedler"},
{"Mathia", "Mathias"},
{"Halgarth", "Hogarth"},
{"Jean-Sebasien", "Jean-Sebastien"},
{"Katherina", "Katharina"},
{"Biyfarguine", "Boufarguine"},
{"Dickenson", "Dickinson"},
{"Jahannes","Johannes"},
{"Eskland","Ekstrand"},
{"Baeuerele","Baeuerle"},
{"Bauerle","Baeuerle"}
{"Bauerle","Baeuerle"},
{"Baeurele","Baeuerle"},
{"Nillson","Nilsson"},
{"Bjorn","Bj<EFBFBD>rn"},
{"Björn","Bj<EFBFBD>rn"},
{"Stepan","Stephan"},
{"Kristoger","Kristofer"},
{"Blessing","Blissing"},
{"Dannahuer","Dannhauer"},
{"Chebeav", "Chebaev"},
{"Messershmidt","Messerschmidt"},
{"Auelien","Aurelien"},
{"Aurélien","Aur<EFBFBD>lien"},
{"McDonnel","Mc Donnell"},
{"McDonnell","Mc Donnell"},
{"Delallée","Delall<EFBFBD>e"},
{"Gjøl","Gj<EFBFBD>l"},
{"Ravšelj","Rav<EFBFBD>elj"},
{"Ravsel", "Rav<EFBFBD>elj"},
{"Ravselj", "Rav<EFBFBD>elj"},
{"Janik", "Jannik"},
{"Viganò", "Vigan<EFBFBD>"}
};
@@ -450,14 +495,28 @@ struct NameCorrection
NameCorrection nameCorrections[] =
{
{"FrancoisTigeot","",
"Francois", "Tigeot"},
{"Juan","Manuel",
"Juan", "Manuel Alvarez"},
{"Jaap","Gas",
"Jaap", "Glas"},
{"Philip","Lamp",
"Philip", "Lamb"},
{"Dimi","Christop",
"Dimi", "Christopoulos"},
{"Jorge","Ciges",
"Jorge", "Izquierdo"},
"Jorge", "Izquierdo Ciges"},
{"Jorge","Izquierdo",
"Jorge", "Izquierdo Ciges"},
{"Rafa","Gata",
"Rafa", "Gaitan"},
{"Sukender","I",
"Sukender", ""},
{"Sukender","Here",
"Sukender", ""},
{"Sukender","Fix",
"Sukender", ""},
{"Ewe","Woessner",
"Uwe", "Woessner"},
{"Martin","von",
@@ -472,6 +531,8 @@ NameCorrection nameCorrections[] =
"Thomas", "Hogarth"},
{"Marin", "Lavery",
"Martin", "Lavery"},
{"Michael", "Bach",
"Michael", "Bach Jensen"},
{"Nguyen", "Van",
"Nguyen", "Van Truong"},
{"Thom", "Carlo",
@@ -493,7 +554,7 @@ NameCorrection nameCorrections[] =
{"Time", "Moore",
"Tim", "Moore"},
{"Jean", "Sebastien",
"Jean-Sebastien", "Guay"},
"Jean-S<EFBFBD>bastien", "Guay"},
{"Michale", "Platings",
"Michael", "Platings"},
{"Mick", "",
@@ -528,6 +589,8 @@ NameCorrection nameCorrections[] =
"Melchior", "Franz"},
{"Glen", "Waldon",
"Glenn", "Waldron"},
{"Glen", "Waldron",
"Glenn", "Waldron"},
{"Ralf", "Karn",
"Ralf", "Kern"},
{"Donny", "Cipperly",
@@ -560,8 +623,12 @@ NameCorrection nameCorrections[] =
"Romano", "Jos<EFBFBD> Magacho da Silva"},
{"Rommano", "Silva",
"Romano", "Jos<EFBFBD> Magacho da Silva"},
{"Romano", "Magacho",
"Romano", "Jos<EFBFBD> Magacho da Silva"},
{"Leandro", "Motta",
"Leandro", "Motta Barros"},
{"Leandro", "Motto",
"Leandro", "Motta Barros"},
{"A", "Botorabi",
"Ali", "Botorabi"},
{"Waltice", "",
@@ -578,10 +645,24 @@ NameCorrection nameCorrections[] =
"Luc", "Frauciel"},
{"Alberto", "Lucas",
"Alberto", "Luaces"},
{"Alberto", "Luacus",
"Alberto", "Luaces"},
{"Tyge", "",
"Tyge", "L<EFBFBD>vset"},
{"Ricard", "Schmidt",
"Richard", "Schmidt"}
"Richard", "Schmidt"},
{"Matthias", "Helsing",
"Mattias", "Helsing"},
{"Clement", "Boesch",
"Cl<EFBFBD>ment", "B<EFBFBD>sch"},
{"Lauren", "Voerman",
"Laurens", "Voerman"},
{"Pjotr", "Sventachov",
"Pjotr", "Svetachov"},
{"Bradley", "Baker",
"Bradley", "Baker Searles"},
{"PawelKsiezopolski", "",
"Pawel", "Ksiezopolski"}
};
@@ -913,7 +994,9 @@ void printContributors(const std::string& changeLog, bool printNumEntries)
cout << "-------------------------" << endl;
for (SortedNameMap::reverse_iterator sitr = sortedNames.rbegin(); sitr != sortedNames.rend(); ++sitr)
{
cout << sitr->first << "\t" << sitr->second.first << " " << sitr->second.second << endl;
cout << sitr->first << "\t" << sitr->second.first;
if (!sitr->second.second.empty()) cout << " " << sitr->second.second;
cout << endl;
}
}
else
@@ -922,7 +1005,9 @@ void printContributors(const std::string& changeLog, bool printNumEntries)
cout << "-----------------" << endl;
for (SortedNameMap::reverse_iterator sitr = sortedNames.rbegin(); sitr != sortedNames.rend(); ++sitr)
{
cout << sitr->second.first << " " << sitr->second.second << endl;
cout << sitr->second.first;
if (!sitr->second.second.empty()) cout << " " << sitr->second.second;
cout << endl;
}
}
}

View File

@@ -28,7 +28,116 @@
#include <osgGA/TerrainManipulator>
#include <osgGA/SphericalManipulator>
#include <osgGA/Device>
#include <iostream>
#include <stdint.h>
#include <osg/GLExtensions>
#ifndef GL_ARB_sync
#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111
#define GL_OBJECT_TYPE 0x9112
#define GL_SYNC_CONDITION 0x9113
#define GL_SYNC_STATUS 0x9114
#define GL_SYNC_FLAGS 0x9115
#define GL_SYNC_FENCE 0x9116
#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117
#define GL_UNSIGNALED 0x9118
#define GL_SIGNALED 0x9119
#define GL_ALREADY_SIGNALED 0x911A
#define GL_TIMEOUT_EXPIRED 0x911B
#define GL_CONDITION_SATISFIED 0x911C
#define GL_WAIT_FAILED 0x911D
#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001
#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull
#endif
class MySwapBuffersCallback : public osg::GraphicsContext::SwapCallback
{
public:
MySwapBuffersCallback():
_extensionInitialized(false),
_glFenceSync(0),
_glIsSync(0),
_glDeleteSync(0),
_glClientWaitSync(0),
_glWaitSync(0),
_glGetInteger64v(0),
_glGetSynciv(0),
_previousSync(0)
{
OSG_NOTICE<<"Created Swap callback."<<std::endl;
}
void setUpExtensions()
{
_extensionInitialized = true;
osg::setGLExtensionFuncPtr(_glFenceSync, "glFenceSync");
osg::setGLExtensionFuncPtr(_glIsSync, "glIsSync");
osg::setGLExtensionFuncPtr(_glDeleteSync, "glDeleteSync");
osg::setGLExtensionFuncPtr(_glClientWaitSync, "glClientWaitSync");
osg::setGLExtensionFuncPtr(_glWaitSync, "glWaitSync");
osg::setGLExtensionFuncPtr(_glGetInteger64v, "glGetInteger64v");
osg::setGLExtensionFuncPtr(_glGetSynciv, "glGetSynciv");
}
virtual void swapBuffersImplementation(osg::GraphicsContext* gc)
{
// OSG_NOTICE<<"Before swap - place to do swap ready sync"<<std::endl;
gc->swapBuffersImplementation();
//glFinish();
if (!_extensionInitialized) setUpExtensions();
if (_glClientWaitSync)
{
if (_previousSync)
{
unsigned int num_seconds = 1;
GLuint64 timeout = num_seconds * ((GLuint64)1000 * 1000 * 1000);
_glClientWaitSync(_previousSync, 0, timeout);
_glDeleteSync(_previousSync);
}
_previousSync = _glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
}
//gc->getState()->checkGLErrors("after glWaitSync");
//OSG_NOTICE<<"After swap"<<std::endl;
}
#ifdef _WIN32
typedef __int64 GLint64;
typedef unsigned __int64 GLuint64;
#else
typedef int64_t GLint64;
typedef uint64_t GLuint64;
#endif
typedef struct __GLsync *GLsync;
typedef GLsync (GL_APIENTRY * PFNGLFENCESYNCPROC) (GLenum condition, GLbitfield flags);
typedef GLboolean (GL_APIENTRY * PFNGLISSYNCPROC) (GLsync sync);
typedef void (GL_APIENTRY * PFNGLDELETESYNCPROC) (GLsync sync);
typedef GLenum (GL_APIENTRY * PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
typedef void (GL_APIENTRY * PFNGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
typedef void (GL_APIENTRY * PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64 *params);
typedef void (GL_APIENTRY * PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
bool _extensionInitialized;
PFNGLFENCESYNCPROC _glFenceSync;
PFNGLISSYNCPROC _glIsSync;
PFNGLDELETESYNCPROC _glDeleteSync;
PFNGLCLIENTWAITSYNCPROC _glClientWaitSync;
PFNGLWAITSYNCPROC _glWaitSync;
PFNGLGETINTEGER64VPROC _glGetInteger64v;
PFNGLGETSYNCIVPROC _glGetSynciv;
GLsync _previousSync;
};
int main(int argc, char** argv)
{
@@ -41,6 +150,9 @@ int main(int argc, char** argv)
arguments.getApplicationUsage()->addCommandLineOption("--image <filename>","Load an image and render it on a quad");
arguments.getApplicationUsage()->addCommandLineOption("--dem <filename>","Load an image/DEM and render it on a HeightField");
arguments.getApplicationUsage()->addCommandLineOption("--login <url> <username> <password>","Provide authentication information for http file access.");
arguments.getApplicationUsage()->addCommandLineOption("-p <filename>","Play specified camera path animation file, previously saved with 'z' key.");
arguments.getApplicationUsage()->addCommandLineOption("--speed <factor>","Speed factor for animation playing (1 == normal speed).");
arguments.getApplicationUsage()->addCommandLineOption("--device <device-name>","add named device to the viewer");
osgViewer::Viewer viewer(arguments);
@@ -77,6 +189,16 @@ int main(int argc, char** argv)
}
}
std::string device;
while(arguments.read("--device", device))
{
osg::ref_ptr<osgGA::Device> dev = osgDB::readFile<osgGA::Device>(device);
if (dev.valid())
{
viewer.addDevice(dev.get());
}
}
// set up the camera manipulators.
{
osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator;
@@ -110,6 +232,8 @@ int main(int argc, char** argv)
viewer.setCameraManipulator( keyswitchManipulator.get() );
}
bool doArbSync = arguments.read("--sync");
// add the state manipulator
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
@@ -161,6 +285,18 @@ int main(int argc, char** argv)
viewer.realize();
if (doArbSync)
{
osgViewer::ViewerBase::Contexts contexts;
viewer.getContexts(contexts);
for(osgViewer::ViewerBase::Contexts::iterator itr = contexts.begin();
itr != contexts.end();
++itr)
{
(*itr)->setSwapCallback(new MySwapBuffersCallback);
}
}
return viewer.run();
}

View File

@@ -1,12 +1,12 @@
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
*
* This software is open source and may be redistributed and/or modified under
* This software is open source and may be redistributed and/or modified under
* the terms of the GNU General Public License (GPL) version 2.0.
* The full license is in LICENSE.txt file included with this distribution,.
*
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* include LICENSE.txt for more details.
*/
@@ -33,15 +33,15 @@
#if defined(__linux)
#include <unistd.h>
#include <linux/sockios.h>
#elif defined(__FreeBSD__)
#elif defined(__FreeBSD__) || defined(__DragonFly__)
#include <unistd.h>
#include <sys/sockio.h>
#elif defined(__sgi)
#include <unistd.h>
#include <net/soioctl.h>
#elif defined(__CYGWIN__)
#elif defined(__CYGWIN__)
#include <unistd.h>
#elif defined(__sun)
#elif defined(__sun)
#include <unistd.h>
#include <sys/sockio.h>
#elif defined (__APPLE__)
@@ -240,7 +240,7 @@ void CameraPacket::readEventQueue(osgViewer::Viewer& viewer)
void CameraPacket::writeEventQueue(osgViewer::Viewer& viewer)
{
osg::notify(osg::INFO)<<"recieved events = "<<_events.size()<<std::endl;
osg::notify(osg::INFO)<<"received events = "<<_events.size()<<std::endl;
// copy the events to osgProducer style events.
viewer.getEventQueue()->appendEvents(_events);
@@ -249,7 +249,7 @@ void CameraPacket::writeEventQueue(osgViewer::Viewer& viewer)
//////////////////////////////////////////////////////////////////////////////
//
// Reciever
// Reciever
//
Receiver::Receiver( void )
{
@@ -336,8 +336,9 @@ void Receiver::sync( void )
return;
}
#if defined(__linux) || defined(__FreeBSD__) || defined( __APPLE__ )
socklen_t
#if defined(__linux) || defined(__FreeBSD__) || defined( __APPLE__ ) || \
defined(__DragonFly__)
socklen_t
#else
int
#endif
@@ -380,7 +381,7 @@ void Receiver::sync( void )
//////////////////////////////////////////////////////////////////////////////
//
// Broadcaster
// Broadcaster
//
Broadcaster::Broadcaster( void )
{

View File

@@ -1,12 +1,12 @@
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
*
* This software is open source and may be redistributed and/or modified under
* This software is open source and may be redistributed and/or modified under
* the terms of the GNU General Public License (GPL) version 2.0.
* The full license is in LICENSE.txt file included with this distribution,.
*
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* include LICENSE.txt for more details.
*/
@@ -29,7 +29,7 @@
//
// Class definition for the recipient of a broadcasted message
//
class Receiver
class Receiver
{
public :
@@ -68,7 +68,7 @@ class Receiver
//
// Class definition for broadcasting a buffer to a LAN
//
class Broadcaster
class Broadcaster
{
public :
@@ -84,7 +84,7 @@ class Broadcaster
// Set a recipient host. If this is used, the Broadcaster
// no longer broadcasts, but rather directs UDP packets at
// host.
void setHost( const char *hostname );
void setHost( const char *hostname );
// Sync broadcasts the buffer
void sync( void );
@@ -112,15 +112,15 @@ class Broadcaster
class CameraPacket {
public:
static const unsigned int MAX_NUM_EVENTS;
static const unsigned int SWAP_BYTES_COMPARE;
CameraPacket():_masterKilled(false)
CameraPacket():_masterKilled(false)
{
_byte_order = SWAP_BYTES_COMPARE;
}
void setPacket(const osg::Matrix& matrix,const osg::FrameStamp* frameStamp)
{
_matrix = matrix;
@@ -129,20 +129,20 @@ class CameraPacket {
_frameStamp = *frameStamp;
}
}
void getModelView(osg::Matrix& matrix,float angle_offset=0.0f)
{
matrix = _matrix * osg::Matrix::rotate(osg::DegreesToRadians(angle_offset),0.0f,1.0f,0.0f);
}
void readEventQueue(osgViewer::Viewer& viewer);
void writeEventQueue(osgViewer::Viewer& viewer);
void setMasterKilled(const bool flag) { _masterKilled = flag; }
const bool getMasterKilled() const { return _masterKilled; }
unsigned int _byte_order;
bool _masterKilled;
osg::Matrix _matrix;
@@ -150,11 +150,11 @@ class CameraPacket {
// note don't use a ref_ptr as used elsewhere for FrameStamp
// since we don't want to copy the pointer - but the memory.
// FrameStamp doesn't have a private destructor to allow
// us to do this, even though its a reference counted object.
// us to do this, even though its a reference counted object.
osg::FrameStamp _frameStamp;
osgGA::EventQueue::Events _events;
};
class DataConverter
@@ -186,22 +186,22 @@ class DataConverter
{
if (_currentPtr+1>=_endPtr) return;
*(_currentPtr++) = *(ptr);
*(_currentPtr++) = *(ptr);
}
inline void read1(char* ptr)
{
if (_currentPtr+1>=_endPtr) return;
*(ptr) = *(_currentPtr++);
*(ptr) = *(_currentPtr++);
}
inline void write2(char* ptr)
{
if (_currentPtr+2>=_endPtr) return;
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr);
}
inline void read2(char* ptr)
@@ -210,13 +210,13 @@ class DataConverter
if (_swapBytes)
{
*(ptr+1) = *(_currentPtr++);
*(ptr) = *(_currentPtr++);
*(ptr+1) = *(_currentPtr++);
*(ptr) = *(_currentPtr++);
}
else
{
*(ptr++) = *(_currentPtr++);
*(ptr) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr) = *(_currentPtr++);
}
}
@@ -224,10 +224,10 @@ class DataConverter
{
if (_currentPtr+4>=_endPtr) return;
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr);
}
inline void read4(char* ptr)
@@ -236,17 +236,17 @@ class DataConverter
if (_swapBytes)
{
*(ptr+3) = *(_currentPtr++);
*(ptr+2) = *(_currentPtr++);
*(ptr+1) = *(_currentPtr++);
*(ptr) = *(_currentPtr++);
*(ptr+3) = *(_currentPtr++);
*(ptr+2) = *(_currentPtr++);
*(ptr+1) = *(_currentPtr++);
*(ptr) = *(_currentPtr++);
}
else
{
*(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr) = *(_currentPtr++);
}
}
@@ -254,15 +254,15 @@ class DataConverter
{
if (_currentPtr+8>=_endPtr) return;
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr);
}
inline void read8(char* ptr)
@@ -272,27 +272,27 @@ class DataConverter
if (_swapBytes)
{
*(ptr+7) = *(_currentPtr++);
*(ptr+6) = *(_currentPtr++);
*(ptr+5) = *(_currentPtr++);
*(ptr+4) = *(_currentPtr++);
*(ptr+7) = *(_currentPtr++);
*(ptr+6) = *(_currentPtr++);
*(ptr+5) = *(_currentPtr++);
*(ptr+4) = *(_currentPtr++);
*(ptr+3) = *(_currentPtr++);
*(ptr+2) = *(_currentPtr++);
*(ptr+1) = *(_currentPtr++);
*(ptr) = *(_currentPtr++);
*(ptr+3) = *(_currentPtr++);
*(ptr+2) = *(_currentPtr++);
*(ptr+1) = *(_currentPtr++);
*(ptr) = *(_currentPtr++);
}
else
{
*(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr) = *(_currentPtr++);
}
}
@@ -305,14 +305,14 @@ class DataConverter
inline void writeFloat(float c) { write4((char*)&c); }
inline void writeDouble(double c) { write8((char*)&c); }
inline char readChar() { char c; read1(&c); return c; }
inline unsigned char readUChar() { unsigned char c; read1((char*)&c); return c; }
inline short readShort() { short c; read2((char*)&c); return c; }
inline unsigned short readUShort() { unsigned short c; read2((char*)&c); return c; }
inline int readInt() { int c; read4((char*)&c); return c; }
inline unsigned int readUInt() { unsigned int c; read4((char*)&c); return c; }
inline float readFloat() { float c; read4((char*)&c); return c; }
inline double readDouble() { double c; read8((char*)&c); return c; }
inline char readChar() { char c=0; read1(&c); return c; }
inline unsigned char readUChar() { unsigned char c=0; read1((char*)&c); return c; }
inline short readShort() { short c=0; read2((char*)&c); return c; }
inline unsigned short readUShort() { unsigned short c=0; read2((char*)&c); return c; }
inline int readInt() { int c=0; read4((char*)&c); return c; }
inline unsigned int readUInt() { unsigned int c=0; read4((char*)&c); return c; }
inline float readFloat() { float c=0.0f; read4((char*)&c); return c; }
inline double readDouble() { double c=0.0; read8((char*)&c); return c; }
void write(const osg::FrameStamp& fs);
void read(osg::FrameStamp& fs);
@@ -322,13 +322,13 @@ class DataConverter
void write(const osgGA::GUIEventAdapter& event);
void read(osgGA::GUIEventAdapter& event);
void write(CameraPacket& cameraPacket);
void read(CameraPacket& cameraPacket);
char* startPtr() { return _startPtr; }
unsigned int numBytes() { return _numBytes; }
protected:
char* _startPtr;
@@ -341,4 +341,4 @@ class DataConverter
#endif
#endif

View File

@@ -251,8 +251,12 @@ osg::ref_ptr<osg::Node> p3d::readShowFiles(osg::ArgumentParser& arguments,const
if(node)
{
if (node->getName().empty()) node->setName( arguments[pos] );
nodeList.push_back(node);
// make sure that this presentation isn't cached
osgDB::Registry::instance()->removeFromObjectCache( arguments[pos] );
}
}
}

View File

@@ -1,12 +1,12 @@
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
/* -*-c++-*- Present3D - Copyright (C) 1999-2006 Robert Osfield
*
* This software is open source and may be redistributed and/or modified under
* This software is open source and may be redistributed and/or modified under
* the terms of the GNU General Public License (GPL) version 2.0.
* The full license is in LICENSE.txt file included with this distribution,.
*
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* include LICENSE.txt for more details.
*/
@@ -28,6 +28,7 @@
#include <OpenThreads/Thread>
#include <osgGA/GUIEventHandler>
#include <osgGA/TrackballManipulator>
#include <osgGA/FlightManipulator>
#include <osgGA/DriveManipulator>
@@ -127,89 +128,64 @@ void setViewer(osgViewer::Viewer& viewer, float width, float height, float dista
// double hfov = osg::RadiansToDegrees(atan2(width/2.0f,distance)*2.0);
viewer.getCamera()->setProjectionMatrixAsPerspective( vfov, width/height, 0.1, 1000.0);
OSG_NOTICE<<"setProjectionMatrixAsPerspective( "<<vfov<<", "<<width/height<<", "<<0.1<<", "<<1000.0<<");"<<std::endl;
}
#if 1
class ForwardToDeviceEventHandler : public osgGA::GUIEventHandler {
public:
ForwardToDeviceEventHandler(osgGA::Device* device) : osgGA::GUIEventHandler(), _device(device) {}
class RayFollowsMouseCallback : public osg::Drawable::EventCallback
{
RayFollowsMouseCallback() {}
/** do customized Event code. */
virtual void event(osg::NodeVisitor* nv, osg::Drawable* drawable)
virtual bool handle (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa, osg::Object *, osg::NodeVisitor *)
{
osg::Geometry* geometry = drawable->asGeometry();
osgGA::EventVisitor* ev = dynamic_cast<osgGA::EventVisitor*>(nv);
if (!ev || !geometry) return;
osgGA::GUIActionAdapter* aa = ev->getActionAdapter();
osgViewer::View* view = dynamic_cast<osgViewer::View*>(aa);
if (!view) return;
osg::Vec3Array* vertices = dynamic_cast<osg::Vec3Array*>(geometry->getVertexArray());
if (!vertices) return;
osg::Camera* camera = view->getCamera();
osg::Matrix VP = camera->getViewMatrix() * camera->getProjectionMatrix();
osg::Matrix inverse_VP;
inverse_VP.invert(VP);
osgGA::EventQueue::Events& events = ev->getEvents();
for(osgGA::EventQueue::Events::iterator itr = events.begin();
itr != events.end();
++itr)
{
handle(inverse_VP, *(*itr), vertices);
}
OSG_INFO<<"ForwardToDeviceEventHandler::setEvent("<<ea.getKey()<<")"<<std::endl;
_device->sendEvent(ea);
return false;
}
void handle(const osg::Matrix& inverse_VP, osgGA::GUIEventAdapter& ea, osg::Vec3Array* vertices)
{
osg::Vec3d start_eye(ea.getXnormalized(), ea.getYnormalized(), 0.0);
osg::Vec3d end_eye(ea.getXnormalized(), ea.getYnormalized(), 1.0);
osg::Vec3d start_world = start_eye * inverse_VP;
osg::Vec3d end_world = start_eye * inverse_VP;
osg::notify(osg::NOTICE)<<"start_world="<<start_world<<std::endl;
osg::notify(osg::NOTICE)<<"end_world="<<end_world<<std::endl;
(*vertices)[0] = start_world;
(*vertices)[1] = end_world;
}
private:
osg::ref_ptr<osgGA::Device> _device;
};
class FollowMouseCallback: public osgGA::GUIEventHandler
{
public:
FollowMouseCallback():
_mousePostition(0.5,0.5) {}
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object* object, osg::NodeVisitor* nv)
{
osg::AutoTransform* transform = dynamic_cast<osg::AutoTransform*>(object);
if (!transform) return false;
osg::NotifySeverity level = osg::INFO;
switch(ea.getEventType())
{
case(osgGA::GUIEventAdapter::PUSH):
case(osgGA::GUIEventAdapter::RELEASE):
case(osgGA::GUIEventAdapter::MOVE):
case(osgGA::GUIEventAdapter::DRAG):
osg::notify(level)<<std::endl<<"ea.getGraphicsContext()="<<ea.getGraphicsContext()<<std::endl;
osg::notify(level)<<"ea.getWindowWidth()="<<ea.getWindowWidth()<<std::endl;
osg::notify(level)<<"ea.getWindowHeight()="<<ea.getWindowHeight()<<std::endl;
osg::notify(level)<<"ea.getX()="<<ea.getX()<<std::endl;
osg::notify(level)<<"ea.getXin()="<<ea.getXmin()<<std::endl;
osg::notify(level)<<"ea.getXmax()="<<ea.getXmax()<<std::endl;
osg::notify(level)<<"ea.getY()="<<ea.getY()<<std::endl;
osg::notify(level)<<"ea.getYin()="<<ea.getYmin()<<std::endl;
osg::notify(level)<<"ea.getYmax()="<<ea.getYmax()<<std::endl;
_mousePostition.set(ea.getXnormalized(), ea.getYnormalized());
break;
case(osgGA::GUIEventAdapter::FRAME):
//case(osgGA::GUIEventAdapter::MOVE):
//case(osgGA::GUIEventAdapter::DRAG):
{
osgViewer::View* view = dynamic_cast<osgViewer::View*>(&aa);
transform->setNodeMask(0x0);
osg::notify(osg::NOTICE)<<std::endl<<"ea.getGraphicsContext()="<<ea.getGraphicsContext()<<std::endl;
osg::notify(osg::NOTICE)<<"ea.getWindowWidth()="<<ea.getWindowWidth()<<std::endl;
osg::notify(osg::NOTICE)<<"ea.getWindowHeight()="<<ea.getWindowHeight()<<std::endl;
osg::notify(osg::NOTICE)<<"ea.getX()="<<ea.getX()<<std::endl;
osg::notify(osg::NOTICE)<<"ea.getXin()="<<ea.getXmin()<<std::endl;
osg::notify(osg::NOTICE)<<"ea.getXmax()="<<ea.getXmax()<<std::endl;
osg::notify(osg::NOTICE)<<"ea.getY()="<<ea.getY()<<std::endl;
osg::notify(osg::NOTICE)<<"ea.getYin()="<<ea.getYmin()<<std::endl;
osg::notify(osg::NOTICE)<<"ea.getYmax()="<<ea.getYmax()<<std::endl;
osg::Camera* camera = view->getCamera();
osg::Matrix VP = camera->getViewMatrix() * camera->getProjectionMatrix();
@@ -217,18 +193,20 @@ class FollowMouseCallback: public osgGA::GUIEventHandler
osg::Matrix inverse_VP;
inverse_VP.invert(VP);
osg::Vec3d start_eye(ea.getXnormalized(), ea.getYnormalized(), 0.0);
osg::Vec3d end_eye(ea.getXnormalized(), ea.getYnormalized(), 1.0);
osg::Vec3d start_eye(_mousePostition.x(), _mousePostition.y(), 0.0);
osg::Vec3d end_eye(_mousePostition.x(), _mousePostition.y(), 1.0);
osg::Vec3d start_world = start_eye * inverse_VP;
osg::Vec3d end_world = start_eye * inverse_VP;
osg::notify(osg::NOTICE)<<"start_world="<<start_world<<std::endl;
osg::notify(osg::NOTICE)<<"end_world="<<end_world<<std::endl;
osg::notify(level)<<"start_world="<<start_world<<std::endl;
osg::notify(level)<<"end_world="<<end_world<<std::endl;
transform->setPosition(end_world);
transform->setNodeMask(0xffffffff);
if (end_world.valid()) transform->setPosition(end_world);
else
{
OSG_NOTICE<<"Ignoring invalid end_world position"<<std::endl;
}
break;
}
@@ -258,6 +236,7 @@ class FollowMouseCallback: public osgGA::GUIEventHandler
v.visit(*this);
}
osg::Vec2d _mousePostition;
};
osg::Node* createCursorSubgraph(const std::string& filename, float size)
@@ -267,13 +246,14 @@ osg::Node* createCursorSubgraph(const std::string& filename, float size)
size = 20.0f;
osg::Geometry* geom = osg::createTexturedQuadGeometry(osg::Vec3(-size*0.5f,-size*0.5f,0.0f),osg::Vec3(size,0.0f,0.0f),osg::Vec3(0.0f,size,0.0f));
geom->getOrCreateStateSet()->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
osg::Image* image = osgDB::readImageFile(osgDB::findDataFile(filename));
if (image)
{
osg::StateSet* stateset = geom->getOrCreateStateSet();
stateset->setTextureAttributeAndModes(0, new osg::Texture2D(image),osg::StateAttribute::ON);
stateset->setMode(GL_BLEND,osg::StateAttribute::ON);
stateset->setTextureAttributeAndModes(0, new osg::Texture2D(image),osg::StateAttribute::ON|osg::StateAttribute::PROTECTED);
stateset->setMode(GL_BLEND,osg::StateAttribute::ON|osg::StateAttribute::PROTECTED);
// stateset->setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);
stateset->setRenderBinDetails(1000, "DepthSortedBin");
}
@@ -291,101 +271,6 @@ osg::Node* createCursorSubgraph(const std::string& filename, float size)
return transform;
}
#else
class FollowMouseCallback: public osgGA::GUIEventHandler
{
public:
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&, osg::Object* object, osg::NodeVisitor*)
{
switch(ea.getEventType())
{
case(osgGA::GUIEventAdapter::MOVE):
case(osgGA::GUIEventAdapter::DRAG):
{
osg::Camera* camera = dynamic_cast<osg::Camera*>(object);
if (camera)
{
double x = ea.getXnormalized();
double y = ea.getYnormalized();
camera->setViewMatrix(osg::Matrixd::translate(x,y,0.0));
}
break;
}
case(osgGA::GUIEventAdapter::KEYDOWN):
{
if (ea.getKey()=='c')
{
osg::Camera* camera = dynamic_cast<osg::Camera*>(object);
if (camera)
{
for(unsigned int i=0; i< camera->getNumChildren(); ++i)
{
osg::Node* node = camera->getChild(i);
node->setNodeMask(
node->getNodeMask()!=0 ?
0 :
0xffffff);
}
}
}
break;
}
default:
break;
}
return false;
}
virtual void accept(osgGA::GUIEventHandlerVisitor& v)
{
v.visit(*this);
}
};
osg::Node* createCursorSubgraph(const std::string& filename, float size)
{
osg::Geode* geode = new osg::Geode;
osg::Geometry* geom = osg::createTexturedQuadGeometry(osg::Vec3(-size*0.5f,-size*0.5f,0.0f),osg::Vec3(size,0.0f,0.0f),osg::Vec3(0.0f,size,0.0f));
osg::Image* image = osgDB::readImageFile(osgDB::findDataFile(filename));
if (image)
{
osg::StateSet* stateset = geom->getOrCreateStateSet();
stateset->setTextureAttributeAndModes(0, new osg::Texture2D(image),osg::StateAttribute::ON);
stateset->setMode(GL_BLEND,osg::StateAttribute::ON);
stateset->setRenderBinDetails(1000, "DepthSortedBin");
}
geode->addDrawable(geom);
osg::Camera* camera = new osg::Camera;
// set the projection matrix
camera->setProjectionMatrix(osg::Matrix::ortho2D(-1,1,-1,1));
// 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::CameraNode::NESTED_RENDER);
camera->addChild(geode);
camera->setEventCallback(new FollowMouseCallback());
return camera;
}
#endif
enum P3DApplicationType
@@ -396,12 +281,53 @@ enum P3DApplicationType
};
void processLoadedModel(osg::ref_ptr<osg::Node>& loadedModel, int optimizer_options, const std::string& cursorFileName)
{
if (!loadedModel) return;
#if !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
// add back in enabling of the GL_ALPHA_TEST to get around the core OSG no longer setting it by default for opaque bins.
// the alpha test is required for the volume rendering alpha clipping to work.
loadedModel->getOrCreateStateSet()->setMode(GL_ALPHA_TEST, osg::StateAttribute::ON);
#endif
// optimize the scene graph, remove rendundent nodes and state etc.
osgUtil::Optimizer optimizer;
optimizer.optimize(loadedModel.get(), optimizer_options);
if (!cursorFileName.empty())
{
osg::ref_ptr<osg::Group> group = new osg::Group;
group->addChild(loadedModel.get());
group->addChild(createCursorSubgraph(cursorFileName, 0.05f));
loadedModel = group;
}
}
void addDeviceTo(osgViewer::Viewer& viewer, const std::string& device_name)
{
osg::ref_ptr<osgGA::Device> dev = osgDB::readFile<osgGA::Device>(device_name);
if (dev.valid())
{
OSG_INFO << "Adding Device : " << device_name << std::endl;
viewer.addDevice(dev.get());
if (dev->getCapabilities() & osgGA::Device::SEND_EVENTS)
viewer.getEventHandlers().push_front(new ForwardToDeviceEventHandler(dev.get()));
}
else
{
OSG_WARN << "could not open device: " << device_name << std::endl;
}
}
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()->setApplicationName(arguments.getApplicationName());
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the application for presenting 3D interactive slide shows.");
@@ -442,13 +368,28 @@ int main( int argc, char **argv )
osg::DisplaySettings::instance()->readEnvironmentalVariables();
}
// set up any logins required for http access
std::string url, username, password;
while(arguments.read("--login",url, username, password))
{
if (!osgDB::Registry::instance()->getAuthenticationMap())
{
osgDB::Registry::instance()->setAuthenticationMap(new osgDB::AuthenticationMap);
osgDB::Registry::instance()->getAuthenticationMap()->addAuthenticationDetails(
url,
new osgDB::AuthenticationDetails(username, password)
);
}
}
#ifdef USE_SDL
SDLIntegration sdlIntegration;
osg::notify(osg::INFO)<<"USE_SDL"<<std::endl;
#endif
#endif
bool doSetViewer = true;
std::string configurationFile;
@@ -461,7 +402,7 @@ int main( int argc, char **argv )
while (arguments.read("-c",configurationFile)) {}
osg::Vec4 clearColor(0.0f,0.0f,0.0f,0.0f);
while (arguments.read("--clear-color",clearColor[0],clearColor[1],clearColor[2],clearColor[3])) {}
std::string filename;
@@ -500,7 +441,7 @@ int main( int argc, char **argv )
// construct the viewer.
osgViewer::Viewer viewer(arguments);
// set clear colour to black by default.
viewer.getCamera()->setClearColor(clearColor);
@@ -509,11 +450,60 @@ int main( int argc, char **argv )
viewer.readConfiguration(configurationFile);
doSetViewer = false;
}
const char* p3dDevice = getenv("P3D_DEVICE");
if (p3dDevice)
{
osgDB::StringList devices;
osgDB::split(p3dDevice, devices);
for(osgDB::StringList::iterator i = devices.begin(); i != devices.end(); ++i)
{
addDeviceTo(viewer, *i);
}
}
std::string device;
while (arguments.read("--device", device))
{
addDeviceTo(viewer, device);
}
if (arguments.read("--http-control"))
{
std::string server_address = "localhost";
std::string server_port = "8080";
std::string document_root = "htdocs";
while (arguments.read("--http-server-address", server_address)) {}
while (arguments.read("--http-server-port", server_port)) {}
while (arguments.read("--http-document-root", document_root)) {}
osg::ref_ptr<osgDB::Options> device_options = new osgDB::Options("documentRegisteredHandlers");
osg::ref_ptr<osgGA::Device> rest_http_device = osgDB::readFile<osgGA::Device>(server_address+":"+server_port+"/"+document_root+".resthttp", device_options.get());
if (rest_http_device.valid())
{
viewer.addDevice(rest_http_device.get());
}
}
// set up stereo masks
viewer.getCamera()->setCullMask(0xffffffff);
viewer.getCamera()->setCullMaskLeft(0x00000001);
viewer.getCamera()->setCullMaskRight(0x00000002);
viewer.getCamera()->setCullMaskRight(0x00000002);
bool assignLeftCullMaskForMono = true;
if (assignLeftCullMaskForMono)
{
viewer.getCamera()->setCullMask(viewer.getCamera()->getCullMaskLeft());
}
else
{
viewer.getCamera()->setCullMask(0xffffffff);
}
// set up the camera manipulators.
{
@@ -529,7 +519,7 @@ int main( int argc, char **argv )
while (arguments.read("-p",pathfile))
{
osgGA::AnimationPathManipulator* apm = new osgGA::AnimationPathManipulator(pathfile);
if (apm || !apm->valid())
if (apm || !apm->valid())
{
unsigned int num = keyswitchManipulator->getNumMatrixManipulators();
keyswitchManipulator->addMatrixManipulator( keyForAnimationPath, "Path", apm );
@@ -542,7 +532,9 @@ int main( int argc, char **argv )
}
// add the state manipulator
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
osg::ref_ptr<osgGA::StateSetManipulator> ssManipulator = new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet());
ssManipulator->setKeyEventToggleTexturing('e');
viewer.addEventHandler( ssManipulator.get() );
// add the state manipulator
viewer.addEventHandler( new osgViewer::StatsHandler() );
@@ -557,11 +549,20 @@ int main( int argc, char **argv )
std::string cursorFileName( p3dCursor ? p3dCursor : "");
while (arguments.read("--cursor",cursorFileName)) {}
const char* p3dShowCursor = getenv("P3D_SHOW_CURSOR");
std::string showCursor( p3dShowCursor ? p3dShowCursor : "YES");
while (arguments.read("--show-cursor")) { showCursor="YES"; }
while (arguments.read("--hide-cursor")) { showCursor="NO"; }
bool hideCursor = (showCursor=="No" || showCursor=="NO" || showCursor=="no");
while (arguments.read("--set-viewer")) { doSetViewer = true; }
while (arguments.read("--no-set-viewer")) { doSetViewer = false; }
// if we want to hide the cursor override the custom cursor.
if (hideCursor) cursorFileName.clear();
// cluster related entries.
int socketNumber=8100;
@@ -589,10 +590,29 @@ int main( int argc, char **argv )
bool loopPresentation = false;
while (arguments.read("--loop")) loopPresentation = true;
{
// set update hte default traversal mode settings for update visitor
// default to osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN.
osg::NodeVisitor::TraversalMode updateTraversalMode = osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN; // viewer.getUpdateVisitor()->getTraversalMode();
const char* p3dUpdateStr = getenv("P3D_UPDATE");
if (p3dUpdateStr)
{
std::string updateStr(p3dUpdateStr);
if (updateStr=="active" || updateStr=="Active" || updateStr=="ACTIVE") updateTraversalMode = osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN;
else if (updateStr=="all" || updateStr=="All" || updateStr=="ALL") updateTraversalMode = osg::NodeVisitor::TRAVERSE_ALL_CHILDREN;
}
while(arguments.read("--update-active")) updateTraversalMode = osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN;
while(arguments.read("--update-all")) updateTraversalMode = osg::NodeVisitor::TRAVERSE_ALL_CHILDREN;
viewer.getUpdateVisitor()->setTraversalMode(updateTraversalMode);
}
// register the slide event handler - which moves the presentation from slide to slide, layer to layer.
osgPresentation::SlideEventHandler* seh = new osgPresentation::SlideEventHandler(&viewer);
viewer.addEventHandler(seh);
osg::ref_ptr<osgPresentation::SlideEventHandler> seh = new osgPresentation::SlideEventHandler(&viewer);
viewer.addEventHandler(seh.get());
seh->setAutoSteppingActive(autoSteppingActive);
seh->setTimeDelayBetweenSlides(timeDelayBetweenSlides);
@@ -610,7 +630,7 @@ int main( int argc, char **argv )
// set up optimizer options
unsigned int optimizer_options = osgUtil::Optimizer::DEFAULT_OPTIMIZATIONS;
bool relase_and_compile = false;
while (arguments.read("--release-and-compile"))
while (arguments.read("--release-and-compile"))
{
relase_and_compile = true;
}
@@ -621,26 +641,34 @@ int main( int argc, char **argv )
viewer.getDatabasePager()->setUnrefImageDataAfterApplyPolicy(true,false);
optimizer_options &= ~osgUtil::Optimizer::OPTIMIZE_TEXTURE_SETTINGS;
}
//
//
// osgDB::Registry::instance()->getOrCreateDatabasePager()->setUnrefImageDataAfterApplyPolicy(true,false);
// optimizer_options &= ~osgUtil::Optimizer::OPTIMIZE_TEXTURE_SETTINGS;
// osg::Texture::getTextureObjectManager()->setExpiryDelay(0.0f);
// osgDB::Registry::instance()->getOrCreateDatabasePager()->setExpiryDelay(1.0f);
// register the handler for modifying the point size
PointsEventHandler* peh = new PointsEventHandler;
viewer.addEventHandler(peh);
osg::ref_ptr<PointsEventHandler> peh = new PointsEventHandler;
viewer.addEventHandler(peh.get());
// add the screen capture handler
std::string screenCaptureFilename = "screen_shot.jpg";
while(arguments.read("--screenshot", screenCaptureFilename)) {}
osg::ref_ptr<osgViewer::ScreenCaptureHandler::WriteToFile> writeFile = new osgViewer::ScreenCaptureHandler::WriteToFile(
osgDB::getNameLessExtension(screenCaptureFilename),
osgDB::getFileExtension(screenCaptureFilename) );
osg::ref_ptr<osgViewer::ScreenCaptureHandler> screenCaptureHandler = new osgViewer::ScreenCaptureHandler(writeFile.get());
screenCaptureHandler->setKeyEventTakeScreenShot('m');//osgGA::GUIEventAdapter::KEY_Print);
screenCaptureHandler->setKeyEventToggleContinuousCapture('M');
viewer.addEventHandler(screenCaptureHandler.get());
// osg::DisplaySettings::instance()->setSplitStereoAutoAjustAspectRatio(false);
float width = osg::DisplaySettings::instance()->getScreenWidth();
float height = osg::DisplaySettings::instance()->getScreenHeight();
float distance = osg::DisplaySettings::instance()->getScreenDistance();
bool sizesSpecified = false;
while (arguments.read("-s", width, height, distance))
while (arguments.read("-s", width, height, distance))
{
sizesSpecified = true;
osg::DisplaySettings::instance()->setScreenDistance(distance);
osg::DisplaySettings::instance()->setScreenHeight(height);
osg::DisplaySettings::instance()->setScreenWidth(width);
@@ -669,11 +697,11 @@ int main( int argc, char **argv )
else if (strcmp(str,"master")==0) P3DApplicationType = MASTER;
else if (strcmp(str,"slave")==0) P3DApplicationType = SLAVE;
}
while (arguments.read("--viewer")) { P3DApplicationType = VIEWER; }
while (arguments.read("--master")) { P3DApplicationType = MASTER; }
while (arguments.read("--slave")) { P3DApplicationType = SLAVE; }
while (arguments.read("--version"))
{
std::string appTypeName = "invalid";
@@ -762,7 +790,7 @@ int main( int argc, char **argv )
// if no model has been successfully loaded report failure.
if (!loadedModel)
if (!loadedModel)
{
osg::notify(osg::INFO) << arguments.getApplicationName() <<": No data loaded" << std::endl;
return 1;
@@ -778,12 +806,12 @@ int main( int argc, char **argv )
for(unsigned int i=0; i<loadedModel->getNumDescriptions(); ++i)
{
const std::string& desc = loadedModel->getDescription(i);
if (desc=="loop")
if (desc=="loop")
{
osg::notify(osg::NOTICE)<<"Enabling looping"<<std::endl;
seh->setLoopPresentation(true);
}
else if (desc=="auto")
else if (desc=="auto")
{
osg::notify(osg::NOTICE)<<"Enabling auto run"<<std::endl;
seh->setAutoSteppingActive(true);
@@ -792,26 +820,7 @@ int main( int argc, char **argv )
}
#if !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
// add back in enabling of the GL_ALPHA_TEST to get around the core OSG no longer setting it by default for opaque bins.
// the alpha test is required for the volume rendering alpha clipping to work.
loadedModel->getOrCreateStateSet()->setMode(GL_ALPHA_TEST, osg::StateAttribute::ON);
#endif
// optimize the scene graph, remove rendundent nodes and state etc.
osgUtil::Optimizer optimizer;
optimizer.optimize(loadedModel.get(), optimizer_options);
if (!cursorFileName.empty())
{
osg::ref_ptr<osg::Group> group = new osg::Group;
group->addChild(loadedModel.get());
group->addChild(createCursorSubgraph(cursorFileName, 0.05f));
loadedModel = group.get();
}
processLoadedModel(loadedModel, optimizer_options, cursorFileName);
// set the scene to render
viewer.setSceneData(loadedModel.get());
@@ -830,7 +839,23 @@ int main( int argc, char **argv )
viewerInitialized = true;
}
if (!cursorFileName.empty())
// pass the model to the slide event handler so it knows which to manipulate.
seh->set(loadedModel.get());
seh->selectSlide(0);
seh->home();
if (!outputFileName.empty())
{
osgDB::writeNodeFile(*loadedModel,outputFileName);
return 0;
}
if (!cursorFileName.empty() || hideCursor)
{
// have to add a frame in here to avoid problems with X11 threading issue on switching off the cursor
// not yet sure why it makes a difference, but it at least fixes the crash that would otherwise occur
@@ -848,21 +873,9 @@ int main( int argc, char **argv )
}
}
// pass the model to the slide event handler so it knows which to manipulate.
seh->set(loadedModel.get());
seh->selectSlide(0);
seh->home();
if (!outputFileName.empty())
{
osgDB::writeNodeFile(*loadedModel,outputFileName);
return 0;
}
osg::Timer_t startOfFrameTick = osg::Timer::instance()->tick();
double targetFrameTime = 1.0/targetFrameRate;
if (exportName.empty())
{
// objects for managing the broadcasting and recieving of camera packets.
@@ -891,7 +904,7 @@ int main( int argc, char **argv )
startOfFrameTick = osg::Timer::instance()->tick();
#if 0
#if 0
if (kmcb)
{
double time = kmcb->getTime();
@@ -907,9 +920,9 @@ int main( int argc, char **argv )
{
// take camera zero as the guide.
osg::Matrix modelview(viewer.getCamera()->getViewMatrix());
cp.setPacket(modelview,viewer.getFrameStamp());
// cp.readEventQueue(viewer);
scratchPad.reset();
@@ -919,7 +932,7 @@ int main( int argc, char **argv )
scratchPad.read(cp);
bc.setBuffer(scratchPad.startPtr(), scratchPad.numBytes());
std::cout << "bc.sync()"<<scratchPad.numBytes()<<std::endl;
bc.sync();
@@ -929,13 +942,13 @@ int main( int argc, char **argv )
rc.setBuffer(scratchPad.startPtr(), scratchPad.numBytes());
rc.sync();
scratchPad.reset();
scratchPad.read(cp);
// cp.writeEventQueue(viewer);
if (cp.getMasterKilled())
if (cp.getMasterKilled())
{
std::cout << "Received master killed."<<std::endl;
// break out of while (!done) loop since we've now want to shut down.
@@ -947,6 +960,31 @@ int main( int argc, char **argv )
// call all node update callbacks and animations.
viewer.eventTraversal();
if (seh->getRequestReload())
{
OSG_INFO<<"Reload requested"<<std::endl;
seh->setRequestReload(false);
int previous_ActiveSlide = seh->getActiveSlide();
int previous_ActiveLayer = seh->getActiveLayer();
// reset time so any event key generate
loadedModel = p3d::readShowFiles(arguments,cacheAllOption.get());
processLoadedModel(loadedModel, optimizer_options, cursorFileName);
if (!loadedModel)
{
return 0;
}
viewer.setSceneData(loadedModel.get());
seh->set(loadedModel.get());
seh->selectSlide(previous_ActiveSlide, previous_ActiveLayer);
continue;
}
// update the scene by traversing it with the the update visitor which will
// call all node update callbacks and animations.
viewer.updateTraversal();
@@ -966,9 +1004,9 @@ int main( int argc, char **argv )
}
else
{
ExportHTML::write(seh, viewer, exportName);
ExportHTML::write(seh.get(), viewer, exportName);
}
return 0;
}

View File

@@ -31,7 +31,6 @@ SHORT_NAMES = YES
JAVADOC_AUTOBRIEF = YES
QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 8
@@ -76,7 +75,6 @@ GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_DIRECTORIES = NO
SHOW_FILES = YES
SHOW_NAMESPACES = YES
FILE_VERSION_FILTER =
@@ -138,7 +136,6 @@ HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER = ${OpenSceneGraph_SOURCE_DIR}/doc/Doxyfiles/custom_Footer.html
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Doxygen generated docs"

View File

@@ -31,7 +31,6 @@ SHORT_NAMES = YES
JAVADOC_AUTOBRIEF = YES
QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 8
@@ -76,7 +75,6 @@ GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_DIRECTORIES = NO
SHOW_FILES = YES
SHOW_NAMESPACES = YES
FILE_VERSION_FILTER =
@@ -151,7 +149,6 @@ HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER = ${OpenSceneGraph_SOURCE_DIR}/doc/Doxyfiles/custom_Footer.html
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Doxygen generated docs"

View File

@@ -128,13 +128,6 @@ JAVADOC_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
# If the DETAILS_AT_TOP tag is set to YES then Doxygen
# will output the detailed description near the top, like JavaDoc.
# If set to NO, the detailed description appears after the member
# documentation.
DETAILS_AT_TOP = NO
# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
# member inherits the documentation from any documented member that it
# re-implements.
@@ -571,12 +564,6 @@ HTML_FOOTER =
HTML_STYLESHEET =
# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
# files or namespaces will be aligned in HTML using tables. If set to
# NO a bullet list will be used.
HTML_ALIGN_MEMBERS = YES
# If the GENERATE_HTMLHELP tag is set to YES, additional index files
# will be generated that can be used as input for tools like the
# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)

View File

@@ -21,7 +21,6 @@ SHORT_NAMES = YES
JAVADOC_AUTOBRIEF = YES
QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 8
@@ -66,7 +65,6 @@ GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_DIRECTORIES = NO
SHOW_FILES = YES
SHOW_NAMESPACES = YES
FILE_VERSION_FILTER =
@@ -141,7 +139,6 @@ HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER = ${OpenSceneGraph_SOURCE_DIR}/doc/Doxyfiles/custom_Footer.html
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Doxygen generated docs"

View File

@@ -66,7 +66,6 @@ GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_DIRECTORIES = YES
SHOW_FILES = YES
SHOW_NAMESPACES = YES
FILE_VERSION_FILTER =
@@ -141,7 +140,6 @@ HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER = "${OpenSceneGraph_SOURCE_DIR}/doc/Doxyfiles/custom_Footer.html"
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
HTML_DYNAMIC_SECTIONS = NO
GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Doxygen generated docs"

View File

@@ -66,7 +66,6 @@ GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_DIRECTORIES = YES
SHOW_FILES = YES
SHOW_NAMESPACES = YES
FILE_VERSION_FILTER =
@@ -126,7 +125,6 @@ HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_FOOTER = "${OpenSceneGraph_SOURCE_DIR}/doc/Doxyfiles/custom_Footer.html"
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
HTML_DYNAMIC_SECTIONS = NO
GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Doxygen generated docs"

View File

@@ -4,14 +4,14 @@
SET(TARGET_DEFAULT_PREFIX "example_")
SET(TARGET_DEFAULT_LABEL_PREFIX "Examples")
SET(TARGET_COMMON_LIBRARIES
SET(TARGET_COMMON_LIBRARIES
OpenThreads
osg
osgDB
osg
osgDB
osgUtil
osgGA
osgViewer
osgText
osgViewer
osgText
)
IF(ANDROID)
@@ -23,6 +23,7 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osg2cpp)
ADD_SUBDIRECTORY(osganalysis)
ADD_SUBDIRECTORY(osganimate)
ADD_SUBDIRECTORY(osgatomiccounter)
ADD_SUBDIRECTORY(osgautocapture)
ADD_SUBDIRECTORY(osgautotransform)
ADD_SUBDIRECTORY(osgbillboard)
@@ -45,9 +46,9 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgfont)
ADD_SUBDIRECTORY(osgforest)
ADD_SUBDIRECTORY(osgfxbrowser)
ADD_SUBDIRECTORY(osgframerenderer)
ADD_SUBDIRECTORY(osgoutline)
ADD_SUBDIRECTORY(osggameoflife)
ADD_SUBDIRECTORY(osggeodemo)
ADD_SUBDIRECTORY(osggeometry)
ADD_SUBDIRECTORY(osggeometryshaders)
ADD_SUBDIRECTORY(osghangglide)
@@ -58,6 +59,7 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgkdtree)
ADD_SUBDIRECTORY(osgkeyboard)
ADD_SUBDIRECTORY(osgkeyboardmouse)
ADD_SUBDIRECTORY(osgkeystone)
ADD_SUBDIRECTORY(osglauncher)
ADD_SUBDIRECTORY(osglight)
ADD_SUBDIRECTORY(osglightpoint)
@@ -67,13 +69,16 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osggraphicscost)
ADD_SUBDIRECTORY(osgmanipulator)
ADD_SUBDIRECTORY(osgmovie)
ADD_SUBDIRECTORY(osgmultiplemovies)
ADD_SUBDIRECTORY(osgmultiplerendertargets)
ADD_SUBDIRECTORY(osgmultitexture)
ADD_SUBDIRECTORY(osgmultitexturecontrol)
ADD_SUBDIRECTORY(osgmultitouch)
ADD_SUBDIRECTORY(osgmultiviewpaging)
ADD_SUBDIRECTORY(osgoccluder)
ADD_SUBDIRECTORY(osgocclusionquery)
ADD_SUBDIRECTORY(osgoit)
ADD_SUBDIRECTORY(osgoscdevice)
ADD_SUBDIRECTORY(osgpackeddepthstencil)
ADD_SUBDIRECTORY(osgpagedlod)
ADD_SUBDIRECTORY(osgparametric)
@@ -101,6 +106,7 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgshadow)
ADD_SUBDIRECTORY(osgshape)
ADD_SUBDIRECTORY(osgsharedarray)
ADD_SUBDIRECTORY(osgsimpleshaders)
ADD_SUBDIRECTORY(osgsimplifier)
ADD_SUBDIRECTORY(osgsimulation)
ADD_SUBDIRECTORY(osgsidebyside)
@@ -153,6 +159,9 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgwidgetwindow)
ADD_SUBDIRECTORY(osguserdata)
# GL3/GL4 example
ADD_SUBDIRECTORY(osgsimplegl3)
IF(OSG_CPP_EXCEPTIONS_AVAILABLE)
ADD_SUBDIRECTORY(osgunittests)
ADD_SUBDIRECTORY(osgmemorytest)
@@ -170,6 +179,8 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgphotoalbum)
ADD_SUBDIRECTORY(osgtessellate)
ADD_SUBDIRECTORY(osgtessellationshaders)
ADD_SUBDIRECTORY(osgcomputeshaders)
ADD_SUBDIRECTORY(osgpdf)
@@ -189,34 +200,35 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgviewerFOX)
ENDIF(FOX_FOUND)
IF (wxWidgets_FOUND)
ADD_SUBDIRECTORY(osgviewerWX)
ENDIF(wxWidgets_FOUND)
IF (wxWidgets_FOUND AND CMAKE_BUILD_TYPE)
IF (${CMAKE_BUILD_TYPE} STREQUAL "Release")
ADD_SUBDIRECTORY(osgviewerWX)
ENDIF()
ENDIF()
IF (QT_FOUND AND NOT OSG_GLES1_AVAILABLE AND NOT OSG_GLES2_AVAILABLE AND NOT OSG_GL3_AVAILABLE)
OPTION(BUILD_QT_EXAMPLES "Enable the build of the examples that depend on Qt" ON)
IF ( (QT4_FOUND OR Qt5Widgets_FOUND) AND NOT OSG_GLES1_AVAILABLE AND NOT OSG_GLES2_AVAILABLE AND NOT OSG_GL3_AVAILABLE)
IF (BUILD_QT_EXAMPLES AND QT_QTOPENGL_LIBRARY)
IF ( QT4_FOUND OR Qt5Widgets_FOUND)
ADD_SUBDIRECTORY(osgviewerQt)
ADD_SUBDIRECTORY(osgqfont)
ENDIF()
IF (BUILD_QT_EXAMPLES AND QT4_FOUND AND QT_QTWEBKIT_FOUND)
IF ( (QT4_FOUND AND QT_QTWEBKIT_FOUND) OR Qt5WebKitWidgets_FOUND )
ADD_SUBDIRECTORY(osgQtWidgets)
ADD_SUBDIRECTORY(osgQtBrowser)
ENDIF()
ENDIF()
IF (FLTK_FOUND)
IF (FLTK_FOUND AND FLTK_GL_LIBRARY)
ADD_SUBDIRECTORY(osgviewerFLTK)
ENDIF(FLTK_FOUND)
ENDIF()
IF (WIN32)
OPTION(BUILD_MFC_EXAMPLE "Enable the build of the MFC Example" OFF)
IF (BUILD_MFC_EXAMPLE)
IF (BUILD_MFC_EXAMPLE)
ADD_SUBDIRECTORY(osgviewerMFC)
ENDIF(BUILD_MFC_EXAMPLE)
@@ -247,7 +259,7 @@ ELSE(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgviewerIPhone)
ENDIF()
# IPHONE_PORT@tom
ENDIF(DYNAMIC_OPENSCENEGRAPH)
ENDIF(ANDROID)

View File

@@ -66,7 +66,7 @@ int main( int argc, char **argv )
// set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is a utility for converting between various input and output databases formats.");
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is a utility for converting glsl shader files into char arrays that can be compiled into applications.");
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("--shader <filename>","Shader file to create a .cpp file for.");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display command line parameters");

View File

@@ -75,7 +75,7 @@ JNIEXPORT void JNICALL Java_osg_AndroidExample_osgNativeLib_setClearColor(JNIEnv
}
JNIEXPORT void JNICALL Java_osg_AndroidExample_osgNativeLib_loadObject(JNIEnv * env, jobject obj, jstring address){
//Import Strings from JNI
const char *nativeAddress = env->GetStringUTFChars(address, false);
const char *nativeAddress = env->GetStringUTFChars(address, JNI_FALSE);
mainApp.loadObject(std::string(nativeAddress));
@@ -84,8 +84,8 @@ JNIEXPORT void JNICALL Java_osg_AndroidExample_osgNativeLib_loadObject(JNIEnv *
}
JNIEXPORT void JNICALL Java_osg_AndroidExample_osgNativeLib_loadObject(JNIEnv * env, jobject obj, jstring address, jstring name){
//Import Strings from JNI
const char *nativeAddress = env->GetStringUTFChars(address, false);
const char *nativeName = env->GetStringUTFChars(name, false);
const char *nativeAddress = env->GetStringUTFChars(address,JNI_FALSE);
const char *nativeName = env->GetStringUTFChars(name, JNI_FALSE);
mainApp.loadObject(std::string(nativeName),std::string(nativeAddress));

View File

@@ -75,7 +75,7 @@ JNIEXPORT void JNICALL Java_osg_AndroidExample_osgNativeLib_setClearColor(JNIEnv
}
JNIEXPORT void JNICALL Java_osg_AndroidExample_osgNativeLib_loadObject(JNIEnv * env, jobject obj, jstring address){
//Import Strings from JNI
const char *nativeAddress = env->GetStringUTFChars(address, false);
const char *nativeAddress = env->GetStringUTFChars(address, JNI_FALSE);
mainApp.loadObject(std::string(nativeAddress));
@@ -84,8 +84,8 @@ JNIEXPORT void JNICALL Java_osg_AndroidExample_osgNativeLib_loadObject(JNIEnv *
}
JNIEXPORT void JNICALL Java_osg_AndroidExample_osgNativeLib_loadObject(JNIEnv * env, jobject obj, jstring address, jstring name){
//Import Strings from JNI
const char *nativeAddress = env->GetStringUTFChars(address, false);
const char *nativeName = env->GetStringUTFChars(name, false);
const char *nativeAddress = env->GetStringUTFChars(address,JNI_FALSE);
const char *nativeName = env->GetStringUTFChars(name, JNI_FALSE);
mainApp.loadObject(std::string(nativeName),std::string(nativeAddress));

View File

@@ -7,10 +7,19 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
STRING(REGEX REPLACE "-pedantic" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
ENDIF()
SET(TARGET_EXTERNAL_LIBRARIES ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} ${QT_QTWEBKIT_LIBRARY})
INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR})
if ( QT4_FOUND )
SET(TARGET_EXTERNAL_LIBRARIES ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} ${QT_QTWEBKIT_LIBRARY})
INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR} ${QT_QTOPENGL_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR} ${QT_QTWEBKIT_INCLUDE_DIR} )
endif( QT4_FOUND )
SET(TARGET_ADDED_LIBRARIES osgWidget osgQt)
#### end var setup ###
SETUP_EXAMPLE(osgQtBrowser)
SET ( EXAMPLE_NAME osgQtBrowser )
SETUP_EXAMPLE(${EXAMPLE_NAME})
IF ( Qt5Widgets_FOUND )
qt5_use_modules( example_${EXAMPLE_NAME} Widgets OpenGL WebKitWidgets )
ENDIF( Qt5Widgets_FOUND )

View File

@@ -29,14 +29,20 @@
#include <osgViewer/ViewerEventHandlers>
#include <osgWidget/Browser>
#include <QtGlobal>
#if QT_VERSION >= 0x050000
# include <QtWebKitWidgets>
#else
# include <QtWebKit>
#endif
#include <QtWebKit/QWebSettings>
#include <QtWebKit/QtWebKit>
#include <QtGui/QGraphicsScene>
#include <QtGui/QGraphicsView>
#include <QtGui/QApplication>
#include <QtGui/QPainter>
#include <QtGui/QtEvents>
#include <QWebSettings>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QApplication>
#include <QPainter>
#include <QtEvents>
#include <osgQt/QGraphicsViewAdapter>
#include <osgQt/QWebViewImage>

View File

@@ -7,10 +7,17 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
STRING(REGEX REPLACE "-pedantic" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
ENDIF()
SET(TARGET_EXTERNAL_LIBRARIES ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} ${QT_QTWEBKIT_LIBRARY})
INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR})
if ( QT4_FOUND )
SET(TARGET_EXTERNAL_LIBRARIES ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} ${QT_QTWEBKIT_LIBRARY})
INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR} ${QT_QTOPENGL_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR} ${QT_QTWEBKIT_INCLUDE_DIR} )
endif( QT4_FOUND )
SET(TARGET_ADDED_LIBRARIES osgWidget osgQt)
#### end var setup ###
SETUP_EXAMPLE(osgQtWidgets)
SET ( EXAMPLE_NAME osgQtWidgets )
SETUP_EXAMPLE(${EXAMPLE_NAME})
IF ( Qt5Widgets_FOUND )
qt5_use_modules( example_${EXAMPLE_NAME} OpenGL WebKitWidgets )
ENDIF( Qt5Widgets_FOUND )

View File

@@ -36,17 +36,16 @@
#include <osgWidget/Browser>
//#include <QtWebKit/QWebSettings>
//#include <QtWebKit/QtWebKit>
#include <QtGui/QGraphicsScene>
#include <QtGui/QGraphicsView>
#include <QtGui/QApplication>
#include <QtGui/QPainter>
#include <QtGui/QtEvents>
#include <QtGui/QDialog>
#include <QtGui/QVBoxLayout>
#include <QtGui/QMainWindow>
#include <QtOpenGL/QtOpenGL>
//#include <QWebSettings>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QApplication>
#include <QPainter>
#include <QtEvents>
#include <QDialog>
#include <QVBoxLayout>
#include <QMainWindow>
#include <QtOpenGL>
#include <osgQt/QGraphicsViewAdapter>
#include <osgQt/QWebViewImage>
@@ -98,7 +97,11 @@ protected:
virtual void mousePressEvent(QMouseEvent* e)
{
bool ok = false;
#if QT_VERSION >= 0x040500
int val = QInputDialog::getInt(this, "Get integer", "Please enter an integer between 0 and pi", 0, 0, 3, 1, &ok);
#else
int val = QInputDialog::getInteger(this, "Get integer", "Please enter an integer between 0 and pi", 0, 0, 3, 1, &ok);
#endif
std::cout << "Ok was " << (ok ? "" : "not") << " pressed, val is " << val << std::endl;
}
};

View File

@@ -134,11 +134,11 @@ public:
if (_imageProcessor.valid())
{
OSG_NOTICE<<"Will be using ImageProcessor to proces image "<<image->getFileName()<<std::endl;
OSG_NOTICE<<"Will be using ImageProcessor to process image "<<image->getFileName()<<std::endl;
}
else
{
OSG_NOTICE<<"No ImageProcessor to proces image "<<image->getFileName()<<std::endl;
OSG_NOTICE<<"No ImageProcessor to process image "<<image->getFileName()<<std::endl;
}
OSG_NOTICE<<" compressImage "<<_compressImages<<std::endl;
OSG_NOTICE<<" generateMipmaps "<<_generateMipmaps<<std::endl;

View File

@@ -38,46 +38,46 @@
osg::AnimationPath* createAnimationPath(const osg::Vec3& center,float radius,double looptime)
{
// set up the animation path
// 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;
return animationPath;
}
osg::Node* createBase(const osg::Vec3& center,float radius)
{
int numTilesX = 10;
int numTilesY = 10;
float width = 2*radius;
float height = 2*radius;
osg::Vec3 v000(center - osg::Vec3(width*0.5f,height*0.5f,0.0f));
osg::Vec3 dx(osg::Vec3(width/((float)numTilesX),0.0,0.0f));
osg::Vec3 dy(osg::Vec3(0.0f,height/((float)numTilesY),0.0f));
// fill in vertices for grid, note numTilesX+1 * numTilesY+1...
osg::Vec3Array* coords = new osg::Vec3Array;
int iy;
@@ -88,54 +88,45 @@ osg::Node* createBase(const osg::Vec3& center,float radius)
coords->push_back(v000+dx*(float)ix+dy*(float)iy);
}
}
//Just two colours - black and white.
osg::Vec4Array* colors = new osg::Vec4Array;
colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f)); // white
colors->push_back(osg::Vec4(0.0f,0.0f,0.0f,1.0f)); // black
int numColors=colors->size();
osg::ref_ptr<osg::DrawElementsUShort> whitePrimitives = new osg::DrawElementsUShort(GL_QUADS);
osg::ref_ptr<osg::DrawElementsUShort> blackPrimitives = new osg::DrawElementsUShort(GL_QUADS);
int numIndicesPerRow=numTilesX+1;
osg::UByteArray* coordIndices = new osg::UByteArray; // assumes we are using less than 256 points...
osg::UByteArray* colorIndices = new osg::UByteArray;
for(iy=0;iy<numTilesY;++iy)
{
for(int ix=0;ix<numTilesX;++ix)
{
// four vertices per quad.
coordIndices->push_back(ix +(iy+1)*numIndicesPerRow);
coordIndices->push_back(ix +iy*numIndicesPerRow);
coordIndices->push_back((ix+1)+iy*numIndicesPerRow);
coordIndices->push_back((ix+1)+(iy+1)*numIndicesPerRow);
// one color per quad
colorIndices->push_back((ix+iy)%numColors);
osg::DrawElementsUShort* primitives = ((iy+ix)%2==0) ? whitePrimitives.get() : blackPrimitives.get();
primitives->push_back(ix +(iy+1)*numIndicesPerRow);
primitives->push_back(ix +iy*numIndicesPerRow);
primitives->push_back((ix+1)+iy*numIndicesPerRow);
primitives->push_back((ix+1)+(iy+1)*numIndicesPerRow);
}
}
// set up a single normal
osg::Vec3Array* normals = new osg::Vec3Array;
normals->push_back(osg::Vec3(0.0f,0.0f,1.0f));
osg::Geometry* geom = new osg::Geometry;
geom->setVertexArray(coords);
geom->setVertexIndices(coordIndices);
geom->setColorArray(colors);
geom->setColorIndices(colorIndices);
geom->setColorBinding(osg::Geometry::BIND_PER_PRIMITIVE);
geom->setNormalArray(normals);
geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,coordIndices->size()));
geom->setColorArray(colors, osg::Array::BIND_PER_PRIMITIVE_SET);
geom->setNormalArray(normals, osg::Array::BIND_OVERALL);
geom->addPrimitiveSet(whitePrimitives.get());
geom->addPrimitiveSet(blackPrimitives.get());
osg::Geode* geode = new osg::Geode;
geode->addDrawable(geom);
return geode;
}
@@ -158,16 +149,16 @@ osg::Node* createMovingModel(const osg::Vec3& center, float radius)
positioned->setMatrix(osg::Matrix::translate(-bs.center())*
osg::Matrix::scale(size,size,size)*
osg::Matrix::rotate(osg::inDegrees(-90.0f),0.0f,0.0f,1.0f));
positioned->addChild(glider);
osg::PositionAttitudeTransform* xform = new osg::PositionAttitudeTransform;
osg::PositionAttitudeTransform* xform = new osg::PositionAttitudeTransform;
xform->setUpdateCallback(new osg::AnimationPathCallback(animationPath,0.0,1.0));
xform->addChild(positioned);
model->addChild(xform);
}
osg::Node* cessna = osgDB::readNodeFile("cessna.osgt");
if (cessna)
{
@@ -179,16 +170,16 @@ osg::Node* createMovingModel(const osg::Vec3& center, float radius)
positioned->setMatrix(osg::Matrix::translate(-bs.center())*
osg::Matrix::scale(size,size,size)*
osg::Matrix::rotate(osg::inDegrees(180.0f),0.0f,0.0f,1.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;
}
@@ -214,10 +205,10 @@ osg::Node* createModel(bool overlay, osgSim::OverlayNode::OverlayTechnique techn
}
else
{
root->addChild(baseModel);
}
root->addChild(movingModel);
return root;
@@ -226,16 +217,16 @@ osg::Node* createModel(bool overlay, osgSim::OverlayNode::OverlayTechnique techn
int main( int argc, char **argv )
{
bool overlay = false;
osg::ArgumentParser arguments(&argc,argv);
while (arguments.read("--overlay")) overlay = true;
osgSim::OverlayNode::OverlayTechnique technique = osgSim::OverlayNode::OBJECT_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY;
while (arguments.read("--object")) { technique = osgSim::OverlayNode::OBJECT_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY; overlay=true; }
while (arguments.read("--ortho") || arguments.read("--orthographic")) { technique = osgSim::OverlayNode::VIEW_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY; overlay=true; }
while (arguments.read("--persp") || arguments.read("--perspective")) { technique = osgSim::OverlayNode::VIEW_DEPENDENT_WITH_PERSPECTIVE_OVERLAY; overlay=true; }
// initialize the viewer.
osgViewer::Viewer viewer;
@@ -246,7 +237,7 @@ int main( int argc, char **argv )
{
return 1;
}
// tilt the scene so the default eye position is looking down on the model.
osg::MatrixTransform* rootnode = new osg::MatrixTransform;
rootnode->setMatrix(osg::Matrix::rotate(osg::inDegrees(30.0f),1.0f,0.0f,0.0f));
@@ -255,7 +246,7 @@ int main( int argc, char **argv )
// run optimization over the scene graph
osgUtil::Optimizer optimzer;
optimzer.optimize(rootnode);
// set the scene to render
viewer.setSceneData(rootnode);
@@ -266,17 +257,17 @@ int main( int argc, char **argv )
#if 0
// use of custom simulation time.
viewer.realize();
double simulationTime = 0.0;
while (!viewer.done())
{
viewer.frame(simulationTime);
simulationTime += 0.001;
}
return 0;
#else

View File

@@ -1,14 +1,14 @@
/* -*-c++-*-
/* -*-c++-*-
* Copyright (C) 2010 Jeremy Moles <cubicool@gmail.com>
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
@@ -50,8 +50,7 @@ osg::Geometry* createEaseMotionGeometry(osgAnimation::Motion* motion) {
geom->setUseDisplayList(false);
geom->setVertexArray(v);
geom->setColorArray(cols);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->setColorArray(cols, osg::Array::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_STRIP, 0, v->size()));
return geom;
@@ -105,11 +104,11 @@ struct ColorLabel: public osgWidget::Label {
setFont("fonts/VeraMono.ttf");
setFontSize(14);
setFontColor(1.0f, 1.0f, 1.0f, 1.0f);
setColor(0.3f, 0.3f, 0.3f, 1.0f);
setPadding(2.0f);
setCanFill(true);
addSize(150.0f, 25.0f);
setLabel(label);
@@ -118,9 +117,9 @@ struct ColorLabel: public osgWidget::Label {
bool mousePush(double, double, const osgWidget::WindowManager*) {
osgWidget::Table* p = dynamic_cast<osgWidget::Table*>(_parent);
if(!p) return false;
p->hide();
const std::string& name = getName();
@@ -232,7 +231,7 @@ struct ColorLabel: public osgWidget::Label {
else if(!name.compare("InOutExpoMotion"))
EASE_MOTION_SAMPLER->setMotion<osgAnimation::InOutExpoMotion>()
;
else EASE_MOTION_SAMPLER->setMotion<osgAnimation::LinearMotion>();
return true;
@@ -240,13 +239,13 @@ struct ColorLabel: public osgWidget::Label {
bool mouseEnter(double, double, const osgWidget::WindowManager*) {
setColor(0.9f, 0.6f, 0.1f, 1.0f);
return true;
}
bool mouseLeave(double, double, const osgWidget::WindowManager*) {
setColor(0.3f, 0.3f, 0.3f, 1.0f);
return true;
}
};
@@ -286,7 +285,7 @@ public:
_window->addWidget(new ColorLabel("OutCircMotion"), 3, 3);
_window->addWidget(new ColorLabel("InCircMotion"), 4, 3);
_window->addWidget(new ColorLabel("InOutCircMotion"), 5, 3);
_window->addWidget(new ColorLabel("OutExpoMotion"), 0, 4);
_window->addWidget(new ColorLabel("InExpoMotion"), 1, 4);
_window->addWidget(new ColorLabel("InOutExpoMotion"), 2, 4);

View File

@@ -115,7 +115,7 @@ struct MyRigTransformHardware : public osgAnimation::RigTransformHardware
{
std::stringstream ss;
ss << "boneWeight" << i;
geom.setVertexAttribData(attribIndex + i, osg::Geometry::ArrayData(getVertexAttrib(i),osg::Geometry::BIND_PER_VERTEX));
geom.setVertexAttribArray(attribIndex + i, getVertexAttrib(i));
}
osg::ref_ptr<osg::StateSet> ss = new osg::StateSet;

View File

@@ -1,14 +1,14 @@
/* -*-c++-*-
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
@@ -27,7 +27,7 @@ class AnimtkUpdateCallback : public osg::NodeCallback
public:
META_Object(osgAnimation, AnimtkUpdateCallback);
AnimtkUpdateCallback()
AnimtkUpdateCallback()
{
_sampler = new osgAnimation::Vec3CubicBezierSampler;
_playing = false;
@@ -46,9 +46,9 @@ public:
/** Callback method called by the NodeVisitor when visiting a node.*/
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
if (nv->getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR &&
nv->getFrameStamp() &&
{
if (nv->getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR &&
nv->getFrameStamp() &&
nv->getFrameStamp()->getFrameNumber() != _lastUpdate) {
_lastUpdate = nv->getFrameStamp()->getFrameNumber();
@@ -89,7 +89,7 @@ class AnimtkStateSetUpdateCallback : public osg::StateSet::Callback
public:
META_Object(osgAnimation, AnimtkStateSetUpdateCallback);
AnimtkStateSetUpdateCallback()
AnimtkStateSetUpdateCallback()
{
_sampler = new osgAnimation::Vec4LinearSampler;
_playing = false;
@@ -109,20 +109,20 @@ public:
/** Callback method called by the NodeVisitor when visiting a node.*/
virtual void operator()(osg::StateSet* state, osg::NodeVisitor* nv)
{
if (state &&
nv->getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR &&
nv->getFrameStamp() &&
nv->getFrameStamp()->getFrameNumber() != _lastUpdate)
{
if (state &&
nv->getVisitorType() == osg::NodeVisitor::UPDATE_VISITOR &&
nv->getFrameStamp() &&
nv->getFrameStamp()->getFrameNumber() != _lastUpdate)
{
_lastUpdate = nv->getFrameStamp()->getFrameNumber();
_currentTime = osg::Timer::instance()->tick();
if (_playing && _sampler.get() && _sampler->getKeyframeContainer())
if (_playing && _sampler.get() && _sampler->getKeyframeContainer())
{
osg::Material* material = dynamic_cast<osg::Material*>(state->getAttribute(osg::StateAttribute::MATERIAL));
if (material)
if (material)
{
osg::Vec4 result;
float t = osg::Timer::instance()->delta_s(_startTime, _currentTime);
@@ -149,7 +149,7 @@ public:
osg::Geode* createAxis()
{
osg::Geode* geode = new osg::Geode;
osg::Geode* geode = new osg::Geode;
osg::ref_ptr<osg::Geometry> geometry (new osg::Geometry());
osg::ref_ptr<osg::Vec3Array> vertices (new osg::Vec3Array());
@@ -168,9 +168,7 @@ osg::Geode* createAxis()
colors->push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
geometry->setColorArray (colors.get());
geometry->setColorBinding (osg::Geometry::BIND_PER_VERTEX);
geometry->setColorArray (colors.get(), osg::Array::BIND_PER_VERTEX);
geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6));
geode->addDrawable( geometry.get() );
@@ -217,7 +215,7 @@ osg::MatrixTransform* setupAnimtkNode()
osgAnimation::Vec3CubicBezierKeyframeContainer* keys = callback->_sampler->getOrCreateKeyframeContainer();
keys->push_back(osgAnimation::Vec3CubicBezierKeyframe(0, osgAnimation::Vec3CubicBezier(
v[0], // pos
v[0] + (v[0] - v[3]), // p1
v[0] + (v[0] - v[3]), // p1
v[1] - (v[1] - v[0]) // p2
)));
keys->push_back(osgAnimation::Vec3CubicBezierKeyframe(2, osgAnimation::Vec3CubicBezier(
@@ -254,7 +252,7 @@ int main (int argc, char* argv[])
osgGA::TrackballManipulator* manipulator = new osgGA::TrackballManipulator();
viewer.setCameraManipulator(manipulator);
osg::Group* root = new osg::Group;
root->setInitialBound(osg::BoundingSphere(osg::Vec3(10,0,10), 30));
root->addChild(createAxis());
@@ -266,7 +264,7 @@ int main (int argc, char* argv[])
viewer.setSceneData( root );
viewer.realize();
while (!viewer.done())
while (!viewer.done())
{
viewer.frame();
}

View File

@@ -1,14 +1,14 @@
/* -*-c++-*-
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
@@ -34,7 +34,7 @@
osg::Geode* createAxis()
{
osg::Geode* geode (new osg::Geode());
osg::Geode* geode (new osg::Geode());
osg::Geometry* geometry (new osg::Geometry());
osg::Vec3Array* vertices (new osg::Vec3Array());
@@ -53,9 +53,7 @@ osg::Geode* createAxis()
colors->push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
geometry->setColorArray (colors);
geometry->setColorBinding (osg::Geometry::BIND_PER_VERTEX);
geometry->setColorArray (colors, osg::Array::BIND_PER_VERTEX);
geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6));
geode->addDrawable( geometry );
@@ -70,21 +68,20 @@ osgAnimation::RigGeometry* createTesselatedBox(int nsplit, float size)
osg::ref_ptr<osg::Vec3Array> vertices (new osg::Vec3Array());
osg::ref_ptr<osg::Vec3Array> colors (new osg::Vec3Array());
geometry->setVertexArray (vertices.get());
geometry->setColorArray (colors.get());
geometry->setColorBinding (osg::Geometry::BIND_PER_VERTEX);
float step = size / nsplit;
float s = 0.5/4.0;
for (int i = 0; i < nsplit; i++)
geometry->setColorArray (colors.get(), osg::Array::BIND_PER_VERTEX);
float step = size / static_cast<float>(nsplit);
float s = 0.5f/4.0f;
for (int i = 0; i < nsplit; i++)
{
float x = -1 + i * step;
float x = -1.0f + static_cast<float>(i) * step;
std::cout << x << std::endl;
vertices->push_back (osg::Vec3 ( x, s, s));
vertices->push_back (osg::Vec3 ( x, -s, s));
vertices->push_back (osg::Vec3 ( x, -s, -s));
vertices->push_back (osg::Vec3 ( x, s, -s));
osg::Vec3 c (0,0,0);
c[i%3] = 1;
osg::Vec3 c (0.0f,0.0f,0.0f);
c[i%3] = 1.0f;
colors->push_back (c);
colors->push_back (c);
colors->push_back (c);
@@ -92,7 +89,7 @@ osgAnimation::RigGeometry* createTesselatedBox(int nsplit, float size)
}
osg::ref_ptr<osg::UIntArray> array = new osg::UIntArray;
for (int i = 0; i < nsplit - 1; i++)
for (int i = 0; i < nsplit - 1; i++)
{
int base = i * 4;
array->push_back(base);
@@ -123,7 +120,7 @@ osgAnimation::RigGeometry* createTesselatedBox(int nsplit, float size)
array->push_back(base+2);
array->push_back(base+7);
}
geometry->addPrimitiveSet(new osg::DrawElementsUInt(osg::PrimitiveSet::TRIANGLES, array->size(), &array->front()));
geometry->setUseDisplayList( false );
riggeometry->setSourceGeometry(geometry);
@@ -144,16 +141,16 @@ void initVertexMap(osgAnimation::Bone* b0,
(*vim)[b1->getName()].setName(b1->getName());
(*vim)[b2->getName()].setName(b2->getName());
for (int i = 0; i < (int)array->size(); i++)
for (int i = 0; i < (int)array->size(); i++)
{
float val = (*array)[i][0];
std::cout << val << std::endl;
if (val >= -1 && val <= 0)
(*vim)[b0->getName()].push_back(osgAnimation::VertexIndexWeight(i,1));
else if ( val > 0 && val <= 1)
(*vim)[b1->getName()].push_back(osgAnimation::VertexIndexWeight(i,1));
else if ( val > 1)
(*vim)[b2->getName()].push_back(osgAnimation::VertexIndexWeight(i,1));
if (val >= -1.0f && val <= 0.0f)
(*vim)[b0->getName()].push_back(osgAnimation::VertexIndexWeight(i,1.0f));
else if ( val > 0.0f && val <= 1.0f)
(*vim)[b1->getName()].push_back(osgAnimation::VertexIndexWeight(i,1.0f));
else if ( val > 1.0f)
(*vim)[b2->getName()].push_back(osgAnimation::VertexIndexWeight(i,1.0f));
}
geom->setInfluenceMap(vim);
@@ -171,26 +168,26 @@ int main (int argc, char* argv[])
osg::ref_ptr<osgAnimation::Skeleton> skelroot = new osgAnimation::Skeleton;
skelroot->setDefaultUpdateCallback();
osg::ref_ptr<osgAnimation::Bone> root = new osgAnimation::Bone;
root->setInvBindMatrixInSkeletonSpace(osg::Matrix::inverse(osg::Matrix::translate(-1,0,0)));
root->setInvBindMatrixInSkeletonSpace(osg::Matrix::inverse(osg::Matrix::translate(-1.0,0.0,0.0)));
root->setName("root");
osgAnimation::UpdateBone* pRootUpdate = new osgAnimation::UpdateBone("root");
pRootUpdate->getStackedTransforms().push_back(new osgAnimation::StackedTranslateElement("translate",osg::Vec3(-1,0,0)));
pRootUpdate->getStackedTransforms().push_back(new osgAnimation::StackedTranslateElement("translate",osg::Vec3(-1.0f,0.0f,0.0f)));
root->setUpdateCallback(pRootUpdate);
osg::ref_ptr<osgAnimation::Bone> right0 = new osgAnimation::Bone;
right0->setInvBindMatrixInSkeletonSpace(osg::Matrix::inverse(osg::Matrix::translate(0,0,0)));
right0->setInvBindMatrixInSkeletonSpace(osg::Matrix::inverse(osg::Matrix::translate(0.0,0.0,0.0)));
right0->setName("right0");
osgAnimation::UpdateBone* pRight0Update = new osgAnimation::UpdateBone("right0");
pRight0Update->getStackedTransforms().push_back(new osgAnimation::StackedTranslateElement("translate", osg::Vec3(1,0,0)));
pRight0Update->getStackedTransforms().push_back(new osgAnimation::StackedRotateAxisElement("rotate", osg::Vec3(0,0,1), 0));
pRight0Update->getStackedTransforms().push_back(new osgAnimation::StackedTranslateElement("translate", osg::Vec3(1.0f,0.0f,0.0f)));
pRight0Update->getStackedTransforms().push_back(new osgAnimation::StackedRotateAxisElement("rotate", osg::Vec3(0.0f,0.0f,1.0f), 0.0));
right0->setUpdateCallback(pRight0Update);
osg::ref_ptr<osgAnimation::Bone> right1 = new osgAnimation::Bone;
right1->setInvBindMatrixInSkeletonSpace(osg::Matrix::inverse(osg::Matrix::translate(1,0,0)));
right1->setInvBindMatrixInSkeletonSpace(osg::Matrix::inverse(osg::Matrix::translate(1.0,0.0,0.0)));
right1->setName("right1");
osgAnimation::UpdateBone* pRight1Update = new osgAnimation::UpdateBone("right1");
pRight1Update->getStackedTransforms().push_back(new osgAnimation::StackedTranslateElement("translate", osg::Vec3(1,0,0)));
pRight1Update->getStackedTransforms().push_back(new osgAnimation::StackedRotateAxisElement("rotate", osg::Vec3(0,0,1), 0));
pRight1Update->getStackedTransforms().push_back(new osgAnimation::StackedTranslateElement("translate", osg::Vec3(1.0f,0.0f,0.0f)));
pRight1Update->getStackedTransforms().push_back(new osgAnimation::StackedRotateAxisElement("rotate", osg::Vec3(0.0f,0.0f,1.0f), 0.0));
right1->setUpdateCallback(pRight1Update);
root->addChild(right0.get());
@@ -204,9 +201,9 @@ int main (int argc, char* argv[])
osgAnimation::Animation* anim = new osgAnimation::Animation;
{
osgAnimation::FloatKeyframeContainer* keys0 = new osgAnimation::FloatKeyframeContainer;
keys0->push_back(osgAnimation::FloatKeyframe(0,0));
keys0->push_back(osgAnimation::FloatKeyframe(3,osg::PI_2));
keys0->push_back(osgAnimation::FloatKeyframe(6,osg::PI_2));
keys0->push_back(osgAnimation::FloatKeyframe(0.0,0.0f));
keys0->push_back(osgAnimation::FloatKeyframe(3.0,osg::PI_2));
keys0->push_back(osgAnimation::FloatKeyframe(6.0,osg::PI_2));
osgAnimation::FloatLinearSampler* sampler = new osgAnimation::FloatLinearSampler;
sampler->setKeyframeContainer(keys0);
osgAnimation::FloatLinearChannel* channel = new osgAnimation::FloatLinearChannel(sampler);
@@ -217,9 +214,9 @@ int main (int argc, char* argv[])
{
osgAnimation::FloatKeyframeContainer* keys1 = new osgAnimation::FloatKeyframeContainer;
keys1->push_back(osgAnimation::FloatKeyframe(0,0));
keys1->push_back(osgAnimation::FloatKeyframe(3,0));
keys1->push_back(osgAnimation::FloatKeyframe(6,osg::PI_2));
keys1->push_back(osgAnimation::FloatKeyframe(0.0,0.0f));
keys1->push_back(osgAnimation::FloatKeyframe(3.0,0.0f));
keys1->push_back(osgAnimation::FloatKeyframe(6.0,osg::PI_2));
osgAnimation::FloatLinearSampler* sampler = new osgAnimation::FloatLinearSampler;
sampler->setKeyframeContainer(keys1);
osgAnimation::FloatLinearChannel* channel = new osgAnimation::FloatLinearChannel(sampler);
@@ -229,13 +226,13 @@ int main (int argc, char* argv[])
}
manager->registerAnimation(anim);
manager->buildTargetReference();
// let's start !
manager->playAnimation(anim);
// we will use local data from the skeleton
osg::MatrixTransform* rootTransform = new osg::MatrixTransform;
rootTransform->setMatrix(osg::Matrix::rotate(osg::PI_2,osg::Vec3(1,0,0)));
rootTransform->setMatrix(osg::Matrix::rotate(osg::PI_2,osg::Vec3(1.0f,0.0f,0.0f)));
right0->addChild(createAxis());
right0->setDataVariance(osg::Object::DYNAMIC);
right1->addChild(createAxis());
@@ -247,8 +244,8 @@ int main (int argc, char* argv[])
trueroot->setDataVariance(osg::Object::DYNAMIC);
rootTransform->addChild(trueroot);
scene->addChild(rootTransform);
osgAnimation::RigGeometry* geom = createTesselatedBox(4, 4.0);
osgAnimation::RigGeometry* geom = createTesselatedBox(4, 4.0f);
osg::Geode* geode = new osg::Geode;
geode->addDrawable(geom);
skelroot->addChild(geode);

View File

@@ -1,14 +1,14 @@
/* -*-c++-*-
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
@@ -30,7 +30,7 @@ using namespace osgAnimation;
osg::ref_ptr<osg::Geode> createAxis()
{
osg::ref_ptr<osg::Geode> geode (new osg::Geode());
osg::ref_ptr<osg::Geode> geode (new osg::Geode());
osg::ref_ptr<osg::Geometry> geometry (new osg::Geometry());
osg::ref_ptr<osg::Vec3Array> vertices (new osg::Vec3Array());
@@ -49,9 +49,7 @@ osg::ref_ptr<osg::Geode> createAxis()
colors->push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
geometry->setColorArray (colors.get());
geometry->setColorBinding (osg::Geometry::BIND_PER_VERTEX);
geometry->setColorArray (colors.get(), osg::Array::BIND_PER_VERTEX);
geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6));
geode->addDrawable( geometry.get() );
@@ -114,7 +112,7 @@ int main (int argc, char* argv[])
channelAnimation1->getOrCreateSampler()->getOrCreateKeyframeContainer()->push_back(osgAnimation::Vec3Keyframe(0, osg::Vec3(0,0,0)));
channelAnimation1->getOrCreateSampler()->getOrCreateKeyframeContainer()->push_back(osgAnimation::Vec3Keyframe(2, osg::Vec3(1,1,0)));
osgAnimation::Animation* anim1 = new osgAnimation::Animation;
anim1->addChannel(channelAnimation1);
anim1->addChannel(channelAnimation1);
anim1->setPlayMode(osgAnimation::Animation::PPONG);
@@ -130,12 +128,12 @@ int main (int argc, char* argv[])
osgAnimation::Animation* anim2 = new osgAnimation::Animation;
anim2->addChannel(channelAnimation2);
anim2->setPlayMode(osgAnimation::Animation::LOOP);
// We register all animation inside the scheduler
mng->registerAnimation(anim1);
mng->registerAnimation(anim2);
//start the animation
mng->playAnimation(anim1);
mng->playAnimation(anim2);

View File

@@ -1,14 +1,14 @@
/* -*-c++-*-
/* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*
* Authors:
@@ -37,13 +37,13 @@ const int WIDTH = 1440;
const int HEIGHT = 900;
osg::Geode* createAxis()
osg::Geode* createAxis()
{
osg::Geode* geode = new osg::Geode();
osg::Geode* geode = new osg::Geode();
osg::Geometry* geometry = new osg::Geometry();
osg::Vec3Array* vertices = new osg::Vec3Array();
osg::Vec4Array* colors = new osg::Vec4Array();
vertices->push_back(osg::Vec3(0.0f, 0.0f, 0.0f));
vertices->push_back(osg::Vec3(1.0f, 0.0f, 0.0f));
vertices->push_back(osg::Vec3(0.0f, 0.0f, 0.0f));
@@ -57,10 +57,9 @@ osg::Geode* createAxis()
colors->push_back(osg::Vec4(0.0f, 1.0f, 0.0f, 1.0f));
colors->push_back(osg::Vec4(0.0f, 0.0f, 1.0f, 1.0f));
colors->push_back(osg::Vec4(0.0f, 0.0f, 1.0f, 1.0f));
geometry->setVertexArray(vertices);
geometry->setColorArray(colors);
geometry->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
geometry->setColorArray(colors, osg::Array::BIND_PER_VERTEX);
geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES, 0, 6));
geometry->getOrCreateStateSet()->setMode(GL_LIGHTING, false);
@@ -100,7 +99,7 @@ struct AddHelperBone : public osg::NodeVisitor
}
};
int main(int argc, char** argv)
int main(int argc, char** argv)
{
osg::ArgumentParser arguments(&argc, argv);
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
@@ -153,7 +152,7 @@ int main(int argc, char** argv)
AnimtkViewerGUI* gui = new AnimtkViewerGUI(&viewer, WIDTH, HEIGHT, 0x1234);
osg::Camera* camera = gui->createParentOrthoCamera();
node->setNodeMask(0x0001);
group->addChild(node);

View File

@@ -0,0 +1,4 @@
SET(TARGET_SRC osgatomiccounter.cpp)
#### end var setup ###
SETUP_EXAMPLE(osgatomiccounter)

View File

@@ -0,0 +1,238 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 2012-2012 David Callu
*
* This application is open source and may be redistributed and/or modified
* freely and without restriction, both in commercial and non commercial applications,
* as long as this copyright notice is maintained.
*
* This application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
#include <osg/BufferIndexBinding>
#include <osg/BufferObject>
#include <osg/Camera>
#include <osg/Program>
#include <osgDB/ReadFile>
#include <osgUtil/Optimizer>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgGA/TrackballManipulator>
#include <osgGA/FlightManipulator>
#include <osgGA/DriveManipulator>
#include <osgGA/KeySwitchMatrixManipulator>
#include <osgGA/StateSetManipulator>
#include <osgGA/AnimationPathManipulator>
#include <osgGA/TerrainManipulator>
#include <osgGA/SphericalManipulator>
#include <iostream>
class AdaptNumPixelUniform : public osg::Camera::DrawCallback
{
public:
AdaptNumPixelUniform()
{
_atomicCounterArray = new osg::UIntArray;
_atomicCounterArray->push_back(0);
}
virtual void operator () (osg::RenderInfo& renderInfo) const
{
_acbb->readData(*renderInfo.getState(), *_atomicCounterArray);
unsigned int numPixel = osg::maximum(1u, _atomicCounterArray->front());
if ((renderInfo.getView()->getFrameStamp()->getFrameNumber() % 10) == 0)
{
OSG_INFO << "osgatomiccounter : draw " << numPixel << " pixels." << std::endl;
}
_invNumPixelUniform->set( 1.0f / static_cast<float>(numPixel) );
}
osg::ref_ptr<osg::Uniform> _invNumPixelUniform;
osg::ref_ptr<osg::UIntArray> _atomicCounterArray;
osg::ref_ptr<osg::AtomicCounterBufferBinding> _acbb;
};
osg::Program * createProgram()
{
std::stringstream vp;
vp << "#version 420 compatibility\n"
<< "\n"
<< "void main(void)\n"
<< "{\n"
<< " gl_Position = ftransform();\n"
<< "}\n";
osg::Shader * vpShader = new osg::Shader( osg::Shader::VERTEX, vp.str() );
std::stringstream fp;
fp << "#version 420 compatibility\n"
<< "\n"
<< "layout(binding = 0) uniform atomic_uint acRed;\n"
<< "layout(binding = 0, offset = 4) uniform atomic_uint acGreen;\n"
<< "layout(binding = 2) uniform atomic_uint acBlue;\n"
<< "\n"
<< "uniform float invNumPixel;\n"
<< "\n"
<< "void main(void)\n"
<< "{\n"
<< " float r = float(atomicCounterIncrement(acRed)) * invNumPixel;\n"
<< " float g = float(atomicCounterIncrement(acGreen)) * invNumPixel;\n"
<< " float b = float(atomicCounterIncrement(acBlue)) * invNumPixel;\n"
<< " gl_FragColor = vec4(r, g, b, 1.0);\n"
<< "}\n"
<< "\n";
osg::Shader * fpShader = new osg::Shader( osg::Shader::FRAGMENT, fp.str() );
osg::Program * program = new osg::Program;
program->addShader(vpShader);
program->addShader(fpShader);
return program;
}
class ResetAtomicCounter : public osg::StateAttributeCallback
{
public:
virtual void operator () (osg::StateAttribute* sa, osg::NodeVisitor*)
{
osg::AtomicCounterBufferBinding * acbb = dynamic_cast<osg::AtomicCounterBufferBinding *>(sa);
if (acbb)
{
osg::AtomicCounterBufferObject * acbo = dynamic_cast<osg::AtomicCounterBufferObject*>(acbb->getBufferObject());
if (acbo && acbo->getBufferData(0))
{
acbo->getBufferData(0)->dirty();
}
}
}
};
int main(int argc, char** argv)
{
// use an ArgumentParser object to manage the program arguments.
osg::ArgumentParser arguments(&argc,argv);
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is a simple example which show draw order of pixel.");
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
osgViewer::Viewer viewer(arguments);
unsigned int helpType = 0;
if ((helpType = arguments.readHelpType()))
{
arguments.getApplicationUsage()->write(std::cout, helpType);
return 1;
}
// report any errors if they have occurred when parsing the program arguments.
if (arguments.errors())
{
arguments.writeErrorMessages(std::cout);
return 1;
}
// set up the camera manipulators.
viewer.setCameraManipulator( new osgGA::TrackballManipulator() );
// add the state manipulator
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
// add the thread model handler
viewer.addEventHandler(new osgViewer::ThreadingHandler);
// add the window size toggle handler
viewer.addEventHandler(new osgViewer::WindowSizeHandler);
// add the stats handler
viewer.addEventHandler(new osgViewer::StatsHandler);
// add the help handler
viewer.addEventHandler(new osgViewer::HelpHandler(arguments.getApplicationUsage()));
// add the screen capture handler
viewer.addEventHandler(new osgViewer::ScreenCaptureHandler);
// load the data
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
if (!loadedModel)
{
osg::Geometry * quad = osg::createTexturedQuadGeometry(osg::Vec3f(-2.0f, 0.0f, -2.0f),
osg::Vec3f(2.0f, 0.0f, 0.0f),
osg::Vec3f(0.0f, 0.0f, 2.0f) );
osg::Geode * geode = new osg::Geode;
geode->addDrawable(quad);
loadedModel = geode;
}
// any option left unread are converted into errors to write out later.
arguments.reportRemainingOptionsAsUnrecognized();
// report any errors if they have occurred when parsing the program arguments.
if (arguments.errors())
{
arguments.writeErrorMessages(std::cout);
return 1;
}
osg::StateSet * ss = loadedModel->asGeode()->getDrawable(0)->getOrCreateStateSet();
ss->setAttributeAndModes( createProgram(), osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE | osg::StateAttribute::PROTECTED );
ss = loadedModel->getOrCreateStateSet();
osg::ref_ptr<osg::UIntArray> atomicCounterArrayRedAndGreen = new osg::UIntArray;
atomicCounterArrayRedAndGreen->push_back(0);
atomicCounterArrayRedAndGreen->push_back(0);
osg::ref_ptr<osg::UIntArray> atomicCounterArrayBlue = new osg::UIntArray;
atomicCounterArrayBlue->push_back(0);
osg::ref_ptr<osg::AtomicCounterBufferObject> acboRedAndGreen = new osg::AtomicCounterBufferObject;
acboRedAndGreen->setUsage(GL_STREAM_COPY);
atomicCounterArrayRedAndGreen->setBufferObject(acboRedAndGreen.get());
osg::ref_ptr<osg::AtomicCounterBufferObject> acboBlue = new osg::AtomicCounterBufferObject;
acboBlue->setUsage(GL_STREAM_COPY);
atomicCounterArrayBlue->setBufferObject(acboBlue.get());
osg::ref_ptr<osg::AtomicCounterBufferBinding> acbbRedAndGreen = new osg::AtomicCounterBufferBinding(0, acboRedAndGreen.get(), 0, sizeof(GLuint)*3);
ss->setAttributeAndModes(acbbRedAndGreen.get());
osg::ref_ptr<osg::AtomicCounterBufferBinding> acbbBlue = new osg::AtomicCounterBufferBinding(2, acboBlue.get(), 0, sizeof(GLuint));
ss->setAttributeAndModes(acbbBlue.get());
acbbRedAndGreen->setUpdateCallback(new ResetAtomicCounter);
acbbBlue->setUpdateCallback(new ResetAtomicCounter);
osg::ref_ptr<osg::Uniform> invNumPixelUniform = new osg::Uniform("invNumPixel", 1.0f/(800.0f*600.0f));
ss->addUniform( invNumPixelUniform.get() );
AdaptNumPixelUniform * drawCallback = new AdaptNumPixelUniform;
drawCallback->_invNumPixelUniform = invNumPixelUniform;
drawCallback->_acbb = acbbBlue;
viewer.getCamera()->setFinalDrawCallback(drawCallback);
// optimize the scene graph, remove redundant nodes and state etc.
osgUtil::Optimizer optimizer;
optimizer.optimize(loadedModel.get());
viewer.setSceneData( loadedModel.get() );
viewer.realize();
return viewer.run();
}

View File

@@ -348,6 +348,8 @@ int main( int argc, char **argv )
keyswitchManipulator->addMatrixManipulator( '2', "Flight", new osgGA::FlightManipulator() );
keyswitchManipulator->addMatrixManipulator( '3', "Drive", new osgGA::DriveManipulator() );
keyswitchManipulator->addMatrixManipulator( '4', "Terrain", new osgGA::TerrainManipulator() );
viewer.setCameraManipulator( keyswitchManipulator.get() );
}

View File

@@ -37,7 +37,7 @@
osg::Node* createLabel(const osg::Vec3& pos, float size, const std::string& label, osgText::Text::AxisAlignment axisAlignment)
{
osg::Geode* geode = new osg::Geode();
std::string timesFont("fonts/arial.ttf");
{
@@ -50,17 +50,17 @@ osg::Node* createLabel(const osg::Vec3& pos, float size, const std::string& labe
text->setAxisAlignment(axisAlignment);
text->setAlignment(osgText::Text::CENTER_CENTER);
text->setText(label);
}
return geode;
return geode;
}
osg::Node* createLabel3(const osg::Vec3& pos, float size, const std::string& label)
{
osg::Geode* geode = new osg::Geode();
std::string timesFont("fonts/arial.ttf");
{
@@ -75,10 +75,10 @@ osg::Node* createLabel3(const osg::Vec3& pos, float size, const std::string& lab
text->setAutoRotateToScreen(true);
text->setCharacterSizeMode(osgText::Text::OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT);
text->setText(label);
}
return geode;
return geode;
}
osg::Node* createAxis(const osg::Vec3& s, const osg::Vec3& e, int numReps, osg::AutoTransform::AutoRotateMode autoRotateMode, osgText::Text::AxisAlignment axisAlignment, const std::string& str)
@@ -113,8 +113,7 @@ osg::Node* createAxis(const osg::Vec3& s, const osg::Vec3& e, int numReps, osg::
osg::Geometry* geom = new osg::Geometry;
geom->setVertexArray(vertices);
geom->setColorArray(colors);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->setColorArray(colors, osg::Array::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(GL_LINE_STRIP,0,vertices->size()));
osg::Geode* geode = new osg::Geode;
@@ -140,8 +139,7 @@ osg::Node* createAxis(const osg::Vec3& s, const osg::Vec3& e, int numReps, osg::
osg::Geometry* geom = new osg::Geometry;
geom->setVertexArray(vertices);
geom->setColorArray(colors);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->setColorArray(colors, osg::Array::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(GL_LINE_STRIP,0,vertices->size()));
osg::Geode* geode = new osg::Geode;
@@ -149,7 +147,7 @@ osg::Node* createAxis(const osg::Vec3& s, const osg::Vec3& e, int numReps, osg::
group->addChild(geode);
}
return group;
}
@@ -169,25 +167,25 @@ osg::Node* createAutoScale(const osg::Vec3& position, float characterSize, const
osg::AutoTransform* at = new osg::AutoTransform;
at->addChild(geode);
at->setAutoRotateMode(osg::AutoTransform::ROTATE_TO_SCREEN);
at->setAutoScaleToScreen(true);
at->setMinimumScale(minScale);
at->setMaximumScale(maxScale);
at->setPosition(position);
return at;
}
osg::Node* createScene()
{
osg::Group* root = new osg::Group;
// int numReps = 3333;
int numReps = 10;
root->addChild(createAxis(osg::Vec3(0.0,0.0,0.0),osg::Vec3(1000.0,0.0,0.0),numReps,osg::AutoTransform::ROTATE_TO_CAMERA,osgText::Text::XY_PLANE, "ROTATE_TO_CAMERA"));
root->addChild(createAxis(osg::Vec3(0.0,0.0,0.0),osg::Vec3(0.0,1000.0,0.0),numReps,osg::AutoTransform::ROTATE_TO_SCREEN,osgText::Text::XY_PLANE, "ROTATE_TO_SCREEN"));
root->addChild(createAxis(osg::Vec3(0.0,0.0,0.0),osg::Vec3(0.0,0.0,1000.0),numReps,osg::AutoTransform::NO_ROTATION,osgText::Text::XZ_PLANE, "NO_ROTATION"));
root->addChild(createAxis(osg::Vec3(0.0,0.0,0.0),osg::Vec3(0.0,0.0,1000.0),numReps,osg::AutoTransform::NO_ROTATION,osgText::Text::XZ_PLANE, "NO_ROTATION"));
root->addChild(createAutoScale(osg::Vec3(500.0,500.0,500.0), 25.0, "AutoScale with no min, max limits"));
root->addChild(createAutoScale(osg::Vec3(500.0,500.0,300.0), 25.0, "AutoScale with minScale = 1, maxScale = 2.0 ", 1, 2.0));
@@ -202,7 +200,7 @@ int main(int, char**)
// set the scene to render
viewer.setSceneData(createScene());
// run the viewers frame loop
return viewer.run();
}

View File

@@ -6,7 +6,7 @@
* 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
@@ -34,7 +34,7 @@
#include <osgViewer/Viewer>
//
// A simple demo demonstrating different texturing modes,
// A simple demo demonstrating different texturing modes,
// including using of texture extensions.
//
@@ -59,9 +59,8 @@ osg::Drawable* createSquare(const osg::Vec3& corner,const osg::Vec3& width,const
osg::Vec3Array* norms = new osg::Vec3Array(1);
(*norms)[0] = width^height;
(*norms)[0].normalize();
geom->setNormalArray(norms);
geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
geom->setNormalArray(norms, osg::Array::BIND_OVERALL);
osg::Vec2Array* tcoords = new osg::Vec2Array(4);
(*tcoords)[0].set(0.0f,0.0f);
@@ -69,9 +68,9 @@ osg::Drawable* createSquare(const osg::Vec3& corner,const osg::Vec3& width,const
(*tcoords)[2].set(1.0f,1.0f);
(*tcoords)[3].set(0.0f,1.0f);
geom->setTexCoordArray(0,tcoords);
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4));
if (image)
{
osg::StateSet* stateset = new osg::StateSet;
@@ -80,7 +79,7 @@ osg::Drawable* createSquare(const osg::Vec3& corner,const osg::Vec3& width,const
stateset->setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON);
geom->setStateSet(stateset);
}
return geom;
}
@@ -110,19 +109,18 @@ osg::Drawable* createAxis(const osg::Vec3& corner,const osg::Vec3& xdir,const os
(*color)[3] = y_color;
(*color)[4] = z_color;
(*color)[5] = z_color;
geom->setColorArray(color);
geom->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
geom->setColorArray(color, osg::Array::BIND_PER_VERTEX);
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6));
osg::StateSet* stateset = new osg::StateSet;
osg::LineWidth* linewidth = new osg::LineWidth();
linewidth->setWidth(4.0f);
stateset->setAttributeAndModes(linewidth,osg::StateAttribute::ON);
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
geom->setStateSet(stateset);
return geom;
}
@@ -138,7 +136,7 @@ osg::Node* createModel()
center->addDrawable(
createSquare(osg::Vec3(-0.5f,0.0f,-0.5f),osg::Vec3(1.0f,0.0f,0.0f),osg::Vec3(0.0f,0.0f,1.0f),osgDB::readImageFile("Images/reflect.rgb")),
osg::Vec3(0.0f,0.0f,0.0f));
osg::Billboard* x_arrow = new osg::Billboard();
x_arrow->setMode(osg::Billboard::AXIAL_ROT);
x_arrow->setAxis(osg::Vec3(1.0f,0.0f,0.0f));
@@ -182,7 +180,7 @@ int main(int, char**)
{
// construct the viewer
osgViewer::Viewer viewer;
// set the scene to render
viewer.setSceneData(createModel());

View File

@@ -48,13 +48,13 @@ const unsigned int MAX_NUM_EVENTS = 10;
const unsigned int SWAP_BYTES_COMPARE = 0x12345678;
class CameraPacket {
public:
CameraPacket():_masterKilled(false)
CameraPacket():_masterKilled(false)
{
_byte_order = SWAP_BYTES_COMPARE;
}
void setPacket(const osg::Matrix& matrix,const osg::FrameStamp* frameStamp)
{
_matrix = matrix;
@@ -63,20 +63,20 @@ class CameraPacket {
_frameStamp = *frameStamp;
}
}
void getModelView(osg::Matrix& matrix,float angle_offset=0.0f)
{
matrix = _matrix * osg::Matrix::rotate(osg::DegreesToRadians(angle_offset),0.0f,1.0f,0.0f);
}
void readEventQueue(osgViewer::Viewer& viewer);
void writeEventQueue(osgViewer::Viewer& viewer);
void setMasterKilled(const bool flag) { _masterKilled = flag; }
const bool getMasterKilled() const { return _masterKilled; }
unsigned int _byte_order;
bool _masterKilled;
osg::Matrix _matrix;
@@ -84,11 +84,11 @@ class CameraPacket {
// note don't use a ref_ptr as used elsewhere for FrameStamp
// since we don't want to copy the pointer - but the memory.
// FrameStamp doesn't have a private destructor to allow
// us to do this, even though its a reference counted object.
// us to do this, even though its a reference counted object.
osg::FrameStamp _frameStamp;
osgGA::EventQueue::Events _events;
};
class DataConverter
@@ -112,7 +112,7 @@ class DataConverter
bool _swapBytes;
char* _currentPtr;
void reset()
{
_currentPtr = _startPtr;
@@ -122,22 +122,22 @@ class DataConverter
{
if (_currentPtr+1>=_endPtr) return;
*(_currentPtr++) = *(ptr);
*(_currentPtr++) = *(ptr);
}
inline void read1(char* ptr)
{
if (_currentPtr+1>=_endPtr) return;
*(ptr) = *(_currentPtr++);
*(ptr) = *(_currentPtr++);
}
inline void write2(char* ptr)
{
if (_currentPtr+2>=_endPtr) return;
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr);
}
inline void read2(char* ptr)
@@ -146,13 +146,13 @@ class DataConverter
if (_swapBytes)
{
*(ptr+1) = *(_currentPtr++);
*(ptr) = *(_currentPtr++);
*(ptr+1) = *(_currentPtr++);
*(ptr) = *(_currentPtr++);
}
else
{
*(ptr++) = *(_currentPtr++);
*(ptr) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr) = *(_currentPtr++);
}
}
@@ -160,10 +160,10 @@ class DataConverter
{
if (_currentPtr+4>=_endPtr) return;
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr);
}
inline void read4(char* ptr)
@@ -172,17 +172,17 @@ class DataConverter
if (_swapBytes)
{
*(ptr+3) = *(_currentPtr++);
*(ptr+2) = *(_currentPtr++);
*(ptr+1) = *(_currentPtr++);
*(ptr) = *(_currentPtr++);
*(ptr+3) = *(_currentPtr++);
*(ptr+2) = *(_currentPtr++);
*(ptr+1) = *(_currentPtr++);
*(ptr) = *(_currentPtr++);
}
else
{
*(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr) = *(_currentPtr++);
}
}
@@ -190,15 +190,15 @@ class DataConverter
{
if (_currentPtr+8>=_endPtr) return;
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr);
}
inline void read8(char* ptr)
@@ -208,27 +208,27 @@ class DataConverter
if (_swapBytes)
{
*(ptr+7) = *(_currentPtr++);
*(ptr+6) = *(_currentPtr++);
*(ptr+5) = *(_currentPtr++);
*(ptr+4) = *(_currentPtr++);
*(ptr+7) = *(_currentPtr++);
*(ptr+6) = *(_currentPtr++);
*(ptr+5) = *(_currentPtr++);
*(ptr+4) = *(_currentPtr++);
*(ptr+3) = *(_currentPtr++);
*(ptr+2) = *(_currentPtr++);
*(ptr+1) = *(_currentPtr++);
*(ptr) = *(_currentPtr++);
*(ptr+3) = *(_currentPtr++);
*(ptr+2) = *(_currentPtr++);
*(ptr+1) = *(_currentPtr++);
*(ptr) = *(_currentPtr++);
}
else
{
*(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr++) = *(_currentPtr++);
*(ptr) = *(_currentPtr++);
}
}
@@ -241,14 +241,14 @@ class DataConverter
inline void writeFloat(float c) { write4((char*)&c); }
inline void writeDouble(double c) { write8((char*)&c); }
inline char readChar() { char c; read1(&c); return c; }
inline unsigned char readUChar() { unsigned char c; read1((char*)&c); return c; }
inline short readShort() { short c; read2((char*)&c); return c; }
inline unsigned short readUShort() { unsigned short c; read2((char*)&c); return c; }
inline int readInt() { int c; read4((char*)&c); return c; }
inline unsigned int readUInt() { unsigned int c; read4((char*)&c); return c; }
inline float readFloat() { float c; read4((char*)&c); return c; }
inline double readDouble() { double c; read8((char*)&c); return c; }
inline char readChar() { char c=0; read1(&c); return c; }
inline unsigned char readUChar() { unsigned char c=0; read1((char*)&c); return c; }
inline short readShort() { short c=0; read2((char*)&c); return c; }
inline unsigned short readUShort() { unsigned short c=0; read2((char*)&c); return c; }
inline int readInt() { int c=0; read4((char*)&c); return c; }
inline unsigned int readUInt() { unsigned int c=0; read4((char*)&c); return c; }
inline float readFloat() { float c=0.0f; read4((char*)&c); return c; }
inline double readDouble() { double c=0.0; read8((char*)&c); return c; }
void write(const osg::FrameStamp& fs)
{
@@ -361,16 +361,16 @@ class DataConverter
event.setModKeyMask(readUInt());
event.setTime(readDouble());
}
void write(CameraPacket& cameraPacket)
{
writeUInt(cameraPacket._byte_order);
writeUInt(cameraPacket._masterKilled);
write(cameraPacket._matrix);
write(cameraPacket._frameStamp);
writeUInt(cameraPacket._events.size());
for(osgGA::EventQueue::Events::iterator itr = cameraPacket._events.begin();
itr != cameraPacket._events.end();
@@ -387,12 +387,12 @@ class DataConverter
{
_swapBytes = !_swapBytes;
}
cameraPacket._masterKilled = readUInt()!=0;
read(cameraPacket._matrix);
read(cameraPacket._frameStamp);
cameraPacket._events.clear();
unsigned int numEvents = readUInt();
for(unsigned int i=0;i<numEvents;++i)
@@ -409,7 +409,7 @@ void CameraPacket::readEventQueue(osgViewer::Viewer& viewer)
_events.clear();
osgViewer::ViewerBase::Contexts contexts;
viewer.getContexts(contexts);
viewer.getContexts(contexts);
for(osgViewer::ViewerBase::Contexts::iterator citr =contexts.begin(); citr != contexts.end(); ++citr)
{
@@ -423,7 +423,7 @@ void CameraPacket::readEventQueue(osgViewer::Viewer& viewer)
}
_events.insert(_events.end(), gw_events.begin(), gw_events.end());
}
viewer.getEventQueue()->copyEvents(_events);
osg::notify(osg::INFO)<<"written events = "<<_events.size()<<std::endl;
@@ -449,7 +449,7 @@ 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 how to approach implementation of clustering.");
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
@@ -459,7 +459,7 @@ int main( int argc, char **argv )
arguments.getApplicationUsage()->addCommandLineOption("-n <int>","Socket number to transmit packets");
arguments.getApplicationUsage()->addCommandLineOption("-f <float>","Field of view of camera");
arguments.getApplicationUsage()->addCommandLineOption("-o <float>","Offset angle of camera");
// construct the viewer.
osgViewer::Viewer viewer;
@@ -468,12 +468,12 @@ int main( int argc, char **argv )
ViewerMode viewerMode = STAND_ALONE;
while (arguments.read("-m")) viewerMode = MASTER;
while (arguments.read("-s")) viewerMode = SLAVE;
int socketNumber=8100;
while (arguments.read("-n",socketNumber)) ;
float camera_fov=-1.0f;
while (arguments.read("-f",camera_fov))
while (arguments.read("-f",camera_fov))
{
}
@@ -497,7 +497,7 @@ int main( int argc, char **argv )
arguments.writeErrorMessages(std::cout);
return 1;
}
if (arguments.argc()<=1)
{
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
@@ -514,13 +514,13 @@ int main( int argc, char **argv )
{
double fovy, aspectRatio, zNear, zFar;
viewer.getCamera()->getProjectionMatrixAsPerspective(fovy, aspectRatio,zNear, zFar);
double original_fov = atan(tan(osg::DegreesToRadians(fovy)*0.5)*aspectRatio)*2.0;
std::cout << "setting lens perspective : original "<<original_fov<<" "<<fovy<<std::endl;
fovy = atan(tan(osg::DegreesToRadians(camera_fov)*0.5)/aspectRatio)*2.0;
viewer.getCamera()->setProjectionMatrixAsPerspective(fovy, aspectRatio,zNear, zFar);
viewer.getCamera()->getProjectionMatrixAsPerspective(fovy, aspectRatio,zNear, zFar);
original_fov = atan(tan(osg::DegreesToRadians(fovy)*0.5)*aspectRatio)*2.0;
std::cout << "setting lens perspective : new "<<original_fov<<" "<<fovy<<std::endl;
@@ -549,13 +549,13 @@ int main( int argc, char **argv )
rc.setPort(static_cast<short int>(socketNumber));
bool masterKilled = false;
DataConverter scratchPad(1024);
while( !viewer.done() && !masterKilled )
{
osg::Timer_t startTick = osg::Timer::instance()->tick();
viewer.advance();
// special handling for working as a cluster.
@@ -563,12 +563,12 @@ int main( int argc, char **argv )
{
case(MASTER):
{
// take camera zero as the guide.
osg::Matrix modelview(viewer.getCamera()->getViewMatrix());
cp->setPacket(modelview,viewer.getFrameStamp());
cp->readEventQueue(viewer);
scratchPad.reset();
@@ -578,11 +578,11 @@ int main( int argc, char **argv )
scratchPad.read(*cp);
bc.setBuffer(scratchPad._startPtr, scratchPad._numBytes);
std::cout << "bc.sync()"<<scratchPad._numBytes<<std::endl;
bc.sync();
}
break;
case(SLAVE):
@@ -591,13 +591,13 @@ int main( int argc, char **argv )
rc.setBuffer(scratchPad._startPtr, scratchPad._numBytes);
rc.sync();
scratchPad.reset();
scratchPad.read(*cp);
cp->writeEventQueue(viewer);
if (cp->getMasterKilled())
if (cp->getMasterKilled())
{
std::cout << "Received master killed."<<std::endl;
// break out of while (!done) loop since we've now want to shut down.
@@ -609,9 +609,9 @@ int main( int argc, char **argv )
// no need to anything here, just a normal interactive viewer.
break;
}
osg::Timer_t endTick = osg::Timer::instance()->tick();
osg::notify(osg::INFO)<<"Time to do cluster sync "<<osg::Timer::instance()->delta_m(startTick,endTick)<<std::endl;
// update the scene by traversing it with the the update visitor which will
@@ -623,14 +623,14 @@ int main( int argc, char **argv )
{
osg::Matrix modelview;
cp->getModelView(modelview,camera_offset);
viewer.getCamera()->setViewMatrix(modelview);
}
// fire off the cull and draw traversals of the scene.
if(!masterKilled)
viewer.renderingTraversals();
}
// if we are master clean up by telling all slaves that we're going down.
@@ -638,7 +638,7 @@ int main( int argc, char **argv )
{
// need to broadcast my death.
cp->setPacket(osg::Matrix::identity(),viewer.getFrameStamp());
cp->setMasterKilled(true);
cp->setMasterKilled(true);
scratchPad.reset();
scratchPad.write(*cp);

View File

@@ -54,7 +54,7 @@ public:
~PickHandler() {}
bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa)
bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa)
{
osgViewer::View* view = dynamic_cast<osgViewer::View*>(&aa);
if (!view) return false;
@@ -71,7 +71,7 @@ public:
{
if (_mx==ea.getX() && _my==ea.getY())
{
pick(view, ea.getX(), ea.getY());
pick(view, ea);
}
break;
}
@@ -81,13 +81,13 @@ public:
return false;
}
void pick(osgViewer::View* view, float x, float y)
void pick(osgViewer::View* view, const osgGA::GUIEventAdapter& event)
{
osg::Node* node = 0;
osg::Group* parent = 0;
osgUtil::LineSegmentIntersector::Intersections intersections;
if (view->computeIntersections(x, y, intersections))
if (view->computeIntersections(event, intersections))
{
osgUtil::LineSegmentIntersector::Intersection intersection = *intersections.begin();
osg::NodePath& nodePath = intersection.nodePath;
@@ -98,7 +98,6 @@ public:
// now we try to decorate the hit node by the osgFX::Scribe to show that its been "picked"
if (parent && node)
{
osgFX::Scribe* parentAsScribe = dynamic_cast<osgFX::Scribe*>(parent);
if (!parentAsScribe)
{

View File

@@ -0,0 +1,2 @@
SET(TARGET_SRC osgcomputeshaders.cpp)
SETUP_EXAMPLE(osgcomputeshaders)

View File

@@ -0,0 +1,92 @@
/* -*-c++-*- OpenSceneGraph example, osgcomputeshaders.
*
* 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.
*/
// Written by Wang Rui
// This example can work only if GL version is 4.3 or greater
#include <osg/Texture2D>
#include <osg/Geometry>
#include <osg/Geode>
#include <osgDB/ReadFile>
#include <osgGA/StateSetManipulator>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
static const char* computeSrc = {
"#version 430\n"
"uniform float osg_FrameTime;\n"
"layout (r32f, binding =0) uniform image2D targetTex;\n"
"layout (local_size_x = 16, local_size_y = 16) in;\n"
"void main() {\n"
" ivec2 storePos = ivec2(gl_GlobalInvocationID.xy);\n"
" float coeffcient = 0.5*sin(float(gl_WorkGroupID.x + gl_WorkGroupID.y)*0.1 + osg_FrameTime);\n"
" coeffcient *= length(vec2(ivec2(gl_LocalInvocationID.xy) - ivec2(8)) / vec2(8.0));\n"
" imageStore(targetTex, storePos, vec4(1.0-coeffcient, 0.0, 0.0, 0.0));\n"
"}\n"
};
int main( int argc, char** argv )
{
osg::ArgumentParser arguments( &argc, argv );
// Create the texture as both the output of compute shader and the input of a normal quad
osg::ref_ptr<osg::Texture2D> tex2D = new osg::Texture2D;
tex2D->setTextureSize( 512, 512 );
tex2D->setFilter( osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR );
tex2D->setFilter( osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR );
tex2D->setInternalFormat( GL_R32F );
tex2D->setSourceFormat( GL_RED );
tex2D->setSourceType( GL_FLOAT );
tex2D->bindToImageUnit( 0, osg::Texture::WRITE_ONLY ); // So we can use 'image2D' in the compute shader
// The compute shader can't work with other kinds of shaders
// It also requires the work group numbers. Setting them to 0 will disable the compute shader
osg::ref_ptr<osg::Program> computeProg = new osg::Program;
computeProg->setComputeGroups( 512/16, 512/16, 1 );
computeProg->addShader( new osg::Shader(osg::Shader::COMPUTE, computeSrc) );
// Create a node for outputting to the texture.
// It is OK to have just an empty node here, but seems inbuilt uniforms like osg_FrameTime won't work then.
// TODO: maybe we can have a custom drawable which also will implement glMemoryBarrier?
osg::Node* sourceNode = osgDB::readNodeFile("axes.osgt");
if ( !sourceNode ) sourceNode = new osg::Node;
sourceNode->setDataVariance( osg::Object::DYNAMIC );
sourceNode->getOrCreateStateSet()->setAttributeAndModes( computeProg.get() );
sourceNode->getOrCreateStateSet()->addUniform( new osg::Uniform("targetTex", (int)0) );
sourceNode->getOrCreateStateSet()->setTextureAttributeAndModes( 0, tex2D.get() );
// Display the texture on a quad. We will also be able to operate on the data if reading back to CPU side
osg::Geometry* geom = osg::createTexturedQuadGeometry(
osg::Vec3(), osg::Vec3(1.0f,0.0f,0.0f), osg::Vec3(0.0f,0.0f,1.0f) );
osg::ref_ptr<osg::Geode> quad = new osg::Geode;
quad->addDrawable( geom );
quad->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
quad->getOrCreateStateSet()->setTextureAttributeAndModes( 0, tex2D.get() );
// Create the scene graph and start the viewer
osg::ref_ptr<osg::Group> scene = new osg::Group;
scene->addChild( sourceNode );
scene->addChild( quad.get() );
osgViewer::Viewer viewer;
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
viewer.addEventHandler( new osgViewer::StatsHandler );
viewer.addEventHandler( new osgViewer::WindowSizeHandler );
viewer.setSceneData( scene.get() );
return viewer.run();
}

View File

@@ -45,21 +45,21 @@
class WallConstraint: public osgUtil::DelaunayConstraint { // forces lines to eb edge
// wall constraint - can generate a wall at the coordinates of the constraint
public:
/** if you derive a class from DelaunayConstraint then you can create
/** if you derive a class from DelaunayConstraint then you can create
* a specific geometry creation routine.
*/
WallConstraint() : height(0), txxrepWall(10), txyrepWall(10) { }
/** or create a wall around the constraint area: */
virtual osg::Geometry * makeWallGeometry(void) const;
/** for basic purposes, you can call these routines to make simple fill in geometries */
virtual osg::DrawArrays* makeWall(void ) const { // build a wall height high around the constraint
const osg::Vec3Array *_line= dynamic_cast<const osg::Vec3Array*>(getVertexArray());
return (new osg::DrawArrays(osg::PrimitiveSet::QUAD_STRIP,0,2*_line->size()));
}
virtual osg::Vec3Array *getWall(const float height) const;
virtual osg::Vec2Array *getWallTexcoords(const float height) const;
virtual osg::Vec3Array *getWallNormals(void) const {
@@ -67,7 +67,7 @@ public:
const osg::Vec3Array *vertices= dynamic_cast<const osg::Vec3Array*>(getVertexArray());
for (unsigned int ipr=0; ipr<getNumPrimitiveSets(); ipr++) {
const osg::PrimitiveSet* prset=getPrimitiveSet(ipr);
if (prset->getMode()==osg::PrimitiveSet::LINE_LOOP ||
if (prset->getMode()==osg::PrimitiveSet::LINE_LOOP ||
prset->getMode()==osg::PrimitiveSet::LINE_STRIP) { // loops and walls
// start with the last point on the loop
osg::Vec3 prevp=(*vertices)[prset->index (prset->getNumIndices()-1)];
@@ -88,12 +88,12 @@ public:
}
return nrms.release();
}
// geometry creation parameters
void setWallTexrep(const float w,const float h) { txxrepWall=w;txyrepWall=h;}
/** Wall Geometry will return with this texture applied: */
void setTexture(const char *tx) { texture=tx;}
/** fence/wall height */
@@ -106,18 +106,18 @@ protected:
class ArealConstraint: public osgUtil::DelaunayConstraint { // forces edges of an area to fit triangles
// areal constraint - general nonuniform field, forest, lake etc.
public:
/** if you derive a class from DelaunayConstraint then you can create
/** if you derive a class from DelaunayConstraint then you can create
* a specific geometry creation routine.
*/
ArealConstraint() : txxrepArea(10), txyrepArea(10),txxrepWall(10), txyrepWall(10) { }
/** return a geometry that fills the constraint.
*/
virtual osg::Geometry * makeAreal( osg::Vec3Array *points);
virtual deprecated_osg::Geometry * makeAreal( osg::Vec3Array *points);
/** or create a wall around the constraint area: */
virtual osg::Geometry * makeWallGeometry( osg::Vec3Array *points) ;
virtual deprecated_osg::Geometry * makeWallGeometry( osg::Vec3Array *points) ;
/** for basic purposes, you can call these routines to make simple fill in geometries */
virtual osg::DrawArrays* makeWall(void ) const;
virtual osg::Vec3Array *getWall(const float height) const;
@@ -129,7 +129,7 @@ public:
virtual osg::Vec3Array *getCanopy(const osg::Vec3Array *points,const float height) const;
virtual osg::Vec2Array *getCanopyTexcoords(const osg::Vec3Array *points) const;
virtual osg::Vec3Array *getCanopyNormals(const osg::Vec3Array *points) const;
// geometry creation parameters
void setTexrep(const float w,const float h) { txxrepArea=w;txyrepArea=h;}
void setWallTexrep(const float w,const float h) { txxrepWall=w;txyrepWall=h;}
@@ -147,39 +147,39 @@ protected:
float txxrepWall, txyrepWall;
};
class LinearConstraint: public osgUtil::DelaunayConstraint {
class LinearConstraint: public osgUtil::DelaunayConstraint {
/** forces edges of a "road" to fit triangles
* if 2 roads cross, then the overlap will be replaced by a 'cross road'
* and the roads built up to the cross roads with a texture along its length. */
public:
LinearConstraint() : osgUtil::DelaunayConstraint(), txxrepAlong(10), txyrepAcross(10), width(2) { }
/** geometry creation parameters */
/* Width of linear feature (eg road, railway) */
void setWidth(const float w) { width=w;}
/** Texture repeat distance across linear (often equal to width) and along its length */
virtual void setTexrep(const float w,const float h) { txyrepAcross=h;txxrepAlong=w; }
/** generate constant width around line - creates the area to be cut into the terrain. */
virtual void setVertices( osg::Vec3Array *lp, const float width);
/** return a geometry that fills the constraint.
*/
virtual osg::Geometry *makeGeometry(const osg::Vec3Array *points) ;
virtual deprecated_osg::Geometry *makeGeometry(const osg::Vec3Array *points) ;
/** return normals array - flat shaded */
osg::Vec3Array* getNormals(const osg::Vec3Array *points);
/** Roads apply a texture proportional to length along the road line. */
virtual osg::DrawArrays* makeRoad( ) const;
virtual osg::Vec3Array *getRoadVertices() const;
virtual osg::Vec2Array *getRoadTexcoords(const osg::Vec3Array *points) ;
virtual osg::Vec3Array *getRoadNormals(const osg::Vec3Array *points) const;
/** Geometry will return with this texture applied: */
void setTexture(const char *tx) { texture=tx;}
protected:
osg::ref_ptr<osg::Vec2Array> _tcoords;
osg::ref_ptr<osg::Vec3Array> _edgecoords;
@@ -196,19 +196,19 @@ class pyramid : public osgUtil::DelaunayConstraint {
* geometry of an Egyptian pyramid to fit the hole. */
public:
pyramid() : _side(100.) {}
void setpos(const osg::Vec3 p, const float size) { _pos=p;_side=size;}
virtual osg::Geometry * makeGeometry(void) const
{
// create pyramid geometry. Centre plus points around base
const osg::Vec3Array *_line= dynamic_cast<const osg::Vec3Array*>(getVertexArray());
osg::Geometry *gm=new osg::Geometry;
deprecated_osg::Geometry *gm=new deprecated_osg::Geometry;
osg::Vec3Array *pts=new osg::Vec3Array;
osg::Vec3Array *norms=new osg::Vec3Array;
osg::Vec2Array *tcoords=new osg::Vec2Array;
int ip;
pts->push_back(_pos+osg::Vec3(0,0,_side)*0.5);
for (ip=0; ip<4; ip++) {
pts->push_back((*_line)[ip]);
@@ -218,12 +218,12 @@ public:
nrm.normalize( );
norms->push_back(nrm);
}
gm->setNormalBinding(osg::Geometry::BIND_PER_PRIMITIVE);
gm->setNormalBinding(deprecated_osg::Geometry::BIND_PER_PRIMITIVE);
gm->setVertexArray(pts);
osg::StateSet *dstate= gm->getOrCreateStateSet( );
dstate->setMode( GL_LIGHTING, osg::StateAttribute::ON );
osg::Image* image = osgDB::readImageFile("Images/Brick-Std-Orange.TGA");
if (image)
{
@@ -283,66 +283,66 @@ osg::Vec3d getpt(const int np)
osg::Node* createHUD(const int ndcs,std::string what)
{ // add a string reporting the type of winding rule tessellation applied
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);
// Disable depth test, and make sure that the hud is drawn after everything
// Disable depth test, and make sure that the hud is drawn after everything
// else so that it always appears ontop.
stateset->setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);
stateset->setRenderBinDetails(11,"RenderBin");
osg::Vec3 position(50.0f,900.0f,0.0f);
osg::Vec3 delta(0.0f,-35.0f,0.0f);
{
osgText::Text* text = new osgText::Text;
geode->addDrawable( text );
std::ostringstream cue;
cue<<"Delaunay triangulation with constraints level "<<ndcs <<"\n"<< what;
text->setFont(timesFont);
text->setPosition(position);
text->setText(cue.str());
text->setColor(osg::Vec4(1.0,1.0,0.8,1.0));
position += delta*(ndcs+2);
#if 0
#if 0
text = new osgText::Text;
geode->addDrawable( text );
text->setFont(timesFont);
text->setPosition(position);
text->setText("(use 'W' wireframe & 'T' texture to visualise mesh)");
text->setColor(osg::Vec4(1.0,1.0,0.8,1.0));
position += delta;
#endif
}
#endif
}
{
osgText::Text* text = new osgText::Text;
geode->addDrawable( text );
text->setFont(timesFont);
text->setPosition(position);
text->setText("Press 'n' to add another constraint.");
}
}
// create the hud.
osg::MatrixTransform* modelview_abs = new osg::MatrixTransform;
modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
modelview_abs->setMatrix(osg::Matrix::identity());
modelview_abs->addChild(geode);
osg::Projection* projection = new osg::Projection;
projection->setMatrix(osg::Matrix::ortho2D(0,1280,0,1024));
projection->addChild(modelview_abs);
return projection;
}
osg::Group *makedelaunay(const int ndcs)
{ // create a terrain tile. This is just an example!
@@ -351,9 +351,9 @@ osg::Group *makedelaunay(const int ndcs)
osg::ref_ptr<osg::Geode> geode=new osg::Geode;
osg::ref_ptr<osgUtil::DelaunayTriangulator> trig=new osgUtil::DelaunayTriangulator();
osg::StateSet *stateset=geode->getOrCreateStateSet();
osg::Vec3Array *points=new osg::Vec3Array;
osg::Image* image = osgDB::readImageFile("Images/blueFlowers.png");
if (image)
{
@@ -363,10 +363,10 @@ osg::Group *makedelaunay(const int ndcs)
texture->setWrap( osg::Texture2D::WRAP_T, osg::Texture2D::REPEAT );
stateset->setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON);
}
geode->setStateSet( stateset );
unsigned int i;
int eod=0;
while (eod>=0) {
osg::Vec3d pos=getpt(eod);
@@ -400,7 +400,7 @@ osg::Group *makedelaunay(const int ndcs)
}
dc->setVertexArray(bounds);
dc->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_STRIP,0,nmax) );
trig->addInputConstraint(dc.get());
what << nmax << " point simple constraint\n";
}
@@ -426,10 +426,10 @@ osg::Group *makedelaunay(const int ndcs)
}
dc->setVertexArray(bounds);
dc->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_LOOP,0,12) );
trig->addInputConstraint(dc.get());
what << 12 << " point closed loop";
if (ndcs>2) {
wc=new WallConstraint; // This example does not remove the interior
// eg to force terrain edges that are on ridges in the terrain etc.
@@ -447,7 +447,7 @@ osg::Group *makedelaunay(const int ndcs)
trig->addInputConstraint(wc.get());
what << " with interior removed\n";
what << 5 << " point wall derived constraint\n";
if (ndcs>3) {
// add a removed area and replace it with a different texture
dc2=new ArealConstraint;
@@ -461,7 +461,7 @@ osg::Group *makedelaunay(const int ndcs)
dc2->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_LOOP,0,18) );
trig->addInputConstraint(dc2.get());
what << 18 << " point area replaced\n";
if (ndcs>4) {
dc3=new LinearConstraint;
// a linear feature or 'road'
@@ -495,7 +495,7 @@ osg::Group *makedelaunay(const int ndcs)
forest->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_LOOP,0,12) );
if (ndcs==6) trig->addInputConstraint(forest.get());
what << 12 << " point forest constraint\n";
if (ndcs>6) { // add roads that intersect forest
osg::ref_ptr<osgUtil::DelaunayConstraint> forestplus=new osgUtil::DelaunayConstraint;
forestroad=new LinearConstraint;
@@ -605,17 +605,17 @@ osg::Group *makedelaunay(const int ndcs)
}
} // ndcs>0
trig->setInputPointArray(points);
/** NB you need to supply a vec3 array for the triangulator to calculate normals into */
osg::Vec3Array *norms=new osg::Vec3Array;
trig->setOutputNormalArray(norms);
trig->triangulate();
osg::notify(osg::WARN) << " End of trig\n " <<std::endl;
// Calculate the texture coordinates after triangulation as
// Calculate the texture coordinates after triangulation as
//the points may get disordered by the triangulate function
osg::ref_ptr<osg::Geometry> gm=new osg::Geometry;
osg::ref_ptr<deprecated_osg::Geometry> gm=new deprecated_osg::Geometry;
gm->setVertexArray(points); // points may have been modified in order by triangulation.
/** calculate texture coords for terrain points */
if (image) {
@@ -629,17 +629,17 @@ osg::Group *makedelaunay(const int ndcs)
}
gm->addPrimitiveSet(trig->getTriangles());
gm->setNormalArray(trig->getOutputNormalArray());
gm->setNormalBinding(osg::Geometry::BIND_PER_PRIMITIVE);
gm->setNormalBinding(deprecated_osg::Geometry::BIND_PER_PRIMITIVE);
geode->addDrawable(gm.get());
if (ndcs>0) {
for ( std::vector < pyramid* >::iterator itr=pyrlist.begin(); itr!=pyrlist.end(); itr++) {
trig->removeInternalTriangles(*itr);
geode->addDrawable((*itr)->makeGeometry()); // this fills the holes of each pyramid with geometry
}
if (ndcs>2) {
trig->removeInternalTriangles(dc.get());
wc->setTexture("Images/Brick-Norman-Brown.TGA"); // wall looks like brick
geode->addDrawable(wc->makeWallGeometry()); // this creates wall at wc drawarrays
if (ndcs>3) {
@@ -647,13 +647,13 @@ osg::Group *makedelaunay(const int ndcs)
osg::ref_ptr<osg::Vec3Array> arpts=dc2->getPoints(points);
dc2->setTexture("Images/purpleFlowers.png");
geode->addDrawable(dc2->makeAreal(arpts.get())); // this creates fill in geometry
if (ndcs>4) { // a simple "road"
trig->removeInternalTriangles(dc3.get());
dc3->setTexture ("Images/road.png");
dc3->setTexrep(40,9.5); // texture is repeated at this frequency
geode->addDrawable(dc3->makeGeometry(points)); // this creates road geometry
if (ndcs>5) {
if (ndcs>6) { // road & forest overlap - order of removal is important
trig->removeInternalTriangles(forestroad.get());
@@ -661,11 +661,11 @@ osg::Group *makedelaunay(const int ndcs)
trig->removeInternalTriangles(forestroad3.get());
}
trig->removeInternalTriangles(forest.get());
forest->setTexture("Images/forestRoof.png");
forest->setTexture("Images/forestRoof.png");
osg::ref_ptr<osg::Vec3Array> locpts=forest->getPoints(points);
geode->addDrawable(forest->makeAreal(locpts.get()));
forest->setWallTexture("Images/forestWall.png");
forest->setWallTexture("Images/forestWall.png");
geode->addDrawable(forest->makeWallGeometry(locpts.get()) );
for (osg::Vec3Array::iterator vit=(*locpts).begin(); vit!=(*locpts).end(); vit++) {
(*vit)+=osg::Vec3(0,0,30);
@@ -713,10 +713,10 @@ osg::Group *makedelaunay(const int ndcs)
class KeyboardEventHandler : public osgGA::GUIEventHandler
{ // extra event handler traps 'n' key to re-triangulate the basic terrain.
public:
KeyboardEventHandler(osgViewer::Viewer &vr):
viewer(vr), iview(0) {}
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&)
{
switch(ea.getEventType())
@@ -738,7 +738,7 @@ public:
}
return false;
}
osgViewer::Viewer &viewer;
int iview;
};
@@ -786,11 +786,11 @@ osg::Vec2Array * WallConstraint::getWallTexcoords(const float height) const
}
const osg::Vec3 curp=(*vertices)[prset->index (0)];
circumference+=(curp-prevp).length();
int nround=(int)(circumference/txxrepWall);
if (nround<1) nround=1; // at least one repeat.
texrepRound=circumference/nround;
float ds=0;
prevp=(*vertices)[prset->index (prset->getNumIndices()-1)];
if (tcoords) {
@@ -809,7 +809,7 @@ osg::Vec2Array * WallConstraint::getWallTexcoords(const float height) const
tcoords->push_back(tci);
}
} // per primitiveset
}
return tcoords;
}
@@ -836,9 +836,8 @@ osg::Geometry *WallConstraint::makeWallGeometry() const
gm->setVertexArray(getWall(height));
gm->addPrimitiveSet(makeWall());
gm->setTexCoordArray(0,getWallTexcoords(height));
gm->setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
gm->setNormalArray(getWallNormals()); // this creates normals to walls
gm->setNormalArray(getWallNormals(), osg::Array::BIND_PER_VERTEX); // this creates normals to walls
return gm.release();
}
@@ -913,11 +912,11 @@ osg::Vec2Array * ArealConstraint::getWallTexcoords(const float height) const
}
const osg::Vec3 curp=(*vertices)[prset->index (0)];
circumference+=(curp-prevp).length();
int nround=(int)(circumference/txxrepWall);
if (nround<1) nround=1; // at least one repeat.
texrepRound=circumference/nround;
float ds=0;
prevp=(*vertices)[prset->index (prset->getNumIndices()-1)];
if (tcoords) {
@@ -988,23 +987,23 @@ osg::DrawArrays * ArealConstraint::makeWall(void) const
return (new osg::DrawArrays(osg::PrimitiveSet::QUAD_STRIP,0,2+2*_line->size()));
}
osg::Geometry *ArealConstraint::makeWallGeometry( osg::Vec3Array *pt)
deprecated_osg::Geometry *ArealConstraint::makeWallGeometry( osg::Vec3Array *pt)
{
osg::ref_ptr<osg::Geometry> gm=new osg::Geometry; // the wall
osg::ref_ptr<osg::Geometry> edges=new osg::Geometry; // edges of bounds
osg::ref_ptr<deprecated_osg::Geometry> gm=new deprecated_osg::Geometry; // the wall
osg::ref_ptr<deprecated_osg::Geometry> edges=new deprecated_osg::Geometry; // edges of bounds
edges->setVertexArray(pt);
osg::DrawElementsUInt *trgeom=getTriangles();
edges->addPrimitiveSet(trgeom);
osg::ref_ptr<osgUtil::Tessellator> tscx=new osgUtil::Tessellator; // this assembles all the constraints
tscx->setTessellationType(osgUtil::Tessellator::TESS_TYPE_GEOMETRY);
tscx->setBoundaryOnly(true);
tscx->setWindingType( osgUtil::Tessellator::TESS_WINDING_NONZERO);
tscx->setWindingType( osgUtil::Tessellator::TESS_WINDING_NONZERO);
// find all edges.
const osg::Vec3Array *points=dynamic_cast<osg::Vec3Array*>(getVertexArray());
tscx->retessellatePolygons(*(edges)); // find all edges
if (walltexture!="") {
osg::Image* image = osgDB::readImageFile(walltexture.c_str());
if (image)
@@ -1047,21 +1046,21 @@ osg::Geometry *ArealConstraint::makeWallGeometry( osg::Vec3Array *pt)
nstart+=2+2*pr->getNumIndices();
}
}
return gm.release();
}
osg::Geometry * ArealConstraint::makeAreal( osg::Vec3Array *points)
deprecated_osg::Geometry * ArealConstraint::makeAreal( osg::Vec3Array *points)
{
osg::ref_ptr<osg::Geometry> gm; // the fill in area
osg::ref_ptr<deprecated_osg::Geometry> gm; // the fill in area
if (_interiorTris.size()>0) {
gm =new osg::Geometry; // the forest roof
gm =new deprecated_osg::Geometry; // the forest roof
gm->setVertexArray(points);
osg::DrawElementsUInt *trgeom=getTriangles();
gm->addPrimitiveSet(trgeom);
gm->setNormalArray(getCanopyNormals(points));
gm->setNormalBinding(osg::Geometry::BIND_PER_PRIMITIVE);
gm->setNormalBinding(deprecated_osg::Geometry::BIND_PER_PRIMITIVE);
gm->setTexCoordArray(0,getCanopyTexcoords(points));
osg::Image* image = osgDB::readImageFile(texture);
if (image)
@@ -1094,7 +1093,7 @@ void LinearConstraint::setVertices( osg::Vec3Array *lp, const float w)
for(unsigned int i=0;i<lp->size();i++) {
osg::Vec3 valong;
osg::Vec3 pos[2];
if (i==0) {
valong=(*lp)[i+1]-(*lp)[i];
} else if (i==lp->size()-1) {
@@ -1121,7 +1120,7 @@ void LinearConstraint::setVertices( osg::Vec3Array *lp, const float w)
osg::DrawArrays* LinearConstraint::makeRoad(void ) const
{
return new osg::DrawArrays(osg::PrimitiveSet::QUAD_STRIP,0,2*_midline->size());
}
osg::Vec3Array *LinearConstraint::getRoadNormals(const osg::Vec3Array* /*points*/) const
@@ -1199,7 +1198,7 @@ osg::Vec2Array *LinearConstraint::getRoadTexcoords(const osg::Vec3Array *points)
ptfound=true;
}
ibm1=ib;
ib++;
ib++;
pminus=(*vit);
}
}
@@ -1219,7 +1218,7 @@ osg::Vec2Array *LinearConstraint::getRoadTexcoords(const osg::Vec3Array *points)
}
return tcoords.release();
}
osg::Vec3Array * LinearConstraint::getNormals(const osg::Vec3Array *points)
osg::Vec3Array * LinearConstraint::getNormals(const osg::Vec3Array *points)
{
osg::ref_ptr<osg::Vec3Array> norms=new osg::Vec3Array;
for (osg::DrawElementsUInt::iterator uiitr=prim_tris_->begin(); uiitr!=prim_tris_->end();uiitr+=3) {
@@ -1233,9 +1232,9 @@ osg::Vec3Array * LinearConstraint::getNormals(const osg::Vec3Array *points)
return norms.release();
}
osg::Geometry * LinearConstraint::makeGeometry(const osg::Vec3Array *points)
deprecated_osg::Geometry * LinearConstraint::makeGeometry(const osg::Vec3Array *points)
{
osg::ref_ptr<osg::Geometry> gm=new osg::Geometry; // the fill in road/railway
osg::ref_ptr<deprecated_osg::Geometry> gm=new deprecated_osg::Geometry; // the fill in road/railway
if (_midline->size()>0) {
osg::ref_ptr<osg::Vec3Array> locpts=getPoints(points);
if (texture!="") {
@@ -1258,19 +1257,19 @@ osg::Geometry * LinearConstraint::makeGeometry(const osg::Vec3Array *points)
}
gm->setVertexArray(locpts.get());
gm->setNormalArray(getNormals(locpts.get()));
gm->setNormalBinding(osg::Geometry::BIND_PER_PRIMITIVE);
gm->setNormalBinding(deprecated_osg::Geometry::BIND_PER_PRIMITIVE);
gm->addPrimitiveSet(getTriangles());
}
return gm.release();
}
int main( int argc, char **argv )
{
// use an ArgumentParser object to manage the program arguments.
osg::ArgumentParser arguments(&argc,argv);
@@ -1279,24 +1278,24 @@ int main( int argc, char **argv )
// create the scene from internal specified terrain/constraints.
osg::ref_ptr<osg::Node> loadedModel = makedelaunay(0);
// if no model has been successfully loaded report failure.
if (!loadedModel)
if (!loadedModel)
{
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
return 1;
}
// optimize the scene graph, remove redundant nodes and state etc.
osgUtil::Optimizer optimizer;
optimizer.optimize(loadedModel.get());
// pass the loaded scene graph to the viewer.
viewer.setSceneData(loadedModel.get());
// copied from osgtessealte.cpp
// add event handler for keyboard 'n' to retriangulate
viewer.addEventHandler(new KeyboardEventHandler(viewer));
return viewer.run();
}

View File

@@ -46,7 +46,7 @@ osg::Node* createScene()
osg::Geode* earth_geode = new osg::Geode;
earth_geode->setName("EarthGeode");
earth_geode->addDrawable(earth_sd);
// Create the Sun, in yellow
osg::ShapeDrawable *sun_sd = new osg::ShapeDrawable;
osg::Sphere* sun_sphere = new osg::Sphere;
@@ -63,13 +63,12 @@ osg::Node* createScene()
osg::PositionAttitudeTransform *pat = new osg::PositionAttitudeTransform;
pat->setPosition(osg::Vec3d(0.0, AU, 0.0));
pat->addChild(sun_geode);
osg::Geometry * unitCircle = new osg::Geometry();
{
osg::Vec4Array * colours = new osg::Vec4Array(1);
(*colours)[0] = osg::Vec4d(1.0,1.0,1.0,1.0);
unitCircle->setColorArray(colours);
unitCircle->setColorBinding(osg::Geometry::BIND_OVERALL);
unitCircle->setColorArray(colours, osg::Array::BIND_OVERALL);
const unsigned int n_points = 1024;
osg::Vec3Array * coords = new osg::Vec3Array(n_points);
const double dx = 2.0*osg::PI/n_points;
@@ -88,8 +87,7 @@ osg::Node* createScene()
{
osg::Vec4Array *colours = new osg::Vec4Array(1);
(*colours)[0] = osg::Vec4d(1.0,0.0,0.0,1.0);
axes->setColorArray(colours);
axes->setColorBinding(osg::Geometry::BIND_OVERALL);
axes->setColorArray(colours, osg::Array::BIND_OVERALL);
osg::Vec3Array *coords = new osg::Vec3Array(6);
(*coords)[0].set(osg::Vec3d(0.0, 0.0, 0.0));
(*coords)[1].set(osg::Vec3d(0.5, 0.0, 0.0));
@@ -101,25 +99,25 @@ osg::Node* createScene()
axes->getOrCreateStateSet()->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
axes->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6));
}
// Earth orbit
osg::Geode * earthOrbitGeode = new osg::Geode;
earthOrbitGeode->addDrawable(unitCircle);
earthOrbitGeode->addDrawable(axes);
earthOrbitGeode->setName("EarthOrbitGeode");
osg::PositionAttitudeTransform * earthOrbitPAT = new osg::PositionAttitudeTransform;
earthOrbitPAT->setScale(osg::Vec3d(AU,AU,AU));
earthOrbitPAT->setPosition(osg::Vec3d(0.0, AU, 0.0));
earthOrbitPAT->addChild(earthOrbitGeode);
earthOrbitPAT->setName("EarthOrbitPAT");
osg::Group* scene = new osg::Group;
scene->setName("SceneGroup");
scene->addChild(earth_geode);
scene->addChild(pat);
scene->addChild(earthOrbitPAT);
return scene;
}
@@ -144,9 +142,9 @@ int main( int argc, char **argv )
osg::ref_ptr<osg::Node> scene = osgDB::readNodeFiles(arguments);
// if one hasn't been loaded create an earth and sun test model.
if (!scene)
if (!scene)
{
scene = createScene();
scene = createScene();
needToSetHomePosition = true;
}
// pass the loaded scene graph to the viewer.
@@ -158,7 +156,7 @@ int main( int argc, char **argv )
{
viewer.getCameraManipulator()->setHomePosition(osg::Vec3d(0.0,-5.0*r_earth,0.0),osg::Vec3d(0.0,0.0,0.0),osg::Vec3d(0.0,0.0,1.0));
}
double zNear=1.0, zMid=10.0, zFar=1000.0;
if (arguments.read("--depth-partition",zNear, zMid, zFar))
{
@@ -175,7 +173,7 @@ int main( int argc, char **argv )
// set up depth partitioning with default settings
viewer.setUpDepthPartition();
}
return viewer.run();
}

View File

@@ -27,48 +27,48 @@
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 subgraph and removing depth peeling steps!!!
//That's why it is done here
osg::StateSet* stateset = _parent->getOrCreateStateSet();
@@ -77,12 +77,12 @@ DePee::DePee(osg::Group* parent, osg::Group* subgraph, unsigned width, unsigned
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();
addDePeePass();
//render head up display
(void) createHUD();
@@ -111,7 +111,7 @@ void DePee::setSketchiness(double sketchiness)
{
_sketchiness->set((float)sketchiness);
}
void DePee::setColored(bool colored)
{
if(colored == !_isColored)
@@ -128,20 +128,20 @@ void DePee::setColored(bool 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);
@@ -150,7 +150,7 @@ void DePee::setEdgy(bool edgy)
{
_dePeePasses.back()->remRenderPass(EDGE_MAP);
}
for(unsigned int i=0; i < n; i++)
{
addDePeePass();
@@ -158,8 +158,8 @@ void DePee::setEdgy(bool edgy)
}
_edgy->set(edgy);
}
void DePee::setFPS(double* fps)
{
@@ -177,29 +177,29 @@ unsigned int DePee::getNumberOfRenderPasses()
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;
}
@@ -213,12 +213,12 @@ bool DePee::remDePeePass()
_dePeePasses.pop_back();
_renderToFirst = !_renderToFirst;
if(_isColored)
{
(void) createMap(COLOR_MAP, false);
}
return true;
}
@@ -234,11 +234,11 @@ bool DePee::createNoiseMap()
_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++)
@@ -258,10 +258,10 @@ bool DePee::createNoiseMap()
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,
image->setImage(_width, _height, 1,
1, GL_LUMINANCE, GL_UNSIGNED_BYTE,
data,
osg::Image::USE_NEW_DELETE);
_noiseMap->setImage(image);
return true;
@@ -270,24 +270,24 @@ bool DePee::createNoiseMap()
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);
@@ -298,16 +298,16 @@ bool DePee::createHUD()
_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));
@@ -315,24 +315,22 @@ bool DePee::createHUD()
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);
geom->setNormalArray(normals, osg::Array::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->setColorArray(colors, osg::Array::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);
}
@@ -341,7 +339,7 @@ bool DePee::createHUD()
// set the projection matrix
camera->setProjectionMatrix(osg::Matrix::ortho2D(0,1280,0,1024));
// set the view matrix
// set the view matrix
camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
camera->setViewMatrix(osg::Matrix::identity());
@@ -352,19 +350,19 @@ bool DePee::createHUD()
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:
@@ -377,13 +375,13 @@ bool DePee::createMap(MapMode mapMode, bool 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);
@@ -393,20 +391,20 @@ bool DePee::createFinal()
// 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
// 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))
@@ -414,82 +412,82 @@ bool DePee::createFinal()
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);
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));
@@ -501,14 +499,14 @@ bool DePee::createEdgeMap(bool first)
_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 |
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));
@@ -518,12 +516,12 @@ bool DePee::createEdgeMap(bool first)
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;
}
@@ -531,13 +529,13 @@ bool DePee::createEdgeMap(bool first)
bool DePee::createNormalDepthColorMap(MapMode mapMode, bool first)
{
DePeePass* pass;
pass = _dePeePasses.back();
pass->newRenderPass(mapMode);
//
// setup camera
// setup camera
//
// set up the background color and clear mask
@@ -549,23 +547,23 @@ bool DePee::createNormalDepthColorMap(MapMode mapMode, bool first)
{
return false;
}
float znear = 1.0f*bs.radius();
float zfar = 3.0f*bs.radius();
// 2:1 aspect ratio as per flag geometry 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));
@@ -574,24 +572,24 @@ bool DePee::createNormalDepthColorMap(MapMode mapMode, bool first)
// 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 |
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());
@@ -602,17 +600,17 @@ bool DePee::createNormalDepthColorMap(MapMode mapMode, bool first)
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));
@@ -626,26 +624,26 @@ bool DePee::createNormalDepthColorMap(MapMode mapMode, bool first)
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;
}
@@ -665,7 +663,7 @@ bool DePee::updateHUDText()
+ (_isSketchy ? "+" : "-") + "(S)ketchy " +
+ (_isColored ? "+" : "-") + "(C)olored " +
+ "-> "+Utility::toString(getNumberOfRenderPasses())+ " Rendering Passes "
+ "@ "
+ "@ "
+ tmp + " fps");
return true;
}

View File

@@ -19,7 +19,7 @@ bool Utility::readFile(const char* fName, std::string& s)
{
std::string foundFile = osgDB::findDataFile(fName);
if (foundFile.empty()) return false;
osgDB::ifstream is;//(fName);
is.open(foundFile.c_str());
if (is.fail())
@@ -51,17 +51,17 @@ osg::Program* Utility::createProgram(std::string vs, std::string fs)
if(!readFile((char*)vs.c_str(), vertSource))
{
printf("shader source not found\n");
return false;
return 0;
}
std::string fragSource;
if(!readFile((char*)fs.c_str(), fragSource))
{
printf("shader source not found\n");
return false;
return 0;
}
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() ) );
@@ -80,28 +80,28 @@ double Utility::getNoise(unsigned x, unsigned y, unsigned random)
double Utility::smoothNoise(unsigned width, unsigned height, unsigned x, unsigned y, unsigned char* noise)
{
assert(noise);
if(x==0 || x > width -2
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]
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)
{
@@ -124,30 +124,29 @@ osg::Geode* Utility::getCanvasQuad(unsigned width, unsigned height, double depth
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);
quad->setColorArray(colors, osg::Array::BIND_OVERALL);
osg::Geode* geode = new osg::Geode();
geode->addDrawable(quad);
return geode;
}

View File

@@ -55,16 +55,16 @@ using namespace osg;
osg::Node* createDistortionSubgraph(osg::Node* subgraph, const osg::Vec4& clearColour)
{
osg::Group* distortionNode = 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_RGBA);
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.
{
osg::Camera* camera = new osg::Camera;
@@ -92,10 +92,10 @@ osg::Node* createDistortionSubgraph(osg::Node* subgraph, const osg::Vec4& clearC
// add subgraph to render
camera->addChild(subgraph);
distortionNode->addChild(camera);
}
// set up the hud camera
{
// create the quad to visualize.
@@ -122,8 +122,6 @@ osg::Node* createDistortionSubgraph(osg::Node* subgraph, const osg::Vec4& clearC
osg::Vec2 dx_texcoord(1.0f/(float)(noSteps-1),0.0f);
osg::Vec2 dy_texcoord(0.0f,1.0f/(float)(noSteps-1));
osg::Vec3 cursor = bottom;
osg::Vec2 texcoord = bottom_texcoord;
int i,j;
for(i=0;i<noSteps;++i)
{
@@ -143,8 +141,7 @@ osg::Node* createDistortionSubgraph(osg::Node* subgraph, const osg::Vec4& clearC
// pass the created vertex array to the points geometry object.
polyGeom->setVertexArray(vertices);
polyGeom->setColorArray(colors);
polyGeom->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
polyGeom->setColorArray(colors, osg::Array::BIND_PER_VERTEX);
polyGeom->setTexCoordArray(0,texcoords);
@@ -161,7 +158,7 @@ osg::Node* createDistortionSubgraph(osg::Node* subgraph, const osg::Vec4& clearC
}
// new we need to add the texture to the Drawable, we do so by creating a
// 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 = polyGeom->getOrCreateStateSet();
stateset->setTextureAttributeAndModes(0, texture,osg::StateAttribute::ON);
@@ -183,7 +180,7 @@ osg::Node* createDistortionSubgraph(osg::Node* subgraph, const osg::Vec4& clearC
// add subgraph to render
camera->addChild(geode);
distortionNode->addChild(camera);
}
return distortionNode;
@@ -191,9 +188,9 @@ osg::Node* createDistortionSubgraph(osg::Node* subgraph, const osg::Vec4& clearC
void setDomeFaces(osgViewer::Viewer& viewer, osg::ArgumentParser& arguments)
{
osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface();
if (!wsi)
if (!wsi)
{
osg::notify(osg::NOTICE)<<"Error, no WindowSystemInterface available, cannot create windows."<<std::endl;
return;
@@ -239,7 +236,7 @@ void setDomeFaces(osgViewer::Viewer& viewer, osg::ArgumentParser& arguments)
viewer.addSlave(camera.get(), osg::Matrixd(), osg::Matrixd());
}
// top face
{
osg::ref_ptr<osg::Camera> camera = new osg::Camera;
@@ -299,7 +296,7 @@ void setDomeFaces(osgViewer::Viewer& viewer, osg::ArgumentParser& arguments)
viewer.addSlave(camera.get(), osg::Matrixd(), osg::Matrixd::rotate(osg::inDegrees(-180.0f), 1.0,0.0,0.0));
}
viewer.getCamera()->setProjectionMatrixAsPerspective(90.0f, 1.0, 1, 1000.0);
viewer.assignSceneDataToCameras();
@@ -316,15 +313,15 @@ osg::Geometry* createDomeDistortionMesh(const osg::Vec3& origin, const osg::Vec3
osg::Vec3d center(0.0,0.0,0.0);
osg::Vec3d eye(0.0,0.0,0.0);
double distance = sqrt(sphere_radius*sphere_radius - collar_radius*collar_radius);
if (arguments.read("--distance", distance)) {}
bool centerProjection = false;
osg::Vec3d projector = eye - osg::Vec3d(0.0,0.0, distance);
osg::notify(osg::NOTICE)<<"Projector position = "<<projector<<std::endl;
osg::notify(osg::NOTICE)<<"distance = "<<distance<<std::endl;
@@ -341,7 +338,7 @@ osg::Geometry* createDomeDistortionMesh(const osg::Vec3& origin, const osg::Vec3
osg::Vec3 yAxis(heightVector);
float height = heightVector.length();
yAxis /= height;
int noSteps = 50;
osg::Vec3Array* vertices = new osg::Vec3Array;
@@ -351,14 +348,11 @@ osg::Geometry* createDomeDistortionMesh(const osg::Vec3& origin, const osg::Vec3
osg::Vec3 bottom = origin;
osg::Vec3 dx = xAxis*(width/((float)(noSteps-1)));
osg::Vec3 dy = yAxis*(height/((float)(noSteps-1)));
osg::Vec3d screenCenter = origin + widthVector*0.5f + heightVector*0.5f;
float screenRadius = heightVector.length() * 0.5f;
osg::Vec3 cursor = bottom;
int i,j;
if (centerProjection)
{
for(i=0;i<noSteps;++i)
@@ -401,13 +395,13 @@ osg::Geometry* createDomeDistortionMesh(const osg::Vec3& origin, const osg::Vec3
if (phi > osg::PI_2) phi = osg::PI_2;
// osg::notify(osg::NOTICE)<<"theta = "<<theta<< "phi="<<phi<<std::endl;
double f = distance * sin(phi);
double e = distance * cos(phi) + sqrt( sphere_radius*sphere_radius - f*f);
double l = e * cos(phi);
double h = e * sin(phi);
double z = l - distance;
osg::Vec3 texcoord(h * cos(theta) / sphere_radius,
h * sin(theta) / sphere_radius,
z / sphere_radius);
@@ -421,12 +415,11 @@ osg::Geometry* createDomeDistortionMesh(const osg::Vec3& origin, const osg::Vec3
// 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->setColorArray(colors, osg::Array::BIND_PER_VERTEX);
geometry->setTexCoordArray(0,texcoords);
@@ -440,15 +433,15 @@ osg::Geometry* createDomeDistortionMesh(const osg::Vec3& origin, const osg::Vec3
}
geometry->addPrimitiveSet(elements);
}
return geometry;
}
void setDomeCorrection(osgViewer::Viewer& viewer, osg::ArgumentParser& arguments)
{
osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface();
if (!wsi)
if (!wsi)
{
osg::notify(osg::NOTICE)<<"Error, no WindowSystemInterface available, cannot create windows."<<std::endl;
return;
@@ -468,8 +461,8 @@ void setDomeCorrection(osgViewer::Viewer& viewer, osg::ArgumentParser& arguments
traits->windowDecoration = false;
traits->doubleBuffer = true;
traits->sharedContext = 0;
osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get());
if (!gc)
@@ -490,8 +483,8 @@ void setDomeCorrection(osgViewer::Viewer& viewer, osg::ArgumentParser& arguments
texture->setInternalFormat(GL_RGB);
texture->setFilter(osg::Texture::MIN_FILTER,osg::Texture::LINEAR);
texture->setFilter(osg::Texture::MAG_FILTER,osg::Texture::LINEAR);
#if 0
#if 0
osg::Camera::RenderTargetImplementation renderTargetImplementation = osg::Camera::SEPERATE_WINDOW;
GLenum buffer = GL_FRONT;
#else
@@ -517,7 +510,7 @@ void setDomeCorrection(osgViewer::Viewer& viewer, osg::ArgumentParser& arguments
viewer.addSlave(camera.get(), osg::Matrixd(), osg::Matrixd());
}
// top face
{
osg::ref_ptr<osg::Camera> camera = new osg::Camera;
@@ -613,7 +606,7 @@ void setDomeCorrection(osgViewer::Viewer& viewer, osg::ArgumentParser& arguments
viewer.addSlave(camera.get(), osg::Matrixd(), osg::Matrixd::rotate(osg::inDegrees(180.0f), 1.0,0.0,0.0));
}
viewer.getCamera()->setProjectionMatrixAsPerspective(90.0f, 1.0, 1, 1000.0);
@@ -623,7 +616,7 @@ void setDomeCorrection(osgViewer::Viewer& viewer, osg::ArgumentParser& arguments
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), arguments));
// new we need to add the texture to the mesh, we do so by creating a
// 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);
@@ -641,18 +634,18 @@ void setDomeCorrection(osgViewer::Viewer& viewer, osg::ArgumentParser& arguments
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(), false);
}
viewer.getCamera()->setNearFarRatio(0.0001f);
}
@@ -670,23 +663,23 @@ int main(int argc, char** argv)
// if not loaded assume no arguments passed in, try use default mode instead.
if (!loadedModel) loadedModel = osgDB::readNodeFile("cow.osgt");
if (!loadedModel)
{
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
return 1;
}
if (arguments.read("--dome") || arguments.read("--puffer") )
{
{
setDomeCorrection(viewer, arguments);
viewer.setSceneData( loadedModel );
}
else if (arguments.read("--faces"))
{
{
setDomeFaces(viewer, arguments);
@@ -702,7 +695,7 @@ int main(int argc, char** argv)
{
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));
@@ -731,7 +724,7 @@ int main(int argc, char** argv)
while (arguments.read("-p",pathfile))
{
osgGA::AnimationPathManipulator* apm = new osgGA::AnimationPathManipulator(pathfile);
if (apm || !apm->valid())
if (apm || !apm->valid())
{
unsigned int num = keyswitchManipulator->getNumMatrixManipulators();
keyswitchManipulator->addMatrixManipulator( keyForAnimationPath, "Path", apm );
@@ -747,7 +740,7 @@ int main(int argc, char** argv)
// add the state manipulator
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
// add the stats handler
viewer.addEventHandler(new osgViewer::StatsHandler);

View File

@@ -31,6 +31,8 @@
#include <osg/StateSet>
#include <osg/Switch>
#include <osg/Texture2D>
#include <osg/TextureBuffer>
#include <osg/Image>
#include <osg/TexEnv>
#include <osg/VertexProgram>
#include <osg/FragmentProgram>
@@ -85,9 +87,9 @@ public:
float _height;
unsigned int _type;
};
typedef std::vector< osg::ref_ptr<Tree> > TreeList;
class Cell : public osg::Referenced
{
public:
@@ -95,21 +97,21 @@ public:
Cell():_parent(0) {}
Cell(osg::BoundingBox& bb):_parent(0), _bb(bb) {}
void addCell(Cell* cell) { cell->_parent=this; _cells.push_back(cell); }
void addTree(Tree* tree) { _trees.push_back(tree); }
void addTrees(const TreeList& trees) { _trees.insert(_trees.end(),trees.begin(),trees.end()); }
void computeBound();
bool contains(const osg::Vec3& position) const { return _bb.contains(position); }
bool divide(unsigned int maxNumTreesPerCell=10);
bool divide(bool xAxis, bool yAxis, bool zAxis);
void bin();
@@ -117,7 +119,7 @@ public:
osg::BoundingBox _bb;
CellList _cells;
TreeList _trees;
};
float random(float min,float max) { return min + (max-min)*(float)rand()/(float)RAND_MAX; }
@@ -139,11 +141,17 @@ public:
osg::Node* createTransformGraph(Cell* cell,osg::StateSet* stateset);
osg::Node* createShaderGraph(Cell* cell,osg::StateSet* stateset);
osg::Node* createGeometryShaderGraph(Cell* cell, osg::StateSet* stateset);
osg::Node* createTextureBufferGraph(Cell* cell, osg::Geometry* templateGeometry);
void CollectTreePositions(Cell* cell, std::vector< osg::Vec3 >& positions);
osg::Node* createHUDWithText(const std::string& text);
osg::Node* createScene(unsigned int numTreesToCreates);
osg::Node* createScene(unsigned int numTreesToCreates, unsigned int maxNumTreesPerCell);
void advanceToNextTechnique(int delta=1)
{
if (_techniqueSwitch.valid())
@@ -156,10 +164,10 @@ public:
_techniqueSwitch->setSingleChildOn(_currentTechnique);
}
}
osg::ref_ptr<osg::Switch> _techniqueSwitch;
int _currentTechnique;
};
@@ -169,22 +177,22 @@ class TechniqueEventHandler : public osgGA::GUIEventHandler
public:
TechniqueEventHandler(ForestTechniqueManager* ttm=0) { _ForestTechniqueManager = ttm; }
META_Object(osgforestApp,TechniqueEventHandler);
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&, osg::Object*, osg::NodeVisitor*);
virtual void getUsage(osg::ApplicationUsage& usage) const;
protected:
~TechniqueEventHandler() {}
TechniqueEventHandler(const TechniqueEventHandler&,const osg::CopyOp&) {}
osg::ref_ptr<ForestTechniqueManager> _ForestTechniqueManager;
};
bool TechniqueEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&, osg::Object*, osg::NodeVisitor*)
@@ -194,14 +202,14 @@ bool TechniqueEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAc
case(osgGA::GUIEventAdapter::KEYDOWN):
{
if (ea.getKey()=='n' ||
ea.getKey()==osgGA::GUIEventAdapter::KEY_Right ||
ea.getKey()==osgGA::GUIEventAdapter::KEY_Right ||
ea.getKey()==osgGA::GUIEventAdapter::KEY_KP_Right)
{
_ForestTechniqueManager->advanceToNextTechnique(1);
return true;
}
else if (ea.getKey()=='p' ||
ea.getKey()==osgGA::GUIEventAdapter::KEY_Left ||
ea.getKey()==osgGA::GUIEventAdapter::KEY_Left ||
ea.getKey()==osgGA::GUIEventAdapter::KEY_KP_Left)
{
_ForestTechniqueManager->advanceToNextTechnique(-1);
@@ -329,7 +337,7 @@ bool ForestTechniqueManager::Cell::divide(bool xAxis, bool yAxis, bool zAxis)
}
void ForestTechniqueManager::Cell::bin()
{
{
// put trees in appropriate cells.
TreeList treesNotAssigned;
for(TreeList::iterator titr=_trees.begin();
@@ -387,9 +395,9 @@ osg::Geode* ForestTechniqueManager::createTerrain(const osg::Vec3& origin, const
texture->setImage(image);
stateset->setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON);
}
geode->setStateSet( stateset );
unsigned int numColumns = 38;
unsigned int numRows = 39;
unsigned int r;
@@ -406,7 +414,7 @@ osg::Geode* ForestTechniqueManager::createTerrain(const osg::Vec3& origin, const
max_z = osg::maximum(max_z,vertex[r+c*numRows][2]);
}
}
float scale_z = size.z()/(max_z-min_z);
@@ -427,22 +435,22 @@ osg::Geode* ForestTechniqueManager::createTerrain(const osg::Vec3& origin, const
grid->setHeight(c,r,(vertex[r+c*numRows][2]-min_z)*scale_z);
}
}
geode->addDrawable(new osg::ShapeDrawable(grid));
}
else
{
osg::Geometry* geometry = new osg::Geometry;
osg::Vec3Array& v = *(new osg::Vec3Array(numColumns*numRows));
osg::Vec2Array& t = *(new osg::Vec2Array(numColumns*numRows));
osg::Vec4ubArray& color = *(new osg::Vec4ubArray(1));
color[0].set(255,255,255,255);
float rowCoordDelta = size.y()/(float)(numRows-1);
float columnCoordDelta = size.x()/(float)(numColumns-1);
float rowTexDelta = 1.0f/(float)(numRows-1);
float columnTexDelta = 1.0f/(float)(numColumns-1);
@@ -464,12 +472,11 @@ osg::Geode* ForestTechniqueManager::createTerrain(const osg::Vec3& origin, const
pos.y() += rowCoordDelta;
tex.y() += rowTexDelta;
}
geometry->setVertexArray(&v);
geometry->setColorArray(&color);
geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
geometry->setColorArray(&color, osg::Array::BIND_OVERALL);
geometry->setTexCoordArray(0,&t);
for(r=0;r<numRows-1;++r)
{
osg::DrawElementsUShort& drawElements = *(new osg::DrawElementsUShort(GL_QUAD_STRIP,2*numColumns));
@@ -481,13 +488,13 @@ osg::Geode* ForestTechniqueManager::createTerrain(const osg::Vec3& origin, const
drawElements[ei++] = (r)*numColumns+c;
}
}
geode->addDrawable(geometry);
osgUtil::SmoothingVisitor sv;
sv.smooth(*geometry);
}
return geode;
}
@@ -496,7 +503,7 @@ void ForestTechniqueManager::createTreeList(osg::Node* terrain,const osg::Vec3&
float max_TreeHeight = sqrtf(size.length2()/(float)numTreesToCreate);
float max_TreeWidth = max_TreeHeight*0.5f;
float min_TreeHeight = max_TreeHeight*0.3f;
float min_TreeWidth = min_TreeHeight*0.5f;
@@ -511,14 +518,14 @@ void ForestTechniqueManager::createTreeList(osg::Node* terrain,const osg::Vec3&
tree->_width = random(min_TreeWidth,max_TreeWidth);
tree->_height = random(min_TreeHeight,max_TreeHeight);
tree->_type = 0;
if (terrain)
{
osg::ref_ptr<osgUtil::LineSegmentIntersector> intersector =
osg::ref_ptr<osgUtil::LineSegmentIntersector> intersector =
new osgUtil::LineSegmentIntersector(tree->_position,tree->_position+osg::Vec3(0.0f,0.0f,size.z()));
osgUtil::IntersectionVisitor iv(intersector.get());
terrain->accept(iv);
if (intersector->containsIntersections())
@@ -533,7 +540,7 @@ void ForestTechniqueManager::createTreeList(osg::Node* terrain,const osg::Vec3&
}
}
}
trees.push_back(tree);
}
}
@@ -563,8 +570,7 @@ osg::Geometry* ForestTechniqueManager::createSprite( float w, float h, osg::Vec4
geom->setTexCoordArray( 0, &t );
geom->setColorArray( &c );
geom->setColorBinding( osg::Geometry::BIND_OVERALL );
geom->setColorArray( &c, osg::Array::BIND_OVERALL );
geom->addPrimitiveSet( new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4) );
@@ -577,7 +583,7 @@ osg::Geometry* ForestTechniqueManager::createOrthogonalQuads( const osg::Vec3& p
osg::Vec3Array& v = *(new osg::Vec3Array(8));
osg::Vec2Array& t = *(new osg::Vec2Array(8));
osg::Vec4ubArray& c = *(new osg::Vec4ubArray(1));
float rotation = random(0.0f,osg::PI/2.0f);
float sw = sinf(rotation)*w*0.5f;
float cw = cosf(rotation)*w*0.5f;
@@ -610,8 +616,7 @@ osg::Geometry* ForestTechniqueManager::createOrthogonalQuads( const osg::Vec3& p
geom->setTexCoordArray( 0, &t );
geom->setColorArray( &c );
geom->setColorBinding( osg::Geometry::BIND_OVERALL );
geom->setColorArray( &c, osg::Array::BIND_OVERALL );
geom->addPrimitiveSet( new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,8) );
@@ -622,10 +627,10 @@ osg::Node* ForestTechniqueManager::createBillboardGraph(Cell* cell,osg::StateSet
{
bool needGroup = !(cell->_cells.empty());
bool needBillboard = !(cell->_trees.empty());
osg::Billboard* billboard = 0;
osg::Group* group = 0;
if (needBillboard)
{
billboard = new osg::Billboard;
@@ -635,10 +640,10 @@ osg::Node* ForestTechniqueManager::createBillboardGraph(Cell* cell,osg::StateSet
++itr)
{
Tree& tree = **itr;
billboard->addDrawable(createSprite(tree._width,tree._height,tree._color),tree._position);
billboard->addDrawable(createSprite(tree._width,tree._height,tree._color),tree._position);
}
}
if (needGroup)
{
group = new osg::Group;
@@ -648,9 +653,9 @@ osg::Node* ForestTechniqueManager::createBillboardGraph(Cell* cell,osg::StateSet
{
group->addChild(createBillboardGraph(itr->get(),stateset));
}
if (billboard) group->addChild(billboard);
}
if (group) return group;
else return billboard;
@@ -660,15 +665,15 @@ osg::Node* ForestTechniqueManager::createXGraph(Cell* cell,osg::StateSet* states
{
bool needGroup = !(cell->_cells.empty());
bool needTrees = !(cell->_trees.empty());
osg::Geode* geode = 0;
osg::Group* group = 0;
if (needTrees)
{
geode = new osg::Geode;
geode->setStateSet(stateset);
for(TreeList::iterator itr=cell->_trees.begin();
itr!=cell->_trees.end();
++itr)
@@ -677,7 +682,7 @@ osg::Node* ForestTechniqueManager::createXGraph(Cell* cell,osg::StateSet* states
geode->addDrawable(createOrthogonalQuads(tree._position,tree._width,tree._height,tree._color));
}
}
if (needGroup)
{
group = new osg::Group;
@@ -687,9 +692,9 @@ osg::Node* ForestTechniqueManager::createXGraph(Cell* cell,osg::StateSet* states
{
group->addChild(createXGraph(itr->get(),stateset));
}
if (geode) group->addChild(geode);
}
if (group) return group;
else return geode;
@@ -699,16 +704,16 @@ osg::Node* ForestTechniqueManager::createTransformGraph(Cell* cell,osg::StateSet
{
bool needGroup = !(cell->_cells.empty());
bool needTrees = !(cell->_trees.empty());
osg::Group* transform_group = 0;
osg::Group* group = 0;
if (needTrees)
{
transform_group = new osg::Group;
osg::Geometry* geometry = createOrthogonalQuads(osg::Vec3(0.0f,0.0f,0.0f),1.0f,1.0f,osg::Vec4ub(255,255,255,255));
for(TreeList::iterator itr=cell->_trees.begin();
itr!=cell->_trees.end();
++itr)
@@ -716,7 +721,7 @@ osg::Node* ForestTechniqueManager::createTransformGraph(Cell* cell,osg::StateSet
Tree& tree = **itr;
osg::MatrixTransform* transform = new osg::MatrixTransform;
transform->setMatrix(osg::Matrix::scale(tree._width,tree._width,tree._height)*osg::Matrix::translate(tree._position));
osg::Geode* geode = new osg::Geode;
geode->setStateSet(stateset);
geode->addDrawable(geometry);
@@ -724,7 +729,7 @@ osg::Node* ForestTechniqueManager::createTransformGraph(Cell* cell,osg::StateSet
transform_group->addChild(transform);
}
}
if (needGroup)
{
group = new osg::Group;
@@ -734,9 +739,9 @@ osg::Node* ForestTechniqueManager::createTransformGraph(Cell* cell,osg::StateSet
{
group->addChild(createTransformGraph(itr->get(),stateset));
}
if (transform_group) group->addChild(transform_group);
}
if (group) return group;
else return transform_group;
@@ -747,7 +752,7 @@ osg::Geometry* ForestTechniqueManager::createOrthogonalQuadsNoColor( const osg::
// set up the coords
osg::Vec3Array& v = *(new osg::Vec3Array(8));
osg::Vec2Array& t = *(new osg::Vec2Array(8));
float rotation = random(0.0f,osg::PI/2.0f);
float sw = sinf(rotation)*w*0.5f;
float cw = cosf(rotation)*w*0.5f;
@@ -795,7 +800,7 @@ class ShaderGeometry : public osg::Drawable
META_Object(osg,ShaderGeometry)
typedef std::vector<osg::Vec4> PositionSizeList;
virtual void drawImplementation(osg::RenderInfo& renderInfo) const
{
for(PositionSizeList::const_iterator itr = _trees.begin();
@@ -822,29 +827,241 @@ class ShaderGeometry : public osg::Drawable
}
return bb;
}
void setGeometry(osg::Geometry* geometry)
{
_geometry = geometry;
}
void addTree(ForestTechniqueManager::Tree& tree)
{
_trees.push_back(osg::Vec4(tree._position.x(), tree._position.y(), tree._position.z(), tree._height));
}
osg::ref_ptr<osg::Geometry> _geometry;
PositionSizeList _trees;
protected:
virtual ~ShaderGeometry() {}
};
osg::Geometry* shared_geometry = 0;
osg::Program* createGeometryShader()
{
static const char* vertSource = {
"#version 120\n"
"#extension GL_EXT_geometry_shader4 : enable\n"
"varying vec2 texcoord;\n"
"void main(void)\n"
"{\n"
" gl_Position = gl_Vertex;\n"
" texcoord = gl_MultiTexCoord0.st;\n"
"}\n"
};
static const char* geomSource = {
"#version 120\n"
"#extension GL_EXT_geometry_shader4 : enable\n"
"varying vec2 texcoord;\n"
"varying float intensity; \n"
"varying float red_intensity; \n"
"void main(void)\n"
"{\n"
" vec4 v = gl_PositionIn[0];\n"
" vec4 info = gl_PositionIn[1];\n"
" intensity = info.y;\n"
" red_intensity = info.z;\n"
"\n"
" float h = info.x;\n"
" float w = h*0.35;\n"
" vec4 e;\n"
" e = v + vec4(-w,0.0,0.0,0.0); gl_Position = gl_ModelViewProjectionMatrix * e; texcoord = vec2(0.0,0.0); EmitVertex();\n"
" e = v + vec4(w,0.0,0.0,0.0); gl_Position = gl_ModelViewProjectionMatrix * e; texcoord = vec2(1.0,0.0); EmitVertex();\n"
" e = v + vec4(-w,0.0,h,0.0); gl_Position = gl_ModelViewProjectionMatrix * e; texcoord = vec2(0.0,1.0); EmitVertex();\n"
" e = v + vec4(w,0.0,h,0.0); gl_Position = gl_ModelViewProjectionMatrix * e; texcoord = vec2(1.0,1.0); EmitVertex();\n"
" EndPrimitive();\n"
" e = v + vec4(0.0,-w,0.0,0.0); gl_Position = gl_ModelViewProjectionMatrix * e; texcoord = vec2(0.0,0.0); EmitVertex();\n"
" e = v + vec4(0.0,w,0.0,0.0); gl_Position = gl_ModelViewProjectionMatrix * e; texcoord = vec2(1.0,0.0); EmitVertex();\n"
" e = v + vec4(0.0,-w,h,0.0); gl_Position = gl_ModelViewProjectionMatrix * e; texcoord = vec2(0.0,1.0); EmitVertex();\n"
" e = v + vec4(0.0,w,h,0.0); gl_Position = gl_ModelViewProjectionMatrix * e; texcoord = vec2(1.0,1.0); EmitVertex();\n"
" EndPrimitive();\n"
"}\n"
};
static const char* fragSource = {
"uniform sampler2D baseTexture; \n"
"varying vec2 texcoord; \n"
"varying float intensity; \n"
"varying float red_intensity; \n"
"\n"
"void main(void) \n"
"{ \n"
" vec4 finalColor = texture2D( baseTexture, texcoord); \n"
" vec4 color = finalColor * intensity;\n"
" color.w = finalColor.w;\n"
" color.x *= red_intensity;\n"
" gl_FragColor = color;\n"
"}\n"
};
osg::Program* pgm = new osg::Program;
pgm->setName( "osgshader2 demo" );
pgm->addShader( new osg::Shader( osg::Shader::VERTEX, vertSource ) );
pgm->addShader( new osg::Shader( osg::Shader::FRAGMENT, fragSource ) );
pgm->addShader( new osg::Shader( osg::Shader::GEOMETRY, geomSource ) );
pgm->setParameter( GL_GEOMETRY_VERTICES_OUT_EXT, 8 );
pgm->setParameter( GL_GEOMETRY_INPUT_TYPE_EXT, GL_LINES );
pgm->setParameter( GL_GEOMETRY_OUTPUT_TYPE_EXT, GL_TRIANGLE_STRIP);
return pgm;
}
void ForestTechniqueManager::CollectTreePositions(Cell* cell, std::vector< osg::Vec3 >& positions)
{
bool needGroup = !(cell->_cells.empty());
bool needTrees = !(cell->_trees.empty());
if (needTrees)
{
for(TreeList::iterator itr=cell->_trees.begin();
itr!=cell->_trees.end();
++itr)
{
Tree& tree = **itr;
positions.push_back(tree._position);
}
}
if (needGroup)
{
for(Cell::CellList::iterator itr=cell->_cells.begin();
itr!=cell->_cells.end();
++itr)
{
CollectTreePositions(itr->get(),positions);
}
}
}
osg::Node* ForestTechniqueManager::createGeometryShaderGraph(Cell* cell, osg::StateSet* dstate)
{
bool needGroup = !(cell->_cells.empty());
bool needTrees = !(cell->_trees.empty());
osg::Geode* geode = 0;
osg::Group* group = 0;
if (needTrees)
{
geode = new osg::Geode;
geode->setStateSet(dstate);
osg::Geometry* geometry = new osg::Geometry;
geode->addDrawable(geometry);
osg::Vec3Array* v = new osg::Vec3Array;
for(TreeList::iterator itr=cell->_trees.begin();
itr!=cell->_trees.end();
++itr)
{
Tree& tree = **itr;
v->push_back(tree._position);
v->push_back(osg::Vec3(/*tree._height*/30.0,(double)random(0.75f,1.15f),(double)random(1.0f,1.250f)));
}
geometry->setVertexArray( v );
geometry->addPrimitiveSet( new osg::DrawArrays( GL_LINES, 0, v->size() ) );
osg::StateSet* sset = geode->getOrCreateStateSet();
sset->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
sset->setAttribute( createGeometryShader() );
osg::Uniform* baseTextureSampler = new osg::Uniform("baseTexture",0);
sset->addUniform(baseTextureSampler);
}
if (needGroup)
{
group = new osg::Group;
for(Cell::CellList::iterator itr=cell->_cells.begin();
itr!=cell->_cells.end();
++itr)
{
group->addChild(createGeometryShaderGraph(itr->get(),dstate));
}
if (geode) group->addChild(geode);
}
if (group) return group;
else return geode;
}
osg::Node* ForestTechniqueManager::createTextureBufferGraph(Cell* cell, osg::Geometry* templateGeometry)
{
bool needGroup = !(cell->_cells.empty());
bool needTrees = !(cell->_trees.empty());
osg::Geode* geode = 0;
osg::Group* group = 0;
if (needTrees)
{
osg::Geometry* geometry = (osg::Geometry*)templateGeometry->clone( osg::CopyOp::DEEP_COPY_PRIMITIVES );
osg::DrawArrays* primSet = dynamic_cast<osg::DrawArrays*>( geometry->getPrimitiveSet(0) );
primSet->setNumInstances( cell->_trees.size() );
geode = new osg::Geode;
geode->addDrawable(geometry);
osg::ref_ptr<osg::Image> treeParamsImage = new osg::Image;
treeParamsImage->allocateImage( 3*cell->_trees.size(), 1, 1, GL_RGBA, GL_FLOAT );
unsigned int i=0;
for(TreeList::iterator itr=cell->_trees.begin();
itr!=cell->_trees.end();
++itr,++i)
{
osg::Vec4f* ptr = (osg::Vec4f*)treeParamsImage->data(3*i);
Tree& tree = **itr;
ptr[0] = osg::Vec4f(tree._position.x(),tree._position.y(),tree._position.z(),1.0);
ptr[1] = osg::Vec4f((float)tree._color.r()/255.0f,(float)tree._color.g()/255.0f, (float)tree._color.b()/255.0f, 1.0);
ptr[2] = osg::Vec4f(tree._width, tree._height, 1.0, 1.0);
}
osg::ref_ptr<osg::TextureBuffer> tbo = new osg::TextureBuffer;
tbo->setImage( treeParamsImage.get() );
tbo->setInternalFormat(GL_RGBA32F_ARB);
geometry->getOrCreateStateSet()->setTextureAttribute(1, tbo.get());
geometry->setInitialBound( cell->_bb );
}
if (needGroup)
{
group = new osg::Group;
for(Cell::CellList::iterator itr=cell->_cells.begin();
itr!=cell->_cells.end();
++itr)
{
group->addChild(createTextureBufferGraph(itr->get(),templateGeometry));
}
if (geode) group->addChild(geode);
}
if (group) return group;
else return geode;
}
osg::Node* ForestTechniqueManager::createShaderGraph(Cell* cell,osg::StateSet* stateset)
{
if (shared_geometry==0)
@@ -856,18 +1073,18 @@ osg::Node* ForestTechniqueManager::createShaderGraph(Cell* cell,osg::StateSet* s
bool needGroup = !(cell->_cells.empty());
bool needTrees = !(cell->_trees.empty());
osg::Geode* geode = 0;
osg::Group* group = 0;
if (needTrees)
{
geode = new osg::Geode;
ShaderGeometry* shader_geometry = new ShaderGeometry;
shader_geometry->setGeometry(shared_geometry);
for(TreeList::iterator itr=cell->_trees.begin();
itr!=cell->_trees.end();
++itr)
@@ -880,7 +1097,7 @@ osg::Node* ForestTechniqueManager::createShaderGraph(Cell* cell,osg::StateSet* s
geode->setStateSet(stateset);
geode->addDrawable(shader_geometry);
}
if (needGroup)
{
group = new osg::Group;
@@ -890,9 +1107,9 @@ osg::Node* ForestTechniqueManager::createShaderGraph(Cell* cell,osg::StateSet* s
{
group->addChild(createShaderGraph(itr->get(),stateset));
}
if (geode) group->addChild(geode);
}
if (group) return group;
else return geode;
@@ -901,14 +1118,14 @@ osg::Node* ForestTechniqueManager::createShaderGraph(Cell* cell,osg::StateSet* s
osg::Node* ForestTechniqueManager::createHUDWithText(const std::string& str)
{
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);
// or disable depth test, and make sure that the hud is drawn after everything
// or disable depth test, and make sure that the hud is drawn after everything
// else so that it always appears ontop.
stateset->setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);
stateset->setRenderBinDetails(11,"RenderBin");
@@ -923,11 +1140,11 @@ osg::Node* ForestTechniqueManager::createHUDWithText(const std::string& str)
text->setFont(timesFont);
text->setPosition(position);
text->setText(str);
position += delta;
}
position += delta;
}
// create the hud.
osg::MatrixTransform* modelview_abs = new osg::MatrixTransform;
modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
@@ -941,7 +1158,7 @@ osg::Node* ForestTechniqueManager::createHUDWithText(const std::string& str)
return projection;
}
osg::Node* ForestTechniqueManager::createScene(unsigned int numTreesToCreates)
osg::Node* ForestTechniqueManager::createScene(unsigned int numTreesToCreates, unsigned int maxNumTreesPerCell)
{
osg::Vec3 origin(0.0f,0.0f,0.0f);
osg::Vec3 size(1000.0f,1000.0f,200.0f);
@@ -949,26 +1166,26 @@ osg::Node* ForestTechniqueManager::createScene(unsigned int numTreesToCreates)
std::cout<<"Creating terrain...";
osg::ref_ptr<osg::Node> terrain = createTerrain(origin,size);
std::cout<<"done."<<std::endl;
std::cout<<"Creating tree locations...";std::cout.flush();
TreeList trees;
createTreeList(terrain.get(),origin,size,numTreesToCreates,trees);
std::cout<<"done."<<std::endl;
std::cout<<"Creating cell subdivision...";
osg::ref_ptr<Cell> cell = new Cell;
cell->addTrees(trees);
cell->divide();
std::cout<<"done."<<std::endl;
cell->divide(maxNumTreesPerCell);
std::cout<<"done."<<std::endl;
osg::Texture2D *tex = new osg::Texture2D;
tex->setWrap( osg::Texture2D::WRAP_S, osg::Texture2D::CLAMP );
tex->setWrap( osg::Texture2D::WRAP_T, osg::Texture2D::CLAMP );
tex->setImage(osgDB::readImageFile("Images/tree0.rgba"));
osg::StateSet *dstate = new osg::StateSet;
{
{
dstate->setTextureAttributeAndModes(0, tex, osg::StateAttribute::ON );
dstate->setTextureAttribute(0, new osg::TexEnv );
@@ -983,7 +1200,7 @@ osg::Node* ForestTechniqueManager::createScene(unsigned int numTreesToCreates)
dstate->setRenderingHint( osg::StateSet::TRANSPARENT_BIN );
}
_techniqueSwitch = new osg::Switch;
@@ -991,11 +1208,11 @@ osg::Node* ForestTechniqueManager::createScene(unsigned int numTreesToCreates)
std::cout<<"Creating osg::Billboard based forest...";
osg::Group* group = new osg::Group;
group->addChild(createBillboardGraph(cell.get(),dstate));
group->addChild(createHUDWithText("Using osg::Billboard's to create a forest\n\nPress left cursor key to select OpenGL shader based forest\nPress right cursor key to select double quad based forest"));
group->addChild(createHUDWithText("Using osg::Billboard's to create a forest\n\nPress left cursor key to select geometry instancing with Texture Buffer Object\nPress right cursor key to select double quad based forest"));
_techniqueSwitch->addChild(group);
std::cout<<"done."<<std::endl;
}
{
std::cout<<"Creating double quad based forest...";
osg::Group* group = new osg::Group;
@@ -1025,7 +1242,7 @@ osg::Node* ForestTechniqueManager::createScene(unsigned int numTreesToCreates)
std::ostringstream vp_oss;
vp_oss <<
"!!ARBvp1.0\n"
"ATTRIB vpos = vertex.position;\n"
"ATTRIB vcol = vertex.color;\n"
"ATTRIB tc = vertex.texcoord[" << 0 << "];"
@@ -1034,8 +1251,8 @@ osg::Node* ForestTechniqueManager::createScene(unsigned int numTreesToCreates)
"PARAM one = { 1.0, 1.0, 1.0, 1.0 };"
"TEMP position;\n"
// vec3 position = gl_Vertex.xyz * gl_Color.w + gl_Color.xyz;
// vec3 position = gl_Vertex.xyz * gl_Color.w + gl_Color.xyz;
"MAD position, vpos, vcol.w, vcol;\n"
// gl_Position = gl_ModelViewProjectionMatrix * vec4(position,1.0);
@@ -1048,7 +1265,7 @@ osg::Node* ForestTechniqueManager::createScene(unsigned int numTreesToCreates)
// gl_FrontColor = vec4(1.0,1.0,1.0,1.0);
"MOV result.color.front.primary, one;\n"
// texcoord = gl_MultiTexCoord0.st;
// texcoord = gl_MultiTexCoord0.st;
"MOV result.texcoord, tc;\n"
"END\n";
@@ -1087,10 +1304,10 @@ osg::Node* ForestTechniqueManager::createScene(unsigned int numTreesToCreates)
#if 1
// use inline shaders
///////////////////////////////////////////////////////////////////
// vertex shader using just Vec4 coefficients
char vertexShaderSource[] =
char vertexShaderSource[] =
"varying vec2 texcoord;\n"
"\n"
"void main(void)\n"
@@ -1104,7 +1321,7 @@ osg::Node* ForestTechniqueManager::createScene(unsigned int numTreesToCreates)
//////////////////////////////////////////////////////////////////
// fragment shader
//
char fragmentShaderSource[] =
char fragmentShaderSource[] =
"uniform sampler2D baseTexture; \n"
"varying vec2 texcoord; \n"
"\n"
@@ -1118,7 +1335,7 @@ osg::Node* ForestTechniqueManager::createScene(unsigned int numTreesToCreates)
osg::Shader* fragment_shader = new osg::Shader(osg::Shader::FRAGMENT, fragmentShaderSource);
program->addShader(fragment_shader);
#else
// get shaders from source
@@ -1132,17 +1349,99 @@ osg::Node* ForestTechniqueManager::createScene(unsigned int numTreesToCreates)
}
group->addChild(createShaderGraph(cell.get(),stateset));
group->addChild(createHUDWithText("Using OpenGL Shader to create a forest\n\nPress left cursor key to select osg::Vertex/FragmentProgram based forest\nPress right cursor key to select osg::Billboard based forest"));
group->addChild(createHUDWithText("Using OpenGL Shader to create a forest\n\nPress left cursor key to select osg::Vertex/FragmentProgram based forest\nPress right cursor key to select osg::Vertex/Geometry/FragmentProgram based forest"));
_techniqueSwitch->addChild(group);
std::cout<<"done."<<std::endl;
}
{
std::cout<<"Creating Geometry Shader based forest...";
osg::StateSet* stateset = new osg::StateSet(*dstate, osg::CopyOp::DEEP_COPY_ALL);
osg::Group* group = new osg::Group;
group->addChild(createGeometryShaderGraph(cell.get(), stateset));
group->addChild(createHUDWithText("Using osg::Vertex/Geometry/FragmentProgram to create a forest\n\nPress left cursor key to select OpenGL Shader based forest\nPress right cursor key to select geometry instancing with Texture Buffer Object"));
_techniqueSwitch->addChild(group);
std::cout<<"done."<<std::endl;
}
{
std::cout<<"Creating forest using geometry instancing and texture buffer objects ...";
osg::StateSet* stateset = new osg::StateSet(*dstate, osg::CopyOp::DEEP_COPY_ALL);
{
osg::Program* program = new osg::Program;
stateset->setAttribute(program);
char vertexShaderSource[] =
"#version 420 compatibility\n"
"uniform samplerBuffer dataBuffer;\n"
"layout(location = 0) in vec3 VertexPosition;\n"
"layout(location = 8) in vec3 VertexTexCoord;\n"
"out vec2 TexCoord;\n"
"out vec4 Color;\n"
"void main()\n"
"{\n"
" int instanceAddress = gl_InstanceID * 3;\n"
" vec3 position = texelFetch(dataBuffer, instanceAddress).xyz;\n"
" Color = texelFetch(dataBuffer, instanceAddress + 1);\n"
" vec2 size = texelFetch(dataBuffer, instanceAddress + 2).xy;\n"
" mat4 mvpMatrix = gl_ModelViewProjectionMatrix *\n"
" mat4( size.x, 0.0, 0.0, 0.0,\n"
" 0.0, size.x, 0.0, 0.0,\n"
" 0.0, 0.0, size.y, 0.0,\n"
" position.x, position.y, position.z, 1.0);\n"
" gl_Position = mvpMatrix * vec4(VertexPosition,1.0) ;\n"
" TexCoord = VertexTexCoord.xy;\n"
"}\n";
char fragmentShaderSource[] =
"#version 420 core\n"
"uniform sampler2D baseTexture; \n"
"in vec2 TexCoord;\n"
"in vec4 Color;\n"
"layout(location = 0, index = 0) out vec4 FragData0;\n"
"void main(void) \n"
"{\n"
" FragData0 = Color*texture(baseTexture, TexCoord);\n"
"}\n";
osg::Shader* vertex_shader = new osg::Shader(osg::Shader::VERTEX, vertexShaderSource);
program->addShader(vertex_shader);
osg::Shader* fragment_shader = new osg::Shader(osg::Shader::FRAGMENT, fragmentShaderSource);
program->addShader(fragment_shader);
osg::Uniform* baseTextureSampler = new osg::Uniform("baseTexture",0);
stateset->addUniform(baseTextureSampler);
osg::Uniform* dataBufferSampler = new osg::Uniform("dataBuffer",1);
stateset->addUniform(dataBufferSampler);
}
osg::ref_ptr<osg::Geometry> templateGeometry = createOrthogonalQuadsNoColor(osg::Vec3(0.0f,0.0f,0.0f),1.0f,1.0f);
templateGeometry->setUseVertexBufferObjects(true);
templateGeometry->setUseDisplayList(false);
osg::Node* textureBufferGraph = createTextureBufferGraph(cell.get(), templateGeometry.get());
textureBufferGraph->setStateSet( stateset );
osg::Group* group = new osg::Group;
group->addChild(textureBufferGraph);
group->addChild(createHUDWithText("Using geometry instancing to create a forest\n\nPress left cursor key to select osg::Vertex/Geometry/FragmentProgram based forest\nPress right cursor key to select osg::Billboard based forest"));
_techniqueSwitch->addChild(group);
std::cout<<"done."<<std::endl;
}
_currentTechnique = 0;
_techniqueSwitch->setSingleChildOn(_currentTechnique);
osg::Group* scene = new osg::Group;
scene->addChild(terrain.get());
scene->addChild(_techniqueSwitch.get());
@@ -1154,15 +1453,19 @@ int main( int argc, char **argv )
// use an ArgumentParser object to manage the program arguments.
osg::ArgumentParser arguments(&argc,argv);
// construct the viewer.
osgViewer::Viewer viewer(arguments);
float numTreesToCreates = 10000;
arguments.read("--trees",numTreesToCreates);
unsigned int numTreesToCreate = 10000;
arguments.read("--trees",numTreesToCreate);
unsigned int maxNumTreesPerCell = sqrtf(static_cast<float>(numTreesToCreate));
arguments.read("--trees-per-cell",maxNumTreesPerCell);
osg::ref_ptr<ForestTechniqueManager> ttm = new ForestTechniqueManager;
// add the stats handler
viewer.addEventHandler(new osgViewer::StatsHandler);
@@ -1170,7 +1473,7 @@ int main( int argc, char **argv )
viewer.addEventHandler(new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()));
// add model to viewer.
viewer.setSceneData( ttm->createScene((unsigned int)numTreesToCreates) );
viewer.setSceneData( ttm->createScene(numTreesToCreate, maxNumTreesPerCell) );
return viewer.run();

View File

@@ -0,0 +1,11 @@
SET(TARGET_SRC
CameraPathProperty.cpp
CameraProperty.cpp
CaptureSettings.cpp
EventProperty.cpp
osgframerenderer.cpp
UpdateProperty.cpp
)
#### end var setup ###
SETUP_EXAMPLE(osgframerenderer)

View File

@@ -0,0 +1,88 @@
#include "CameraPathProperty.h"
using namespace gsc;
void CameraPathProperty::update(osgViewer::View* view)
{
osg::Camera* camera = view->getCamera();
osg::FrameStamp* fs = view->getFrameStamp();
if (_animationPath.valid())
{
osg::AnimationPath::ControlPoint cp;
_animationPath->getInterpolatedControlPoint( fs->getSimulationTime(), cp );
OSG_NOTICE<<"CameraPathProperty "<<fs->getFrameNumber()<<" "<<fs->getSimulationTime()<<std::endl;
osg::Matrixd matrix;
cp.getMatrix( matrix );
camera->setViewMatrix( osg::Matrix::inverse(matrix) );
}
}
void CameraPathProperty::loadAnimationPath()
{
_animationPath = new osg::AnimationPath;;
//_animationPath->setLoopMode(osg::AnimationPath::LOOP);
osgDB::ifstream in(_filename.c_str());
if (!in)
{
OSG_WARN << "CameraPathProperty: Cannot open animation path file \"" << _filename << "\".\n";
return;
}
_animationPath->read(in);
}
bool CameraPathProperty::getTimeRange(double& startTime, double& endTime) const
{
if (!_animationPath) return false;
const osg::AnimationPath::TimeControlPointMap& tcpm = _animationPath->getTimeControlPointMap();
if (tcpm.empty()) return false;
startTime = tcpm.begin()->first;
endTime = tcpm.rbegin()->first;
return true;
}
void CameraPathProperty::resetTimeRange(double startTime, double endTime)
{
if (!_animationPath) return;
osg::AnimationPath::TimeControlPointMap& tcpm = _animationPath->getTimeControlPointMap();
if (tcpm.empty()) return;
osg::AnimationPath::TimeControlPointMap copy_tcpm = tcpm;
double offset = tcpm.begin()->first;
double originalLength = tcpm.rbegin()->first - tcpm.begin()->first ;
double scale = originalLength>0.0 ? (endTime-startTime)/originalLength : 1.0;
tcpm.clear();
for(osg::AnimationPath::TimeControlPointMap::iterator itr = copy_tcpm.begin();
itr != copy_tcpm.end();
++itr)
{
tcpm[startTime + (itr->first-offset)*scale] = itr->second;
}
}
/////////////////////////////////////////////////////////////////////////////////////////
//
// Serialization support
//
REGISTER_OBJECT_WRAPPER( gsc_CameraPathProperty,
new gsc::CameraPathProperty,
gsc::CameraPathProperty,
"osg::Object gsc::CameraPathProperty" )
{
ADD_STRING_SERIALIZER( AnimationPathFileName, "" );
}

View File

@@ -0,0 +1,46 @@
#ifndef CAMERAPATHPROPERTY_H
#define CAMERAPATHPROPERTY_H
#include <osg/AnimationPath>
#include "UpdateProperty.h"
namespace gsc
{
class CameraPathProperty : public gsc::UpdateProperty
{
public:
CameraPathProperty() {}
CameraPathProperty(const std::string& filename) { setAnimationPathFileName(filename); }
CameraPathProperty(const CameraPathProperty& cpp, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY) {}
META_Object(gsc, CameraPathProperty);
void setAnimationPathFileName(const std::string& filename) { _filename = filename; loadAnimationPath(); }
const std::string& getAnimationPathFileName() const { return _filename; }
void setAnimationPath(osg::AnimationPath* ap) { _animationPath = ap; }
osg::AnimationPath* getAnimationPath() { return _animationPath.get(); }
const osg::AnimationPath* getAnimationPath() const { return _animationPath.get(); }
bool getTimeRange(double& startTime, double& endTime) const;
void resetTimeRange(double startTime, double endTime);
virtual void update(osgViewer::View* view);
protected:
virtual ~CameraPathProperty() {}
void loadAnimationPath();
std::string _filename;
osg::ref_ptr<osg::AnimationPath> _animationPath;
};
}
#endif

View File

@@ -0,0 +1,81 @@
#include "CameraProperty.h"
using namespace gsc;
void CameraProperty::setToModel(const osg::Node* node)
{
osg::BoundingSphere bs = node->getBound();
double dist = osg::DisplaySettings::instance()->getScreenDistance();
OSG_NOTICE<<"Node name "<<node->getName()<<std::endl;
#if 1
if (node->getName().find("Presentation")==std::string::npos)
{
double screenWidth = osg::DisplaySettings::instance()->getScreenWidth();
double screenHeight = osg::DisplaySettings::instance()->getScreenHeight();
double screenDistance = osg::DisplaySettings::instance()->getScreenDistance();
double vfov = atan2(screenHeight/2.0,screenDistance)*2.0;
double hfov = atan2(screenWidth/2.0,screenDistance)*2.0;
double viewAngle = vfov<hfov ? vfov : hfov;
dist = bs.radius() / sin(viewAngle*0.5);
}
#endif
_center = bs.center();
_eye = _center - osg::Vec3d(0.0, dist, 0.0);
_up = osg::Vec3d(0.0, 0.0, 1.0);
_rotationCenter = _center;
_rotationAxis = osg::Vec3d(0.0, 0.0, 1.0);
_rotationSpeed = 0.0;
}
void CameraProperty::update(osgViewer::View* view)
{
osg::Camera* camera = view->getCamera();
osg::FrameStamp* fs = view->getFrameStamp();
osg::Matrixd matrix;
matrix.makeLookAt(_eye, _center, _up);
if (_rotationSpeed!=0.0)
{
matrix.preMult(osg::Matrixd::translate(-_rotationCenter) *
osg::Matrix::rotate(osg::DegreesToRadians(_rotationSpeed*fs->getSimulationTime()), _rotationAxis) *
osg::Matrixd::translate(_rotationCenter));
}
camera->setViewMatrix( matrix );
// set the fusion distance up so that the left and right eye images are co-incedent on the image plane at the center of ration.
view->setFusionDistance(osgUtil::SceneView::USE_FUSION_DISTANCE_VALUE,(_center-_eye).length());
// view->setFusionDistance(osgUtil::SceneView::PROPORTIONAL_TO_SCREEN_DISTANCE, 1.0);
}
/////////////////////////////////////////////////////////////////////////////////////////
//
// Serialization support
//
REGISTER_OBJECT_WRAPPER( gsc_CameraProperty,
new gsc::CameraProperty,
gsc::CameraProperty,
"osg::Object gsc::CameraProperty" )
{
ADD_VEC3D_SERIALIZER( Center, osg::Vec3d(0.0,0.0,0.0) );
ADD_VEC3D_SERIALIZER( EyePoint, osg::Vec3d(0.0,-1.0,0.0) );
ADD_VEC3D_SERIALIZER( UpVector, osg::Vec3d(0.0,0.0,1.0) );
ADD_VEC3D_SERIALIZER( RotationCenter, osg::Vec3d(0.0,0.0,0.0) );
ADD_VEC3D_SERIALIZER( RotationAxis, osg::Vec3d(0.0,0.0,1.0) );
ADD_DOUBLE_SERIALIZER( RotationSpeed, 0.0 );
}

View File

@@ -0,0 +1,72 @@
#ifndef CAMERAPROPERTY_H
#define CAMERAPROPERTY_H
#include <osg/AnimationPath>
#include "UpdateProperty.h"
namespace gsc
{
class CameraProperty : public gsc::UpdateProperty
{
public:
CameraProperty():
_center(0.0,0.0,0.0),
_eye(0.0,-1.0,0.0),
_up(0.0,0.0,1.0),
_rotationCenter(0.0,0.0,0.0),
_rotationAxis(0.0,0.0,1.0),
_rotationSpeed(0.0) {}
CameraProperty(const CameraProperty& cp, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):
_center(cp._center),
_eye(cp._eye),
_up(cp._up),
_rotationCenter(cp._rotationCenter),
_rotationAxis(cp._rotationAxis),
_rotationSpeed(cp._rotationSpeed)
{}
META_Object(gsc, CameraProperty);
void setToModel(const osg::Node* node);
void setCenter(const osg::Vec3d& center) { _center = center; }
const osg::Vec3d& getCenter() const { return _center; }
void setEyePoint(const osg::Vec3d& eye) { _eye = eye; }
const osg::Vec3d& getEyePoint() const { return _eye; }
void setUpVector(const osg::Vec3d& up) { _up = up; }
const osg::Vec3d& getUpVector() const { return _up; }
void setRotationCenter(const osg::Vec3d& center) { _rotationCenter = center; }
const osg::Vec3d& getRotationCenter() const { return _rotationCenter; }
void setRotationAxis(const osg::Vec3d& axis) { _rotationAxis = axis; }
const osg::Vec3d& getRotationAxis() const { return _rotationAxis; }
void setRotationSpeed(double speed) { _rotationSpeed = speed; }
double getRotationSpeed() const { return _rotationSpeed; }
virtual void update(osgViewer::View* view);
protected:
virtual ~CameraProperty() {}
osg::Vec3d _center;
osg::Vec3d _eye;
osg::Vec3d _up;
osg::Vec3d _rotationCenter;
osg::Vec3d _rotationAxis;
double _rotationSpeed;
};
}
#endif

View File

@@ -0,0 +1,187 @@
#include "CaptureSettings.h"
using namespace gsc;
CaptureSettings::CaptureSettings():
_stereoMode(OFF),
_offscreen(false),
_outputImageFlip(false),
_width(1024),
_height(512),
_screenWidth(0.0),
_screenHeight(0.0),
_screenDistance(0.0),
_samples(0),
_sampleBuffers(0),
_frameRate(60.0),
_numberOfFrames(0.0)
{
}
CaptureSettings::CaptureSettings(const CaptureSettings& cs, const osg::CopyOp& copyop):
osg::Object(cs, copyop),
_inputFileName(cs._inputFileName),
_outputFileName(cs._outputFileName),
_outputDirectoryName(cs._outputDirectoryName),
_outputBaseFileName(cs._outputBaseFileName),
_outputExtension(cs._outputExtension),
_stereoMode(cs._stereoMode),
_offscreen(cs._offscreen),
_outputImageFlip(cs._outputImageFlip),
_width(cs._width),
_height(cs._height),
_screenWidth(cs._screenWidth),
_screenHeight(cs._screenHeight),
_screenDistance(cs._screenDistance),
_samples(cs._samples),
_sampleBuffers(cs._sampleBuffers),
_frameRate(cs._frameRate),
_numberOfFrames(cs._numberOfFrames),
_eventHandlers(cs._eventHandlers),
_properties(cs._properties)
{
}
void CaptureSettings::setOutputFileName(const std::string& filename)
{
_outputFileName = filename;
_outputDirectoryName = osgDB::getFilePath(filename);
if (!_outputDirectoryName.empty()) _outputDirectoryName += osgDB::getNativePathSeparator();
_outputBaseFileName = osgDB::getStrippedName(filename);
_outputExtension = osgDB::getFileExtensionIncludingDot(filename);
}
const std::string& CaptureSettings::getOutputFileName() const
{
return _outputFileName;
}
std::string CaptureSettings::getOutputFileName(unsigned int frameNumber) const
{
std::stringstream str;
str<<_outputDirectoryName<<_outputBaseFileName<<"_"<<frameNumber<<_outputExtension;
return str.str();
}
std::string CaptureSettings::getOutputFileName(unsigned int cameraNum, unsigned int frameNumber) const
{
std::stringstream str;
str<<_outputDirectoryName<<_outputBaseFileName<<"_"<<cameraNum<<"_"<<frameNumber<<_outputExtension;
return str.str();
}
bool CaptureSettings::valid() const
{
return _numberOfFrames>0 && !_outputBaseFileName.empty() && !_outputExtension.empty() && !_inputFileName.empty();
}
/////////////////////////////////////////////////////////////////////////////////////////
//
// Serialization support
//
static bool checkEventHandlers( const gsc::CaptureSettings& cs )
{
return !cs.getEventHandlers().empty();
}
static bool readEventHandlers( osgDB::InputStream& is, gsc::CaptureSettings& cs )
{
unsigned int size = 0; is >> size >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
osg::ref_ptr<osg::Object> obj = is.readObject();
gsc::UpdateProperty* up = dynamic_cast<gsc::UpdateProperty*>( obj.get() );
if ( up ) cs.addUpdateProperty( up );
}
is >> is.END_BRACKET;
return true;
}
static bool writeEventHandlers( osgDB::OutputStream& os, const gsc::CaptureSettings& cs )
{
const gsc::CaptureSettings::EventHandlers& pl = cs.getEventHandlers();
unsigned int size = pl.size();
os << size << os.BEGIN_BRACKET << std::endl;
for ( unsigned int i=0; i<size; ++i )
{
os << pl[i].get();
}
os << os.END_BRACKET << std::endl;
return true;
}
static bool checkProperties( const gsc::CaptureSettings& cs )
{
return !cs.getProperties().empty();
}
static bool readProperties( osgDB::InputStream& is, gsc::CaptureSettings& cs )
{
unsigned int size = 0; is >> size >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
osg::ref_ptr<osg::Object> obj = is.readObject();
gsc::UpdateProperty* up = dynamic_cast<gsc::UpdateProperty*>( obj.get() );
if ( up ) cs.addUpdateProperty( up );
}
is >> is.END_BRACKET;
return true;
}
static bool writeProperties( osgDB::OutputStream& os, const gsc::CaptureSettings& cs )
{
const gsc::CaptureSettings::Properties& pl = cs.getProperties();
unsigned int size = pl.size();
os << size << os.BEGIN_BRACKET << std::endl;
for ( unsigned int i=0; i<size; ++i )
{
os << pl[i].get();
}
os << os.END_BRACKET << std::endl;
return true;
}
REGISTER_OBJECT_WRAPPER( gsc_CaptureSettings,
new gsc::CaptureSettings,
gsc::CaptureSettings,
"osg::Object gsc::CaptureSettings" )
{
ADD_STRING_SERIALIZER( InputFileName, "" );
ADD_STRING_SERIALIZER( OutputFileName, "" );
ADD_DOUBLE_SERIALIZER( FrameRate, 60.0 );
BEGIN_ENUM_SERIALIZER( StereoMode, OFF );
ADD_ENUM_VALUE( OFF );
ADD_ENUM_VALUE( HORIZONTAL_SPLIT );
ADD_ENUM_VALUE( VERTICAL_SPLIT );
END_ENUM_SERIALIZER();
ADD_BOOL_SERIALIZER( Offscreen, false );
ADD_BOOL_SERIALIZER( OutputImageFlip, false );
ADD_UINT_SERIALIZER( Width, 1024 );
ADD_UINT_SERIALIZER( Height, 512 );
ADD_FLOAT_SERIALIZER( ScreenWidth, 0.0 );
ADD_FLOAT_SERIALIZER( ScreenHeight, 0.0 );
ADD_FLOAT_SERIALIZER( ScreenDistance, 0.0 );
BEGIN_ENUM_SERIALIZER( PixelFormat, RGB );
ADD_ENUM_VALUE( RGB );
ADD_ENUM_VALUE( RGBA );
END_ENUM_SERIALIZER();
ADD_UINT_SERIALIZER( Samples, 0 );
ADD_UINT_SERIALIZER( SampleBuffers, 0 );
ADD_UINT_SERIALIZER( NumberOfFrames, 0 );
ADD_USER_SERIALIZER( EventHandlers );
ADD_USER_SERIALIZER( Properties );
}

View File

@@ -0,0 +1,148 @@
#ifndef CAPTURESETTINGS_H
#define CAPTURESETTINGS_H
#include <osgDB/ReadFile>
#include <osgDB/FileNameUtils>
#include <osgDB/WriteFile>
#include <osgViewer/Viewer>
#include <osg/AnimationPath>
#include "UpdateProperty.h"
namespace gsc
{
class CaptureSettings : public osg::Object
{
public:
CaptureSettings();
CaptureSettings(const CaptureSettings& cs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
META_Object(gsc, CaptureSettings);
void setInputFileName(const std::string& filename) { _inputFileName = filename; }
const std::string& getInputFileName() const { return _inputFileName; }
void setOutputFileName(const std::string& filename);
const std::string& getOutputFileName() const;
std::string getOutputFileName(unsigned int frameNumber) const;
std::string getOutputFileName(unsigned int cameraNumber, unsigned int frameNumber) const;
enum StereoMode
{
OFF,
HORIZONTAL_SPLIT,
VERTICAL_SPLIT
};
void setStereoMode(StereoMode mode) { _stereoMode = mode; }
StereoMode getStereoMode() const { return _stereoMode; }
void setOffscreen(bool o) { _offscreen = o; }
bool getOffscreen() const { return _offscreen; }
void setOutputImageFlip(bool flip) { _outputImageFlip = flip; }
bool getOutputImageFlip() const { return _outputImageFlip; }
void setWidth(unsigned int width) { _width = width; }
unsigned int getWidth() const { return _width; }
void setHeight(unsigned int height) { _height = height; }
unsigned int getHeight() const { return _height; }
void setScreenWidth(float width) { _screenWidth = width; }
float getScreenWidth() const { return _screenWidth; }
void setScreenHeight(float height) { _screenHeight = height; }
float getScreenHeight() const { return _screenHeight; }
void setScreenDistance(float distance) { _screenDistance = distance; }
float getScreenDistance() const { return _screenDistance; }
enum PixelFormat
{
RGB,
RGBA
};
void setPixelFormat(PixelFormat format) { _pixelFormat = format; }
PixelFormat getPixelFormat() const { return _pixelFormat; }
void setSamples(unsigned int s) { _samples = s; }
unsigned int getSamples() const { return _samples; }
void setSampleBuffers(unsigned int s) { _sampleBuffers = s; }
unsigned int getSampleBuffers() const { return _sampleBuffers; }
void setFrameRate(double fr) { _frameRate = fr; }
double getFrameRate() const { return _frameRate; }
void setNumberOfFrames(unsigned int nf) { _numberOfFrames = nf; }
unsigned int getNumberOfFrames() const { return _numberOfFrames; }
typedef std::vector< osg::ref_ptr<osgGA::GUIEventHandler> > EventHandlers;
void setEventHandlers(const EventHandlers& eh);
EventHandlers& getEventHandlers() { return _eventHandlers; }
const EventHandlers& getEventHandlers() const { return _eventHandlers; }
typedef std::vector< osg::ref_ptr<UpdateProperty> > Properties;
void addUpdateProperty(UpdateProperty* up) { _properties.push_back(up); }
void setProperties(const Properties& pl) { _properties = pl; }
Properties& getProperties() { return _properties; }
const Properties& getProperties() const { return _properties; }
template<typename T>
T* getPropertyOfType()
{
for(Properties::iterator itr = _properties.begin();
itr != _properties.end();
++itr)
{
T* p = dynamic_cast<T*>(itr->get());
if (p) return p;
}
return 0;
}
bool valid() const;
protected:
virtual ~CaptureSettings() {}
std::string _inputFileName;
std::string _outputFileName;
std::string _outputDirectoryName;
std::string _outputBaseFileName;
std::string _outputExtension;
StereoMode _stereoMode;
bool _offscreen;
bool _outputImageFlip;
unsigned int _width;
unsigned int _height;
float _screenWidth;
float _screenHeight;
float _screenDistance;
PixelFormat _pixelFormat;
unsigned int _samples;
unsigned int _sampleBuffers;
double _frameRate;
unsigned int _numberOfFrames;
EventHandlers _eventHandlers;
Properties _properties;
};
}
#endif

View File

@@ -0,0 +1,41 @@
#include "EventProperty.h"
namespace gsc
{
void EventProperty::update(osgViewer::View* view)
{
if (view && view->getEventQueue() && _event.valid())
{
view->getEventQueue()->addEvent(_event.get());
}
}
/////////////////////////////////////////////////////////////////////////////////////////
//
// Serialization support
//
REGISTER_OBJECT_WRAPPER( gsc_EventProperty,
new gsc::EventProperty,
gsc::EventProperty,
"osg::Object gsc::EventProperty" )
{
ADD_OBJECT_SERIALIZER( Event, osgGA::GUIEventAdapter, NULL );
}
}
namespace osgGA
{
namespace B
{
}
}

View File

@@ -0,0 +1,38 @@
#ifndef EVENTPROPERTY_H
#define EVENTPROPERTY_H
#include <osgGA/GUIEventAdapter>
#include "UpdateProperty.h"
namespace gsc
{
class EventProperty : public gsc::UpdateProperty
{
public:
EventProperty() {}
EventProperty(osgGA::GUIEventAdapter* event):_event(event) {}
EventProperty(const EventProperty& cpp, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY) {}
META_Object(gsc, EventProperty);
void setEvent(osgGA::GUIEventAdapter* ea) { _event = ea; }
osgGA::GUIEventAdapter* getEvent() { return _event.get(); }
const osgGA::GUIEventAdapter* getEvent() const { return _event.get(); }
virtual void update(osgViewer::View* view);
protected:
virtual ~EventProperty() {}
double _previousFrameTime;
osg::ref_ptr<osgGA::GUIEventAdapter> _event;
};
}
#endif

View File

@@ -0,0 +1,4 @@
#include "UpdateProperty.h"
using namespace gsc;

View File

@@ -0,0 +1,32 @@
#ifndef UPDATEPROPERTY_H
#define UPDATEPROPERTY_H
#include <osgDB/ReadFile>
#include <osgDB/FileNameUtils>
#include <osgDB/WriteFile>
#include <osgViewer/Viewer>
#include <osg/AnimationPath>
namespace gsc
{
class UpdateProperty : public osg::Object
{
public:
UpdateProperty() {}
UpdateProperty(const UpdateProperty& up, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY) {}
META_Object(gsc, UpdateProperty);
virtual void update(osgViewer::View* view) {}
protected:
virtual ~UpdateProperty() {}
};
}
#endif

View File

@@ -0,0 +1,559 @@
#include <osgDB/ReadFile>
#include <osgDB/FileUtils>
#include <osgDB/FileNameUtils>
#include <osgDB/WriteFile>
#include <osgViewer/Viewer>
#include <osg/AnimationPath>
#include "UpdateProperty.h"
#include "CameraProperty.h"
#include "CameraPathProperty.h"
#include "EventProperty.h"
#include "CaptureSettings.h"
#include <osgGA/StateSetManipulator>
struct ScreenShot : public osg::Camera::DrawCallback
{
ScreenShot(GLenum pixelFormat, bool flip):
_pixelFormat(pixelFormat),
_flip(flip) {}
virtual void operator () (osg::RenderInfo& renderInfo) const
{
if (!_frameCapture)
{
OSG_NOTICE<<"No FrameCamera assigned"<<std::endl;
return;
}
unsigned int frameNumber = renderInfo.getState()->getFrameStamp()->getFrameNumber();
CameraNumMap::const_iterator itr = _cameraNumMap.find(renderInfo.getCurrentCamera());
std::string outputFileName = (itr!=_cameraNumMap.end()) ?
_frameCapture->getOutputFileName(itr->second, frameNumber) :
_frameCapture->getOutputFileName(frameNumber);
OSG_NOTICE<<"outputFileName="<<outputFileName<<std::endl;
osg::Camera* camera = renderInfo.getCurrentCamera();
osg::Viewport* viewport = camera ? camera->getViewport() : 0;
if (viewport)
{
OSG_NOTICE<<"Doing read of ="<<viewport->x()<<", "<<viewport->y()<<", "<<viewport->width()<<", "<<viewport->height()<<" with pixelFormat=0x"<<std::hex<<_pixelFormat<<std::dec<<std::endl;
glReadBuffer(camera->getDrawBuffer());
osg::ref_ptr<osg::Image> image = new osg::Image;
image->readPixels(viewport->x(),viewport->y(),viewport->width(),viewport->height(),
_pixelFormat, GL_UNSIGNED_BYTE, 1);
if (_flip) image->flipVertical();
osgDB::writeImageFile(*image, outputFileName);
}
}
typedef std::map<const osg::Camera*, unsigned int> CameraNumMap;
GLenum _pixelFormat;
bool _flip;
osg::ref_ptr<gsc::CaptureSettings> _frameCapture;
CameraNumMap _cameraNumMap;
};
int main( int argc, char **argv )
{
// use an ArgumentParser object to manage the program arguments.
osg::ArgumentParser arguments(&argc,argv);
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates use of 3D textures.");
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options]");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
arguments.getApplicationUsage()->addCommandLineOption("-i <filename>","Input scene (or presentation) filename.");
arguments.getApplicationUsage()->addCommandLineOption("-o <filename>","Base ouput filename of the images, recommended to use something like Images/image.png");
arguments.getApplicationUsage()->addCommandLineOption("--cs <filename>","Load pre-generated configuration file for run.");
arguments.getApplicationUsage()->addCommandLineOption("--ouput-cs <filename>","Output configuration file with settings provided on commandline.");
arguments.getApplicationUsage()->addCommandLineOption("-p <filename>","Use specificied camera path file to control camera position.");
arguments.getApplicationUsage()->addCommandLineOption("--offscreen","Use an pbuffer to render the images offscreen.");
arguments.getApplicationUsage()->addCommandLineOption("--screen","Use an window to render the images.");
arguments.getApplicationUsage()->addCommandLineOption("--width <width>","Window/output image width.");
arguments.getApplicationUsage()->addCommandLineOption("--height <height>","Window/output image height.");
arguments.getApplicationUsage()->addCommandLineOption("--screen-distance <distance>","Set the distance of the viewer from the physical screen.");
arguments.getApplicationUsage()->addCommandLineOption("--screen-width <width>","Set the width of the physical screen.");
arguments.getApplicationUsage()->addCommandLineOption("--screen-height <height>","Set the height of the physical screen.");
arguments.getApplicationUsage()->addCommandLineOption("--ms <s>","Number of multi-samples to use when rendering, an enable a single sample buffer.");
arguments.getApplicationUsage()->addCommandLineOption("--samples <s>","Number of multi-samples to use when rendering.");
arguments.getApplicationUsage()->addCommandLineOption("--sampleBuffers <sb>","Number of sample buffers to use when rendering.");
arguments.getApplicationUsage()->addCommandLineOption("-f <fps>","Number of frames per second in simulation time.");
arguments.getApplicationUsage()->addCommandLineOption("-n <frames>","Number of frames to render/images to create.");
arguments.getApplicationUsage()->addCommandLineOption("-d <time>","Duration of rendering run (duration = frames/fps).");
arguments.getApplicationUsage()->addCommandLineOption("--center <x> <y> <z>","View center.");
arguments.getApplicationUsage()->addCommandLineOption("--eye <x> <y> <z>","Camera eye point.");
arguments.getApplicationUsage()->addCommandLineOption("--up <x> <y> <z>","Camera up vector.");
arguments.getApplicationUsage()->addCommandLineOption("--rotation-center <x> <y> <z>","Position to rotatate around.");
arguments.getApplicationUsage()->addCommandLineOption("--rotation-axis <x> <y> <z>","Axis to rotate around.");
arguments.getApplicationUsage()->addCommandLineOption("--rotation-speed <v>","Degrees per second.");
arguments.getApplicationUsage()->addCommandLineOption("--stereo <mode>","OFF | HORIZONTAL_SPLIT | VERTICAL_SPLIT");
unsigned int helpType = 0;
if ((helpType = arguments.readHelpType()))
{
arguments.getApplicationUsage()->write(std::cout, helpType);
return 1;
}
osgViewer::Viewer viewer;
typedef std::list< osg::ref_ptr<gsc::CaptureSettings> > CaptureSettingsList;
CaptureSettingsList frameCaptureList;
osg::ref_ptr<gsc::CaptureSettings> fc = new gsc::CaptureSettings;
double duration = 0.0;
double fps = 0.0f;
unsigned int nframes = 0;
bool readCaptureSettings = false;
std::string filename;
if (arguments.read("--cs",filename))
{
osg::ref_ptr<osg::Object> object = osgDB::readObjectFile(filename);
gsc::CaptureSettings* input_cs = dynamic_cast<gsc::CaptureSettings*>(object.get());
if (input_cs) { fc = input_cs; readCaptureSettings = true; }
else
{
OSG_NOTICE<<"Unable to read CaptureSettings from file: "<<filename<<std::endl;
if (object.valid()) OSG_NOTICE<<"Object read, "<<object.get()<<", className()="<<object->className()<<std::endl;
return 1;
}
}
float screenWidth = fc->getScreenWidth()!=0.0 ? fc->getScreenWidth() : osg::DisplaySettings::instance()->getScreenWidth();
if (arguments.read("--screen-width",screenWidth)) {}
float screenHeight = fc->getScreenHeight()!=0.0 ? fc->getScreenHeight() : osg::DisplaySettings::instance()->getScreenHeight();
if (arguments.read("--screen-height",screenHeight)) {}
float screenDistance = fc->getScreenDistance()!=0.0 ? fc->getScreenDistance() : osg::DisplaySettings::instance()->getScreenDistance();
if (arguments.read("--screen-distance",screenDistance)) {}
fc->setScreenWidth(screenWidth);
osg::DisplaySettings::instance()->setScreenWidth(screenWidth);
fc->setScreenHeight(screenHeight);
osg::DisplaySettings::instance()->setScreenHeight(screenHeight);
fc->setScreenDistance(screenDistance);
osg::DisplaySettings::instance()->setScreenDistance(screenDistance);
bool useScreenSizeForProjectionMatrix = true;
if (arguments.read("-i",filename)) fc->setInputFileName(filename);
if (arguments.read("-o",filename)) fc->setOutputFileName(filename);
if (arguments.read("-p",filename))
{
osg::ref_ptr<gsc::CameraPathProperty> cpp = new gsc::CameraPathProperty;
cpp->setAnimationPathFileName(filename);
double startTime = 0, endTime = 1.0f;
if (cpp->getTimeRange(startTime, endTime))
{
OSG_NOTICE<<"Camera path time range "<<startTime<<", "<<endTime<<std::endl;
if (startTime!=0.0)
{
cpp->resetTimeRange(0.0, endTime-startTime);
if (cpp->getTimeRange(startTime, endTime))
{
OSG_NOTICE<<" new time range "<<startTime<<", "<<endTime<<std::endl;
}
else
{
OSG_NOTICE<<" failed to set new time range "<<startTime<<", "<<endTime<<std::endl;
}
}
duration = endTime;
}
else
{
OSG_NOTICE<<"Camera path time range "<<startTime<<", "<<endTime<<std::endl;
}
fc->addUpdateProperty(cpp.get());
}
else
{
osg::ref_ptr<gsc::CameraProperty> cp = fc->getPropertyOfType<gsc::CameraProperty>();
bool newCameraProperty = false;
bool valueSet = false;
if (!cp)
{
newCameraProperty = true;
cp = new gsc::CameraProperty;
osg::ref_ptr<osg::Node> node = fc->getInputFileName().empty() ? 0 : osgDB::readNodeFile(fc->getInputFileName());
if (node.valid())
{
cp->setToModel(node.get());
valueSet = true;
}
}
osg::Vec3d vec;
while (arguments.read("--center",vec.x(), vec.y(), vec.z())) { cp->setCenter(vec); valueSet = true; }
while (arguments.read("--eye",vec.x(), vec.y(), vec.z())) { cp->setEyePoint(vec); valueSet = true; }
while (arguments.read("--up",vec.x(), vec.y(), vec.z())) { cp->setUpVector(vec); valueSet = true; }
while (arguments.read("--rotation-center",vec.x(), vec.y(), vec.z())) { cp->setRotationCenter(vec); valueSet = true; }
while (arguments.read("--rotation-axis",vec.x(), vec.y(), vec.z())) { cp->setRotationAxis(vec); valueSet = true; }
double speed;
while (arguments.read("--rotation-speed",speed)) { cp->setRotationSpeed(speed); valueSet = true; }
if (newCameraProperty && valueSet)
{
fc->addUpdateProperty(cp.get());
}
}
std::string stereoMode;
if (arguments.read("--stereo", stereoMode))
{
if (stereoMode=="HORIZONTAL_SPLIT") fc->setStereoMode(gsc::CaptureSettings::HORIZONTAL_SPLIT);
else if (stereoMode=="VERTICAL_SPLIT") fc->setStereoMode(gsc::CaptureSettings::VERTICAL_SPLIT);
else if (stereoMode=="OFF") fc->setStereoMode(gsc::CaptureSettings::OFF);
}
if (arguments.read("--offscreen")) fc->setOffscreen(true);
if (arguments.read("--screen")) fc->setOffscreen(false);
if (arguments.read("--flip")) fc->setOutputImageFlip(true);
if (arguments.read("--no-flip")) fc->setOutputImageFlip(false);
unsigned int width = 1024;
if (arguments.read("--width",width)) fc->setWidth(width);
unsigned int height = 512;
if (arguments.read("--height",height)) fc->setHeight(height);
if (arguments.read("--rgb")) fc->setPixelFormat(gsc::CaptureSettings::RGB);
if (arguments.read("--rgba")) fc->setPixelFormat(gsc::CaptureSettings::RGBA);
osg::Vec4 clearColor(0.0f,0.0f,0.0f,0.0f);
while (arguments.read("--clear-color",clearColor[0],clearColor[1],clearColor[2],clearColor[3])) {}
unsigned int samples = 0;
if (arguments.read("--samples",samples)) fc->setSamples(samples);
unsigned int sampleBuffers = 0;
if (arguments.read("--sampleBuffers",sampleBuffers)) fc->setSampleBuffers(sampleBuffers);
unsigned int ms = 0;
if (arguments.read("--ms",ms))
{
fc->setSamples(ms);
fc->setSampleBuffers(1);
}
if (arguments.read("-f",fps)) fc->setFrameRate(fps);
if (arguments.read("-n",nframes)) fc->setNumberOfFrames(nframes);
if (arguments.read("-d",duration)) {}
std::string key;
double time;
while(arguments.read("--key-down",time, key) && key.size()>=1)
{
OSG_NOTICE<<"keydown "<<key<<", "<<time<<std::endl;
osg::ref_ptr<osgGA::GUIEventAdapter> event = new osgGA::GUIEventAdapter;
event->setTime(time);
event->setEventType(osgGA::GUIEventAdapter::KEYDOWN);
event->setKey(key[0]);
fc->addUpdateProperty(new gsc::EventProperty(event.get()));
}
while(arguments.read("--key-up",time, key) && key.size()>=1)
{
OSG_NOTICE<<"keyup "<<key<<", "<<time<<std::endl;
osg::ref_ptr<osgGA::GUIEventAdapter> event = new osgGA::GUIEventAdapter;
event->setTime(time);
event->setEventType(osgGA::GUIEventAdapter::KEYUP);
event->setKey(key[0]);
fc->addUpdateProperty(new gsc::EventProperty(event.get()));
}
double mouse_x, mouse_y;
while(arguments.read("--mouse-move",time, mouse_x, mouse_y))
{
OSG_NOTICE<<"mouse move "<<time<<", "<<mouse_x<<", "<<mouse_y<<std::endl;
osg::ref_ptr<osgGA::GUIEventAdapter> event = new osgGA::GUIEventAdapter;
event->setTime(time);
event->setEventType(osgGA::GUIEventAdapter::MOVE);
event->setX(mouse_x);
event->setY(mouse_y);
fc->addUpdateProperty(new gsc::EventProperty(event.get()));
}
while(arguments.read("--mouse-drag",time, mouse_x, mouse_y))
{
OSG_NOTICE<<"mouse drag "<<time<<", "<<mouse_x<<", "<<mouse_y<<std::endl;
osg::ref_ptr<osgGA::GUIEventAdapter> event = new osgGA::GUIEventAdapter;
event->setTime(time);
event->setEventType(osgGA::GUIEventAdapter::DRAG);
event->setX(mouse_x);
event->setY(mouse_y);
fc->addUpdateProperty(new gsc::EventProperty(event.get()));
}
if (!readCaptureSettings)
{
if (duration!=0.0)
{
if (fps!=0.0) nframes = static_cast<unsigned int>(ceil(duration*fps));
else if (nframes!=0) fps = duration/static_cast<double>(nframes);
else
{
fps = 60.0;
nframes = static_cast<unsigned int>(ceil(duration/fps));
}
}
else // duration == 0.0
{
if (fps==0.0) fps=60.0;
if (nframes==0) nframes=1;
duration = static_cast<double>(nframes)/fps;
}
fc->setNumberOfFrames(nframes);
fc->setFrameRate(fps);
OSG_NOTICE<<"Duration="<<duration<<", FPS="<<fps<<", Number of Frames="<<nframes<<std::endl;
}
if (arguments.read("--output-cs",filename))
{
osgDB::writeObjectFile(*fc, filename);
return 1;
}
if (fc.valid())
{
frameCaptureList.push_back(fc);
}
if (frameCaptureList.empty())
{
OSG_NOTICE<<"No settings provided"<<std::endl;
return 1;
}
// setup viewer
{
osg::ref_ptr<osg::DisplaySettings> ds = new osg::DisplaySettings;
bool stereo = fc->getStereoMode()!=gsc::CaptureSettings::OFF;
osg::DisplaySettings::StereoMode stereoMode = fc->getStereoMode()==gsc::CaptureSettings::VERTICAL_SPLIT ? osg::DisplaySettings::VERTICAL_SPLIT : osg::DisplaySettings::HORIZONTAL_SPLIT;
double fovx_multiple = fc->getStereoMode()==gsc::CaptureSettings::HORIZONTAL_SPLIT ? 2.0 : 1;
double fovy_multiple = fc->getStereoMode()==gsc::CaptureSettings::VERTICAL_SPLIT ? 2.0 : 1;
ds->setStereoMode(stereoMode);
ds->setStereo(stereo);
if (fc->getScreenWidth()!=0.0) ds->setScreenWidth(fc->getScreenWidth());
if (fc->getScreenHeight()!=0.0) ds->setScreenHeight(fc->getScreenHeight());
if (fc->getScreenDistance()!=0.0) ds->setScreenDistance(fc->getScreenDistance());
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits(ds.get());
traits->readDISPLAY();
if (traits->displayNum<0) traits->displayNum = 0;
traits->x = 0;
traits->y = 0;
traits->width = fc->getWidth();
traits->height = fc->getHeight();
traits->alpha = (fc->getPixelFormat() == gsc::CaptureSettings::RGBA) ? 8 : 0;
traits->samples = fc->getSamples();
traits->sampleBuffers = fc->getSampleBuffers();
traits->windowDecoration = !(fc->getOffscreen());
traits->doubleBuffer = true;
traits->sharedContext = 0;
traits->pbuffer = fc->getOffscreen();
osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get());
if (!gc)
{
OSG_NOTICE<<"Failed to created requested graphics context"<<std::endl;
return 1;
}
viewer.getCamera()->setClearColor(clearColor);
viewer.getCamera()->setGraphicsContext(gc.get());
viewer.getCamera()->setDisplaySettings(ds.get());
osgViewer::GraphicsWindow* gw = dynamic_cast<osgViewer::GraphicsWindow*>(gc.get());
if (gw)
{
OSG_INFO<<"GraphicsWindow has been created successfully."<<std::endl;
gw->getEventQueue()->getCurrentEventState()->setWindowRectangle(0, 0, fc->getWidth(), fc->getHeight());
}
else
{
OSG_NOTICE<<"PixelBuffer has been created succseffully "<<traits->width<<", "<<traits->height<<std::endl;
}
if (useScreenSizeForProjectionMatrix)
{
OSG_NOTICE<<"Setting projection matrix"<<std::endl;
double vfov = osg::RadiansToDegrees(atan2(screenHeight/2.0f,screenDistance)*2.0);
// double hfov = osg::RadiansToDegrees(atan2(width/2.0f,distance)*2.0);
viewer.getCamera()->setProjectionMatrixAsPerspective( vfov*fovy_multiple, (screenWidth/screenHeight)*fovx_multiple, 0.1, 1000.0);
OSG_NOTICE<<"setProjectionMatrixAsPerspective( "<<vfov*fovy_multiple<<", "<<(screenWidth/screenHeight)*fovx_multiple<<", "<<0.1<<", "<<1000.0<<");"<<std::endl;
}
else
{
double fovy, aspectRatio, zNear, zFar;
viewer.getCamera()->getProjectionMatrixAsPerspective(fovy, aspectRatio, zNear, zFar);
double newAspectRatio = double(traits->width) / double(traits->height);
double aspectRatioChange = newAspectRatio / aspectRatio;
if (aspectRatioChange != 1.0)
{
viewer.getCamera()->getProjectionMatrix() *= osg::Matrix::scale(fovx_multiple/aspectRatioChange,fovy_multiple,1.0);
}
}
// set up stereo masks
viewer.getCamera()->setCullMask(0xffffffff);
viewer.getCamera()->setCullMaskLeft(0x00000001);
viewer.getCamera()->setCullMaskRight(0x00000002);
viewer.getCamera()->setViewport(new osg::Viewport(0, 0, traits->width, traits->height));
GLenum buffer = traits->doubleBuffer ? GL_BACK : GL_FRONT;
viewer.getCamera()->setDrawBuffer(buffer);
viewer.getCamera()->setReadBuffer(buffer);
}
std::string outputPath = osgDB::getFilePath(fc->getOutputFileName());
if (!outputPath.empty())
{
osgDB::FileType type = osgDB::fileType(outputPath);
switch(type)
{
case(osgDB::FILE_NOT_FOUND):
if (!osgDB::makeDirectory(outputPath))
{
OSG_NOTICE<<"Error: could not create directory ["<<outputPath<<"]."<<std::endl;
return 1;
}
OSG_NOTICE<<"Created directory ["<<outputPath<<"]."<<std::endl;
break;
case(osgDB::REGULAR_FILE):
OSG_NOTICE<<"Error: filepath for output files is regular file, not a directory as required."<<std::endl;
return 1;
case(osgDB::DIRECTORY):
OSG_NOTICE<<"Valid path["<<outputPath<<"] provided for output files."<<std::endl;
break;
}
}
GLenum pixelFormat = (fc->getPixelFormat()==gsc::CaptureSettings::RGBA) ? GL_RGBA : GL_RGB;
viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded);
viewer.realize();
// set up screen shot
osg::ref_ptr<ScreenShot> screenShot = new ScreenShot(pixelFormat, fc->getOutputImageFlip());;
{
osgViewer::Viewer::Cameras cameras;
viewer.getCameras(cameras);
if (cameras.size()>1)
{
unsigned int cameraNum = 0;
for(osgViewer::Viewer::Cameras::iterator itr = cameras.begin();
itr != cameras.end();
++itr, ++cameraNum)
{
osg::Camera* camera = *itr;
camera->setFinalDrawCallback(screenShot.get());
screenShot->_cameraNumMap[camera] = cameraNum;
}
}
else if (cameras.size()==1)
{
osg::Camera* camera = cameras.front();
camera->setFinalDrawCallback(screenShot.get());
}
else
{
OSG_NOTICE<<"No usable Cameras created."<<std::endl;
return 1;
}
}
for(CaptureSettingsList::iterator itr = frameCaptureList.begin();
itr != frameCaptureList.end();
++itr)
{
gsc::CaptureSettings* fc = itr->get();
screenShot->_frameCapture = fc;
osg::ref_ptr<osg::Node> model = osgDB::readNodeFile(fc->getInputFileName());
if (!model) break;
viewer.setSceneData(model.get());
double simulationTime = 0.0;
for(unsigned int i=0; i<fc->getNumberOfFrames(); ++i)
{
OSG_NOTICE<<"fc.getOutputFileName("<<i<<")="<<fc->getOutputFileName(i)<<std::endl;
viewer.advance(simulationTime);
gsc::CaptureSettings::Properties& pl = fc->getProperties();
for(gsc::CaptureSettings::Properties::iterator plitr = pl.begin();
plitr != pl.end();
++plitr)
{
(*plitr)->update(&viewer);
}
viewer.eventTraversal();
viewer.updateTraversal();
viewer.renderingTraversals();
// advance simulationTime and number of frames rendered
simulationTime += 1.0/fc->getFrameRate();
}
}
osg::ref_ptr<osg::Object> object = new osgGA::StateSetManipulator;
osg::ref_ptr<osgGA::StateSetManipulator> ss = dynamic_cast<osgGA::StateSetManipulator*>(object.get());
return 0;
}

View File

@@ -23,7 +23,7 @@
namespace osgfxbrowser {
Frame::Frame()
: osg::Geode(),
: osg::Geode(),
bgcolor_(0.5f, 0.5f, 0.5f, 1.0f),
rect_(0, 0, 100, 100),
caption_("Frame")
@@ -108,8 +108,7 @@ osg::Geometry *Frame::build_quad(const Rect &rect, const osg::Vec4 &color, bool
clr->push_back(osg::Vec4(black, 0));
}
geo->setColorArray(clr.get());
geo->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
geo->setColorArray(clr.get(), osg::Array::BIND_PER_VERTEX);
geo->addPrimitiveSet(new osg::DrawArrays(GL_QUADS, 0, shadow? 12: 4));

View File

@@ -27,10 +27,10 @@ ProcessPass::ProcessPass(osg::TextureRectangle *in_tex,
_TextureHeight(height)
{
_RootGroup = new osg::Group;
_InTexture = in_tex;
_OutTexture = out_tex;
_Camera = new osg::Camera;
setupCamera();
_Camera->addChild(createTexturedQuad().get());
@@ -47,7 +47,7 @@ ProcessPass::~ProcessPass()
osg::ref_ptr<osg::Group> ProcessPass::createTexturedQuad()
{
osg::ref_ptr<osg::Group> top_group = new osg::Group;
osg::ref_ptr<osg::Geode> quad_geode = new osg::Geode;
osg::ref_ptr<osg::Vec3Array> quad_coords = new osg::Vec3Array; // vertex coords
@@ -72,19 +72,18 @@ osg::ref_ptr<osg::Group> ProcessPass::createTexturedQuad()
quad_geom->setVertexArray(quad_coords.get());
quad_geom->setTexCoordArray(0, quad_tcoords.get());
quad_geom->addPrimitiveSet(quad_da.get());
quad_geom->setColorArray(quad_colors.get());
quad_geom->setColorBinding(osg::Geometry::BIND_OVERALL);
quad_geom->setColorArray(quad_colors.get(), osg::Array::BIND_OVERALL);
_StateSet = quad_geom->getOrCreateStateSet();
_StateSet->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
_StateSet->setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);
_StateSet->setTextureAttributeAndModes(0, _InTexture.get(), osg::StateAttribute::ON);
_StateSet->addUniform(new osg::Uniform("textureIn", 0));
quad_geode->addDrawable(quad_geom.get());
top_group->addChild(quad_geode.get());
return top_group;
@@ -94,7 +93,7 @@ void ProcessPass::setupCamera()
{
// clearing
_Camera->setClearMask(GL_DEPTH_BUFFER_BIT);
// projection and view
_Camera->setProjectionMatrix(osg::Matrix::ortho2D(0,1,0,1));
_Camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
@@ -118,7 +117,7 @@ void ProcessPass::setShader(std::string filename)
return;
}
osg::ref_ptr<osg::Shader> fshader = new osg::Shader( osg::Shader::FRAGMENT );
osg::ref_ptr<osg::Shader> fshader = new osg::Shader( osg::Shader::FRAGMENT );
fshader->loadShaderSourceFromFile(foundFile);
_FragmentProgram = 0;
@@ -135,7 +134,7 @@ GameOfLifePass::GameOfLifePass(osg::Image *in_image)
{
_TextureWidth = in_image->s();
_TextureHeight = in_image->t();
_RootGroup = new osg::Group;
_BranchSwith[0] = new osg::Switch;
@@ -149,11 +148,11 @@ GameOfLifePass::GameOfLifePass(osg::Image *in_image)
createOutputTextures();
_InOutTextureLife[0]->setImage(in_image);
_ProcessPass[0] = new ProcessPass(_InOutTextureLife[0].get(),
_InOutTextureLife[1].get(),
_TextureWidth, _TextureHeight);
// For the other pass, the input/output textures are flipped
_ProcessPass[1] = new ProcessPass(_InOutTextureLife[1].get(),
_InOutTextureLife[0].get(),
@@ -194,7 +193,7 @@ void GameOfLifePass::createOutputTextures()
{
for (int i=0; i<2; i++) {
_InOutTextureLife[i] = new osg::TextureRectangle;
_InOutTextureLife[i]->setTextureSize(_TextureWidth, _TextureHeight);
_InOutTextureLife[i]->setInternalFormat(GL_RGBA);
_InOutTextureLife[i]->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::NEAREST);

View File

@@ -46,10 +46,10 @@ osg::Node* createScene(osg::Image *start_im)
// create quad to display image on
osg::ref_ptr<osg::Geode> geode = new osg::Geode();
// each geom will contain a quad
osg::ref_ptr<osg::DrawArrays> da = new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4);
osg::ref_ptr<osg::Vec4Array> colors = new osg::Vec4Array;
colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
@@ -58,7 +58,7 @@ osg::Node* createScene(osg::Image *start_im)
tcoords->push_back(osg::Vec2(width, 0));
tcoords->push_back(osg::Vec2(width, height));
tcoords->push_back(osg::Vec2(0, height));
osg::ref_ptr<osg::Vec3Array> vcoords = new osg::Vec3Array; // vertex coords
osg::ref_ptr<osg::Geometry> geom = new osg::Geometry;
@@ -67,25 +67,24 @@ osg::Node* createScene(osg::Image *start_im)
vcoords->push_back(osg::Vec3d(width, 0, 0));
vcoords->push_back(osg::Vec3d(width, 0, height));
vcoords->push_back(osg::Vec3d(0, 0, height));
geom->setVertexArray(vcoords.get());
geom->setTexCoordArray(0,tcoords.get());
geom->addPrimitiveSet(da.get());
geom->setColorArray(colors.get());
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->setColorArray(colors.get(), osg::Array::BIND_OVERALL);
geomss = geom->getOrCreateStateSet();
geomss->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
geode->addDrawable(geom.get());
topnode->addChild(geode.get());
// create the ping pong processing passes
golpass = new GameOfLifePass(start_im);
topnode->addChild(golpass->getRoot().get());
// attach the output of the processing to the geom
geomss->setTextureAttributeAndModes(0,
geomss->setTextureAttributeAndModes(0,
golpass->getOutputTexture().get(),
osg::StateAttribute::ON);
return topnode;
@@ -119,14 +118,14 @@ int main(int argc, char *argv[])
// load the image
osg::ref_ptr<osg::Image> startIm = osgDB::readImageFile(startName);
if (!startIm) {
std::cout << "Could not load start image.\n";
return(1);
}
osg::Node* scene = createScene(startIm.get());
// construct the viewer.
osgViewer::Viewer viewer;
viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded);
@@ -145,7 +144,7 @@ int main(int argc, char *argv[])
// flip the textures after we've completed a frame
golpass->flip();
// attach the proper output to view
geomss->setTextureAttributeAndModes(0,
geomss->setTextureAttributeAndModes(0,
golpass->getOutputTexture().get(),
osg::StateAttribute::ON);
}

View File

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

View File

@@ -1,152 +0,0 @@
// Geo demo written by Geoff Michel, November 2002.
/* OpenSceneGraph example, osggeodemo.
*
* 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 <stdio.h>
#include <osgViewer/Viewer>
#include <osg/Node>
#include <osg/Notify>
#include <osgDB/Registry>
#include <osgDB/ReadFile>
#include <osgGA/TrackballManipulator>
#include <osgGA/FlightManipulator>
#include <osgGA/DriveManipulator>
#include <osgGA/AnimationPathManipulator>
#include <osgDB/WriteFile>
#include <osgDB/FileUtils>
#include <osgDB/FileNameUtils>
#include <osgUtil/Optimizer>
#include <iostream>
// currently not a satisfactory solution, but this is early days for the
// geo loader and having direct links with it.
#include "../../src/osgPlugins/geo/osgGeoAnimation.h"
//== event trapper gets events
class geodemoEventHandler : public osgGA::GUIEventHandler
{
public:
geodemoEventHandler( ) { mouse_x=mouse_y=0;}
virtual ~geodemoEventHandler( ) {}
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&)
{
mouse_x=ea.getX();
mouse_y=ea.getY();
return false;
}
inline float getMouseX(void) {return mouse_x;};
inline float getMouseY(void) {return mouse_y;};
private:
float mouse_x, mouse_y;
};
static geodemoEventHandler *ghand=NULL;
inline double DEG2RAD(const double val) { return val*0.0174532925199432957692369076848861;}
inline double RAD2DEG(const double val) { return val*57.2957795130823208767981548141052;}
double dodynamics(const double /*time*/, const double val, const std::string name)
{ // Each local variable named 'name' declared in the geo modeller is passed into here.
// its current value is val; returns new value. Time - elapsed time
static double heading,speed; // these are only required for my 'dynamics'
if (name == "xpos") {
return (val+speed*sin(heading));
// std::cout << " nx " << (*itr->getValue()) ;
} else if (name == "ypos") {
return (val+speed*cos(heading));
// std::cout << " ny " << (*itr->getValue()) ;
} else if (name == "sped") {
speed=(0.00025*(ghand->getMouseY()-300)); // (*itr->getValue());
return (speed);
} else if (name == "heading") {
heading-= 0.01*DEG2RAD(ghand->getMouseX()-400); // =DEG2RAD(*itr->getValue());
return (RAD2DEG(heading));
} else if (name == "conerot") {
return ((ghand->getMouseX()-400));
} else if (name == "planrot") {
return ((ghand->getMouseY()-300)/200.0);
} else if (name == "secint" || name == "minutehand"|| name == "hourhand") {
// std::cout << " updating " << name << " " << val << std::endl;
}
return val;
}
int main( int argc, char **argv )
{
// use an ArgumentParser object to manage the program arguments.
osg::ArgumentParser arguments(&argc,argv);
// construct the viewer.
osgViewer::Viewer viewer;
// load the nodes from the commandline arguments.
osg::Node* rootnode = osgDB::readNodeFiles(arguments);
if (!rootnode)
{
osg::notify(osg::NOTICE)<<"Please specify a geo model filename on the command line."<<std::endl;
return 1;
}
// run optimization over the scene graph
osgUtil::Optimizer optimzer;
optimzer.optimize(rootnode);
// add a viewport to the viewer and attach the scene graph.
viewer.setSceneData( rootnode );
geoHeader *gh = dynamic_cast<geoHeader *>(rootnode);
if (gh)
{ // it is a geo file, so set function to update its animation variables.
ghand=new geodemoEventHandler();
gh->setUserUpdate(dodynamics);
viewer.addEventHandler(ghand);
}
else
{ // maybe a group with geo models below.
osg::Group *gpall=dynamic_cast<osg::Group *>(rootnode);
if (gpall)
{
int nchild=gpall->getNumChildren();
for (int i=0; i<nchild; i++)
{
osg::Node *nod=gpall->getChild(i);
gh = dynamic_cast<geoHeader *>(nod);
if (gh)
{
ghand=new geodemoEventHandler();
gh->setUserUpdate(dodynamics);
viewer.addEventHandler(ghand);
}
}
}
}
return viewer.run();
}

View File

@@ -37,10 +37,11 @@
#include <iostream>
// This demo illustrates how to create the various different types of geometry that
// the osg::Geometry class can represent. This demo uses the OpenGL red book diagram of different
// OpenGL Primitives as a template for all the equivalent OpenSceneGraph Primitives. The OpenSceneGraph
// wraps OpenGL very thinly and therefore uses all the same enum and naming conventions. The coordinate data is also
// the osg::Geometry class can represent. This demo uses the OpenGL red book diagram of different
// OpenGL Primitives as a template for all the equivalent OpenSceneGraph Primitives. The OpenSceneGraph
// wraps OpenGL very thinly and therefore uses all the same enum and naming conventions. The coordinate data is also
// wrapped around OpenGL's vertex arrays and draw arrays/elements calls. Familiarity with
// OpenGL will help you understand the osg::Geometry class which encapsulate all this, or if you
// havn't learned OpenGL yet, learning osg::Geometry will help you understand how OpenGL
@@ -50,7 +51,7 @@
// a draw method for drawing objects in the scene. osg::Geometry contains all the vertex, normal
// color and texture coordinate arrays required to specify the coordinates of your objects, and the
// primitives join these coordinates together as the points, lines or surfaces that you will see
// rendered on your screen.
// rendered on your screen.
//
// This demo is split into two functions, the createScene() function which creates the scene graph
// with the various primitives in it, and the main() which sets up a basic viewer window and
@@ -59,7 +60,7 @@
struct NormalPrint
{
void operator() (const osg::Vec3& v1,const osg::Vec3& v2,const osg::Vec3& v3, bool) const
void operator() (const osg::Vec3& v1,const osg::Vec3& v2,const osg::Vec3& v3, bool) const
{
osg::Vec3 normal = (v2-v1)^(v3-v2);
normal.normalize();
@@ -71,10 +72,10 @@ struct NormalPrint
void printTriangles(const std::string& name, osg::Drawable& drawable)
{
std::cout<<name<<std::endl;
osg::TriangleFunctor<NormalPrint> tf;
drawable.accept(tf);
std::cout<<std::endl;
}
@@ -93,9 +94,9 @@ osg::Node* createScene()
{
// create Geometry object to store all the vertices and points primitive.
osg::Geometry* pointsGeom = new osg::Geometry();
// create a Vec3Array and add to it all my coordinates.
// Like all the *Array variants (see include/osg/Array) , Vec3Array is derived from both osg::Array
// Like all the *Array variants (see include/osg/Array) , Vec3Array is derived from both osg::Array
// and std::vector<>. osg::Array's are reference counted and hence sharable,
// which std::vector<> provides all the convenience, flexibility and robustness
// of the most popular of all STL containers.
@@ -105,30 +106,28 @@ osg::Node* createScene()
vertices->push_back(osg::Vec3(-0.873376, 9.18133e-09, 0.832179));
vertices->push_back(osg::Vec3(-0.836299, -2.15188e-09, 0.885735));
vertices->push_back(osg::Vec3(-0.790982, 9.18133e-09, 0.959889));
// pass the created vertex array to the points geometry object.
pointsGeom->setVertexArray(vertices);
// create the color of the geometry, one single for the whole geometry.
// for consistency of design even one single color must added as an element
// in a color array.
osg::Vec4Array* colors = new osg::Vec4Array;
// add a white color, colors take the form r,g,b,a with 0.0 off, 1.0 full on.
colors->push_back(osg::Vec4(1.0f,1.0f,0.0f,1.0f));
// pass the color array to points geometry, note the binding to tell the geometry
// that only use one color for the whole object.
pointsGeom->setColorArray(colors);
pointsGeom->setColorBinding(osg::Geometry::BIND_OVERALL);
pointsGeom->setColorArray(colors, osg::Array::BIND_OVERALL);
// set the normal in the same way color.
osg::Vec3Array* normals = new osg::Vec3Array;
normals->push_back(osg::Vec3(0.0f,-1.0f,0.0f));
pointsGeom->setNormalArray(normals);
pointsGeom->setNormalBinding(osg::Geometry::BIND_OVERALL);
pointsGeom->setNormalArray(normals, osg::Array::BIND_OVERALL);
// create and add a DrawArray Primitive (see include/osg/Primitive). The first
@@ -137,8 +136,8 @@ osg::Node* createScene()
// parameter is the index position into the vertex array of the first point
// to draw, and the third parameter is the number of points to draw.
pointsGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POINTS,0,vertices->size()));
// add the points geometry to the geode.
geode->addDrawable(pointsGeom);
}
@@ -147,7 +146,7 @@ osg::Node* createScene()
{
// create Geometry object to store all the vertices and lines primitive.
osg::Geometry* linesGeom = new osg::Geometry();
// this time we'll preallocate the vertex array to the size we
// need and then simple set them as array elements, 8 points
// makes 4 line segments.
@@ -161,39 +160,37 @@ osg::Node* createScene()
(*vertices)[6].set(-1.07936, 9.18133e-09, 0.317217);
(*vertices)[7].set(-0.700348, 9.18133e-09, 0.362533);
// pass the created vertex array to the points geometry object.
linesGeom->setVertexArray(vertices);
// set the colors as before, plus using the above
osg::Vec4Array* colors = new osg::Vec4Array;
colors->push_back(osg::Vec4(1.0f,1.0f,0.0f,1.0f));
linesGeom->setColorArray(colors);
linesGeom->setColorBinding(osg::Geometry::BIND_OVERALL);
linesGeom->setColorArray(colors, osg::Array::BIND_OVERALL);
// set the normal in the same way color.
osg::Vec3Array* normals = new osg::Vec3Array;
normals->push_back(osg::Vec3(0.0f,-1.0f,0.0f));
linesGeom->setNormalArray(normals);
linesGeom->setNormalBinding(osg::Geometry::BIND_OVERALL);
linesGeom->setNormalArray(normals, osg::Array::BIND_OVERALL);
// This time we simply use primitive, and hardwire the number of coords to use
// This time we simply use primitive, and hardwire the number of coords to use
// since we know up front,
linesGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,8));
// add the points geometry to the geode.
geode->addDrawable(linesGeom);
}
// create LINE_STRIP
{
// create Geometry object to store all the vertices and lines primitive.
osg::Geometry* linesGeom = new osg::Geometry();
// this time we'll preallocate the vertex array to the size
// this time we'll preallocate the vertex array to the size
// and then use an iterator to fill in the values, a bit perverse
// but does demonstrate that we have just a standard std::vector underneath.
osg::Vec3Array* vertices = new osg::Vec3Array(5);
@@ -203,29 +200,27 @@ osg::Node* createScene()
(vitr++)->set(0.164788, -2.15188e-09, 0.366653);
(vitr++)->set(-0.0288379, -2.15188e-09, 0.333695);
(vitr++)->set(-0.0453167, -2.15188e-09, 0.280139);
// pass the created vertex array to the points geometry object.
linesGeom->setVertexArray(vertices);
// set the colors as before, plus using the above
osg::Vec4Array* colors = new osg::Vec4Array;
colors->push_back(osg::Vec4(1.0f,1.0f,0.0f,1.0f));
linesGeom->setColorArray(colors);
linesGeom->setColorBinding(osg::Geometry::BIND_OVERALL);
linesGeom->setColorArray(colors, osg::Array::BIND_OVERALL);
// set the normal in the same way color.
osg::Vec3Array* normals = new osg::Vec3Array;
normals->push_back(osg::Vec3(0.0f,-1.0f,0.0f));
linesGeom->setNormalArray(normals);
linesGeom->setNormalBinding(osg::Geometry::BIND_OVERALL);
linesGeom->setNormalArray(normals, osg::Array::BIND_OVERALL);
// This time we simply use primitive, and hardwire the number of coords to use
// This time we simply use primitive, and hardwire the number of coords to use
// since we know up front,
linesGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_STRIP,0,5));
// add the points geometry to the geode.
geode->addDrawable(linesGeom);
}
@@ -234,9 +229,9 @@ osg::Node* createScene()
{
// create Geometry object to store all the vertices and lines primitive.
osg::Geometry* linesGeom = new osg::Geometry();
// this time we'll a C arrays to initialize the vertices.
osg::Vec3 myCoords[] =
{
osg::Vec3(0.741546, -2.15188e-09, 0.453167),
@@ -246,33 +241,31 @@ osg::Node* createScene()
osg::Vec3(0.968129, -2.15188e-09, 0.337815),
osg::Vec3(0.869256, -2.15188e-09, 0.531441)
};
int numCoords = sizeof(myCoords)/sizeof(osg::Vec3);
osg::Vec3Array* vertices = new osg::Vec3Array(numCoords,myCoords);
// pass the created vertex array to the points geometry object.
linesGeom->setVertexArray(vertices);
// set the colors as before, plus using the above
osg::Vec4Array* colors = new osg::Vec4Array;
colors->push_back(osg::Vec4(1.0f,1.0f,0.0f,1.0f));
linesGeom->setColorArray(colors);
linesGeom->setColorBinding(osg::Geometry::BIND_OVERALL);
linesGeom->setColorArray(colors, osg::Array::BIND_OVERALL);
// set the normal in the same way color.
osg::Vec3Array* normals = new osg::Vec3Array;
normals->push_back(osg::Vec3(0.0f,-1.0f,0.0f));
linesGeom->setNormalArray(normals);
linesGeom->setNormalBinding(osg::Geometry::BIND_OVERALL);
linesGeom->setNormalArray(normals, osg::Array::BIND_OVERALL);
// This time we simply use primitive, and hardwire the number of coords to use
// This time we simply use primitive, and hardwire the number of coords to use
// since we know up front,
linesGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_LOOP,0,numCoords));
// add the points geometry to the geode.
geode->addDrawable(linesGeom);
}
@@ -300,17 +293,17 @@ osg::Node* createScene()
// According to the OpenGL diagram vertices should be specified in a clockwise direction.
// In reality you need to specify coords for polygons in a anticlockwise direction
// for their front face to be pointing towards you; get this wrong and you could
// find back face culling removing the wrong faces of your models. The OpenGL diagram
// find back face culling removing the wrong faces of your models. The OpenGL diagram
// is just plain wrong, but it's a nice diagram so we'll keep it for now!
// create POLYGON
{
// create Geometry object to store all the vertices and lines primitive.
osg::Geometry* polyGeom = new osg::Geometry();
// this time we'll use C arrays to initialize the vertices.
// note, anticlockwise ordering.
// note II, OpenGL polygons must be convex, planar polygons, otherwise
// note II, OpenGL polygons must be convex, planar polygons, otherwise
// undefined results will occur. If you have concave polygons or ones
// that cross over themselves then use the osgUtil::Tessellator to fix
// the polygons into a set of valid polygons.
@@ -322,30 +315,28 @@ osg::Node* createScene()
osg::Vec3(-0.766264, 0.0f, -0.0576758),
osg::Vec3(-0.980488, 0.0f, -0.094753)
};
int numCoords = sizeof(myCoords)/sizeof(osg::Vec3);
osg::Vec3Array* vertices = new osg::Vec3Array(numCoords,myCoords);
// pass the created vertex array to the points geometry object.
polyGeom->setVertexArray(vertices);
// use the shared color array.
polyGeom->setColorArray(shared_colors.get());
polyGeom->setColorBinding(osg::Geometry::BIND_OVERALL);
polyGeom->setColorArray(shared_colors.get(), osg::Array::BIND_OVERALL);
// use the shared normal array.
polyGeom->setNormalArray(shared_normals.get());
polyGeom->setNormalBinding(osg::Geometry::BIND_OVERALL);
polyGeom->setNormalArray(shared_normals.get(), osg::Array::BIND_OVERALL);
// This time we simply use primitive, and hardwire the number of coords to use
// This time we simply use primitive, and hardwire the number of coords to use
// since we know up front,
polyGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POLYGON,0,numCoords));
printTriangles("Polygon",*polyGeom);
// add the points geometry to the geode.
geode->addDrawable(polyGeom);
}
@@ -355,7 +346,7 @@ osg::Node* createScene()
{
// create Geometry object to store all the vertices and lines primitive.
osg::Geometry* polyGeom = new osg::Geometry();
// note, anticlockwise ordering.
osg::Vec3 myCoords[] =
{
@@ -369,29 +360,27 @@ osg::Node* createScene()
osg::Vec3(0.164788, 0.0f, -0.0453167),
osg::Vec3(0.13595, 0.0f, -0.255421)
};
int numCoords = sizeof(myCoords)/sizeof(osg::Vec3);
osg::Vec3Array* vertices = new osg::Vec3Array(numCoords,myCoords);
// pass the created vertex array to the points geometry object.
polyGeom->setVertexArray(vertices);
// use the shared color array.
polyGeom->setColorArray(shared_colors.get());
polyGeom->setColorBinding(osg::Geometry::BIND_OVERALL);
polyGeom->setColorArray(shared_colors.get(), osg::Array::BIND_OVERALL);
// use the shared normal array.
polyGeom->setNormalArray(shared_normals.get());
polyGeom->setNormalBinding(osg::Geometry::BIND_OVERALL);
polyGeom->setNormalArray(shared_normals.get(), osg::Array::BIND_OVERALL);
// This time we simply use primitive, and hardwire the number of coords to use
// This time we simply use primitive, and hardwire the number of coords to use
// since we know up front,
polyGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,numCoords));
printTriangles("Quads",*polyGeom);
// add the points geometry to the geode.
@@ -402,7 +391,7 @@ osg::Node* createScene()
{
// create Geometry object to store all the vertices and lines primitive.
osg::Geometry* polyGeom = new osg::Geometry();
// note, first coord at top, second at bottom, reverse to that buggy OpenGL image..
osg::Vec3 myCoords[] =
{
@@ -418,29 +407,27 @@ osg::Node* createScene()
osg::Vec3(1.11232, -2.15188e-09, 0.0123591),
osg::Vec3(1.12468, 9.18133e-09, -0.164788),
};
int numCoords = sizeof(myCoords)/sizeof(osg::Vec3);
osg::Vec3Array* vertices = new osg::Vec3Array(numCoords,myCoords);
// pass the created vertex array to the points geometry object.
polyGeom->setVertexArray(vertices);
// use the shared color array.
polyGeom->setColorArray(shared_colors.get());
polyGeom->setColorBinding(osg::Geometry::BIND_OVERALL);
polyGeom->setColorArray(shared_colors.get(), osg::Array::BIND_OVERALL);
// use the shared normal array.
polyGeom->setNormalArray(shared_normals.get());
polyGeom->setNormalBinding(osg::Geometry::BIND_OVERALL);
polyGeom->setNormalArray(shared_normals.get(), osg::Array::BIND_OVERALL);
// This time we simply use primitive, and hardwire the number of coords to use
// This time we simply use primitive, and hardwire the number of coords to use
// since we know up front,
polyGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUAD_STRIP,0,numCoords));
printTriangles("Quads strip",*polyGeom);
// add the points geometry to the geode.
@@ -451,7 +438,7 @@ osg::Node* createScene()
{
// create Geometry object to store all the vertices and lines primitive.
osg::Geometry* polyGeom = new osg::Geometry();
// note, first coord at top, second at bottom, reverse to that buggy OpenGL image..
osg::Vec3 myCoords[] =
{
@@ -467,7 +454,7 @@ osg::Node* createScene()
osg::Vec3(-1.067, 9.18133e-09, -0.609715),
// TRIANGLE STRIP 6 vertices, v6..v11
// note defined top point first,
// note defined top point first,
// then anticlockwise for the next two points,
// then alternating to bottom there after.
osg::Vec3(-0.160668, -2.15188e-09, -0.531441),
@@ -486,46 +473,44 @@ osg::Node* createScene()
osg::Vec3(0.840418, -2.15188e-09, -0.506723),
};
int numCoords = sizeof(myCoords)/sizeof(osg::Vec3);
osg::Vec3Array* vertices = new osg::Vec3Array(numCoords,myCoords);
// pass the created vertex array to the points geometry object.
polyGeom->setVertexArray(vertices);
// use the shared color array.
polyGeom->setColorArray(shared_colors.get());
polyGeom->setColorBinding(osg::Geometry::BIND_OVERALL);
polyGeom->setColorArray(shared_colors.get(), osg::Array::BIND_OVERALL);
// use the shared normal array.
polyGeom->setNormalArray(shared_normals.get());
polyGeom->setNormalBinding(osg::Geometry::BIND_OVERALL);
polyGeom->setNormalArray(shared_normals.get(), osg::Array::BIND_OVERALL);
// This time we simply use primitive, and hardwire the number of coords to use
// This time we simply use primitive, and hardwire the number of coords to use
// since we know up front,
polyGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::TRIANGLES,0,6));
polyGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::TRIANGLE_STRIP,6,6));
polyGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::TRIANGLE_FAN,12,5));
// polygon stipple
osg::StateSet* stateSet = new osg::StateSet();
polyGeom->setStateSet(stateSet);
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
osg::PolygonStipple* polygonStipple = new osg::PolygonStipple;
stateSet->setAttributeAndModes(polygonStipple,osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);
#endif
printTriangles("Triangles/Strip/Fan",*polyGeom);
// add the points geometry to the geode.
geode->addDrawable(polyGeom);
}
return geode;
return geode;
}
@@ -542,33 +527,33 @@ class MyTransformCallback : public osg::NodeCallback
virtual void operator() (osg::Node* node, osg::NodeVisitor* nv)
{
osg::MatrixTransform* transform = dynamic_cast<osg::MatrixTransform*>(node);
osg::MatrixTransform* transform = dynamic_cast<osg::MatrixTransform*>(node);
if (nv && transform && nv->getFrameStamp())
{
double time = nv->getFrameStamp()->getSimulationTime();
transform->setMatrix(osg::Matrix::translate(0.0f,1.0f+cosf(time*_angular_velocity),0.0f));
}
// must continue subgraph traversal.
traverse(node,nv);
traverse(node,nv);
}
protected:
float _angular_velocity;
};
osg::Node* createBackground()
{
{
// we'll create a texture mapped quad to sit behind the Geometry
// we'll create a texture mapped quad to sit behind the Geometry
osg::Image* image = osgDB::readImageFile("Images/primitives.gif");
if (!image) return NULL;
// create Geometry object to store all the vertices and lines primitive.
osg::Geometry* polyGeom = new osg::Geometry();
@@ -588,15 +573,13 @@ osg::Node* createBackground()
osg::Vec4Array* colors = new osg::Vec4Array;
colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
polyGeom->setColorArray(colors);
polyGeom->setColorBinding(osg::Geometry::BIND_OVERALL);
polyGeom->setColorArray(colors, osg::Array::BIND_OVERALL);
// set the normal in the same way color.
osg::Vec3Array* normals = new osg::Vec3Array;
normals->push_back(osg::Vec3(0.0f,-1.0f,0.0f));
polyGeom->setNormalArray(normals);
polyGeom->setNormalBinding(osg::Geometry::BIND_OVERALL);
polyGeom->setNormalArray(normals, osg::Array::BIND_OVERALL);
osg::Vec2 myTexCoords[] =
{
@@ -625,11 +608,11 @@ osg::Node* createBackground()
// There are three variants of the DrawElements osg::Primitive, UByteDrawElements which
// contains unsigned char indices, UShortDrawElements which contains unsigned short indices,
// and UIntDrawElements which contains ... unsigned int indices.
// The first parameter to DrawElements is
// and UIntDrawElements which contains ... unsigned int indices.
// The first parameter to DrawElements is
polyGeom->addPrimitiveSet(new osg::DrawElementsUShort(osg::PrimitiveSet::TRIANGLE_STRIP,numIndices,myIndices));
// new we need to add the texture to the Drawable, we do so by creating a
// new we need to add the texture to the Drawable, we do so by creating a
// StateSet to contain the Texture2D StateAttribute.
osg::StateSet* stateset = new osg::StateSet;
@@ -641,7 +624,7 @@ osg::Node* createBackground()
polyGeom->setStateSet(stateset);
// create the Geode (Geometry Node) to contain all our osg::Geometry objects.
osg::Geode* geode = new osg::Geode();
@@ -651,7 +634,7 @@ osg::Node* createBackground()
//return geode;
// create a transform to move the background back and forward with.
osg::MatrixTransform* transform = new osg::MatrixTransform();
transform->setUpdateCallback(new MyTransformCallback(1.0f));
transform->addChild(geode);

View File

@@ -141,8 +141,7 @@ public:
SomePoints()
{
osg::Vec4Array* cAry = new osg::Vec4Array;
setColorArray( cAry );
setColorBinding( osg::Geometry::BIND_OVERALL );
setColorArray( cAry, osg::Array::BIND_OVERALL );
cAry->push_back( osg::Vec4(1,1,1,1) );
osg::Vec3Array* vAry = new osg::Vec3Array;

View File

@@ -395,8 +395,7 @@ osg::Node* createTrackModel(Track* track, const osg::Vec4& colour)
osg::ref_ptr<osg::Vec4Array> colours = new osg::Vec4Array;
colours->push_back(colour);
geometry->setColorArray(colours.get());
geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
geometry->setColorArray(colours.get(), osg::Array::BIND_OVERALL);
geometry->addPrimitiveSet(new osg::DrawArrays(GL_LINE_STRIP, 0, points.size()));

View File

@@ -44,7 +44,7 @@ Node *makeBase( void )
c = 0;
(*coords)[c].set(0.0f,0.0f,0.0f);
(*tcoords)[c].set(0.0f,0.0f);
for( i = 0; i <= 18; i++ )
{
theta = osg::DegreesToRadians((float)i * 20.0);
@@ -61,8 +61,7 @@ Node *makeBase( void )
geom->setTexCoordArray( 0, tcoords );
geom->setColorArray( colors );
geom->setColorBinding( Geometry::BIND_OVERALL );
geom->setColorArray( colors, Array::BIND_OVERALL );
geom->addPrimitiveSet( new DrawArrays(PrimitiveSet::TRIANGLE_FAN,0,19) );
@@ -81,7 +80,7 @@ Node *makeBase( void )
// clear the depth to the far plane.
osg::Depth* depth = new osg::Depth;
depth->setFunction(osg::Depth::ALWAYS);
depth->setRange(1.0,1.0);
depth->setRange(1.0,1.0);
dstate->setAttributeAndModes(depth,StateAttribute::ON );
dstate->setRenderBinDetails(-1,"RenderBin");

View File

@@ -58,8 +58,8 @@ Node *makeSky( void )
Vec3Array& coords = *(new Vec3Array(19*nlev));
Vec4Array& colors = *(new Vec4Array(19*nlev));
Vec2Array& tcoords = *(new Vec2Array(19*nlev));
int ci = 0;
for( i = 0; i < nlev; i++ )
@@ -104,12 +104,11 @@ Node *makeSky( void )
geom->addPrimitiveSet(drawElements);
}
geom->setVertexArray( &coords );
geom->setTexCoordArray( 0, &tcoords );
geom->setColorArray( &colors );
geom->setColorBinding( Geometry::BIND_PER_VERTEX );
geom->setColorArray( &colors, Array::BIND_PER_VERTEX );
Texture2D *tex = new Texture2D;
@@ -121,12 +120,12 @@ Node *makeSky( void )
dstate->setTextureAttribute(0, new TexEnv );
dstate->setMode( GL_LIGHTING, StateAttribute::OFF );
dstate->setMode( GL_CULL_FACE, StateAttribute::ON );
// clear the depth to the far plane.
osg::Depth* depth = new osg::Depth;
depth->setFunction(osg::Depth::ALWAYS);
depth->setRange(1.0,1.0);
depth->setRange(1.0,1.0);
dstate->setAttributeAndModes(depth,StateAttribute::ON );
dstate->setRenderBinDetails(-2,"RenderBin");

View File

@@ -94,17 +94,19 @@ Node *makeTerrain( void )
Vec3Array& v = *(new Vec3Array(m*n));
Vec2Array& t = *(new Vec2Array(m*n));
Vec4Array& col = *(new Vec4Array(1));
col[0][0] = col[0][1] = col[0][2] = col[0][3] = 1.0f;
for( i = 0; i < m * n; i++ )
{
v[i][0] = vertex[i][0] - dbcenter[0];
v[i][1] = vertex[i][1] - dbcenter[1];
v[i][2] = vertex[i][2];
float* vc = vertex[i];
v[i][0] = vc[0] - dbcenter[0];
v[i][1] = vc[1] - dbcenter[1];
v[i][2] = vc[2];
t[i][0] = texcoord[i][0] + 0.025;
t[i][1] = texcoord[i][1];
float* tc = texcoord[i];
t[i][0] = tc[0];
t[i][1] = tc[1];
}
Geometry *geom = new Geometry;
@@ -112,8 +114,7 @@ Node *makeTerrain( void )
geom->setVertexArray( &v );
geom->setTexCoordArray( 0, &t );
geom->setColorArray( &col );
geom->setColorBinding( Geometry::BIND_OVERALL );
geom->setColorArray( &col, Array::BIND_OVERALL );
for( i = 0; i < m-2; i++ )
{

View File

@@ -166,10 +166,10 @@ static Geometry *makeTree( _tree *tree, StateSet *dstate )
{
float vv[][3] =
{
{ -tree->w/2.0, 0.0, 0.0 },
{ tree->w/2.0, 0.0, 0.0 },
{ tree->w/2.0, 0.0, 2 * tree->h },
{ -tree->w/2.0, 0.0, 2 * tree->h },
{ -tree->w/2.0f, 0.0f, 0.0f },
{ tree->w/2.0f, 0.0f, 0.0f },
{ tree->w/2.0f, 0.0f, 2.0f * tree->h },
{ -tree->w/2.0f, 0.0f, 2.0f * tree->h },
};
Vec3Array& v = *(new Vec3Array(4));
@@ -198,8 +198,7 @@ static Geometry *makeTree( _tree *tree, StateSet *dstate )
geom->setTexCoordArray( 0, &t );
geom->setColorArray( &l );
geom->setColorBinding( Geometry::BIND_OVERALL );
geom->setColorArray( &l, Array::BIND_OVERALL );
geom->addPrimitiveSet( new DrawArrays(PrimitiveSet::QUADS,0,4) );
@@ -238,7 +237,7 @@ Node *makeTrees( void )
tex->setImage(osgDB::readImageFile("Images/tree0.rgba"));
StateSet *dstate = new StateSet;
dstate->setTextureAttributeAndModes(0, tex, StateAttribute::ON );
dstate->setTextureAttribute(0, new TexEnv );
@@ -249,7 +248,7 @@ Node *makeTrees( void )
dstate->setAttributeAndModes( alphaFunc, StateAttribute::ON );
dstate->setMode( GL_LIGHTING, StateAttribute::OFF );
dstate->setRenderingHint( StateSet::TRANSPARENT_BIN );
int tt[] = { 15, 30, 45, 58, 72, 75, 93, 96, 105, -1 };

View File

@@ -46,7 +46,7 @@ osg::Camera* createHUD()
// set the projection matrix
camera->setProjectionMatrix(osg::Matrix::ortho2D(0,1280,0,1024));
// set the view matrix
// set the view matrix
camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
camera->setViewMatrix(osg::Matrix::identity());
@@ -58,7 +58,7 @@ osg::Camera* createHUD()
// we don't want the camera to grab event focus from the viewers main camera(s).
camera->setAllowEventFocus(false);
// add to this camera a subgraph to render
@@ -84,7 +84,7 @@ osg::Camera* createHUD()
text->setText("Head Up Displays are simple :-)");
position += delta;
}
}
{
@@ -96,7 +96,7 @@ osg::Camera* createHUD()
text->setText("All you need to do is create your text in a subgraph.");
position += delta;
}
}
{
@@ -109,7 +109,7 @@ osg::Camera* createHUD()
"to create an orthographic projection.\n");
position += delta;
}
}
{
osgText::Text* text = new osgText::Text;
@@ -121,7 +121,7 @@ osg::Camera* createHUD()
"it remains independent from any external model view matrices.");
position += delta;
}
}
{
osgText::Text* text = new osgText::Text;
@@ -132,7 +132,7 @@ osg::Camera* createHUD()
text->setText("And set the Camera's clear mask to just clear the depth buffer.");
position += delta;
}
}
{
osgText::Text* text = new osgText::Text;
@@ -144,7 +144,7 @@ osg::Camera* createHUD()
"to make sure it's drawn last.");
position += delta;
}
}
{
@@ -166,13 +166,11 @@ osg::Camera* createHUD()
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);
geom->setNormalArray(normals, osg::Array::BIND_OVERALL);
osg::Vec4Array* colors = new osg::Vec4Array;
colors->push_back(osg::Vec4(1.0f,1.0,0.8f,0.2f));
geom->setColorArray(colors);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->setColorArray(colors, osg::Array::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(GL_QUADS,0,4));
@@ -196,14 +194,14 @@ struct SnapImage : public osg::Camera::DrawCallback
_filename(filename),
_snapImage(false)
{
_image = new osg::Image;
_image = new osg::Image;
}
virtual void operator () (osg::RenderInfo& renderInfo) const
{
if (!_snapImage) return;
osg::notify(osg::NOTICE)<<"Camera callback"<<std::endl;
osg::Camera* camera = renderInfo.getCurrentCamera();
@@ -217,10 +215,10 @@ struct SnapImage : public osg::Camera::DrawCallback
GL_RGBA,
GL_UNSIGNED_BYTE);
osgDB::writeImageFile(*_image, _filename);
osg::notify(osg::NOTICE)<<"Taken screenshot, and written to '"<<_filename<<"'"<<std::endl;
osg::notify(osg::NOTICE)<<"Taken screenshot, and written to '"<<_filename<<"'"<<std::endl;
}
_snapImage = false;
}
@@ -259,7 +257,7 @@ struct SnapeImageHandler : public osgGA::GUIEventHandler
return false;
}
int _key;
osg::ref_ptr<SnapImage> _snapImage;
};
@@ -273,11 +271,11 @@ int main( int argc, char **argv )
// read the scene from the list of file specified commandline args.
osg::ref_ptr<osg::Node> scene = osgDB::readNodeFiles(arguments);
// if not loaded assume no arguments passed in, try use default model instead.
if (!scene) scene = osgDB::readNodeFile("dumptruck.osgt");
if (!scene)
{
osg::notify(osg::NOTICE)<<"No model loaded"<<std::endl;
@@ -291,16 +289,16 @@ int main( int argc, char **argv )
osgViewer::Viewer viewer;
// create a HUD as slave camera attached to the master view.
viewer.setUpViewAcrossAllScreens();
osgViewer::Viewer::Windows windows;
viewer.getWindows(windows);
if (windows.empty()) return 1;
osg::Camera* hudCamera = createHUD();
// set up cameras to render on the first window available.
hudCamera->setGraphicsContext(windows[0]);
hudCamera->setViewport(0,0,windows[0]->getTraits()->width, windows[0]->getTraits()->height);
@@ -327,21 +325,21 @@ int main( int argc, char **argv )
view->setCameraManipulator(new osgGA::TrackballManipulator);
// now create the HUD camera's view
osgViewer::Viewer::Windows windows;
viewer.getWindows(windows);
if (windows.empty()) return 1;
osg::Camera* hudCamera = createHUD();
// set up cameras to render on the first window available.
hudCamera->setGraphicsContext(windows[0]);
hudCamera->setViewport(0,0,windows[0]->getTraits()->width, windows[0]->getTraits()->height);
osgViewer::View* hudView = new osgViewer::View;
hudView->setCamera(hudCamera);
viewer.addView(hudView);
return viewer.run();
@@ -351,18 +349,18 @@ int main( int argc, char **argv )
{
// construct the viewer.
osgViewer::Viewer viewer;
SnapImage* postDrawCallback = new SnapImage("PostDrawCallback.png");
viewer.getCamera()->setPostDrawCallback(postDrawCallback);
viewer.getCamera()->setPostDrawCallback(postDrawCallback);
viewer.addEventHandler(new SnapeImageHandler('p',postDrawCallback));
SnapImage* finalDrawCallback = new SnapImage("FinalDrawCallback.png");
viewer.getCamera()->setFinalDrawCallback(finalDrawCallback);
viewer.getCamera()->setFinalDrawCallback(finalDrawCallback);
viewer.addEventHandler(new SnapeImageHandler('f',finalDrawCallback));
osg::ref_ptr<osg::Group> group = new osg::Group;
// add the HUD subgraph.
// add the HUD subgraph.
if (scene.valid()) group->addChild(scene.get());
group->addChild(createHUD());
@@ -371,5 +369,5 @@ int main( int argc, char **argv )
return viewer.run();
}
}

View File

@@ -29,6 +29,9 @@
#include <osgDB/Registry>
#include <osgDB/ReadFile>
#include <osgDB/WriteFile>
#include <osgDB/FileNameUtils>
#include <osgDB/FileUtils>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
@@ -36,6 +39,32 @@
#include <iostream>
static osgDB::DirectoryContents getSuitableFiles(osg::ArgumentParser& arguments)
{
osgDB::DirectoryContents files;
for(int i=1; i<arguments.argc(); ++i)
{
if (osgDB::fileType(arguments[i]) == osgDB::DIRECTORY)
{
const std::string& directory = arguments[i];
osgDB::DirectoryContents dc = osgDB::getSortedDirectoryContents(directory);
for(osgDB::DirectoryContents::iterator itr = dc.begin(); itr != dc.end(); ++itr)
{
std::string full_file_name = directory + "/" + (*itr);
std::string ext = osgDB::getLowerCaseFileExtension(full_file_name);
if ((ext == "jpg") || (ext == "png") || (ext == "gif") || (ext == "rgb") || (ext == "dds") )
{
files.push_back(full_file_name);
}
}
}
else {
files.push_back(arguments[i]);
}
}
return files;
}
//
@@ -69,13 +98,20 @@ osg::StateSet* createState(osg::ArgumentParser& arguments)
double length = -1.0;
while (arguments.read("--length",length)) {}
if (arguments.argc()>1)
double fps = 30.0;
while (arguments.read("--fps",fps)) {}
osgDB::DirectoryContents files = getSuitableFiles(arguments);
if (!files.empty())
{
for(int i=1; i<arguments.argc(); ++i)
for(osgDB::DirectoryContents::iterator itr = files.begin();
itr != files.end();
++itr)
{
const std::string& filename = *itr;
if (preLoad)
{
osg::ref_ptr<osg::Image> image = osgDB::readImageFile(arguments[i]);
osg::ref_ptr<osg::Image> image = osgDB::readImageFile(filename);
if (image.valid())
{
imageSequence->addImage(image.get());
@@ -83,8 +119,9 @@ osg::StateSet* createState(osg::ArgumentParser& arguments)
}
else
{
imageSequence->addImageFile(arguments[i]);
imageSequence->addImageFile(filename);
}
}
if (length>0.0)
@@ -93,10 +130,8 @@ osg::StateSet* createState(osg::ArgumentParser& arguments)
}
else
{
unsigned int maxNum = osg::maximum(imageSequence->getFileNames().size(),
imageSequence->getImages().size());
imageSequence->setLength(float(maxNum)*0.1f);
unsigned int maxNum = imageSequence->getNumImageData();
imageSequence->setLength(double(maxNum)*(1.0/fps));
}
}
else
@@ -171,11 +206,48 @@ public:
void set(osg::Node* node);
void setTrackMouse(bool tm)
{
if (tm==_trackMouse) return;
_trackMouse = tm;
std::cout << "tracking mouse: " << (_trackMouse ? "ON" : "OFF") << std::endl;
for(ImageStreamList::iterator itr=_imageStreamList.begin();
itr!=_imageStreamList.end();
++itr)
{
if ((*itr)->getStatus()==osg::ImageStream::PLAYING)
{
(*itr)->pause();
}
else
{
(*itr)->play();
}
}
}
bool getTrackMouse() const { return _trackMouse; }
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object*, osg::NodeVisitor* nv);
virtual void getUsage(osg::ApplicationUsage& usage) const;
typedef std::vector< osg::observer_ptr<osg::ImageStream> > ImageStreamList;
struct ImageStreamPlaybackSpeedData {
double fps;
unsigned char* lastData;
double timeStamp, lastOutput;
ImageStreamPlaybackSpeedData() : fps(0), lastData(NULL), timeStamp(0), lastOutput(0) {}
};
typedef std::vector< ImageStreamPlaybackSpeedData > ImageStreamPlayBackSpeedList;
protected:
@@ -240,6 +312,7 @@ protected:
bool _playToggle;
bool _trackMouse;
ImageStreamList _imageStreamList;
ImageStreamPlayBackSpeedList _imageStreamPlayBackSpeedList;
};
@@ -253,6 +326,7 @@ void MovieEventHandler::set(osg::Node* node)
FindImageStreamsVisitor fisv(_imageStreamList);
node->accept(fisv);
}
_imageStreamPlayBackSpeedList.resize(_imageStreamList.size());
}
@@ -260,6 +334,53 @@ bool MovieEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAction
{
switch(ea.getEventType())
{
case(osgGA::GUIEventAdapter::FRAME):
{
double t = ea.getTime();
bool printed(false);
ImageStreamPlayBackSpeedList::iterator fps_itr = _imageStreamPlayBackSpeedList.begin();
for(ImageStreamList::iterator itr=_imageStreamList.begin();
itr!=_imageStreamList.end();
++itr, ++fps_itr)
{
if (((*itr)->getStatus()==osg::ImageStream::PLAYING) && ((*itr)->data() != (*fps_itr).lastData))
{
ImageStreamPlaybackSpeedData& data(*fps_itr);
double dt = (data.timeStamp > 0) ? t - data.timeStamp : 1/60.0;
data.lastData = (*itr)->data();
data.fps = (*fps_itr).fps * 0.8 + 0.2 * (1/dt);
data.timeStamp = t;
if (t-data.lastOutput > 1)
{
std::cout << data.fps << " ";
data.lastOutput = t;
printed = true;
}
}
}
if (printed)
std::cout << std::endl;
}
break;
case(osgGA::GUIEventAdapter::MOVE):
{
if (_trackMouse)
{
for(ImageStreamList::iterator itr=_imageStreamList.begin();
itr!=_imageStreamList.end();
++itr)
{
double dt = (*itr)->getLength() * ((1.0+ea.getXnormalized()) / 2.0);
(*itr)->seek(dt);
std::cout << "seeking to " << dt << " length: " <<(*itr)->getLength() << std::endl;
}
}
return false;
}
case(osgGA::GUIEventAdapter::KEYDOWN):
{
if (ea.getKey()=='p')
@@ -312,6 +433,12 @@ bool MovieEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAction
}
}
return true;
}
else if (ea.getKey() == 'i')
{
setTrackMouse(!_trackMouse);
}
return false;
}
@@ -319,10 +446,13 @@ bool MovieEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAction
default:
return false;
}
return false;
}
void MovieEventHandler::getUsage(osg::ApplicationUsage& usage) const
{
usage.addKeyboardMouseBinding("i","toggle interactive mode, scrub via mouse-move");
usage.addKeyboardMouseBinding("p","Play/Pause movie");
usage.addKeyboardMouseBinding("r","Restart movie");
usage.addKeyboardMouseBinding("l","Toggle looping of movie");
@@ -347,6 +477,9 @@ int main(int argc, char **argv)
// pass the model to the MovieEventHandler so it can pick out ImageStream's to manipulate.
MovieEventHandler* meh = new MovieEventHandler();
meh->set( viewer.getSceneData() );
if (arguments.read("--track-mouse")) meh->setTrackMouse(true);
viewer.addEventHandler( meh );
viewer.addEventHandler( new osgViewer::StatsHandler());

View File

@@ -43,7 +43,7 @@ typedef NodeContainer::iterator NodeIterator;
NodeContainer nodes;
//
osg::Group * Root = 0;
osg::ref_ptr<osg::Group> Root = 0;
const int HOUSES_SIZE = 25000; // total number of houses
double XDim = 5000.0f; // area dimension +/- XDim
@@ -81,11 +81,11 @@ void CreateHouses()
};
// use the same color, normal and indices for all houses.
osg::Vec4Array* colors = new osg::Vec4Array(1);
osg::ref_ptr<osg::Vec4Array> colors = new osg::Vec4Array(1);
(*colors)[0] = osg::Vec4(1.0f, 1.0f, 1.0f, 1.0f);
// normals
osg::Vec3Array * normals = new osg::Vec3Array(16);
osg::ref_ptr<osg::Vec3Array> normals = new osg::Vec3Array(16);
(*normals)[0] = osg::Vec3( 0.0f, -0.0f, -1.0f);
(*normals)[1] = osg::Vec3( 0.0f, -0.0f, -1.0f);
(*normals)[2] = osg::Vec3( 0.0f, -1.0f, 0.0f);
@@ -104,10 +104,10 @@ void CreateHouses()
(*normals)[15] = osg::Vec3(-0.707107f, 0.0f, 0.707107f);
// coordIndices
osg::UByteArray* coordIndices = new osg::UByteArray(48,indices);
osg::ref_ptr<osg::UByteArray> coordIndices = new osg::UByteArray(48,indices);
// share the primitive set.
osg::PrimitiveSet* primitives = new osg::DrawArrays(osg::PrimitiveSet::TRIANGLES,0,48);
// share the primitive set.
osg::PrimitiveSet* primitives = new osg::DrawArrays(osg::PrimitiveSet::TRIANGLES,0,48);
for (int q = 0; q < HOUSES_SIZE; q++)
{
@@ -120,11 +120,11 @@ void CreateHouses()
* 2 * ZDim) - ZDim;
float scale = 10.0f;
osg::Vec3 offset(xPos,yPos,0.0f);
osg::Vec3 offset(xPos,yPos,0.0f);
// coords
osg::Vec3Array* coords = new osg::Vec3Array(10);
osg::ref_ptr<osg::Vec3Array> coords = new osg::Vec3Array(10);
(*coords)[0] = osg::Vec3( 0.5f, -0.7f, 0.0f);
(*coords)[1] = osg::Vec3( 0.5f, 0.7f, 0.0f);
(*coords)[2] = osg::Vec3(-0.5f, 0.7f, 0.0f);
@@ -143,23 +143,23 @@ void CreateHouses()
// create geometry
osg::Geometry * geometry = new osg::Geometry();
geometry->addPrimitiveSet(primitives);
geometry->setVertexArray(coords);
geometry->setVertexIndices(coordIndices);
geometry->setColorArray(colors);
geometry->setColorBinding(osg::Geometry::BIND_OVERALL);
geometry->setNormalArray(normals);
geometry->setNormalBinding(osg::Geometry::BIND_PER_PRIMITIVE);
osg::ref_ptr<deprecated_osg::Geometry> geometry = new deprecated_osg::Geometry();
osg::Geode * geode = new osg::Geode();
geode->addDrawable(geometry);
nodes.push_back(geode);
geometry->addPrimitiveSet(primitives);
geometry->setVertexArray(coords.get());
geometry->setVertexIndices(coordIndices.get());
geometry->setColorArray(colors.get());
geometry->setColorBinding(deprecated_osg::Geometry::BIND_OVERALL);
geometry->setNormalArray(normals.get());
geometry->setNormalBinding(deprecated_osg::Geometry::BIND_PER_PRIMITIVE);
osg::ref_ptr<osg::Geode> geode = new osg::Geode();
geode->addDrawable(geometry.get());
nodes.push_back(geode.get());
}
}
@@ -187,14 +187,14 @@ void LayoutAsGrid()
{
osg::Node * node = nodeIter->get();
osg::Vec3 center = node->getBound().center();
int x = (int)floor((center.x() - xGridStart) / xGridSize);
int z = (int)floor((center.y() - yGridStart) / yGridSize);
groups[z * GridX + x]->addChild(node);
}
// add nodes to building root
// add nodes to building root
for (i = 0; i < GridX * GridY; i++)
{
osg::StateSet * stateset = new osg::StateSet();
@@ -205,7 +205,7 @@ void LayoutAsGrid()
0.5f + (static_cast<double> (rand()) / (2.0*static_cast<double> (RAND_MAX))),
0.5f + (static_cast<double> (rand()) / ( 2.0*static_cast<double>(RAND_MAX))),
1.0f);
material->setAmbient(osg::Material::FRONT_AND_BACK, color);
material->setDiffuse(osg::Material::FRONT_AND_BACK, color);
stateset->setAttributeAndModes(material, osg::StateAttribute::ON);
@@ -244,14 +244,14 @@ int main( int argc, char **argv )
// load the nodes from the commandline arguments.
osg::Node* model = osgDB::readNodeFiles(arguments);
osg::ref_ptr<osg::Node> model = osgDB::readNodeFiles(arguments);
if (model)
{
// the osgSim::InsertImpostorsVisitor used lower down to insert impostors
// only operators on subclass of Group's, if the model top node is not
// a group then it won't be able to insert an impostor. We therefore
// manually insert an impostor above the model.
if (dynamic_cast<osg::Group*>(model)==0)
if (dynamic_cast<osg::Group*>(model.get())==0)
{
const osg::BoundingSphere& bs = model->getBound();
if (bs.valid())
@@ -260,7 +260,7 @@ int main( int argc, char **argv )
osgSim::Impostor* impostor = new osgSim::Impostor;
// standard LOD settings
impostor->addChild(model);
impostor->addChild(model.get());
impostor->setRange(0,0.0f,1e7f);
impostor->setCenter(bs.center());
@@ -278,9 +278,9 @@ int main( int argc, char **argv )
// we would know about it, other than by following the parent path
// up from model. This is really what should be done, but I'll pass
// on it right now as it requires a getRoots() method to be added to
// osg::Node, and we're about to make a release so no new features!
osg::Group* rootnode = new osg::Group;
rootnode->addChild(model);
// osg::Node, and we're about to make a release so no new features!
osg::ref_ptr<osg::Group> rootnode = new osg::Group;
rootnode->addChild(model.get());
// now insert impostors in the model using the InsertImpostorsVisitor.
@@ -304,7 +304,7 @@ int main( int argc, char **argv )
}
// add model to viewer.
viewer.setSceneData(model);
viewer.setSceneData(model.get());
return viewer.run();
}

View File

@@ -0,0 +1,5 @@
SET(TARGET_SRC
osgkeystone.cpp )
#### end var setup ###
SETUP_EXAMPLE(osgkeystone)

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