Compare commits

...

1192 Commits

Author SHA1 Message Date
Robert Osfield
d69f2a81f9 Updated ChangeLog for 3.4.1 release 2017-08-28 17:50:49 +01:00
Robert Osfield
35334daae4 Build fix 2017-08-28 17:34:51 +01:00
Robert Osfield
14232cd993 Added back in 3.4.0 release entry 2017-08-28 16:55:52 +01:00
Denys Koch
ec86072533 Fix flawed BoundingSphere inequality operator 2017-08-28 16:53:20 +01:00
Robert Osfield
3f66f1d276 Updates for 3.4.1 stable release 2017-08-28 15:36:31 +01:00
Robert Osfield
c1055fdfbc Updated rc number to 3 or 3.4.1-rc3 2017-08-24 17:49:34 +01:00
Robert Osfield
328632af75 Updated READE and ChangeLog 2017-08-24 17:45:48 +01:00
Robert Osfield
ec89d96114 Fixed underflow issue 2017-08-23 15:26:52 +01:00
Robert Osfield
ea17943a74 Bimped SO version due to changes in Windows exports in osgDB::ifstream + ofstream. 2017-08-22 14:17:45 +01:00
Robert Osfield
07d05840e9 Updated RC number to 2 for 3.4.1-rc2 2017-08-22 12:19:40 +01:00
Robert Osfield
d108bea9eb Updated ChangeLog 2017-08-22 12:18:29 +01:00
Robert Osfield
1bc5ef030f Added name typo fix 2017-08-22 12:00:17 +01:00
Robert Osfield
15e60acfb5 Updated ChangeLog 2017-08-22 09:05:27 +01:00
Robert Osfield
4710b6556d Added catch for controbutors list 2017-08-22 09:04:49 +01:00
OpenSceneGraph git repository
a231483ea6 Merge pull request #310 from OpenMW/merge_internalsizedformats
Applied sizedInternalFormats change to 3.4 branch
2017-08-22 08:03:33 +01:00
Robert Osfield
5e48c51bd7 Reversed the order of some sizedInternalFormats enum entries to sync with the change in serach direction that was checked in as an earlier revision. 2017-08-21 21:16:00 +00:00
Robert Osfield
036c6676c1 Added handling of CPACK and automatically generated package files 2017-08-21 15:24:13 +01:00
Robert Osfield
ed9c28b4ec Removed unneccessary DrawArrays->setCount() that was causing a crash. 2017-08-18 16:26:12 +01:00
Robert Osfield
50e471d900 Merged addition of "" around variablesfrom master. 2017-08-18 16:11:29 +01:00
Raymond de Vries
5b7ef57ad7 Fix for better picking up 3rd party dependencies 2017-08-18 16:01:31 +01:00
Robert Osfield
a3e11f1d50 Fixed iterator comparison. 2017-08-18 08:08:28 +01:00
Robert Osfield
4e67d6deb2 Adopted OSG_GL*_FEATURES usage of 0 and 1 in place of false and true to avoid VisualStudio 2012 build issues 2017-08-17 08:53:58 +01:00
Uwe Woessner
edee9d0946 Extension to the PLY plugin to read files with textures. 2017-08-15 15:42:22 +01:00
OpenSceneGraph git repository
e5cccefafe Merge pull request #291 from eligovision/OpenSceneGraph-3.4_animation
osgAnimation: classes UpdateVec2fUniform and UpdateVec4fUniform added
2017-07-31 16:47:09 +01:00
konstantin.matveyev
2c35b63d38 [*] osgDB::OutputStream fix 2017-07-31 17:50:36 +03:00
konstantin.matveyev
700dd2b9a7 [+] Two classes added: osgAnimation::UpdateVec2fUniform, osgAnimation::UpdateVec4fUniform 2017-07-31 17:50:08 +03:00
OpenSceneGraph git repository
c1585d3c17 Merge pull request #289 from eligovision/OpenSceneGraph-3.4_apple
IMAGEIO plugin tweak
2017-07-31 15:06:57 +01:00
OpenSceneGraph git repository
76a92314cf Merge pull request #290 from eligovision/OpenSceneGraph-3.4_apple_ios
osgViewer::GraphicsWindowIOS fixes
2017-07-31 15:05:26 +01:00
konstantin.matveyev
60eb458c47 [*] imageio changed: more methods of storing image supported; tested on macOS (compatibility profile) and iOS(GLES2/3) 2017-07-31 15:37:55 +03:00
konstantin.matveyev
7e5a9582b3 [*] osgViewer::GraphicsWindowIOS fixes 2017-07-31 15:34:21 +03:00
Robert Osfield
662e76d721 Fixed indectation 2017-07-31 12:44:47 +01:00
OpenSceneGraph git repository
428f4a3804 Merge pull request #288 from eligovision/OpenSceneGraph-3.4_pragmatic
pragma(tic) shader composing fixes in the State
2017-07-31 12:42:15 +01:00
konstantin.matveyev
23edfad1fd [**] pragma(tic) fix: 'defineMap.changed flag' condition changed in State::push/popDefineList 2017-07-31 13:40:00 +03:00
Robert Osfield
0c1fad2c91 Updated AUTHORS and CHangeLog for 3.4.1-rc1 2017-07-28 17:57:02 +01:00
Robert Osfield
1201ac230d Updated 3.4 branch to 3.4.1-rc1 version 2017-07-28 17:43:34 +01:00
James Turner
eabd08ef25 Attempt to fix broken DLL exports from osgDB
Only export the osgDB method implementations, instead of the entire
class, and hence avoid exporting symbols from the base class, which
then conflict with other compilation units when linking.

This avoids the need for /FORCE:MULTIPLE linker option with MSVC.
2017-07-27 16:52:22 +01:00
Robert Osfield
a5bcbc1822 Adopted FindFreetype.cmake from master 2017-07-27 10:43:33 +01:00
Robert Osfield
f822603446 Replaced State::_glExtensions initialization to be consistent with master, enabling sharing of GLExtension data structure. 2017-07-26 11:12:11 +01:00
Robert Osfield
f449bd3730 Moved State::initializeExtensionProcs() nearer top of source file to make the position consistent with change in position in master, making it easier to diff between them. 2017-07-26 11:08:46 +01:00
Robert Osfield
b37b635a7c Merged GLExtension deletion mechanism from master to avoid GLEXtension being deleted when shared contexts are used and osg::State is deleted when a context is deleted. 2017-07-25 15:58:27 +01:00
OpenSceneGraph git repository
224f837e0d Merge pull request #272 from psyinf/msvc_static_build
Msvc static build
2017-07-25 14:45:20 +01:00
Sebastian Messerschmidt
1d7d1dda42 FIX: missing change in ENDIF 2017-07-21 13:12:38 +02:00
Sebastian Messerschmidt
ac36649ed6 FIX: <CMake> attempting to install pdb-files for static targets caused failing INSTALL 2017-07-21 12:58:10 +02:00
Anna Sokol
9c7a474032 Since version 2.5.1 freetype has supported the WOFF extension format.
In the attached ReaderWriterFreeType.cpp file I added the following line:

            supportsExtension("woff","web open font format");
2017-07-17 16:47:22 +01:00
Robert Osfield
06a45ef889 Pulled in .gitignore from master 2017-06-20 09:35:49 +01:00
Robert Osfield
1e4f6f675b Backported GLES compatible shaders into ShaderGen 2017-06-19 17:38:54 +01:00
Robert Osfield
e6ab01c7c6 Backported GL2/3, GLES2/3 compatible Text and StatsHandler shaders to OSG-3.4 2017-06-19 17:38:25 +01:00
Robert Osfield
b2cd4b5836 Added TimeMultiplier and LoopingMode to ImageSequence .osg serializer 2017-05-29 12:25:30 +01:00
Robert Osfield
09b37224ff Improved the DrawElements selction 2017-05-25 13:29:42 +01:00
Robert Osfield
6d4afbbb49 Added handlng of Text with large number of characters 2017-05-25 10:53:00 +01:00
Robert Osfield
8b433f8364 Replaced osg::DrawElementeUInt usage for a more flexible DrawElements base class approach with the default set to DrawElementUShort to ensure compatibility with GLES2 implementes that don't support uint for glDrawElements. 2017-05-25 10:41:12 +01:00
Robert Osfield
10c1fedfca Addded a GLES2 compatible osgmovie shader 2017-05-16 12:32:41 +01:00
OpenSceneGraph git repository
0af180f8b0 Merge pull request #251 from emminizer/OpenSceneGraph-3.4
osgText::Glyph: Explicitly set GL_TEXTURE_MIN_FILTER to address disap…
2017-05-10 11:08:27 +01:00
Daniel Emminizer
b001e8d36d osgText::Glyph: Explicitly set GL_TEXTURE_MIN_FILTER to address disappearing glyphs on some Intel cards. 2017-04-25 07:22:16 -04:00
Alexander Roan
397ab4aa51 GLExtenstions: fix checking of isFrameBufferObjectSupported flag for GLES2 2017-04-24 10:38:02 +01:00
Konstantin S. Matveyev
9eaf03e16e Fixes glyphs's MODELVIEW matrices (positions, scales etc.) if state.getUseModelViewAndProjectionUniforms() is true 2017-04-18 15:53:48 +01:00
OpenSceneGraph git repository
9ba9221ccf Merge pull request #214 from LaurensVoerman/submit-3.4serializerParticle
fix bug in osgb/osgt/osgx readerwriter osgParticle
2017-03-13 14:27:08 +00:00
OpenSceneGraph git repository
16591a310a Merge pull request #210 from scrawl/programfix_backport
Backport state leak fix to 3.4 branch
2017-03-11 11:38:18 +00:00
Nico Kruithof
1b9e1301cf Fixed typo
osg_ModeViewMatrix -> osg_ModelViewMatrix
2017-03-10 17:48:54 +00:00
Laurens Voerman
796b9f0a9b fix bug in osgb/osgt/osgx readerwriter causing the osgParticle-SizeInterpolator and -ColorInterpolator to dissapear 2017-03-06 15:33:22 +01:00
Robert Osfield
232d227170 Changed Program::apply() to Program::compileGLObjects() to avoid the Program::apply() setting of setLastAppliedProgramObjects for affect current state. 2017-02-26 17:25:10 +01:00
OpenSceneGraph git repository
95818b0819 Merge pull request #199 from scrawl/statefix_backport
Backport State fix to 3.4 branch
2017-02-08 14:54:08 +00:00
Julien Valentin
ad0a73273c fix in StateSet.cpp
the State::DefineMap::changed flag is not resetted to false after currentDefines are updated
2017-02-08 00:52:04 +01:00
Robert Osfield
168212f383 Fixed linking bug caused by repeated Program::addShader()/removeShader() operations invalidating the internal attach/dettech lists. 2017-01-24 17:38:33 +00:00
Robert Osfield
320e0ce60c Quitened down verbose debug messages 2017-01-20 17:31:49 +00:00
Robert Osfield
6f1a828b37 Quietened down some verbose debug messages 2017-01-20 17:06:55 +00:00
Robert Osfield
e07f1ff5e9 Fixed indentation of comment 2017-01-19 15:56:17 +00:00
Robert Osfield
b6ec9dc532 Fixed unitialized variable access to premature calling of computeMatrix(). 2017-01-04 12:56:25 +00:00
Robert Osfield
d93d2e0ec1 From Hartwig Wiesmann, "ScalarsToColors returns a wrong color in case a value larger max is passed to getColor" 2016-12-23 17:17:33 +00:00
Robert Osfield
f272089857 From Torben Dannhauer, build updates for NVTT. 2016-12-21 17:03:24 +00:00
Robert Osfield
ad917a5318 From Torben Dannahauer, updates to track changes to Winddows 3rd party package 2016-12-21 16:35:10 +00:00
Robert Osfield
f0056c6d3b From Torben Dannhauer, "When compiling OSG with DCMTK on windows, it throws an compiler error due to a missing ws2_32.lib in the linker settings." 2016-12-21 15:35:43 +00:00
Robert Osfield
fe25b2961b From Andreas Ekstrand, "he attached ESRIShape.cpp contains a small fix in parsing of PointZ features, now correctly comparing with header content length which is defined in 16-bit words.
This should have been fixed in my old submission from 2012 but was probably overlooked due to an alternative way of comparing to a fix number for this feature type.

Without this fix, the plugin will only read one PointZ feature even if multiple features exist."
2016-12-21 11:40:16 +00:00
Robert Osfield
6511347d4b Added StateSet::setGlobalDefaults() to fix bug when osgViewer has stats on but no scene graph assigned 2016-12-21 09:15:48 +00:00
Robert Osfield
192e654cdb Fixed handling of #define's that are used as functions 2016-12-16 16:14:10 +00:00
Robert Osfield
b59c46c3cf Added GL_EXT_texture_border_clamp support for GLES 2016-11-30 17:15:06 +00:00
scrawl
29049ea238 Fix typo in StateSet::compileGLObjects, causing compilation of attributes to not be executed unless checkForGLErrors is true. 2016-11-26 12:17:07 +00:00
Robert Osfield
46df1fd141 Fixed crash in handling of osg::Callback attached as Drawable update callback.
Added handling of osg::Callback as a Drawable cull callback
2016-11-23 19:18:14 +00:00
Robert Osfield
8af48d369c Added Dragger::applyAppropriateFrontFace(StateSet*) to make it easy to handle inverted matrices by toggling the FrontFace to sure the correct face is visible. 2016-11-11 17:16:40 +00:00
Robert Osfield
95d450e026 Merge branch 'OpenSceneGraph-3.4' of https://github.com/openscenegraph/OpenSceneGraph into OpenSceneGraph-3.4 2016-11-11 13:54:54 +00:00
Robert Osfield
b58048e43b Fixed handling of Locator's with negative extents 2016-11-11 13:54:15 +00:00
Robert Osfield
1f1c21772a Added check against binding type of array to decide whether it's appropriate to assign array to VBO. 2016-11-03 11:32:25 +00:00
Robert Osfield
fa27a1f3ed Changed appending of \n to be to the version line. 2016-10-12 17:23:19 +01:00
Robert Osfield
d5d4f7239b From Torben Dannhauer, added freetype27 (2.7) to search list 2016-10-10 11:22:44 +01:00
Laurens Voerman
2a110515c1 remove CMAKE_BUILD_TYPE STREQUAL "Release" (cmake configure time varable) to select pdb install - select CONFIGURATIONS RelWithDebInfo Debug 2016-10-07 17:03:35 +01:00
Laurens Voerman
d2a0315e20 fix bug in SmoothingVisitor tripped by bunny.ply 2016-10-06 14:18:14 +01:00
Robert Osfield
1f9725ea49 Replaced local static usage to avoid threading and mulit-context issues 2016-09-22 14:34:13 +01:00
Anish Thomas
d772304cec GLSL 1.3 support for vertex-attrib aliasing 2016-09-12 08:46:40 +01:00
Robert Osfield
192574958a Fixed handling in osgUtil::IncrementalCompileOperation/CompileSet/StateToCompile when the _markerObject is NULL. 2016-08-15 12:56:57 +01:00
Robert Osfield
7df7eb78ac Merge branch 'OpenSceneGraph-3.4' of https://github.com/openscenegraph/OpenSceneGraph into OpenSceneGraph-3.4 2016-07-31 14:57:11 +01:00
Robert Osfield
e2359890bd Added FT_LOAD_NO_HINTING 2016-07-31 14:02:41 +01:00
Robert Osfield
912e4f8a0c Revert "corrected syntax error in src/osgPlugins/fbx/ReaderWriterFBX.cpp"
This reverts commit 7a1324800f.
2016-07-31 11:27:45 +01:00
Robert Osfield
78300f7d61 Fixed build error reported on gcc 4.6.4/Ubuntu 12.04 32bit, issue #108 2016-07-31 11:27:23 +01:00
Thao Le
2bd81226c3 corrected syntax error in src/osgPlugins/fbx/ReaderWriterFBX.cpp 2016-06-20 06:43:02 +01:00
Robert Osfield
37f6e2b39e Fixed invalidated iterator bug pick up by Coverity. 2016-06-10 12:45:38 +01:00
Robert Osfield
2f4064d757 Copied over .travis.yml file to 3.4 branch to add build testing 2016-06-09 14:33:05 +01:00
Mathieu MARACHE
04f27c370e Build fix for VS. 2016-06-09 14:10:02 +01:00
Robert Osfield
02eb8de191 Rewrote Window::setNextFocusable() to address a bug in the management of the search iterator. Covertiy reported bug "Undefined behavior may result; the program may crash or subtly misbehave.
In osgWidget::​Window::​setNextFocusable(): An invalid or past-the-end iterator is being used."
2016-06-09 12:10:38 +01:00
Robert Osfield
d3f5aef5ef Fixed "Using invalid iterator" bug in getTile() methods, detected by Covertity. 2016-06-09 11:43:28 +01:00
Julien Valentin
ec8cb360c8 Fixed little bug in DrawArraysLength (instancing not supported).
Corrected PrimitiveSet.cpp in order DrawArraysLength can be instanced.
It's the only pr missing code
if (_numInstances>=1)      glDrawXXXInstanced(...,_numInstances);
else glDrawXXX();
2016-06-03 17:58:26 +01:00
Robert Osfield
8c79dccbbc Fixed missing " 2016-06-01 12:49:55 +01:00
Robert Osfield
517728c7d9 Added macosx10.11 to the list of supported OSX SDK's 2016-06-01 11:42:17 +01:00
Robert Osfield
0f7e30a74e Added in extra search paths for FBX 2016-06-01 11:25:31 +01:00
Andreas Cadhalpun
6cacc5a2c2 Replace deprecated FFmpeg API to fix build with ffmpeg-3.0.x 2016-06-01 10:33:19 +01:00
Stephan van Alste
aae4f22163 Do not install non existant pdb file in release build mode 2016-05-31 17:06:48 +01:00
Ralf Habacker
6eaf2f5781 Install msvc debug files along with the binaries 2016-05-31 17:02:11 +01:00
Ralf Habacker
e536d8e601 Fixed bug not detecting unc pathes in osgDB::isAbsolutePath() 2016-05-31 16:17:15 +01:00
Alberto Luaces
af9d8889c8 defines for building on Hurd and BSD kernels 2016-05-31 12:59:48 +01:00
Pjotr Svetachov
a4c9cac2a8 small optimization to the osgb/t serializers. 2016-05-31 11:28:27 +01:00
Jannik Heller
5c46d9de3e Fixed typo of method name 2016-05-30 13:43:09 +01:00
Tony Vasile
8d08b75e19 OpenFlight-plugin with Surface Material Codes. There is one additional field that may be required by an existing application in addition to the IR Code is the IR Material. I have a small fix to include the IR Material as the User Value <UA:IRM> 2016-05-30 12:42:06 +01:00
Robert Osfield
6ec5d80b0d From Wee See, "attached a small submission, which makes the option "readObjectRecordData" of OpenFlight-plugin working like documented in the Knowledge Base of OSG (52-using-the-openflight-plugin).
Actually, if the option "readObjectRecordData" is set, ObjectRecordData will not be read and set.
With this submission, if the option "readObjectRecordData" is set, ObjectRecordData will be read and set."
2016-05-26 18:07:46 +01:00
Robert Osfield
f48b5a3fdb From Philippe Renon and Robert Osfield, osgViewer::Viewer::checkNeedToDoFrame should return true when only the root node has an update callback.
Note, from Robert, I took Philippe modifications to Viewer.cpp and reformated them slightly to avoid a double check against getSceneData()!=0 and then rolled
the changes out to CompositeViewer::checkNeedToDoFrame() to ensure that both implementations work the same.
2016-05-26 17:51:35 +01:00
Robert Osfield
7bcc5d861e Fixed RenderStageCache's handling of Observer functionality that was causing a crashing on exit in osgoit and osgprerender examples. 2016-05-24 20:49:01 +01:00
Robert Osfield
933b8cdbaf Added GLES3 path for setting up with EGL 2016-05-06 19:55:04 +01:00
Robert Osfield
7200e38fce Added 3.4 press release to NEWS.txt 2016-05-06 17:53:27 +01:00
Robert Osfield
4a1f033dbe Added non const releaseGLObjects(osg::State* state) for backwards compatibility 2016-04-27 08:40:35 +01:00
Robert Osfield
ec19ee9655 Fixed copy _readBuffer bug. 2016-04-21 14:08:20 +01:00
Robert Osfield
653af27d02 Fixed ShaderComposer::releaseGLObjects(State*) const method as it's const was missing.
Rewrote the ShaderComposer::releaseGLObjects() const method to pass on the releaseGLObjects() calls to any associated Program or Shader objects.
2016-04-18 20:49:02 +01:00
Robert Osfield
29ce4f616d From Vladimir Chebaev, fixed handling of outline orientiation 2016-04-14 18:08:52 +01:00
Robert Osfield
f39cc7b6f1 From Vladimir Chebaev, fixed handling of outline orientiation 2016-04-14 18:01:58 +01:00
Robert Osfield
879a8bd020 Changed the default value paramter to be consistent with the non templated version of StateSet::setTextureAttributeAndModes(..) 2016-04-01 11:47:02 +01:00
Robert Osfield
ccb06f003a Merge branch 'OpenSceneGraph-3.4' of https://github.com/openscenegraph/OpenSceneGraph into OpenSceneGraph-3.4 2016-03-31 19:26:51 +01:00
Robert Osfield
79fa48c984 added assignment of mipmap levels from source image. 2016-03-31 19:26:08 +01:00
Robert Osfield
47022a1bf0 From Sherman Wilcox, added assignment of mipmap levels from source image. 2016-03-31 18:58:45 +01:00
Robert Osfield
926cffb2ee From Jannik Heller, Wrong function call in setTextureAttributeAndModes
"From I think that this piece of code in StateSet::setTextureAttributeAndModes is a copy&paste mistake:

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

As per the warning message it should be calling setAttributeAndModes(attribute,value); ."
2016-03-11 16:48:19 +00:00
Robert Osfield
f044bc6b45 From Joe Thompson, "OpenSceneGraph cannot be built with Visual Studio 2008.
The file osg-OpenSceneGraph-3.4.0\include\osg\Types
typedefs int8_t, int16_t, int32_t and int64_t
These are typedefed as signed __intX in several other places.
With VS2008, this causes an error "int8_t redifined, different basic types"
Explicitly declaring them signed fixes the error."
2016-03-02 09:21:15 +00:00
Robert Osfield
ac8bbb9d1e Updated ChangeLog 2016-03-01 20:37:07 +00:00
Robert Osfield
db24f7f09d Removed redundent CMake vars 2016-03-01 20:34:18 +00:00
Robert Osfield
520b6c24f6 Fixed the make tag-run and branch-run 2016-03-01 20:33:21 +00:00
Robert Osfield
244cec821e Updated AUTHORS and ChangeLog 2016-03-01 19:54:36 +00:00
Robert Osfield
ba309bf38b Refactored the make tag-test, tag-run, branch-test, branch-run and ChangeLog features of the CMakeLists build system so it now supports working off git instead of subversion 2016-03-01 19:50:05 +00:00
Robert Osfield
60a7b8ce02 Within the #pragmatic shader composition code added platform specific line endings for WIN32 vs all other platforms to "\r\n" and "\n" respectively. 2016-03-01 11:47:33 +00:00
Robert Osfield
3a15c66290 Merged improved parsing of #pragma from master. 2016-02-29 15:57:01 +00:00
Robert Osfield
577d161303 Fixed debug build 2016-02-24 16:00:12 +00:00
Robert Osfield
6011bc4307 From Jannik Heller, osgParticle freeze on cull fix, ammended by Robert Osfield to make if statements a little more readable. 2016-02-23 10:14:21 +00:00
Robert Osfield
40caedc7cd From Anish Thomas, "Underflow bug in BufferObject pool usage" 2016-02-22 09:22:06 +00:00
Robert Osfield
4371512dd2 From Bjorn Blissing, "I stumbled upon a strange ifdef-case inside Geometry.cpp
Currently the code looks like this:

Code:
    DrawElementsUByte* elems = new DrawElementsUByte(PrimitiveSet::TRIANGLES);
    elems->push_back(0);
    elems->push_back(1);
    elems->push_back(2);

    elems->push_back(2);
    elems->push_back(3);
    elems->push_back(0);
    geom->addPrimitiveSet(elems);
    geom->addPrimitiveSet(new DrawArrays(PrimitiveSet::QUADS,0,4));

The second condition looked really strange (note the ! sign), and results in pretty much all code paths uses the first code. The correct version should probably be that only people with GLES1 or GLES2 should use GL_TRIANGLES to simulate quads. And all others should use the native support for GL_QUADS.
"
2016-02-19 15:04:14 +00:00
Robert Osfield
9132d98785 To the COLLADA_INCLUDE_DIR search paths added the directories:
/usr/local/include/collada-dom2.4
    /usr/local/include/collada-dom2.2
    /opt/local/include/collada-dom2.4
    /opt/local/include/collada-dom2.2
    /usr/include/collada-dom2.4
    /usr/include/collada-dom2.2

To enable recent versions of the DOM to be found in their new install locations.
2016-02-19 12:21:36 +00:00
Robert Osfield
47c531cc37 Updated the AuthenticationDetails::HttpAuthentication enum to reflect current libcurl values 2016-02-18 19:55:58 +00:00
Robert Osfield
4704621c39 Replaced (long int) with more portable (GLint64) 2016-02-18 10:58:26 +00:00
Robert Osfield
0244b234ca From Tony Vasile, "This is a fix for the handling of OpenFlight files with switches whose children have a transformation matrix on them. It may break other things and I have only tested this with one of my models." 2016-02-18 10:07:29 +00:00
Robert Osfield
09fd75dcf4 From Mourad Boufarguine, "This submission fixes typos in Uniform::getTypename() method in Uniform.cpp (missing "r" in usampler names)." 2016-02-18 09:28:33 +00:00
Robert Osfield
c3d45732a1 Renamed zero and one to transparentCount and opaqueCount to avoid confusion in their meaning and usage. 2016-02-18 08:59:26 +00:00
Robert Osfield
89f74b1a56 Fixed warning 2016-02-17 17:36:10 +00:00
Robert Osfield
6089257d3c Commented out unused functions and variable. 2016-02-17 17:08:07 +00:00
Robert Osfield
97336b89ac Introduced a separate GLuint64 one variable to get around a 32bit build timer issue under Windows. 2016-02-17 16:03:26 +00:00
Robert Osfield
229b833a5a Fixed check against Drawable::isCullingActive().
Removed old code intended to check the Geode parent of a Drawable to see if it's CullingActive is true as this was broken by the change osg::Drawable being derived from osg::Node rather than osg::Object.
2016-01-27 10:10:01 +00:00
Robert Osfield
7ae1421864 Added .gitignore to queiten down git status reports 2016-01-25 19:44:58 +00:00
Robert Osfield
bf1aa5088e Revert "From Jannik Heller and Robert Osfield, introduced ReadResult/WriteResult::statusMessage() method that creates a std::string from the stutus value and message string."
as this submission was meant for the master only, not the binary compatible 3.4 branch.

This reverts commit df97a18a5754ed39ac43044ad9557e8409790ff3.
2016-01-25 12:18:32 +00:00
Robert Osfield
e798db04c8 From John Farrier, "Best I can tell, there is an enumeration for NEVER_CHECK_GL_ERRORS in CheckForGLErrors, defined in State. State.cpp does check to see if you want MORE error checking, but there is no way to turn OFF error checking. This change allows disabling of OpenGL error checking." 2016-01-25 10:49:23 +00:00
Robert Osfield
adbadd66be From Patrick Neary, "In ShaderComposer::getOrCreateProgram(), tesselation control and evaluation shaders are processed but not added to the shader program." 2016-01-25 10:26:52 +00:00
Robert Osfield
bd0cf5e47d Changed the prototype from NULL to osg::DummyObject to address a bug in reading .osgt + .osgx where an image is written out but fails to read the file causes subsequent parts of the file to be mis-read 2016-01-22 10:14:35 +00:00
Robert Osfield
7239050c5b Fixed typo View::setImagePager(..) template method 2016-01-21 08:32:57 +00:00
Robert Osfield
55bb474c3b From Jannik Heller, "This submission fixes a bug introduced in commit 5b17e3bc2a "Introduced CMake option OSG_PROVIDE_READFILE option...". The added overload for StateSet::setAttributeAndModes was ignoring the mode setting.
"
2016-01-20 14:24:06 +00:00
Robert Osfield
ff1051a6fd From Jannik Heller and Robert Osfield, introduced ReadResult/WriteResult::statusMessage() method that creates a std::string from the stutus value and message string. 2016-01-19 17:39:03 +00:00
Robert Osfield
845bb6aceb From Ravi Mathur, OSX/Clang 7.0.0 build fix 2016-01-19 15:43:47 +00:00
Robert Osfield
3e23c5b22d From Wojciech Lewandowski, Visual Studio 2008 compatibility fix
Two fixed files:

osgPlugins/osgjs/JSON_Objects
osgPlugins/stl/ReaderWriterSTL.cpp.

They did not compile with VS 2008 (recent master from Github). It looks like they defined stdint types  (missing in VS 2008) but code using them also included <osg/Types> header. Errors were caused by minor differences in signed int definitions. I just removed own definitions and added include<osg/Types> instead. It solves the problem and makes the code clearer now.
2015-12-14 18:47:09 +00:00
Robert Osfield
5675d86c9b From Jordi Torres, Fix for missing header file in distribution
osg/TriangleLinePointIndexFunctor was not being installed because it was not added to the CMakeLists.txt
2015-11-23 13:17:06 +00:00
Robert Osfield
5405d9c465 Added support for copying include/osgViewer/config headers on make install. 2015-11-23 12:29:25 +00:00
Robert Osfield
3b17418031 Fixed warning message
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15179 16af8721-9629-0410-8352-f15c8da7e697
2015-11-09 15:14:07 +00:00
Robert Osfield
9fc6850962 From Jannik Heller, fixed typo of OSG_COMPIlE_CONTEXTS env var
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15175 16af8721-9629-0410-8352-f15c8da7e697
2015-11-08 11:59:23 +00:00
Robert Osfield
46904ff67a From Mathias Froehlich, "Avoid per frame X11 roundtrips"
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15174 16af8721-9629-0410-8352-f15c8da7e697
2015-11-05 14:38:19 +00:00
Robert Osfield
636d595912 From Alberto Luaces, "here are two minimal capitalization fixes for mingw cross-compilation, where case sensitivity matters."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15172 16af8721-9629-0410-8352-f15c8da7e697
2015-10-26 11:43:28 +00:00
Robert Osfield
5310a96c73 Restructed the setting of the RenderStage ClearColor/ClearMask to make the code more readable and to avoid double setting of the ClearMask.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15170 16af8721-9629-0410-8352-f15c8da7e697
2015-10-26 11:41:44 +00:00
Robert Osfield
5dc251a5c1 From Sebastian Messershmidt, "The uncommented pointer type QTimerEvent */*event*/ leads to a compiler error under visual studio 2010"
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15168 16af8721-9629-0410-8352-f15c8da7e697
2015-10-23 11:07:30 +00:00
Robert Osfield
6a67be2e32 Introduced CMake option OSG_PROVIDE_READFILE option that defaults to ON, but when switched to OFF disables the building of the osgDB::read*File() methods,
forcing users to use osgDB::readRef*File() methods.  The later is preferable as it closes a potential threading bug when using paging databases in conjunction
with the osgDB::Registry Object Cache.  This threading bug occurs when one thread gets an object from the Cache via an osgDB::read*File() call where only
a pointer to the object is passed back, so taking a reference to the object is delayed till it gets reassigned to a ref_ptr<>, but at the same time another
thread calls a flush of the Object Cache deleting this object as it's referenceCount is now zero.  Using osgDB::readREf*File() makes sure the a ref_ptr<> is
passed back and the referenceCount never goes to zero.

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

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

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

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



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15165 16af8721-9629-0410-8352-f15c8da7e697
2015-10-22 14:14:53 +00:00
Robert Osfield
74f1838960 Added osg::flushAllDeletedGLObjects to clean up of graphics context after the existing osg::deleteAllGLObjects() to catch any cases where delete doesn't flush GL objects.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15149 16af8721-9629-0410-8352-f15c8da7e697
2015-10-08 15:58:22 +00:00
Robert Osfield
f4e71bad3a OSG_INIT_SINGLETON_PROXY into DatabasePager::prototype() and Registry::instance(), removing the InitRegistry proxy object in src/osgViewer/ViewerBase.cpp.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15148 16af8721-9629-0410-8352-f15c8da7e697
2015-10-05 11:18:46 +00:00
Robert Osfield
61d317b0b8 From Kristofer Tingdahl, "we had a minor shadow problem with the osg-3.4 that pollutes our continuous integration"
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15144 16af8721-9629-0410-8352-f15c8da7e697
2015-09-25 15:20:32 +00:00
Robert Osfield
05f3e038d8 Added fix for case when Renderer is assigned to a Camera that has now View
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15142 16af8721-9629-0410-8352-f15c8da7e697
2015-09-25 11:15:09 +00:00
Robert Osfield
1a9a74216b Refactored osgViewer::Renderer's handled of FrameStamp to avoid threading conflicts
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15139 16af8721-9629-0410-8352-f15c8da7e697
2015-09-25 10:10:10 +00:00
Robert Osfield
6344d4430d From John Hedström,"Texture2DArray support for the .osg serializer"
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15137 16af8721-9629-0410-8352-f15c8da7e697
2015-09-24 14:14:43 +00:00
Robert Osfield
3c7bf7ec8a Fixed line endings
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15133 16af8721-9629-0410-8352-f15c8da7e697
2015-09-24 09:29:15 +00:00
Robert Osfield
87e5c54ee7 From Jannik Heller, "I've hit what I believe to be a bug (or at the very least, an unintuitive behaviour) in the osg::Geometry copy constructor. I noticed it when using osg::clone on a Geometry with vertex buffer objects, and the copy flags DEEP_COPY_ARRAYS. To be precise, I add a Geometry to an osgUtil::IncrementalCompileOperation, then osg::clone the Geometry. I was getting reports from users of random crashes happening.
I believe the offending lines are in the osg::Geometry copy constructor:

    if ((copyop.getCopyFlags() & osg::CopyOp::DEEP_COPY_ARRAYS))
    {
        if (_useVertexBufferObjects)
        {
            // copying of arrays doesn't set up buffer objects so we'll need to force
            // Geometry to assign these, we'll do this by switching off VBO's then renabling them.
            setUseVertexBufferObjects(false);
            setUseVertexBufferObjects(true);
        }
    }

Toggling the vertex buffer objects off then on again actually touches not only the arrays controlled by DEEP_COPY_ARRAYS, but also the PrimitiveSets which are controlled by DEEP_COPY_PRIMITIVES. This means if the user has copyflags of only DEEP_COPY_ARRAYS, we are modifying arrays that belong to the original const Geometry& we are copying from. I believe this shouldn't be allowed to happen because we are using a const& specifier for the original Geometry.

In my case the osgUtil::IncrementalCompileOperation was trying to compile the geometry, while in the main thread a clone operation toggled the VBO's off and on, a crash ensues.

In the attached patch, you will find a more efficient handling of VBO's in the osg::Geometry copy constructor, so that only the Arrays that were actually deep copied have their VBO assigned, and no changes are made to Arrays that already had a valid VBO assigned. In addition, the DEEP_COPY_PRIMITIVES flag is now honored so that VBO's are set up correctly should a user copy a Geometry with only that flag.
"


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15128 16af8721-9629-0410-8352-f15c8da7e697
2015-09-04 15:35:14 +00:00
Robert Osfield
0567ce316d From Laurens Voerman, "I found that using an ImageSequence with mode PAGE_AND_DISCARD_USED_IMAGES triggers the (3) imageThreads to run and never stop, even when no more work is to be done. This is due to a bug in the stop condition currently setting the thread to stop and wait for a signal only when no work needs to be done AND the databasepager is paused.
It should stop and wait for a signal on either of those two. Due to a few logical inversions it boils down to replacing || with &&

OLD _block->set((!_requestList.empty() || !_pager->_databasePagerThreadPaused));
NEW _block->set((!_requestList.empty() && !_pager->_databasePagerThreadPaused));//release the threads to run IF (work_to_be_done && not_paused)

This bug is present since svn rev 8663 (just before 2.6.0 release)


attached is a zip with the files:

OpenSceneGraph\include\osgDB\ImagePager



This file is valid for svn branch and stable 3.2 and 3.4
branches 2.6 - 3.0 have the same bug, but other differences in the file."


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15126 16af8721-9629-0410-8352-f15c8da7e697
2015-09-04 15:05:06 +00:00
Robert Osfield
5cbd785f78 From Laurens Voerman, "I crashed osgconv while compressing textures:
osgconv --compressed-dxt1 cow.osg cow.ive

due to different handling of the extentions in osg 3.4 and up.

attached is a zip with the files:

OpenSceneGraph\applications\osgconv\osgconv.cpp



This file is valid for svn branch and stable3.4."




git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15123 16af8721-9629-0410-8352-f15c8da7e697
2015-09-04 14:50:27 +00:00
Robert Osfield
4ee38248a2 From Julien Valentin, "Serializing custom geometry i ran into a crash due to a
setVertexAttribArrayList(array) with array containing NULL vertexAttrib.
I added a test in order to avoid it


Code:
void Geometry::setVertexAttribArrayList(const ArrayList& arrayList)
{
    _vertexAttribList = arrayList;

    dirtyDisplayList();

    if (_useVertexBufferObjects)
    {
        for(ArrayList::iterator itr = _vertexAttribList.begin();
            itr != _vertexAttribList.end();
            ++itr)
        {
if(itr->get())//ADDED
            addVertexBufferObjectIfRequired(itr->get());
        }
    }
}
"

and

"The bug i ran into is a crash reading osgt Geometry with null vertexattribs.
The only thing i added is a not nul check on array passed to setVertexAttribArrayList."




git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15122 16af8721-9629-0410-8352-f15c8da7e697
2015-09-04 14:35:03 +00:00
Robert Osfield
f4013a68da Updated ChangeLog
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15114 16af8721-9629-0410-8352-f15c8da7e697
2015-08-12 11:13:17 +00:00
Robert Osfield
2ad1e661e0 Added initializer
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15113 16af8721-9629-0410-8352-f15c8da7e697
2015-08-12 10:44:20 +00:00
Robert Osfield
c1d5b6992c Updated ChangeLog
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15112 16af8721-9629-0410-8352-f15c8da7e697
2015-08-12 10:30:18 +00:00
Robert Osfield
b92c3f1455 Merged shaders from svn/trunk that refactor the workaround to the NVidia driver bug
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15111 16af8721-9629-0410-8352-f15c8da7e697
2015-08-12 10:19:15 +00:00
Robert Osfield
9975e15a97 Update ChangeLog
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15108 16af8721-9629-0410-8352-f15c8da7e697
2015-08-12 10:06:58 +00:00
Robert Osfield
5b242d22ff Change RC number to 0 for 3.4.0 stable release.
Updated ChangeLog
Updated the release data in the README


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15099 16af8721-9629-0410-8352-f15c8da7e697
2015-08-12 06:38:59 +00:00
Robert Osfield
814a885a6c Updated ChangeLog and RC nubmer to 13, and added GL1 to the docs on the GL_PROFILE usage
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15098 16af8721-9629-0410-8352-f15c8da7e697
2015-08-11 20:12:02 +00:00
Robert Osfield
471b256d30 Refactored workaround of NVidia nan length bug.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15097 16af8721-9629-0410-8352-f15c8da7e697
2015-08-11 20:08:07 +00:00
Robert Osfield
8f73ddc27d Moved the FIND_PACKAGE(Boost) from the root CMakeLists.txt into the local Find scripts to avoid Boost check when not neccessary.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15094 16af8721-9629-0410-8352-f15c8da7e697
2015-08-11 08:44:46 +00:00
Robert Osfield
0874f126c0 Updated ChangeLog
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15090 16af8721-9629-0410-8352-f15c8da7e697
2015-08-10 19:58:22 +00:00
Robert Osfield
697128a11d From svn/trunk merged support for passing the GL_VENDOR string into the #pragma(tic) shader compositions defines
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15089 16af8721-9629-0410-8352-f15c8da7e697
2015-08-10 19:56:53 +00:00
Robert Osfield
96d247aa7e Update RC number to 12, and updated ChangeLog
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15086 16af8721-9629-0410-8352-f15c8da7e697
2015-08-10 19:46:19 +00:00
Robert Osfield
c0ac503123 Fixed line endings
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15084 16af8721-9629-0410-8352-f15c8da7e697
2015-08-10 19:40:25 +00:00
Robert Osfield
b74924fab4 Updated built-in shaders from OpenSceneGraph-Data vesion that introduce #pragma(tic) shaders that resolve the NVidia loop iteration bug.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15082 16af8721-9629-0410-8352-f15c8da7e697
2015-08-10 19:39:18 +00:00
Robert Osfield
75217a2ed5 Quietened down #pragma(tic) shader composition messages
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15080 16af8721-9629-0410-8352-f15c8da7e697
2015-08-10 19:19:03 +00:00
Robert Osfield
2bed348da1 Build fix for VS and installing TYpes
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15076 16af8721-9629-0410-8352-f15c8da7e697
2015-08-10 05:04:39 +00:00
Robert Osfield
af8b11a391 Update ChangeLog and AUTHORS for rc11
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15074 16af8721-9629-0410-8352-f15c8da7e697
2015-08-09 10:20:51 +00:00
Robert Osfield
27f080159e Updated RC number to 11.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15073 16af8721-9629-0410-8352-f15c8da7e697
2015-08-09 10:16:48 +00:00
Robert Osfield
e8722e76ea Changed GLint64 and GLuint64 to use int64_t and uint64_t (pulled in via include/osg/Types) to avoid conflict with Qt5 definitions
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15072 16af8721-9629-0410-8352-f15c8da7e697
2015-08-09 10:16:03 +00:00
Robert Osfield
8b4ff0f50a Added #idef guards for SGIX usage
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15070 16af8721-9629-0410-8352-f15c8da7e697
2015-08-09 09:40:59 +00:00
Robert Osfield
559da06ffa From Glenn Waldron, fix error in ZIP plugin handling of memory buffer
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15068 16af8721-9629-0410-8352-f15c8da7e697
2015-08-08 08:49:53 +00:00
Robert Osfield
5c40e9bf81 Updated rc number and ChangeLog for 3.4.0-rc10
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15063 16af8721-9629-0410-8352-f15c8da7e697
2015-08-06 15:10:55 +00:00
Robert Osfield
1186143571 Merged workaround for NVidia driver/GPU bug by updating shaders from svn/trunk that change float to int usage.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15062 16af8721-9629-0410-8352-f15c8da7e697
2015-08-06 15:04:36 +00:00
Robert Osfield
732364d49b Added checks for the validity of chached coordinate arrays.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15061 16af8721-9629-0410-8352-f15c8da7e697
2015-08-06 15:03:50 +00:00
Robert Osfield
0153c3e7e2 Updated rc number to 9, and updated ChangeLog and AUTHORS.txt
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15043 16af8721-9629-0410-8352-f15c8da7e697
2015-08-03 19:38:37 +00:00
Robert Osfield
5e8d5b50db From Andy Skinner, "Someone was using our code on a system that does not seem to have the SGIX symbols used in osgViewer.cpp.
I used osgSetGLExtensionsFuncPtr to remove the symbols.  I don't know how to test this path, but it did remove the symbols from libosgViewer.so.  I have also not been able yet to see if that was sufficient for our customer.

 

I did this by looking at other cases, and I tried to follow some of the same practices in PixelBufferX11, like using _useSGIX in a similar way to the previous _useGLX1_3."




git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15042 16af8721-9629-0410-8352-f15c8da7e697
2015-08-03 19:14:11 +00:00
Robert Osfield
e9b75e0ded Update ChangeLog and AUTHORS
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15039 16af8721-9629-0410-8352-f15c8da7e697
2015-07-31 15:12:10 +00:00
Robert Osfield
803677e03c Updated rc number to 8 for 3.4.9-rc8
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15038 16af8721-9629-0410-8352-f15c8da7e697
2015-07-31 15:01:34 +00:00
Robert Osfield
0f97a42e17 From Terry Welsh, "I downloaded the Android 3rdparty deps from here
http://www.openscenegraph.org/index.php/download-section/dependencies
but was not able to use them for a while. Attached are changes to
OsgAndroidMacroUtils.cmake that allow the deps to be found by cmake.

Specifically, all FIND_PATH commands require the
NO_CMAKE_FIND_ROOT_PATH option to actually find paths. This is odd
because if you inspect CMAKE_FIND_ROOT_PATH it appears to be empty. I
would expect it to have no effect at all.

I also needed to remove quotes from this line in order for headers to be found:

set(FREETYPE_INCLUDE_DIRS "${FREETYPE_DIR}/include
${FREETYPE_DIR}/include/freetype/config")

Assuming this script worked in the past, it seems like cmake behavior
may have changed at some point. I'm using cmake version 2.8.12.2."


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15037 16af8721-9629-0410-8352-f15c8da7e697
2015-07-31 13:47:03 +00:00
Robert Osfield
91fd245d7c From Jannik Heller, "Here is a patch for the S3TC capability check.
On a Intel HD graphics Linux system with Mesa 10.1.3, I found that osg's Extensions::isTextureCompressionS3TCSupported() returned false, even though S3TC compressed textures *are* in fact working. I tested this by loading and rendering various DXT1, DXT3 and DXT5 compressed textures in the OSG.

"glxinfo | grep s3tc" gives:
    GL_S3_s3tc

Note, if I install the package "libtxc-dxtn-s2tc0", I get in addition:

glxinfo | grep s3tc
    GL_EXT_texture_compression_s3tc
    GL_S3_s3tc

However, S3TC compressed textures worked correctly within the OSG even without libtxc-dxtn-s2tc0 installed.

I'm not sure what the differences between these extensions are, but based on the description at https://www.opengl.org/registry/specs/S3/s3tc.txt I would assume that both will work for OSG's purposes. The attached patch changes isTextureCompressionS3TCSupported() to accept either extension."



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15034 16af8721-9629-0410-8352-f15c8da7e697
2015-07-31 13:44:36 +00:00
Robert Osfield
eb90d9aa34 Warning fix
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15033 16af8721-9629-0410-8352-f15c8da7e697
2015-07-31 10:59:23 +00:00
Robert Osfield
8e9f688809 From Kristofer Tingdahl, warning fixes.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15031 16af8721-9629-0410-8352-f15c8da7e697
2015-07-31 10:54:17 +00:00
Robert Osfield
6c1c179c62 Compile fix for Mingw.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15028 16af8721-9629-0410-8352-f15c8da7e697
2015-07-31 10:27:08 +00:00
Robert Osfield
cfe3e621ad Update version and rc number of 3.4.0-rc7.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15026 16af8721-9629-0410-8352-f15c8da7e697
2015-07-23 21:32:17 +00:00
Robert Osfield
761cf52bb7 Added explicit initialization of osg::Referenced(true) to osg::Operation subclasses as it uses virtual inhertiance from osg::Referenced.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15024 16af8721-9629-0410-8352-f15c8da7e697
2015-07-23 15:46:39 +00:00
Robert Osfield
42efcf24fb From Pjotr Svetachov, buid fixes for VS2015.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15022 16af8721-9629-0410-8352-f15c8da7e697
2015-07-23 14:37:24 +00:00
Robert Osfield
0a56f65077 Fixed indentation
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15019 16af8721-9629-0410-8352-f15c8da7e697
2015-07-23 14:30:39 +00:00
Robert Osfield
3339395071 git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15018 16af8721-9629-0410-8352-f15c8da7e697 2015-07-23 14:03:15 +00:00
Robert Osfield
34e53a37e0 Warning fixes for Clang-3.6
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15017 16af8721-9629-0410-8352-f15c8da7e697
2015-07-23 11:14:00 +00:00
Robert Osfield
482fd41d58 Added missing handling of lightnumber and associate lights
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15014 16af8721-9629-0410-8352-f15c8da7e697
2015-07-23 09:23:32 +00:00
Robert Osfield
2eef9d233b Changed the GL_HEADER_HAS_GLINT64 and GL_HEADER_HAS_GLUINT64 to use cmakedefine to improve handling of when cmake doesn't find GLint64 and GLuint64.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15012 16af8721-9629-0410-8352-f15c8da7e697
2015-07-23 07:39:01 +00:00
Robert Osfield
4a886c6e22 Fixed Contributors list
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15008 16af8721-9629-0410-8352-f15c8da7e697
2015-07-22 14:55:26 +00:00
Robert Osfield
717d566713 Updated ChangeLog
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15006 16af8721-9629-0410-8352-f15c8da7e697
2015-07-22 14:51:58 +00:00
Robert Osfield
1d0a265cd4 Update rc to 6.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15005 16af8721-9629-0410-8352-f15c8da7e697
2015-07-22 14:41:55 +00:00
Robert Osfield
3d69d46e3e Moved from svn/trunk, moved GL_ALPHA_TEST from AlphaFunc to GLDefines
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15004 16af8721-9629-0410-8352-f15c8da7e697
2015-07-22 14:30:01 +00:00
Robert Osfield
8e20224828 From svn/trunk merged automatic detection of GLint64 + GLuint64 in GL headers
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@15003 16af8721-9629-0410-8352-f15c8da7e697
2015-07-22 14:27:36 +00:00
Robert Osfield
6e65a9955e Added check for validity of OpenFlight shininess value.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@14999 16af8721-9629-0410-8352-f15c8da7e697
2015-07-21 14:22:01 +00:00
Robert Osfield
2264c3b7e2 Fixed typo
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@14996 16af8721-9629-0410-8352-f15c8da7e697
2015-07-21 13:42:22 +00:00
Robert Osfield
8c991c056f Reduced debug message verbosity.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@14994 16af8721-9629-0410-8352-f15c8da7e697
2015-07-20 13:23:50 +00:00
Robert Osfield
34ab8bc048 Updated RC to 5 for 3.4.0-rc5 release
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@14991 16af8721-9629-0410-8352-f15c8da7e697
2015-07-20 07:53:18 +00:00
Robert Osfield
d73e979ea8 Updated ChangeLog for rc
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@14990 16af8721-9629-0410-8352-f15c8da7e697
2015-07-20 07:46:58 +00:00
Robert Osfield
6273495c64 Changed the _MSC_VER check to <= 1700 to support VS2012.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@14988 16af8721-9629-0410-8352-f15c8da7e697
2015-07-20 07:42:00 +00:00
Robert Osfield
8f26396e78 Reinstated the TIFFSetField(image, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@14986 16af8721-9629-0410-8352-f15c8da7e697
2015-07-19 09:51:17 +00:00
Robert Osfield
78bf1e8ea4 From KOS, "I've mentioned in the "osg-users" ML about build error with the newest GStreamer 1.5
Please, have a look at the attached patch."

CMakeModules/FindGStreamer.cmake


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@14983 16af8721-9629-0410-8352-f15c8da7e697
2015-07-17 18:31:19 +00:00
Robert Osfield
83a03f3346 Updated release candidate number
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@14980 16af8721-9629-0410-8352-f15c8da7e697
2015-07-17 09:16:06 +00:00
Robert Osfield
4626f6fb6a Updated ChangeLog and AUTHORS
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@14978 16af8721-9629-0410-8352-f15c8da7e697
2015-07-17 09:06:03 +00:00
Robert Osfield
9e581f91db Added cmake version checked for cmake_policy setting
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@14974 16af8721-9629-0410-8352-f15c8da7e697
2015-07-17 08:21:28 +00:00
Robert Osfield
887768b55a 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.4@14970 16af8721-9629-0410-8352-f15c8da7e697
2015-07-17 08:12:51 +00:00
Robert Osfield
5b1cfd26ab 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.4@14966 16af8721-9629-0410-8352-f15c8da7e697
2015-07-16 19:16:54 +00:00
Robert Osfield
f48a4baa4e From Cory Slep and Robert Osfield, "When using Open Scene Graph and Qt on Android, the resulting thread that an application developer’s Q*Application is run on is different than what Qt considers the “main” thread, which can cause subtle problems. This is because Qt loads native libraries in one thread, and later runs the application in a different thread. They delay running in the second thread as long as possible as they have a nontrivial bootstrapping process. The motivation for Qt having this second thread is to allow them to remain responsive to both Java and native events, and capture events that would otherwise be “missed”
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@14964 16af8721-9629-0410-8352-f15c8da7e697
2015-07-16 15:56:40 +00:00
Robert Osfield
49c802153d Added check to catch cases where the backdrop coordinate cache is too small for the number of contexts being computed.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@14962 16af8721-9629-0410-8352-f15c8da7e697
2015-07-16 11:01:50 +00:00
Robert Osfield
13e79d3210 Added initializers and reverted OSX workaround from 2013.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@14960 16af8721-9629-0410-8352-f15c8da7e697
2015-07-15 10:02:31 +00:00
Robert Osfield
236617b6c5 Fixed source of 3.4.0-rc tags to branches so that release candidates are made from the correct 3.4 branch.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@14957 16af8721-9629-0410-8352-f15c8da7e697
2015-07-14 16:55:27 +00:00
Robert Osfield
a0229ee684 Updated ChangeLog and Release Candidate number of 3.4-rc2
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@14955 16af8721-9629-0410-8352-f15c8da7e697
2015-07-14 16:37:31 +00:00
Robert Osfield
5ebfa0a71e Moved the cmake_policy(SET CMP0043 NEW) to work for all script paths that Qt5 usage could pass through.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@14954 16af8721-9629-0410-8352-f15c8da7e697
2015-07-14 13:33:17 +00:00
Robert Osfield
5acad4e07e Added cmake_policy(SET CMP0043 NEW) usage when compiling against Qt5 as it was causing a warning we couldn't fix on the OSG side otherwise.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@14951 16af8721-9629-0410-8352-f15c8da7e697
2015-07-14 13:26:34 +00:00
Robert Osfield
ccae59e98a Added _defineList into the osg::StateSet::compare() implementation to address issues with osgUtil::Optimizer ignoring defines.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@14949 16af8721-9629-0410-8352-f15c8da7e697
2015-07-14 08:25:20 +00:00
Robert Osfield
222871aade Added Text::GlyphQuads::release/resizeGLObjects() and handling of inconsistent contextID sizes to avoid crashes when viewers and scene graphs aren't initialized correctly to the right number of contexts.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@14946 16af8721-9629-0410-8352-f15c8da7e697
2015-07-13 16:09:40 +00:00
Robert Osfield
d221133728 Standardize the call to setUpThreading() in CompositeViewer/Viewer::realize().
Standardize the call to scene->resizeGLObjects().


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@14945 16af8721-9629-0410-8352-f15c8da7e697
2015-07-13 16:04:38 +00:00
Robert Osfield
2eff96d1a4 From Terry Welsh, "fThis fixes problem where new glClipControl feature would not compile for GLES2 profile"
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@14942 16af8721-9629-0410-8352-f15c8da7e697
2015-07-13 08:48:41 +00:00
Robert Osfield
0394ba5453 Updated ChangeLog and AUTHORS for 3.4-rc1
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@14939 16af8721-9629-0410-8352-f15c8da7e697
2015-07-03 06:50:25 +00:00
Robert Osfield
1db8a4e818 Branch OpenSceneGraph-3.4
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.4@14938 16af8721-9629-0410-8352-f15c8da7e697
2015-07-03 06:30:28 +00:00
Robert Osfield
a39578826c Updated for 3.4 branch.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14937 16af8721-9629-0410-8352-f15c8da7e697
2015-07-03 06:28:05 +00:00
Robert Osfield
98ebacdcbb Fixed repeated name in SETUP_PLUGIN.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14936 16af8721-9629-0410-8352-f15c8da7e697
2015-07-02 11:58:49 +00:00
Robert Osfield
04f4b542bd Updated ChangeLog and AUTHORS file in prep for 3.4 branch.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14935 16af8721-9629-0410-8352-f15c8da7e697
2015-07-02 10:25:14 +00:00
Robert Osfield
f0ac1a16f9 Build fix
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14934 16af8721-9629-0410-8352-f15c8da7e697
2015-07-02 08:57:08 +00:00
Robert Osfield
08893c7fcc Moved the defination of GL_MAX_VARYING_COMPONENTS to GL_3_0 block to avoid warnings of redefinition.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14933 16af8721-9629-0410-8352-f15c8da7e697
2015-07-02 08:52:55 +00:00
Robert Osfield
17dfbe99fc Updated ChangeLog
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14931 16af8721-9629-0410-8352-f15c8da7e697
2015-07-01 05:32:40 +00:00
Robert Osfield
74ddaeaf50 From Mathias Froehlich, added seriliazers for new osg::ClipControl
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14930 16af8721-9629-0410-8352-f15c8da7e697
2015-07-01 05:10:20 +00:00
Robert Osfield
2f7193ee4c Updated ChangeLog and AUTHORS files
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14929 16af8721-9629-0410-8352-f15c8da7e697
2015-06-30 09:51:05 +00:00
Robert Osfield
b4cd40cf7c From Mathias Froehlich, "Attached a new state attribute implementing the glClipControl that appeared with GL4.5."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14928 16af8721-9629-0410-8352-f15c8da7e697
2015-06-30 09:11:00 +00:00
Robert Osfield
5cd478e4bb Quitened down debug for ViewConfig argument parsing
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14927 16af8721-9629-0410-8352-f15c8da7e697
2015-06-30 08:39:33 +00:00
Robert Osfield
d3baf9d311 Build fix for GLDAL>=2
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14925 16af8721-9629-0410-8352-f15c8da7e697
2015-06-30 08:38:01 +00:00
Robert Osfield
fe09ebfbdb From Christian Kehl, added Vec2::set(const Vec2) method
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14924 16af8721-9629-0410-8352-f15c8da7e697
2015-06-26 09:40:37 +00:00
Robert Osfield
b5a3a58076 From Jannik Heller, fixed clearReferencesToDependentCameras() calls
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14922 16af8721-9629-0410-8352-f15c8da7e697
2015-06-19 09:51:30 +00:00
Robert Osfield
3bcfad833c Fixed handling of use GLObjectsVisitor for modifying scene graph state without compiling to OpenGL so that the visitor can be run safely without a graphics context being current.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14921 16af8721-9629-0410-8352-f15c8da7e697
2015-06-17 16:25:47 +00:00
Robert Osfield
6f00eb2548 Small tidy up to make script more readable.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14920 16af8721-9629-0410-8352-f15c8da7e697
2015-06-16 17:18:11 +00:00
Robert Osfield
4ec0e76c0b Added QT_QTCORE_INCLUDE_DIR entry to qfont plugin build to fix Qt4 build under Linux
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14919 16af8721-9629-0410-8352-f15c8da7e697
2015-06-16 17:17:50 +00:00
Robert Osfield
1e0d682979 From Jannik Heller, "I've added the check for Qt version mismatches into osgQt as suggested in http://forum.openscenegraph.org/viewtopic.php?t=14999.
When an application is built with Qt4, but osgQt was built with Qt5 (or vice versa), upon #includeing osgQt users will receive an #error aborting the build.

This at least provides a proper error message rather than a crash, while we are working on better fixes for the problem."


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14918 16af8721-9629-0410-8352-f15c8da7e697
2015-06-15 19:59:01 +00:00
Robert Osfield
824cc95518 Experiment with how to define GLsizeiptr.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14917 16af8721-9629-0410-8352-f15c8da7e697
2015-06-15 13:51:29 +00:00
Robert Osfield
08d2d322d9 Upated version number
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14916 16af8721-9629-0410-8352-f15c8da7e697
2015-06-15 13:51:09 +00:00
Robert Osfield
75891924bb Removed old and unused windows code path to avoid confusion
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14915 16af8721-9629-0410-8352-f15c8da7e697
2015-06-12 20:23:15 +00:00
Robert Osfield
82c188c24a Updated ChangeLog
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14913 16af8721-9629-0410-8352-f15c8da7e697
2015-06-12 11:28:54 +00:00
Robert Osfield
1e78098967 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/trunk@14912 16af8721-9629-0410-8352-f15c8da7e697
2015-06-12 08:04:42 +00:00
Robert Osfield
fc9848ff19 Reverted the typdef GLfloat GLdouble for Andoid as this was causing conflicts.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14910 16af8721-9629-0410-8352-f15c8da7e697
2015-06-11 08:44:26 +00:00
Robert Osfield
8aee04c780 Updated ChangeLog and AUTHORS file for 3.3.8 dev release
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14909 16af8721-9629-0410-8352-f15c8da7e697
2015-06-10 18:22:09 +00:00
Robert Osfield
e69405f99a From Laurens Voerman, "attached is a zip with the files:
OpenSceneGraph\CMakeModules\FindOpenEXR.cmake

I introduced a bug in the previous submission pointed out by Dmitry Marakasov:
looking for IlmIlf instead of IlmImf (as the previous version did - but using variable OPENEXR_IlmIlf_LIBRARY)

For some reason google decided his message was spam, so I just noticed it, and I reply to confirm his remarks and attach a full file.

"


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14908 16af8721-9629-0410-8352-f15c8da7e697
2015-06-10 16:48:28 +00:00
Robert Osfield
e76c91ed78 From Colin McDonald, "An earlier fix in OSG 3.2 has been inadvertently lost in 3.3.x. The glGenerateMipMap function is part of the GL_EXT_framebuffer_object extension. Just checking if the function is present before using it for texture mipmaps is not sufficient, as on remote X-windows displays the client side capability may be different from the display server. This can lead to mipmapped textures failing to render. I've restored a fbo extension check. I've also tided up the GL version checking a little."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14907 16af8721-9629-0410-8352-f15c8da7e697
2015-06-10 16:47:15 +00:00
Robert Osfield
d2e0081690 From 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/trunk@14905 16af8721-9629-0410-8352-f15c8da7e697
2015-06-10 10:00:27 +00:00
Robert Osfield
11a55ea6de Added supoort for osg::CullSettings/Camera::InheritanceMaskActionOnAttributeSetting and InheritanceMask properties.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14904 16af8721-9629-0410-8352-f15c8da7e697
2015-06-09 16:49:20 +00:00
Robert Osfield
bd9bd3f8b2 Added namespace around typedef to avoid conflict issues
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14903 16af8721-9629-0410-8352-f15c8da7e697
2015-06-09 12:51:38 +00:00
Robert Osfield
7e05d2fd54 Introduce osg::Object::asNode(), asNodeVisitor(), asStateAttribute() and asUniform() to replace dynamic_cast<> usage in Callback.cpp.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14902 16af8721-9629-0410-8352-f15c8da7e697
2015-06-09 10:49:34 +00:00
Robert Osfield
37d051af5e Added output of HUD scene graph to hud.osgt and hud.osgb for testing purposes.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14901 16af8721-9629-0410-8352-f15c8da7e697
2015-06-09 09:44:37 +00:00
Robert Osfield
03565e3bbe Updated AUTHORS and ChangeLog for dev release
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14900 16af8721-9629-0410-8352-f15c8da7e697
2015-06-08 11:33:49 +00:00
Robert Osfield
4073910ce8 From Mike Connell, "Give ReadFileCallback access to parent location : These small changes to the database pager allow user code in the ReadFileCallback to safely determine where the file being loaded is destined to be inserted into the scenegraph.
"


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14899 16af8721-9629-0410-8352-f15c8da7e697
2015-06-08 11:18:24 +00:00
Robert Osfield
ceabbdb8d9 Addressed race condition where SceneView::setLightingMode() was setting a shread Master Camera's StateSet.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14898 16af8721-9629-0410-8352-f15c8da7e697
2015-06-08 10:20:53 +00:00
Robert Osfield
f7f1487fca 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/trunk@14896 16af8721-9629-0410-8352-f15c8da7e697
2015-06-07 11:13:02 +00:00
Robert Osfield
1f0ba7aa4f Updated AUTHORS for dev release
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14895 16af8721-9629-0410-8352-f15c8da7e697
2015-06-04 09:35:19 +00:00
Robert Osfield
32b60cd2d7 From Jannik Heller, Transform::computeBound() optimization.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14894 16af8721-9629-0410-8352-f15c8da7e697
2015-06-04 09:13:05 +00:00
Robert Osfield
ff42ff2a11 From Jannik Heller, Removed unused StatsHandler::_keyEventToggleVsync
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14893 16af8721-9629-0410-8352-f15c8da7e697
2015-06-04 09:05:24 +00:00
Robert Osfield
23cd6d2ba3 From Jannik Heller, "In the attachment you will find a build fix for the latest trunk. osgAnimation failed to compile when using OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION=OFF ."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14892 16af8721-9629-0410-8352-f15c8da7e697
2015-06-04 09:00:17 +00:00
Robert Osfield
95f911e98c Removed export that was breaking windows build
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14891 16af8721-9629-0410-8352-f15c8da7e697
2015-06-03 10:28:34 +00:00
Robert Osfield
fd46645ade From KOS, "New classes for osgAnimation presented: UpdateFloatUniform, UpdateVec3fUniform and UpdateMatrixfUniform (based on UpdateUniform template)
Classes operate like osgAnimation::UpdateMaterial for Material's diffuse component, but change Uniform."


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14890 16af8721-9629-0410-8352-f15c8da7e697
2015-06-03 09:14:35 +00:00
Robert Osfield
fd806293be From KOS, build fix for osg::Uniform::Callback to osg::UniformCallback change
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14889 16af8721-9629-0410-8352-f15c8da7e697
2015-06-03 09:07:41 +00:00
Robert Osfield
9222506a2c Added doxygen comment for typedef
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14888 16af8721-9629-0410-8352-f15c8da7e697
2015-06-03 09:06:44 +00:00
Robert Osfield
e7244e654a Build fix for when Uniform::Callback isn't defined
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14887 16af8721-9629-0410-8352-f15c8da7e697
2015-06-03 08:38:18 +00:00
Robert Osfield
da73723949 From Konstantin Matveyev, serializer support for UniformCallback
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14886 16af8721-9629-0410-8352-f15c8da7e697
2015-06-02 10:25:13 +00:00
Robert Osfield
e3f0876e87 From Konstantin Matveyev, "I've changed osg::Uniform::Callback to osg::UniformCallback.
osg::UniformCallback inherits osg::Callback now.

I don't really now if this class should be inside osgWrappers/serializers
because StateAttributeCallback is not presented there, but i've included it in the patch.


Please see archive in the attachment.


PS
DEEP_COPY_UNIFORMS works for me.
"
Note from Robert Osfield, added typedef UniformCallback Callback for backwards compatibility.



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14885 16af8721-9629-0410-8352-f15c8da7e697
2015-06-02 09:33:22 +00:00
Robert Osfield
80791c6972 Changed name of UniformCallback to UniformBufferCallback to avoid conflict with changes to come to the osg::Uniform::Callback -> osg::UniformCallback.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14884 16af8721-9629-0410-8352-f15c8da7e697
2015-06-02 09:18:19 +00:00
Robert Osfield
ba9dfb2ff6 From Albert Luaces, typo fixes.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14883 16af8721-9629-0410-8352-f15c8da7e697
2015-06-01 13:40:20 +00:00
Robert Osfield
d14a602a59 From Jannik Heller, typo fixes
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14882 16af8721-9629-0410-8352-f15c8da7e697
2015-06-01 13:11:49 +00:00
Robert Osfield
e0028bef6e From Jannik Heller, "This patch adds a missing initialization of osgParticle::ParticleProcessor::_frameNumber in the copy constructor.
I noticed this because valgrind was complaining about use of uninitialized memory."


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14881 16af8721-9629-0410-8352-f15c8da7e697
2015-06-01 12:14:53 +00:00
Robert Osfield
120bf699b2 From Frashud Lashkari, "I was getting "Unsupported wrapper class..." error messages when attempting to load osgb models simultaneously from multiple threads. I believe the problem is caused by un-synchronized access to the global osgDB::ObjectWrapperManager class. I've attached a change that adds a mutex to the class and uses it when accessing the internal wrapper/compress maps. This appears to fix the issues I was having."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14880 16af8721-9629-0410-8352-f15c8da7e697
2015-06-01 12:07:04 +00:00
Robert Osfield
78a01ce2a5 From Jannik Heller, "I have added new functions Texture::generateAndAssignTextureObject mirroring the Texture::generateTextureObject functions.
I have left the Texture::generateTextureObject functions intact as I'm not sure if/how it's used outside the core OSG. If you feel that compatibility isn't important in that area feel free to drop it.

While testing the build with OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION=OFF I found a compile error in GlyphGeometry.cpp that was entirely unrelated to the changes I've made. The fix is included in the patch.

There is one thing left to fix and that is Texture2D::SubloadCallback:

        class OSG_EXPORT SubloadCallback : public Referenced
        {
            public:
                ....
                virtual TextureObject* generateTextureObject(const Texture2D& texture, State& state) const
                {
                    return osg::Texture::generateTextureObject(&texture, state.getContextID(), GL_TEXTURE_2D);
                }
                ...
         }"
         


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14879 16af8721-9629-0410-8352-f15c8da7e697
2015-06-01 10:50:44 +00:00
Robert Osfield
44c406e167 From Jannik Heller, build fix
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14878 16af8721-9629-0410-8352-f15c8da7e697
2015-06-01 10:41:43 +00:00
Robert Osfield
f72b62a065 From Jannik Heller, fix for race condition in orphanded BufferObject handling.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14877 16af8721-9629-0410-8352-f15c8da7e697
2015-05-29 07:52:27 +00:00
Robert Osfield
4f423ff66b From Colin McDonald, "rc/osgUtl/MeshOptimizers.cpp won't compile on some systems due to a missing std:: namespace prefix."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14876 16af8721-9629-0410-8352-f15c8da7e697
2015-05-26 17:24:48 +00:00
Robert Osfield
906bb27fa0 From Farshid Lashkari, "attached a small change to osgUtil::SceneView that prevents unnecessary calls to glClear when the split stereo separation is 0."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14875 16af8721-9629-0410-8352-f15c8da7e697
2015-05-26 17:22:05 +00:00
Robert Osfield
0f35f31d72 From Thomas Hogarth, "Little fix for ClassInterface::getSupportedProperties, before if you set searchAssociates to false then it would return the same BaseSerialiser::Type for every entry in the PropertyMap as i was not being incremented on line 539. Fix attached."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14874 16af8721-9629-0410-8352-f15c8da7e697
2015-05-26 17:17:26 +00:00
Robert Osfield
ddda9a6a0d From We See, "I found a small bug in osgUtil::RenderStage::draw() (osg 3.3.7), which crashes osg. The problem was caused by an access to the object _camera without checking whether the object is valid. So I changed the line:
Code:
if (_cameraRequiresSetUp || (_cameraAttachmentMapModifiedCount!=_camera->getAttachmentMapModifiedCount()))

to

Code:
if (_cameraRequiresSetUp || (_camera.valid() && _cameraAttachmentMapModifiedCount!=_camera->getAttachmentMapModifiedCount()))
"


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14873 16af8721-9629-0410-8352-f15c8da7e697
2015-05-26 17:12:05 +00:00
Robert Osfield
01e87939a4 From Farshid Lashkari and Robert Osfield, "a small change to the CullVisitor class, which will use cloneType() on the root render stage when creating children render stages. This allows us to pass a custom RenderStage object to the SceneView and have it used for all sub-stages."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14872 16af8721-9629-0410-8352-f15c8da7e697
2015-05-26 17:09:25 +00:00
Robert Osfield
820166b49d Rewrote the Text3D bevel implementation to automatically adjust bevel thickness to avoid overalapping and erronous tesselation.
Added osgText::Bevel::s/getRoundedConcaveJunctions(bool) to control how the bevel should be tessellated around concave junctions on the glyph boundary.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14871 16af8721-9629-0410-8352-f15c8da7e697
2015-05-26 10:05:47 +00:00
Robert Osfield
05841d7c00 Added use of ref_ptr<>
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14870 16af8721-9629-0410-8352-f15c8da7e697
2015-05-26 08:48:33 +00:00
Robert Osfield
95a507299b Changed the EventQueue::frame() event generation to use the generatePointerData/reprojectPointerData() methods in the same way that other events are handled.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14869 16af8721-9629-0410-8352-f15c8da7e697
2015-05-25 12:39:18 +00:00
Robert Osfield
d5b615a4e1 Added osgGA::GUIEventAdapter* returns from various EventQueue event generation methods.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14868 16af8721-9629-0410-8352-f15c8da7e697
2015-05-25 11:33:04 +00:00
Robert Osfield
2e11113072 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/trunk@14866 16af8721-9629-0410-8352-f15c8da7e697
2015-05-21 14:11:32 +00:00
Robert Osfield
180ce288c3 Update ChangeLog and AUTHORS file
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14865 16af8721-9629-0410-8352-f15c8da7e697
2015-05-06 18:39:44 +00:00
Robert Osfield
89fd422c98 Changed the CMP0020 check to > 2.8.10
Updated SO version number


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14864 16af8721-9629-0410-8352-f15c8da7e697
2015-05-05 11:05:09 +00:00
Robert Osfield
5380aebfc1 From Christian Kehl, changes for making osgAndroid working with GLES1 enabled
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14862 16af8721-9629-0410-8352-f15c8da7e697
2015-04-30 14:04:51 +00:00
Robert Osfield
eb5791e5e2 From Dmitriy Ogalcev, fix for crash when calling setCursor from a non GUI thread
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14861 16af8721-9629-0410-8352-f15c8da7e697
2015-04-30 13:59:24 +00:00
Robert Osfield
8962838e6a Replaced attempt at passing NULL Matrix with two specialized methods.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14860 16af8721-9629-0410-8352-f15c8da7e697
2015-04-28 16:12:57 +00:00
Robert Osfield
e52b95e084 Renamed LineSegment::intersect(BoundingSphere/Box, double/float&, double/float&) methods to LineSegment::intersectAndComputeRations(..) to avoid confusion with the change in convention for
the old intersect(BoundingBox&, float/double&, float/double&) method as it was inconsitent with the rest of the OSG including the intersect(BoundingSphere) method in how the ratio for the
second intersection was measure from - original from the end point, but now made consistent with other places in the OSG so be based on ration from start to end of segment.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14859 16af8721-9629-0410-8352-f15c8da7e697
2015-04-27 19:31:13 +00:00
Robert Osfield
5be2e05b18 Refactoring GlyphGeometry Boundary class to facilate better bevel overlap detection
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14858 16af8721-9629-0410-8352-f15c8da7e697
2015-04-23 14:44:06 +00:00
Robert Osfield
f66b430476 Comment out debug notification
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14857 16af8721-9629-0410-8352-f15c8da7e697
2015-04-23 12:58:27 +00:00
Robert Osfield
7d66324e5d Removed unused method
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14856 16af8721-9629-0410-8352-f15c8da7e697
2015-04-23 09:49:16 +00:00
Robert Osfield
2b1abf1937 From Giampaolo Vigano, "please find attached a further fix for 3ds plugin: now reflection map works also with transparent objects (I also removed a redundant setting of BlendFunc)."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14855 16af8721-9629-0410-8352-f15c8da7e697
2015-04-22 14:25:34 +00:00
Robert Osfield
5237185e8c From Chris Denham, "I found a couple of memory leaks in 3DS reader plugin and I have attached corrected files. I have attached an example 3DS file I used to test the leaks/fixes using osgviewer for trunk at rev [14853] and the tagged version 3.2.1.
The first leak is in the lib3ds module (yeah, I know that probably should be corrected at http://code.google.com/p/lib3ds/ but I'm assuming that as no commits have happened there since 2011 that it may be better to fix the copy we have in the OSG of that project) The leak is caused by lib3d's use of realloc(ptr, 0) to free up memory allocations, but realloc, when ptr==NULL returns malloc(0) rather than NULL and thus leaks a zero byte allocation. The solution here was to adjust the 'lib3ds_util_reserve_array' function so that it realloc is not used to release a NULL pointer.

The second leak is in ReaderWriter3DS.cpp and arises when any of the created StateSet objects added to the StateSetMap don't subsequently get applied to a Node. The solution here was just to simply use the osg::ref_ptr around the raw StateSet pointer that was used in the locally defined StateSetInfo struct."



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14854 16af8721-9629-0410-8352-f15c8da7e697
2015-04-21 17:29:15 +00:00
Robert Osfield
6a4a21afe3 Updated AUTHORS
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14851 16af8721-9629-0410-8352-f15c8da7e697
2015-04-20 10:41:45 +00:00
Robert Osfield
e08fd168f6 Build fix
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14850 16af8721-9629-0410-8352-f15c8da7e697
2015-04-20 10:36:42 +00:00
Robert Osfield
54b389a18a Build fix
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14849 16af8721-9629-0410-8352-f15c8da7e697
2015-04-20 10:19:04 +00:00
Robert Osfield
1020e22c33 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/trunk@14848 16af8721-9629-0410-8352-f15c8da7e697
2015-04-20 09:39:00 +00:00
Robert Osfield
14ef282297 From Tim Moore, "The order_by_primitive_mode comparer was not providing a strict weak
ordering, which was causing a crash in the sort() call in
VertexAccessOrderVisitor::optimizeOrder (gcc 4.9, Fedora 21)."



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14846 16af8721-9629-0410-8352-f15c8da7e697
2015-04-20 09:08:56 +00:00
Robert Osfield
ed7629351f Updated dev release number
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14845 16af8721-9629-0410-8352-f15c8da7e697
2015-04-17 14:36:05 +00:00
Robert Osfield
f4196dfe64 Added implementations for the libraryName and className for the AntiSquish node.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14844 16af8721-9629-0410-8352-f15c8da7e697
2015-04-17 13:33:08 +00:00
Robert Osfield
3bc1102f11 Fixed CollectParentPaths visitor so that it sets the setNodeMaskOverride(0xffffffff) to make sure all parents are traversed to find parents, even ones that have their NodeMask set to 0x0.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14843 16af8721-9629-0410-8352-f15c8da7e697
2015-04-17 13:24:44 +00:00
Robert Osfield
a583b306c5 Added --test-NodeMask option to test crash when a parent of osgmanipulator::AntiSquish node has a NodeMask set to 0x0.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14842 16af8721-9629-0410-8352-f15c8da7e697
2015-04-17 13:22:07 +00:00
Robert Osfield
3a2380932f Changed MSVC version test to <= to enable fallback for VS2010.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14841 16af8721-9629-0410-8352-f15c8da7e697
2015-04-16 11:19:50 +00:00
Robert Osfield
c61c3d5500 Fixed crash when AntiSquish node is the root of the scene graph.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14840 16af8721-9629-0410-8352-f15c8da7e697
2015-04-16 10:07:23 +00:00
Robert Osfield
4a734b314c Updated ChangeLog
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14839 16af8721-9629-0410-8352-f15c8da7e697
2015-04-15 18:34:16 +00:00
Robert Osfield
bf0425f628 Updated version number of dev release
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14837 16af8721-9629-0410-8352-f15c8da7e697
2015-04-15 18:05:43 +00:00
Robert Osfield
eb893eba75 Added missing const to find VS2005 build
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14836 16af8721-9629-0410-8352-f15c8da7e697
2015-04-15 17:12:52 +00:00
Robert Osfield
1909de938a Added check for changes to window size during GraphicsWindowWin32::init() to fix bug that occurs when the window manage resizes the window automatically on creation.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14835 16af8721-9629-0410-8352-f15c8da7e697
2015-04-14 18:16:32 +00:00
Robert Osfield
3add98180c From Philippe Renon, MingW build fix
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14834 16af8721-9629-0410-8352-f15c8da7e697
2015-04-14 15:50:51 +00:00
Robert Osfield
87122ca369 Fixed typo of SEPARATE enums
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14833 16af8721-9629-0410-8352-f15c8da7e697
2015-04-13 11:48:28 +00:00
Robert Osfield
0a1db3d6fc From Jannik Heller, typo fixes
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14832 16af8721-9629-0410-8352-f15c8da7e697
2015-04-13 10:43:56 +00:00
Robert Osfield
166c49eedd From Konstantin Matveyev, "I've added GLES3 profile, which also enables GLES2 features (OSG_GLES3_AVAILABLE=true => OSG_GLES2_AVAILABLE=true).
If OSG_OPENGL_PROFILE="GLES3" =>
GraphicsWindowIOS will create gles3 context.
If failed, GraphicsWindowIOS will create gles2 context.
Multisampling also working.

"


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14831 16af8721-9629-0410-8352-f15c8da7e697
2015-04-13 10:11:32 +00:00
Robert Osfield
a711fdba36 From Laurens Voerman, I have modified the FindOpenEXR.cmake to find the debug libraries, and to define a variable
(OPENEXR_LIBRARIES_VARS) with the variable names that might have a _DEBUG version defined.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14830 16af8721-9629-0410-8352-f15c8da7e697
2015-04-13 09:50:27 +00:00
Robert Osfield
0335ea3760 Added passing of command line arguments to viewer construction to allow one to specify extra controls for the viewer such as window size etc.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14829 16af8721-9629-0410-8352-f15c8da7e697
2015-04-13 08:55:08 +00:00
Robert Osfield
16b19a0c30 Refactored AntiSquish::computeUnSquishedMatrix() method to use the parent node path of the AntiSquish node
to compute the required matrix rather than using the NodePath provided by the NodeVistor. This is required
as in osg::computeLocalToWorld() usage case the NodeVisitor pointer is NULL, so the correct matrix isn't possible to compute.



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14828 16af8721-9629-0410-8352-f15c8da7e697
2015-04-09 18:42:08 +00:00
Robert Osfield
595a048319 Added WindowSizeHandler to osgmanipulator example
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14827 16af8721-9629-0410-8352-f15c8da7e697
2015-04-09 18:38:53 +00:00
Robert Osfield
70b5297575 From Jannik Heller, typo fixes
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14826 16af8721-9629-0410-8352-f15c8da7e697
2015-04-07 18:01:12 +00:00
Robert Osfield
ab2fc1be76 From Giampaolo Viganò, "you can find in the attached ZIP archive a fix for 3ds plugin transparent/diffuse textures and opacity maps and the support for reflection map"
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14825 16af8721-9629-0410-8352-f15c8da7e697
2015-04-07 16:58:31 +00:00
Robert Osfield
abdb23e367 From Janik Heller, clean up of drawable/node usage
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14824 16af8721-9629-0410-8352-f15c8da7e697
2015-04-07 15:53:17 +00:00
Robert Osfield
31488eeba1 Removed unused ShapesToGeometriesVisitor.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14823 16af8721-9629-0410-8352-f15c8da7e697
2015-04-07 15:52:02 +00:00
Robert Osfield
6cff8650f2 Cleaned up handling of Drawables so it utilizes the Node inheritance properly.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14822 16af8721-9629-0410-8352-f15c8da7e697
2015-04-07 15:49:06 +00:00
Robert Osfield
814693ffc1 Build fix for VS2005.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14821 16af8721-9629-0410-8352-f15c8da7e697
2015-04-03 15:43:34 +00:00
Robert Osfield
4c84742664 Improved the doxygen comment for the new createImageWithOrientationConversion(..) function.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14820 16af8721-9629-0410-8352-f15c8da7e697
2015-04-03 13:34:13 +00:00
Robert Osfield
c753dbc3e6 Added automatic rotation of jpeg image based on EXIF rotation information provided in the header.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14819 16af8721-9629-0410-8352-f15c8da7e697
2015-04-03 13:29:31 +00:00
Robert Osfield
40a7f903ec Implemented an osg::createImageWithOrientationConversion(...) method to aid for changing orientation of images.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14818 16af8721-9629-0410-8352-f15c8da7e697
2015-04-03 13:19:32 +00:00
Robert Osfield
8fb08496ae Added reading of EXIF_Orientation tags when present in a jpeg file.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14817 16af8721-9629-0410-8352-f15c8da7e697
2015-04-02 16:11:22 +00:00
Robert Osfield
950d7bb60b From Wojciech Lewandowski, Windows build fixes, "These are the tweaks I had to make. JSON_Objects / json_stream headers attached. I am not sure how these will behave on VS 2010. Someone with VS 2010 should test it. Should be okay on VS 2008 and below + VS 2012 and above, though."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14816 16af8721-9629-0410-8352-f15c8da7e697
2015-04-02 10:12:22 +00:00
Robert Osfield
9aa8d641a0 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/trunk@14814 16af8721-9629-0410-8352-f15c8da7e697
2015-04-01 09:37:44 +00:00
Robert Osfield
de415fbcf9 Fixed crash when using a subload callback, where the _images array is empty by _images[0] was still being accessed.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14813 16af8721-9629-0410-8352-f15c8da7e697
2015-03-31 19:31:34 +00:00
Robert Osfield
5229280901 Added --subload command line option and test subload callback for testing purposes
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14812 16af8721-9629-0410-8352-f15c8da7e697
2015-03-31 19:29:02 +00:00
Robert Osfield
a7ba138dc7 Introduced osg::Camera::resize(..) method and associated enum thus:
enum ResizeMask
        {
            RESIZE_VIEWPORT=1,
            RESIZE_ATTACHMENTS=2,
            RESIZE_PROJECTIONMATRIX=4,
            RESIZE_DEFAULT=RESIZE_VIEWPORT|RESIZE_ATTACHMENTS
        };

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



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14811 16af8721-9629-0410-8352-f15c8da7e697
2015-03-31 16:23:43 +00:00
Robert Osfield
99f7bfab3b Introduced Camera::resizeAttachments(int width, int height) to resize all the Texture and Image assigned the the Camera attachments.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14810 16af8721-9629-0410-8352-f15c8da7e697
2015-03-31 15:08:13 +00:00
Robert Osfield
296c12a8e9 Refactor the RTT Camera resize code into a seperate Callback method in prep for this all being done by a single Camera API call.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14809 16af8721-9629-0410-8352-f15c8da7e697
2015-03-31 10:41:33 +00:00
Robert Osfield
307e70f13b Added Camera::dirtyAttachmentMap(), Camera::s/getAttachmentMapModified() value and usage of this in RenderStage as a new mechanism
for telling the rendering backend to update itself to reflect new values in the attachments such as new texture or image sizes.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14808 16af8721-9629-0410-8352-f15c8da7e697
2015-03-31 10:36:38 +00:00
Robert Osfield
06e6f368fc Added StatsHandler to osgtessellationshaders example to test out rendering bug associated with stats rendering.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14807 16af8721-9629-0410-8352-f15c8da7e697
2015-03-23 11:36:02 +00:00
Robert Osfield
890aea9537 Added event handle to alter the RTT Camera's dimensions to follow the windows resizes.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14806 16af8721-9629-0410-8352-f15c8da7e697
2015-03-20 17:58:34 +00:00
Robert Osfield
953828a817 Fixed resize dimensions of X11 window
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14805 16af8721-9629-0410-8352-f15c8da7e697
2015-03-20 15:49:12 +00:00
Robert Osfield
6854d2968f From Jannik Heller, "Fix for Qt4 multi-threaded crash. This patch adds the AA_X11InitThreads flag to the QApplication setup, meaning QT will call XInitThreads for us. This also bumps the required QT version to 4.8+, because the AA_X11InitThreads flag was introduced in that version. If that is not acceptable, we could add a QT_VERSION >= 0x040800 guard, or manually call XInitThreads() instead. Let me know what you think."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14804 16af8721-9629-0410-8352-f15c8da7e697
2015-03-20 11:48:21 +00:00
Robert Osfield
63a3595aab Added Texture wrap setting to CLAMP_TO_EDGE to fix rendering problem when running the default osgdistortion example
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14803 16af8721-9629-0410-8352-f15c8da7e697
2015-03-19 10:49:17 +00:00
Robert Osfield
d9f920ee37 Fixed VisualStudio warning
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14802 16af8721-9629-0410-8352-f15c8da7e697
2015-03-17 18:10:21 +00:00
Robert Osfield
31fd2456b6 From Konstantin Matveyev, "Added ComputeBoundingBoxCallback, ComputeBoundingSphereCallback and UpdateCallback implmenentations to serializers"
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14801 16af8721-9629-0410-8352-f15c8da7e697
2015-03-17 14:50:34 +00:00
Robert Osfield
bf86b031e0 Updated ChangeLog and AUTHORS file for dev release
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14800 16af8721-9629-0410-8352-f15c8da7e697
2015-03-17 09:40:31 +00:00
Robert Osfield
535b168d81 Fixed library wrapper
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14798 16af8721-9629-0410-8352-f15c8da7e697
2015-03-17 09:09:10 +00:00
Robert Osfield
c086bef5ed Added ComputeBoundingSphereCallback reference
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14796 16af8721-9629-0410-8352-f15c8da7e697
2015-03-17 08:25:49 +00:00
Robert Osfield
fb4a2d7128 From Konstantin Matveyev, "More "LibraryWrapper" fixes for osg and osgAnimation NodeKits
in the attachment (for 3.3.6 version :)

Fixes:

osg:
Unsupported associated class osg::UpdateCallback (osg_Drawable_UpdateCallback);
ComputeBoundingBoxCallback

osgAnimation:
Unsupported wrapper class osgAnimation::RigComputeBoundingBoxCallback
"


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14795 16af8721-9629-0410-8352-f15c8da7e697
2015-03-17 08:24:01 +00:00
Robert Osfield
b8cd439697 Changed to using osgDB::ofstream to work around Windows build issue
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14794 16af8721-9629-0410-8352-f15c8da7e697
2015-03-17 08:19:05 +00:00
Robert Osfield
728d5ead52 Removed unneccessary library link line.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14793 16af8721-9629-0410-8352-f15c8da7e697
2015-03-16 17:01:57 +00:00
Robert Osfield
6d47fe4d98 Removed the using namespace std and replaced with local std:: to make the code clearer
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14792 16af8721-9629-0410-8352-f15c8da7e697
2015-03-16 14:16:52 +00:00
Robert Osfield
e6e39e7924 Refactored the command line setup to enable better control of set up.
Added WindowSizeHandler to allow for adjustment of window size.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14791 16af8721-9629-0410-8352-f15c8da7e697
2015-03-16 12:13:44 +00:00
Robert Osfield
7165182e35 From Konstantin Matveyev, "Last update in the osgAnimation::Animation ONCE mode bug fix"
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14789 16af8721-9629-0410-8352-f15c8da7e697
2015-03-16 10:30:18 +00:00
Robert Osfield
a88fa6f7b7 Added --play-mode [ONCE, STAY, LOOP, PPONG] to help with testing.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14788 16af8721-9629-0410-8352-f15c8da7e697
2015-03-16 10:07:13 +00:00
Robert Osfield
58717d9279 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/trunk@14786 16af8721-9629-0410-8352-f15c8da7e697
2015-03-13 08:12:26 +00:00
Robert Osfield
e2f208af54 Refactored how the callbacks for updating geometry are managed in MorphGeometry and RigGeometry to address bugs in serialization.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14784 16af8721-9629-0410-8352-f15c8da7e697
2015-03-12 17:11:11 +00:00
Robert Osfield
dd2de7f132 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/trunk@14782 16af8721-9629-0410-8352-f15c8da7e697
2015-03-12 15:12:29 +00:00
Robert Osfield
d3e9c44440 From Mattias Helsing, add copyright notice from other osgjs header to the json_stream header
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14781 16af8721-9629-0410-8352-f15c8da7e697
2015-03-12 13:41:00 +00:00
Robert Osfield
3d144a0312 Added using namespace std and removed the std:: prefixes before the std::isfinte and std::isinf function calls to avoid problems with Android builds against older NDK's.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14780 16af8721-9629-0410-8352-f15c8da7e697
2015-03-12 13:37:08 +00:00
Robert Osfield
53859bb3de From Laurens Voerman, warning fixes
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14778 16af8721-9629-0410-8352-f15c8da7e697
2015-03-11 17:47:08 +00:00
Robert Osfield
11f5039695 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/trunk@14776 16af8721-9629-0410-8352-f15c8da7e697
2015-03-11 17:36:45 +00:00
Robert Osfield
75b9cd3627 Completed support for assigning 3D osg::Image to osg::Texture2DArray.
Improved the osgtexture2DArray example to add --mipmap and --packed command line options to help with testing.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14775 16af8721-9629-0410-8352-f15c8da7e697
2015-03-11 17:27:08 +00:00
Robert Osfield
b6acb1a8d3 Updated the comments to be more relevant
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14774 16af8721-9629-0410-8352-f15c8da7e697
2015-03-11 15:44:23 +00:00
Robert Osfield
c30be2355b Work in progress to allow osg::Texture2DArray to be set up with a single osg::Image containing 3D image data.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14773 16af8721-9629-0410-8352-f15c8da7e697
2015-03-10 18:15:02 +00:00
Robert Osfield
d97e01c520 Work in progress on new osgtexture2DArray example
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14772 16af8721-9629-0410-8352-f15c8da7e697
2015-03-10 18:07:17 +00:00
Robert Osfield
2a84719f4a From Cedric Pinson, gles and osgjs plugins that support conversion of OSG loaded models into a form that can be used with osgjs JavaScript library
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14770 16af8721-9629-0410-8352-f15c8da7e697
2015-03-09 11:27:26 +00:00
Robert Osfield
9e2c23c9d3 Update AUTHORS file for 3.3.6 dev release
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14768 16af8721-9629-0410-8352-f15c8da7e697
2015-03-05 19:53:17 +00:00
Robert Osfield
6a860e5e82 Updated dev release number
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14767 16af8721-9629-0410-8352-f15c8da7e697
2015-03-05 19:33:17 +00:00
Robert Osfield
e5b533726e Updated ChangeLog for dev release
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14765 16af8721-9629-0410-8352-f15c8da7e697
2015-03-05 19:26:08 +00:00
Robert Osfield
ed9502e017 Added check for newline at end of version line, and of it's not add a '\n'
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14761 16af8721-9629-0410-8352-f15c8da7e697
2015-03-05 10:53:28 +00:00
Robert Osfield
efb90a6a80 Updated SO_VERSION after changes to osgPresentation
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14760 16af8721-9629-0410-8352-f15c8da7e697
2015-03-04 18:39:04 +00:00
Robert Osfield
8c8b8f3305 Restructed the osgPresentation and present3D directories back to the structure that was present in OSG-3.2
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14759 16af8721-9629-0410-8352-f15c8da7e697
2015-03-04 18:36:44 +00:00
Robert Osfield
26d1679248 Removed the experiemental osgPresentation classes. These are only partially functional and not appropriate for the stable OSG-3.4 release
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14758 16af8721-9629-0410-8352-f15c8da7e697
2015-03-04 17:42:30 +00:00
Robert Osfield
412a9154c3 Updated AUTHORS for 3.3.5 dev release
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14756 16af8721-9629-0410-8352-f15c8da7e697
2015-03-03 15:26:15 +00:00
Robert Osfield
66aef5dfc9 Fixed ClusterCullingCallback parser problem due to osg::Callback not being included in inheritance list
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14755 16af8721-9629-0410-8352-f15c8da7e697
2015-03-03 14:59:37 +00:00
Robert Osfield
5346e7772a Restructed the checks in the CollectLowestTransformsVisitor::removeTransforms() to avoid benign case being flagged as warning.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14753 16af8721-9629-0410-8352-f15c8da7e697
2015-03-03 12:56:09 +00:00
Robert Osfield
ec6edf535d From Miha Ravselj, "Regarding previous submission it was only partial solution. After further testing I found similar bug also in ClearNode serializer.
//GLbitfield mask = GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT;
This line was problematic since it produced incorrect result when let's say COLOR flag is serialized
it should be null as in Camera serializer or in a proposed BitFlagsSerializer


This line of code caused that whenever only GL_COLOR_BUFFER_BIT bit was written and on value read GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT was restored instead of GL_COLOR_BUFFER_BIT only.

//GLbitfield mask = 0; //this resolves the issue same as in camera
Also same bit-wise comparison bug was also present in write method.
-------------------------------------------------------------------------------------

As you can see there are total 3 bit mask serializers in OSG and all 3 had bugs so I decided to add ADD_BITFLAGS_SERIALIZER and replace USER serializers in osg::Camera, osg::ClearNode and osgText::TextBase. I have made sure that bitflags serializer does not break backwards-compatibility since it uses same code as user serializer does in all 3 cases. (see tester.cpp on how compatibility test was performed)"



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14752 16af8721-9629-0410-8352-f15c8da7e697
2015-03-03 12:03:23 +00:00
Robert Osfield
4c4738eced Re-organized the #ifdef's to avoid usage of glPolyginMode under GLES
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14751 16af8721-9629-0410-8352-f15c8da7e697
2015-03-03 12:00:52 +00:00
Robert Osfield
925c37b783 Updated SO_VERSION to take account of API changes in osgDB
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14749 16af8721-9629-0410-8352-f15c8da7e697
2015-03-02 14:38:17 +00:00
Robert Osfield
58edd10d04 From Johannes Scholz, "Attached you find a patch for osgDB::OutputStream and osgDB::InputStream to include osg::Image::data() using Base64 encoding inside the ASCII OSGT, if WriteImageHint=IncludeData is set, only."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14748 16af8721-9629-0410-8352-f15c8da7e697
2015-03-02 12:11:43 +00:00
Robert Osfield
1d9e7f144b From Michael McDonnel, "The tessellation shader example has a small bug.The middle of the
geometry is clipped as soon as it is tessellated. The clipping is
probably caused by rounding errors because it is only in one spot. The
clipping disappears when the camera is moved, and reappears when it is
moved back. Expanding the the bounding box fixed the clipping bug."

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


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14747 16af8721-9629-0410-8352-f15c8da7e697
2015-03-02 12:09:25 +00:00
Robert Osfield
0a83632f0a Fixed StateSet::Define names to match OpenSceneGraph-Data/shaders.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14745 16af8721-9629-0410-8352-f15c8da7e697
2015-03-01 15:20:37 +00:00
Robert Osfield
321750d72d 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/trunk@14744 16af8721-9629-0410-8352-f15c8da7e697
2015-03-01 11:08:58 +00:00
Robert Osfield
e3e1a55702 Updated version number after dev release.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14740 16af8721-9629-0410-8352-f15c8da7e697
2015-02-27 10:01:56 +00:00
Robert Osfield
e9f497aa1f Updated ChangeLog and Contributors to fix trailing spaces
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14738 16af8721-9629-0410-8352-f15c8da7e697
2015-02-27 09:47:58 +00:00
Robert Osfield
b59b0e0253 Fixed Windows warnings
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14737 16af8721-9629-0410-8352-f15c8da7e697
2015-02-27 09:05:04 +00:00
Robert Osfield
d03b38dea8 Fixes for warnings
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14736 16af8721-9629-0410-8352-f15c8da7e697
2015-02-27 04:29:30 +00:00
Robert Osfield
23b76599bd Fixed build with auto ptr conversion switched off
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14735 16af8721-9629-0410-8352-f15c8da7e697
2015-02-26 20:15:36 +00:00
Robert Osfield
f93a4f330a Updated AUTHORS
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14733 16af8721-9629-0410-8352-f15c8da7e697
2015-02-26 19:51:56 +00:00
Robert Osfield
6a30705870 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/trunk@14732 16af8721-9629-0410-8352-f15c8da7e697
2015-02-26 19:14:28 +00:00
Robert Osfield
9dffd49241 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/trunk@14729 16af8721-9629-0410-8352-f15c8da7e697
2015-02-26 18:06:06 +00:00
Robert Osfield
77f662f9f7 From Julien Valentin and Alberto Luaces, added support for transform feedback extensions
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14728 16af8721-9629-0410-8352-f15c8da7e697
2015-02-26 17:49:36 +00:00
Robert Osfield
63acee9ee3 Update AUTHORS file
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14727 16af8721-9629-0410-8352-f15c8da7e697
2015-02-26 17:18:31 +00:00
Robert Osfield
d1c93f6bad Fixed typo
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14725 16af8721-9629-0410-8352-f15c8da7e697
2015-02-26 14:16:22 +00:00
Robert Osfield
11ff450231 Regenerated AUTHORS.txt to fix missing special characters
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14724 16af8721-9629-0410-8352-f15c8da7e697
2015-02-26 13:52:12 +00:00
Robert Osfield
9362339242 Updated AUTHORS file
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14723 16af8721-9629-0410-8352-f15c8da7e697
2015-02-25 19:59:01 +00:00
Robert Osfield
32831b1ef8 Updated ChangeLog
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14722 16af8721-9629-0410-8352-f15c8da7e697
2015-02-25 19:52:00 +00:00
Robert Osfield
5f1b41a84f From Aitor Moreno, "Attached you will find the modified file without the lines which raises the exception. "
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14721 16af8721-9629-0410-8352-f15c8da7e697
2015-02-25 19:38:43 +00:00
Robert Osfield
1db6def2c4 From Jamie Robertson, "I've been using osgSim::ScalarBar to display fixed range color values (e.g. red from 1-2, green from 3-4 etc), by setting the _numColors the same as the number of actual colors in the ColorRange.
Currently if you do this you get strange looking results as the colors are calculated for values in the centre of each color step, so if your steps are large, the colors are interpolated sigificantly (see screen grab of red, green and blue colors for illustration).

I've attached a fix which just uses the original color values whenever _numColors equals the number of actual defined colors in the ColorRange. I doubt anyone would want interpolated colors in these circumstances."



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14720 16af8721-9629-0410-8352-f15c8da7e697
2015-02-25 19:31:20 +00:00
Robert Osfield
47202acc24 From Dmitry Marakasov, "While packaging osg-3.3.3 I've discovered that gstreamer detection is
broken:

-- Could NOT find GStreamer (missing:  GSTREAMER_BASE_INCLUDE_DIRS GSTREAMER_BASE_LIBRARIES GSTREAMER_GSTREAMER-APP_INCLUDE_DIRS GSTREAMER_GSTREAMER-APP_LIBRARIES GSTREAMER_GSTREAMER-PBUTILS_INCLUDE_DIRS GSTREAMER_GSTREAMER-PBUTILS_LIBRARIES) (found version "1.4.5")

though all required modules are installed.

There are two problems: first, module names are spelled incorrectly in root
CMakeLists.txt (e.g. gstreamer-app instead of app), so variables expected
for them are e.g. GSTREAMER_GSTREAMER-APP_INCLUDE_DIRS instead of
GSTREAMER_APP_INCLUDE_DIRS.

Second, gstreamer base component is detected as GSTREAMER while checked
later as GSTREAMER_BASE. I've uncommented the detection as
GSTREAMER_BASE, but obviously that should be revisited and only one
detection left. With this patch, gstreamer is detected properly and
the plugins is successfully built and installed."


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

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


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14716 16af8721-9629-0410-8352-f15c8da7e697
2015-02-25 16:59:43 +00:00
Robert Osfield
e7d41377be Fixed handling of NULL entries in osg::Geometry TexCoordArrayList and VertexAttribArrayList.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14715 16af8721-9629-0410-8352-f15c8da7e697
2015-02-25 14:55:59 +00:00
Robert Osfield
213efd20ad Fixed matrix setup.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14714 16af8721-9629-0410-8352-f15c8da7e697
2015-02-24 11:06:05 +00:00
Robert Osfield
bd3f390b2f Fixed image allocation operations.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14712 16af8721-9629-0410-8352-f15c8da7e697
2015-02-23 20:28:28 +00:00
Robert Osfield
594b3064c0 From Miha Ravšelj and Robert Osfield, fix for serializer bug in osgText::TextBase and osg::Camera
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14711 16af8721-9629-0410-8352-f15c8da7e697
2015-02-23 11:43:21 +00:00
Robert Osfield
685a270c18 From Arjun Ramamurthy, fix for use of StatsHandler in multipleviews/windows
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14709 16af8721-9629-0410-8352-f15c8da7e697
2015-02-23 11:07:03 +00:00
Robert Osfield
1320c923ca Changed the toggle of defines so that it works with assumed defaults now set up by the GeometryPool so that when toggling it doesn't have a delay in what the user would expect
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14708 16af8721-9629-0410-8352-f15c8da7e697
2015-02-20 15:12:57 +00:00
Robert Osfield
72c4f3a8ba Removed redudent shaders, and updated remaining shaders to match OpenSceneGraph-Data/shaders
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14705 16af8721-9629-0410-8352-f15c8da7e697
2015-02-20 15:04:56 +00:00
Robert Osfield
afbf20eba9 First step of refactoring the osg::Program management in osgTerrain::GeometryPool for better performance by placing default osg::Program and shader defines on a single StateSet below the osgTerrain::Terrain
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14704 16af8721-9629-0410-8352-f15c8da7e697
2015-02-20 15:02:43 +00:00
Robert Osfield
5c023d1f76 Moved osgTerrain::GeometryPool from osgTerrain::DisplacementMappingTechnique to the osgTerrain::Terrain
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14703 16af8721-9629-0410-8352-f15c8da7e697
2015-02-18 10:52:52 +00:00
Robert Osfield
e5d51da1b3 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/trunk@14701 16af8721-9629-0410-8352-f15c8da7e697
2015-02-18 10:23:14 +00:00
Robert Osfield
4cb5bce66a Added support for DefineList to StateSet::merge(..)
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14700 16af8721-9629-0410-8352-f15c8da7e697
2015-02-17 20:42:12 +00:00
Robert Osfield
3e2305d815 From Stephan Wenglorz, "the attached fix corrects a small bug in OperationThread::setDone(bool), calling it had the opposite effect of what was intended, i.e. setting done to false actually finished the thread. The effect was that VPB threads would exit before starting osgdem when a task had been enqueued, because they initially set done to false."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14699 16af8721-9629-0410-8352-f15c8da7e697
2015-02-17 19:40:58 +00:00
Robert Osfield
8546e911fc Removed GL_ usage in defines
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14697 16af8721-9629-0410-8352-f15c8da7e697
2015-02-17 19:22:37 +00:00
Robert Osfield
441dbe6b02 Removed commented out lines
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14696 16af8721-9629-0410-8352-f15c8da7e697
2015-02-17 19:21:29 +00:00
Robert Osfield
53198f2e9b Cleaned up warning generated when compiling osgocculusviewer
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14695 16af8721-9629-0410-8352-f15c8da7e697
2015-02-17 10:36:41 +00:00
Robert Osfield
6bddbdf074 Improvements to the #pragma(tic) shader composition support
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14694 16af8721-9629-0410-8352-f15c8da7e697
2015-02-13 12:50:43 +00:00
Robert Osfield
77b8962bcc Deprecated the old ShaderComposition example code so that it's now only invoked if you add a --old to the osgshadercomposition command line.
Introduced a new shader composition example based on the new #pragama and #define based GLSL shader/osg::StateSet::setDefine() functionality now built into the core OSG.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14692 16af8721-9629-0410-8352-f15c8da7e697
2015-02-13 10:56:59 +00:00
Robert Osfield
a40260a5a5 From Farshid Lashkari, "I've attached a fix for some internal glu functions so that they use size_t for computing allocation sizes instead of GLint. I encountered some large images that were triggering integer overflows with the current code."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14690 16af8721-9629-0410-8352-f15c8da7e697
2015-02-13 07:45:49 +00:00
Robert Osfield
66210a6aca Fixed warning
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14689 16af8721-9629-0410-8352-f15c8da7e697
2015-02-11 19:21:27 +00:00
Robert Osfield
9fa3defb0e Added reassignment of the #version line to the first entry in the source list.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14688 16af8721-9629-0410-8352-f15c8da7e697
2015-02-11 16:41:31 +00:00
Robert Osfield
4a9f4aae9d Added GL #define for Windows build
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14687 16af8721-9629-0410-8352-f15c8da7e697
2015-02-11 09:41:15 +00:00
Robert Osfield
a676d5d37b Windows build fix
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14686 16af8721-9629-0410-8352-f15c8da7e697
2015-02-10 21:13:16 +00:00
Robert Osfield
06f186dc07 Added GL_LINES_ADJACENCY_EXT variants back into ObjectWraper to enable backwards compatibility.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14685 16af8721-9629-0410-8352-f15c8da7e697
2015-02-10 18:01:02 +00:00
Robert Osfield
ea7dbabda1 Change for new Program API
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14684 16af8721-9629-0410-8352-f15c8da7e697
2015-02-10 17:53:29 +00:00
Robert Osfield
b38c6258bf Added support for new #pragam(atic) shader composition to new displacement mapping technique
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14683 16af8721-9629-0410-8352-f15c8da7e697
2015-02-10 17:20:26 +00:00
Robert Osfield
b90503fdf5 Introduced new shader composition approach that utilizes #pragma requires(), #pragma import_defines() and #ifdef in GLSL to enable multiple different versions of shaders based
on defines passed in from osg::StateSet::setDefine(..).



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14681 16af8721-9629-0410-8352-f15c8da7e697
2015-02-10 17:04:02 +00:00
Robert Osfield
bb637e73f3 Fixed typo.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14680 16af8721-9629-0410-8352-f15c8da7e697
2015-02-04 15:11:00 +00:00
Robert Osfield
1debc21bb2 Removed unncessary _EXT
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14679 16af8721-9629-0410-8352-f15c8da7e697
2015-02-03 16:36:19 +00:00
Robert Osfield
bbb54cedc7 Commented out the experimental V8 and Python plugins as these plugins only existed as a proof of concept test linkage with these dependenices, and have no functionality beyond this.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14678 16af8721-9629-0410-8352-f15c8da7e697
2015-02-02 09:53:55 +00:00
Robert Osfield
a9804d7e19 Replaced _EXT defines with GL-3.2 versions
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14677 16af8721-9629-0410-8352-f15c8da7e697
2015-01-27 15:07:53 +00:00
Robert Osfield
045caf1086 From Javier Taibo,
"I have found a "bug" in the new audio decoding code (actually I think the bug is in ffmpeg, but anyway it should be wise to protect the OSG plug-in about it). I am attaching a security check in FFmpegDecoderAudio.cpp.

If anybody is curious about the problem, it happens sometimes when decoding an AAC audio stream. It eventually includes a PCE block inside the AAC audio frame and then ffmpeg audio decoding function signals a "new_frame" with 1024 samples, but a null pointer instead of the audio data. It can be easily detected because in these cases number of channels is 0. Maybe this is the intended behaviour for ffmpeg, but I find it quite weird.
"

" It seems that libav does not have a channels attribute in AVFrame structure. This new version should do."


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14676 16af8721-9629-0410-8352-f15c8da7e697
2015-01-23 17:15:20 +00:00
Robert Osfield
4bcf4cf7bb Changed osgFX::MultiTextureControl so that it uses an osg::FloatArray internally to enable sharing with osg::Uniform.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14675 16af8721-9629-0410-8352-f15c8da7e697
2015-01-23 13:51:09 +00:00
Robert Osfield
22cf4c18c3 Added MultiTextureControl event handling of shift 012 i.e. ')', '!', '"' and 'A' to toggle full on for each of the respective or all texture units.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14674 16af8721-9629-0410-8352-f15c8da7e697
2015-01-23 13:50:12 +00:00
Robert Osfield
f5faf615ef Added #define GL_SEPARATE_ATTRIBS and correcte GL_INTERLEAVED_ATTRIBS
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14673 16af8721-9629-0410-8352-f15c8da7e697
2015-01-22 16:49:00 +00:00
Robert Osfield
51b19d2d8b From Alexey Pavlov, "Export fix for Windows platform"
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14672 16af8721-9629-0410-8352-f15c8da7e697
2015-01-22 16:41:34 +00:00
Robert Osfield
e330e9309c Added GL_INTERLEAVED_ATTRIBS for windows build
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14671 16af8721-9629-0410-8352-f15c8da7e697
2015-01-22 15:08:26 +00:00
Robert Osfield
4a668d53c5 Fixed warning
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14670 16af8721-9629-0410-8352-f15c8da7e697
2015-01-22 15:07:50 +00:00
Robert Osfield
d5f2c34f24 From Andreas Henne, OpenGL core profile fixes required for OSX.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14669 16af8721-9629-0410-8352-f15c8da7e697
2015-01-21 15:35:19 +00:00
Robert Osfield
7fbeeefea8 Added TextureWeights uniform support and controls to osgFX::MultiTextureControl to support usage with shaders.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14668 16af8721-9629-0410-8352-f15c8da7e697
2015-01-21 11:09:29 +00:00
Robert Osfield
3ab06c54bf Re-enabled texturing and fixed runtime warning
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14667 16af8721-9629-0410-8352-f15c8da7e697
2015-01-20 18:01:10 +00:00
Robert Osfield
51afa2c1df Added hardwired geometry shaders
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14666 16af8721-9629-0410-8352-f15c8da7e697
2015-01-20 17:58:56 +00:00
Robert Osfield
a0f1442aae Updated shaders
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14664 16af8721-9629-0410-8352-f15c8da7e697
2015-01-20 17:40:46 +00:00
Robert Osfield
98f5fca9c2 Added key osgTerrain::GeometryPool methods virtual to make it easier to override the shaders
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14662 16af8721-9629-0410-8352-f15c8da7e697
2015-01-20 15:23:06 +00:00
Robert Osfield
0a4efa35c3 Changed the reset of the GLExtensions::Set() in the State destructor so that it checks to see if the local _glExtensions pointer has been set up and taken ownership of the GLExtensions::Set() value
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14661 16af8721-9629-0410-8352-f15c8da7e697
2015-01-20 11:24:31 +00:00
Robert Osfield
3eca5765c9 Added GeometryPool::s/getUseGeometryShader() hint, and OSG_TERRAIN_USE_GEOMETRY_SHADER env var for setting the default value.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14660 16af8721-9629-0410-8352-f15c8da7e697
2015-01-19 11:29:55 +00:00
Robert Osfield
249c0ff208 Added support for using geometry shaders to align the quad diagonals with the local terrain
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14658 16af8721-9629-0410-8352-f15c8da7e697
2015-01-16 11:03:11 +00:00
Robert Osfield
3e3d7e4dc1 Added a local Vec3Array cache to the HeightFieldDrawable to facilitate efficient intersection testing
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14656 16af8721-9629-0410-8352-f15c8da7e697
2015-01-12 10:31:58 +00:00
Robert Osfield
ed57c8718c Added ability to populate a local vertex cache for when one computes final vertex position in a vertex shader but still want to the Primitive functors to work with the transformed positions.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14655 16af8721-9629-0410-8352-f15c8da7e697
2015-01-12 10:30:50 +00:00
Robert Osfield
d409ffcb91 From Javier Taibo, "I have found that since version 1.1, FFMPEG changed the way audio streams are retrieved, from packed to planar format. SDL interprets packed audio, as is used in the osgmovie example. To make the audio work when the OSGffmpeg plug-in is compiled against recent FFMPEG versions, FFmpegDecoderAudio must check for planar formats and in these cases request the samples as packed. This way all works as before. It can be checked with osgmovie example application.
$ osgmovie --audio movie.avi.ffmpeg
  FFmpegImageStream::open audio failed, audio stream will be disabled: unknown audio format

  With the attached FFmpegDecoderAudio.cpp, audio sounds correctly.

  I am also attaching a modified version of FindFFmpeg.cmake that allows to set as FFMPEG_DIR the ffmpeg compiled in the source directory structure. It should not break anything as it only adds some additional search paths.
"


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14654 16af8721-9629-0410-8352-f15c8da7e697
2015-01-07 14:14:55 +00:00
Robert Osfield
bf794165d5 From Farshid Lashkari, "small change to osg::Image::readImageFromCurrentTexture to allow reading data from compressed cubemap textures."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14653 16af8721-9629-0410-8352-f15c8da7e697
2015-01-07 10:36:34 +00:00
Robert Osfield
134b2e506f Cleaned up GL_TEXTURE_BUFFER_*ARB usage as include/osg/GLDefines now provides the non ARB variants
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14652 16af8721-9629-0410-8352-f15c8da7e697
2015-01-06 17:23:26 +00:00
Robert Osfield
8b384baca9 From Julien Valentin, "To sum up changes, I had:
-some extensions in GLExtensions
  - GL_TEXTURE_BUFFER as target in osg::StateSet
  - a VBO based transform feed back example
"


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14651 16af8721-9629-0410-8352-f15c8da7e697
2015-01-06 17:12:51 +00:00
Robert Osfield
f9f480b935 Updates SO_VERSION in prep for API modifications since the 3.3.3 dev release
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14650 16af8721-9629-0410-8352-f15c8da7e697
2015-01-06 17:09:44 +00:00
Robert Osfield
4538a0fa41 From Julien Valentin, added missing initializer
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14647 16af8721-9629-0410-8352-f15c8da7e697
2015-01-06 14:55:00 +00:00
Robert Osfield
f7b95ea4e5 From Julien Valentin, typo fix
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14646 16af8721-9629-0410-8352-f15c8da7e697
2015-01-06 14:41:30 +00:00
Robert Osfield
b1852757b5 From Jason Beverage, "Here is a fix to the STL plugin that fixes build errors introduced in the last commit. It's just a simple addition of the stdint.h header."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14644 16af8721-9629-0410-8352-f15c8da7e697
2015-01-05 17:39:44 +00:00
Robert Osfield
ace32ebe6c Updated ChangeLog and AUTHORS
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14643 16af8721-9629-0410-8352-f15c8da7e697
2014-12-24 11:56:48 +00:00
Robert Osfield
1b1c987356 Removed debug message
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14642 16af8721-9629-0410-8352-f15c8da7e697
2014-12-24 11:43:41 +00:00
Robert Osfield
78729e28fd From Marc Helbling, Clément Léger, Aurélien Chatelain, Paul Cheyrou-Lagrèze :
"a last submission for the obj plugin
* supports vertex color definition after vertex position by Clément Léger
* supports zbrush vertex color definition (as #MRGB comment) by Aurélien Chatelain
* adds a noReverseFace option to not mess with face definition by Aurélien Chatelain
* makes material parsing case insensitive (by Paul Cheyrou-Lagrèze and me)
* makes the plugin resilient to faulty vertex uv/normal definition (i.e. when a too big index is referenced) by Aurélien hatelain
"


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14641 16af8721-9629-0410-8352-f15c8da7e697
2014-12-24 11:25:46 +00:00
Robert Osfield
50203023c7 From Aurélien Chatelain, "adds support for
* quad primitives
* face definition with the "vertex_index" label (previously only "vertex_indices" was supported)
* replaces normal computation by the SmoothingVisitor to avoid code duplication
"

Submitted by Marc Helbling.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14640 16af8721-9629-0410-8352-f15c8da7e697
2014-12-24 11:02:18 +00:00
Robert Osfield
a331680cec From Aurélien Chatelain, "the smoothing visitor did not handle shared arrays. It may leads to bad geometry arrays when a shared array is involved in the scene.
This submission adds shared array duplication (and moves the SharedArrayOptimizer declaration in MeshOptimizer to make it callable from the SmoothingVisitor)."

Submitted by Marc Helbling.
Edited by Robet Osfield to retain the usual OSG coding style.




git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14639 16af8721-9629-0410-8352-f15c8da7e697
2014-12-24 10:55:49 +00:00
Robert Osfield
2870c12b03 From Aurélien Chatelain, "updates the STL plugin:
* fixes vertex color support
* adds 'magics' color definition
* cleans options to make the plugin more consistent with other plugins
* adds options to not tristrip geometries"

Submitted by Marc Helbling.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14638 16af8721-9629-0410-8352-f15c8da7e697
2014-12-24 10:47:25 +00:00
Robert Osfield
18323ac899 Aded shaders for various combinations of layers.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14637 16af8721-9629-0410-8352-f15c8da7e697
2014-12-24 10:14:03 +00:00
Robert Osfield
c57e62e799 Added osgDB::readShaderFileWithFallback(..) convinience functions to make it easier to set up reading external shader files with a built in fallback.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14636 16af8721-9629-0410-8352-f15c8da7e697
2014-12-24 10:13:42 +00:00
Robert Osfield
f984f6032f Added support for reading Vec3 colour arrays
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14634 16af8721-9629-0410-8352-f15c8da7e697
2014-12-23 14:20:53 +00:00
Robert Osfield
5a4f962013 Changes to allow the COLLADA plugin to compile against the latest COLLADA DOM version 2.4 as well as retaining compatibility with the old 2.2 DOM.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14633 16af8721-9629-0410-8352-f15c8da7e697
2014-12-23 12:10:03 +00:00
Robert Osfield
dd650921b1 Added comment about using -DCMAKE_DISABLE_FINDPACKAGE_* command line.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14632 16af8721-9629-0410-8352-f15c8da7e697
2014-12-22 10:35:33 +00:00
Robert Osfield
73221e8682 Added doxygen comment for ref_ptr<>::release().
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14630 16af8721-9629-0410-8352-f15c8da7e697
2014-12-22 09:50:10 +00:00
Robert Osfield
8e901ebbac Updated version number after dev release
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14628 16af8721-9629-0410-8352-f15c8da7e697
2014-12-22 09:49:17 +00:00
Robert Osfield
4945e03bcb Windows build error and warning fixes
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14626 16af8721-9629-0410-8352-f15c8da7e697
2014-12-19 11:00:31 +00:00
Robert Osfield
c6013c721e Updated ChangeLog and AUTHORS file for dev release
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14625 16af8721-9629-0410-8352-f15c8da7e697
2014-12-19 10:25:49 +00:00
Robert Osfield
dfc02b78bf Added if () block to avoid script variables set to NOT-Found being used in searching
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14624 16af8721-9629-0410-8352-f15c8da7e697
2014-12-19 08:27:30 +00:00
Robert Osfield
a03ec99005 Fixed script warnings
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14623 16af8721-9629-0410-8352-f15c8da7e697
2014-12-19 08:25:35 +00:00
Robert Osfield
8be71caeaf From Aitor Moreno, LAS plugin - depends upon boost and liblas and liblas-c
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14622 16af8721-9629-0410-8352-f15c8da7e697
2014-12-18 17:47:08 +00:00
Robert Osfield
b163ff8562 From Adrian Clark, build fix for recent Android NDK using the old Android build approach.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14621 16af8721-9629-0410-8352-f15c8da7e697
2014-12-18 16:52:57 +00:00
Robert Osfield
4ce6b07886 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/trunk@14620 16af8721-9629-0410-8352-f15c8da7e697
2014-12-18 15:59:16 +00:00
Robert Osfield
2a46857353 Updated AUTHORS
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14617 16af8721-9629-0410-8352-f15c8da7e697
2014-12-18 11:36:16 +00:00
Robert Osfield
e281c264a7 Updated ChangeLog in prep for dev release
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14616 16af8721-9629-0410-8352-f15c8da7e697
2014-12-18 11:19:11 +00:00
Robert Osfield
34177d3f63 Fixed warning
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14615 16af8721-9629-0410-8352-f15c8da7e697
2014-12-18 11:09:43 +00:00
Robert Osfield
6f9ac83693 Added DisplaySettings::s/getNvOptimusEnablement() and OSG_NvOptimusEnablement env var control to control the setting of the NvOptimusEnablement variable
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14614 16af8721-9629-0410-8352-f15c8da7e697
2014-12-18 10:59:07 +00:00
Robert Osfield
075e874c85 From Sukender, "Added options to the FBX writer: an ascii/binary switch, and the ability to select FBX version as the SDK handles it (Ex: "FBX201300").
This allows the user to achieve backward compatibility, and debug format issues using text output."


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14613 16af8721-9629-0410-8352-f15c8da7e697
2014-12-18 09:24:46 +00:00
Robert Osfield
af16041f57 From Mattias Helsing, "The addition of the GStreamer cmake find script broke my build because
cmake vars weren't passed correctly to find_package_handler_args, so
while the find script didn't find a single required GStreamer lib or
include path it still reported GSTREAMER_FOUND=TRUE (and then tried to
compile the new plugin). This fixes it and correctly reports missing
components."


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14611 16af8721-9629-0410-8352-f15c8da7e697
2014-12-18 09:03:15 +00:00
Robert Osfield
adf9596316 Added support for using SDL2 to the osgmovie to enable it to handle floating point audio formats
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14610 16af8721-9629-0410-8352-f15c8da7e697
2014-12-17 19:21:32 +00:00
Robert Osfield
69abe094ab From Javier Taibo, " I have found that since version 1.1, FFMPEG changed the way audio streams are retrieved, from packed to planar format. SDL interprets packed audio, as is used in the osgmovie example. To make the audio work when the OSGffmpeg plug-in is compiled against recent FFMPEG versions, FFmpegDecoderAudio must check for planar formats and in these cases request the samples as packed. This way all works as before. It can be checked with osgmovie example application.
$ osgmovie --audio movie.avi.ffmpeg
  FFmpegImageStream::open audio failed, audio stream will be disabled: unknown audio format

  With the attached FFmpegDecoderAudio.cpp, audio sounds correctly.

  I am also attaching a modified version of FindFFmpeg.cmake that allows to set as FFMPEG_DIR the ffmpeg compiled in the source directory structure. It should not break anything as it only adds some additional search paths.

"

Note from Robert Osfield, I have found in testing that audio quality is not good for planar floating point formats, even with adding support for SDL2 to the osgmovie example. I haven't yet tracked down the cause of these audio problems or a solution.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14609 16af8721-9629-0410-8352-f15c8da7e697
2014-12-17 19:20:48 +00:00
Robert Osfield
4513709a1b From Sukender, "FBX writer was writing an empty file when the scene had a root node being a Geode.
This was caused be the change in Drawable (now derived from Node) and Geode (now derived from Group).
This fix simply sticks with previous behaviour. Another change could be to adapt WriterNodeVisitor.
"


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14608 16af8721-9629-0410-8352-f15c8da7e697
2014-12-17 10:19:02 +00:00
Robert Osfield
e7ea085912 Fixed warnings and memmory leaks
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14607 16af8721-9629-0410-8352-f15c8da7e697
2014-12-16 17:37:03 +00:00
Robert Osfield
e4e22bb1af Fixed warnings
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14606 16af8721-9629-0410-8352-f15c8da7e697
2014-12-16 17:15:21 +00:00
Robert Osfield
4dfe6ab048 Improved handling of invalid/unhandled files
Added support for ImageStream::LoopigMode variable
Fixed memory leak associtied with restarting videos
Changed Image::setData() to Image::dirty() to avoid resetting data


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14605 16af8721-9629-0410-8352-f15c8da7e697
2014-12-16 17:08:01 +00:00
Robert Osfield
6cd9932780 From Julen Garcia, "Here there is a small plugin I use to play video files. It is based on GStreamer http://gstreamer.freedesktop.org and I have used the FFmpeg plugin as inspiration."
From Robert Osfield, fixed handled of row widths so that they are padded to a 4 byte boundary as certain row widths were being rendered incorrectly.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14604 16af8721-9629-0410-8352-f15c8da7e697
2014-12-16 11:20:42 +00:00
Robert Osfield
58c47e9842 From Marc Helbling, "please find enclosed a submission that should improve the VertexAccessOrderVisitor (pre-transform) optimizer:
* it sorts primitives to keep "more complex" primitives first; maybe you'll prefer to have this as an option (but usually it should make more sense to pre-transform triangles before e.g. lines)
* currently, the visitor rely on TriangleIndexFunctor and does not take care of points and lines (see https://github.com/openscenegraph/osg/blob/master/include/osg/TriangleIndexFunctor#L124-130). This can lead to issues e.g. if you store the wireframe lines along with some triangles: the triangles will be reindexed but not the line. I've therefore added osg/include/TriangleLinePointIndexFunctor to index triangles, lines and points and derived VertexReorder from this class.
* to avoid issues, shared arrays are duplicated. However, in some cases (e.g. an UV channel shared in the geometry only) this is not required. I'm adding a SharedArrayOptimizer to optimize this: it looks for duplicated UVs before the array duplication and deduplicate arrays after.
"


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14603 16af8721-9629-0410-8352-f15c8da7e697
2014-12-16 09:34:15 +00:00
Robert Osfield
117869d154 From Marc Helbling, "please find the mergeTriangleStrip code merged in osgUtil::TriStripVisitor.
I've removed the references to DrawArrays as we should no longer produce any.

Note that:
* as the name suggest, it only works for triangle strips but could probably be easily extended to quads
* the resulting primitive is not highly optimized; we could probably sort the strips in order to minimize the number of primitive restart
* as we may merge DrawElementsUInt and DrawElementUShort, the code will only generate DrawElementsUInt"


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14602 16af8721-9629-0410-8352-f15c8da7e697
2014-12-15 17:15:21 +00:00
Robert Osfield
811dde86c8 Build fix
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14601 16af8721-9629-0410-8352-f15c8da7e697
2014-12-10 18:23:32 +00:00
Robert Osfield
49c48a5509 Added OpenGL Transform Feedback extensions.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14600 16af8721-9629-0410-8352-f15c8da7e697
2014-12-10 13:05:47 +00:00
Robert Osfield
1b6e50a2dd From Marcus Hein, Added support for OpenGL SSBO and SSBB via osg::ShaderStorageBufferObject and osg::ShaderStorageBufferBinding to core OSG library, and added new osgSSBO example
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14599 16af8721-9629-0410-8352-f15c8da7e697
2014-12-10 12:23:04 +00:00
Robert Osfield
92e2d849ed Added GLDefines header
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14597 16af8721-9629-0410-8352-f15c8da7e697
2014-12-10 11:44:16 +00:00
Robert Osfield
487c2b5f67 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/trunk@14595 16af8721-9629-0410-8352-f15c8da7e697
2014-12-10 11:29:54 +00:00
Robert Osfield
3c07921dee Removed old GL2Extensions class, replacing it with a typedef to GL2Extensions
Removed old includes to include/osg/GL2Extensions


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14594 16af8721-9629-0410-8352-f15c8da7e697
2014-12-10 10:44:58 +00:00
Robert Osfield
485709f708 Moved GL2Extensions functionality into the include/osg/GLExtensions header and new GLExtensions object.
Moved the #defines into new include/osg/GLDefines
Converted all GL2Extensions usage to GLExtensions usage


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14593 16af8721-9629-0410-8352-f15c8da7e697
2014-12-10 10:38:12 +00:00
Robert Osfield
09205544b7 Streamlined the extension functions
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14592 16af8721-9629-0410-8352-f15c8da7e697
2014-12-10 09:11:17 +00:00
Robert Osfield
7629a5126a Added #ifdef's around GLsync typedef
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14591 16af8721-9629-0410-8352-f15c8da7e697
2014-12-09 21:33:12 +00:00
Robert Osfield
22e51c9902 Windows build fixes
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14590 16af8721-9629-0410-8352-f15c8da7e697
2014-12-09 20:09:29 +00:00
Robert Osfield
a6aa47afcd Added new examples to runexamples.bat script
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14589 16af8721-9629-0410-8352-f15c8da7e697
2014-12-09 19:31:53 +00:00
Robert Osfield
d166b6d1df Quietened down debug messages
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14588 16af8721-9629-0410-8352-f15c8da7e697
2014-12-09 19:22:45 +00:00
Robert Osfield
d32cd203a2 From Wand Rui, "I've rewritten the osgblenddrawbuffers example to use the new BlendFunci and Capability classes. Hope it will tell others how to make use of the new functionality and why they are important in modern MRT-based applications."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14587 16af8721-9629-0410-8352-f15c8da7e697
2014-12-09 19:20:05 +00:00
Robert Osfield
43049ebcf1 Moved FBO Extensions into GL2Extensions.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14586 16af8721-9629-0410-8352-f15c8da7e697
2014-12-09 18:30:28 +00:00
Robert Osfield
d5fcdabfa1 Removed no longer used Extension definition
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14585 16af8721-9629-0410-8352-f15c8da7e697
2014-12-09 14:58:34 +00:00
Robert Osfield
e31f682451 Moved local Extensions structs into GL2Extensions
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14584 16af8721-9629-0410-8352-f15c8da7e697
2014-12-09 14:57:25 +00:00
Robert Osfield
3f1e77d479 Moveved Stencil/StencilTwoSided::Extensions into GL2Extensions
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14583 16af8721-9629-0410-8352-f15c8da7e697
2014-12-09 11:14:33 +00:00
Robert Osfield
ec4f898bce Moved local Extensions objects to GL2Extensions
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14582 16af8721-9629-0410-8352-f15c8da7e697
2014-12-09 10:37:09 +00:00
Robert Osfield
cceee38727 Moved Texture*::Extensions functionality into GL2Extensions
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14581 16af8721-9629-0410-8352-f15c8da7e697
2014-12-09 10:05:59 +00:00
Robert Osfield
a8804e2366 MOved VertexProgram and FragmentProgram::Extensions into GL2Extensions.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14580 16af8721-9629-0410-8352-f15c8da7e697
2014-12-08 16:08:44 +00:00
Robert Osfield
35cfbfdb8c Fixed memory leak in RenderStageCache.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14578 16af8721-9629-0410-8352-f15c8da7e697
2014-12-08 11:08:29 +00:00
Robert Osfield
bc424bc54f MOved SampleMaski::Extensions into osg::GL2Extensions
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14577 16af8721-9629-0410-8352-f15c8da7e697
2014-12-07 17:31:49 +00:00
Robert Osfield
9b03b3f8ce Moved TextureCubeMap::Extension functionality into GL2Extensions
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14576 16af8721-9629-0410-8352-f15c8da7e697
2014-12-05 20:05:18 +00:00
Robert Osfield
f634152de0 Moved osg::Drawable::Extensions into osg::GL2Extensions
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14575 16af8721-9629-0410-8352-f15c8da7e697
2014-12-05 17:26:42 +00:00
Robert Osfield
1ce8029f39 Fixed windows build warnings
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14574 16af8721-9629-0410-8352-f15c8da7e697
2014-12-05 10:37:20 +00:00
Robert Osfield
1bcb944ddc Windows build fix
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14573 16af8721-9629-0410-8352-f15c8da7e697
2014-12-05 09:52:42 +00:00
Robert Osfield
aa090f0f99 From the GLintptr + GLsizeiptr defintions to GL2Extensions header
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14572 16af8721-9629-0410-8352-f15c8da7e697
2014-12-05 08:58:23 +00:00
Robert Osfield
d83e641fad Moved osg::BlenFunc::Extensions into osg::GL2Extensions
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14571 16af8721-9629-0410-8352-f15c8da7e697
2014-12-04 19:03:16 +00:00
Robert Osfield
d02c0bdc49 Moved GLBufferObject::Extensions structure into osg::GL2Extensions
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14570 16af8721-9629-0410-8352-f15c8da7e697
2014-12-04 18:13:11 +00:00
Robert Osfield
69407f4054 Removed redundent spaces
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14569 16af8721-9629-0410-8352-f15c8da7e697
2014-12-04 18:12:07 +00:00
Robert Osfield
1791ac08a8 Added glMemoryBarrier, glMapBufferRange and glBindBufferBase to GL2Extensions
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14568 16af8721-9629-0410-8352-f15c8da7e697
2014-12-04 17:12:55 +00:00
Robert Osfield
6569f69de1 Moved old GL2Extensions::Get(..) usage across to new osg::State::get<GL2Extensions>() usage
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14567 16af8721-9629-0410-8352-f15c8da7e697
2014-12-04 16:28:32 +00:00
Robert Osfield
66da1328f8 Ported GL2Extentions across to using the new GL extensions approach - cutting code count by 3000 lines!
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14566 16af8721-9629-0410-8352-f15c8da7e697
2014-12-04 16:22:31 +00:00
Robert Osfield
f8d53b7c8d Build fix for when ref_ptr<> auto conversion is disabled
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14565 16af8721-9629-0410-8352-f15c8da7e697
2014-12-04 15:10:43 +00:00
Robert Osfield
5efe60dcf5 Added osg::Capability and Cabibilityi base classes to wrap up glEnable/glDisable + glEnablei/glDisablei functionality, with osg::Enablei and osg::Disablei concrete implementations.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14564 16af8721-9629-0410-8352-f15c8da7e697
2014-12-03 17:31:16 +00:00
Robert Osfield
457d41d385 Added osg::BlendFunci, osg::BlendEquationi and osg::ColorMaski StateAttrirbutes that wrap the glBlendFunci, glBlendEquationi and glColorMaski functions
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14563 16af8721-9629-0410-8352-f15c8da7e697
2014-12-02 17:12:56 +00:00
Robert Osfield
a9cab19ddb Moved BlendEquation across to using the new GL extension setup approach.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14562 16af8721-9629-0410-8352-f15c8da7e697
2014-12-02 15:37:07 +00:00
Robert Osfield
0ce96fbe8b Fixed typo
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14561 16af8721-9629-0410-8352-f15c8da7e697
2014-12-02 15:21:24 +00:00
Robert Osfield
ff73445bf3 Added a template get and get_exisiting method into osg::State that implements a new mechanism for managing OpenGL extensions.
Refactored the BendFunc::Extensions usage to simplify it utilizing the new osg::State extension mechanism.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14560 16af8721-9629-0410-8352-f15c8da7e697
2014-12-02 11:10:23 +00:00
Robert Osfield
b7067ad988 From Rafa Gaitan, "I'm attaching also a new version of the toolchain with support for the r10c ndk. This fixes some CMake Warnings and allows to use the toolchain in macosx."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14558 16af8721-9629-0410-8352-f15c8da7e697
2014-11-28 16:20:28 +00:00
Robert Osfield
e5f5c30e4d Removed include/osg/Version and include/OpenThreads/Version headers as these are autogenerated.
Changed the paths for the OpenThreads/osg Version headers to be placed in the PROJECT_BINARY_DIR.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14557 16af8721-9629-0410-8352-f15c8da7e697
2014-11-28 16:10:14 +00:00
Robert Osfield
d7c6bb1c4b Standardized on defined(__ANDROID__)
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14556 16af8721-9629-0410-8352-f15c8da7e697
2014-11-28 10:54:40 +00:00
Robert Osfield
6d98c5460f Added getlocaledecpoint() workaround for Android build of lua plugin
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14555 16af8721-9629-0410-8352-f15c8da7e697
2014-11-28 10:52:06 +00:00
Robert Osfield
1c9993dd5d Added in source shaders
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14554 16af8721-9629-0410-8352-f15c8da7e697
2014-11-27 15:54:24 +00:00
Robert Osfield
114ddbb0c6 Changed the name of shader files
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14553 16af8721-9629-0410-8352-f15c8da7e697
2014-11-27 15:39:38 +00:00
Robert Osfield
95b3622d1d From Jason Beverage, "It looks like the Callback header got accidentally removed from the CMakeLists.txt in the submission yesterday for the geometry instancing example."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14551 16af8721-9629-0410-8352-f15c8da7e697
2014-11-26 20:40:57 +00:00
Robert Osfield
4184696809 Windows build fix
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14550 16af8721-9629-0410-8352-f15c8da7e697
2014-11-26 19:05:09 +00:00
Robert Osfield
d76947845a Fixed warnings
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14549 16af8721-9629-0410-8352-f15c8da7e697
2014-11-26 17:08:16 +00:00
Robert Osfield
2f0cc6fbc9 Fixed warnings
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14546 16af8721-9629-0410-8352-f15c8da7e697
2014-11-26 17:04:12 +00:00
Robert Osfield
f802f6d0ed Fixed deprecated warnings
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14545 16af8721-9629-0410-8352-f15c8da7e697
2014-11-26 16:29:53 +00:00
Robert Osfield
a165930b48 Fixed warning
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14542 16af8721-9629-0410-8352-f15c8da7e697
2014-11-26 16:15:37 +00:00
Robert Osfield
0be132c07c Fixed warnings.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14539 16af8721-9629-0410-8352-f15c8da7e697
2014-11-26 16:04:33 +00:00
Robert Osfield
d6ed4c4d6d Fixed warning
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14537 16af8721-9629-0410-8352-f15c8da7e697
2014-11-26 16:00:18 +00:00
Robert Osfield
8fe82b463f Fixed warning
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14536 16af8721-9629-0410-8352-f15c8da7e697
2014-11-26 15:59:23 +00:00
Robert Osfield
dd186fe6a1 Added osgTerrain::DisplacementMappingTechnique serializer
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14535 16af8721-9629-0410-8352-f15c8da7e697
2014-11-26 14:06:27 +00:00
Robert Osfield
dfb0b2ab8e Renamed ShaderTerrain to DisplacementMappingTechnique and moved it from the osgterrain example testbed into the osgTerrain NodeKit
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14534 16af8721-9629-0410-8352-f15c8da7e697
2014-11-26 14:04:20 +00:00
Robert Osfield
d9f93f9d1a Moved osgTerrain::GeometryPool from osgterrain example into osgTerrain NodeKit
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14533 16af8721-9629-0410-8352-f15c8da7e697
2014-11-26 13:36:28 +00:00
Robert Osfield
eaa170809f Removed GL header as it's already included via the ${OPENSCENEGRAPH_OPENGL_HEADER} entry.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14532 16af8721-9629-0410-8352-f15c8da7e697
2014-11-25 14:37:05 +00:00
Robert Osfield
4c5a1885d2 From PawelKsiezopolski, "This submission contains a new example for OSG : a geometry instancing rendering
algorithm consisting of two consequent phases :

- first phase is a GLSL shader performing object culling and LOD picking ( a culling shader ).
  Every culled object is represented as GL_POINT in the input osg::Geometry.
  The output of the culling shader is a set of object LODs that need to be rendered.
  The output is stored in texture buffer objects. No pixel is drawn to the screen
  because GL_RASTERIZER_DISCARD mode is used.

- second phase draws osg::Geometry containing merged LODs using glDrawArraysIndirect()
  function. Information about quantity of instances to render, its positions and other
  parameters is sourced from texture buffer objects filled in the first phase.

The example uses various OpenGL 4.2 features such as texture buffer objects,
atomic counters, image units and functions defined in GL_ARB_shader_image_load_store
extension to achieve its goal and thus will not work on graphic cards with older OpenGL
versions.

The example was tested on Linux and Windows with NVidia 570 and 580 cards.
The tests on AMD cards were not conducted ( due to lack of it ).
The tests were performed using OSG revision 14088.

The main advantages of this rendering method :
- instanced rendering capable of drawing thousands of different objects with
  almost no CPU intervention  ( cull and draw times are close to 0 ms ).
- input objects may be sourced from any OSG graph ( for example - information about
  object points may be stored in a PagedLOD graph. This way we may cover the whole
  countries with trees, buildings and other objects ).
  Furthermore if we create osgDB plugins that generate data on the fly, we may
  generate information for every grass blade for that country.
- every object may have its own parameters and thus may be distinct from other objects
  of the same type.
- relatively low memory footprint ( single object information is stored in a few
  vertex attributes ).
- no GPU->CPU roundtrip typical for such methods ( method uses atomic counters
  and glDrawArraysIndirect() function instead of OpenGL queries. This way
  information about quantity of rendered objects never goes back to CPU.
  The typical GPU->CPU roundtrip cost is about 2 ms ).
- this example also shows how to render dynamic objects ( objects that may change
  its position ) with moving parts ( like car wheels or airplane propellers ) .
  The obvious extension to that dynamic method would be the animated crowd rendering.
- rendered objects may be easily replaced ( there is no need to process the whole
  OSG graphs, because these graphs store only positional information ).

The main disadvantages of a method :
- the maximum quantity of objects to render must be known beforehand
  ( because texture buffer objects holding data between phases have constant size ).
- OSG statistics are flawed ( they don't know anymore how many objects are drawn ).
- osgUtil::Intersection does not work

Example application may be used to make some performance tests, so below you
will find some extended parameter description :
--skip-dynamic       - skip rendering of dynamic objects if you only want to
                       observe static object statistics
--skip-static        - the same for static objects
--dynamic-area-size  - size of the area for dynamic rendering. Default = 1000 meters
                       ( square 1000m x 1000m ). Along with density defines
                       how many dynamic objects is there in the example.
--static-area-size   - the same for static objects. Default = 2000 meters
                       ( square 2000m x 2000m ).

Example application defines some parameters (density, LOD ranges, object's triangle count).
You may manipulate its values using below described modifiers:
--density-modifier   - density modifier in percent. Default = 100%.
                       Density ( along with LOD ranges ) defines maximum
                       quantity of rendered objects. registerType() function
                       accepts maximum density ( in objects per square kilometer )
                       as its parameter.
--lod-modifier       - defines the LOD ranges. Default = 100%.
--triangle-modifier  - defines the number of triangles in finally rendered objects.
                       Default = 100 %.
--instances-per-cell - for static rendering the application builds OSG graph using
                       InstanceCell class ( this class is a modified version of Cell class
                       from osgforest example - it builds simple quadtree from a list
                       of static instances ). This parameter defines maximum number
                       of instances in a single osg::Group in quadtree.
                       If, for example, you modify it to value=100, you will see
                       really big cull time in OSG statistics ( because resulting
                       tree generated by InstanceCell will be very deep ).
                       Default value = 4096 .
--export-objects     - write object geometries and quadtree of instances to osgt files
                       for later analysis.
--use-multi-draw     - use glMultiDrawArraysIndirect() instead of glDrawArraysIndirect() in a
                       draw shader. Thanks to this we may render all ( different ) objects
                       using only one draw call. Requires OpenGL version 4.3 and some more
                       work from me, because now it does not work ( probably I implemented
                       it wrong, or Windows NVidia driver has errors, because it hangs
                       the apllication at the moment ).

This application is inspired by Daniel Rákos work : "GPU based dynamic geometry LOD" that
may be found under this address : http://rastergrid.com/blog/2010/10/gpu-based-dynamic-geometry-lod/
There are however some differences :
- Daniel Rákos uses GL queries to count objects to render, while this example
  uses atomic counters ( no GPU->CPU roundtrip )
- this example does not use transform feedback buffers to store intermediate data
  ( it uses texture buffer objects instead ).
- I use only the vertex shader to cull objects, whereas Daniel Rákos uses vertex shader
  and geometry shader ( because only geometry shader can send more than one primitive
  to transform feedback buffers ).
- objects in the example are drawn using glDrawArraysIndirect() function,
  instead of glDrawElementsInstanced().

Finally there are some things to consider/discuss  :
- the whole algorithm exploits nice OpenGL feature that any GL buffer
  may be bound as any type of buffer ( in our example a buffer is once bound
  as a texture buffer object, and later is bound as GL_DRAW_INDIRECT_BUFFER ).
  osg::TextureBuffer class has one handy method to do that trick ( bindBufferAs() ),
  and new primitive sets use osg::TextureBuffer as input.
  For now I added new primitive sets to example ( DrawArraysIndirect and
  MultiDrawArraysIndirect defined in examples/osggpucull/DrawIndirectPrimitiveSet.h ),
  but if Robert will accept its current implementations ( I mean - primitive
  sets that have osg::TextureBuffer in constructor ), I may add it to
  osg/include/PrimitiveSet header.
- I used BufferTemplate class writen and published by Aurelien in submission forum
  some time ago. For some reason this class never got into osg/include, but is
  really needed during creation of UBOs, TBOs, and possibly SSBOs in the future.
  I added std::vector specialization to that template class.
- I needed to create similar osg::Geometries with variable number of vertices
  ( to create different LODs in my example ). For this reason I've written
  some code allowing me to create osg::Geometries from osg::Shape descendants.
  This code may be found in ShapeToGeometry.* files. Examples of use are in
  osggpucull.cpp . The question is : should this code stay in example, or should
  it be moved to osgUtil ?
- this remark is important for NVidia cards on Linux and Windows : if
  you have "Sync to VBlank" turned ON in nvidia-settings and you want to see
  real GPU times in OSG statistics window, you must set the power management
  settings to "Prefer maximum performance", because when "Adaptive mode" is used,
  the graphic card's clock may be slowed down by the driver during program execution
  ( On Linux when OpenGL application starts in adaptive mode, clock should work
  as fast as possible, but after one minute of program execution, the clock slows down ).
  This happens when GPU time in OSG statistics window is shorter than 3 ms.
"


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14531 16af8721-9629-0410-8352-f15c8da7e697
2014-11-25 10:58:23 +00:00
Robert Osfield
f06ea2bc6e Removed DrawArrays optimization to simplify the code and open the door to adding primitive combining.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14530 16af8721-9629-0410-8352-f15c8da7e697
2014-11-25 10:33:20 +00:00
Robert Osfield
79a4fff2dc Commented out State::setUpVertexAttribAlias(..) debug message.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14529 16af8721-9629-0410-8352-f15c8da7e697
2014-11-25 10:11:06 +00:00
Robert Osfield
53e337611a 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/trunk@14527 16af8721-9629-0410-8352-f15c8da7e697
2014-11-24 15:19:20 +00:00
Robert Osfield
86ddca4edb Added VertexAttribDivisor class to wrap up glVertexAttribDivisor function
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14526 16af8721-9629-0410-8352-f15c8da7e697
2014-11-24 14:54:39 +00:00
Robert Osfield
2a8d894168 Fixed osgsimplegl3 example's set up of the main camera.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14524 16af8721-9629-0410-8352-f15c8da7e697
2014-11-24 14:09:14 +00:00
Robert Osfield
fce7137525 Added numTextureUnits parameter to the osg::State::resetVertexAttributeAlias(bool, unit) method, and set the default to 8.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14523 16af8721-9629-0410-8352-f15c8da7e697
2014-11-24 14:01:05 +00:00
Robert Osfield
671d8dc342 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/trunk@14522 16af8721-9629-0410-8352-f15c8da7e697
2014-11-21 20:16:16 +00:00
Robert Osfield
a97f104ab6 Added comment clarifying how Image::getColor(..) out of 0..1 range texcoords are handled - now clamped to edge.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14520 16af8721-9629-0410-8352-f15c8da7e697
2014-11-21 20:15:30 +00:00
Robert Osfield
e51fd3d4fa Implemented a clamp to edge policy for the Image::g/setColor(color, texcoord).
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14519 16af8721-9629-0410-8352-f15c8da7e697
2014-11-21 17:22:30 +00:00
Robert Osfield
b37d6b1921 Added testing for Drawables in the CopyOp::operator(Node*) to replicate the old functionality.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14518 16af8721-9629-0410-8352-f15c8da7e697
2014-11-21 17:17:11 +00:00
Robert Osfield
e67466a74f From Sebastian Messerschmidt, "Added setColor function to modify an image based on texture coordinates, parallel to the getColor functionality."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14517 16af8721-9629-0410-8352-f15c8da7e697
2014-11-21 16:27:29 +00:00
Robert Osfield
f49d7ae110 Added --db-affinit cpuNum option to osgterrain example to illustrate how to set the thead affinity of the DatabasePager threads.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14516 16af8721-9629-0410-8352-f15c8da7e697
2014-11-21 14:46:08 +00:00
Robert Osfield
c71016bd3c From Sebastian Messerschmidt, "Attached you find a change adding a getNumSamples() function to retrieve the value set via setNumSamples."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14515 16af8721-9629-0410-8352-f15c8da7e697
2014-11-21 10:44:01 +00:00
Robert Osfield
b9a529148a From Rafa Gaitan, "I finally had some time to change the build system for Android using a Toolchain, which, I think, will be easier to maintain and uses cmake standard system to build it.
My changes:
-------------------
- I changed the cmake files and added a toolchain for building OSG in Android. The toolchain is based on the one used at OpenCV. For building OSG for android you just need to do:

    mkdir build_android_static_gles2 && cd build_android_static_gles2
    cmake .. -DANDROID_NDK=<path-to-the-android-ndk>
                  -DCMAKE_TOOLCHAIN_FILE=../PlatformSpecifics/Android/android.toolchain.cmake
                  -DOPENGL_PROFILE="GLES2"
                  -DDYNAMIC_OPENTHREADS=OFF
                  -DDYNAMIC_OPENSCENEGRAPH=OFF
                  -DANDROID_NATIVE_API_LEVEL=15 # optional
                  -DANDROID_ABI=armeabim #optional
                  -DCMAKE_INSTALL_PREFIX=<path-to-the-install-path> #optional
make -j 8
make install

    The OPENGL_PROFILE works as expected, changing it to "GLES1" it builds and links OSG using GLES1.
    The DYNAMIC_OPENTHREADS/DYNAMIC_OPENSCENEGRAPH parameters also allows to build the dynamic libraries

- I also added some build fixes for android related to the texture formats and added some missing USE_OSG_SERIALIZER_WRAPPER in the osg serializer library to support loading osgb files in static."


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14514 16af8721-9629-0410-8352-f15c8da7e697
2014-11-21 10:37:33 +00:00
Robert Osfield
2986df22d6 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/trunk@14513 16af8721-9629-0410-8352-f15c8da7e697
2014-11-21 10:21:46 +00:00
Robert Osfield
5da4e80e95 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/trunk@14510 16af8721-9629-0410-8352-f15c8da7e697
2014-11-20 17:37:52 +00:00
Robert Osfield
f8c4ad4b90 From Pjotr Svetachov, "I was experimenting with VBO's to try to get them on par with display
lists when drawing lots of batches and noticed that my program
generated a lot of unneeded glClientActiveTexture calls. Digging
deeper I found out it came from State::disableTexCoordPointer where
the function would call glClientActiveTexture but not
glDisableClientState because the geometry didn't have texture
coordinates for that channel. This is because in our scene there are
some geometries that have move than one uv channels making
State::_texCoordArrayList grow. Then the method
State::applyDisablingOfVertexAttributes() will call
disableTexCoordPointer multiple times.

I rearrange the method a little to combat this. Now the logic has the
same ordering as disableTexCoordPointersAboveAndIncluding which
already combats this."


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14508 16af8721-9629-0410-8352-f15c8da7e697
2014-11-20 17:00:14 +00:00
Robert Osfield
834c940db1 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/trunk@14507 16af8721-9629-0410-8352-f15c8da7e697
2014-11-20 16:38:23 +00:00
Robert Osfield
600e98773e 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/trunk@14505 16af8721-9629-0410-8352-f15c8da7e697
2014-11-20 10:52:24 +00:00
Robert Osfield
2da766ff1b 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/trunk@14503 16af8721-9629-0410-8352-f15c8da7e697
2014-11-20 10:45:05 +00:00
Robert Osfield
1e75ca63f4 From Christian Ruzicka, "while testing this commit on our OSG 3.2 version, I observed that the changes for ETC2 brake ETC1 support. Attached you'll find the changes to get ETC1 running again"
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14501 16af8721-9629-0410-8352-f15c8da7e697
2014-11-20 10:05:52 +00:00
Robert Osfield
cf7258e03a 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/trunk@14500 16af8721-9629-0410-8352-f15c8da7e697
2014-11-20 09:55:50 +00:00
Robert Osfield
b4354df6fb Fixed segfalt in Texture2DArray copy constructor where it would apply images to an uninitialzed vector.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14498 16af8721-9629-0410-8352-f15c8da7e697
2014-11-20 09:41:27 +00:00
Robert Osfield
7ae45b7ac2 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/trunk@14495 16af8721-9629-0410-8352-f15c8da7e697
2014-11-20 09:32:38 +00:00
Robert Osfield
f3859f6d11 From Pjotr Svetachov, fix for build breakage with giflib 5.0.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14493 16af8721-9629-0410-8352-f15c8da7e697
2014-11-20 09:21:52 +00:00
Robert Osfield
f0882eda6b From Per Nordqvist, "The README.txt is still somewhat confusing so I have updated it"
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14491 16af8721-9629-0410-8352-f15c8da7e697
2014-11-20 08:26:34 +00:00
Robert Osfield
aa17d70853 Removed configure script as it's no longer required as cmake . will now default to Release
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14490 16af8721-9629-0410-8352-f15c8da7e697
2014-11-19 17:45:45 +00:00
Robert Osfield
f3eb245e98 Added CMake script to set the default CMAKE_BUILD_TYPE to Release. Approach taken from simgear.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14489 16af8721-9629-0410-8352-f15c8da7e697
2014-11-19 17:42:11 +00:00
Robert Osfield
a08b3104a8 Fixed Contributors names
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14486 16af8721-9629-0410-8352-f15c8da7e697
2014-11-19 17:29:15 +00:00
Robert Osfield
43bdd32242 From Clement Boesch, "Fix remaining bit of Giflib5 usage"
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14485 16af8721-9629-0410-8352-f15c8da7e697
2014-11-19 17:10:21 +00:00
Robert Osfield
3dd9f8d430 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/trunk@14484 16af8721-9629-0410-8352-f15c8da7e697
2014-11-19 11:37:37 +00:00
Robert Osfield
34863fe2d2 From Wang Rui, "The submission includes some fixes for osgQt library and osgQtWidgets example: (1) QTextEdit now works with mouse/drag events, (2) scrollbars will change when OSG window is resizing, (3) improve rendering efficiency of QGraphicsViewAdapter so that it works with complex Qt UI, (4) add new setBackgroundWidget() method to indicate a 'background widget', which will ignore mouse/key events on it and pass them to the 3D scene."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14482 16af8721-9629-0410-8352-f15c8da7e697
2014-11-19 11:30:53 +00:00
Robert Osfield
5f45a39f28 Changed the way that the cell size is passed to the shader
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14481 16af8721-9629-0410-8352-f15c8da7e697
2014-11-19 10:43:07 +00:00
Robert Osfield
5ab861cd04 From James Turner, "Converting the loops to forward versions fixed the issue. The problem is size_t is unsigned; at the limit condition it doesn’t go negative but wraps around to 0xffffffffffffffff …. and boom."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14480 16af8721-9629-0410-8352-f15c8da7e697
2014-11-19 09:33:53 +00:00
Robert Osfield
f40df07ec7 Fixed typo
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14478 16af8721-9629-0410-8352-f15c8da7e697
2014-11-17 15:43:26 +00:00
Robert Osfield
ab47842d6d Fixed typo in comment
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14477 16af8721-9629-0410-8352-f15c8da7e697
2014-11-17 09:19:38 +00:00
Robert Osfield
6661deeb24 Added use of GL_TRIANGLE_STRIP to cut down the size of the primitive indices required.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14476 16af8721-9629-0410-8352-f15c8da7e697
2014-11-14 17:44:20 +00:00
Robert Osfield
bff5b0261b Implemented skirt functionality
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14475 16af8721-9629-0410-8352-f15c8da7e697
2014-11-14 16:47:32 +00:00
Robert Osfield
25cfb81a09 Refactored the handling of use of the osgDB::ObjectCache in the DatabasePager to use a local thread specific ObjectCache to handle new additions and
then have these additions merged with the main Registry ObjectCache during the main loop.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14474 16af8721-9629-0410-8352-f15c8da7e697
2014-11-13 09:40:11 +00:00
Robert Osfield
ed28ec97c7 Moved implementation of ObjectCache functionality out of Registry into a dedicated osgDB::ObjectCache class.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14473 16af8721-9629-0410-8352-f15c8da7e697
2014-11-11 18:28:07 +00:00
Robert Osfield
0e9c93f335 To handle thread safe paging and use of the osgDB::Registry ObjectCache, moved the handling of cache into osgDB::DatabasePager.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14472 16af8721-9629-0410-8352-f15c8da7e697
2014-11-10 16:04:43 +00:00
Robert Osfield
14620aa1dd From Pjotr Svetachov, "I tried your fix and it exposed a bug in my fix :)
The problem is that the readObjectFields method will add the object to the _identifierMap. So all the other instances of that image in the same file will be replaced by the created dummy object. In my fix this was an dummy image and I didn't notice it in our scene's, probably because it covered a small part of an object. In your fix the dummy object was not an image and that leads to a crash when something tries to use it as an image. I have attached a small fix for this bug.

"


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14471 16af8721-9629-0410-8352-f15c8da7e697
2014-11-06 10:44:27 +00:00
Robert Osfield
a84df15c0a Introduced use of MarkerObject to IncrmentalCompileOperation/DatabasePager as a way of marking objects that have already been processed and compiled,
thus avoid potential threading conflicts when paged subgraphs are reused.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14470 16af8721-9629-0410-8352-f15c8da7e697
2014-11-06 10:40:54 +00:00
Robert Osfield
7f592b7ad5 Added handling of the reading of field properties to a dummy object for cached images to avoid threading issues associated with reusing and modifying an active object.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14469 16af8721-9629-0410-8352-f15c8da7e697
2014-11-05 16:08:42 +00:00
Robert Osfield
9cda04e51f Reinstated the original mechanism for OperationThread::cancel() that co-operatively releases blocks/barriers to make sure the thread is able to exit correctly.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14468 16af8721-9629-0410-8352-f15c8da7e697
2014-11-05 13:38:50 +00:00
Robert Osfield
7a33cc00cd Improvements to the ShaderTerrain experiemental terrain rendering technique.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14466 16af8721-9629-0410-8352-f15c8da7e697
2014-11-04 20:07:40 +00:00
Robert Osfield
1a265f53f7 Changed TerrainTile::setDirty() to use children needing update traversal mechanism to address threadng issues.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14465 16af8721-9629-0410-8352-f15c8da7e697
2014-11-04 20:07:15 +00:00
Robert Osfield
5177298dad Change isRunning variable to an Atomic to address possible race condition asscoiated with reading and writing to the variable from different threads.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14464 16af8721-9629-0410-8352-f15c8da7e697
2014-11-04 20:06:05 +00:00
Robert Osfield
de0664ef77 Build fixes for ffmpeg LIBAVCODEC_VERSION_MAJOR >= 56
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14462 16af8721-9629-0410-8352-f15c8da7e697
2014-11-04 16:29:30 +00:00
Robert Osfield
aa962724e8 Added an InitRegistry static intiialization and destrucion static to help control the order of construction and destruction of the osgDB::Registry.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14461 16af8721-9629-0410-8352-f15c8da7e697
2014-11-04 11:18:42 +00:00
Robert Osfield
28a676e105 Replaced use of while(isRunning()) { YieldCurrentThread(); } style loops with use of join() to avoid false positives being reported by valgrind when using the helgrind tool for thread debugging.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14460 16af8721-9629-0410-8352-f15c8da7e697
2014-11-04 10:46:59 +00:00
Robert Osfield
997ee30039 Added experimental osgTerrain::ShaderTerrain TerrainTechnique to osgterrain example to flesh out new shader based displacement mapping approach to osgTerrain databases.
Requires shader files place in OpenSceneGraph-Data/shaders from OpenSceneGraph-Data's svn/trunk to function.

Run osgterrain example with --shader command line option to select displacement mapping shader approach.



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14458 16af8721-9629-0410-8352-f15c8da7e697
2014-10-21 15:08:44 +00:00
Robert Osfield
174c161daa Removed --sync related code as it's now integrated into osg::DisplaySettings and osgViewer
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14457 16af8721-9629-0410-8352-f15c8da7e697
2014-10-21 14:47:43 +00:00
Robert Osfield
4c1fd06252 Added osg::SyncSwapBuffersCallback to include/osg/GraphicsContext and support for enabling it to include/osg/DisplaySettings, and to the Viewer/CompositeViewer::realize() methods.
To enable the sync of swap buffers set the env var OSG_SYNC_SWAP_BUFFERS to ON or 1, to switch off set to OFF or 0.

One can also use the --sync command line option for application that pass on command line options to the osg::DisplaySettings::instance().


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14456 16af8721-9629-0410-8352-f15c8da7e697
2014-10-21 14:46:12 +00:00
Robert Osfield
fec06828cf Removed checks against Drawable as these are no longer required.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14455 16af8721-9629-0410-8352-f15c8da7e697
2014-10-21 08:27:28 +00:00
Robert Osfield
68c4eaaff1 Added support for writing the file path of a script to the lua package.path to help with loading scripts within lua.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14451 16af8721-9629-0410-8352-f15c8da7e697
2014-09-17 17:40:07 +00:00
Robert Osfield
acbad2424e Changed osgvolume example to use the new tf plugin rather than having local code for reading transfer function
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14450 16af8721-9629-0410-8352-f15c8da7e697
2014-09-16 17:40:13 +00:00
Robert Osfield
f3ba656303 Added write support
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14449 16af8721-9629-0410-8352-f15c8da7e697
2014-09-16 11:00:01 +00:00
Robert Osfield
e35b0796d6 Added .tf & .tf-255 plugin for reading ascii 1D transfer functon files in support for volume rendering.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14448 16af8721-9629-0410-8352-f15c8da7e697
2014-09-15 17:53:44 +00:00
Robert Osfield
e97059df78 Added basic frame rendering for TabWidget
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14446 16af8721-9629-0410-8352-f15c8da7e697
2014-09-12 14:16:08 +00:00
Robert Osfield
e3a3ae6de6 Improved the alignment and sizing of TabWidget tab headers
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14445 16af8721-9629-0410-8352-f15c8da7e697
2014-09-10 17:03:27 +00:00
Robert Osfield
fafe06acbf Implemented the selection of tabs by clicking, using mouse wheel or arrow keys.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14443 16af8721-9629-0410-8352-f15c8da7e697
2014-09-10 11:59:51 +00:00
Robert Osfield
6b82d4099f Improved the handling of the dialog title text
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14442 16af8721-9629-0410-8352-f15c8da7e697
2014-09-09 16:12:59 +00:00
Robert Osfield
57a42aac39 Moved the diaglog title bar widgets into the Widget::GraphicsSubgraph map to avoid them poluting the Dialog's children list and to prevent them from being serialized.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14441 16af8721-9629-0410-8352-f15c8da7e697
2014-09-09 15:14:35 +00:00
Robert Osfield
e93e7ca1f2 Introduced Widget::WidgetStateSet to help localize the StateSet set up by Widget implementations from being serialized or
affecting what end users apply via the standard Node::s/getStateSet().

Further work on TabWidget.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14440 16af8721-9629-0410-8352-f15c8da7e697
2014-09-09 13:37:33 +00:00
Robert Osfield
0db0bcdd5e Build fix
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14439 16af8721-9629-0410-8352-f15c8da7e697
2014-09-08 08:53:23 +00:00
Robert Osfield
23b8131ae5 Added shell of new osgUI::TabWidget class
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14438 16af8721-9629-0410-8352-f15c8da7e697
2014-09-05 16:04:11 +00:00
Robert Osfield
9e9fe9b9c9 Introduced support for specifying whether a serializer supports different types of usage - one or more of READ_WRITE_PROPERTY, GET_PROPERTY and SET_PROPERTY.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14437 16af8721-9629-0410-8352-f15c8da7e697
2014-09-05 11:05:43 +00:00
Robert Osfield
21fc2fae8d Added setting of the IsoSurfaceProperty in VolumeSettings
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14436 16af8721-9629-0410-8352-f15c8da7e697
2014-09-03 15:54:47 +00:00
Robert Osfield
4f6dbf5623 Added close button on Dialog title bar
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14435 16af8721-9629-0410-8352-f15c8da7e697
2014-09-03 12:28:04 +00:00
Robert Osfield
1e9722601c Refactored the handling of ComboBox item picking to make it faster and more reliable
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14433 16af8721-9629-0410-8352-f15c8da7e697
2014-09-02 17:01:44 +00:00
Robert Osfield
959d78f755 Improved handling of ComboBox popup toggling
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14432 16af8721-9629-0410-8352-f15c8da7e697
2014-09-02 10:00:33 +00:00
Robert Osfield
30f4568f7b Added support for scaling widgets via the scoll wheel.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14431 16af8721-9629-0410-8352-f15c8da7e697
2014-09-02 09:14:08 +00:00
Robert Osfield
90c787a56a Removed debugging message
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14430 16af8721-9629-0410-8352-f15c8da7e697
2014-09-02 08:41:31 +00:00
Robert Osfield
5633fa1247 Added DragCallback class to help dialog dragging support.
Introduced a new Widget::computeExtentsPositionInLocalCoordinates() method that intersects with a ray through mouse pointer and the extents of the widget.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14429 16af8721-9629-0410-8352-f15c8da7e697
2014-09-01 19:13:35 +00:00
Robert Osfield
baf139c75b Improved support for controlling the ShadingModel via the VolumeSettings object
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14428 16af8721-9629-0410-8352-f15c8da7e697
2014-08-28 15:11:29 +00:00
Robert Osfield
d97081fe7f Improved handling of VolumeSettings
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14427 16af8721-9629-0410-8352-f15c8da7e697
2014-08-28 09:42:01 +00:00
Robert Osfield
2f10db8f11 Changed the osgUI behaviour so that events are set to be handled by Widgets that have focus even if they don't directly use them.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14425 16af8721-9629-0410-8352-f15c8da7e697
2014-08-27 15:08:48 +00:00
Robert Osfield
77c0f5f675 Changed the NodeVisitor::apply(Drawable&) to call apply(Node&)
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14424 16af8721-9629-0410-8352-f15c8da7e697
2014-08-27 15:07:47 +00:00
Robert Osfield
f6cc4440a1 Added support for getting osgVolumre::Property::ModifieCount
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14422 16af8721-9629-0410-8352-f15c8da7e697
2014-08-27 09:25:54 +00:00
Robert Osfield
d1bf811331 Added Property::getModifiedCount() + dirty() to help with tracking changes. Added VolumeSettings serializers for Property objects
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14421 16af8721-9629-0410-8352-f15c8da7e697
2014-08-25 16:56:47 +00:00
Robert Osfield
6126379362 Changed StateSet::ParentList from vector<Object*> to vector<Node*> to reflect that Drawable is now a Node.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14420 16af8721-9629-0410-8352-f15c8da7e697
2014-08-25 13:43:11 +00:00
Robert Osfield
beeda386ef Improved handling of setting of the depth of the UI.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14418 16af8721-9629-0410-8352-f15c8da7e697
2014-08-22 19:00:53 +00:00
Robert Osfield
d4260ddb18 Reordered method implemenations to make it easier to compare similar methods
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14417 16af8721-9629-0410-8352-f15c8da7e697
2014-08-20 14:15:36 +00:00
Robert Osfield
a53e73ba10 Added toggling on/off of the VolumeSettings ui via the 'E' key.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14416 16af8721-9629-0410-8352-f15c8da7e697
2014-08-19 16:58:02 +00:00
Robert Osfield
e3c445a52f Updated VolumeSettings.lua reference to use ui prefix to work with the new OpenSceneGraph-Data/ui/VolumeSettings.lua file.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14415 16af8721-9629-0410-8352-f15c8da7e697
2014-08-19 16:37:20 +00:00
Robert Osfield
7e4b41e41a Fixed MD2 danglng pointer crash.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14413 16af8721-9629-0410-8352-f15c8da7e697
2014-08-19 09:27:46 +00:00
Robert Osfield
2032be209a Fixed build
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14411 16af8721-9629-0410-8352-f15c8da7e697
2014-08-19 09:00:42 +00:00
Robert Osfield
818e1393ec Fixed build
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14410 16af8721-9629-0410-8352-f15c8da7e697
2014-08-19 08:57:23 +00:00
Robert Osfield
f28d460caa Added support for ComboBox::currentIndexChanged*(uint) callback API.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14409 16af8721-9629-0410-8352-f15c8da7e697
2014-08-14 19:00:37 +00:00
Robert Osfield
5f74fdc326 Resert default value to 1.0
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14408 16af8721-9629-0410-8352-f15c8da7e697
2014-08-13 09:24:38 +00:00
Robert Osfield
f0125da6fd 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/trunk@14407 16af8721-9629-0410-8352-f15c8da7e697
2014-08-08 16:42:32 +00:00
Robert Osfield
af5685bf28 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/trunk@14405 16af8721-9629-0410-8352-f15c8da7e697
2014-08-08 16:34:12 +00:00
Robert Osfield
89786dd42a 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/trunk@14403 16af8721-9629-0410-8352-f15c8da7e697
2014-08-08 16:09:39 +00:00
Robert Osfield
973ac76197 From Glen Waldron, "Node: patch for remove*Callback() methods to resolve a crash"
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14401 16af8721-9629-0410-8352-f15c8da7e697
2014-08-08 15:45:54 +00:00
Robert Osfield
99cbab1806 Changes to support building against ANDROID under OSX.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14399 16af8721-9629-0410-8352-f15c8da7e697
2014-08-08 09:28:26 +00:00
Robert Osfield
fdd9efe45a Implemented osgUI::Validator, IntValidator and DoubleValidator classes that manage validation/specialization of LineEdit widgets to work with just integer or double values.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14398 16af8721-9629-0410-8352-f15c8da7e697
2014-08-05 18:32:45 +00:00
Robert Osfield
0335e9c63a Implemented callbacks for validate(), textChanged() and returnPressed()
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14397 16af8721-9629-0410-8352-f15c8da7e697
2014-08-01 13:07:38 +00:00
Robert Osfield
ff78d30cee Moved responsiblity for checking current event focus onto Widget::handleImplementations().
Added support for closing CombinBox popup when the mouse is clicked outside the popup or combobox widget.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14396 16af8721-9629-0410-8352-f15c8da7e697
2014-08-01 10:57:24 +00:00
Robert Osfield
e979f76156 Added NodeVisitor::INTERSECTION_VISITOR VisitorType
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14395 16af8721-9629-0410-8352-f15c8da7e697
2014-07-31 18:29:31 +00:00
Robert Osfield
899e359cdb Fixed rendering of Popups
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14394 16af8721-9629-0410-8352-f15c8da7e697
2014-07-30 12:48:28 +00:00
Robert Osfield
cbfcac6f63 Update SO version to account for new changes to osg::StateSet and osgUI
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14393 16af8721-9629-0410-8352-f15c8da7e697
2014-07-30 12:47:45 +00:00
Robert Osfield
0bdd7351f6 Added StateSet::RenderBinMode::PROTECTED_RENDERBIN_DETAILS and OVERRIDE_PROTECTED_RENDERBIN_DETAILS options.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14392 16af8721-9629-0410-8352-f15c8da7e697
2014-07-30 12:47:16 +00:00
Robert Osfield
46440ad0a8 Added preliminary icon to ComboBox.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14391 16af8721-9629-0410-8352-f15c8da7e697
2014-07-29 15:50:55 +00:00
Robert Osfield
a3794f3bd3 Fixed debug comment
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14390 16af8721-9629-0410-8352-f15c8da7e697
2014-07-29 15:50:37 +00:00
Robert Osfield
90e58f66c0 Implemented prelimary icon support allowing UI widget to place image and model based icons on widgets
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14389 16af8721-9629-0410-8352-f15c8da7e697
2014-07-29 15:50:07 +00:00
Robert Osfield
839dbb1bc1 Added catch for NULL Transform pointers getting into the _transformMap.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14388 16af8721-9629-0410-8352-f15c8da7e697
2014-07-29 15:47:55 +00:00
Robert Osfield
e65d03bf27 Added handling of Drawables added directly to scene graph without Geode decorating them.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14386 16af8721-9629-0410-8352-f15c8da7e697
2014-07-28 16:19:44 +00:00
Robert Osfield
23ae292fe2 Added support for changing background colour of LineEdit widget when focus changes
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14385 16af8721-9629-0410-8352-f15c8da7e697
2014-07-24 14:14:35 +00:00
Robert Osfield
cbd2d6e434 Refined the colouring of widget to be more in sync with the defaults used in Qt.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14384 16af8721-9629-0410-8352-f15c8da7e697
2014-07-24 13:25:49 +00:00
Robert Osfield
3a7942dfb7 Added VolumeSettings::Filename property.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14383 16af8721-9629-0410-8352-f15c8da7e697
2014-07-23 16:36:17 +00:00
Robert Osfield
aa2c9c152f Changed the default text colour to black
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14382 16af8721-9629-0410-8352-f15c8da7e697
2014-07-23 15:57:35 +00:00
Robert Osfield
900534f86e Added writeFile support
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14381 16af8721-9629-0410-8352-f15c8da7e697
2014-07-23 14:50:42 +00:00
Robert Osfield
5130361d65 Added Node:getNumParents() and Node:getParent(index) support
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14380 16af8721-9629-0410-8352-f15c8da7e697
2014-07-23 10:49:27 +00:00
Robert Osfield
7dc3b34bfd Removed State::AppliedProgramObjectSet container and Obsever usage from osg::State to address threading bug crash.
The State::AppliedProgramObjectSet wasn't ever being used actively in the current rev of the OSG so populating and clearing was no longer neccessary, allowing the code to be removed completely.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14377 16af8721-9629-0410-8352-f15c8da7e697
2014-07-22 16:02:33 +00:00
Robert Osfield
3b23b474dc Centralized the calling of #include <stdint.h> and VS fallback into include/osg/Types header
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14376 16af8721-9629-0410-8352-f15c8da7e697
2014-07-21 16:36:47 +00:00
Robert Osfield
d3945d5210 From Pjotr Svetachov, "I think I spotted some unneeded ref_ptrs in the cullvisitor. The call
pushModelViewMatrix or pushProjectionMatrix will already keep the
reference when adding it to the MatrixStack. In CullVisitor::apply
methods for the billboard and the camera you already take a pointer
instead of a ref_ptr."


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14375 16af8721-9629-0410-8352-f15c8da7e697
2014-07-21 14:32:40 +00:00
Robert Osfield
6bb2251faf Added setting of glPixelStore before glTexSubImage2D call.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14374 16af8721-9629-0410-8352-f15c8da7e697
2014-07-21 13:45:58 +00:00
Robert Osfield
8f39d7a2b2 From Jaap Gas, "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/trunk@14372 16af8721-9629-0410-8352-f15c8da7e697
2014-07-21 13:43:11 +00:00
Robert Osfield
20560bd927 Initial work on integtasting osgUI into Present3D
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14370 16af8721-9629-0410-8352-f15c8da7e697
2014-07-21 12:21:42 +00:00
Robert Osfield
93938439d9 Fixed indentation
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14369 16af8721-9629-0410-8352-f15c8da7e697
2014-07-21 12:18:43 +00:00
Robert Osfield
0f611144d7 Added debug messages
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14368 16af8721-9629-0410-8352-f15c8da7e697
2014-07-21 09:35:00 +00:00
Robert Osfield
acb497b2ab Added serailizer support for NodeVisitor, UpdateVisitor, CullVisitor and EventVisitor
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14367 16af8721-9629-0410-8352-f15c8da7e697
2014-07-18 17:17:01 +00:00
Robert Osfield
50e63ad3ee Added readScript/writeScript methods to ReaderWriter
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14366 16af8721-9629-0410-8352-f15c8da7e697
2014-07-14 15:59:06 +00:00
Robert Osfield
5a7a20d01e Renamed osgDB::PropertyInterface to osgDB::ClassInterface to better reflect it's functionality
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14365 16af8721-9629-0410-8352-f15c8da7e697
2014-07-14 14:09:08 +00:00
Robert Osfield
f2d11bb46e Added preliminary support for writing VolumeSettings to disk from within Present3D in response to pressing and releasing 'Ctrl-S'.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14363 16af8721-9629-0410-8352-f15c8da7e697
2014-07-04 16:45:05 +00:00
Robert Osfield
70f9bdc6e1 Updated iso and mip shaders from OpenSceneGraph-Data.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14358 16af8721-9629-0410-8352-f15c8da7e697
2014-07-03 16:36:02 +00:00
Robert Osfield
d981ca416e Added virtual destructors
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14351 16af8721-9629-0410-8352-f15c8da7e697
2014-07-03 13:06:23 +00:00
Robert Osfield
3f637584f5 Fixed line endings
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14350 16af8721-9629-0410-8352-f15c8da7e697
2014-07-03 13:05:09 +00:00
Robert Osfield
7a18876c5b Changed enum usage to use the new osgVolume::VolumeSettings versions and added support for reading a VolumeSettings file.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14349 16af8721-9629-0410-8352-f15c8da7e697
2014-07-03 13:01:05 +00:00
Robert Osfield
3c6a1ec117 Refactor VolumeSettings so that it's subclassed from osgVolume::Property
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14348 16af8721-9629-0410-8352-f15c8da7e697
2014-07-03 10:01:46 +00:00
Robert Osfield
c4f199d1b5 Added osgVolume::VolumeSettings object
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14347 16af8721-9629-0410-8352-f15c8da7e697
2014-07-02 16:26:18 +00:00
Robert Osfield
b8dbebeca7 Changed the default image output format to .osgb as .dds isn't able to represent signed byte, short and int data correctly.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14346 16af8721-9629-0410-8352-f15c8da7e697
2014-07-02 15:34:37 +00:00
Robert Osfield
7bacd73e85 fixed handlng of file type of nested files within a .osgx, .osgt and .osgb file.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14344 16af8721-9629-0410-8352-f15c8da7e697
2014-07-02 14:14:53 +00:00
Robert Osfield
d4c4bee020 From Laurens Voerman, "just like ClusterCullingCallback (fixed in r14322) visual studio likes an explicit implementation of run() for InteractiveImageHandler.
The warning is (14 times):
include\osgViewer/ViewerEventHandlers(542): warning C4250: 'osgViewer::InteractiveImageHandler' : inherits 'osgGA::EventHandler::osgGA::EventHandler::run' via dominance (src\osgViewer\StatsHandler.cpp)
          include\osgGA/EventHandler(45) : see declaration of 'osgGA::EventHandler::run'


attached a zipped version of include\osgViewer\ViewerEventHandlers"


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14343 16af8721-9629-0410-8352-f15c8da7e697
2014-07-02 10:25:29 +00:00
Robert Osfield
48c9816c38 Added #include <stdint.h> to address compile issue on some Linux distro's.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14341 16af8721-9629-0410-8352-f15c8da7e697
2014-07-01 07:31:46 +00:00
Robert Osfield
43a068b156 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/trunk@14339 16af8721-9629-0410-8352-f15c8da7e697
2014-06-30 15:31:36 +00:00
Robert Osfield
45bea0db4b REmoved debug cout
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14338 16af8721-9629-0410-8352-f15c8da7e697
2014-06-30 13:24:41 +00:00
Robert Osfield
bb8b1538c7 From Mikhail Izmestev, "Attached fix to avoid vector reallocs on push_back in StateGraph::moveStateGraph."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14334 16af8721-9629-0410-8352-f15c8da7e697
2014-06-30 10:13:19 +00:00
Robert Osfield
147c5e183f Updated ChangeLog and AUTHORS file
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14332 16af8721-9629-0410-8352-f15c8da7e697
2014-06-30 09:12:14 +00:00
Robert Osfield
9d5a510441 Updated version number
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14331 16af8721-9629-0410-8352-f15c8da7e697
2014-06-30 08:56:08 +00:00
Robert Osfield
5fb078b4f1 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/trunk@14329 16af8721-9629-0410-8352-f15c8da7e697
2014-06-30 08:46:54 +00:00
Robert Osfield
1581699022 Removed space from #include.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14326 16af8721-9629-0410-8352-f15c8da7e697
2014-06-30 08:20:30 +00:00
Robert Osfield
4c18eb62ca 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/trunk@14323 16af8721-9629-0410-8352-f15c8da7e697
2014-06-30 07:37:06 +00:00
Robert Osfield
7a14b224ed Replaced using NodeCallback::run with explict run() implementation.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14322 16af8721-9629-0410-8352-f15c8da7e697
2014-06-28 06:22:47 +00:00
Robert Osfield
555c935ffd From Pjotr Svetachov, "I made a small change to DataOutputStream.cpp which makes saving Geodes possible again. This is only half a fix as it only will save a Drawable that is part of a Geode. But this change does not require a version bump of the .ive format. I tried it with a few datasets we have here with the 3.2 stable branch and the trunk with this patch and there was no difference in the .ive files that were produced."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14319 16af8721-9629-0410-8352-f15c8da7e697
2014-06-27 15:57:34 +00:00
Robert Osfield
1d4fbbce1f Removed unused method.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14318 16af8721-9629-0410-8352-f15c8da7e697
2014-06-27 15:55:05 +00:00
Robert Osfield
e9728042b9 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/trunk@14315 16af8721-9629-0410-8352-f15c8da7e697
2014-06-27 15:48:38 +00:00
Robert Osfield
23ae2acf73 Updated AUTHORS file
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14313 16af8721-9629-0410-8352-f15c8da7e697
2014-06-27 15:39:05 +00:00
Robert Osfield
f42ac7e15b Added an OSG_INIT_SINGLETON_PROXY to make sure that the ApplicationUsage singleton gets intialized before usage.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14312 16af8721-9629-0410-8352-f15c8da7e697
2014-06-27 15:38:52 +00:00
Robert Osfield
32e0e21013 Updated AUTHORS file
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14310 16af8721-9629-0410-8352-f15c8da7e697
2014-06-27 15:36:47 +00:00
Robert Osfield
8d6bee6da9 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/trunk@14309 16af8721-9629-0410-8352-f15c8da7e697
2014-06-27 15:30:56 +00:00
Robert Osfield
d994e84288 Update ChangeLog for dev release
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14306 16af8721-9629-0410-8352-f15c8da7e697
2014-06-26 15:54:47 +00:00
Robert Osfield
92d684de6b Revised KdTreeBuilder so that is used the new apply(osg::Geometry&) method rather than expanding an osg::Geode.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14303 16af8721-9629-0410-8352-f15c8da7e697
2014-06-26 14:16:11 +00:00
Robert Osfield
a21ce3469b 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/trunk@14302 16af8721-9629-0410-8352-f15c8da7e697
2014-06-26 11:49:59 +00:00
Robert Osfield
67f98edc05 From Lauren 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/trunk@14300 16af8721-9629-0410-8352-f15c8da7e697
2014-06-26 11:11:59 +00:00
Robert Osfield
93cf84da3e Removed erroneous character
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14298 16af8721-9629-0410-8352-f15c8da7e697
2014-06-26 11:09:46 +00:00
Robert Osfield
febcb25cb6 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/trunk@14296 16af8721-9629-0410-8352-f15c8da7e697
2014-06-26 10:53:18 +00:00
Robert Osfield
138ea0e0c7 From Pjotr Svetachov, "For a scene with a lot of animated agents I did some small
optimizations to reduce cpu overhead:
1) Avoid a load-hit-store in UpdateBone. b->getMatrixInBoneSpace()
returns the same matrix that was just stored with b->setMatrix()
2) Avoid calling element->isIdentity() for the whole transform stack
(can be expensive is element is a matrix)
3) Make the key frame interpolator use binary search instead of a
linear one. This is very noticeable in scenes where some geometry has
long repeating animations that start at the same time, you will see
the update time grow then reset and grow again."


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14294 16af8721-9629-0410-8352-f15c8da7e697
2014-06-26 10:45:07 +00:00
Robert Osfield
ed314c6d7d 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/trunk@14293 16af8721-9629-0410-8352-f15c8da7e697
2014-06-26 10:24:41 +00:00
Robert Osfield
d82131544b 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.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14290 16af8721-9629-0410-8352-f15c8da7e697
2014-06-26 10:05:53 +00:00
Robert Osfield
d939adeb56 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/trunk@14288 16af8721-9629-0410-8352-f15c8da7e697
2014-06-26 09:38:56 +00:00
Robert Osfield
2428e07f35 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/trunk@14287 16af8721-9629-0410-8352-f15c8da7e697
2014-06-26 09:33:56 +00:00
Robert Osfield
86ddbc7ad9 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/trunk@14285 16af8721-9629-0410-8352-f15c8da7e697
2014-06-25 16:05:56 +00:00
Robert Osfield
aac0a5fbe2 From Auelien Albert, "I'm working on an application which use 3ds file format as input and use the name of the material to "map" specific data with 3d geometry.
The osg 3ds plugin modify the exported materials name in the same way it modifies the node names.

I've added an option to preserve originals materials names, with the assurance of unique material names are preserved."


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14283 16af8721-9629-0410-8352-f15c8da7e697
2014-06-25 15:55:21 +00:00
Robert Osfield
a2db511c99 Refactored the way that hole are pruned from the occluder hole list.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14282 16af8721-9629-0410-8352-f15c8da7e697
2014-06-25 15:47:59 +00:00
Robert Osfield
1674692840 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/trunk@14280 16af8721-9629-0410-8352-f15c8da7e697
2014-06-25 11:07:59 +00:00
Robert Osfield
5c488d4c46 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/trunk@14277 16af8721-9629-0410-8352-f15c8da7e697
2014-06-25 10:45:18 +00:00
Robert Osfield
4e530a1938 changed debug message to use OSG_DEBUG
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14276 16af8721-9629-0410-8352-f15c8da7e697
2014-06-25 09:58:49 +00:00
Robert Osfield
d22f62396c From Alexander Sinditskiy, "My changes added support for gltexstorrage2d for texture2d.
Initially I described issue in message:
http://forum.openscenegraph.org/viewtopic.php?t=13820
It solves issue with compiling texture using ico from image with mipmaps

I added enviroment variable OSG_GL_TEXTURE_STORAGE_ENABLE to control usage of glTexStorage2d. Initially it is disabled.

It used only if image have mipmaps.

Another issue is converting from internalFormat + type to sized internal format. I created sizedInternalFormats[] struct where sized internal formats are ordered from worse->best.
also this struct have commented lines. Commented formats are listed in
http://www.opengl.org/wiki/GLAPI/glTexStorage2D
but looks like not using in osg."

Note from Robert Osfield.  Changed the env var control to OSG_GL_TEXTURE_STORAGE and made it's value true by default when the feature is supported by the OpenGL driver.  To disable to
use of glTexStorage2D use OSG_GL_TEXTURE_STORAGE="OFF" or "DISABLE"



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14275 16af8721-9629-0410-8352-f15c8da7e697
2014-06-25 09:57:36 +00:00
Robert Osfield
71f7a74091 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/trunk@14273 16af8721-9629-0410-8352-f15c8da7e697
2014-06-25 08:21:13 +00:00
Robert Osfield
81c23564b5 From Björn Blissing, "Fix to support correct shininess and transparency in FBX plugin"
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14272 16af8721-9629-0410-8352-f15c8da7e697
2014-06-25 08:18:05 +00:00
Robert Osfield
82a34a2546 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/trunk@14269 16af8721-9629-0410-8352-f15c8da7e697
2014-06-24 19:57:19 +00:00
Robert Osfield
bd82d2a52d From Farshid Lashkari, "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/trunk@14267 16af8721-9629-0410-8352-f15c8da7e697
2014-06-24 14:58:13 +00:00
Robert Osfield
7295258d71 Merged fix to merge geometries.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14265 16af8721-9629-0410-8352-f15c8da7e697
2014-06-24 11:24:13 +00:00
Robert Osfield
4ec4e88f85 Fixed nested callback calling.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14264 16af8721-9629-0410-8352-f15c8da7e697
2014-06-23 12:02:41 +00:00
Robert Osfield
c6ab14018a Fixed check against totaly number of vertices
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14262 16af8721-9629-0410-8352-f15c8da7e697
2014-06-16 16:16:10 +00:00
Robert Osfield
8d06b9b019 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/trunk@14261 16af8721-9629-0410-8352-f15c8da7e697
2014-06-16 08:54:54 +00:00
Robert Osfield
9195a0000b Added osgUI::ColorPalette class
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14259 16af8721-9629-0410-8352-f15c8da7e697
2014-06-13 17:17:09 +00:00
Robert Osfield
3a18699074 Fixed typo in parameter name
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14258 16af8721-9629-0410-8352-f15c8da7e697
2014-06-13 17:16:51 +00:00
Robert Osfield
d9a6491a43 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/trunk@14257 16af8721-9629-0410-8352-f15c8da7e697
2014-06-12 16:00:21 +00:00
Robert Osfield
be13c2202d 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/trunk@14255 16af8721-9629-0410-8352-f15c8da7e697
2014-06-12 15:24:34 +00:00
Robert Osfield
410f7d27ed Improved positioning of combo box popup items
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14253 16af8721-9629-0410-8352-f15c8da7e697
2014-06-12 14:12:30 +00:00
Robert Osfield
63d101b653 Added frame support to ComboBox.
Improved the alingment support for text


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14252 16af8721-9629-0410-8352-f15c8da7e697
2014-06-12 14:05:28 +00:00
Robert Osfield
584035b663 Added handling of AligmentSettings of Text layout
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14251 16af8721-9629-0410-8352-f15c8da7e697
2014-06-11 16:31:17 +00:00
Robert Osfield
86a9a45525 Implemented more robust intersection handling for mouse interactions. Wired up even handling of ComboBox popup.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14250 16af8721-9629-0410-8352-f15c8da7e697
2014-06-11 10:55:33 +00:00
Robert Osfield
89ca694684 Added using Callback::run() method to Drawable::CullCallback
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14249 16af8721-9629-0410-8352-f15c8da7e697
2014-06-10 08:50:42 +00:00
Robert Osfield
d234262585 Fixed handling of Drawable callbacks and NumChildrenRequiringEventTraversal
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14248 16af8721-9629-0410-8352-f15c8da7e697
2014-06-09 13:46:44 +00:00
Robert Osfield
a316c30b4a Removed redudent NodeVisitor::s/getUserData() as osg::Object provide this.
Added using run entry to InteractiveImageHandler to quieten warning




git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14247 16af8721-9629-0410-8352-f15c8da7e697
2014-06-06 15:05:31 +00:00
Robert Osfield
1c699a3664 Added using NodeCallback::run() to avoid warnings
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14246 16af8721-9629-0410-8352-f15c8da7e697
2014-06-06 09:12:43 +00:00
Robert Osfield
d7b99b9062 Added missing OSG_EXPORT
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14245 16af8721-9629-0410-8352-f15c8da7e697
2014-06-06 09:01:25 +00:00
Robert Osfield
977ec20751 Refactored Callback system in osg::Node, osg::Drawable, osg::StateSet and osg::StateAttribute to use a new osg::Callback base class.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14244 16af8721-9629-0410-8352-f15c8da7e697
2014-06-05 16:26:13 +00:00
Robert Osfield
35d6cb812f Updated shaders from OpenSceneGraph-Data sources 2014-06-04 08:59:31 +00:00
Robert Osfield
6ea4f4a939 From Pjotr Sventachov and Robert Osfield, added callback unit test to osgcallback example, to use test run osgcallback --test, if everything is functioning then test1 to test7 messages should be reported to the console. 2014-06-03 15:05:51 +00:00
Robert Osfield
333a16a88d Reverted change of Node::ParentList from being a vector<Node*> back to a vector<Group*> 2014-06-03 09:52:55 +00:00
Robert Osfield
3dde165f14 Refactor osg::Geode to subclass from osg::Group and reuse the NodeList children container 2014-06-03 09:23:24 +00:00
Robert Osfield
2d41cbd0cf Removed OSG_USE_BOUND and associated osg::Bound adapter class to avoid problems with BoundingBox::expandBy/expandByRadius() implementation choosing a null BoundingBox from
the osg::Bound class causing crashes.
2014-06-02 16:20:39 +00:00
Robert Osfield
e1ec4ec67f From Roni Zanolli, build fix for iPhone 2014-06-02 08:13:39 +00:00
Robert Osfield
199506296a Implemented basic frame graphic 2014-05-30 16:44:36 +00:00
Robert Osfield
189c0b3477 Futher work on ComboBox/Popup 2014-05-29 15:21:42 +00:00
Robert Osfield
a45ba05bdd Added beginnings of ComboBox popup functionality. 2014-05-29 10:51:26 +00:00
Robert Osfield
26a7c30229 Added cached Depth and ColorMask to reduce the amount of duplicate state in the osgUI subgraph 2014-05-28 10:18:57 +00:00
Robert Osfield
1fcb91900a Replaced Widget::GraphicsSubgraph with GraphicsSubgraphMap to allow finer control of when the rendering subgraphs are done. 2014-05-28 10:06:14 +00:00
Robert Osfield
6af9edf33b Improved handling of text 2014-05-27 14:14:51 +00:00
Robert Osfield
faced0a896 Removed Dialog/Popup::open/close() methods as they are replaced by the setVisible() method 2014-05-26 16:32:20 +00:00
Robert Osfield
5d635287c0 Implemented Widger::Visible and Enabled usage 2014-05-26 16:27:33 +00:00
Robert Osfield
b04a4813ba Added Visible and Enalbed properties to Widget 2014-05-26 16:15:33 +00:00
Robert Osfield
5d234ba021 Fixed missing initilaizer 2014-05-26 16:15:12 +00:00
Robert Osfield
71352ea56d Added item serializer 2014-05-26 15:58:18 +00:00
Robert Osfield
f50ec0fe8e Implemented clipping of widget to the widgets extents. 2014-05-23 18:59:16 +00:00
Robert Osfield
cca18e82e8 Implemented scheme for making sure nested widgest overdraw parent widgets graphics 2014-05-23 15:00:49 +00:00
Robert Osfield
55c2041d4d Added wrappers for open and close methods 2014-05-23 15:00:09 +00:00
Robert Osfield
bda5ec4875 Added osgUI::Widget::set/getGraphicsSubgraph() to hold the subgraph that does the rendering portion of widgets 2014-05-22 10:02:35 +00:00
Robert Osfield
0b5b3213fe Addd method implementation in serializers 2014-05-21 16:15:02 +00:00
Robert Osfield
d8adc80c2c Fixed handling of traverse 2014-05-21 10:17:31 +00:00
Robert Osfield
20fd80de3a Improved handling of callback object to open the door to use of general osg::CallbackObject as mechnisms for something simialr to Qt's signal/slot mechanism. 2014-05-21 09:45:11 +00:00
Robert Osfield
28c36d615b Added osg::runNamedCallbackObjects(..) convinience method for run all named osg::CallbackObjects attached to an osg::Object 2014-05-21 09:07:25 +00:00
Robert Osfield
9859f3110b Renamed callbacks to avoid overlap with Node callbacks 2014-05-21 09:06:17 +00:00
Robert Osfield
30b54e3af2 Moved the _boundingSphere set method into the update section of the Drawable::getBoundingBox() method
Added an UpdateVisitor::apply(Drawable&) implementation.
2014-05-20 16:09:34 +00:00
Robert Osfield
e70acf4c51 From Pjotr Svetachov, "I stumbled on a little bug with the new drawables. I was distributing points data into different drawables that I used in a LOD later. When simplifying the system to not use geodes anymore I came upon the following bug:
If Drawable::getBoundingBox would compute an invalid bounding box (if it was for example empty) it would make a bounding sphere with a infinite radius which counts as a valid sphere in osg.

Attached is a small fix."
2014-05-20 15:34:12 +00:00
Robert Osfield
8346f0ebe1 Improved the handling of updating of text 2014-05-20 08:35:39 +00:00
Robert Osfield
d917987938 Added shell of Popup class 2014-05-20 08:35:19 +00:00
Robert Osfield
e4004118db Added check against whether an event has been handled or not before actioning escape/quit. 2014-05-20 08:34:32 +00:00
Robert Osfield
4ce2e075c4 Add shell of Dialog class 2014-05-19 10:11:50 +00:00
Robert Osfield
1b34fed500 Added handling of up/down key to ComboBox 2014-05-19 09:30:36 +00:00
Robert Osfield
87fd1d38fb Added initial cut of ComboBox 2014-05-16 19:24:58 +00:00
Robert Osfield
3e00764649 Added initial shell of PushButton implementation 2014-05-16 10:38:40 +00:00
Robert Osfield
03fc0c3662 Added support for intesecting Drawable that are attached directly to the scene graph without an osg::Geode 2014-05-15 16:30:17 +00:00
Robert Osfield
5b60708e80 From Sebastian Messerschmidt, "There was some small error due to MS non-conformity handling comments correctly." 2014-05-15 14:57:28 +00:00
Robert Osfield
d8a06f827e From Pjotr Svetachov, build fixes for VisualStudio 2014-05-15 14:45:28 +00:00
Robert Osfield
85386daa25 Added osgGA dependency 2014-05-15 13:34:50 +00:00
Robert Osfield
4f199e36c9 Placed the #include<osg/Node> within #ifdef OSG_USE_BOUND to prevent unncessary inclusion of Node header when OSG_USE_BOUND is false. 2014-05-15 13:22:47 +00:00
Robert Osfield
20b9f3ff88 Added Node::asDrawable() and Node::asGeometry() methods to provide a low cost way of casting a node to Drawable and Geoemtry.
Changed the Group::computeBound() method so that it takes account of the a Drawable's BoundingBox.
2014-05-15 09:26:59 +00:00
Robert Osfield
afcf54b108 Fixed the bounding sphere computation and handling of Drawable as the root of the scene graph 2014-05-14 16:52:18 +00:00
Robert Osfield
74f91037a7 Further work on Bound class/Node::getBound() and Drawable::getBound() and usage in OSG codebase 2014-05-14 16:01:40 +00:00
Robert Osfield
ff21af2b0d Cleaned up code 2014-05-14 16:00:08 +00:00
Robert Osfield
4174d72a52 2014-05-14 10:19:43 +00:00
Robert Osfield
12a737ae02 Changed the Node::ParentList to be a list of osg::Node rather than osg::Group, and added addChild, removeChild, replaceChild virtual method to Node to enable code
to user code compile with minimal modifications to account for the new change to the Node ParentList.
2014-05-13 08:43:07 +00:00
Robert Osfield
b2c7bacfe9 From Farshid Lashkari, "As discussed, I've added the ability to handle Drawable objects within the NodeVisitor class. Here is an overview of the changes:
- Added apply(Drawable) and apply(Geometry) to NodeVisitor

- Added accept(NodeVisitor) method to Drawable/Geometry

- Added traverse(NodeVisitor) to Geode which calls accept(NodeVisitor) on all Drawables

- Updated CullVisitor to use new apply(Drawable) to handle drawables. The apply(Billboard) method still manually handles the drawables since it is depends on the billboard settings. I needed to disable the traverse within billboard to prevent duplicate traversal of drawables.

- Update other osgUtil node visitors (GLObjectsVisitor, IncrementalCompileOperation, ..) to use new apply(Drawable) method.
"
2014-05-12 12:10:35 +00:00
Robert Osfield
ead92353fe Added beginnings of new osgUI library, a replacement for osgWidget that works fully in 3D/stereo and is scriptable. 2014-05-12 11:27:54 +00:00
Robert Osfield
490b351330 Replaced obsolete __linux usage. 2014-05-06 16:38:57 +00:00
Robert Osfield
754a163cbf From Stephan Huber, "Xcode changed the default std-lib-implementation again. Now it’s GNU++98 instead of C++11. I adapted the cMakeList.txt files accordingly to add this new option so we can set it explicitly and link against 3rdparty-c++-libs." 2014-05-06 09:43:32 +00:00
Robert Osfield
eae4d51e3f From Stephan Huber, "Please revert the change to FindQuickTime.cmake as this breaks compilation for IOS and possibly OS X." 2014-05-06 08:37:39 +00:00
Robert Osfield
cf66750d7b From Farshid Lashkari, "fix for the Collada loader where it would access a null string in some cases" 2014-05-02 09:12:36 +00:00
Robert Osfield
1f33e2a2a0 From Ali Botorabi, "recently I ran into a problem with Microsoft's Appverifier while using OpenThreads on win32 platform. The Appverifier complained about an invalid thread handle during starting of a new thread. After looking closer into the problem it seemed that indeed a potential root of problem may be in the thread startup code. See the line below in Win32Thread.cpp (line number 347):
pd->tid.set( (void*)_beginthreadex(NULL,static_cast<unsigned>(pd->stackSize),ThreadPrivateActions::StartThread,static_cast<void *>(this),0,&ID));

the method "pd->tid.set" sets the thread id, however via the startup function "ThreadPrivateActions::StartThread" that thread id is used (see further down the call hierarchy the line "int status = SetThreadPriority( pd->tid.get(), prio);".

Until now I never ran into any problem in debug or release builds, though. It seems that furtunately the tid.set method was executed always before the tid.get method in the startup code. However, this may make trouble in the furture. A simple solution is the following: just replace the line above with following two lines:

    pd->tid.set( (void*)_beginthreadex(NULL,static_cast<unsigned>(pd->stackSize),ThreadPrivateActions::StartThread,static_cast<void *>(this),CREATE_SUSPENDED,&ID));
    ResumeThread(pd->tid.get());


The trick is just starting the thread in suspended mode so the StartThread function does not get executed and we can safely store the tid by pd->tid.set. Then start the Thread by calling ResumeThread."
2014-05-02 09:11:16 +00:00
Robert Osfield
35d73ea41c From Stephan Huber, fix for OSX build 2014-05-01 15:50:14 +00:00
Robert Osfield
298f1c65b6 Renamed the new include/osg/OpenGL automatically configured header file to include/osg/GL replacing the original hand built GL header 2014-04-30 13:19:22 +00:00
Robert Osfield
e16eb147a1 From Sebastian Messerschmidt, "attached is the compile/linker fix for multiple definitions of getTypeEnum when compiling the Lua with VisualStudio and potentially other compilers.
"
2014-04-30 11:51:40 +00:00
Robert Osfield
a04232a75a From Pjotr Svetachov, "have added some missing serializers for RigGeomery. Withouth them I
ran into two issues.

At first you get a bunch of warnings that osg::ComputeBoundCallback
and osg::UpdateCallback were unsupported wrapper classes when
converting fbx models with skeletal animation to osg(t/b).

The second issue was that when reading, the readers fail to read the
ComputeBoundCallback and UpdateCallback and set them to NULL which
messes up the RigGeometry.

Because a RigGeometry makes his own classes in the constructor it
might be preferable to not write them at all, because now those
classes are being made two times when reading a RigGeometry. But after
thinking about this that would place too much limits on them (you
won't be able to share or name them and save that information or make
a new inherited class from them and write that one) So I ended up
thinking the best way was to just write the files.
"
2014-04-29 15:14:39 +00:00
Robert Osfield
b6404d18c3 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:35 +00:00
Robert Osfield
fa6f5219bf From Mattias Helsing, "I finally got to fix the cmake Modules that have duplicates in later
version of cmake. See attached submission. I have tested the ones that
I compile myself (GDAL, Freetype, ZLIB) on ubuntu 12.04 with
cmake-2.8.7."
2014-04-29 12:19:21 +00:00
Robert Osfield
ecd26f9f5b From Paul Martz, "There is no standard place for gl/glcorearb.h on Windows. Previously, the only way to get OSG to build for core profile was to append an additional include directory ("/I") onto the CFLAGS variables This submission adds a FindGLCORE.cmake script so that the path to gl/glcorearb.h can be specified with a variable, GLCORE_ROOT, either in CMake or the environment.
Currently this submission is Windows-only. I don't think OSX or Linux require any help in locating gl/glcorearb.h. But if they do, this submission can be easily modified.

Files:
 - "CMakeLists.txt" is the top-level file.
 - FindGLCORE.cmake" and "OsgMacroUtils.cmake" go in CMakeModules.
"
2014-04-29 12:18:51 +00:00
Robert Osfield
2bb4e0566c 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:36 +00:00
Robert Osfield
4dd3e3562f 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:05 +00:00
Robert Osfield
f5261b9877 Fixed type error 2014-04-28 11:53:58 +00:00
Robert Osfield
4994b806d2 From Pjotr Svetachov, "For me osgviewer.cpp and Renderer.cpp were not compiling (visual studio 2013 with profile GL2) because they were still using GLuintEXT. So I changed that, see the attached files.
I also noticed that the generated OpenGL header were not copied to the installation directory so my own application could not find it."
2014-04-25 08:57:27 +00:00
Robert Osfield
6a0270279c Reordered the configuiration file blocks to make it more understandable 2014-04-25 08:56:53 +00:00
Robert Osfield
3ec6938b95 From Paul Martz, fixed placement of OpenGL header so that it gets generated and placed in the build directory as per the Config file 2014-04-25 08:18:03 +00:00
Robert Osfield
7b4d7cd221 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:46 +00:00
Robert Osfield
77f1c58345 From Lionel Lagarde, "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:16 +00:00
Robert Osfield
bc5575f83a From Kristofer Tingdahl, "I and my team have gone over the code again, and we feel that we are comfortable in our current proposal for change. It goes deeper than it did before, and I explain why:
There was code in the osgViewer/Viewer.cpp and osgViewer/CompositeViewer.cpp that transformed the Y-coordinates of an event. The code in the composite viewer did however miss the touch-data of the event. I thought that it should really be the GUIEventAdapter that should know about this, and hence I added the
GUIEventAdapter::setMouseYOrientationAndUpdateCoords which is re-computing the coordinates. First I simply added a boolean to the setMouseYOrientation function:

setMouseYOrientation( MouseYOrientation, bool updatecooreds=false );

but then the serializer complained.

This function is called from both the Viewer and the CompositeViewer. We have not tested from the viewer, but I cannot see it would not work from visual inspection.

The other change is in MultiTouchTrackballManipulator::handleMultiTouchDrag. I have removed the normalisation. The reason for that is that it normalised into screen coordinates from 0,0 to 1,1. The problem with that is that if you have a pinch event and you keep the distance say 300 pixels between your fingers, these 300 pixels represent 0.20 of the screen in the horizontal domain, but 0.3 of the screen in the vertical domain. A rotation of the pinch-fingers will hence result in a zoom in, as the normalised distance is changing between them.

A consequence of this is that I have changed the pan-code to use the same algorithm as the middle-mouse-pan.

The rest of it is very similar from previous revision, and there has been some fine-tuning here and there.

"
2014-04-24 17:14:54 +00:00
Robert Osfield
6f2d003bc5 From Mattias Helsing, "Seems I was only half right given what you asked for. CMP0017 only
says that modules that are found and ran from cmake modules dir should
prefer cmake-provided modules. find_package() and include() still look
in CMAKE_MODULE_PATH first.

After some investigating I've come up with a proposal examplified in
the attached FindGDAL.cmake script. It simply calls the cmake provided
FindGDAL.cmake if it exists and returns if it succeeds in finding GDAL
using that, otherwise continue with our local cmake code.
Pro: Wont clutter our root CMakeLists.txt
Con: If we begin to write more advanced Findxxx modules (using
COMPONENTS, REQUIRED etc.) we may have to revise this scheme.
"
2014-04-24 10:49:57 +00:00
Robert Osfield
ec658b115c Fixed reference invalidation bug. 2014-04-24 10:38:58 +00:00
Robert Osfield
a43cc12394 Fixed typo in OPENSCENEGRAPH_OPENGL_HEADER name 2014-04-24 07:22:55 +00:00
Robert Osfield
ef76994c05 Removed header as this CMake generated configuration file is not required to be part of svn repository 2014-04-24 07:20:44 +00:00
Robert Osfield
a1342a6bf6 Added src/osg/OpenGL.in configuration file and include/osg/OpenGL header files 2014-04-23 19:30:33 +00:00
Robert Osfield
5597248895 Introduced new scheme for setting up which version of OpenGL/OpenGL ES the OSG is compiled for.
To select standard OpenGL 1/2 build with full backwards and forwards comtability use:

  ./configure
  make

OR

  ./configure -DOPENGL_PROFILE=GL2

To select OpenGL 3 core profile build using GL3/gl3.h header:

  ./configure -DOPENGL_PROFILE=GL3

To select OpenGL Arb core profile build using GL/glcorearb.h header:

  ./configure -DOPENGL_PROFILE=GLCORE

To select OpenGL ES 1.1 profile use:

  ./configure -DOPENGL_PROFILE=GLES1

To select OpenGL ES 2 profile use:

  ./configure -DOPENGL_PROFILE=GLES2


Using OPENGL_PROFILE will select all the appropriate features required so no other settings in cmake will need to be adjusted.
The new configuration options are stored in the include/osg/OpenGL header that deprecates the old include/osg/GL header.
2014-04-23 09:08:26 +00:00
Robert Osfield
560587c88f Fixed comment 2014-04-14 16:16:08 +00:00
Robert Osfield
5015fb6dac 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:27 +00:00
Robert Osfield
c168887e5e From Paul Cheyrou-Lagreze, "Attached is fix/feature for FBX osgplugins against latest trunk:
- ReaderWriterFBX.cpp: add "z up scene axis" support:  FBX provides facility to convert model scene axis during conversion. Currently fbx plugin convert axis to fbx:opengl axis system (which is arbitrarily at Y up, as opengl is in reality axis agnostic) and sometimes what is needed is Z up so added an option for Z up conversion

- FindFBX.cmake: add support for latest fbx sdk ( 2014.2 )"
2014-04-09 17:40:27 +00:00
Robert Osfield
db6df6fefd Disabled warnings to address issues in FBX headers that generate lots of warnings that we can't fix. 2014-04-09 17:20:26 +00:00
Robert Osfield
ef5be684ed Added extra search paths to add compatibility with Kubuntu/Ubuntu 14.04 now locaton for freetype 2014-04-08 19:42:05 +00:00
Robert Osfield
51671348f7 Updated ChangeLog and fixed Contributors list 2014-04-08 17:45:21 +00:00
Robert Osfield
a4a5957e2f 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:52 +00:00
Robert Osfield
25ddbf8f1f From Sebastian Messerschmidt, "n the trunk version the osgGA::GUIActionAdapter has additional functions for lineIntersection which use osgGA::GUIEventAdapter&, but the class declaration is neither forwarded, nor is the header included.
Using the trunk together with osgEarth 2.5 will fail to build, due to the missing type.

Attached is the file forward declaring osgGA::GUIEventAdapter."
2014-04-08 11:48:34 +00:00
Robert Osfield
f2b746520b 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:59 +00:00
Robert Osfield
ca4d93652d 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:08:05 +00:00
Robert Osfield
efc493cfa0 Fixed build when using of double BoundingBox/BoundingSphere 2014-04-07 15:04:34 +00:00
Robert Osfield
391ab02573 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:17:57 +00:00
Robert Osfield
64979a0c1a 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:14 +00:00
Robert Osfield
20c0292e97 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:40 +00:00
Robert Osfield
88aa9ac5de From Bjorn Hein, "please find attached a small fix for RayIntersector.cpp.
* Changes are made against trunk
* Reason: crashes when using specific constructor from RayIntersector
* Info: Line 42:  added in constructor
RayIntersector::RayIntersector(const Vec3d& start, const Vec3d&
direction) missing initialisation of _parent
"
2014-04-07 13:52:01 +00:00
Robert Osfield
ac380e03c4 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:15 +00:00
Robert Osfield
67b4d5412b Fixed iso surface shaders 2014-04-04 11:25:51 +00:00
Robert Osfield
d773d358c4 Improved the setting of sample density/ratio so that they are consistent 2014-04-01 18:56:57 +00:00
Robert Osfield
e5fe59799d Fixed handling of volume tiles with a region. 2014-04-01 18:33:02 +00:00
Robert Osfield
27b71e3927 Added cube and hull rendering support 2014-03-27 12:47:44 +00:00
Robert Osfield
2f8b0f7a70 Restructured the handling of TileData to make it more extensible and flexible. 2014-03-19 17:56:40 +00:00
Robert Osfield
d7944b6ca9 Addd ExteriorTransparencyFactorProperty for support of upcomming functionality of rendering a cube volume with a hull volume inside it. 2014-03-18 18:14:15 +00:00
Robert Osfield
ed724a730e Added support for animating volume hulls. 2014-03-17 15:54:52 +00:00
Robert Osfield
d703a2df44 From Stephan Huber, "attached is a fix for the rest-http-plugin which should fix the font-issue reported by Phil. The old implementation did forward all requests to the internal http-server via user-events. This prevented error-reporting for missing files, as the request was accidentally handled by the plugin. As a request for missing font-file succeeds and returned an empty file, the curl-plugin hands the data happily to the freetype-plugin which failed trying to load an empty font-file, obviously.
My fix was to rename the standard request handler to a specialized user-event-handler which handles only requests for "/user-event“

So fonts should work on iOS when loaded remotely, even when a local file is available and with the resthttp-plugin serving the presentation.
"
2014-03-13 14:02:50 +00:00
Robert Osfield
7f206fbf80 From Stephan Huber, fix for building lua plugin from local source 2014-03-13 13:59:34 +00:00
Robert Osfield
ea865d0ff9 Added support for directly invoking scripts using <run-script> and <run-script-file> to enable scripts to interact with each other. 2014-03-13 10:28:18 +00:00
Robert Osfield
75982f3379 Improved support for passing events between scripts and Present3D application 2014-03-12 11:01:09 +00:00
Robert Osfield
8f30a262f4 Added PresentationInterface class to make it more convinient to access the current presentation from scripting languages 2014-03-11 10:52:10 +00:00
Robert Osfield
ee266255eb Added scripting support for JumpData, KeyPosition, HomePosition and parts of SlideEventHandler that enable dispatching of user created events. 2014-03-10 19:08:46 +00:00
Robert Osfield
9b299dc4b9 Added ability to replace callback objects via lua scripts to allow one to override callbacks.
Added fallback for osgGA::Widget::Extents.
2014-03-07 11:09:25 +00:00
Robert Osfield
9319350176 Added support for osg::Image to the lua plugin. 2014-03-06 10:27:26 +00:00
Robert Osfield
076adcbd82 Implement add, set and get methods for StateSet. 2014-03-04 13:36:13 +00:00
Robert Osfield
218e36b12b Relaxed the handling of Image objects 2014-03-04 13:35:27 +00:00
Robert Osfield
c6e72ee00b Fixed handling of OverrideValue 2014-03-04 13:34:23 +00:00
Robert Osfield
2b67196418 From Stephan Huber, fix for handling font paths on a local machine when other files have been source from a remote machine. 2014-02-28 17:38:36 +00:00
Robert Osfield
de09adcaa9 Added MapReverseIterator implementation. 2014-02-27 10:02:55 +00:00
Robert Osfield
46381cb15c Added MapIteratorObject and support for it in the lua plugin to provide map iterator functionality. 2014-02-26 18:18:08 +00:00
Robert Osfield
9394215d31 Added Map serializer size() method and support for it in the lua plugin. Renamed functions in lua plugin to be more consistent. 2014-02-26 11:01:35 +00:00
Robert Osfield
69e9f2c973 Added support for vector and map containers in osgDB::Serailizer's and lua plugin. 2014-02-26 08:26:51 +00:00
Robert Osfield
4ef5d9eb5f Added Vector serialization and support in lua plugin top enable script users to set/get vector properties such as osg::Array, osg::PrimitiveSet and children lists. 2014-02-24 10:19:48 +00:00
Robert Osfield
6d68718fba Fixed handling of enums in Lua plugin.
Fixed computation of getNumPrimitives() so that it returns 0 when PrimitiveSet is zero.

Added missing properties to PrimitiveSet serializers
2014-02-13 18:52:41 +00:00
Robert Osfield
cb805d7be5 Added inital cut of PrimitiveSetSet wrappers to scripting 2014-02-13 11:01:36 +00:00
Robert Osfield
42705bff3f Added full range of Array subclasses to wrappers 2014-02-12 18:10:52 +00:00
Robert Osfield
743a6b049c Added initial support for wrapping osg::Array in a way that can be used via scripting. 2014-02-12 18:03:53 +00:00
Robert Osfield
8bbbea1274 Fixed handling of assignment of User Object's that replace existing Object with the specified propertyName. 2014-02-11 18:18:48 +00:00
Robert Osfield
2797e8cb7c Improved support for setting/getting properties via the osg::UserDataContainer. 2014-02-11 18:07:37 +00:00
Robert Osfield
e3a003a08f Quitened down debug messages 2014-02-11 10:56:51 +00:00
Robert Osfield
a9f8af3fb6 Changed implementation of enums to use strings as lua type to make it easier to do comparisons and track values 2014-02-11 09:43:08 +00:00
Robert Osfield
e21865ee33 Implemented Widget::handle, handleImplementation, traverse and travseImplementation() wrappers to enable them to be extended via scripting 2014-02-10 18:07:26 +00:00
Robert Osfield
31e98b51df Added support for serailizing and scripting BoundingBox and BoundingSphere objects 2014-02-10 16:44:13 +00:00
Robert Osfield
3dcca431a9 Fixed handling of setting member variables via the Serializers when the value is the default.
Added support for more features of the osgDB::Widget class.

Fixed handling of boolean values in the Lua plugin
2014-02-08 17:53:51 +00:00
Robert Osfield
1319c2d281 Added support for enum's in the Lua script integration 2014-02-08 10:39:20 +00:00
Robert Osfield
8eae4b0381 Fixed export 2014-02-08 10:38:51 +00:00
Robert Osfield
8ad0ab1f6b Fixed handling of returns when invoking a script, removed some debug messages, added a warning message when detecting erronous types.
Added FocusBehaviour enum to osgGA::Widget serialization
2014-02-07 16:06:57 +00:00
Robert Osfield
6f5e5c23df Added initial Widget wrapper 2014-02-07 10:46:16 +00:00
Robert Osfield
4016aed62d Moved experimental Widget class to osgGA
Add computeIntersections() to the osgGA::GUIActionAdapter base class to enable intersection tests without needing to directly link to osgViewer.
2014-02-06 17:32:41 +00:00
Robert Osfield
958a7d0ab0 Added osg::CallbackObject suport to the experiment Widget base class to enable script language extension of widgets 2014-02-06 17:04:40 +00:00
Robert Osfield
99eb81e743 Added support for casting objects to allow one to access a parent classes methods. 2014-02-06 11:25:37 +00:00
Robert Osfield
ca3737e002 Tweaked the detection of when the position transform for the hull is required. 2014-02-05 11:08:39 +00:00
Robert Osfield
2b8be97297 Added support for a <hull> tag that can be used within <volume> tag. 2014-02-05 11:07:03 +00:00
Robert Osfield
1909093cac Improved the white space trimming 2014-02-05 11:04:29 +00:00
Robert Osfield
c599189d7d Added lua-5.2.3 as source code so it can be optinally built as part of the lua plugin, making it possible to work out of the box across all platforms with needing lua as an external dependency.
Added the Cmake option OSG_USE_LOCAL_LUA_SOURCE to control whether to build and use the Lua source code in the lua plugin, or look for lua as an external dependency.
2014-02-04 16:49:13 +00:00
Robert Osfield
6bf6d5eeb2 Added test code for nesting a <hull> within a volume tag. 2014-02-04 16:46:33 +00:00
Robert Osfield
488e1692cc From Stephan Huber, added support for compile source code of lua with the lua plugin 2014-02-04 11:24:01 +00:00
Robert Osfield
f44369777f Fixed error in the computation of tex coords of Maximum Intensity Projection + Transfer Function rendering. 2014-02-03 15:35:22 +00:00
Robert Osfield
306a4f2d2d Replaced C cast to long with a static_cast<const void*>() to avoid a build error under Mingw 64. 2014-01-31 19:18:18 +00:00
Robert Osfield
5f8e2bda2f Added osg::CallbackObject to be used to extend C++ class from scripting languages by providing callback objects assigned to the osg::Object UserDataContainer, with the CallbackObject's Name used to map the "method" provided by the CallbackObject. The CallbackObject is implemented by the script engine to provide the neccessary glue to invoking the script with the appropriate input parameters and handling the output parameters.
To the Lua plugin added support for assigned lua functions to C++ osg::Objects via the new osg::CallbackObject mechanism.  To invoke the scripts function from C++ one must get the CallbackObject and call run on it.

Renamed ScriptCallback to ScriptNodeCallback to avoid possibly confusion between osg::CallbackObject and the ScriptNodeCallback.
2014-01-31 16:20:29 +00:00
Robert Osfield
661f0e69ef Updated ChangeLog 2014-01-29 11:01:24 +00:00
Robert Osfield
d63c6f6978 From Kristofer Tingdahl, made method virtual 2014-01-28 16:49:20 +00:00
Robert Osfield
fba7a65fb4 Fixed MingW build's handling of debug d postfix. 2014-01-28 16:48:47 +00:00
Robert Osfield
4814a5341e Removed the invocation of gcc on all platforms 2014-01-28 15:28:17 +00:00
Robert Osfield
f7e6f0092c From Kristofer Tingdahl, "the vertical bar is upside down, and hence not as the documentation says it should be. This is corrected with this patch"
From Robert Osfield, changed the example so that the vertical and horizon scalar bars are rotated to the XZ plane so you can see them with the default viewer's camera orientation.
Tweaked the positioning of title text of vertic scalar bar to avoid overlap of text.
2014-01-28 11:01:28 +00:00
Robert Osfield
4f19237467 Removed unimplemented method 2014-01-27 15:43:36 +00:00
Robert Osfield
5292c7ca50 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:09 +00:00
Robert Osfield
70bfad0371 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:32 +00:00
Robert Osfield
fcc34a8b45 From Michael Schanne, "small fix for a duplicate OR operand in KdTree.cpp." 2014-01-24 16:45:45 +00:00
Robert Osfield
1ec3ec1247 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:34 +00:00
Robert Osfield
1270236715 From Torben Dannhauer, VisualStudio 2013 build fixes 2014-01-24 16:24:59 +00:00
Robert Osfield
8a334e724b From Kristofer, "The osgSim::ScalarBar has a problem in that if the scalarbar has a color in one end that co-incides with the background color, one cannot see where the scalarbar ends. With this patch, we add a line around the perimiter of the bar to mark it.
Secondly, we thought the text-annotation missed ticks that mark out precisely where on the bar the texts relate to, so we added that as well."
2014-01-24 16:19:38 +00:00
Robert Osfield
8ae57c2797 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:01:59 +00:00
Robert Osfield
eb56080277 Fixed warnings 2014-01-24 15:40:18 +00:00
Robert Osfield
91b7104a92 Changed the handling of single window configurations so that simply reuse the View::getCamera() instead of creating a slave. 2014-01-24 14:26:25 +00:00
Robert Osfield
15f44c8736 Added a getModeUsage() method that prevents any mode being automatically associated with these Texture types that are only usable using non fixed function pipeline. 2014-01-24 12:01:37 +00:00
Robert Osfield
f0df819cbf Fixed crash when reading a viewer configuration file where the EventVisitor was being re-assigned but left a dangling pointer 2014-01-24 11:37:35 +00:00
Robert Osfield
29ab577bc3 From Stephan Huber, "attached is a new zip containing two small fixes:
* forwarded touch-events do have a correct input-range from 0 .. 1
* I refactored sending touch-events per osc so the receiver can detect a TOUCH_ENDED better"
2014-01-24 10:10:43 +00:00
Robert Osfield
4886a8941d Fixed warnings 2014-01-23 19:55:37 +00:00
Robert Osfield
d8482ef1ba From Kristofer Tingdahl,"we have a bunch of classes that inherit osg::Node, and they create their own, internal geometry which is passed into the render bucket at the cull-traversal. Last week, we realised that these classes are not accounted for when doing an ComputeBoundVisitor- traversal, as there is no specialization in ComputeBoundVisitor for them.
One solution is naturally to create a new class that would inherit the osg::ComputeBoundVisitor, and use that. I don't like that idea as the ComputeBoundVisitor does actually have what I need - it is only hidden in a protected function.

I am therefor suggesting a slight generalization of the ComputeBoundVisitor with the attached patch, which is tested.

The patch has two parts:
we add applyBBox() so that one can use that in a customized traverse-function and add a bbox to the visitor. I considered calling this function expandByBBox(), but I though  applyBBox was better.
The MatrixStack is made available to the outside world. That enables a traverse-function to do whatever it wishes.
I do actually only need one of the two, as I can implement what I wish either way, but adding getMatrixStack() will make more generic expansions possible.
"

From Robert Osfield, changed the name of the new applyBBox(..) method to applyBoundingBox(..) to keep it's naming more consistent with the rest of the OSG.
2014-01-23 16:48:29 +00:00
Robert Osfield
a96ad565c7 From Stephan Huber, "attached are some fixes to the osc-plugin and the touch-implementations for iOS and os x and other small bugfixes. These fixes will normalize the orientation of the touch points, and transmitting the touch points over osc via the TUIO-protocol works now more robustly between two osg-applications.
I added a new tag to p3d called forward_touch_event_to_device and renamed the existing forward_event_to_device to forward_mouse_event_to_device. This new tag will transmit touches to the virtual trackpad as touch events. I added the MultitouchTrackball to the p3d-app so zooming and moving a model remotely should now work, if you use forward_touch_event_to_device. I kept (and fixed) forward_mouse_event_to_device for background compatibility, so old presentations works as in previous versions, without the ability to zoom + scale. of course.

forward_touch_event_to_device needs some more testing, (e.g. with image-streams and keystone, afaik there’s no support for touch-events...) but for a first version it works nice.
"
2014-01-23 15:37:48 +00:00
Robert Osfield
09c09628ac Removed debug message 2014-01-23 10:56:17 +00:00
Robert Osfield
15882aae5f Changed the TransprencyProperty range to 0 to 2.0 to enable forcing opaque qualities on fragments 2014-01-23 10:50:55 +00:00
Robert Osfield
8876394c7c Cleaned up debug message. 2014-01-23 10:11:15 +00:00
Robert Osfield
fd85542d8f 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:53 +00:00
Robert Osfield
ea429d5d46 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:09 +00:00
Robert Osfield
7f9f7dd216 Added GL_TEXTURE_2D_MULTISAMPLE to texture mode list. 2014-01-23 07:59:46 +00:00
Robert Osfield
405cb0d828 Made protected methods virtual to allow subclassing to customize more aspects of the window setup. 2014-01-22 17:29:44 +00:00
Robert Osfield
4fef6a3c2f Refactored .p3d loader to make it less strict about the tag, property and value strings when matching them to supported values.
Examples of supported matches are:

   <Slide> and <slide> will be treated the same
   <bgcolor>WHITE</bgcolor> and <bgcolor>White</bgcolor> will be treated the same
   <text alignment="TOP_LEFT"</text> and <text alignment="top left"</text>,  <text alignment="TopLeft"</text> will all be treated the same
2014-01-22 16:29:45 +00:00
Robert Osfield
7fe3244c71 Added support for sampleRatio and sampleRatioWhenMoving <volume> properties 2014-01-22 11:25:54 +00:00
Robert Osfield
c63bebd8c3 Build fixes for when ref_ptr<> automatic type conversion is turned off 2014-01-21 18:58:52 +00:00
Robert Osfield
1678dc3562 Added support for osgVolue::SampleRatioProperty. Fixed build errors when compiling with ref_ptr<> automatic type conversion. 2014-01-21 18:48:53 +00:00
Robert Osfield
e48d6812fa Build fixes for when ref_ptr<> has no auto type conversion 2014-01-21 18:31:20 +00:00
Robert Osfield
504b42aa61 Fixed build error 2014-01-21 17:27:21 +00:00
Robert Osfield
779bd20fd5 Fixed build error due to typo. 2014-01-21 17:00:56 +00:00
Robert Osfield
752d40b118 Integrated multipass volume rendering shaders from OpenSceneGraph-Data 2014-01-20 17:23:11 +00:00
Robert Osfield
b41e5ccc77 Changed the default directory for the output files to be the current working directory,
with the --write-to-source-file-directory added to allow one to have the original behaviour
of writing to the same directory as the original source file.
2014-01-20 17:03:29 +00:00
Robert Osfield
8a0e49d780 Removed nolonger used code paths 2014-01-20 16:21:24 +00:00
Robert Osfield
54a3f76a2b Disable depth test for rendering of hull backface 2014-01-20 15:54:48 +00:00
Robert Osfield
5cb305041d From Stephan Huber, "recent commits regarding GLuint64EXT broke the build for GLES1 and GLES2. Attached you’ll find a fix which hopefully work for every platform." 2014-01-20 15:10:49 +00:00
Robert Osfield
15399bbf35 From Kristofer Tingdahl, reimplement of AntiSquish node to avoid the use of an update callback.
From Robert Osfield, small ammendments to clean up header.
2014-01-20 11:00:09 +00:00
Robert Osfield
6246cd5d85 From Roni Zanolli,Added use of Qt's new devicePixelRatio() method to assist with handling the upscalling of resolution on iPhone for "retina" displays.
From Robert Osfield, changed Roni's code to use a #define GETDEVICEPIXELRATIO to access the versioned Qt devicePixelRatio() method to avoid duplication of the Qt version checking.
2014-01-20 10:40:49 +00:00
Robert Osfield
0d4a448c34 Fixed warning 2014-01-17 18:20:39 +00:00
Robert Osfield
8efe470d07 From Stephan Huber, fix for OSX build issue 2014-01-17 18:20:28 +00:00
Robert Osfield
e968caae80 From Kristoger 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:30 +00:00
Robert Osfield
e04e03d695 From Jordi Torres, "We have a code using gcc with -Wextra flag and using OSG as a third party library. It does not compile when importing <osgViewer/Viewer> failing in EventHandler and GUIEventHandler:
....

GUIEventHandler: In copy constructor 'osgGA::GUIEventHandler::GUIEventHandler(const osgGA::GUIEventHandler&, const osg::CopyOp&)':

/include/osgGA/GUIEventHandler:56:9: error: base class 'class osg::Object' should be explicitly initialized in the copy constructor [-Werror=extra]

It seems the diamond problem:

   A = osg::Object
  / \
 /   \--> Virtual inheritance
B     C
 \   /
  \ /
   D = EventHandler
   |
   |
   E = GUIEventHandler

The most derived class(E)  handles the instantiation of A (osg::Object), but all have to be responsible in case they are the ones instantiated.


In case A is not initialized in the copy constructor of derived classes the default constructor will be called, which seems a bug.

I've added osg::Object to the initalization list of EventHandler and GUIEventHandler copy constructors, because both classes are instantiables.
 "
2014-01-17 13:59:29 +00:00
Robert Osfield
354d79acd1 From Jordi Torres, "Fixed a typo in ReaderWriterCURL::ReaderWriterCURL() changed Psuedo for Pseudo." 2014-01-17 13:54:14 +00:00
Robert Osfield
235a52405d Fixed handling of background colours. 2014-01-17 12:40:58 +00:00
Robert Osfield
706afaccae Removed old redundent TexGen usage. 2014-01-16 17:26:35 +00:00
Robert Osfield
e8cd06c6e9 Added hull="hul-filename" property support to <volume> tag that can used thus:
<layer>
            <volume renderer="MultiPass" hull="cow.osgt.0,-2,-4.trans.50,50,50.scale">CardiacCT</volume>
        </layer>
2014-01-16 17:17:37 +00:00
Robert Osfield
1264ec736a Added support for controlling the extents of the volume rendering by nesting the hull underneath VolumeTile. Currently only supported by the new osgVolume::MultipassTechnique 2014-01-16 16:08:43 +00:00
Robert Osfield
a30ec25067 From Paul Martz, build fix for Windows GL3 build 2014-01-09 11:13:09 +00:00
Robert Osfield
110fbf89b0 Added per TileData RTT Camera in prep for rendering backface of volume to a depth texture 2014-01-09 09:41:43 +00:00
Robert Osfield
2efd52dda2 Changed near/far values to use CullVisitor::value_type and use std::numeric_limits<>. 2014-01-08 15:56:43 +00:00
Robert Osfield
889e4749ef 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:33:00 +00:00
Robert Osfield
84d301715e Removed more odd characters 2014-01-08 10:31:36 +00:00
Robert Osfield
32d7a48712 Removed more odd characters 2014-01-08 10:28:24 +00:00
Robert Osfield
db82bb4ab1 Removed odd characters 2014-01-08 10:24:43 +00:00
Robert Osfield
4a76063b03 Moved destructor to protected 2014-01-08 10:16:39 +00:00
Robert Osfield
716cfbffa4 Refined the GLint64 definitions 2014-01-07 19:06:44 +00:00
Robert Osfield
0f2502c72d Removed duplicated instances of GLint64EXT declarations 2014-01-07 18:32:45 +00:00
Robert Osfield
0bb62a8162 Removed execute properties via svn propdel svn:executable file 2014-01-07 16:43:07 +00:00
Robert Osfield
d48091d37e 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:22 +00:00
Robert Osfield
7bc373a056 Bumped SO_VERSION number of OpenThreads to avoid conflicts with Debian SO_VERSION bump 2014-01-07 16:18:05 +00:00
Robert Osfield
0ee9f732b8 From Sebastian Messerschmidt, "Original shader was not running on various NVidia cards due to old syntax in shader." 2014-01-07 16:15:50 +00:00
Robert Osfield
3531bec43c Added State::getMaxTextureCoords() and State::getMaxTextureUnits() inline methods. 2014-01-07 11:01:32 +00:00
Robert Osfield
cc99a40b16 Added support for Switch::set/getValue() 2014-01-06 17:19:21 +00:00
Robert Osfield
8ae971bdaa Added Group::setChild(..) and Geode::setDrawable(..) MethodObjects 2014-01-06 16:58:07 +00:00
Robert Osfield
fa7f25d75d Removed the prototype MethodObject classes 2014-01-06 15:46:36 +00:00
Robert Osfield
6490f1b6a5 Moved osgDB::MethodObject from lua plugin into osgDB, added support for running methods via the osgDB::PropertyInterface class.
Updated lua plugin to use new osgDB::PropertyInterface to run methods.

Added addChild/removeChild() etc to Group.cpp, and addDrawable/removeDrawable() etc. to Geode.cpp serializers.
2014-01-06 15:45:46 +00:00
Robert Osfield
534d21dffd Renamed the OSGSIM cmake variable to OSGSIM_LIBRARY to be consistent with the rest of the variables. 2014-01-06 10:23:26 +00:00
Robert Osfield
bfdcf4d8d1 Fixed build of V8 and Python plugins 2014-01-03 14:36:58 +00:00
Robert Osfield
afab78ed40 Preliminary support for wrapping methods in the lua script plugin. 2013-12-25 17:36:32 +00:00
Robert Osfield
865a47bd6b Added <switch> tag to .p3d to allow one to provide multiple ways to render children within a layer. 2013-12-20 09:57:35 +00:00
Robert Osfield
a72508bc71 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:24 +00:00
Robert Osfield
e4810990f0 From Sylvain Marie, When compiling OSG for the iOS simulator, providing both -miphoneos-version-min and -mios-simulator-version-min doesn’t please clang (tested on OS X 10.9.0 with Xcode 5.0.1).
Here is a small change (against commit da597ab16945c572a2ad2f4f26fcef38ed21b074) in the CMakeLists.txt to avoid this situation.
2013-12-19 15:10:28 +00:00
Robert Osfield
3e171414bd From Michal Durkovic, "I’m building current trunk on Mac OS X 10.9 and have encountered this error during linking of osgdb_lua plugin:
Undefined symbols for architecture x86_64:

  "lua::LuaScriptEngine::pushValue(osg::Quat const&) const", referenced from:

      PushStackValueVisitor::apply(osg::Quat const&) in LuaScriptEngine.o

  "lua::LuaScriptEngine::pushValue(osg::Plane const&) const", referenced from:

      PushStackValueVisitor::apply(osg::Plane const&) in LuaScriptEngine.o

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)



Looks like LuaScriptEngine was missing implementation of those 2 member functions. Fixed src/osgPlugins/lua/LuaScriptEngine.cpp file in attachment.

"
2013-12-19 13:53:40 +00:00
Robert Osfield
f16f278fea From Stephan Hunber, "attached you’ll find some changes to osg/p3d:
* a new command-line-option to present3d and a new option to the p3d-plugin to suppress any found <env> tags
* a new command-line-option to present3d to forward mouse-events via osgGA::Device (defaults to off) so we can test the interface-files with present3d better
* I added a new attribute forward_to_devices for click_to_event to forward the event to all attached devices instead of handling the event locally. This will fix the annoyance with the new interface-files when toggling polygon-mode or switching light on/off.

Here’s an example:

<click_to_event forward_to_devices="true">0x72</click_to_event>
"
2013-12-19 13:49:27 +00:00
Robert Osfield
02120e188e From Stephan Hunber, "I found some time and ported osgDB::FileUtils and DarwinUtils across new apis to fix the warnings about deprecated api-usage.
* osgDB::FileUtils uses now the Cocoa-API to determine the paths of the application-support-folder
* DarwinUtils uses now modern functions of the quartz-api to get and set screen-resolutions. Removed some of the osg-deprecated stuff.
"
2013-12-19 13:44:42 +00:00
Robert Osfield
a8dc460085 Implemented support for calling scripts from with Present3D. 2013-12-19 10:02:16 +00:00
Robert Osfield
591c5bae42 Added support for new osgVolume::MultiPassTechnique to Present3D. To use add property renderer="MultiPass":
<volume renderer="MultiPass">MyVolumeData</volume>
2013-12-17 12:18:06 +00:00
Robert Osfield
666aa81185 Added experimental image 3d downsample function. 2013-12-17 10:52:50 +00:00
Robert Osfield
723ecfad8d Removed the unused Texture::Extensions::numTextureUnits() 2013-12-16 11:28:10 +00:00
Robert Osfield
5571c361dc Implemented ability to switch between different shaders with new MultipassTechnique 2013-12-13 12:38:01 +00:00
Robert Osfield
939aa38a2a Added SampleRatioWhenMoving property and support to new osgVolume::MultipassTechnique. 2013-12-12 09:53:24 +00:00
Robert Osfield
a5c0127a6e Applied unquie CullVisitor::Identifier rather than reusing the cloned one. 2013-12-12 09:51:30 +00:00
Robert Osfield
2501f32e9a Changed epsilon to 1e-5 to address picking problems with planaer objects 2013-12-11 17:20:14 +00:00
Robert Osfield
e3bf55a266 Added initial support for 1D transfer functions to MultipassTechnique 2013-12-11 12:00:27 +00:00
Robert Osfield
ff4a0ce1e2 Added support for handling viewports with offset origins, and with it split stereo. 2013-12-10 13:38:27 +00:00
Robert Osfield
bc95ea97fb Introduced SampleRatioValueProperty for more intuitive control of how many samples to take when volume rendering 2013-12-10 10:43:48 +00:00
Robert Osfield
499adba97f Improvements to new MultipassTechnique 2013-12-09 10:39:01 +00:00
Robert Osfield
3858acf70f Further work on new MultipassTechnique/VolumeScene. 2013-12-06 19:31:12 +00:00
Robert Osfield
ed4deeb0fb From Mike Krus, compile fix to enable compiling across a wider set of versions. 2013-12-06 09:35:57 +00:00
Robert Osfield
1b3290221c Added support for using shaders to render the RTT textures with depth 2013-11-26 19:03:46 +00:00
Robert Osfield
477951b924 Replaced readShaderFile() usage to readRefShaderFile() 2013-11-26 10:38:35 +00:00
Robert Osfield
4fcf8d3e86 Added initial render to texture functionality into osgVolume::VolumeScene 2013-11-25 17:36:17 +00:00
Robert Osfield
f02ed3c629 Warning fixes 2013-11-22 10:27:15 +00:00
Robert Osfield
91033a3a1f From Kristofer Tingdahl, Build fix for svg plugin that makes sure the version of librsvg is at sufficient, and fixed a missing virtual destructor warning. 2013-11-22 09:48:02 +00:00
Robert Osfield
d3a7115c45 Removed trailing spaces, added missing return to last lines 2013-11-22 09:38:50 +00:00
Robert Osfield
5bea13c172 Added new osgVolume::VolumeScene and osgVolume::MultipassTechnique class shells that will be filled out to provide multi-pass volume rendering that handles mixing of
3D meshes with volume rendering and segmentation of volumes via a user defined hull mesh.
2013-11-21 18:17:44 +00:00
Robert Osfield
1b269a7711 From Stephan Huber, "CLang / LLVM on OS X seems to have a problem compiling the osgGA-serializer. (It was reported before on the list, but the error is hard to track as it shows up only sometimes)
I fixed the compile-error with a dedicated destructor of osgGA::GUIEventHandler"
2013-11-21 14:21:55 +00:00
Robert Osfield
9a9efb1c58 From Farshid Lashkari, " 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 14:08:01 +00:00
Robert Osfield
a5d78953d4 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:59:00 +00:00
Robert Osfield
1e2bead9bc Converted std::max to osg::maximum to fix VS2013 build error 2013-11-21 11:02:08 +00:00
Robert Osfield
a54b999ccc Added Geometry::drawVertexArraysomplemetation(..) and drawPrimitivesImplemenation(..) methods that are called from drawImplementation(..). These new vertex methods
allow subclasses from osg::Geometry to specialize the vertex array setup or how the primitives are dispatched to OpenGL.
2013-11-21 10:31:34 +00:00
Robert Osfield
dbf88cc209 From Stephan Huber, "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-18 14:21:06 +00:00
Robert Osfield
d8c1c4bbeb From Stephan Huber, compile fix for OpenGL ES on iOS. 2013-11-18 13:31:44 +00:00
Robert Osfield
e0d3ab4412 From Stephan Huber, * GUIEventAdapter: add support for getting normalized touch points
* MultiTouchTrackball: some code cleanup and support for normalized touch-points
* oscdevice: receiving and sending multi-touch-events via the Cursor2D-profile from TUIO
* added some documentation
2013-11-18 13:25:55 +00:00
Robert Osfield
d7442e7456 Added panning and zooming functionality to transfer function UI prototype code. 2013-11-18 12:46:00 +00:00
Robert Osfield
80c45ad46a Added BoundingBox::contains(const vec_type& v, value_type epsilon) method with new epsilon parameter to make it easier to test for containment in the presence of numerical errors 2013-11-18 12:45:04 +00:00
Robert Osfield
c194e92df8 Moved Handled propety from GUIEventAdapter to Event base class.
Added CameraManipulator::finishAnimation() method to allow application code to stop any animation/throw of manipulators.
2013-11-15 16:15:09 +00:00
Robert Osfield
835d9455a9 Restored the rescaleToZeroToOneRange() to address rendering issues. 2013-11-12 14:21:00 +00:00
Robert Osfield
eede49d15c Removed unused variables 2013-11-11 10:55:51 +00:00
Robert Osfield
829cd9718a From Stepan Huber, "attached are my changes for the osc, zeroconf and resthttp-plugin to use the new event-class. I refactored the osgoscdevice-example so that it’s working again. " 2013-11-08 12:28:51 +00:00
Robert Osfield
1a90789402 Added support for assinging and display transfer functions 2013-11-08 12:26:14 +00:00
Robert Osfield
25b8b8bd16 Quietened down debug messages 2013-11-08 12:25:35 +00:00
Robert Osfield
70c78264dc Changed the LineSegmentIntersector to RayIntersector to provide more reliable intersections with flat meshes. 2013-11-07 12:37:10 +00:00
Robert Osfield
7a2900e238 Added osgUtil::Intersector::PrecisionHint member and set it's default to USE_DOUBLE_COMPUTATIONS, and implemented support for use double or float maths internally in LineSegmentIntersector and RayIntersector classes 2013-11-07 12:35:34 +00:00
Robert Osfield
fef39b6215 Re-enabled the disable of the transfer function 2013-11-06 09:50:16 +00:00
Robert Osfield
2ebe81cb0e Fixed handling of web cams 2013-11-06 09:49:51 +00:00
Robert Osfield
6f6c44446c Introduced a cast(T) method into the ImageUtils template functor to allow code reading images to handle casting from source data to a form that a user can use more conviently 2013-11-06 09:23:21 +00:00
Robert Osfield
ef3a65b93f Restructed the call to avformat_open_input to provide more information. 2013-11-06 09:20:35 +00:00
Robert Osfield
2b3665f010 Fixed typo 2013-11-05 15:23:32 +00:00
Robert Osfield
ffb0a8e545 From Stephan Huber, "Build Problem with osgGA at MacOS with Xcode 5"..."attached you'll find a possible solution for the issue. This will add a new option to cmake called OSG_CXX_LANGUAGE_STANDARD which defaults to C++11. If you set it to C++98 it will setup the project accordingly." 2013-11-01 14:40:50 +00:00
Robert Osfield
a10e9c6950 Added initial shell of new osgtransferfunction example that will be tested bed for upcomming transfer function editing UI. 2013-10-28 17:46:07 +00:00
Robert Osfield
ff8fe4143e From Likasz Izebski, "added support for etc2/eac compression" 2013-10-28 12:03:55 +00:00
Robert Osfield
ac383e15c1 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
4a660f6266 Introduce new osgGA::Event and osgGA::EventHandler base classes that the old GUIEventAdapter and GUIEventHandler now subclass from.
The new osgGA::Event is written to support more generic events than the original GUIEventAdapter which are written for keyboard and mouse events.
2013-10-25 14:54:15 +00:00
Robert Osfield
2025c511f0 Remoed -fpermissive 2013-10-25 14:46:37 +00:00
Robert Osfield
191eabd3ab Fixed warning 2013-10-25 09:02:39 +00:00
Robert Osfield
2a9ed125b8 Fixed warning 2013-10-24 20:22:13 +00:00
Robert Osfield
b3603f76e4 Removed depreated glib call 2013-10-24 19:56:04 +00:00
Robert Osfield
95e8d2838c Fixed FileInfo self intialization bug 2013-10-24 19:32:00 +00:00
Robert Osfield
1861e025e9 Fixed build problems with the OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION off 2013-10-24 17:43:02 +00:00
Robert Osfield
ded27b4971 From Stephan Huber, "attached you’ll find a small enhancement for present3d. Now you can get advanced help via —help-all etc (similar to osgviewer)" 2013-10-24 12:15:37 +00:00
Robert Osfield
37fa2d698f From Stephan Huber, add support for controlling the OSXMenubarBehavior set by DisplaySettings. 2013-10-24 10:10:16 +00:00
Robert Osfield
234adf7daf Cleaned up addChild/getChild/setChild/getNumChildren methods and added readNodeFile, readImageFile and readObjectFile functions 2013-10-24 09:06:52 +00:00
Robert Osfield
f548bc79d4 Added support for Group::addChild/setChild/getChild/getNumChildren. 2013-10-23 16:17:26 +00:00
Robert Osfield
c45f3aa4fb Merged changes to DisplaySettings from Stephan Huber in prep for controlling the menu hiding behaviour under OSX.
Added new WindowSystemInterface::setDisplaySettings() method to provide a mechanism for passing settings onto the WindowSystemInterface so it can then set up the system appropriately.

Added assignment of the DisplaySettings to the WindowSystemInterface in Viewer/ComppsiteViewer::realize().
2013-10-22 19:12:34 +00:00
Robert Osfield
b7b7186cf8 Preliminary remapping of internalFormat for GL3 core profile 2013-10-22 18:58:15 +00:00
Robert Osfield
3dba54c10a Fixed warnings 2013-10-22 16:28:20 +00:00
Robert Osfield
1196f153fc From Colin McDonald, "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:32:21 +00:00
Robert Osfield
c34a8e4ddb From Colin McDonald, "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."
2013-10-22 11:26:45 +00:00
Robert Osfield
5ed399ca48 Fixed handling of osg::Program so that it's not overriden by shader composition when enabled 2013-10-22 11:18:28 +00:00
Robert Osfield
4493d11ca3 Added State::releaseGLObjects() and ShaderComposer::releaseGLObjects() to avoid problems with cleanup of graphics context 2013-10-21 16:35:12 +00:00
Robert Osfield
074eb8e41c Build fixes for clang 2013-10-21 09:54:41 +00:00
Robert Osfield
a68f0f26a8 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:49 +00:00
Robert Osfield
9146ba7d44 From Vladimir Chebeav, fix for removal of nested callbacks 2013-10-18 08:37:18 +00:00
Robert Osfield
5bfb2ef26d From Konstantin Matveyev, "Multiple light fix in FBX-importer" 2013-10-18 07:55:26 +00:00
Robert Osfield
bddeecdbee From Colin McDonald, "Some missing updates to the serializer static build support." 2013-10-18 07:52:18 +00:00
Robert Osfield
49625a1baf From Andreas Henne, "in my application I use the TrackballDragger, the ScaleAxisDragger and the TranslateAxisDragger. Unfortunately these draggers are very thin and they do not provide methods to change their visual appearance. Another problem that I noticed is that lighting on the cones and boxes of the TranslateAxisDragger and ScaleAxisDragger is incorrect when the draggers are scaled due to not normalized normals. This small patch adresses these problems, providing methods to make the draggers thicker. I have attached a zip archive containing the corresponding files and also a modified osgManipulator example that makes use of the modifications. I don't want to retain any copyright." 2013-10-18 07:31:22 +00:00
Robert Osfield
a97e092619 Fix for error in getting the uniform block max name length, fix suggested by Christopher Fennell. 2013-10-17 18:29:39 +00:00
Robert Osfield
7de6a0c9e2 From Stephan Huber, build fix 2013-10-17 14:02:15 +00:00
Robert Osfield
eb7c2ae3f7 Added set/get to the ImageSerializer and removed some redudent comments 2013-10-10 20:43:03 +00:00
Robert Osfield
cd86995d7d 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:24 +00:00
Robert Osfield
08ec0a11bf From Laurens Voerman, compile fix for VisualStudio 2013-10-10 14:45:57 +00:00
Robert Osfield
0dc55ebc86 Laurens Voerman, "my cmake (2.8.10.2 generating for Visual Studio 11 Win64) doesn't like
include(${CMAKE_MODULE_PATH}/FindPackageHandleStandardArgs.cmake)
in CMakeModules/FindLua52.cmake
changing to a more common
    include(FindPackageHandleStandardArgs)
solves my problem."
2013-10-10 14:41:41 +00:00
Robert Osfield
4e4d2b35cf Added get/set method to Serializer to allow pointer passing without going through InputStream/OutputStream. 2013-10-10 09:28:26 +00:00
Robert Osfield
9c53794bc7 Implemented preliminary readNode/readImage support in the lua plugin allow a lua script to create a scene graph as return it. 2013-10-09 15:32:56 +00:00
Robert Osfield
e8b5272b02 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:05:09 +00:00
Robert Osfield
20fbad6c29 Cleaned up line endings 2013-10-07 09:33:46 +00:00
Robert Osfield
da2d7e2dde Added support for automatically select Lua 5.2 is it's available, then falling back to checking for Lua 5.1 otherwise. 2013-10-04 20:42:23 +00:00
Robert Osfield
d260b16981 Moved code across to use lua_userdata to manage pointer to osg::Object that is ref()/unref() 2013-10-04 19:48:03 +00:00
Robert Osfield
79e2d1309f Added support for Lua 5.2 and osg::Object creation from within Lua scripts. 2013-10-04 16:30:25 +00:00
Robert Osfield
c77dc4fe9e Added createObject() interface 2013-10-04 16:29:45 +00:00
Robert Osfield
b5b020a138 Updated version number after 3.3.0 dev release 2013-10-04 16:28:49 +00:00
Robert Osfield
910cfeea60 Fixed errors in Contributors list 2013-10-03 16:20:29 +00:00
Robert Osfield
83c396b13b From Jan Peciva, RayIntersector implementation 2013-10-03 08:45:57 +00:00
Robert Osfield
69f2fb56b3 From Colin McDonald and Robert Osfield, "When a serializer shared library is loaded it registers all of
the wrappers it contains.  The registration creates a prototype
object for all of the wrapped classes.  For some of the higher-level
classes this can be a bit heavy.

I noticed a problem with a model which required a single class from
osgSim.  When osgdb_serializers_osgsim.so was loaded it registered
wrappers and created prototype objects for all of the osgSim classes,
including osgSim::ScalarBar.  The constructor for that class creates
several drawables, and loads arial.ttf using the freetype plugin.  I
don't need that, and don't even ship the font or plugin with my
application, resulting in an unexplained warning message loading
the model.

I've modified the ObjectWrapper class to defer the prototype object
creation until if & when actually required."
2013-10-02 13:59:00 +00:00
Robert Osfield
0ec35d5a5d 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:58 +00:00
Robert Osfield
0eb435e118 Re-ordered the public/protected sections to keep the public section all together 2013-10-02 11:28:38 +00:00
Robert Osfield
60d4b71d2b 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:29 +00:00
Robert Osfield
59caf4a48e Fixed build with no automatic ref_ptr<> conversion 2013-10-01 19:34:21 +00:00
Robert Osfield
fcc14e467a Updated AUTHORS files 2013-10-01 19:31:48 +00:00
Robert Osfield
11168fea66 Updated ChangeLog in prep for dev release 2013-10-01 19:00:02 +00:00
Robert Osfield
5015ec4b5d From Aurelien Albert, "I'm working with OSG and a customer low-level OpenGL library.
To make easier "lazy apply" on the customer OpenGL shaders, the easiest way was to add an accessor to current OSG state's UniformMap.

I've also added accessors for modes and texture, since it could be usefull in the same way.

All methods are const, so I think there is no side-effects."
2013-10-01 17:01:21 +00:00
Robert Osfield
270883d3f4 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:20 +00:00
Robert Osfield
c399db82a3 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:56 +00:00
Robert Osfield
76d833f332 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:26 +00:00
Robert Osfield
68c22efa58 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:18 +00:00
Robert Osfield
c626b0e1f6 From Jeffrey Kinross, "I ran into an issue with case sensitivity on OS X and the OSXAVFoundation code.
In CMakeList.txt there is a case sensitivity issue which a fix was posted by Robert Osfield in the users forum.

I also had to rename the files OSXAvFoundationCoreVideoTexture.h and OSXAvFoundationCoreVideoTexture.cpp to OSXAVFoundationCoreVideoTexture.h and OSXAVFoundationCoreVideoTexture.cpp

Finally in OSXAvFoundationCoreVideoTexture.cpp the include OSXAVFoundationVideo.H was updated to OSXAVFoundationVideo.h"
2013-09-30 18:32:41 +00:00
Robert Osfield
d304ed7d73 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:15:51 +00:00
Robert Osfield
0ba856a637 2013-09-30 10:28:14 +00:00
Robert Osfield
8bc85764ff Unified Vec/Plane/Quat handling code. 2013-09-27 18:43:35 +00:00
Robert Osfield
ff925f1d86 Added support for getting Vec* and Matrix objects from Lua stack and assigning them as OSG object properties. 2013-09-27 13:04:04 +00:00
Robert Osfield
43cb1b3a41 Initial cut of setting and getting osg::Object properties within Lua scripts 2013-09-26 17:27:49 +00:00
Robert Osfield
6d8f40d13a Added support for passing parameters in and out of scripts.
Implemented support for osg::ValueObject in LuaScriptEngine.
2013-09-24 15:17:42 +00:00
Robert Osfield
796314c339 Changed NodeVisitor so that is subclasses from osg::Object rather than osg::Referenced to enable it to be used with serialization and scripting 2013-09-24 15:08:23 +00:00
Robert Osfield
874a7ed3b3 Removed redundent spaces 2013-09-24 08:56:47 +00:00
Robert Osfield
351f98b10d Added test for osgGA::GUIEventAdapter 2013-09-23 14:10:36 +00:00
Robert Osfield
3af70f13a3 Removed unnceccesary setNumChildrenRequiringUpdateTraversal from VolumeTile constructor. 2013-09-20 15:43:24 +00:00
Robert Osfield
8f3ee7c649 Added initial cut of white and black lists 2013-09-20 10:44:24 +00:00
Robert Osfield
6bc413530e Added compoundClassName() convinience method to standardize the generation of the compoundClassName. 2013-09-20 10:25:23 +00:00
Robert Osfield
6e3f893a0e Added type maps to help with querrying supported type names 2013-09-20 10:04:50 +00:00
Robert Osfield
250d9f2ed7 Introduce osgDB::PropetyInterface class that provided a generic interface for get/setting properties on scene graph objects, utilizing the osgDB serializers to do
the actual interface query and set/gets.
2013-09-19 16:19:32 +00:00
Robert Osfield
f42481b60f Removed unneccessary return 2013-09-19 16:18:20 +00:00
Robert Osfield
24ecfb1a48 Added access methods to Serializer to help with using wrappers for other purposes such as script integration.
Added Vec*i and Vec*ui support to serializers
2013-09-11 15:44:08 +00:00
Robert Osfield
31cd80cea7 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:17:59 +00:00
Robert Osfield
82bbcef117 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
898c716841 Added osgPresentation::Show node and implementations with basic property reporting for various internal nodes of presentation graph 2013-09-10 09:23:30 +00:00
Robert Osfield
085bfd83d7 From Wang Rui, "The Python header will look for its libraries using "#pragma comment(lib,"python32_d.lib")" for MSVC. So user-specified libraries will not really be set for the osgdb_python plugin. This small fix may help locate the Python libraries after putting the CMakeLists.txt into src/osgPlugins/python
"
2013-09-09 16:02:32 +00:00
Robert Osfield
27b57dbf0c From Colin Cochran, OES support for point sprites 2013-09-09 14:58:25 +00:00
Robert Osfield
e9697859bd From Colin McDonald, "Add test for GL_EXT_framebuffer_object extension : 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:13 +00:00
Robert Osfield
b20a74b017 From Ulrich Hertlein, "Patch for FindAVFoundation to work with OS X 10.9" 2013-09-09 12:44:36 +00:00
Robert Osfield
80456598e0 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:52 +00:00
Robert Osfield
61ccd56d25 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:18 +00:00
Robert Osfield
7050c59cae Initial cut of Audio/Volume/Movie/Image presentation objects 2013-09-06 09:35:56 +00:00
Robert Osfield
df48d440e4 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:05 +00:00
Robert Osfield
94735a8364 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:09 +00:00
Robert Osfield
19f84b52e7 Fixed warnings 2013-09-05 10:04:56 +00:00
Robert Osfield
0d2825e06f 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:42:00 +00:00
Robert Osfield
73250601f0 Added missing Model.cpp 2013-09-05 08:22:27 +00:00
Robert Osfield
9201cf8d00 Moved the property test from the model to presentation to test out the property inheritance scheme 2013-09-04 17:27:26 +00:00
Robert Osfield
856ec46467 Added PrintProperties visitor 2013-09-04 16:25:18 +00:00
Robert Osfield
ccf7bbdb50 Added PrintPropertiesAction to osgPresentation 2013-09-04 15:39:17 +00:00
Robert Osfield
9f5e131203 Added Action class NodeVisitor that supports osgPresentation nodes. 2013-09-04 10:33:11 +00:00
Robert Osfield
3c106e4dd7 Added test for osgPresentatation::Group::getSupportedProperties() 2013-09-03 15:50:28 +00:00
Robert Osfield
fdfe3210ce Added beginings of Text implementation 2013-09-03 10:17:06 +00:00
Robert Osfield
f5deda56a6 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:56:48 +00:00
Robert Osfield
b9ecec6452 Refactored the use of epsilon in the clamping of the start/end points of the LineSegmentIntersector to better handle numerical precision issues. 2013-09-02 10:56:14 +00:00
Robert Osfield
698365e47f Fixed double copy in StackedTransform copy constructor 2013-09-02 09:12:24 +00:00
Robert Osfield
7c78101621 Added IO test for new osgPresentation nodes 2013-09-02 08:29:09 +00:00
Robert Osfield
820ba45fab Added Audio, Image, Movie, Model and Volume class to osgPresentation. 2013-09-01 17:24:35 +00:00
Robert Osfield
de428146b9 Fixed build 2013-08-23 16:47:27 +00:00
Robert Osfield
ef32fab30e Added color property to FontData parsing 2013-08-23 11:42:52 +00:00
Robert Osfield
d7038e1be1 Quitened down debug message 2013-08-22 13:39:36 +00:00
Robert Osfield
11685a3e0c Removed debug messages 2013-08-22 12:37:49 +00:00
Robert Osfield
79c9aa7d02 Quitened down debug message 2013-08-22 12:07:55 +00:00
Robert Osfield
ffa58776fe Quitened down debug message 2013-08-22 11:18:45 +00:00
Robert Osfield
db449b9e09 Added warning when model file has not be found 2013-08-22 10:09:21 +00:00
Robert Osfield
464628b5c4 Reduced debug message level, and added a notify message for when an image isn't loaded 2013-08-22 10:05:29 +00:00
Robert Osfield
fcde15e136 Added test for serializers and fixed serializers 2013-08-22 07:49:22 +00:00
Robert Osfield
c678fed113 Added initial classes for present3D refactor 2013-08-21 19:54:03 +00:00
Robert Osfield
4e3715d4bb Moved old osgPresentation source files to osgPresentation/deprecated subdirectory. 2013-08-18 18:10:39 +00:00
Robert Osfield
28ce02915a Moved old present3D sources into local deprecated directory to clean up the main present3D source directory for future refactored present3D 2013-08-18 16:59:11 +00:00
Robert Osfield
bd7ec9c5f7 Added initial cut of basic scripting support, introducing an osg::Script object to wrap up the individual scripts, osg::ScriptCallback for assigning a Script as node callback and an osg::ScriptEngine base class that plugins implement to provided support for specific scripting languages.
Provided are lua, python and V8 (for javascript) plugins that just open up enough of a link to the respective libs to run a script, there is no scene graph <-> script communication in current implementation.
2013-08-09 16:51:06 +00:00
Robert Osfield
babd6e0ee7 Removed CameraNode reference 2013-08-09 11:00:55 +00:00
Robert Osfield
eba9291e5c Removed unused includes 2013-08-09 07:46:22 +00:00
Robert Osfield
ef88a54125 Removed old cursor code 2013-08-09 07:38:32 +00:00
Robert Osfield
93ebfd6217 Added translucent version of cushion which isn't depth tested to enable one to see the cursor even when it's behind other objects 2013-08-08 17:21:20 +00:00
Robert Osfield
82401defc7 Added osgPresentation::Cursor class to wrap up 3D cursor in the scene functionality 2013-08-08 16:49:33 +00:00
Robert Osfield
835ee7aa8e Added osgpresentation example as a test bed for new osgPresentation object model.
First cut of example test bed is to test how easy it is to build against Lua, V8 and Python for purposes of running embedded scripts.
2013-08-07 17:08:38 +00:00
Robert Osfield
0c609bc17e 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:34 +00:00
Robert Osfield
90703f99ee Added missing initializer for _epsilon 2013-08-01 17:38:34 +00:00
Robert Osfield
5f6a1f4093 From Anish Thomas, added catch for to an empty DrawElementsUInt creation. 2013-08-01 11:25:02 +00:00
Robert Osfield
b69745f178 Updated ChangeLog and AUTHORS file 2013-08-01 10:38:02 +00:00
Robert Osfield
14f63cbe67 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:12 +00:00
Robert Osfield
46ec50aecb 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:05 +00:00
Robert Osfield
837a680849 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
07365c1073 Added osg::RenderInfo::pushRenderBin()/popRenderBin() and RenderInfo::getRenderBinStack() and getCameraStack() access methods for getting access to the current RenderBin/RenderStage. 2013-08-01 07:19:45 +00:00
Robert Osfield
364e2765e7 Added Intersector::get/setEpsilon(double) to allow users to control what epsilon is used by the LineSegmentIntersector when doing testing of itersections with bounding boxes 2013-07-31 13:11:49 +00:00
Robert Osfield
9c9939e5d4 From Aurelien Albert, "Here is the code to get access to OpenGL handle of an osg::FrameBufferObject" 2013-07-31 07:11:07 +00:00
Robert Osfield
9878a83894 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:31 +00:00
Robert Osfield
56cb7de72a From Sergey Kurdakov, fixed GLES2 invalid enumerant warning by disabling the check against GL_MAX_TEXTURE_COORDS under GLES. 2013-07-31 06:42:49 +00:00
Robert Osfield
52761f2c29 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:33 +00:00
Robert Osfield
fb8db6cb73 Removed trailing spaces 2013-07-30 06:36:49 +00:00
Robert Osfield
846001f06d Merged from OSG-3.2 branch the removal of check for Asio under Windows 2013-07-30 06:12:31 +00:00
Robert Osfield
0620f249a5 Changed default of serialize draw to off 2013-07-24 17:30:46 +00:00
Robert Osfield
019bccfa6f Pulled in READE, NEWS and AUTHORS changes from OSG-3.2 branch. 2013-07-24 14:24:33 +00:00
Robert Osfield
75fd039dba Added GL2Extensions::isDrawBuffersSupported() and usage of this in FrameBufferObject.cpp to prevent crash under GLES2 when users attempt to use MRT when it's not supported 2013-07-24 13:02:32 +00:00
Robert Osfield
9b733baf02 Updated NEWS from OSG-3.2 branch 2013-07-24 12:51:13 +00:00
Robert Osfield
ee5a1b0a83 Fixed warning 2013-07-24 12:48:59 +00:00
Robert Osfield
8d3e46dfac Updated SO version for post 3.2 era. 2013-07-24 12:25:18 +00:00
Robert Osfield
75226e6b68 Added getCallbacks() methods 2013-07-24 12:17:06 +00:00
Robert Osfield
085d3af14c From Rocco Martino, build fix for compiling against ffmpeg/trunk 2013-07-23 18:11:35 +00:00
Robert Osfield
ca3efe6bdc Added NOT ANDROID to force use of posix API when building for Android under Windows 2013-07-23 15:28:31 +00:00
Robert Osfield
c21b60b038 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:28 +00:00
Robert Osfield
51075421d3 Fixed crash when open(..) returns an error. 2013-07-23 09:54:25 +00:00
Robert Osfield
f6c3c8ac00 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:39 +00:00
Robert Osfield
fcca4032ef 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
a802729562 Added FRAME_BUFFER_OBJECT enum 2013-07-22 10:15:59 +00:00
Robert Osfield
95d5a19319 Updated OpenThreads version 2013-07-22 10:15:44 +00:00
Robert Osfield
4a2e1534d5 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:05:54 +00:00
Robert Osfield
f21a1dc9ad Added default setting of BIND_PER_VERTEX when applying Geometry::setTexCoordArray() 2013-07-19 20:59:09 +00:00
Robert Osfield
b3aa1bda1d Updated OpenThreads version to be in sync with OSG version 2013-07-19 17:00:24 +00:00
Robert Osfield
cda0b615de Updated version number for svn/trunk to 3.3.0 for all new feature development 2013-07-19 14:55:36 +00:00
1263 changed files with 154669 additions and 133510 deletions

94
.gitignore vendored Normal file
View File

@@ -0,0 +1,94 @@
doc/all_Doxyfile
doc/auto_Doxyfile
doc/core_Doxyfile
doc/openscenegraph.doxyfile
doc/openthreads.doxyfile
doc/OpenSceneGraphReferenceDocs/
doc/OpenThreadsReferenceDocs/
cmake_uninstall.cmake
include/OpenThreads/Config
include/OpenThreads/Version
include/osg/Config
include/osg/GL
include/osg/Version
include/osgQt/Version
src/osgQt/__
lib/
bin/
*.pc
*.conf
CMakeCache.txt
CMakeFiles
CMakeScripts
Makefile
cmake_install.cmake
install_manifest*.txt
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
# Platform Specifics - auto generated files
PlatformSpecifics/Windows/*.rc
# Visual studio - project files
*.sln
*.suo
*.vcxproj
*.vcxproj.filters
*.vcxproj.user
# Visual Studio - Build Results
[Dd]ebug/
[Rr]elease/
[Mm]in[Ss]ize[Rr]el/
[Rr]el[Ww]ith[Dd]eb[Ii]nfo/
# Visual Studio - Browsing Database File
*.sdf
*.opensdf
#osx xcode
DerivedData/
*.DS_Store
*.build
*.xcodeproj
#CPACK related files
CPackConfig-*.cmake
_CPack_Packages/
#packages
*.tar.gz
*.zip

36
.travis.yml Normal file
View File

@@ -0,0 +1,36 @@
matrix:
fast_finish: true
include:
#Linux build
- os: linux
dist: trusty
language: cpp
env:
#- LLVM_VERSION=3.8
sudo: false
cache:
apt: true
directories:
- $HOME/.ccache
compiler:
#- clang
- g++
addons:
apt:
sources:
#- llvm-toolchain-precise-3.8
- ubuntu-toolchain-r-test
packages:
#- clang-3.8
- g++
- cmake
# OSX build
- os: osx
language: cpp
script:
- mkdir build
- cd build
- travis_wait 60 cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../product -DBUILD_OSG_EXAMPLES=ON ..
- make install -j3

View File

@@ -1,110 +1,116 @@
OpenSceneGraph Library 3.2.0
OpenSceneGraph Library 3.4.1
510 Contributors:
562 Contributors:
Firstname Surname
-----------------
Robert Osfield
Don Burns
Stephan Huber
Paul Martz
Farshid Lashkari
Mathias Fr<46>hlich
Marco Jez
Farshid Lashkari
Wang Rui
Jean-S<>bastien Guay
Mike Weiblen
Ulrich Hertlein
Mike Weiblen
Sukender
Eric Wing
Sukender
Cedric Pinson
Brede Johansen
Bob Kuehne
Wojciech Lewandowski
Michael Platings
Geoff Michel
Wojciech Lewandowski
Eric Sokolowsky
Laurens Voerman
David Callu
Trajce Nikolov
Colin McDonald
Trajce Nikolov
Tim Moore
Martin Lavery
Laurens Voerman
Tree
Mattias Helsing
Jason Beverage
Tree
Pjotr Svetachov
Luigi Calori
Alberto Luaces
Mike Wittman
Jan Peciva
Chris Hanson
Roland Smeenk
Roger James
Jeremy Moles
Jason Beverage
Jan Peciva
Jannik Heller
J.P. Delport
Mattias Helsing
Andy Skinner
Magnus Kessler
David Fries
Andy Skinner
Paul Melis
Alberto Luaces
Luc Frauciel
Tom Jolley
Paul Melis
Luc Frauciel
Aurelien Albert
Pavel Moloshtan
Brad Christiansen
Torben Dannhauer
Terry Welsh
Olaf Flebbe
Mathieu Marache
Lionel Lagarde
Jason Daly
Art Tevs
Philip Lowman
Per Fahlberg
Norman Vine
Terry Welsh
Serge Lages
Lionel Lagarde
Chris Denham
Alberto Farre
Sherman Wilcox
Robert Michael
Serge Lages
Romano Jos<6F> Magacho da Silva
Mourad Boufarguine
Alberto Farre
Glenn Waldron
Andr<EFBFBD> Garneau
Adrian Egli
Ruben Lopez
Sebastian Messerschmidt
Randall Hopper
Kristofer Tingdahl
Jan Ciger
Glenn Waldron
Ruben Lopez
Robert Michael
Gideon May
Don Tidrow
Aurelien Albert
Torben Dannhauer
Stephane Lamoliatte
Romano Jos<6F> Magacho da Silva
Michael Gronager
Martin Naylor
Joakim Simonsson
David Spilling
Daniel Sj<53>lie
Bryan Thrall
Fabien Lavignotte
Mike Connell
Melchior Franz
Johannes Baeuerle
Andreas Ekstrand
Riccardo Corsi
Rafa Gaitan
Mike Connell
Fabien Lavignotte
Thomas Hogarth
Riccardo Corsi
Melchior Franz
Konstantin Matveyev
Johannes Baeuerle
Neil Hughes
Martin Beckett
Marc Helbling
Jordi Torres
Joran Jessurun
Gino van den Bergen
Frederic Marmond
David Guthrie
Csaba Halasz
Cory Riddell
Chuck Seberino
Boris Bralo
Yefei He
Thomas Hogarth
Sondra Iverson
Simon Julier
Rune Schmidt Jensen
Ravi Mathur
Rainer Oder
Nico Kruithof
Martin Aumueller
@@ -112,20 +118,24 @@ Mario Valle
Lukasz Izdebski
Jorge Izquierdo Ciges
Gordon Tomlinson
Frederic Marmond
Frederic Bouvier
Carlo Camporesi
Ben Discoe
Bj<EFBFBD>rn Blissing
Alexander Sinditskiy
Thibault Genessay
Sasa Bistrovic
Ravi Mathur
Ralf Habacker
Pjotr Svetachov
Neil Groves
Mikhail Izmestev
Markus Trenkwalder
Loic Dachary
Joseph Steel
John Shue
Hartwig Wiesmann
Brad Colbert
Ben Discoe
Vladimir Chebaev
Vivek Rajan
Uwe Woessner
Tony Horrobin
@@ -133,6 +143,7 @@ Thom DeCarlo
Tatsuhiro Nishioka
Tanguy Fautr<74>
Sean Spicer
Ryan Kawicki
Richard Schmidt
Peter Hrenka
Paul de Repentigny
@@ -144,20 +155,16 @@ Martins Innus
Maciej Krol
Lilin Xiong
Leandro Motta Barros
Jordi Torres
Julien Valentin
Johan Nouvel
Hartwig Wiesmann
Javier Taibo
Donn Mielcarek
Corbin Holtz
Blasius Czink
Alexander Sinditskiy
Alexander Irion
Toshiyuki Takahei
Sebastien Grignard
Ryan Kawicki
Rudolf Wiedemann
Romano Magacho
Mikhail Izmestev
Maria Ten
Liang Aibin
Katharina Plugge
@@ -174,34 +181,43 @@ Bruce Clay
Bradley Anderegg
Andreas Goebel
Alok Priyadarshi
Alberto Barbati
Ali Botorabi
Alan Dickinson
Wee See
Vladimir Shabanov
Tugkan Calapoglu
Tim Daoust
Sylvain Marie
Sohey Yamamoto
Sergey Leontyev
Sebastian Messerschmidt
Santosh Gaikwad
Ryan Pavlik
Robert Milharcic
Rene Molenaar
Piotr Domagalski
Philippe Renon
Phil Atkin
Pawel Ksiezopolski
Patrick Neary
Nathan Monteleone
Miha Rav<61>elj
Miguel Escriva
Mattias Linde
Mark Sciabica
Marcin Prus
Lee Butler
Lars Nilsson
Konstantin Sinitsyn
Ken Sewell
Julian Ortiz
Julen Garcia
John Kaniarz
Johannes Scholz
Jim Vaughan
Jeremy Bell
Jaromir Vitek
James French
Jaap Glas
Guillaume Millet
Gary Quinn
Garrett Potts
@@ -210,45 +226,48 @@ Fabio Mierlo
Doug McCorkle
Donald Cipperly
Don Leich
Don Burns
Dietmar Funck
Colin Cochran
Christian Ruzicka
Christian Buchner
Charles Cole
Blake Williams
Bj<EFBFBD>rn Hein
Aur<EFBFBD>lien Chatelain
Antoine Hue
Andrew Bettison
Andreas Henne
Anders Backman
Ali Botorabi
Alexander Wiebel
Alessandro Terenzi
Alberto Barbati
Zach Deedler
Yuzhong Shen
Wee See
Warren Macchi
Vladimir Chebaev
Vincent Bourdier
Terrex
Terrex
Tassilo Glander
Sylvain Marie
Steve Lunsford
Stephane Simon
Stephan Eilemann
Stanislav Blinov
Sergey Polischuk
Roni Zanolli
Raymond de Vries
Ralf Kern
Piotr Gwiazdowski
Pierre Haritchabalet
Perry Miller
Pawel Ksiezopolski
Paul Palumbo
Paul Obermeier
Nguyen Van Truong
Nathan Cournia
Morten Haukness
Morn<EFBFBD> Pistorius
Michael Mc Donnell
Michael Henheffer
Michael Guerrero
Maya Leonard
Max Bandazian
Mathias Fiedler
Mathew May
@@ -258,20 +277,17 @@ Martin Lambers
Martijn Kragtwijk
Marius Heise
Marcin Hajder
Marcel Pursche
Lilith Bryant
Lars Nilsson
Kristofer Tingdahl
Kevin Moiule
Keith Steffen
Julen Garcia
Joseph Winston
John Aughey
Johannes Scholz
Joachim Pouderoux
Jean-Christophe Lombardo
Javier Taibo
Jan Klimke
James Turner
James Moliere
Jaap Glas
Igor Kravtchenko
Himar Carmona
He Sicong
@@ -279,30 +295,37 @@ Guy Volckaert
Gustavo Wagner
Guillaume Taze
Guillaume Chouvenc
Giuseppe Donvito
Gill Peacegood
Giampaolo Vigan<61>
Gerrick Bivins
George Tarantilis
Ferdi Smit
Eric Buehler
Eduardo Poyart
Edgar Ellis
Dmitry Marakasov
Dimi Christopoulos
Diane Delallée
Diane Delall<EFBFBD>e
David Longest
David Ergo
Daniel Trstenjak
Craig Bosma
Claus Scheiblauer
Christophe Loustaunau
Christian Kehl
Bradley Baker Searles
Brad Anderegg
Aric Aumann
Anish Thomas
Andrew Sampson
Andrew Lorino
Alexandre Amalric
Aitor Moreno
Zbigniew Sroczynski
Yuri Vilmanis
Xin Li
Wang Lam
Wand Rui
Walter J. Altice
Volker Walkiewicz
Vladimir Vukicevic
@@ -316,36 +339,44 @@ Valeriy Dubov
Vaclav Bilek
Tyge L<>vset
Troy Yee
Torben Dannahauer
Tony Vasile
Tomas Hogarth
Tomas Hnilica
Todd Furlong
Tobias Ottenweller
Tino Schwarze
Tim George
Thorsten Brehm
Thomas Weidner
Tan Dunning
Tamer Fahmy
Stewart Andreason
Steven Thomas
Stephan Wenglorz
Simon Hammett
Simon Carmody
Simon Buckley
Sid Byce
Shuxing Xiao
Shane Arnott
Sergey Kurdakov
Sebastien Kuntz
Ruth Lang
Ruben The
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
@@ -359,9 +390,11 @@ Philip Lamb
Petr Salinger
Peter Bear
Peter Amstutz
Per Nordqvist
Paul Idstein
Paul Fredrikson
Paul Fotheringham
Paul Cheyrou-Lagreze
Pau Garcia
Patrick Hartling
Parag Chaudhur
@@ -372,21 +405,26 @@ Oren Fromberg
Oliver Neumann
Ole-Morten Duesund
Nicolas Brodu
Nick Thu
Nick Black
Mojtaba Fathi
Mirko Viviani
Mikkel Gjøl
Mikkel Gj<EFBFBD>l
Mike Krus
Mike Garrity
Miha Ravsel
Mick Thu
Michal Durkovic
Michael Schanne
Michael Polak
Michael Morrison
Michael Logan
Michael Kapelko
Michael Bach Jensen
Maya Thu
Maya Leonard
Max Rhiener
Max Behensky
Mauricio Hofmam
Matthias Helsing
Matthew May
Matthew Johnson-Roberson
Matt Green
@@ -399,20 +437,19 @@ Martin Innus
Martin Beck
Marius Kintel
Mario Guimaraes
Marcus Hein
Marco Thu
Marco Sciabica
Marco Lehmann
Marcel Pursche
Maik Keller
Lukas Diduch
Louis Hamilton
Likasz Izebski
Lewis Harmon
Leigh Stivers
Laurence Muller
Laura Cerritelli
Lars Nillson
Kyle Centers
Kristopher Bixler
Konstantin Matveyev
Kim Seokhwan
Kim Bale
Karsten Weiss
@@ -423,20 +460,24 @@ Juergen Rensen
Juan Manuel Alvarez
Juan Hernando
Josh Portway
Jonathan Greig
John Tan
John Hedström
John Grant
John Farrier
John Donovan
John Davis
John Cummings
John Argentieri
Joe Thompson
Joan Abadie
Jim Brooks
Jeroen den Dekker
Jeffrey Kinross
Jay Zuckerman
Jason Howlett
Jason Ballenger
Jan Klimke
James Turner
Jamie Robertson
James Killian
James Athey
J.E. Hoffmann
@@ -447,8 +488,10 @@ Hartmut Seichter
Gunter Huber
Gregory Jaegy
Graeme Harkness
Github It
Gian Lorenzetto
George Papagiannakis
Geoff Thu
Galen Faidley
Frida Schlaug
Frederic Smith
@@ -463,6 +506,8 @@ Ferdinand Cornelissen
Fajran Iman
Fabien Dachicourt
Erik Johnson
Eric Thu
Eric Buehler
Eduardo Alberto
Edmond Gheury
Ed Ralston
@@ -470,6 +515,7 @@ Duvan Cope
Duncan Cavens
Drew Whitehouse
Douglas A. Pouk
Dmitriy Ogalcev
Dean Iverson
David Jung
Danny Valente
@@ -477,11 +523,14 @@ Daniel Stien
Dan Minor
C<EFBFBD>sar L. B. Silveira
Cyril Brulebois
Cory Slep
Cl<EFBFBD>ment B<>sch
Clay Fowler
Claus Steuer
Chuck Sembroski
Christopher Blaesius
Christopher Baker
Christophe Herreman
Christian Ruzicka
Christian Noon
Christian Kaser
Christian Ehrlicher
@@ -490,10 +539,8 @@ Carlos Garcea
Bryce Eldridge
Bruno Herbelin
Brian Keener
Brede Thu
Brandon Hamm
Bora Utka
Bj<EFBFBD>rn Hein
Bjorn Blissing
Bill Prendergast
Bernardt Duvenhage
Benoit Laniel
@@ -501,16 +548,21 @@ Benjamin Wasty
Ben van Basten
Bart Gallet
Axel Volley
Arjun Ramamurthy
Anthousis Andreadis
Andy Preece
Andrew Reyonolds
Andreas Roth
Andreas Jochens
Andre Normann
Alois Wismer
Almalric Alexandre
Allen Bierbaum
Alexey Pavlov
Alberto Jaspe
Alan Purvis
Alan Ott
Alan Harris
Adrien Grandemange
Adrian Clark
Adam Richard

View File

@@ -22,38 +22,43 @@ if(COMMAND cmake_policy)
# tell CMake to prefer CMake's own CMake modules when available
# only available from cmake-2.8.4
if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 8 AND ${CMAKE_PATCH_VERSION} GREATER 3)
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} EQUAL 2 OR ${CMAKE_MAJOR_VERSION} GREATER 2) AND
(${CMAKE_MINOR_VERSION} EQUAL 8 OR ${CMAKE_MINOR_VERSION} GREATER 8) AND
${CMAKE_PATCH_VERSION} GREATER 10)
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 2)
SET(OPENSCENEGRAPH_PATCH_VERSION 0)
SET(OPENSCENEGRAPH_SOVERSION 99)
SET(OPENSCENEGRAPH_MINOR_VERSION 4)
SET(OPENSCENEGRAPH_PATCH_VERSION 1)
SET(OPENSCENEGRAPH_SOVERSION 131)
# 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)
# git tags will be treated as release candidates of given number
SET(OPENSCENEGRAPH_RELEASE_CANDIDATE 0)
SET(OPENSCENEGRAPH_VERSION ${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION}.${OPENSCENEGRAPH_PATCH_VERSION})
@@ -80,78 +85,16 @@ 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}")
## Option to enable Android build using AndroidNDK
OPTION(OSG_BUILD_PLATFORM_ANDROID OFF)
IF(OSG_BUILD_PLATFORM_ANDROID)
# 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)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR)
IF(ANDROID)
INCLUDE(OsgAndroidMacroUtils)
SET(ANDROID TRUE)
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"
ARGS --directory=${CMAKE_BINARY_DIR} NDK_APPLICATION_MK=Application.mk -j${J} NDK_LOG=1
)
ADD_CUSTOM_TARGET(ndk ALL echo
DEPENDS Android-OpenSceneGraph
)
install(DIRECTORY include/ DESTINATION include/
PATTERN ".svn" EXCLUDE
)
install(DIRECTORY ${CMAKE_BINARY_DIR}/include/ DESTINATION include/
)
install(DIRECTORY ${CMAKE_BINARY_DIR}/obj/ DESTINATION obj/
PATTERN ".svn" EXCLUDE
PATTERN "objs" EXCLUDE
)
ADD_DEFINITIONS(-DANDROID)
ENDIF()
# Okay, here's the problem: On some platforms, linking against OpenThreads
# is not enough and explicit linking to the underlying thread library
# is also required (e.g. FreeBSD). But OpenThreads may be built with different
@@ -171,27 +114,15 @@ IF(CMAKE_SYSTEM MATCHES IRIX)
SET(CMAKE_THREAD_LIBS_INIT "" CACHE INTERNAL "")
ENDIF()
OPTION(OSG_MAINTAINER "Enable OpenSceneGraph maintainer build methods, such as making svn branches, tags, updating ChangeLog." OFF)
OPTION(OSG_MAINTAINER "Enable OpenSceneGraph maintainer build methods, such as making git branches, tags, updating ChangeLog." OFF)
IF (OSG_MAINTAINER)
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://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})
ELSE()
SET(SVNSOURCEDIR ${SVNBRANCHDIR}/${OPENSCENEGRAPH_BRANCH})
ENDIF()
SET(GITCOMMAND git)
IF (OPENSCENEGRAPH_RELEASE_CANDIDATE EQUAL 0)
SET(RELEASE_NAME OpenSceneGraph-${OPENSCENEGRAPH_VERSION})
@@ -199,31 +130,38 @@ IF (OSG_MAINTAINER)
SET(RELEASE_NAME OpenSceneGraph-${OPENSCENEGRAPH_VERSION}-rc${OPENSCENEGRAPH_RELEASE_CANDIDATE})
ENDIF()
SET(RELEASE_MESSAGE "Release ${RELEASE_NAME}")
SET(BRANCH_MESSAGE "Branch ${OPENSCENEGRAPH_BRANCH}")
ADD_CUSTOM_TARGET(tag-test
COMMAND echo ${SVNCOMMAND} copy ${SVNSOURCEDIR} ${SVNTAGDIR}/${RELEASE_NAME} -m "Release ${RELEASE_NAME}"
COMMAND echo ${GITCOMMAND} tag -a ${RELEASE_NAME} -m ${RELEASE_MESSAGE}
COMMAND echo ${GITCOMMAND} push origin ${RELEASE_NAME}
)
ADD_CUSTOM_TARGET(tag-run
COMMAND ${SVNCOMMAND} copy ${SVNSOURCEDIR} ${SVNTAGDIR}/${RELEASE_NAME} -m "Release ${RELEASE_NAME}"
COMMAND ${GITCOMMAND} tag -a ${RELEASE_NAME} -m ${RELEASE_MESSAGE}
COMMAND ${GITCOMMAND} push origin ${RELEASE_NAME}
)
ADD_CUSTOM_TARGET(branch-test
COMMAND echo ${SVNCOMMAND} copy ${SVNSOURCEDIR} ${SVNBRANCHDIR}/${OPENSCENEGRAPH_BRANCH} -m "Branch ${OPENSCENEGRAPH_BRANCH}"
COMMAND echo ${GITCOMMAND} branch ${OPENSCENEGRAPH_BRANCH} -m ${BRANCH_MESSAGE}
COMMAND echo ${GITCOMMAND} push origin ${OPENSCENEGRAPH_BRANCH}
)
ADD_CUSTOM_TARGET(branch-run
COMMAND ${SVNCOMMAND} copy ${SVNSOURCEDIR} ${SVNBRANCHDIR}/${OPENSCENEGRAPH_BRANCH} -m "Branch ${OPENSCENEGRAPH_BRANCH}"
COMMAND ${GITCOMMAND} branch ${OPENSCENEGRAPH_BRANCH} -m ${BRANCH_MESSAGE}
COMMAND ${GITCOMMAND} push origin ${OPENSCENEGRAPH_BRANCH}
)
#
# Provide target for generating ChangeLog
#
SET(GENERATELOGS svn2cl)
SET(GITLOGFORMAT "%aD%nChecked in by : %an%n%s%b%n")
SET(GENERATELOGS git log --pretty=format:${GITLOGFORMAT})
ADD_CUSTOM_TARGET(ChangeLog
COMMAND ${SVNCOMMAND} update
COMMAND ${GENERATELOGS} ${SVNSOURCEDIR}
COMMAND ${GENERATELOGS} > ChangeLog
)
ENDIF(OSG_MAINTAINER)
@@ -234,8 +172,12 @@ IF(APPLE)
EXECUTE_PROCESS(COMMAND "/usr/bin/sw_vers" "-productVersion"
OUTPUT_VARIABLE OSG_OSX_SDK_NAME
OUTPUT_STRIP_TRAILING_WHITESPACE)
STRING(SUBSTRING "${OSG_OSX_SDK_NAME}" 0 4 OSG_OSX_SDK_NAME)
SET(OSG_OSX_SDK_NAME "macosx${OSG_OSX_SDK_NAME}")
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
@@ -247,13 +189,16 @@ IF(APPLE)
#you need to manually set the default sdk version here
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(llvm-gcc-4.2 GNU)
CMAKE_FORCE_CXX_COMPILER(llvm-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)
@@ -283,6 +228,10 @@ ELSE()
ENDIF()
ENDIF()
IF(UNIX AND NOT ANDROID)
# Not sure what this will do on Cygwin and Msys
# Also, remember OS X X11 is a user installed option so it may not exist.
@@ -444,49 +393,228 @@ ENDIF()
OPTION(OSG_DISABLE_MSVC_WARNINGS "Set to OFF to not disable MSVC warnings generated by OSG headers." ON)
MARK_AS_ADVANCED(OSG_DISABLE_MSVC_WARNINGS)
OPTION(OSG_PROVIDE_READFILE "Set to ON for include/osgDB/ReadFile to provide the osgDB::read*File(() methods. " ON)
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)
OPTION(OSG_GLES1_AVAILABLE "Set to OFF to disable use of OpenGL ES 1.x functions library." OFF)
OPTION(OSG_GLES2_AVAILABLE "Set to OFF to disable use of OpenGL ES 2.x functions library." OFF)
# Map the OPENGL_PROFILE to OSG_GL*_AVAILABLE settings
SET(OPENGL_PROFILE "GL2" CACHE STRING "OpenGL Profile to use, choose from GL1, GL2, GL3, GLES1, GLES2, GLES3")
IF ((OPENGL_PROFILE STREQUAL "GL1") OR (OPENGL_PROFILE STREQUAL "GL2"))
OPTION(OSG_GL1_AVAILABLE "Set to OFF to disable use of OpenGL 1.x functions library." ON )
ELSE()
OPTION(OSG_GL1_AVAILABLE "Set to OFF to disable use of OpenGL 1.x functions library." OFF )
ENDIF()
IF ((OPENGL_PROFILE STREQUAL "GL2"))
OPTION(OSG_GL2_AVAILABLE "Set to OFF to disable use of OpenGL 2.x functions library." ON )
ELSE()
OPTION(OSG_GL2_AVAILABLE "Set to OFF to disable use of OpenGL 2.x functions library." OFF )
ENDIF()
IF ((OPENGL_PROFILE STREQUAL "GL3") OR (OPENGL_PROFILE STREQUAL "GLCORE"))
OPTION(OSG_GL3_AVAILABLE "Set to OFF to disable use of OpenGL 3.x functions library." ON )
ELSE()
OPTION(OSG_GL3_AVAILABLE "Set to OFF to disable use of OpenGL 3.x functions library." OFF )
ENDIF()
IF ((OPENGL_PROFILE STREQUAL "GLES1"))
OPTION(OSG_GLES1_AVAILABLE "Set to OFF to disable use of OpenGL ES 1.x functions library." ON )
ELSE()
OPTION(OSG_GLES1_AVAILABLE "Set to OFF to disable use of OpenGL ES 1.x functions library." OFF )
ENDIF()
IF ((OPENGL_PROFILE STREQUAL "GLES2"))
OPTION(OSG_GLES2_AVAILABLE "Set to OFF to disable use of OpenGL ES 2.x functions library." ON )
ELSEIF ((OPENGL_PROFILE STREQUAL "GLES3"))
OPTION(OSG_GLES2_AVAILABLE "Set to OFF to disable use of OpenGL ES 2.x functions library." ON )
OPTION(OSG_GLES3_AVAILABLE "Set to OFF to disable use of OpenGL ES 3.x functions library." ON )
ELSE()
OPTION(OSG_GLES2_AVAILABLE "Set to OFF to disable use of OpenGL ES 2.x functions library." OFF )
OPTION(OSG_GLES3_AVAILABLE "Set to OFF to disable use of OpenGL ES 3.x functions library." OFF )
ENDIF()
OPTION(OSG_GL_LIBRARY_STATIC "Set to ON to statically link with OpenGL/GLES library." OFF)
SET(OPENGL_egl_LIBRARY CACHE STRING "Set the OpenGL egl library.")
# SET(OSG_GL_DISPLAYLISTS_AVAILABLE ${OSG_GL1_AVAILABLE})
# SET(OSG_GL_MATRICES_AVAILABLE ${OSG_GL1_AVAILABLE})
# SET(OSG_GL_VERTEX_FUNCS_AVAILABLE ${OSG_GL1_AVAILABLE})
# SET(OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE ${OSG_GL1_AVAILABLE})
# SET(OSG_GL_FIXED_FUNCTION_AVAILABLE ${OSG_GL1_AVAILABLE})
# Map the OSG_GL*_AVAILABLE settings to OSG_GL_* settings
IF (OSG_GLES2_AVAILABLE OR OSG_GL3_AVAILABLE)
OPTION(OSG_GL_DISPLAYLISTS_AVAILABLE "Set to OFF to disable use of OpenGL display lists." OFF)
OPTION(OSG_GL_MATRICES_AVAILABLE "Set to OFF to disable use of OpenGL built-in matrices." OFF)
OPTION(OSG_GL_VERTEX_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertex/glColor etc." OFF)
OPTION(OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertexPointer/glColorPointer etc." OFF)
OPTION(OSG_GL_FIXED_FUNCTION_AVAILABLE "Set to OFF to disable use of OpenGL fixed function pipeline." OFF)
ELSEIF (OSG_GLES1_AVAILABLE)
OPTION(OSG_GL_DISPLAYLISTS_AVAILABLE "Set to OFF to disable use of OpenGL display lists." OFF)
OPTION(OSG_GL_MATRICES_AVAILABLE "Set to OFF to disable use of OpenGL built-in matrices." ON)
OPTION(OSG_GL_VERTEX_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertex/glColor etc." ON)
OPTION(OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertexPointer/glColorPointer etc." ON)
OPTION(OSG_GL_FIXED_FUNCTION_AVAILABLE "Set to OFF to disable use of OpenGL fixed function pipeline." ON)
ELSE()
OPTION(OSG_GL_DISPLAYLISTS_AVAILABLE "Set to OFF to disable use of OpenGL display lists." ON)
OPTION(OSG_GL_MATRICES_AVAILABLE "Set to OFF to disable use of OpenGL built-in matrices." ON)
OPTION(OSG_GL_VERTEX_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertex/glColor etc." ON)
OPTION(OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertexPointer/glColorPointer etc." ON)
OPTION(OSG_GL_FIXED_FUNCTION_AVAILABLE "Set to OFF to disable use of OpenGL fixed function pipeline." ON)
ENDIF()
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 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})
IF (OSG_GLES1_AVAILABLE OR OSG_GLES2_AVAILABLE)
OPTION(OSG_CPP_EXCEPTIONS_AVAILABLE "Set to OFF to disable compile of OSG components that use C++ exceptions." OFF)
ELSE()
OPTION(OSG_CPP_EXCEPTIONS_AVAILABLE "Set to OFF to disable compile of OSG components that use C++ exceptions." ON)
ENDIF()
# Map the OSG_GL*_AVAILABLE settings to OpenGL header settings
IF (OSG_GL3_AVAILABLE)
IF (APPLE)
SET(OPENGL_HEADER1 "#include <OpenGL/gl.h>" CACHE STRING "#include<> line for OpenGL Header")
SET(OPENGL_HEADER2 "#include <OpenGL/gl3.h>" CACHE STRING "#include<> line for additional OpenGL Headers if required")
ELSE()
IF (OPENGL_PROFILE STREQUAL "GLCORE")
IF(WIN32)
FIND_PACKAGE(GLCORE REQUIRED)
ENDIF()
SET(OPENGL_HEADER1 "#include <GL/glcorearb.h>" CACHE STRING "#include<> line for OpenGL Header")
SET(OPENGL_HEADER2 "" CACHE STRING "#include<> line for additional OpenGL Headers if required")
ELSE()
SET(OPENGL_HEADER1 "#include <GL3/gl3.h>" CACHE STRING "#include<> line for OpenGL Header")
SET(OPENGL_HEADER2 "" CACHE STRING "#include<> line for additional OpenGL Headers if required")
ENDIF()
ENDIF()
ELSEIF(OSG_GLES1_AVAILABLE)
IF (APPLE AND NOT ANDROID)
SET(OPENGL_HEADER1 "#include \"TargetConditionals.h\"" CACHE STRING "#include<> line for OpenGL Header")
SET(OPENGL_HEADER2 "#include <OpenGLES/ES1/gl.h>" CACHE STRING "#include<> line for additional OpenGL Headers if required")
ELSE()
SET(OPENGL_HEADER1 "#include <GLES/gl.h>" CACHE STRING "#include<> line for OpenGL Header")
SET(OPENGL_HEADER2 "" CACHE STRING "#include<> line for additional OpenGL Headers if required")
ENDIF()
ELSEIF(OSG_GLES2_AVAILABLE)
IF (APPLE AND NOT ANDROID)
SET(OPENGL_HEADER1 "#include \"TargetConditionals.h\"" CACHE STRING "#include<> line for OpenGL Header")
SET(OPENGL_HEADER2 "#include <OpenGLES/ES2/gl.h>" CACHE STRING "#include<> line for additional OpenGL Headers if required")
# TODO: GLES3
ELSE()
SET(OPENGL_HEADER1 "#include <GLES2/gl2.h>" CACHE STRING "#include<> line for OpenGL Header")
SET(OPENGL_HEADER2 "" CACHE STRING "#include<> line for additional OpenGL Headers if required")
# TODO: GLES3
ENDIF()
ELSE()
IF (APPLE)
SET(OPENGL_HEADER1 "#include <OpenGL/gl.h>" CACHE STRING "#include<> line for OpenGL Header")
SET(OPENGL_HEADER2 "" CACHE STRING "#include<> line for additional OpenGL Headers if required")
ELSE()
SET(OPENGL_HEADER1 "#include <GL/gl.h>" CACHE STRING "#include<> line for OpenGL Header")
SET(OPENGL_HEADER2 "" CACHE STRING "#include<> line for additional OpenGL Headers if required")
ENDIF()
ENDIF()
IF (OSG_GL1_AVAILABLE)
SET(OSG_GL1_FEATURES 1)
ELSE()
SET(OSG_GL1_FEATURES 0)
ENDIF()
IF (OSG_GL2_AVAILABLE)
SET(OSG_GL2_FEATURES 1)
ELSE()
SET(OSG_GL2_FEATURES 0)
ENDIF()
IF (OSG_GL3_AVAILABLE)
SET(OSG_GL3_FEATURES 1)
ELSE()
SET(OSG_GL3_FEATURES 0)
ENDIF()
IF (OSG_GLES1_AVAILABLE)
SET(OSG_GLES1_FEATURES 1)
ELSE()
SET(OSG_GLES1_FEATURES 0)
ENDIF()
IF (OSG_GLES2_AVAILABLE)
SET(OSG_GLES2_FEATURES 1)
ELSE()
SET(OSG_GLES2_FEATURES 0)
ENDIF()
IF (OSG_GLES3_AVAILABLE)
SET(OSG_GLES3_FEATURES 1)
ELSE()
SET(OSG_GLES3_FEATURES 0)
ENDIF()
IF(ANDROID)
IF(OSG_GLES1_AVAILABLE)
FIND_PATH(OPENGL_INCLUDE_DIR GLES/gl.h
PATHS
${ANDROID_SYSROOT}/usr/include)
FIND_LIBRARY(OPENGL_gl_LIBRARY GLESv1_CM
PATHS
${ANDROID_SYSROOT}/usr/lib)
ELSEIF(OSG_GLES2_AVAILABLE)
FIND_PATH(OPENGL_INCLUDE_DIR GLES2/gl2.h
PATHS
${ANDROID_SYSROOT}/usr/include)
FIND_LIBRARY(OPENGL_gl_LIBRARY GLESv2
PATHS
${ANDROID_SYSROOT}/usr/lib)
ENDIF()
ENDIF()
OPTION(OSG_CPP_EXCEPTIONS_AVAILABLE "Set to OFF to disable compile of OSG components that use C++ exceptions." ON)
################################################################################
# Set Config file
# Set Config header file
SET(OPENSCENEGRAPH_CONFIG_HEADER "${PROJECT_BINARY_DIR}/include/osg/Config")
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/Config.in"
"${OPENSCENEGRAPH_CONFIG_HEADER}")
SET(OPENSCENEGRAPH_VERSION_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/include/osg/Version")
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/Version.in"
"${OPENSCENEGRAPH_VERSION_HEADER}")
################################################################################
# Set OpenGL header file
INCLUDE (CheckCXXSourceCompiles)
#SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${OPENGL_INCLUDE_DIR})
check_cxx_source_compiles(
"${OPENGL_HEADER1}
${OPENGL_HEADER2}
int main() { GLint64 test; return 0; }"
GL_HEADER_HAS_GLINT64
)
check_cxx_source_compiles(
"${OPENGL_HEADER1}
${OPENGL_HEADER2}
int main() { GLuint64 test; return 0; }"
GL_HEADER_HAS_GLUINT64
)
SET(OPENSCENEGRAPH_OPENGL_HEADER "${PROJECT_BINARY_DIR}/include/osg/GL")
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/GL.in"
"${OPENSCENEGRAPH_OPENGL_HEADER}")
# INSTALL_FILES(/include/osg/ FILES "${OPENSCENEGRAPH_CONFIG_HEADER}")
################################################################################
# Set Version header file
SET(OPENSCENEGRAPH_VERSION_HEADER "${PROJECT_BINARY_DIR}/include/osg/Version")
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/Version.in"
"${OPENSCENEGRAPH_VERSION_HEADER}")
################################################################################
# Set Version Info resource file
IF(MSVC)
SET(OPENSCENEGRAPH_VERSIONINFO_RC "${PROJECT_BINARY_DIR}/PlatformSpecifics/Windows/OpenSceneGraphVersionInfo.rc")
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/PlatformSpecifics/Windows/OpenSceneGraphVersionInfo.rc.in"
@@ -508,11 +636,18 @@ IF(WIN32 AND NOT ANDROID)
INCLUDE(Find3rdPartyDependencies)
ENDIF()
OPTION(OSG_USE_LOCAL_LUA_SOURCE "Enable to use local Lua source when building the lua plugin" ON)
#
# 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)
@@ -528,15 +663,33 @@ ELSE()
FIND_PACKAGE(LibVNCServer)
FIND_PACKAGE(OurDCMTK)
FIND_PACKAGE(FFmpeg)
FIND_PACKAGE(GStreamer COMPONENTS app pbutils)
FIND_PACKAGE(GLIB COMPONENTS gobject)
FIND_PACKAGE(DirectShow)
FIND_PACKAGE(SDL2)
FIND_PACKAGE(SDL)
FIND_PACKAGE(Poppler-glib)
FIND_PACKAGE(RSVG)
FIND_PACKAGE(GtkGl)
FIND_PACKAGE(DirectInput)
FIND_PACKAGE(NVTT)
FIND_PACKAGE(Asio)
IF (NOT WIN32)
FIND_PACKAGE(Asio)
ENDIF()
FIND_PACKAGE(ZeroConf)
FIND_PACKAGE(LIBLAS)
IF (NOT(OSG_USE_LOCAL_LUA_SOURCE))
FIND_PACKAGE(Lua52)
IF (NOT (LUA_LIBRARIES AND LUA_INCLUDE_DIR))
FIND_PACKAGE(Lua51)
ENDIF()
ENDIF()
# V8 and Python plugins are tests for linking against these libraries but aren't functionality beyond this.
# FIND_PACKAGE(V8)
# FIND_PACKAGE(PythonLibs)
ENDIF()
IF(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION LESS 8)
@@ -555,11 +708,11 @@ IF(OSG_USE_QT AND NOT ANDROID)
IF (DESIRED_QT_VERSION)
IF (DESIRED_QT_VERSION MATCHES 5)
FIND_PACKAGE(Qt5Widgets)
FIND_PACKAGE(Qt5Widgets)
ELSEIF (DESIRED_QT_VERSION MATCHES 4)
FIND_PACKAGE(Qt4)
FIND_PACKAGE(Qt4)
ELSE()
FIND_PACKAGE(Qt3)
FIND_PACKAGE(Qt3)
ENDIF()
ELSE()
@@ -590,7 +743,14 @@ IF(OSG_USE_QT AND 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)
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()
@@ -794,7 +954,7 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
# errors instead of warnings for certain issues, including superfluous
# semicolons and commas, and the use of long long. -fpermissive seems
# to be the workaround.
SET(OSG_AGGRESSIVE_WARNING_FLAGS -Wall -Wparentheses -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
@@ -811,6 +971,36 @@ ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# 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.
IF (APPLE)
SET(OSG_CXX_LANGUAGE_STANDARD "C++11" CACHE STRING "set the c++ language standard (C++98 / GNU++98 / C++11) for OSG" )
MARK_AS_ADVANCED(OSG_CXX_LANGUAGE_STANDARD)
# remove existing flags
REMOVE_CXX_FLAG(-std=c++98)
REMOVE_CXX_FLAG(-std=gnu++98)
REMOVE_CXX_FLAG(-std=c++11)
REMOVE_CXX_FLAG(-stdlib=libstdc++)
REMOVE_CXX_FLAG(-stdlib=libc++)
IF(${OSG_CXX_LANGUAGE_STANDARD} STREQUAL "c++98" OR ${OSG_CXX_LANGUAGE_STANDARD} STREQUAL "C++98")
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++")
ELSE()
IF(${OSG_CXX_LANGUAGE_STANDARD} STREQUAL "gnu++98" OR ${OSG_CXX_LANGUAGE_STANDARD} STREQUAL "GNU++98")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "gnu++98")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libstdc++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++98 -stdlib=libstdc++")
ELSE()
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++")
ENDIF()
ENDIF()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-overloaded-virtual -Wno-conversion")
set(WARNING_CFLAGS "")
ENDIF()
ENDIF()
# This part is for the CMake menu option to toggle the warnings on/off.
@@ -870,12 +1060,23 @@ IF(APPLE AND NOT ANDROID)
#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=4.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} -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} -pipe -no-cpp-precomp" CACHE STRING "Flags used by the compiler during all build types." FORCE)
ENDIF()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -miphoneos-version-min=${IPHONE_VERSION_MIN}" FORCE)
ELSE()
#simulator uses i386 architectures
SET(CMAKE_OSX_ARCHITECTURES "i386" CACHE STRING "Build architectures for iOS Simulator" FORCE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mno-thumb -arch i386 -pipe -no-cpp-precomp" CACHE STRING "Flags used by the compiler during all build types." FORCE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mios-simulator-version-min=${IPHONE_VERSION_MIN}" FORCE)
ENDIF()
#here we set the specific iphone sdk version. We can only set either device or simulator sdk. So if you want both you currently have to have two seperate projects
@@ -903,7 +1104,7 @@ IF(APPLE AND NOT ANDROID)
# 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)
IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.8")
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)
@@ -1140,10 +1341,4 @@ ADD_CUSTOM_TARGET(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
#
IF(ANDROID)
message(STATUS "Creating Android Makefile Master files" )
configure_file("${OSG_ANDROID_TEMPLATES}/Android.mk.master.in" "${CMAKE_BINARY_DIR}/Android.mk")
configure_file("${OSG_ANDROID_TEMPLATES}/Application.mk.master.in" "${CMAKE_BINARY_DIR}/Application.mk")
configure_file("${OSG_ANDROID_TEMPLATES}/AndroidManifest.xml.master.in" "${CMAKE_BINARY_DIR}/AndroidManifest.xml")
ENDIF(ANDROID)

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

@@ -9,19 +9,19 @@ MACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES_BASE SEARCHPATHLIST DEBU
SET(MY_PATH_INCLUDE )
SET(MY_PATH_LIB )
FOREACH( MYPATH ${SEARCHPATHLIST} )
SET(MY_PATH_INCLUDE ${MY_PATH_INCLUDE} ${MYPATH}/include)
SET(MY_PATH_LIB ${MY_PATH_LIB} ${MYPATH}/lib)
ENDFOREACH( MYPATH ${SEARCHPATHLIST} )
FIND_PATH("${DEPNAME}_INCLUDE_DIR" ${INCLUDEFILE}
${MY_PATH_INCLUDE}
NO_DEFAULT_PATH
)
MARK_AS_ADVANCED("${DEPNAME}_INCLUDE_DIR")
#MESSAGE( " ${DEPNAME}_INCLUDE_DIR --> ${${DEPNAME}_INCLUDE_DIR}<--")
SET(LIBRARY_NAMES "")
FOREACH(LIBNAME ${LIBRARY_NAMES_BASE})
LIST(APPEND LIBRARY_NAMES "${LIBNAME}${EXSUFFIX}")
@@ -35,7 +35,7 @@ MACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES_BASE SEARCHPATHLIST DEBU
FOREACH(LIBNAME ${LIBRARY_NAMES_BASE})
LIST(APPEND LIBRARY_NAMES_DEBUG "${LIBNAME}${DEBUGSUFFIX}${EXSUFFIX}")
ENDFOREACH(LIBNAME)
FIND_LIBRARY("${DEPNAME}_LIBRARY_DEBUG"
FIND_LIBRARY("${DEPNAME}_LIBRARY_DEBUG"
NAMES ${LIBRARY_NAMES_DEBUG}
PATHS ${MY_PATH_LIB}
NO_DEFAULT_PATH
@@ -49,30 +49,36 @@ MACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES_BASE SEARCHPATHLIST DEBU
MESSAGE("-- Warning Debug ${DEPNAME} not found, using: ${${DEPNAME}_LIBRARY}")
SET(${DEPNAME}_LIBRARY_DEBUG "${${DEPNAME}_LIBRARY}")
ENDIF(NOT ${DEPNAME}_LIBRARY_DEBUG)
SET(${DEPNAME}_LIBRARIES debug ${${DEPNAME}_LIBRARY_DEBUG} optimized ${${DEPNAME}_LIBRARY} )
ENDIF(${DEPNAME}_INCLUDE_DIR AND ${DEPNAME}_LIBRARY)
ENDMACRO(FIND_DEPENDENCY DEPNAME INCLUDEFILE LIBRARY_NAMES_BASE SEARCHPATHLIST DEBUGSUFFIX)
################################################################################################
# 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;freetype244;freetype250;" ${OSG_3RDPARTY_BIN} "d" "")
FIND_DEPENDENCY(TIFF tiff.h "libtiff;tiff" ${OSG_3RDPARTY_BIN} "D" "")
FIND_DEPENDENCY(FREETYPE ft2build.h "freetype;freetype2311MT;freetype234;freetype234MT;freetype235;freetype237;freetype238;freetype244;freetype250;freetype27;" ${OSG_3RDPARTY_BIN} "d" "")
IF(FREETYPE_FOUND)
#forcing subsequent FindFreeType stuff to not search for other variables.... kind of a hack
#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)
SET(FREETYPE_INCLUDE_DIR_freetype2 ${FREETYPE_INCLUDE_DIR} CACHE PATH "" FORCE)
MARK_AS_ADVANCED(FREETYPE_INCLUDE_DIR_ft2build FREETYPE_INCLUDE_DIR_freetype2)
SET(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}")
ENDIF(FREETYPE_FOUND)
FIND_DEPENDENCY(CURL curl/curl.h "libcurl;curllib" ${OSG_3RDPARTY_BIN} "D" "")
FIND_DEPENDENCY(CURL curl/curl.h "libcurl;curllib;libcurl_imp" ${OSG_3RDPARTY_BIN} "D" "")
FIND_DEPENDENCY(JPEG jpeglib.h "libjpeg;jpeg" ${OSG_3RDPARTY_BIN} "D" "")
FIND_DEPENDENCY(GDAL gdal.h "gdal;gdal16" ${OSG_3RDPARTY_BIN} "d" "_i")
FIND_DEPENDENCY(GLUT GL/glut.h glut32 ${OSG_3RDPARTY_BIN} "D" "")
IF(GLUT_FOUND)
#forcing subsequent FindGlut stuff to not search for other variables.... kind of a hack
#forcing subsequent FindGlut stuff to not search for other variables.... kind of a hack
SET(GLUT_glut_LIBRARY ${GLUT_LIBRARY} CACHE FILEPATH "")
MARK_AS_ADVANCED(GLUT_glut_LIBRARY)
ENDIF(GLUT_FOUND)
@@ -81,19 +87,21 @@ MACRO(SEARCH_3RDPARTY OSG_3RDPARTY_BIN)
IF(ZLIB_FOUND)
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
#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" "")
# CMakes default module to find libxml2 will not find the in
FIND_DEPENDENCY(LIBXML2 libxml/xpath.h "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)
# The CMAKE find libxml module uses LIBXML2_LIBRARIES -> fill it.... kind of a hack
SET(LIBXML2_LIBRARIES ${LIBXML2_LIBRARY} CACHE FILEPATH "LibXML2 library for collada" 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)
@@ -104,7 +112,7 @@ ENDMACRO(SEARCH_3RDPARTY OSG_3RDPARTY_BIN)
# this is code for handling optional 3RDPARTY usage
################################################################################################
OPTION(USE_3RDPARTY_BIN "Set to ON to use Mike prebuilt dependencies situated side of OpenSceneGraph source. Use OFF for avoiding." ON)
OPTION(USE_3RDPARTY_BIN "Set to ON to use Mike or Torbens prebuilt dependencies situated side of OpenSceneGraph source. Use OFF for avoiding." ON)
IF(USE_3RDPARTY_BIN)
# Check Architecture
@@ -132,7 +140,7 @@ IF(USE_3RDPARTY_BIN)
SET(TEST_3RDPARTY_DIR "${PARENT_DIR}/3rdParty_win32binaries_vs90sp1")
ENDIF()
ENDIF(NOT EXISTS ${TEST_3RDPARTY_DIR})
SET(ACTUAL_3RDPARTY_DIR "${TEST_3RDPARTY_DIR}" CACHE PATH "Location of 3rdparty dependencies")
SET(ACTUAL_3DPARTY_DIR "${ACTUAL_3RDPARTY_DIR}") # kept for backcompatibility
IF(EXISTS ${ACTUAL_3RDPARTY_DIR})

View File

@@ -1,22 +1,20 @@
# 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_INCLUDE_DIR, where to find the headers
# 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
# Created by Stephan Maximilian Huber
IF(APPLE)
FIND_PATH(AV_FOUNDATION_INCLUDE_DIR AVFoundation/AVFoundation.h)
FIND_LIBRARY(AV_FOUNDATION_LIBRARY AVFoundation)
ENDIF()
SET(AV_FOUNDATION_FOUND "NO")
IF(AV_FOUNDATION_LIBRARY AND AV_FOUNDATION_INCLUDE_DIR)
IF(AV_FOUNDATION_LIBRARY)
SET(AV_FOUNDATION_FOUND "YES")
ENDIF()
@@ -32,11 +30,11 @@ ELSE()
# 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")
IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.8" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.9" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.10" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.11")
# nothing special here ;-)
ELSE()
MESSAGE("AVFoundation disabled for SDK < 10.8")
SET(AV_FOUNDATION_FOUND "NO")
SET(AV_FOUNDATION_FOUND "NO")
ENDIF()
ENDIF()
ENDIF()

12
CMakeModules/FindAsio.cmake Executable file → Normal file
View File

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

View File

@@ -11,16 +11,16 @@
# $COLLADA_DIR is an environment variable that would
# correspond to the ./configure --prefix=$COLLADA_DIR
#
# Created by Robert Osfield.
# Created by Robert Osfield.
# Check if COLLADA_DIR is set, otherwise use ACTUAL_3DPARTY_DIR:
SET( COLLADA_ENV_VAR_AVAILABLE $ENV{COLLADA_DIR} )
IF ( COLLADA_ENV_VAR_AVAILABLE )
SET(COLLADA_DOM_ROOT "$ENV{COLLADA_DIR}/dom" CACHE PATH "Location of Collada DOM directory" FORCE)
ELSE ( COLLADA_ENV_VAR_AVAILABLE )
ELSE ()
SET(COLLADA_DOM_ROOT "${ACTUAL_3DPARTY_DIR}/include/1.4/dom" CACHE PATH "Location of Collada DOM directory" FORCE)
ENDIF( COLLADA_ENV_VAR_AVAILABLE )
ENDIF()
@@ -28,6 +28,12 @@ IF(APPLE)
SET(COLLADA_BUILDNAME "mac")
ELSEIF(MINGW)
SET(COLLADA_BUILDNAME "mingw")
ELSEIF(MSVC14)
SET(COLLADA_BUILDNAME "vc14")
ELSEIF(MSVC12)
SET(COLLADA_BUILDNAME "vc12")
ELSEIF(MSVC11)
SET(COLLADA_BUILDNAME "vc11")
ELSEIF(MSVC10)
SET(COLLADA_BUILDNAME "vc10")
ELSEIF(MSVC90)
@@ -49,10 +55,16 @@ FIND_PATH(COLLADA_INCLUDE_DIR dae.h
/usr/local/include
/usr/local/include/colladadom
/usr/local/include/collada-dom
/usr/local/include/collada-dom2.4
/usr/local/include/collada-dom2.2
/opt/local/include/collada-dom
/opt/local/include/collada-dom2.4
/opt/local/include/collada-dom2.2
/usr/include/
/usr/include/colladadom
/usr/include/collada-dom
/usr/include/collada-dom2.4
/usr/include/collada-dom2.2
/sw/include # Fink
/opt/local/include # DarwinPorts
/opt/csw/include # Blastwave
@@ -61,16 +73,17 @@ FIND_PATH(COLLADA_INCLUDE_DIR dae.h
${ACTUAL_3DPARTY_DIR}/include
)
FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY
NAMES collada_dom collada14dom Collada14Dom libcollada14dom21 libcollada14dom22
FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY
NAMES collada_dom collada14dom Collada14Dom libcollada14dom21 libcollada14dom22 collada-dom2.4-dp collada-dom2.4-dp-vc120-mt
PATHS
${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4
${COLLADA_DOM_ROOT}
$ENV{COLLADA_DIR}/build/${COLLADA_BUILDNAME}-1.4
$ENV{COLLADA_DIR}/lib
$ENV{COLLADA_DIR}/lib-dbg
$ENV{COLLADA_DIR}
~/Library/Frameworks
/Library/Frameworks
/Library/Frameworks
/opt/local/Library/Frameworks #macports
/usr/local/lib
/usr/local/lib64
@@ -84,10 +97,11 @@ FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY
${ACTUAL_3DPARTY_DIR}/lib
)
FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY_DEBUG
NAMES collada_dom-d collada14dom-d Collada14Dom-d libcollada14dom21-d libcollada14dom22-d
FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY_DEBUG
NAMES collada_dom-d collada14dom-d Collada14Dom-d libcollada14dom21-d libcollada14dom22-d collada-dom2.4-dp-d collada-dom2.4-dp-vc120-mt-d
PATHS
${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4-d
${COLLADA_DOM_ROOT}
$ENV{COLLADA_DIR}/build/${COLLADA_BUILDNAME}-1.4-d
$ENV{COLLADA_DIR}/lib
$ENV{COLLADA_DIR}/lib-dbg
@@ -107,7 +121,7 @@ FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY_DEBUG
${ACTUAL_3DPARTY_DIR}/lib
)
FIND_LIBRARY(COLLADA_STATIC_LIBRARY
FIND_LIBRARY(COLLADA_STATIC_LIBRARY
NAMES libcollada14dom21-s libcollada14dom22-s libcollada14dom.a
PATHS
${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4
@@ -130,7 +144,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY
${ACTUAL_3DPARTY_DIR}/lib
)
FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
NAMES collada_dom-sd collada14dom-sd libcollada14dom21-sd libcollada14dom22-sd libcollada14dom-d.a
PATHS
${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4-d
@@ -169,10 +183,19 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
)
ENDIF(WIN32)
ENDIF(LIBXML2_FOUND)
FIND_PACKAGE(ZLIB)
IF (ZLIB_FOUND)
SET(COLLADA_ZLIB_LIBRARY "${ZLIB_LIBRARY}" CACHE FILEPATH "" FORCE)
IF (ZLIB_LIBRARY_RELEASE)
SET(COLLADA_ZLIB_LIBRARY "${ZLIB_LIBRARY_RELEASE}" CACHE FILEPATH "" FORCE)
ELSE(ZLIB_LIBRARY_RELEASE)
SET(COLLADA_ZLIB_LIBRARY "${ZLIB_LIBRARY}" CACHE FILEPATH "" FORCE)
ENDIF(ZLIB_LIBRARY_RELEASE)
IF (ZLIB_LIBRARY_DEBUG)
SET(COLLADA_ZLIB_LIBRARY_DEBUG "${ZLIB_LIBRARY_DEBUG}" CACHE FILEPATH "" FORCE)
ELSE(ZLIB_LIBRARY_DEBUG)
SET(COLLADA_ZLIB_LIBRARY_DEBUG "${COLLADA_ZLIB_LIBRARY}" CACHE FILEPATH "" FORCE)
ENDIF(ZLIB_LIBRARY_DEBUG)
ELSE(ZLIB_FOUND)
IF(WIN32)
FIND_LIBRARY(COLLADA_ZLIB_LIBRARY
@@ -238,7 +261,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
)
FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY
NAMES libboost_filesystem boost_filesystem boost_filesystem-mt 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 libboost_filesystem-${COLLADA_BUILDNAME}0-mt-1_58 boost_filesystem-${COLLADA_BUILDNAME}0-mt-1_62
PATHS
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
@@ -246,7 +269,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
)
FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY_DEBUG
NAMES libboost_filesystem-d boost_filesystem-d boost_filesystem-mt-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 libboost_filesystem-${COLLADA_BUILDNAME}0-mt-gd-1_58 boost_filesystem-${COLLADA_BUILDNAME}0-mt-gd-1_62
PATHS
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
@@ -254,7 +277,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
)
FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY
NAMES libboost_system boost_system boost_system-mt 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 libboost_system-${COLLADA_BUILDNAME}0-mt-1_58 boost_system-${COLLADA_BUILDNAME}0-mt-1_62
PATHS
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
@@ -262,7 +285,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
)
FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY_DEBUG
NAMES libboost_system-d boost_system-d boost_system-mt-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 libboost_system-${COLLADA_BUILDNAME}0-mt-gd-1_58 boost_system-${COLLADA_BUILDNAME}0-mt-gd-1_62
PATHS
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
@@ -273,6 +296,20 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
SET(COLLADA_FOUND "NO")
IF(COLLADA_DYNAMIC_LIBRARY OR COLLADA_STATIC_LIBRARY)
IF (COLLADA_INCLUDE_DIR)
SET(COLLADA_FOUND "YES")
ENDIF(COLLADA_INCLUDE_DIR)
ENDIF(COLLADA_DYNAMIC_LIBRARY OR COLLADA_STATIC_LIBRARY)
FIND_PATH(COLLADA_INCLUDE_DOMANY_DIR 1.4/dom/domAny.h
${COLLADA_INCLUDE_DIR}
)
IF (COLLADA_INCLUDE_DOMANY_DIR)
SET(COLLADA_DOM_2_4_OR_LATER TRUE)
ELSEIF()
SET(COLLADA_DOM_2_4_OR_LATER FALSE)
ENDIF()
ENDIF()
ENDIF()

View File

@@ -18,8 +18,10 @@ ELSEIF(MSVC90)
SET(FBX_LIBDIR "vs2008")
ELSEIF(MSVC10)
SET(FBX_LIBDIR "vs2010")
ELSEIF(MSVC11 OR MSVC_VERSION>1700)
ELSEIF(MSVC11)
SET(FBX_LIBDIR "vs2012")
ELSEIF(MSVC12 OR MSVC_VERSION>1800)
SET(FBX_LIBDIR "vs2013")
ENDIF()
IF(APPLE)
@@ -32,6 +34,8 @@ ELSE()
SET(FBX_LIBDIR ${FBX_LIBDIR}/x86)
ENDIF()
#try to use 2015.1 or 2014.2 version
IF(APPLE)
SET(FBX_LIBNAME "libfbxsdk")
ELSEIF(CMAKE_COMPILER_IS_GNUCXX)
@@ -44,9 +48,14 @@ 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
"$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2015.1"
"$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2015.1"
"/Applications/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/FBX/FBX SDK/2014.2"
/Applications/Autodesk/FBXSDK20142
)
# search for headers & debug/release libraries
@@ -74,21 +83,22 @@ ELSE()
ENDIF()
IF(NOT FBX_FOUND)
#try to use 2013.3 version
#try to use 2014.1 version
IF(APPLE)
SET(FBX_LIBNAME "fbxsdk-2013.3-static")
SET(FBX_LIBNAME "fbxsdk-2014.1")
ELSEIF(CMAKE_COMPILER_IS_GNUCXX)
SET(FBX_LIBNAME "fbxsdk-2013.3-static")
SET(FBX_LIBNAME "fbxsdk-2014.1")
ELSE()
SET(FBX_LIBNAME "fbxsdk-2013.3-md")
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/2013.3
$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2013.3
"$ENV{ProgramW6432}/Autodesk/FBX/FBX SDK/2014.1"
"$ENV{PROGRAMFILES}/Autodesk/FBX/FBX SDK/2014.1"
"/Applications/Autodesk/FBX/FBX SDK/2014.1"
/Applications/Autodesk/FBXSDK20141
)
@@ -110,3 +120,42 @@ IF(NOT FBX_FOUND)
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/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

@@ -14,8 +14,8 @@
#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)
#We have to search the path which contain the header.h (useful for old version)
#and search the path which contain the libname/header.h (useful for new version)
#Then we need to include ${FFMPEG_libname_INCLUDE_DIRS} (in old version case, use by ffmpeg header and osg plugin code)
# (in new version case, use by ffmpeg header)
@@ -32,6 +32,8 @@ MACRO(FFMPEG_FIND varname shortname headername)
PATHS
${FFMPEG_ROOT}/include
$ENV{FFMPEG_DIR}/include
${FFMPEG_ROOT}
$ENV{FFMPEG_DIR}
~/Library/Frameworks
/Library/Frameworks
/usr/local/include
@@ -49,6 +51,8 @@ MACRO(FFMPEG_FIND varname shortname headername)
PATHS
${FFMPEG_ROOT}/include
$ENV{FFMPEG_DIR}/include
${FFMPEG_ROOT}
$ENV{FFMPEG_DIR}
~/Library/Frameworks
/Library/Frameworks
/usr/local/include
@@ -67,6 +71,8 @@ MACRO(FFMPEG_FIND varname shortname headername)
PATHS
${FFMPEG_ROOT}/lib
$ENV{FFMPEG_DIR}/lib
${FFMPEG_ROOT}/lib${shortname}
$ENV{FFMPEG_DIR}/lib${shortname}
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
@@ -123,11 +129,14 @@ FFMPEG_FIND(LIBAVFORMAT avformat avformat.h)
FFMPEG_FIND(LIBAVDEVICE avdevice avdevice.h)
FFMPEG_FIND(LIBAVCODEC avcodec avcodec.h)
FFMPEG_FIND(LIBAVUTIL avutil avutil.h)
FFMPEG_FIND(LIBSWRESAMPLE swresample swresample.h)
FFMPEG_FIND(LIBAVRESAMPLE avresample avresample.h)
FFMPEG_FIND(LIBSWSCALE swscale swscale.h) # not sure about the header to look for here.
SET(FFMPEG_FOUND "NO")
# Note we don't check FFMPEG_LIBSWSCALE_FOUND here, it's optional.
IF (FFMPEG_LIBAVFORMAT_FOUND AND FFMPEG_LIBAVDEVICE_FOUND AND FFMPEG_LIBAVCODEC_FOUND AND FFMPEG_LIBAVUTIL_FOUND AND STDINT_OK)
IF (FFMPEG_LIBAVFORMAT_FOUND AND FFMPEG_LIBAVDEVICE_FOUND AND FFMPEG_LIBAVCODEC_FOUND AND FFMPEG_LIBAVUTIL_FOUND AND STDINT_OK
AND ( FFMPEG_LIBSWRESAMPLE_FOUND OR FFMPEG_LIBAVRESAMPLE_FOUND ) )
SET(FFMPEG_FOUND "YES")

View File

@@ -9,6 +9,15 @@
#
# Created by Robert Osfield.
# prefer FindFLTK from cmake distribution
if(EXISTS ${CMAKE_ROOT}/Modules/FindFLTK.cmake)
include(${CMAKE_ROOT}/Modules/FindFLTK.cmake)
if(FLTK_FOUND)
return()
endif()
endif()
FIND_PATH(FLTK_INCLUDE_DIR Fl/Fl.H Fl/Fl.h
$ENV{FLTK_DIR}/include
$ENV{FLTK_DIR}

View File

@@ -1,117 +0,0 @@
# - Locate FreeType library
# This module defines
# FREETYPE_LIBRARY, the library to link against
# FREETYPE_FOUND, if false, do not try to link to FREETYPE
# FREETYPE_INCLUDE_DIRS, where to find headers.
# This is the concatenation of the paths:
# FREETYPE_INCLUDE_DIR_ft2build
# FREETYPE_INCLUDE_DIR_freetype2
#
# $FREETYPE_DIR is an environment variable that would
# correspond to the ./configure --prefix=$FREETYPE_DIR
# used in building FREETYPE.
# Created by Eric Wing.
# Ugh, FreeType seems to use some #include trickery which
# makes this harder than it should be. It looks like they
# put ft2build.h in a common/easier-to-find location which
# then contains a #include to a more specific header in a
# more specific location (#include <freetype/config/ftheader.h>).
# Then from there, they need to set a bunch of #define's
# so you can do something like:
# #include FT_FREETYPE_H
# Unfortunately, using CMake's mechanisms like INCLUDE_DIRECTORIES()
# wants explicit full paths and this trickery doesn't work too well.
# I'm going to attempt to cut out the middleman and hope
# everything still works.
FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
PATHS
$ENV{FREETYPE_DIR}
NO_DEFAULT_PATH
PATH_SUFFIXES include
)
FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this.
NO_DEFAULT_PATH
PATH_SUFFIXES include
)
FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
PATHS
/usr/local
/usr
/usr/local/X11R6
/usr/local/X11
/usr/X11R6
/usr/X11
/sw
/opt/local
/opt/csw
/opt
/usr/freeware
PATH_SUFFIXES include
)
FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h
$ENV{FREETYPE_DIR}/include/freetype2
NO_DEFAULT_PATH
)
FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h
PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this.
NO_DEFAULT_PATH
PATH_SUFFIXES include/freetype2
)
FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/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
$ENV{FREETYPE_DIR}
NO_DEFAULT_PATH
PATH_SUFFIXES lib64 lib
)
FIND_LIBRARY(FREETYPE_LIBRARY
NAMES freetype libfreetype freetype219
PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this.
NO_DEFAULT_PATH
PATH_SUFFIXES lib64 lib
)
FIND_LIBRARY(FREETYPE_LIBRARY
NAMES freetype libfreetype freetype219
PATHS
/usr/local
/usr
/usr/local/X11R6
/usr/local/X11
/usr/X11R6
/usr/X11
/sw
/opt/local
/opt/csw
/opt
/usr/freeware
PATH_SUFFIXES lib64 lib
)
IF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2)
SET(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}")
ENDIF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2)
SET(FREETYPE_FOUND "NO")
IF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS)
SET(FREETYPE_FOUND "YES")
ENDIF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS)

View File

@@ -0,0 +1,188 @@
#.rst:
# FindFreetype
# ------------
#
# Locate FreeType library
#
# This module defines
#
# ::
#
# FREETYPE_LIBRARIES, the library to link against
# FREETYPE_FOUND, if false, do not try to link to FREETYPE
# FREETYPE_INCLUDE_DIRS, where to find headers.
# FREETYPE_VERSION_STRING, the version of freetype found (since CMake 2.8.8)
# This is the concatenation of the paths:
# FREETYPE_INCLUDE_DIR_ft2build
# FREETYPE_INCLUDE_DIR_freetype2
#
#
#
# $FREETYPE_DIR is an environment variable that would correspond to the
# ./configure --prefix=$FREETYPE_DIR used in building FREETYPE.
#=============================================================================
# Copyright 2000-2016 Kitware, Inc.
# Copyright 2000-2011 Insight Software Consortium
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# * Neither the names of Kitware, Inc., the Insight Software Consortium,
# nor the names of their contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
# Created by Eric Wing.
# Modifications by Alexander Neundorf.
# This file has been renamed to "FindFreetype.cmake" instead of the correct
# "FindFreeType.cmake" in order to be compatible with the one from KDE4, Alex.
# Ugh, FreeType seems to use some #include trickery which
# makes this harder than it should be. It looks like they
# put ft2build.h in a common/easier-to-find location which
# then contains a #include to a more specific header in a
# more specific location (#include <freetype/config/ftheader.h>).
# Then from there, they need to set a bunch of #define's
# so you can do something like:
# #include FT_FREETYPE_H
# Unfortunately, using CMake's mechanisms like include_directories()
# wants explicit full paths and this trickery doesn't work too well.
# I'm going to attempt to cut out the middleman and hope
# everything still works.
# Adapted for OpenSceneGraph until the updates here for finding the debug Windows library freetyped are released with CMake
set(FREETYPE_FIND_ARGS
HINTS
ENV FREETYPE_DIR
PATHS
/usr/X11R6
/usr/local/X11R6
/usr/local/X11
/usr/freeware
ENV GTKMM_BASEPATH
[HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]
[HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]
)
find_path(
FREETYPE_INCLUDE_DIR_ft2build
ft2build.h
${FREETYPE_FIND_ARGS}
PATH_SUFFIXES
include/freetype2
include
freetype2
)
find_path(
FREETYPE_INCLUDE_DIR_freetype2
NAMES
freetype/config/ftheader.h
config/ftheader.h
${FREETYPE_FIND_ARGS}
PATH_SUFFIXES
include/freetype2
include
freetype2
)
if(NOT FREETYPE_LIBRARY)
find_library(FREETYPE_LIBRARY_RELEASE
NAMES
freetype
libfreetype
freetype219
${FREETYPE_FIND_ARGS}
PATH_SUFFIXES
lib
)
find_library(FREETYPE_LIBRARY_DEBUG
NAMES
freetyped
libfreetyped
freetype219d
${FREETYPE_FIND_ARGS}
PATH_SUFFIXES
lib
)
include(SelectLibraryConfigurations) #OSG Look in CMake Modules dir
select_library_configurations(FREETYPE)
endif()
unset(FREETYPE_FIND_ARGS)
# set the user variables
if(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2)
set(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}")
list(REMOVE_DUPLICATES FREETYPE_INCLUDE_DIRS)
endif()
set(FREETYPE_LIBRARIES "${FREETYPE_LIBRARY}")
if(EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h")
set(FREETYPE_H "${FREETYPE_INCLUDE_DIR_freetype2}/freetype/freetype.h")
elseif(EXISTS "${FREETYPE_INCLUDE_DIR_freetype2}/freetype.h")
set(FREETYPE_H "${FREETYPE_INCLUDE_DIR_freetype2}/freetype.h")
endif()
if(FREETYPE_INCLUDE_DIR_freetype2 AND FREETYPE_H)
file(STRINGS "${FREETYPE_H}" freetype_version_str
REGEX "^#[\t ]*define[\t ]+FREETYPE_(MAJOR|MINOR|PATCH)[\t ]+[0-9]+$")
unset(FREETYPE_VERSION_STRING)
foreach(VPART MAJOR MINOR PATCH)
foreach(VLINE ${freetype_version_str})
if(VLINE MATCHES "^#[\t ]*define[\t ]+FREETYPE_${VPART}[\t ]+([0-9]+)$")
set(FREETYPE_VERSION_PART "${CMAKE_MATCH_1}")
if(FREETYPE_VERSION_STRING)
set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_STRING}.${FREETYPE_VERSION_PART}")
else()
set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_PART}")
endif()
unset(FREETYPE_VERSION_PART)
endif()
endforeach()
endforeach()
endif()
# handle the QUIETLY and REQUIRED arguments and set FREETYPE_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs) #OSG Look in CMake Modules dir
find_package_handle_standard_args(
Freetype
REQUIRED_VARS
FREETYPE_LIBRARY
FREETYPE_INCLUDE_DIRS
VERSION_VAR
FREETYPE_VERSION_STRING
)
mark_as_advanced(
FREETYPE_INCLUDE_DIR_freetype2
FREETYPE_INCLUDE_DIR_ft2build
)

View File

@@ -19,6 +19,15 @@
# This makes the presumption that you are include gdal.h like
# #include "gdal.h"
# prefer FindGDAL from cmake distribution
if(EXISTS ${CMAKE_ROOT}/Modules/FindGDAL.cmake)
include(${CMAKE_ROOT}/Modules/FindGDAL.cmake)
if(GDAL_FOUND)
return()
endif()
endif()
FIND_PATH(GDAL_INCLUDE_DIR gdal.h
PATHS
$ENV{GDAL_DIR}

View File

@@ -0,0 +1,36 @@
# Finds the OpenGL Core Profile (cp) header file.
# Looks for glcorearb.h
#
# This script defines the following:
# GLCORE_FOUND // Set to TRUE if glcorearb.h is found
# GLCORE_INCLUDE_DIR // Parent directory of directory (gl, GL3, or OpenGL) containing the CP header.
# GLCORE_GLCOREARB_HEADER // advanced
#
# GLCORE_ROOT can be set as an environment variable or a CMake variable,
# to the parent directory of the gl, GL3, or OpenGL directory containing the CP header.
#
FIND_PATH( GLCORE_GLCOREARB_HEADER
NAMES GL/glcorearb.h GL3/glcorearb.h OpenGL/glcorearb.h gl/glcorearb.h
HINTS ${GLCORE_ROOT}
PATHS ENV GLCORE_ROOT
)
set( GLCORE_INCLUDE_DIR )
if( GLCORE_GLCOREARB_HEADER )
set( GLCORE_INCLUDE_DIR ${GLCORE_GLCOREARB_HEADER} )
endif()
# handle the QUIETLY and REQUIRED arguments and set
# GLCORE_FOUND to TRUE as appropriate
INCLUDE( FindPackageHandleStandardArgs )
FIND_PACKAGE_HANDLE_STANDARD_ARGS( GLCORE
"Set GLCORE_ROOT as the parent of the directory containing the OpenGL core profile header."
GLCORE_INCLUDE_DIR )
MARK_AS_ADVANCED(
GLCORE_INCLUDE_DIR
GLCORE_GLCOREARB_HEADER
)

142
CMakeModules/FindGLIB.cmake Normal file
View File

@@ -0,0 +1,142 @@
# - Try to find Glib and its components (gio, gobject etc)
# Once done, this will define
#
# GLIB_FOUND - system has Glib
# GLIB_INCLUDE_DIRS - the Glib include directories
# GLIB_LIBRARIES - link these to use Glib
#
# Optionally, the COMPONENTS keyword can be passed to find_package()
# and Glib components can be looked for. Currently, the following
# components can be used, and they define the following variables if
# found:
#
# gio: GLIB_GIO_LIBRARIES
# gobject: GLIB_GOBJECT_LIBRARIES
# gmodule: GLIB_GMODULE_LIBRARIES
# gthread: GLIB_GTHREAD_LIBRARIES
#
# Note that the respective _INCLUDE_DIR variables are not set, since
# all headers are in the same directory as GLIB_INCLUDE_DIRS.
#
# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
if (WIN32)
find_library(GLIB_LIBRARIES
NAMES glib-2.0
PATHS C:/gstreamer/1.0/x86_64/lib
)
else ()
find_package(PkgConfig)
pkg_check_modules(PC_GLIB QUIET glib-2.0)
find_library(GLIB_LIBRARIES
NAMES glib-2.0
HINTS ${PC_GLIB_LIBDIR}
${PC_GLIB_LIBRARY_DIRS}
)
endif ()
# Files in glib's main include path may include glibconfig.h, which,
# for some odd reason, is normally in $LIBDIR/glib-2.0/include.
get_filename_component(_GLIB_LIBRARY_DIR ${GLIB_LIBRARIES} PATH)
find_path(GLIBCONFIG_INCLUDE_DIR
NAMES glibconfig.h
HINTS ${PC_LIBDIR} ${PC_LIBRARY_DIRS} ${_GLIB_LIBRARY_DIR}
PATH_SUFFIXES glib-2.0/include
)
if (WIN32)
find_path(GLIB_INCLUDE_DIR
NAMES glib.h
PATHS C:/gstreamer/1.0/x86_64/include
PATH_SUFFIXES glib-2.0
)
else()
find_path(GLIB_INCLUDE_DIR
NAMES glib.h
HINTS ${PC_GLIB_INCLUDEDIR}
${PC_GLIB_INCLUDE_DIRS}
PATH_SUFFIXES glib-2.0
)
endif()
if (GLIBCONFIG_INCLUDE_DIR)
set(GLIB_INCLUDE_DIRS ${GLIB_INCLUDE_DIR} ${GLIBCONFIG_INCLUDE_DIR})
# Version detection
file(READ "${GLIBCONFIG_INCLUDE_DIR}/glibconfig.h" GLIBCONFIG_H_CONTENTS)
string(REGEX MATCH "#define GLIB_MAJOR_VERSION ([0-9]+)" _dummy "${GLIBCONFIG_H_CONTENTS}")
set(GLIB_VERSION_MAJOR "${CMAKE_MATCH_1}")
string(REGEX MATCH "#define GLIB_MINOR_VERSION ([0-9]+)" _dummy "${GLIBCONFIG_H_CONTENTS}")
set(GLIB_VERSION_MINOR "${CMAKE_MATCH_1}")
string(REGEX MATCH "#define GLIB_MICRO_VERSION ([0-9]+)" _dummy "${GLIBCONFIG_H_CONTENTS}")
set(GLIB_VERSION_MICRO "${CMAKE_MATCH_1}")
set(GLIB_VERSION "${GLIB_VERSION_MAJOR}.${GLIB_VERSION_MINOR}.${GLIB_VERSION_MICRO}")
# Additional Glib components. We only look for libraries, as not all of them
# have corresponding headers and all headers are installed alongside the main
# glib ones.
foreach (_component ${GLIB_FIND_COMPONENTS})
if (${_component} STREQUAL "gio")
find_library(GLIB_GIO_LIBRARIES NAMES gio-2.0 HINTS ${_GLIB_LIBRARY_DIR})
set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} GLIB_GIO_LIBRARIES)
elseif (${_component} STREQUAL "gobject")
find_library(GLIB_GOBJECT_LIBRARIES NAMES gobject-2.0 HINTS ${_GLIB_LIBRARY_DIR})
set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} GLIB_GOBJECT_LIBRARIES)
elseif (${_component} STREQUAL "gmodule")
find_library(GLIB_GMODULE_LIBRARIES NAMES gmodule-2.0 HINTS ${_GLIB_LIBRARY_DIR})
set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} GLIB_GMODULE_LIBRARIES)
elseif (${_component} STREQUAL "gthread")
find_library(GLIB_GTHREAD_LIBRARIES NAMES gthread-2.0 HINTS ${_GLIB_LIBRARY_DIR})
set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} GLIB_GTHREAD_LIBRARIES)
elseif (${_component} STREQUAL "gio-unix")
# gio-unix is compiled as part of the gio library, but the include paths
# are separate from the shared glib ones. Since this is currently only used
# by WebKitGTK+ we don't go to extraordinary measures beyond pkg-config.
pkg_check_modules(GIO_UNIX QUIET gio-unix-2.0)
endif ()
endforeach ()
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLIB REQUIRED_VARS GLIB_INCLUDE_DIRS GLIB_LIBRARIES ${ADDITIONAL_REQUIRED_VARS}
VERSION_VAR GLIB_VERSION)
mark_as_advanced(
GLIBCONFIG_INCLUDE_DIR
GLIB_GIO_LIBRARIES
GLIB_GIO_UNIX_LIBRARIES
GLIB_GMODULE_LIBRARIES
GLIB_GOBJECT_LIBRARIES
GLIB_GTHREAD_LIBRARIES
GLIB_INCLUDE_DIR
GLIB_INCLUDE_DIRS
GLIB_LIBRARIES
)
else()
endif ()

View File

@@ -0,0 +1,174 @@
# - Try to find GStreamer and its plugins
# Once done, this will define
#
# GSTREAMER_FOUND - system has GStreamer
# GSTREAMER_INCLUDE_DIRS - the GStreamer include directories
# GSTREAMER_LIBRARIES - link these to use GStreamer
#
# Additionally, gstreamer-base is always looked for and required, and
# the following related variables are defined:
#
# GSTREAMER_BASE_INCLUDE_DIRS - gstreamer-base's include directory
# GSTREAMER_BASE_LIBRARIES - link to these to use gstreamer-base
#
# Optionally, the COMPONENTS keyword can be passed to find_package()
# and GStreamer plugins can be looked for. Currently, the following
# plugins can be searched, and they define the following variables if
# found:
#
# gstreamer-app: GSTREAMER_APP_INCLUDE_DIRS and GSTREAMER_APP_LIBRARIES
# gstreamer-audio: GSTREAMER_AUDIO_INCLUDE_DIRS and GSTREAMER_AUDIO_LIBRARIES
# gstreamer-fft: GSTREAMER_FFT_INCLUDE_DIRS and GSTREAMER_FFT_LIBRARIES
# gstreamer-pbutils: GSTREAMER_PBUTILS_INCLUDE_DIRS and GSTREAMER_PBUTILS_LIBRARIES
# gstreamer-video: GSTREAMER_VIDEO_INCLUDE_DIRS and GSTREAMER_VIDEO_LIBRARIES
#
# Copyright (C) 2012 Raphael Kubo da Costa <rakuco@webkit.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS
# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Helper macro to find a GStreamer plugin (or GStreamer itself)
# _component_prefix is prepended to the _INCLUDE_DIRS and _LIBRARIES variables (eg. "GSTREAMER_AUDIO")
# _pkgconfig_name is the component's pkg-config name (eg. "gstreamer-1.0", or "gstreamer-video-1.0").
# _header is the component's header, relative to the gstreamer-1.0 directory (eg. "gst/gst.h").
# _library is the component's library name (eg. "gstreamer-1.0" or "gstvideo-1.0")
#macro(FIND_GSTREAMER_COMPONENT _component_prefix _pkgconfig_name _header _library)
# pkg_check_modules(PC_${_component_prefix} QUIET ${_pkgconfig_name})
#
# find_path(${_component_prefix}_INCLUDE_DIRS
# NAMES ${_header}
# HINTS ${PC_${_component_prefix}_INCLUDE_DIRS} ${PC_${_component_prefix}_INCLUDEDIR}
# PATH_SUFFIXES gstreamer-1.0
# )
#
# find_library(${_component_prefix}_LIBRARIES
# NAMES ${_library}
# HINTS ${PC_${_component_prefix}_LIBRARY_DIRS} ${PC_${_component_prefix}_LIBDIR}
# )
#endmacro()
if (WIN32)
macro(FIND_GSTREAMER_COMPONENT _component_prefix _pkgconfig_name _header _library)
find_path(${_component_prefix}_INCLUDE_DIRS
NAMES ${_header}
PATHS C:/gstreamer/1.0/x86_64/include
PATH_SUFFIXES gstreamer-1.0
)
find_library(${_component_prefix}_LIBRARIES
NAMES ${_library}
PATHS C:/gstreamer/1.0/x86_64/lib
)
endmacro()
else ()
find_package(PkgConfig)
macro(FIND_GSTREAMER_COMPONENT _component_prefix _pkgconfig_name _header _library)
pkg_check_modules(${_component_prefix} QUIET ${_pkgconfig_name})
# find_path(${_component_prefix}_INCLUDE_DIRS
# NAMES ${_header}
# HINTS ${PC_${_component_prefix}_INCLUDE_DIRS} ${PC_${_component_prefix}_INCLUDEDIR}
# PATH_SUFFIXES gstreamer-1.0
# )
# find_library(${_component_prefix}_LIBRARIES
# NAMES ${_library}
# HINTS ${PC_${_component_prefix}_LIBRARY_DIRS} ${PC_${_component_prefix}_LIBDIR}
# )
endmacro()
endif ()
# ------------------------
# 1. Find GStreamer itself
# ------------------------
# 1.1. Find headers and libraries
FIND_GSTREAMER_COMPONENT(GSTREAMER gstreamer-1.0 gst/gst.h gstreamer-1.0)
FIND_GSTREAMER_COMPONENT(GSTREAMER_BASE gstreamer-base-1.0 gst/gst.h gstbase-1.0)
# 1.2. Check GStreamer version
if (GSTREAMER_INCLUDE_DIRS)
if (EXISTS "${GSTREAMER_INCLUDE_DIRS}/gst/gstversion.h")
file(READ "${GSTREAMER_INCLUDE_DIRS}/gst/gstversion.h" GSTREAMER_VERSION_CONTENTS)
string(REGEX MATCH "#define +GST_VERSION_MAJOR +\\(([0-9]+)\\)" _dummy "${GSTREAMER_VERSION_CONTENTS}")
set(GSTREAMER_VERSION_MAJOR "${CMAKE_MATCH_1}")
string(REGEX MATCH "#define +GST_VERSION_MINOR +\\(([0-9]+)\\)" _dummy "${GSTREAMER_VERSION_CONTENTS}")
set(GSTREAMER_VERSION_MINOR "${CMAKE_MATCH_1}")
string(REGEX MATCH "#define +GST_VERSION_MICRO +\\(([0-9]+)\\)" _dummy "${GSTREAMER_VERSION_CONTENTS}")
set(GSTREAMER_VERSION_MICRO "${CMAKE_MATCH_1}")
set(GSTREAMER_VERSION "${GSTREAMER_VERSION_MAJOR}.${GSTREAMER_VERSION_MINOR}.${GSTREAMER_VERSION_MICRO}")
endif ()
endif ()
if ("${GStreamer_FIND_VERSION}" VERSION_GREATER "${GSTREAMER_VERSION}")
message(FATAL_ERROR "Required version (" ${GStreamer_FIND_VERSION} ") is higher than found version (" ${GSTREAMER_VERSION} ")")
endif ()
# -------------------------
# 2. Find GStreamer plugins
# -------------------------
FIND_GSTREAMER_COMPONENT(GSTREAMER_APP gstreamer-app-1.0 gst/app/gstappsink.h gstapp-1.0)
FIND_GSTREAMER_COMPONENT(GSTREAMER_AUDIO gstreamer-audio-1.0 gst/audio/audio.h gstaudio-1.0)
FIND_GSTREAMER_COMPONENT(GSTREAMER_FFT gstreamer-fft-1.0 gst/fft/gstfft.h gstfft-1.0)
FIND_GSTREAMER_COMPONENT(GSTREAMER_PBUTILS gstreamer-pbutils-1.0 gst/pbutils/pbutils.h gstpbutils-1.0)
FIND_GSTREAMER_COMPONENT(GSTREAMER_VIDEO gstreamer-video-1.0 gst/video/video.h gstvideo-1.0)
# ------------------------------------------------
# 3. Process the COMPONENTS passed to FIND_PACKAGE
# ------------------------------------------------
set(_GSTREAMER_REQUIRED_VARS GSTREAMER_INCLUDE_DIRS GSTREAMER_LIBRARIES GSTREAMER_VERSION GSTREAMER_BASE_INCLUDE_DIRS GSTREAMER_BASE_LIBRARIES)
foreach (_component ${GStreamer_FIND_COMPONENTS})
set(_gst_component "GSTREAMER_${_component}")
string(TOUPPER ${_gst_component} _UPPER_NAME)
list(APPEND _GSTREAMER_REQUIRED_VARS ${_UPPER_NAME}_INCLUDE_DIRS ${_UPPER_NAME}_LIBRARIES)
endforeach ()
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GStreamer REQUIRED_VARS ${_GSTREAMER_REQUIRED_VARS}
VERSION_VAR GSTREAMER_VERSION)
mark_as_advanced(
GSTREAMER_APP_INCLUDE_DIRS
GSTREAMER_APP_LIBRARIES
GSTREAMER_AUDIO_INCLUDE_DIRS
GSTREAMER_AUDIO_LIBRARIES
GSTREAMER_BASE_INCLUDE_DIRS
GSTREAMER_BASE_LIBRARIES
GSTREAMER_FFT_INCLUDE_DIRS
GSTREAMER_FFT_LIBRARIES
GSTREAMER_INCLUDE_DIRS
GSTREAMER_LIBRARIES
GSTREAMER_PBUTILS_INCLUDE_DIRS
GSTREAMER_PBUTILS_LIBRARIES
GSTREAMER_VIDEO_INCLUDE_DIRS
GSTREAMER_VIDEO_LIBRARIES
)

View File

@@ -9,6 +9,15 @@
#
# Created by Robert Osfield.
# prefer FindJasper from cmake distribution
if(EXISTS ${CMAKE_ROOT}/Modules/FindJasper.cmake)
include(${CMAKE_ROOT}/Modules/FindJasper.cmake)
if(JASPER_FOUND)
return()
endif()
endif()
FIND_PATH(JASPER_INCLUDE_DIR jasper/jasper.h
$ENV{JASPER_DIR}/include
$ENV{JASPER_DIR}/src/libjasper/include

View File

@@ -0,0 +1,107 @@
#---
# File: FindLIBLAS.cmake
#
# Find the native LIBLAS includes and library
#
# LIBLAS_INCLUDE_DIRS - where to find liblas's includes.
# LIBLAS_LIBRARIES - List of libraries when using liblas.
# LIBLAS_FOUND - True if liblas found.
#---
# Set the include dir:
find_path(LIBLAS_INCLUDE_DIR liblas/liblas.hpp)
# Macro for setting libraries:
macro(FIND_LIBLAS_LIBRARY MYLIBRARY MYLIBRARYNAME)
find_library(
"${MYLIBRARY}_DEBUG"
NAMES "${MYLIBRARYNAME}${CMAKE_DEBUG_POSTFIX}"
PATHS
${LIBLAS_DIR}/lib/Debug
${LIBLAS_DIR}/lib64/Debug
${LIBLAS_DIR}/lib
${LIBLAS_DIR}/lib64
$ENV{LIBLAS_DIR}/lib/debug
$ENV{LIBLAS_DIR}/lib64/debug
NO_DEFAULT_PATH
)
find_library(
"${MYLIBRARY}_DEBUG"
NAMES "${MYLIBRARYNAME}${CMAKE_DEBUG_POSTFIX}"
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;LIBLAS_ROOT]/lib
/usr/freeware/lib64
)
find_library(
${MYLIBRARY}
NAMES "${MYLIBRARYNAME}${CMAKE_RELEASE_POSTFIX}"
PATHS
${LIBLAS_DIR}/lib/Release
${LIBLAS_DIR}/lib64/Release
${LIBLAS_DIR}/lib
${LIBLAS_DIR}/lib64
$ENV{LIBLAS_DIR}/lib/Release
$ENV{LIBLAS_DIR}/lib64/Release
$ENV{LIBLAS_DIR}/lib
$ENV{LIBLAS_DIR}/lib64
$ENV{LIBLAS_DIR}
$ENV{LIBLASDIR}/lib
$ENV{LIBLASDIR}/lib64
$ENV{LIBLASDIR}
$ENV{LIBLAS_ROOT}/lib
$ENV{LIBLAS_ROOT}/lib64
NO_DEFAULT_PATH
)
find_library(
${MYLIBRARY}
NAMES "${MYLIBRARYNAME}${CMAKE_RELEASE_POSTFIX}"
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;LIBLAS_ROOT]/lib
/usr/freeware/lib64
)
if( NOT ${MYLIBRARY}_DEBUG )
if( MYLIBRARY )
set( ${MYLIBRARY}_DEBUG ${MYLIBRARY} )
endif(MYLIBRARY)
endif( NOT ${MYLIBRARY}_DEBUG )
endmacro(FIND_LIBLAS_LIBRARY LIBRARY LIBRARYNAME)
FIND_LIBLAS_LIBRARY(LIBLAS_LIBRARY las)
FIND_LIBLAS_LIBRARY(LIBLASC_LIBRARY las_c)
set(LIBLAS_FOUND "NO")
if(LIBLAS_LIBRARY AND LIBLASC_LIBRARY AND LIBLAS_INCLUDE_DIR)
FIND_PACKAGE(Boost) # used by LIBLAS
if(Boost_FOUND)
set(LIBLAS_LIBRARIES ${LIBLAS_LIBRARY} ${LIBLASC_LIBRARY} )
set(LIBLAS_FOUND "YES")
endif()
endif()

View File

@@ -0,0 +1,83 @@
# Locate Lua library
# This module defines
# LUA51_FOUND, if false, do not try to link to Lua
# LUA_LIBRARIES
# LUA_INCLUDE_DIR, where to find lua.h
# LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8)
#
# Note that the expected include convention is
# #include "lua.h"
# and not
# #include <lua/lua.h>
# This is because, the lua location is not standardized and may exist
# in locations other than lua/
#=============================================================================
# Copyright 2007-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
find_path(LUA_INCLUDE_DIR lua.h
HINTS
ENV LUA_DIR
PATH_SUFFIXES include/lua52 include/lua5.2 include/lua include
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
)
find_library(LUA_LIBRARY
NAMES lua52 lua5.2 lua-5.2 lua
HINTS
ENV LUA_DIR
PATH_SUFFIXES lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw
/opt/local
/opt/csw
/opt
)
if(LUA_LIBRARY)
# include the math library for Unix
if(UNIX AND NOT APPLE)
find_library(LUA_MATH_LIBRARY m)
set( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
# For Windows and Mac, don't need to explicitly include the math library
else()
set( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries")
endif()
endif()
if(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h")
file(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"")
string(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}")
unset(lua_version_str)
endif()
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if
# all listed variables are TRUE
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua52
REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR
VERSION_VAR LUA_VERSION_STRING)
mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY)

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,97 @@ 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
)
# NVTHREAD
FIND_LIBRARY(NVTHREAD_LIBRARY
NAMES nvthread
PATHS
/usr/local
/usr
$ENV{NVTT_DIR}
${3rdPartyRoot}
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
)
FIND_LIBRARY(NVTHREAD_LIBRARY_DEBUG
NAMES nvthread_d
PATHS
/usr/local
/usr
$ENV{NVTT_DIR}
${3rdPartyRoot}
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
)
# SQUISH
FIND_LIBRARY(NVSQUISH_LIBRARY
NAMES squish
PATHS
/usr/local
/usr
$ENV{NVTT_DIR}
${3rdPartyRoot}
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
)
FIND_LIBRARY(NVSQUISH_LIBRARY_DEBUG
NAMES squish_d
PATHS
/usr/local
/usr
$ENV{NVTT_DIR}
${3rdPartyRoot}
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
)
# BC6H
FIND_LIBRARY(NVBC6H_LIBRARY
NAMES bc6h
PATHS
/usr/local
/usr
$ENV{NVTT_DIR}
${3rdPartyRoot}
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
)
FIND_LIBRARY(NVBC6H_LIBRARY_DEBUG
NAMES bc6h_d
PATHS
/usr/local
/usr
$ENV{NVTT_DIR}
${3rdPartyRoot}
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
)
# BC7
FIND_LIBRARY(NVBC7_LIBRARY
NAMES bc7
PATHS
/usr/local
/usr
$ENV{NVTT_DIR}
${3rdPartyRoot}
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
)
FIND_LIBRARY(NVBC7_LIBRARY_DEBUG
NAMES bc7_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
@@ -107,7 +107,7 @@ MACRO(FIND_OSG_LIBRARY MYLIBRARY MYLIBRARYNAME)
ENDIF(NOT MYLIBRARY)
ENDIF( NOT ${MYLIBRARY}_DEBUG )
ENDMACRO(FIND_OSG_LIBRARY LIBRARY LIBRARYNAME)
FIND_OSG_LIBRARY(OSG_LIBRARY osg)
@@ -126,7 +126,7 @@ 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 osgSim)
FIND_OSG_LIBRARY(OSGSIM_LIBRARY osgSim)
FIND_OSG_LIBRARY(OPENTHREADS_LIBRARY OpenThreads)

View File

@@ -9,6 +9,7 @@
#
# Created by Robert Osfield.
FIND_PATH(OPENEXR_INCLUDE_DIR OpenEXR/ImfIO.h
$ENV{OPENEXR_DIR}/include
$ENV{OPENEXR_DIR}
@@ -23,78 +24,41 @@ FIND_PATH(OPENEXR_INCLUDE_DIR OpenEXR/ImfIO.h
/usr/freeware/include
)
FIND_LIBRARY(OPENEXR_IlmIlf_LIBRARY
NAMES IlmImf
PATHS
$ENV{OPENEXR_DIR}/lib
$ENV{OPENEXR_DIR}
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
# Macro to find exr libraries (deduplicating search paths)
# example: OPENEXR_FIND_VAR(OPENEXR_IlmImf_LIBRARY IlmImf)
MACRO(OPENEXR_FIND_VAR varname libname)
FIND_LIBRARY( ${varname}
NAMES ${libname}
PATHS
$ENV{OPENEXR_DIR}/lib
$ENV{OPENEXR_DIR}
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
ENDMACRO(OPENEXR_FIND_VAR)
FIND_LIBRARY(OPENEXR_IlmThread_LIBRARY
NAMES IlmThread
PATHS
$ENV{OPENEXR_DIR}/lib
$ENV{OPENEXR_DIR}
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
# Macro to find exr libraries (and debug versions)
# example: OPENEXR_FIND(IlmImf)
MACRO(OPENEXR_FIND libname)
OPENEXR_FIND_VAR(OPENEXR_${libname}_LIBRARY ${libname})
OPENEXR_FIND_VAR(OPENEXR_${libname}_LIBRARY_DEBUG ${libname}d)
ENDMACRO(OPENEXR_FIND)
FIND_LIBRARY(OPENEXR_Iex_LIBRARY
NAMES Iex
PATHS
$ENV{OPENEXR_DIR}/lib
$ENV{OPENEXR_DIR}
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
FIND_LIBRARY(OPENEXR_Half_LIBRARY
NAMES Half
PATHS
$ENV{OPENEXR_DIR}/lib
$ENV{OPENEXR_DIR}
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
OPENEXR_FIND(IlmImf)
OPENEXR_FIND(IlmThread)
OPENEXR_FIND(Iex)
OPENEXR_FIND(Half)
SET(OPENEXR_FOUND "NO")
IF(OPENEXR_INCLUDE_DIR AND OPENEXR_IlmIlf_LIBRARY AND OPENEXR_IlmThread_LIBRARY AND OPENEXR_Iex_LIBRARY AND OPENEXR_Half_LIBRARY)
SET(OPENEXR_LIBRARIES
${OPENEXR_IlmIlf_LIBRARY}
${OPENEXR_IlmThread_LIBRARY}
${OPENEXR_Half_LIBRARY}
${OPENEXR_Iex_LIBRARY}
)
IF(OPENEXR_INCLUDE_DIR AND OPENEXR_IlmImf_LIBRARY AND OPENEXR_IlmThread_LIBRARY AND OPENEXR_Iex_LIBRARY AND OPENEXR_Half_LIBRARY)
SET(OPENEXR_LIBRARIES ${OPENEXR_IlmImf_LIBRARY} ${OPENEXR_IlmThread_LIBRARY} ${OPENEXR_Half_LIBRARY} ${OPENEXR_Iex_LIBRARY} )
SET(OPENEXR_LIBRARIES_VARS OPENEXR_IlmImf_LIBRARY OPENEXR_IlmThread_LIBRARY OPENEXR_Half_LIBRARY OPENEXR_Iex_LIBRARY )
SET(OPENEXR_FOUND "YES")
ENDIF(OPENEXR_INCLUDE_DIR AND OPENEXR_IlmIlf_LIBRARY AND OPENEXR_IlmThread_LIBRARY AND OPENEXR_Iex_LIBRARY AND OPENEXR_Half_LIBRARY)
ENDIF(OPENEXR_INCLUDE_DIR AND OPENEXR_IlmImf_LIBRARY AND OPENEXR_IlmThread_LIBRARY AND OPENEXR_Iex_LIBRARY AND OPENEXR_Half_LIBRARY)

View File

@@ -17,6 +17,16 @@
#
# Created by Eric Wing.
# prefer FindOpenThreads from cmake distribution
if(EXISTS ${CMAKE_ROOT}/Modules/FindOpenThreads.cmake)
include(${CMAKE_ROOT}/Modules/FindOpenThreads.cmake)
if(OPENTHREADS_FOUND)
return()
endif()
endif()
# Header files are presumed to be included like
# #include <OpenThreads/Thread>

View File

@@ -1,13 +1,14 @@
# Locate QuickTime
# This module defines
# QUICKTIME_LIBRARY
# QUICKTIME_FOUND, if false, do not try to link to gdal
# QUICKTIME_FOUND, if false, do not try to link to gdal
# QUICKTIME_INCLUDE_DIR, where to find the headers
#
# $QUICKTIME_DIR is an environment variable that would
# correspond to the ./configure --prefix=$QUICKTIME_DIR
#
# Created by Eric Wing.
# Created by Eric Wing.
# QuickTime on OS X looks different than QuickTime for Windows,
# so I am going to case the two.
@@ -63,8 +64,8 @@ ELSE()
ENDIF()
ENDIF()
# Disable quicktime for >= 10.7, as it's officially deprecated
IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.7" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.8" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.9")
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()

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)

178
CMakeModules/FindSDL2.cmake Normal file
View File

@@ -0,0 +1,178 @@
# - Locate SDL library
# This module defines
# SDL2_LIBRARY, the name of the library to link against
# SDL2_FOUND, if false, do not try to link to SDL
# SDL2_INCLUDE_DIR, where to find SDL.h
# SDL2_VERSION_STRING, human-readable string containing the version of SDL
#
# This module responds to the flag:
# SDL2_BUILDING_LIBRARY
# If this is defined, then no SDL2_main will be linked in because
# only applications need main().
# Otherwise, it is assumed you are building an application and this
# module will attempt to locate and set the proper link flags
# as part of the returned SDL2_LIBRARY variable.
#
# Don't forget to include SDLmain.h and SDLmain.m your project for the
# OS X framework based version. (Other versions link to -lSDLmain which
# this module will try to find on your behalf.) Also for OS X, this
# module will automatically add the -framework Cocoa on your behalf.
#
#
# Additional Note: If you see an empty SDL2_LIBRARY_TEMP in your configuration
# and no SDL2_LIBRARY, it means CMake did not find your SDL library
# (SDL.dll, libsdl.so, SDL.framework, etc).
# Set SDL2_LIBRARY_TEMP to point to your SDL library, and configure again.
# Similarly, if you see an empty SDL2MAIN_LIBRARY, you should set this value
# as appropriate. These values are used to generate the final SDL2_LIBRARY
# variable, but when these values are unset, SDL2_LIBRARY does not get created.
#
#
# $SDLDIR is an environment variable that would
# correspond to the ./configure --prefix=$SDLDIR
# used in building SDL.
# l.e.galup 9-20-02
#
# Modified by Eric Wing.
# Added code to assist with automated building by using environmental variables
# and providing a more controlled/consistent search behavior.
# Added new modifications to recognize OS X frameworks and
# additional Unix paths (FreeBSD, etc).
# Also corrected the header search path to follow "proper" SDL guidelines.
# Added a search for SDLmain which is needed by some platforms.
# Added a search for threads which is needed by some platforms.
# Added needed compile switches for MinGW.
#
# On OSX, this will prefer the Framework version (if found) over others.
# People will have to manually change the cache values of
# SDL2_LIBRARY to override this selection or set the CMake environment
# CMAKE_INCLUDE_PATH to modify the search paths.
#
# Note that the header path has changed from SDL/SDL.h to just SDL.h
# This needed to change because "proper" SDL convention
# is #include "SDL.h", not <SDL/SDL.h>. This is done for portability
# reasons because not all systems place things in SDL/ (see FreeBSD).
#=============================================================================
# Copyright 2003-2009 Kitware, Inc.
# Copyright 2012 Benjamin Eikel
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
find_path(SDL2_INCLUDE_DIR SDL.h
HINTS
ENV SDL2DIR
PATH_SUFFIXES include/SDL2
)
# SDL-1.1 is the name used by FreeBSD ports...
# don't confuse it for the version number.
find_library(SDL2_LIBRARY_TEMP
NAMES SDL2
HINTS
ENV SDL2DIR
PATH_SUFFIXES lib
)
if(NOT SDL2_BUILDING_LIBRARY)
if(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
# Non-OS X framework versions expect you to also dynamically link to
# SDLmain. This is mainly for Windows and OS X. Other (Unix) platforms
# seem to provide SDLmain for compatibility even though they don't
# necessarily need it.
find_library(SDL2MAIN_LIBRARY
NAMES SDL2main
HINTS
ENV SDL2DIR
PATH_SUFFIXES lib
PATHS
/sw
/opt/local
/opt/csw
/opt
)
endif()
endif()
# SDL may require threads on your system.
# The Apple build may not need an explicit flag because one of the
# frameworks may already provide it.
# But for non-OSX systems, I will use the CMake Threads package.
if(NOT APPLE)
find_package(Threads)
endif()
# MinGW needs an additional library, mwindows
# It's total link flags should look like -lmingw32 -lSDLmain -lSDL -lmwindows
# (Actually on second look, I think it only needs one of the m* libraries.)
if(MINGW)
set(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW")
endif()
if(SDL2_LIBRARY_TEMP)
# For SDLmain
if(SDL2MAIN_LIBRARY AND NOT SDL2_BUILDING_LIBRARY)
list(FIND SDL2_LIBRARY_TEMP "${SDL2MAIN_LIBRARY}" _SDL2_MAIN_INDEX)
if(_SDL2_MAIN_INDEX EQUAL -1)
set(SDL2_LIBRARY_TEMP "${SDL2MAIN_LIBRARY}" ${SDL2_LIBRARY_TEMP})
endif()
unset(_SDL2_MAIN_INDEX)
endif()
# For OS X, SDL uses Cocoa as a backend so it must link to Cocoa.
# CMake doesn't display the -framework Cocoa string in the UI even
# though it actually is there if I modify a pre-used variable.
# I think it has something to do with the CACHE STRING.
# So I use a temporary variable until the end so I can set the
# "real" variable in one-shot.
if(APPLE)
set(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework Cocoa")
endif()
# For threads, as mentioned Apple doesn't need this.
# In fact, there seems to be a problem if I used the Threads package
# and try using this line, so I'm just skipping it entirely for OS X.
if(NOT APPLE)
set(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT})
endif()
# For MinGW library
if(MINGW)
set(SDL2_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL2_LIBRARY_TEMP})
endif()
# Set the final string here so the GUI reflects the final state.
set(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP} CACHE STRING "Where the SDL Library can be found")
# Set the temp variable to INTERNAL so it is not seen in the CMake GUI
set(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "")
endif()
if(SDL2_INCLUDE_DIR AND EXISTS "${SDL2_INCLUDE_DIR}/SDL2_version.h")
file(STRINGS "${SDL2_INCLUDE_DIR}/SDL2_version.h" SDL2_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL2_MAJOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL2_INCLUDE_DIR}/SDL2_version.h" SDL2_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL2_MINOR_VERSION[ \t]+[0-9]+$")
file(STRINGS "${SDL2_INCLUDE_DIR}/SDL2_version.h" SDL2_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL2_PATCHLEVEL[ \t]+[0-9]+$")
string(REGEX REPLACE "^#define[ \t]+SDL2_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_VERSION_MAJOR "${SDL2_VERSION_MAJOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL2_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_VERSION_MINOR "${SDL2_VERSION_MINOR_LINE}")
string(REGEX REPLACE "^#define[ \t]+SDL2_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL2_VERSION_PATCH "${SDL2_VERSION_PATCH_LINE}")
set(SDL2_VERSION_STRING ${SDL2_VERSION_MAJOR}.${SDL2_VERSION_MINOR}.${SDL2_VERSION_PATCH})
unset(SDL2_VERSION_MAJOR_LINE)
unset(SDL2_VERSION_MINOR_LINE)
unset(SDL2_VERSION_PATCH_LINE)
unset(SDL2_VERSION_MAJOR)
unset(SDL2_VERSION_MINOR)
unset(SDL2_VERSION_PATCH)
endif()
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2
REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR
VERSION_VAR SDL2_VERSION_STRING)

45
CMakeModules/FindV8.cmake Normal file
View File

@@ -0,0 +1,45 @@
# Locate V8
# This module defines
# V8_LIBRARY
# V8_FOUND, if false, do not try to link to gdal
# V8_INCLUDE_DIR, where to find the headers
#
# $V8_DIR is an environment variable that would
# correspond to the ./configure --prefix=$V8_DIR
#
# Created by Robert Osfield (based on FindFLTK.cmake)
FIND_PATH(V8_INCLUDE_DIR v8.h
$ENV{V8_DIR}/include
$ENV{V8_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(V8_LIBRARY
NAMES v8 libv8
PATHS
$ENV{V8_DIR}/lib
$ENV{V8_DIR}
~/Library/Frameworks
/Library/Frameworks
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
/usr/freeware/lib64
)
SET(V8_FOUND "NO")
IF(V8_LIBRARY AND V8_INCLUDE_DIR)
SET(V8_FOUND "YES")
ENDIF()

View File

@@ -10,6 +10,16 @@
#
# Created by Ulrich Hertlein.
# prefer FindZLIB from cmake distribution
if(EXISTS ${CMAKE_ROOT}/Modules/FindZLIB.cmake)
include(${CMAKE_ROOT}/Modules/FindZLIB.cmake)
if(ZLIB_FOUND)
return()
endif()
endif()
FIND_PATH(ZLIB_INCLUDE_DIR zlib.h
$ENV{ZLIB_DIR}/include
$ENV{ZLIB_DIR}

0
CMakeModules/FindZeroConf.cmake Executable file → Normal file
View File

View File

@@ -25,14 +25,6 @@ IF(MSVC AND OSG_MSVC_VERSIONED_DLL)
HANDLE_MSVC_DLL()
ENDIF()
IF(ANDROID)
INSTALL (
FILES ${TARGET_H}
DESTINATION ${INSTALL_INCDIR}/${LIB_NAME}
COMPONENT libopenscenegraph-dev
)
ELSE(ANDROID)
INSTALL(
TARGETS ${LIB_NAME}
RUNTIME DESTINATION ${INSTALL_BINDIR} COMPONENT libopenscenegraph
@@ -40,6 +32,12 @@ INSTALL(
ARCHIVE DESTINATION ${INSTALL_ARCHIVEDIR} COMPONENT libopenscenegraph-dev
)
IF(MSVC AND DYNAMIC_OPENSCENEGRAPH)
GET_TARGET_PROPERTY(PREFIX ${LIB_NAME} PREFIX)
INSTALL(FILES ${OUTPUT_BINDIR}/${PREFIX}${LIB_NAME}${CMAKE_RELWITHDEBINFO_POSTFIX}.pdb DESTINATION ${INSTALL_BINDIR} COMPONENT libopenscenegraph CONFIGURATIONS RelWithDebInfo)
INSTALL(FILES ${OUTPUT_BINDIR}/${PREFIX}${LIB_NAME}${CMAKE_DEBUG_POSTFIX}.pdb DESTINATION ${INSTALL_BINDIR} COMPONENT libopenscenegraph CONFIGURATIONS Debug)
ENDIF(MSVC AND DYNAMIC_OPENSCENEGRAPH)
IF(NOT OSG_COMPILE_FRAMEWORKS)
INSTALL (
FILES ${TARGET_H}
@@ -59,4 +57,3 @@ ELSE()
# MESSAGE("${OSG_COMPILE_FRAMEWORKS_INSTALL_NAME_DIR}")
ENDIF()
ENDIF(ANDROID)

View File

@@ -67,7 +67,7 @@ MACRO(ANDROID_3RD_PARTY)
#JPEG
################################################
FIND_PATH(JPEG_INCLUDE_DIR Android.mk
${CMAKE_SOURCE_DIR}/3rdparty/libjpeg
${CMAKE_SOURCE_DIR}/3rdparty/libjpeg NO_CMAKE_FIND_ROOT_PATH
)
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libjpeg")
#set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${JPEG_INCLUDE_DIR}/Android.mk \n")
@@ -82,7 +82,7 @@ MACRO(ANDROID_3RD_PARTY)
#PNG
################################################
FIND_PATH(PNG_INCLUDE_DIR Android.mk
${CMAKE_SOURCE_DIR}/3rdparty/libpng
${CMAKE_SOURCE_DIR}/3rdparty/libpng NO_CMAKE_FIND_ROOT_PATH
)
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libpng")
#set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${PNG_INCLUDE_DIR}/Android.mk \n")
@@ -97,7 +97,7 @@ MACRO(ANDROID_3RD_PARTY)
#GIF
################################################
FIND_PATH(GIFLIB_INCLUDE_DIR Android.mk
${CMAKE_SOURCE_DIR}/3rdparty/giflib
${CMAKE_SOURCE_DIR}/3rdparty/giflib NO_CMAKE_FIND_ROOT_PATH
)
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libgif")
#set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${GIFLIB_INCLUDE_DIR}/Android.mk \n")
@@ -112,7 +112,7 @@ MACRO(ANDROID_3RD_PARTY)
#TIF
################################################
FIND_PATH(TIFF_INCLUDE_DIR Android.mk
${CMAKE_SOURCE_DIR}/3rdparty/libtiff
${CMAKE_SOURCE_DIR}/3rdparty/libtiff NO_CMAKE_FIND_ROOT_PATH
)
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libtiff")
#set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${TIFF_INCLUDE_DIR}/Android.mk \n")
@@ -142,7 +142,7 @@ MACRO(ANDROID_3RD_PARTY)
#CURL
################################################
FIND_PATH(CURL_DIR Android.mk
${CMAKE_SOURCE_DIR}/3rdparty/curl
${CMAKE_SOURCE_DIR}/3rdparty/curl NO_CMAKE_FIND_ROOT_PATH
)
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libcurl")
#set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${CURL_DIR}/Android.mk \n")
@@ -159,11 +159,11 @@ MACRO(ANDROID_3RD_PARTY)
#FREETYPE
################################################
FIND_PATH(FREETYPE_DIR Android.mk
${CMAKE_SOURCE_DIR}/3rdparty/freetype
${CMAKE_SOURCE_DIR}/3rdparty/freetype NO_CMAKE_FIND_ROOT_PATH
)
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libft2")
#set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${FREETYPE_DIR}/Android.mk \n")
set(FREETYPE_INCLUDE_DIRS "${FREETYPE_DIR}/include ${FREETYPE_DIR}/include/freetype/config")
set(FREETYPE_INCLUDE_DIRS ${FREETYPE_DIR}/include ${FREETYPE_DIR}/include/freetype/config)
if(FREETYPE_DIR)
message(STATUS "FREETYPE found ${FREETYPE_DIR}" )
set(FREETYPE_FOUND "Yes")
@@ -175,7 +175,7 @@ MACRO(ANDROID_3RD_PARTY)
#GDAL
################################################
FIND_PATH(GDAL_DIR gdal.h
${CMAKE_SOURCE_DIR}/3rdparty/gdal/include
${CMAKE_SOURCE_DIR}/3rdparty/gdal/include NO_CMAKE_FIND_ROOT_PATH
)
set(GDAL_INCLUDE_DIR "${GDAL_DIR}")
if(GDAL_DIR)

View File

@@ -4,8 +4,8 @@
# full path of the library name. in order to differentiate release and debug, this macro get the
# 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
# The existence of a variable name with _DEBUG appended is tested and, in case it' s value is used
# for linking to when in debug mode
# the content of this library for linking when in debugging
#######################################################################################################
@@ -43,7 +43,11 @@ SET(VALID_BUILDER_VERSION OFF)
MACRO(LINK_WITH_VARIABLES TRGTNAME)
FOREACH(varname ${ARGN})
IF(${varname}_DEBUG)
TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${${varname}}" debug "${${varname}_DEBUG}")
IF(${varname}_RELEASE)
TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${${varname}_RELEASE}" debug "${${varname}_DEBUG}")
ELSE(${varname}_RELEASE)
TARGET_LINK_LIBRARIES(${TRGTNAME} optimized "${${varname}}" debug "${${varname}_DEBUG}")
ENDIF(${varname}_RELEASE)
ELSE(${varname}_DEBUG)
TARGET_LINK_LIBRARIES(${TRGTNAME} "${${varname}}" )
ENDIF(${varname}_DEBUG)
@@ -87,12 +91,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,20 +116,20 @@ 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})
FOREACH(LINKLIB ${TARGET_ADDED_LIBRARIES})
SET(TO_INSERT TRUE)
FOREACH (value ${TARGET_COMMON_LIBRARIES})
IF (${value} STREQUAL ${LINKLIB})
IF ("${value}" STREQUAL "${LINKLIB}")
SET(TO_INSERT FALSE)
ENDIF (${value} STREQUAL ${LINKLIB})
ENDIF ("${value}" STREQUAL "${LINKLIB}")
ENDFOREACH (value ${TARGET_COMMON_LIBRARIES})
IF(TO_INSERT)
LIST(APPEND TARGET_LIBRARIES ${LINKLIB})
@@ -151,7 +155,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)
@@ -212,9 +216,10 @@ ENDMACRO(SET_OUTPUT_DIR_PROPERTY_260 TARGET_TARGETNAME RELATIVE_OUTDIR)
##########################################################################################################
MACRO(SETUP_LIBRARY LIB_NAME)
IF(ANDROID)
SETUP_ANDROID_LIBRARY(${LIB_NAME})
ELSE()
IF(GLCORE_FOUND)
INCLUDE_DIRECTORIES( ${GLCORE_INCLUDE_DIR} )
ENDIF()
SET(TARGET_NAME ${LIB_NAME} )
SET(TARGET_TARGETNAME ${LIB_NAME} )
ADD_LIBRARY(${LIB_NAME}
@@ -224,10 +229,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,15 +246,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})
ELSE()
IF(GLCORE_FOUND)
INCLUDE_DIRECTORIES( ${GLCORE_INCLUDE_DIR} )
ENDIF()
SET(TARGET_NAME ${PLUGIN_NAME} )
@@ -268,38 +275,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,26 +315,31 @@ 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})
IF(MSVC AND DYNAMIC_OPENSCENEGRAPH)
INSTALL(FILES ${OUTPUT_BINDIR}/${OSG_PLUGINS}/${TARGET_TARGETNAME}${CMAKE_RELWITHDEBINFO_POSTFIX}.pdb DESTINATION bin/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT} CONFIGURATIONS RelWithDebInfo)
INSTALL(FILES ${OUTPUT_BINDIR}/${OSG_PLUGINS}/${TARGET_TARGETNAME}${CMAKE_DEBUG_POSTFIX}.pdb DESTINATION bin/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT} CONFIGURATIONS Debug)
ENDIF(MSVC AND DYNAMIC_OPENSCENEGRAPH)
ELSE(WIN32)
INSTALL(TARGETS ${TARGET_TARGETNAME}
RUNTIME DESTINATION bin COMPONENT ${PACKAGE_COMPONENT}
ARCHIVE DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} COMPONENT libopenscenegraph-dev
LIBRARY DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT})
ENDIF(WIN32)
ENDIF()
ENDMACRO(SETUP_PLUGIN)
@@ -342,6 +349,10 @@ ENDMACRO(SETUP_PLUGIN)
MACRO(SETUP_EXE IS_COMMANDLINE_APP)
#MESSAGE("in -->SETUP_EXE<-- ${TARGET_NAME}-->${TARGET_SRC} <--> ${TARGET_H}<--")
IF(GL3_FOUND)
INCLUDE_DIRECTORIES( ${GLCORE_INCLUDE_DIR} )
ENDIF()
IF(NOT TARGET_TARGETNAME)
SET(TARGET_TARGETNAME "${TARGET_DEFAULT_PREFIX}${TARGET_NAME}")
ENDIF(NOT TARGET_TARGETNAME)
@@ -350,11 +361,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 +374,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 +395,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 +409,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,15 +427,19 @@ 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)
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION bin COMPONENT openscenegraph )
IF(MSVC)
INSTALL(FILES ${CMAKE_BINARY_DIR}/bin/${TARGET_NAME}${CMAKE_RELWITHDEBINFO_POSTFIX}.pdb DESTINATION bin COMPONENT openscenegraph CONFIGURATIONS RelWithDebInfo)
INSTALL(FILES ${CMAKE_BINARY_DIR}/bin/${TARGET_NAME}${CMAKE_DEBUG_POSTFIX}.pdb DESTINATION bin COMPONENT openscenegraph CONFIGURATIONS Debug)
ENDIF(MSVC)
ENDIF(APPLE)
ENDMACRO(SETUP_APPLICATION)
@@ -439,15 +460,19 @@ 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 )
IF(MSVC)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_TARGETNAME}${CMAKE_RELWITHDEBINFO_POSTFIX}.pdb DESTINATION share/OpenSceneGraph/bin COMPONENT openscenegraph-examples CONFIGURATIONS RelWithDebInfo)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_TARGETNAME}${CMAKE_DEBUG_POSTFIX}.pdb DESTINATION share/OpenSceneGraph/bin COMPONENT openscenegraph-examples CONFIGURATIONS Debug)
ENDIF(MSVC)
ENDIF(APPLE)
ENDMACRO(SETUP_EXAMPLE)
@@ -483,7 +508,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 +541,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()

166649
ChangeLog

File diff suppressed because it is too large Load Diff

906
NEWS.txt

File diff suppressed because it is too large Load Diff

View File

@@ -4,7 +4,7 @@ APP_PROJECT_PATH := $(call my-dir)
APP_OPTIM := ${ANDROID_RELEASE_OPTIM}
APP_PLATFORM := ${ANDROID_PLATFORM}
APP_PLATFORM := android-${ANDROID_PLATFORM}
APP_STL := ${ANDROID_STL}
APP_CPPFLAGS := -fexceptions -frtti
#APP_CPPFLAGS := -Os -mthumb-interwork -fno-short-enums

File diff suppressed because it is too large Load Diff

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,65 +23,64 @@ more indepth instructions.
Robert Osfield.
Project Lead.
26th April 2013.
28th August 2017.
--
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
get the best performance from your final libraries/applications.
Under unices (i.e. Linux, IRIX, Solaris, Free-BSD, HP-Ux, AIX, OSX)
use the cmake or ccmake command-line utils. Note that cmake . defaults
to building Release to ensure that you get the best performance from
your final libraries/applications.
cd OpenSceneGraph
./configure
cmake .
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
cd build
cmake ../OpenSceneGraph -DCMAKE_BUILD_TYPE=Release
cmake ../OpenSceneGraph
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 +164,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
* Enable OSG_GLES1_AVAILABLE *OR* OSG_GLES2_AVAILABLE *OR* OSG_GLES3_AVAILABLE (GLES3 will enable GLES2 features)
* 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 +201,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

@@ -1,9 +1,9 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This application is open source and may be redistributed and/or modified
* 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.
@@ -26,12 +26,12 @@ 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 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.
if (arguments.read("-h") || arguments.read("--help"))
{
@@ -49,14 +49,14 @@ int main( int argc, char **argv )
{
insert = true;
}
bool extract = false;
while (arguments.read("-e") || arguments.read("--extract"))
{
extract = true;
}
bool list = false;
bool list = false;
while (arguments.read("-l") || arguments.read("--list"))
{
list = true;
@@ -93,7 +93,7 @@ int main( int argc, char **argv )
}
}
}
// any option left unread are converted into errors to write out later.
arguments.reportRemainingOptionsAsUnrecognized();
@@ -103,7 +103,7 @@ int main( int argc, char **argv )
arguments.writeErrorMessages(std::cout);
return 1;
}
if (archiveFilename.empty())
{
std::cout<<"Please specify an archive name using --archive filename"<<std::endl;
@@ -115,7 +115,7 @@ int main( int argc, char **argv )
std::cout<<"Please specify an operation on the archive, either --insert, --extract or --list"<<std::endl;
return 1;
}
if (insert && extract)
{
std::cout<<"Cannot insert and extract files from the archive at one time, please use either --insert or --extract."<<std::endl;
@@ -127,7 +127,7 @@ int main( int argc, char **argv )
if (insert)
{
archive = osgDB::openArchive(archiveFilename, osgDB::Archive::WRITE);
if (archive.valid())
{
for (FileNameList::iterator itr=files.begin();
@@ -135,7 +135,7 @@ int main( int argc, char **argv )
++itr)
{
std::cout<<"reading "<<*itr<<std::endl;
osg::ref_ptr<osg::Object> obj = osgDB::readObjectFile(*itr);
osg::ref_ptr<osg::Object> obj = osgDB::readRefObjectFile(*itr);
if (obj.valid())
{
std::cout<<" write to archive "<<*itr<<std::endl;
@@ -152,10 +152,10 @@ int main( int argc, char **argv )
}
}
}
else
else
{
archive = osgDB::openArchive(archiveFilename, osgDB::Archive::READ);
if (extract && archive.valid())
{
for (FileNameList::iterator itr=files.begin();
@@ -175,7 +175,7 @@ int main( int argc, char **argv )
}
if (list && archive.valid())
{
{
std::cout<<"List of files in archive:"<<std::endl;
osgDB::Archive::FileNameList fileNames;
if (archive->getFileNames(fileNames))
@@ -187,11 +187,11 @@ int main( int argc, char **argv )
std::cout<<" "<<*itr<<std::endl;
}
}
std::cout<<std::endl;
std::cout<<"Master file "<<archive->getMasterFileName()<<std::endl;
}
return 0;
}

View File

@@ -157,6 +157,7 @@ public:
}
osg::ref_ptr<osg::State> state = new osg::State;
state->initializeExtensionProcs();
for(TextureSet::iterator itr=_textureSet.begin();
itr!=_textureSet.end();
@@ -174,7 +175,7 @@ public:
{
texture->setInternalFormatMode(_internalFormatMode);
// need to disable the unref after apply, other the image could go out of scope.
// need to disable the unref after apply, otherwise the image could go out of scope.
bool unrefImageDataAfterApply = texture->getUnRefImageDataAfterApply();
texture->setUnRefImageDataAfterApply(false);
@@ -373,16 +374,6 @@ public:
++_numStateSetRemoved;
}
for(unsigned int i=0;i<node.getNumDrawables();++i)
{
osg::Drawable* drawable = node.getDrawable(i);
if (drawable && drawable->getStateSet())
{
drawable->setStateSet(0);
++_numStateSetRemoved;
}
}
traverse(node);
}
@@ -557,6 +548,7 @@ 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;
@@ -780,7 +772,7 @@ int main( int argc, char **argv )
osg::Timer_t startTick = osg::Timer::instance()->tick();
osg::ref_ptr<osg::Node> root = osgDB::readNodeFiles(fileNames);
osg::ref_ptr<osg::Node> root = osgDB::readRefNodeFiles(fileNames);
if (root.valid())
{
@@ -816,7 +808,7 @@ int main( int argc, char **argv )
root->accept(av);
}
// optimize the scene graph, remove rendundent nodes and state etc.
// optimize the scene graph, remove redundant nodes and state etc.
osgUtil::Optimizer optimizer;
optimizer.optimize(root.get());

View File

@@ -1,9 +1,9 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This application is open source and may be redistributed and/or modified
* 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.
@@ -46,20 +46,20 @@ struct Extents
_maxLevel(maxLevel),
_min(minX, minY),
_max(maxX, maxY) {}
Extents(const Extents& extents):
_maxLevel(extents._maxLevel),
_min(extents._min),
_max(extents._max) {}
Extents& operator = (const Extents& rhs)
{
if (&rhs == this) return *this;
_maxLevel = rhs._maxLevel;
_min = rhs._min;
_max = rhs._max;
return *this;
}
@@ -69,10 +69,10 @@ struct Extents
osg::notify(osg::INFO)<<" _maxLevel="<<_maxLevel<<", _min="<<_min<<" _max="<<_max<<std::endl;
if (level>_maxLevel) return false;
osg::Vec2d union_min, union_max;
// handle mins
// handle mins
if (_min.x()!=DBL_MAX && in_min.x()!=DBL_MAX)
{
// both _min.x() and in_min.x() are defined so use max of two
@@ -95,7 +95,7 @@ struct Extents
union_min.y() = _min.y()<in_min.y() ? _min.y() : in_min.y();
}
// handle maxs
// handle maxs
if (_max.x()!=-DBL_MAX && in_max.x()!=-DBL_MAX)
{
// both _max.x() and in_max.x() are defined so use max of two
@@ -121,7 +121,7 @@ struct Extents
bool result = union_min.x()<union_max.x() && union_min.y()<union_max.y() ;
osg::notify(osg::INFO)<<" union_min="<<union_min<<" union_max="<<union_max<<" result = "<<result<<std::endl;
return result;
}
@@ -140,7 +140,7 @@ public:
_currentLevel(0) {}
void setFileCache(osgDB::FileCache* fileCache) { _fileCache = fileCache; }
void addExtents(unsigned int maxLevel, double minX, double minY, double maxX, double maxY)
{
_extentsList.push_back(Extents(maxLevel, minX, minY, maxX, maxY));
@@ -154,16 +154,16 @@ public:
void apply(osg::CoordinateSystemNode& cs)
{
_csnStack.push_back(&cs);
if (!s_ExitApplication) traverse(cs);
_csnStack.pop_back();
}
void apply(osg::Group& group)
{
if (s_ExitApplication) return;
osgTerrain::TerrainTile* terrainTile = dynamic_cast<osgTerrain::TerrainTile*>(&group);
osgTerrain::Locator* locator = terrainTile ? terrainTile->getLocator() : 0;
if (locator)
@@ -196,7 +196,7 @@ public:
return;
}
traverse(group);
}
@@ -217,11 +217,11 @@ public:
void apply(osg::PagedLOD& plod)
{
if (s_ExitApplication) return;
++_currentLevel;
initBound();
// first compute the bounds of this subgraph
for(unsigned int i=0; i<plod.getNumFileNames(); ++i)
{
@@ -230,7 +230,7 @@ public:
traverse(plod);
}
}
if (intersects())
{
for(unsigned int i=0; i<plod.getNumFileNames(); ++i)
@@ -239,7 +239,7 @@ public:
if (!plod.getFileName(i).empty())
{
std::string filename;
if (!plod.getDatabasePath().empty())
if (!plod.getDatabasePath().empty())
{
filename = plod.getDatabasePath() + plod.getFileName(i);
}
@@ -255,10 +255,10 @@ public:
}
}
}
--_currentLevel;
}
void apply(osg::Geode& geode)
{
for(unsigned int i=0; i<geode.getNumDrawables(); ++i)
@@ -271,10 +271,10 @@ public:
}
}
}
osg::Node* readNodeFileAndWriteToCache(const std::string& filename)
osg::ref_ptr<osg::Node> readNodeFileAndWriteToCache(const std::string& filename)
{
osg::Node* node = 0;
osg::ref_ptr<osg::Node> node = 0;
if (_fileCache.valid() )
{
if (_fileCache->existsInCache(filename))
@@ -286,7 +286,7 @@ public:
{
osg::notify(osg::NOTICE)<<"reading : "<<filename<<std::endl;
node = osgDB::readNodeFile(filename);
node = osgDB::readRefNodeFile(filename);
if (node)
{
osg::notify(osg::NOTICE)<<"write to FileCache : "<<filename<<std::endl;
@@ -298,7 +298,7 @@ public:
else
{
osg::notify(osg::NOTICE)<<"reading : "<<filename<<std::endl;
node = osgDB::readNodeFile(filename);
node = osgDB::readRefNodeFile(filename);
}
return node;
}
@@ -307,18 +307,18 @@ public:
protected:
inline void pushMatrix(osg::Matrix& matrix) { _matrixStack.push_back(matrix); }
inline void popMatrix() { _matrixStack.pop_back(); }
void convertXYZToLatLongHeight(osg::EllipsoidModel* em, osg::Vec3d& v)
{
em->convertXYZToLatLongHeight(v.x(), v.y(), v.z(),
v.y(), v.x(), v.z());
v.x() = osg::RadiansToDegrees(v.x());
v.y() = osg::RadiansToDegrees(v.y());
}
void initBound()
{
_min.set(DBL_MAX, DBL_MAX);
@@ -332,16 +332,16 @@ protected:
if (v.x() > _max.x()) _max.x() = v.x();
if (v.y() > _max.y()) _max.y() = v.y();
}
void updateBound(osg::Vec3Array& vertices)
{
// set up matrix
osg::Matrix matrix;
if (!_matrixStack.empty()) matrix = _matrixStack.back();
// set up ellipsoid model
osg::EllipsoidModel* em = !_csnStack.empty() ? _csnStack.back()->getEllipsoidModel() : 0;
for(osg::Vec3Array::iterator itr = vertices.begin();
itr != vertices.end();
++itr)
@@ -352,7 +352,7 @@ protected:
updateBound(v);
}
}
bool intersects()
{
osg::notify(osg::INFO)<<"intersects() _min = "<<_min<<" _max = "<<_max<<std::endl;
@@ -362,7 +362,7 @@ protected:
{
if (itr->intersects(_currentLevel, _min, _max)) return true;
}
return false;
}
@@ -376,7 +376,7 @@ protected:
unsigned int _currentLevel;
MatrixStack _matrixStack;
CSNStack _csnStack;
osg::Vec2d _min;
osg::Vec2d _max;
};
@@ -403,7 +403,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 an application for collecting a set of separate files into a single archive file that can be later read in OSG applications..");
@@ -412,21 +412,21 @@ int main( int argc, char **argv )
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.");
arguments.getApplicationUsage()->addCommandLineOption("-c directory","Shorthand for --file-cache directory.");
arguments.getApplicationUsage()->addCommandLineOption("--file-cache directory","Set directory as to place cache download files.");
// if user request help write it out to cout.
if (arguments.read("-h") || arguments.read("--help"))
{
arguments.getApplicationUsage()->write(std::cout);
return 1;
}
LoadDataVisitor ldv;
std::string fileCachePath;
while(arguments.read("--file-cache",fileCachePath) || arguments.read("-c",fileCachePath)) {}
if (fileCachePath.empty())
{
{
const char* env_fileCachePath = getenv("OSG_FILE_CACHE");
if (env_fileCachePath)
{
@@ -439,7 +439,7 @@ int main( int argc, char **argv )
std::cout<<"No path to the file cache defined, please set OSG_FILE_PATH env var, or use --file-cache <directory> to set a suitable directory for the file cache."<<std::endl;
return 1;
}
ldv.setFileCache(new osgDB::FileCache(fileCachePath));
unsigned int maxLevels = 0;
@@ -447,14 +447,14 @@ int main( int argc, char **argv )
{
ldv.addExtents(maxLevels);
}
double minX, maxX, minY, maxY;
while(arguments.read("-e",maxLevels, minX, minY, maxX, maxY))
{
ldv.addExtents(maxLevels, minX, minY, maxX, maxY);
}
std::string filename;
for(int i=1; i<arguments.argc(); ++i)
{
@@ -464,21 +464,21 @@ int main( int argc, char **argv )
break;
}
}
if (filename.empty())
if (filename.empty())
{
std::cout<<"No file to load specified."<<std::endl;
return 1;
}
osg::ref_ptr<osg::Node> loadedModel = ldv.readNodeFileAndWriteToCache(filename);
if (!loadedModel)
{
std::cout<<"No data loaded, please specify a database to load"<<std::endl;
return 1;
}
loadedModel->accept(ldv);
if (s_ExitApplication)

View File

@@ -254,7 +254,28 @@ const char* invalidNames[] =
"GraphicsContext*",
"Apple",
"GeometryNew",
"FrameBufferObject"
"FrameBufferObject",
"Lua",
"VolumeTile",
"PushStackValueVisitor",
"RayIntersector",
"OpenSceneGraph-Data",
"Node",
"AlphaFunc",
"CompositeViewer",
"OpenSceneGraph-3",
"DisplaySettings::SHADER_NONE",
"CodeDocs",
"Mon",
"Tue",
"Wed",
"Fri",
"Sat",
"Sun",
"I",
"TriangleFunctor",
"PrimitiveFunctor",
"OpenMW"
};
@@ -347,6 +368,7 @@ TypoCorrection typoCorrections[] =
{"Krulthof", "Kruithof"},
{"Lagrade", "Lagarde"},
{"Largade", "Lagarde"},
{"Largarde", "Lagarde"},
{"Larshkari", "Lashkari"},
{"Lashakari", "Lashkari"},
{"Lashari", "Lashkari"},
@@ -454,7 +476,31 @@ TypoCorrection typoCorrections[] =
{"Eskland","Ekstrand"},
{"Baeuerele","Baeuerle"},
{"Bauerle","Baeuerle"},
{"Baeurele","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>"},
{"Vigano", "Vigan<EFBFBD>"},
{"Frashud", "Farshid"},
{"Dannahauer","Dannahauer"},
{"Sando","Sandro"}
};
@@ -468,6 +514,16 @@ struct NameCorrection
NameCorrection nameCorrections[] =
{
{"LaurensVoerman","Meta_Shape",
"Laurens", "Voerman"},
{"LaurensVoerman","OpenCascade",
"Laurens", "Voerman"},
{"LaurensVoerman","Fri",
"Laurens", "Voerman"},
{"LaurensVoerman","",
"Laurens", "Voerman"},
{"Laurens","Loerman",
"Laurens", "Voerman"},
{"FrancoisTigeot","",
"Francois", "Tigeot"},
{"Juan","Manuel",
@@ -562,6 +618,8 @@ NameCorrection nameCorrections[] =
"Melchior", "Franz"},
{"Glen", "Waldon",
"Glenn", "Waldron"},
{"Glen", "Waldron",
"Glenn", "Waldron"},
{"Ralf", "Karn",
"Ralf", "Kern"},
{"Donny", "Cipperly",
@@ -594,6 +652,8 @@ 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",
@@ -619,7 +679,27 @@ NameCorrection nameCorrections[] =
{"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"},
{"Albert", "Luaces",
"Alberto","Luaces"},
{"KOS", "",
"Konstantin","Matveyev"},
{"WeSee", "",
"Alois", "Wismer"},
{"We", "See",
"Alois", "Wismer"}
};
@@ -951,7 +1031,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
@@ -960,7 +1042,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

@@ -1,5 +1,5 @@
// The majority of the application is dedicated to building the
// current contribitors list by parsing the ChangeLog, it just takes
// current contributors list by parsing the ChangeLog, it just takes
// one line in the main itself to report the version number.
#include <set>

View File

@@ -14,6 +14,7 @@
#include <osg/CoordinateSystemNode>
#include <osg/Switch>
#include <osg/Types>
#include <osgText/Text>
#include <osgViewer/Viewer>
@@ -32,111 +33,6 @@
#include <iostream>
#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)
{
@@ -187,14 +83,14 @@ 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);
osg::ref_ptr<osgGA::Device> dev = osgDB::readRefFile<osgGA::Device>(device);
if (dev.valid())
{
viewer.addDevice(dev.get());
viewer.addDevice(dev);
}
}
@@ -231,8 +127,6 @@ 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()) );
@@ -258,7 +152,7 @@ int main(int argc, char** argv)
viewer.addEventHandler(new osgViewer::ScreenCaptureHandler);
// load the data
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles(arguments);
if (!loadedModel)
{
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
@@ -278,24 +172,12 @@ int main(int argc, char** argv)
// optimize the scene graph, remove redundant nodes and state etc.
osgUtil::Optimizer optimizer;
optimizer.optimize(loadedModel.get());
optimizer.optimize(loadedModel);
viewer.setSceneData( loadedModel.get() );
viewer.setSceneData(loadedModel);
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

@@ -54,7 +54,7 @@ IF (NOT DYNAMIC_OPENSCENEGRAPH)
osgdb_openflight
osgdb_obj
)
SET(TARGET_ADDED_LIBRARIES ${TARGET_ADDED_LIBRARIES}
osgdb_deprecated_osg osgdb_deprecated_osgparticle osgdb_deprecated_osganimation
osgdb_deprecated_osgfx osgdb_deprecated_osgsim osgdb_deprecated_osgtext

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,17 @@
#if defined(__linux)
#include <unistd.h>
#include <linux/sockios.h>
#elif defined(__FreeBSD__) || defined(__DragonFly__)
#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
#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 (__GNU__)
#include <unistd.h>
#elif defined(__sun)
#include <unistd.h>
#include <sys/sockio.h>
#elif defined (__APPLE__)
@@ -202,7 +204,8 @@ void DataConverter::write(CameraPacket& cameraPacket)
itr != cameraPacket._events.end();
++itr)
{
write(*(*itr));
osgGA::GUIEventAdapter* event = (*itr)->asGUIEventAdapter();
if (event) write(*(event));
}
}
@@ -249,7 +252,7 @@ void CameraPacket::writeEventQueue(osgViewer::Viewer& viewer)
//////////////////////////////////////////////////////////////////////////////
//
// Reciever
// Receiver
//
Receiver::Receiver( void )
{
@@ -337,8 +340,8 @@ void Receiver::sync( void )
}
#if defined(__linux) || defined(__FreeBSD__) || defined( __APPLE__ ) || \
defined(__DragonFly__)
socklen_t
defined(__DragonFly__) || defined(__FreeBSD_kernel__) || defined(__GNU__)
socklen_t
#else
int
#endif
@@ -381,7 +384,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,25 +29,25 @@
//
// Class definition for the recipient of a broadcasted message
//
class Receiver
class Receiver
{
public :
Receiver();
~Receiver();
Receiver();
~Receiver();
// setBuffer defines the buffer into which the broadcasted
// message will be received.
void setBuffer( void *buffer, const unsigned int size );
// setBuffer defines the buffer into which the broadcasted
// message will be received.
void setBuffer( void *buffer, const unsigned int size );
// Define what port to listen and bind to
void setPort( const short port );
// Define what port to listen and bind to
void setPort( const short port );
// Sync does a blocking wait to recieve next message
void sync( void );
// Sync does a blocking wait to recieve next message
void sync( void );
private :
bool init( void );
bool init( void );
private :
#if defined (WIN32) && !defined(__CYGWIN__)
@@ -68,29 +68,29 @@ class Receiver
//
// Class definition for broadcasting a buffer to a LAN
//
class Broadcaster
class Broadcaster
{
public :
Broadcaster( void );
~Broadcaster( void );
Broadcaster( void );
~Broadcaster( void );
// Set the broadcast port
void setPort( const short port );
// Set the broadcast port
void setPort( const short port );
// Set the buffer to be broadcast
void setBuffer( void *buffer, const unsigned int buffer_size );
// Set the buffer to be broadcast
void setBuffer( void *buffer, const unsigned int buffer_size );
// 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 );
// 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 );
// Sync broadcasts the buffer
void sync( void );
// Sync broadcasts the buffer
void sync( void );
private :
bool init( void );
bool init( void );
private :
#if defined(WIN32) && !defined(__CYGWIN__)
@@ -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

@@ -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.
*/
@@ -46,16 +46,16 @@ public:
void setSnapImageOnNextFrame(bool flag) { _snapImageOnNextFrame = flag; }
bool getSnapImageOnNextFrame() const { return _snapImageOnNextFrame; }
virtual void operator () (const osg::Camera& camera) const
{
if (!_snapImageOnNextFrame) return;
int x = static_cast<int>(camera.getViewport()->x());
int y = static_cast<int>(camera.getViewport()->y());
unsigned int width = static_cast<unsigned int>(camera.getViewport()->width());
unsigned int height = static_cast<unsigned int>(camera.getViewport()->height());
osg::ref_ptr<osg::Image> image = new osg::Image;
image->readPixels(x,y,width,height,
GL_RGB,GL_UNSIGNED_BYTE);
@@ -64,16 +64,16 @@ public:
{
osg::notify(osg::NOTICE) << "Saved screen image to `"<<_filename<<"`"<< std::endl;
}
_snapImageOnNextFrame = false;
}
protected:
std::string _filename;
mutable bool _snapImageOnNextFrame;
};
std::string ExportHTML::createFileName(const std::string& basename, unsigned int page, const std::string& ext)
@@ -102,7 +102,7 @@ bool ExportHTML::write(osgPresentation::SlideEventHandler* seh, osgViewer::Viewe
image_basename = osgDB::getNameLessExtension(filename);
image_ext = ".jpg";
}
std::cout<<"Writing slides to "<<image_basename<<"_[slidenumber]"<<image_ext<<std::endl;
osg::ref_ptr<SnapImageDrawCallback> sidc = new SnapImageDrawCallback;
@@ -169,7 +169,7 @@ bool ExportHTML::write(osgPresentation::SlideEventHandler* seh, osgViewer::Viewe
}
fout<<"</tr>"<<std::endl;
fout<<"</table>"<<std::endl;
fout<<"<img src=\""<<osgDB::getSimpleFileName(os.str())<<"\">"<<std::endl;
fout<<"<img src=\""<<osgDB::getSimpleFileName(os.str())<<"\">"<<std::endl;
fout<<"</html>"<<std::endl;
}
else

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.
*/

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.
*/
@@ -54,11 +54,6 @@ bool PointsEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActio
return false;
}
void PointsEventHandler::accept(osgGA::GUIEventHandlerVisitor& v)
{
v.visit(*this);
}
void PointsEventHandler::getUsage(osg::ApplicationUsage& usage) const
{
usage.addKeyboardMouseBinding("+","Increase point size");

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.
*/
@@ -22,25 +22,23 @@ class PointsEventHandler : public osgGA::GUIEventHandler
{
public:
PointsEventHandler();
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&);
virtual void accept(osgGA::GUIEventHandlerVisitor& v);
void getUsage(osg::ApplicationUsage& usage) const;
void setStateSet(osg::StateSet* stateset) { _stateset=stateset; }
osg::StateSet* getStateSet() { return _stateset.get(); }
const osg::StateSet* getStateSet() const { return _stateset.get(); }
void setPointSize(float psize);
float getPointSize() const;
void changePointSize(float delta);
void changePointAttenuation(float scale);
osg::ref_ptr<osg::StateSet> _stateset;

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.
*/
@@ -35,7 +35,7 @@ class AddVolumeEditingCallbackVisitor : public osg::NodeVisitor
public:
AddVolumeEditingCallbackVisitor():
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}
void apply(osg::Group& group)
{
osgVolume::VolumeTile* volumeTile = dynamic_cast<osgVolume::VolumeTile*>(&group);
@@ -51,7 +51,7 @@ public:
traverse(group);
}
}
};
bool p3d::getFileNames(osg::ArgumentParser& arguments, FileNameList& xmlFiles, FileNameList& normalFiles)
@@ -62,7 +62,7 @@ bool p3d::getFileNames(osg::ArgumentParser& arguments, FileNameList& xmlFiles, F
if (!arguments.isOption(pos))
{
std::string ext = osgDB::getFileExtension(arguments[pos]);
if (osgDB::equalCaseInsensitive(ext,"xml") || osgDB::equalCaseInsensitive(ext,"p3d"))
if (osgDB::equalCaseInsensitive(ext,"xml") || osgDB::equalCaseInsensitive(ext,"p3d"))
{
xmlFiles.push_back(arguments[pos]);
}
@@ -73,7 +73,7 @@ bool p3d::getFileNames(osg::ArgumentParser& arguments, FileNameList& xmlFiles, F
}
}
return (!xmlFiles.empty() || !normalFiles.empty());
}
}
bool p3d::readEnvVars(osg::ArgumentParser& arguments)
{
@@ -94,23 +94,23 @@ bool p3d::readEnvVars(osg::ArgumentParser& arguments)
{
osgDB::getDataFilePathList().push_front(path);
}
if (p3d::readEnvVars(file)) readVars = true;
}
}
}
}
return readVars;
}
bool p3d::readEnvVars(const std::string& fileName)
{
std::string ext = osgDB::getFileExtension(fileName);
if (!osgDB::equalCaseInsensitive(ext,"xml") &&
if (!osgDB::equalCaseInsensitive(ext,"xml") &&
!osgDB::equalCaseInsensitive(ext,"p3d")) return false;
osg::ref_ptr<osgDB::XmlNode> doc = new osgDB::XmlNode;
osgDB::XmlNode* root = 0;
@@ -146,7 +146,7 @@ bool p3d::readEnvVars(const std::string& fileName)
}
bool readVars = false;
for(osgDB::XmlNode::Children::iterator itr = root->children.begin();
itr != root->children.end();
++itr)
@@ -182,7 +182,7 @@ osgDB::Options* createOptions(const osgDB::ReaderWriter::Options* options)
osg::ref_ptr<osg::Node> p3d::readHoldingSlide(const std::string& filename)
{
std::string ext = osgDB::getFileExtension(filename);
if (!osgDB::equalCaseInsensitive(ext,"xml") &&
if (!osgDB::equalCaseInsensitive(ext,"xml") &&
!osgDB::equalCaseInsensitive(ext,"p3d")) return 0;
osg::ref_ptr<osgDB::ReaderWriter::Options> options = createOptions(0);
@@ -215,24 +215,24 @@ osg::ref_ptr<osg::Node> p3d::readShowFiles(osg::ArgumentParser& arguments,const
std::string filename;
while (arguments.read("--image",filename))
{
osg::ref_ptr<osg::Image> image = readImageFile(filename.c_str(), local_options.get());
if (image.valid()) nodeList.push_back(osg::createGeodeForImage(image.get()));
osg::ref_ptr<osg::Image> image = readRefImageFile(filename.c_str(), local_options.get());
if (image.valid()) nodeList.push_back(osg::createGeodeForImage(image));
}
while (arguments.read("--movie",filename))
{
osg::ref_ptr<osg::Image> image = readImageFile(filename.c_str(), local_options.get());
osg::ref_ptr<osg::Image> image = readRefImageFile(filename.c_str(), local_options.get());
osg::ref_ptr<osg::ImageStream> imageStream = dynamic_cast<osg::ImageStream*>(image.get());
if (image.valid())
{
imageStream->play();
nodeList.push_back(osg::createGeodeForImage(imageStream.get()));
nodeList.push_back(osg::createGeodeForImage(imageStream));
}
}
while (arguments.read("--dem",filename))
{
osg::HeightField* hf = readHeightFieldFile(filename.c_str(), local_options.get());
osg::ref_ptr<osg::HeightField> hf = readRefHeightFieldFile(filename.c_str(), local_options.get());
if (hf)
{
osg::Geode* geode = new osg::Geode;
@@ -247,7 +247,7 @@ osg::ref_ptr<osg::Node> p3d::readShowFiles(osg::ArgumentParser& arguments,const
if (!arguments.isOption(pos))
{
// not an option so assume string is a filename.
osg::Node *node = osgDB::readNodeFile( arguments[pos], local_options.get());
osg::ref_ptr<osg::Node> node = osgDB::readRefNodeFile( arguments[pos], local_options.get());
if(node)
{
@@ -260,12 +260,12 @@ osg::ref_ptr<osg::Node> p3d::readShowFiles(osg::ArgumentParser& arguments,const
}
}
}
if (nodeList.empty())
{
return NULL;
}
osg::ref_ptr<osg::Node> root;
if (nodeList.size()==1)
@@ -274,7 +274,7 @@ osg::ref_ptr<osg::Node> p3d::readShowFiles(osg::ArgumentParser& arguments,const
}
else // size >1
{
osg::Switch* sw = new osg::Switch;
for(NodeList::iterator itr=nodeList.begin();
itr!=nodeList.end();
@@ -283,7 +283,7 @@ osg::ref_ptr<osg::Node> p3d::readShowFiles(osg::ArgumentParser& arguments,const
sw->addChild((*itr).get());
}
sw->setSingleChildOn(0);
sw->setEventCallback(new p3d::ShowEventHandler());
root = sw;
@@ -292,7 +292,7 @@ osg::ref_ptr<osg::Node> p3d::readShowFiles(osg::ArgumentParser& arguments,const
if (root.valid())
{
osg::notify(osg::INFO)<<"Got node now adding callback"<<std::endl;
AddVolumeEditingCallbackVisitor avecv;
root->accept(avecv);
}

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,13 +28,13 @@ bool ShowEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
case(osgGA::GUIEventAdapter::KEYUP):
{
osg::notify(osg::INFO)<<"ShowEventHandler KEYUP "<<(int)ea.getKey()<<std::endl;
if (ea.getKey()>=osgGA::GUIEventAdapter::KEY_F1 &&
if (ea.getKey()>=osgGA::GUIEventAdapter::KEY_F1 &&
ea.getKey()<=osgGA::GUIEventAdapter::KEY_F8)
{
unsigned int child = ea.getKey()-osgGA::GUIEventAdapter::KEY_F1;
osg::notify(osg::INFO)<<" Select "<<child<<std::endl;
osg::Switch* showSwitch = dynamic_cast<osg::Switch*>(object);
if (showSwitch)
if (showSwitch)
{
if (child<showSwitch->getNumChildren())
{
@@ -52,12 +52,6 @@ bool ShowEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
return false;
}
void ShowEventHandler::accept(osgGA::GUIEventHandlerVisitor& v)
{
v.visit(*this);
}
void ShowEventHandler::getUsage(osg::ApplicationUsage& /*usage*/) const
{
}

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,11 +28,9 @@ class ShowEventHandler : public osgGA::GUIEventHandler
ShowEventHandler();
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object* object, osg::NodeVisitor* nv);
virtual void accept(osgGA::GUIEventHandlerVisitor& v);
virtual void getUsage(osg::ApplicationUsage& usage) const;
};
}

View File

@@ -1,17 +1,16 @@
/* -*-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.
*/
#include <osg/Geometry>
#include <osg/CameraNode>
#include <osg/Texture2D>
#include <osg/AutoTransform>
#include <osg/Notify>
@@ -37,9 +36,10 @@
#include <osgGA/TerrainManipulator>
#include <osgGA/AnimationPathManipulator>
#include <osgGA/StateSetManipulator>
#include <osgGA/MultiTouchTrackballManipulator>
#include <osgPresentation/SlideEventHandler>
#include <osgPresentation/SlideShowConstructor>
#include <osgPresentation/Cursor>
#include "ReadShowFile.h"
#include "PointsEventHandler.h"
@@ -51,6 +51,7 @@
#include <fstream>
#include <iostream>
#include <string.h>
#ifdef USE_SDL
@@ -129,148 +130,103 @@ void setViewer(osgViewer::Viewer& viewer, float width, float height, float dista
viewer.getCamera()->setProjectionMatrixAsPerspective( vfov, width/height, 0.1, 1000.0);
OSG_NOTICE<<"setProjectionMatrixAsPerspective( "<<vfov<<", "<<width/height<<", "<<0.1<<", "<<1000.0<<");"<<std::endl;
OSG_INFO<<"setProjectionMatrixAsPerspective( "<<vfov<<", "<<width/height<<", "<<0.1<<", "<<1000.0<<");"<<std::endl;
}
class ForwardToDeviceEventHandler : public osgGA::GUIEventHandler {
public:
ForwardToDeviceEventHandler(osgGA::Device* device) : osgGA::GUIEventHandler(), _device(device) {}
ForwardToDeviceEventHandler(osgGA::Device* device, bool format_mouse_events) : osgGA::GUIEventHandler(), _device(device), _forwardMouseEvents(format_mouse_events) {}
virtual bool handle (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa, osg::Object *, osg::NodeVisitor *)
{
OSG_INFO<<"ForwardToDeviceEventHandler::setEvent("<<ea.getKey()<<")"<<std::endl;
_device->sendEvent(ea);
switch (ea.getEventType())
{
case osgGA::GUIEventAdapter::PUSH:
case osgGA::GUIEventAdapter::RELEASE:
case osgGA::GUIEventAdapter::MOVE:
case osgGA::GUIEventAdapter::DRAG:
case osgGA::GUIEventAdapter::SCROLL:
if (_forwardMouseEvents)
_device->sendEvent(ea);
break;
default:
_device->sendEvent(ea);
break;
}
return false;
}
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)
bool handle(osgGA::Event* event, osg::Object* object, osg::NodeVisitor* nv)
{
if (event->asGUIEventAdapter())
return osgGA::GUIEventHandler::handle(event, object, nv);
else
{
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):
{
osgViewer::View* view = dynamic_cast<osgViewer::View*>(&aa);
osg::Camera* camera = view->getCamera();
osg::Matrix VP = camera->getViewMatrix() * camera->getProjectionMatrix();
osg::Matrix inverse_VP;
inverse_VP.invert(VP);
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(level)<<"start_world="<<start_world<<std::endl;
osg::notify(level)<<"end_world="<<end_world<<std::endl;
if (end_world.valid()) transform->setPosition(end_world);
else
{
OSG_NOTICE<<"Ignoring invalid end_world position"<<std::endl;
}
break;
}
case(osgGA::GUIEventAdapter::KEYDOWN):
{
if (ea.getKey()=='c')
{
for(unsigned int i=0; i< transform->getNumChildren(); ++i)
{
osg::Node* node = transform->getChild(i);
node->setNodeMask(
node->getNodeMask()!=0 ?
0 :
0xffffff);
}
}
break;
}
default:
break;
}
_device->sendEvent(*event);
return false;
}
virtual void accept(osgGA::GUIEventHandlerVisitor& v)
{
v.visit(*this);
}
osg::Vec2d _mousePostition;
};
osg::Node* createCursorSubgraph(const std::string& filename, float size)
{
osg::Geode* geode = new osg::Geode;
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|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");
}
geode->addDrawable(geom);
osg::AutoTransform* transform = new osg::AutoTransform;
transform->setAutoRotateMode(osg::AutoTransform::ROTATE_TO_CAMERA);
transform->setAutoScaleToScreen(true);
private:
osg::ref_ptr<osgGA::Device> _device;
bool _forwardMouseEvents;
};
transform->addChild(geode);
transform->setEventCallback(new FollowMouseCallback());
class DumpEventHandler : public osgGA::GUIEventHandler {
public:
DumpEventHandler() : osgGA::GUIEventHandler() {}
return transform;
virtual bool handle (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa, osg::Object *, osg::NodeVisitor *)
{
switch (ea.getEventType())
{
case osgGA::GUIEventAdapter::FRAME:
return false;
break;
case osgGA::GUIEventAdapter::PUSH:
std::cout << "PUSH: ";
break;
case osgGA::GUIEventAdapter::RELEASE:
std::cout << "RELEASE: ";
break;
case osgGA::GUIEventAdapter::MOVE:
std::cout << "MOVE: ";
break;
case osgGA::GUIEventAdapter::DRAG:
std::cout << "DRAG: ";
break;
case osgGA::GUIEventAdapter::SCROLL:
std::cout << "SCROLL: ";
break;
break;
default:
std::cout << ea.getEventType() << " ";
break;
}
std::cout << ea.getX() << "/" << ea.getY() << " " << ea.isMultiTouchEvent() << std::endl;
return false;
}
bool handle(osgGA::Event* event, osg::Object* object, osg::NodeVisitor* nv)
{
if (event->asGUIEventAdapter())
return osgGA::GUIEventHandler::handle(event, object, nv);
else
{
return false;
}
}
private:
};
}
enum P3DApplicationType
@@ -284,7 +240,7 @@ 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.
@@ -292,7 +248,7 @@ void processLoadedModel(osg::ref_ptr<osg::Node>& loadedModel, int optimizer_opti
loadedModel->getOrCreateStateSet()->setMode(GL_ALPHA_TEST, osg::StateAttribute::ON);
#endif
// optimize the scene graph, remove rendundent nodes and state etc.
// optimize the scene graph, remove redundant nodes and state etc.
osgUtil::Optimizer optimizer;
optimizer.optimize(loadedModel.get(), optimizer_options);
@@ -300,21 +256,24 @@ void processLoadedModel(osg::ref_ptr<osg::Node>& loadedModel, int optimizer_opti
{
osg::ref_ptr<osg::Group> group = new osg::Group;
group->addChild(loadedModel.get());
group->addChild(createCursorSubgraph(cursorFileName, 0.05f));
OSG_NOTICE<<"Creating Cursor"<<std::endl;
group->addChild(new osgPresentation::Cursor(cursorFileName, 20.0f));
loadedModel = group;
}
}
void addDeviceTo(osgViewer::Viewer& viewer, const std::string& device_name)
void addDeviceTo(osgViewer::Viewer& viewer, const std::string& device_name, bool forward_mouse_events)
{
osg::ref_ptr<osgGA::Device> dev = osgDB::readFile<osgGA::Device>(device_name);
osg::ref_ptr<osgGA::Device> dev = osgDB::readRefFile<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()));
if ((dev->getCapabilities() & osgGA::Device::SEND_EVENTS))
viewer.getEventHandlers().push_front(new ForwardToDeviceEventHandler(dev.get(), forward_mouse_events));
}
else
{
@@ -327,7 +286,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 the application for presenting 3D interactive slide shows.");
@@ -348,6 +307,8 @@ int main( int argc, char **argv )
arguments.getApplicationUsage()->addCommandLineOption("--html <filename>","Print out slides to a series of html & image files.");
arguments.getApplicationUsage()->addCommandLineOption("--loop","Switch on looping of presentation.");
arguments.getApplicationUsage()->addCommandLineOption("--devices","Print the Video input capability via QuickTime and exit.");
arguments.getApplicationUsage()->addCommandLineOption("--forwardMouseEvents","forward also mouse/touch-events to the devices");
arguments.getApplicationUsage()->addCommandLineOption("--suppressEnvTags", "suppresses all found ENV-tags in the presentation");
// add alias from xml to p3d to provide backwards compatibility for old p3d files.
osgDB::Registry::instance()->addFileExtensionAlias("xml","p3d");
@@ -356,14 +317,17 @@ int main( int argc, char **argv )
if (arguments.read("-devices") || arguments.read("--devices"))
{
// Force load QuickTime plugin, probe video capability, exit
osgDB::readImageFile("devices.live");
osgDB::readRefImageFile("devices.live");
return 1;
}
bool suppress_env_tags = false;
if (arguments.read("--suppressEnvTags"))
suppress_env_tags = true;
// read any env vars from presentations before we create viewer to make sure the viewer
// utilises these env vars
if (p3d::readEnvVars(arguments))
if (!suppress_env_tags && p3d::readEnvVars(arguments))
{
osg::DisplaySettings::instance()->readEnvironmentalVariables();
}
@@ -386,10 +350,10 @@ int main( int argc, char **argv )
#ifdef USE_SDL
SDLIntegration sdlIntegration;
osg::notify(osg::INFO)<<"USE_SDL"<<std::endl;
#endif
#endif
bool doSetViewer = true;
std::string configurationFile;
@@ -402,7 +366,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;
@@ -441,7 +405,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);
@@ -451,6 +415,10 @@ int main( int argc, char **argv )
doSetViewer = false;
}
bool forwardMouseEvents = false;
if (arguments.read("--forwardMouseEvents"))
forwardMouseEvents = true;
const char* p3dDevice = getenv("P3D_DEVICE");
if (p3dDevice)
{
@@ -458,7 +426,7 @@ int main( int argc, char **argv )
osgDB::split(p3dDevice, devices);
for(osgDB::StringList::iterator i = devices.begin(); i != devices.end(); ++i)
{
addDeviceTo(viewer, *i);
addDeviceTo(viewer, *i, forwardMouseEvents);
}
}
@@ -466,13 +434,13 @@ int main( int argc, char **argv )
std::string device;
while (arguments.read("--device", device))
{
addDeviceTo(viewer, device);
addDeviceTo(viewer, device, forwardMouseEvents);
}
if (arguments.read("--http-control"))
{
std::string server_address = "localhost";
std::string server_port = "8080";
std::string document_root = "htdocs";
@@ -483,23 +451,33 @@ int main( int argc, char **argv )
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());
osg::ref_ptr<osgGA::Device> rest_http_device = osgDB::readRefFile<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.
{
osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator;
keyswitchManipulator->addMatrixManipulator( '1', "Trackball", new osgGA::TrackballManipulator() );
keyswitchManipulator->addMatrixManipulator( '1', "Trackball", new osgGA::MultiTouchTrackballManipulator() );
keyswitchManipulator->addMatrixManipulator( '2', "Flight", new osgGA::FlightManipulator() );
keyswitchManipulator->addMatrixManipulator( '3', "Drive", new osgGA::DriveManipulator() );
keyswitchManipulator->addMatrixManipulator( '4', "Terrain", new osgGA::TerrainManipulator() );
@@ -509,7 +487,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 );
@@ -521,6 +499,8 @@ int main( int argc, char **argv )
viewer.setCameraManipulator( keyswitchManipulator.get() );
}
//viewer.getEventHandlers().push_front(new DumpEventHandler());
// add the state manipulator
osg::ref_ptr<osgGA::StateSetManipulator> ssManipulator = new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet());
ssManipulator->setKeyEventToggleTexturing('e');
@@ -547,12 +527,12 @@ int main( int argc, char **argv )
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;
@@ -599,7 +579,7 @@ int main( int argc, char **argv )
viewer.getUpdateVisitor()->setTraversalMode(updateTraversalMode);
}
// register the slide event handler - which moves the presentation from slide to slide, layer to layer.
osg::ref_ptr<osgPresentation::SlideEventHandler> seh = new osgPresentation::SlideEventHandler(&viewer);
viewer.addEventHandler(seh.get());
@@ -619,19 +599,19 @@ 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"))
bool release_and_compile = false;
while (arguments.read("--release-and-compile"))
{
relase_and_compile = true;
release_and_compile = true;
}
seh->setReleaseAndCompileOnEachNewSlide(relase_and_compile);
if (relase_and_compile)
seh->setReleaseAndCompileOnEachNewSlide(release_and_compile);
if (release_and_compile)
{
// make sure that imagery stays around after being applied to textures.
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);
@@ -657,7 +637,7 @@ int main( int argc, char **argv )
float width = osg::DisplaySettings::instance()->getScreenWidth();
float height = osg::DisplaySettings::instance()->getScreenHeight();
float distance = osg::DisplaySettings::instance()->getScreenDistance();
while (arguments.read("-s", width, height, distance))
while (arguments.read("-s", width, height, distance))
{
osg::DisplaySettings::instance()->setScreenDistance(distance);
osg::DisplaySettings::instance()->setScreenHeight(height);
@@ -672,9 +652,10 @@ int main( int argc, char **argv )
viewer.getUsage(*arguments.getApplicationUsage());
// if user request help write it out to cout.
if (arguments.read("-h") || arguments.read("--help"))
unsigned int helpType = 0;
if ((helpType = arguments.readHelpType()))
{
arguments.getApplicationUsage()->write(osg::notify(osg::NOTICE));
arguments.getApplicationUsage()->write(std::cout, helpType);
return 1;
}
@@ -687,11 +668,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";
@@ -769,6 +750,9 @@ int main( int argc, char **argv )
osg::ref_ptr<osgDB::ReaderWriter::Options> cacheAllOption = new osgDB::ReaderWriter::Options;
if(suppress_env_tags)
cacheAllOption->setPluginStringData("suppressEnvTags", "true");
cacheAllOption->setObjectCacheHint(osgDB::ReaderWriter::Options::CACHE_ALL);
osgDB::Registry::instance()->setOptions(cacheAllOption.get());
@@ -780,7 +764,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;
@@ -796,12 +780,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);
@@ -830,7 +814,7 @@ int main( int argc, char **argv )
}
// pass the model to the slide event handler so it knows which to manipulate.
seh->set(loadedModel.get());
@@ -843,7 +827,7 @@ int main( int argc, char **argv )
osgDB::writeNodeFile(*loadedModel,outputFileName);
return 0;
}
if (!cursorFileName.empty() || hideCursor)
{
@@ -865,7 +849,7 @@ int main( int argc, char **argv )
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.
@@ -894,7 +878,7 @@ int main( int argc, char **argv )
startOfFrameTick = osg::Timer::instance()->tick();
#if 0
#if 0
if (kmcb)
{
double time = kmcb->getTime();
@@ -910,9 +894,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();
@@ -922,7 +906,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();
@@ -932,13 +916,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.
@@ -946,7 +930,7 @@ int main( int argc, char **argv )
}
}
// update the scene by traversing it with the the update visitor which will
// update the scene by traversing it with the update visitor which will
// call all node update callbacks and animations.
viewer.eventTraversal();
@@ -972,10 +956,10 @@ int main( int argc, char **argv )
seh->selectSlide(previous_ActiveSlide, previous_ActiveLayer);
continue;
}
// update the scene by traversing it with the the update visitor which will
// update the scene by traversing it with the update visitor which will
// call all node update callbacks and animations.
viewer.updateTraversal();
@@ -996,7 +980,7 @@ int main( int argc, char **argv )
{
ExportHTML::write(seh.get(), viewer, exportName);
}
return 0;
}

1
configure vendored
View File

@@ -1 +0,0 @@
cmake . -DCMAKE_BUILD_TYPE=Release $@

View File

@@ -27,6 +27,7 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgautocapture)
ADD_SUBDIRECTORY(osgautotransform)
ADD_SUBDIRECTORY(osgbillboard)
ADD_SUBDIRECTORY(osgblenddrawbuffers)
ADD_SUBDIRECTORY(osgblendequation)
ADD_SUBDIRECTORY(osgcallback)
ADD_SUBDIRECTORY(osgcamera)
@@ -46,7 +47,6 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgfont)
ADD_SUBDIRECTORY(osgforest)
ADD_SUBDIRECTORY(osgfxbrowser)
ADD_SUBDIRECTORY(osgframerenderer)
ADD_SUBDIRECTORY(osgoutline)
ADD_SUBDIRECTORY(osggameoflife)
ADD_SUBDIRECTORY(osggeometry)
@@ -65,6 +65,7 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osglightpoint)
ADD_SUBDIRECTORY(osglogicop)
ADD_SUBDIRECTORY(osglogo)
ADD_SUBDIRECTORY(osggpucull)
ADD_SUBDIRECTORY(osggpx)
ADD_SUBDIRECTORY(osggraphicscost)
ADD_SUBDIRECTORY(osgmanipulator)
@@ -95,6 +96,7 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgprerendercubemap)
ADD_SUBDIRECTORY(osgreflect)
ADD_SUBDIRECTORY(osgrobot)
ADD_SUBDIRECTORY(osgSSBO)
ADD_SUBDIRECTORY(osgscalarbar)
ADD_SUBDIRECTORY(osgscribe)
ADD_SUBDIRECTORY(osgsequence)
@@ -118,14 +120,17 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgstereomatch)
ADD_SUBDIRECTORY(osgterrain)
ADD_SUBDIRECTORY(osgthreadedterrain)
ADD_SUBDIRECTORY(osgtransferfunction)
ADD_SUBDIRECTORY(osgtext)
ADD_SUBDIRECTORY(osgtext3D)
ADD_SUBDIRECTORY(osgtexture1D)
ADD_SUBDIRECTORY(osgtexture2D)
ADD_SUBDIRECTORY(osgtexture2DArray)
ADD_SUBDIRECTORY(osgtexture3D)
ADD_SUBDIRECTORY(osgtexturerectangle)
ADD_SUBDIRECTORY(osgtexturecompression)
ADD_SUBDIRECTORY(osgthirdpersonview)
ADD_SUBDIRECTORY(osgtransformfeedback)
ADD_SUBDIRECTORY(osguniformbuffer)
ADD_SUBDIRECTORY(osguserstats)
ADD_SUBDIRECTORY(osgvertexprogram)

View File

@@ -7,7 +7,7 @@
#include <iostream>
// Search in str for all occurences of spat and replace them with rpat.
// Search in str for all occurrences of spat and replace them with rpat.
void searchAndReplace(std::string& str, const std::string& spat, const std::string& rpat)
{
std::string::size_type pos = 0;
@@ -30,13 +30,13 @@ void writeShader(osg::Shader* shader, const std::string& cppFileName, const std:
searchAndReplace(shaderSource, "\r\n", "\n");
searchAndReplace(shaderSource, "\r", "\n");
searchAndReplace(shaderSource, "\"", "\\\"");
std::string variableString = std::string("char ")+variableName+std::string("[] = ");
std::string::size_type startOfLine = 0;
std::string::size_type endOfLine = shaderSource.find_first_of('\n', startOfLine);
if (endOfLine==std::string::npos)
if (endOfLine==std::string::npos)
{
fout<<variableString<<shaderSource<<"\\n\";"<<std::endl;
}
@@ -63,25 +63,29 @@ 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 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("--write-to-source-file-directory","Use the path to the source filename as the directory to write to.");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display command line parameters");
// if user request help write it out to cout.
if (arguments.read("-h") || arguments.read("--help"))
{
{
arguments.getApplicationUsage()->write(std::cout);
return 1;
}
bool useSamePathAsSourceFile = false;
if (arguments.read("--write-to-source-file-directory")) useSamePathAsSourceFile = true;
std::string filename;
if (arguments.read("--shader",filename))
{
osg::ref_ptr<osg::Shader> shader = osgDB::readShaderFile(filename);
osg::ref_ptr<osg::Shader> shader = osgDB::readRefShaderFile(filename);
if (shader.valid())
{
std::string name = osgDB::getStrippedName(filename);
@@ -94,9 +98,11 @@ int main( int argc, char **argv )
name[pos] = '_';
pos = name.find_first_of(invalidCharacters);
}
std::string ext = osgDB::getFileExtension(filename);
std::string cppFileName = osgDB::concatPaths(path, name + "_" + ext + ".cpp");
std::string cppFileName = name + "_" + ext + ".cpp";
if (useSamePathAsSourceFile) cppFileName = osgDB::concatPaths(path, cppFileName);
std::string variableName = name + "_" + ext;
writeShader(shader.get(), cppFileName, variableName);
@@ -107,7 +113,7 @@ int main( int argc, char **argv )
std::cout<<"Error: could not find file '"<<filename<<"'"<<std::endl;
return 1;
}
}
std::cout<<"No appropriate command line options used."<<std::endl;

View File

@@ -59,10 +59,10 @@ class ViewerFrameThread : public OpenThreads::Thread
~ViewerFrameThread()
{
cancel();
while(isRunning())
if (isRunning())
{
OpenThreads::Thread::YieldCurrentThread();
cancel();
join();
}
}

View File

@@ -107,25 +107,25 @@ protected:
};
//We would need to document the following somewhere in order to guide people on
//We would need to document the following somewhere in order to guide people on
//what they need to use...
//
//----------------------------------------------
//There are two angles to consider.
//
//1. If someone wants a widget in their Qt app to be an OSG-rendered scene, they
//need GraphicsWindowQt (in the osgViewerQtContext example) or QOSGWidget (in the
//osgViewerQt example). These two allow both OSG and Qt to manage their threads
//in a way which is optimal to them. We've used QOSGWidget in the past and had
//trouble when Qt tried to overlay other widgets over the QOSGWidget (since OSG
//did its rendering independently of Qt, it would overwrite what Qt had drawn). I
//haven't tried GraphicsWindowQt yet, but I expect since it uses QGLWidget, it
//will result in Qt knowing when OSG has drawn and be able to do overlays at the
//1. If someone wants a widget in their Qt app to be an OSG-rendered scene, they
//need GraphicsWindowQt (in the osgViewerQtContext example) or QOSGWidget (in the
//osgViewerQt example). These two allow both OSG and Qt to manage their threads
//in a way which is optimal to them. We've used QOSGWidget in the past and had
//trouble when Qt tried to overlay other widgets over the QOSGWidget (since OSG
//did its rendering independently of Qt, it would overwrite what Qt had drawn). I
//haven't tried GraphicsWindowQt yet, but I expect since it uses QGLWidget, it
//will result in Qt knowing when OSG has drawn and be able to do overlays at the
//right time. Eventually GraphicsWindowQt can be brought into osgViewer I imagine...
//
//2. If someone wants to bring Qt widgets inside their OSG scene (to do HUDs or
//an interface on a computer screen which is inside the 3D scene, or even
//floating Qt widgets, for example). That's where QGraphicsViewAdapter +
//2. If someone wants to bring Qt widgets inside their OSG scene (to do HUDs or
//an interface on a computer screen which is inside the 3D scene, or even
//floating Qt widgets, for example). That's where QGraphicsViewAdapter +
//QWidgetImage will be useful.
//----------------------------------------------
@@ -160,7 +160,7 @@ int main(int argc, char **argv)
bool useLabel = false;
if (arguments.read("--useLabel")) useLabel = true;
// true = make a Qt window with the same content to compare to
// true = make a Qt window with the same content to compare to
// QWebViewImage/QWidgetImage
// false = use QWebViewImage/QWidgetImage (depending on useWidgetImage)
bool sanityCheck = false;
@@ -183,9 +183,9 @@ int main(int argc, char **argv)
//-------------------------------------------------------------------
// QWebViewImage test
//-------------------------------------------------------------------
// Note: When the last few issues with QWidgetImage are fixed,
// QWebViewImage and this if() {} section can be removed since
// QWidgetImage can display a QWebView just like QWebViewImage. Use
// Note: When the last few issues with QWidgetImage are fixed,
// QWebViewImage and this if() {} section can be removed since
// QWidgetImage can display a QWebView just like QWebViewImage. Use
// --useWidgetImage --useBrowser to see that in action.
if (!sanityCheck)
@@ -193,7 +193,7 @@ int main(int argc, char **argv)
osg::ref_ptr<osgQt::QWebViewImage> image = new osgQt::QWebViewImage;
if (arguments.argc()>1) image->navigateTo((arguments[1]));
else image->navigateTo("http://www.youtube.com/");
else image->navigateTo("http://www.openscenegraph.org/");
osgWidget::GeometryHints hints(osg::Vec3(0.0f,0.0f,0.0f),
osg::Vec3(1.0f,0.0f,0.0f),
@@ -208,7 +208,7 @@ int main(int argc, char **argv)
}
else
{
// Sanity check, do the same thing as QGraphicsViewAdapter but in
// Sanity check, do the same thing as QGraphicsViewAdapter but in
// a separate Qt window.
QWebPage* webPage = new QWebPage;
webPage->settings()->setAttribute(QWebSettings::JavascriptEnabled, true);
@@ -218,7 +218,7 @@ int main(int argc, char **argv)
webView->setPage(webPage);
if (arguments.argc()>1) webView->load(QUrl(arguments[1]));
else webView->load(QUrl("http://www.youtube.com/"));
else webView->load(QUrl("http://www.openscenegraph.org/"));
QGraphicsScene* graphicsScene = new QGraphicsScene;
graphicsScene->addWidget(webView);
@@ -240,14 +240,16 @@ int main(int argc, char **argv)
// QWidgetImage test
//-------------------------------------------------------------------
// QWidgetImage still has some issues, some examples are:
//
// 1. Editing in the QTextEdit doesn't work. Also when started with
// --useBrowser, editing in the search field on YouTube doesn't
// work. But that same search field when using QWebViewImage
// works... And editing in the text field in the pop-up getInteger
// dialog works too. All these cases use QGraphicsViewAdapter
//
// 1. Editing in the QTextEdit doesn't work. Also when started with
// --useBrowser, editing in the search field on YouTube doesn't
// work. But that same search field when using QWebViewImage
// works... And editing in the text field in the pop-up getInteger
// dialog works too. All these cases use QGraphicsViewAdapter
// under the hood, so why do some work and others don't?
//
// <<< FIXED, need TextEditorInteraction >>>
//
// a) osgQtBrowser --useWidgetImage [--fullscreen] (optional)
// b) Try to click in the QTextEdit and type, or to select text
// and drag-and-drop it somewhere else in the QTextEdit. These
@@ -259,11 +261,11 @@ int main(int argc, char **argv)
// g) osgQtBrowser
// h) Try the operation in f), it works.
//
// 2. Operations on floating windows (--numFloatingWindows 1 or more).
// Moving by dragging the titlebar, clicking the close button,
// resizing them, none of these work. I wonder if it's because the
// OS manages those functions (they're functions of the window
// decorations) so we need to do something special for that? But
// 2. Operations on floating windows (--numFloatingWindows 1 or more).
// Moving by dragging the titlebar, clicking the close button,
// resizing them, none of these work. I wonder if it's because the
// OS manages those functions (they're functions of the window
// decorations) so we need to do something special for that? But
// in --sanityCheck mode they work.
//
// a) osgQtBrowser --useWidgetImage --numFloatingWindows 1 [--fullscreen]
@@ -272,35 +274,37 @@ int main(int argc, char **argv)
// c) osgQtBrowser --useWidgetImage --numFloatingWindows 1 --sanityCheck
// d) Try the operations in b), all they work.
// e) osgQtBrowser --useWidgetImage [--fullscreen]
// f) Click the button so that the getInteger() dialog is
// displayed, then try to move that dialog or close it with the
// f) Click the button so that the getInteger() dialog is
// displayed, then try to move that dialog or close it with the
// close button, these don't work.
// g) osgQtBrowser --useWidgetImage --sanityCheck
// h) Try the operation in f), it works.
//
// 3. (Minor) The QGraphicsView's scrollbars don't appear when
// using QWidgetImage or QWebViewImage. QGraphicsView is a
// 3. (Minor) The QGraphicsView's scrollbars don't appear when
// using QWidgetImage or QWebViewImage. QGraphicsView is a
// QAbstractScrollArea and it should display scrollbars as soon as
// the scene is too large to fit the view.
//
// <<< FIXED >>>
//
// a) osgQtBrowser --useWidgetImage --fullscreen
// b) Resize the OSG window so it's smaller than the QTextEdit.
// Scrollbars should appear but don't.
// c) osgQtBrowser --useWidgetImage --sanityCheck
// d) Try the operation in b), scrollbars appear. Even if you have
// floating windows (by clicking the button or by adding
// --numFloatingWindows 1) and move them outside the view,
// scrollbars appear too. You can't test that case in OSG for
// d) Try the operation in b), scrollbars appear. Even if you have
// floating windows (by clicking the button or by adding
// --numFloatingWindows 1) and move them outside the view,
// scrollbars appear too. You can't test that case in OSG for
// now because of problem 2 above, but that's pretty cool.
//
// 4. (Minor) In sanity check mode, the widget added to the
// 4. (Minor) In sanity check mode, the widget added to the
// QGraphicsView is centered. With QGraphicsViewAdapter, it is not.
//
// a) osgQtBrowser --useWidgetImage [--fullscreen]
// b) The QTextEdit and button are not in the center of the image
// generated by the QGraphicsViewAdapter.
// c) osgQtBrowser --useWidgetImage --sanityCheck
// d) The QTextEdit and button are in the center of the
// d) The QTextEdit and button are in the center of the
// QGraphicsView.
@@ -346,7 +350,7 @@ int main(int argc, char **argv)
{
QTextEdit* textEdit = new QTextEdit(text);
textEdit->setReadOnly(false);
textEdit->setTextInteractionFlags(Qt::TextEditable);
textEdit->setTextInteractionFlags(Qt::TextEditorInteraction);
QPalette palette = textEdit->palette();
palette.setColor(QPalette::Highlight, Qt::darkBlue);
@@ -388,7 +392,7 @@ int main(int argc, char **argv)
texture->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
mt->getOrCreateStateSet()->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON);
osgViewer::InteractiveImageHandler* handler;
osgViewer::InteractiveImageHandler* handler;
if (inScene)
{
mt->setMatrix(osg::Matrix::rotate(osg::Vec3(0,1,0), osg::Vec3(0,0,1)));
@@ -398,9 +402,9 @@ int main(int argc, char **argv)
}
else // fullscreen
{
// The HUD camera's viewport needs to follow the size of the
// The HUD camera's viewport needs to follow the size of the
// window. MyInteractiveImageHandler will make sure of this.
// As for the quad and the camera's projection, setting the
// As for the quad and the camera's projection, setting the
// projection resize policy to FIXED takes care of them, so
// they can stay the same: (0,1,0,1) with a quad that fits.
@@ -429,13 +433,13 @@ int main(int argc, char **argv)
overlay->addChild(mt);
root->addChild(overlay);
quad->setEventCallback(handler);
quad->setCullCallback(handler);
}
else
{
// Sanity check, do the same thing as QWidgetImage and
// Sanity check, do the same thing as QWidgetImage and
// QGraphicsViewAdapter but in a separate Qt window.
graphicsScene = new QGraphicsScene;

View File

@@ -0,0 +1,4 @@
SET(TARGET_SRC osgSSBO.cpp )
SETUP_EXAMPLE(osgSSBO)

View File

@@ -0,0 +1,949 @@
//info : osgSSBO example,testing ShaderStorageBufferObjects ,Markus Hein, 2014, osg-3.2.1
//required hardware and driver must support GL >= GL 4.3 or GL ES 3.1 (GL ES not tested, would be nice if someone will test it on a small device)
//testing osg support for Shader Storage Buffer Objects
//version: "first take" from last night session..
#include <osg/StateAttributeCallback>
#include <osg/Texture2D>
#include <osg/Geometry>
#include <osg/Geode>
#include <osgDB/ReadFile>
#include <osgGA/StateSetManipulator>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osg/Node>
#include <osg/PositionAttitudeTransform>
#include <osg/Geometry>
#include <osg/Notify>
#include <osg/MatrixTransform>
#include <osg/Texture2D>
#include <osg/TextureRectangle>
#include <osg/Stencil>
#include <osg/Depth>
#include <osg/Billboard>
#include <osg/Material>
#include <osg/AnimationPath>
#include <osgGA/TrackballManipulator>
#include <osgGA/FlightManipulator>
#include <osgGA/DriveManipulator>
#include <osgUtil/SmoothingVisitor>
#include <osgDB/Registry>
#include <osgDB/ReadFile>
#include <osgDB/WriteFile>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgViewer/Renderer>
#include <osg/Array>
#include <osg/BoundingSphere>
#include <osg/BufferIndexBinding>
#include <osg/BufferObject>
#include <osg/Group>
#include <osg/Math>
#include <osg/MatrixTransform>
#include <osg/Program>
#include <osg/Shader>
#include <osg/Drawable>
#include <osg/CopyOp>
#include <osg/State>
#include <osg/Matrix>
#include <osg/ShapeDrawable>
#include <osg/GL>
#include <osg/StateSet>
#include <osg/Texture2D>
#include <osg/BlendFunc>
#include <osg/TexEnv>
#include <osg/Material>
#include <osg/PointSprite>
#include <osg/Program>
#include <osg/Notify>
#include <osg/Point>
#include <osg/io_utils>
#include <osg/VertexProgram>
#include <osgText/Font>
#include <osgText/Text>
#include <osgDB/ReadFile>
#include <osgDB/WriteFile>
#include <osgDB/FileNameUtils>
#include <osgUtil/Optimizer>
#include <iostream>
#include <typeinfo>
using namespace osg;
//todo .. #define COMPUTATION_IN_SEPARATE_THREAD
#define WORK_GROUP_SIZE 16
#define PRERENDER_ANTIALIASINGMULTISAMPLES 16
#define PRERENDER_HIGH_QUALITY_ANTIALIASING
#define PRERENDER_WIDTH 1920
#define PRERENDER_HEIGHT 1080
#define SUB_PLACEMENT_OFFSET_HORIZONTAL 0.5
#define SUB_PLACEMENT_OFFSET_VERTICAL 0.5
enum BufferOffset
{
POSITION_NOW_OFFSET,
POSITION_OLD_OFFSET,
POSITION_INIT_OFFSET,
VELOCITY_NOW_OFFSET,
VELOCITY_OLD_OFFSET,
VELOCITY_INIT_OFFSET,
ACCELERATION_OFFSET,
PROPERTIES_OFFSET,
OFFSET_END
};
const int __numDataValuesPerChannel = OFFSET_END;
const int __numChannels = 4;
//512x512x4x7 = 7.340.032 floats in SSBO on GPU
const int NUM_ELEMENTS_X = 512;
const int NUM_ELEMENTS_Y = 512;
float random(float min, float max) { return min + (max - min)*(float)rand() / (float)RAND_MAX; }
enum Channel
{
RED_CHANNEL,
GREEN_CHANNEL,
BLUE_CHANNEL,
ALPHA_CHANNEL,
RGB_CHANNEL,
RGBA_CHANNEL
};
class ShaderStorageBufferCallback : public osg::StateAttributeCallback
{
public:
void operator() (osg::StateAttribute* attr, osg::NodeVisitor* nv)
{
//if you need to process the data in your app-code , better leaving it on GPU and processing there, uploading per frame will make it slow
#if 0
osg::ShaderStorageBufferBinding* ssbb = static_cast<osg::ShaderStorageBufferBinding*>(attr);
osg::ShaderStorageBufferObject* ssbo
= static_cast<osg::ShaderStorageBufferObject*>(ssbb->getBufferObject());
osg::FloatArray* array = static_cast<osg::FloatArray*>(ssbo->getBufferData(0));
float someValue = array->at(0);
//std::cout << "someValue now: " << someValue << std::endl;
//data transfer performance test
// array->dirty();
#endif
}
};
//do not forget to set OSG_FILE_PATH to default OSG-Data and make sure the new shaders are copied there under"shaders"
class ComputeNode : public osg::PositionAttitudeTransform
{
public:
osg::ref_ptr<osg::Program> _computeProgram;
osg::ref_ptr<osg::Shader> _computeShader; //compute and write position data in SSBO
osg::ref_ptr<osg::Shader> _vertexShader; //reading position data from SSBO (OBS!: make sure glMemoryBuffer() is syncing this)
osg::ref_ptr<osg::Shader> _geometryShader; //building a quad looking to the camera
osg::ref_ptr<osg::Shader> _fragmentShader; //use false-colors etc. for making your data visible
osg::ref_ptr<osg::Node> _helperNode; // coordinate system node
ref_ptr<osg::ShaderStorageBufferObject> _ssbo;
ref_ptr<osg::ShaderStorageBufferBinding> _ssbb;
GLfloat* _data; // some data we upload to GPU, initialised with random values
osg::ref_ptr<FloatArray> _dataArray; //
osg::ref_ptr<osg::Group> _computationResultsRenderGroup;
osg::ref_ptr<osg::Program> _computationResultsRenderProgram;
osg::ref_ptr<osg::StateSet> _computationResultsRenderStateSet;
std::string _computeShaderSourcePath;
std::string _vertexShaderSourcePath;
std::string _geometryShaderSourcePath;
std::string _fragmentShaderSourcePath;
void addHelperGeometry();
void addDataMonitor(osg::Vec3 placement, osg::Vec3 relativePlacement, float scale, Channel channel, BufferOffset shaderBufferOffset, std::string labelcaption, float minDataRange, float maxDataRange);
void addComputationResultsRenderTree();
void initComputingSetup();
ComputeNode()
{
const char* envOsgFilePath = getenv("OSG_FILE_PATH");
std::stringstream computeshaderpath; computeshaderpath << envOsgFilePath << "/shaders/osgssboComputeShader.cs";
_computeShaderSourcePath = computeshaderpath.str();
std::stringstream vertexshaderpath; vertexshaderpath << envOsgFilePath << "/shaders/osgssboVertexShader.vs";
_vertexShaderSourcePath = vertexshaderpath.str();
std::stringstream geometryshaderpath; geometryshaderpath << envOsgFilePath << "/shaders/osgssboGeometryShader.gs";
_geometryShaderSourcePath = geometryshaderpath.str();
std::stringstream fragmentshaderpath; fragmentshaderpath << envOsgFilePath << "/shaders/osgssboFragmentShader.fs";
_fragmentShaderSourcePath = fragmentshaderpath.str();
}
};
class ComputeNodeUpdateCallback : public osg::NodeCallback
{
public:
ComputeNode* _computeNode;
osg::Timer_t _prevShaderUpdateTime;
osg::Timer _timer;
ComputeNodeUpdateCallback(){}
ComputeNodeUpdateCallback(ComputeNode* computeNode)
{
_computeNode = computeNode;
_prevShaderUpdateTime = 0;
}
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
osg::Timer_t currTime = _timer.tick();
if (_timer.delta_s(_prevShaderUpdateTime, currTime) > 1.0) //one second interval for shader-changed-do-reload check
{
osg::ref_ptr<osg::Shader> reloadedshader;
std::string runningSource;
std::string reloadedstring;
if (_computeNode->_computeShader.valid())
{
runningSource = _computeNode->_computeShader->getShaderSource();
reloadedshader = osg::Shader::readShaderFile(osg::Shader::COMPUTE, _computeNode->_computeShaderSourcePath);
reloadedstring = reloadedshader->getShaderSource();
if (!osgDB::equalCaseInsensitive(runningSource.c_str(), reloadedstring.c_str()))
{
_computeNode->_computeProgram->removeShader(_computeNode->_computeShader.get());
_computeNode->_computeShader = reloadedshader.get();
_computeNode->_computeProgram->addShader(_computeNode->_computeShader.get());
}
}
if (_computeNode->_vertexShader.valid())
{
runningSource = _computeNode->_vertexShader->getShaderSource();
reloadedshader = osg::Shader::readShaderFile(osg::Shader::VERTEX, _computeNode->_vertexShaderSourcePath);
reloadedstring = reloadedshader->getShaderSource();
if (!osgDB::equalCaseInsensitive(runningSource.c_str(), reloadedstring.c_str()))
{
_computeNode->_computationResultsRenderProgram->removeShader(_computeNode->_vertexShader.get());
_computeNode->_vertexShader = reloadedshader.get();
_computeNode->_computationResultsRenderProgram->addShader(_computeNode->_vertexShader.get());
}
}
if (_computeNode->_geometryShader.valid())
{
runningSource = _computeNode->_geometryShader->getShaderSource();
reloadedshader = osg::Shader::readShaderFile(osg::Shader::GEOMETRY, _computeNode->_geometryShaderSourcePath);
reloadedstring = reloadedshader->getShaderSource();
if (!osgDB::equalCaseInsensitive(runningSource.c_str(), reloadedstring.c_str()))
{
_computeNode->_computationResultsRenderProgram->removeShader(_computeNode->_geometryShader.get());
_computeNode->_geometryShader = reloadedshader.get();
_computeNode->_computationResultsRenderProgram->addShader(_computeNode->_geometryShader.get());
}
}
if (_computeNode->_fragmentShader.valid())
{
runningSource = _computeNode->_fragmentShader->getShaderSource();
reloadedshader = osg::Shader::readShaderFile(osg::Shader::FRAGMENT, _computeNode->_fragmentShaderSourcePath);
reloadedstring = reloadedshader->getShaderSource();
if (!osgDB::equalCaseInsensitive(runningSource.c_str(), reloadedstring.c_str()))
{
_computeNode->_computationResultsRenderProgram->removeShader(_computeNode->_fragmentShader.get());
_computeNode->_fragmentShader = reloadedshader.get();
_computeNode->_computationResultsRenderProgram->addShader(_computeNode->_fragmentShader.get());
}
}
_prevShaderUpdateTime = _timer.tick();
}
traverse(node, nv);
}
};
//set OSG_FILE_PATH for loading axes.osgt
void ComputeNode::addHelperGeometry()
{
_helperNode = osgDB::readRefNodeFile("axes.osgt");
if (_helperNode.valid())
{
addChild(_helperNode.get());
}
//osg::PositionAttitudeTransform* pat = new osg::PositionAttitudeTransform;
//pat->setPosition(osg::Vec3(0.5, 0, 0.5));
//osg::Geode *sphereGeode = new osg::Geode;
//float radius = 0.5f;
//osg::TessellationHints* hints = new osg::TessellationHints;
//hints->setDetailRatio(0.9f);
//osg::ShapeDrawable* sphere = new osg::ShapeDrawable(new osg::Sphere(osg::Vec3(0.0f, 0.0f, 0.0f), radius), hints);
//sphereGeode->addDrawable(sphere);
//sphere->setColor(osg::Vec4(0, 1, 0, 0.1));
//osg::StateSet* stateset = sphereGeode->getOrCreateStateSet();
//osg::BlendFunc *blend = new osg::BlendFunc;
//blend->setFunction(osg::BlendFunc::SRC_ALPHA, osg::BlendFunc::ONE_MINUS_SRC_ALPHA);
//stateset->setAttributeAndModes(blend, osg::StateAttribute::ON);
//pat->addChild(sphereGeode);
//addChild(pat);
}
void ComputeNode::addDataMonitor(osg::Vec3 placement, osg::Vec3 relativePlacement, float scale, Channel colorchannel, BufferOffset shaderStorageBufferOffset, std::string labelCaption, float minDataRange, float maxDataRange)
{
osg::PositionAttitudeTransform* pat = new osg::PositionAttitudeTransform;
pat->setPosition(relativePlacement);
addChild(pat);
osg::Geometry* geom;
if (NUM_ELEMENTS_X >= NUM_ELEMENTS_Y)
{
float ratio = (float)((float)NUM_ELEMENTS_Y / (float)NUM_ELEMENTS_X);
geom = osg::createTexturedQuadGeometry(placement, osg::Vec3(1.0f*scale, 0.0f, 0.0f), osg::Vec3(0.0f, 0.0f, ratio*1.0f*scale));
}
else
{
float ratio = (float)((float)NUM_ELEMENTS_X / (float)NUM_ELEMENTS_Y);
geom = osg::createTexturedQuadGeometry(placement, osg::Vec3(ratio*1.0f*scale, 0.0f, 0.0f), osg::Vec3(0.0f, 0.0f, 1.0f*scale));
}
geom->setVertexAttribArray(1, geom->getTexCoordArray(0), osg::Array::BIND_PER_VERTEX);
osg::ref_ptr<osg::Geode> quad = new osg::Geode;
quad->addDrawable(geom);
quad->setStateSet(getOrCreateStateSet());
pat->addChild(quad.get());
static const char* vertexShaderSrcChannelMonitor = {
"#version 430 \n"
"uniform int numRows;\n"
"uniform int numCols;\n"
"uniform float osg_FrameTime;\n"
"uniform mat4 osg_ProjectionMatrix;\n"
"uniform mat4 osg_ModelViewMatrix;\n"
"out vec2 texCoordFromVertexShader;\n"
"struct particle{ float x; float y; float z; float w;};"
"layout (location = 0) in vec3 vertexpos;\n"
"attribute vec2 tex_coords;\n"
"void main() {\n"
"texCoordFromVertexShader.xy = tex_coords.xy; gl_Position = ( osg_ProjectionMatrix * osg_ModelViewMatrix * vec4(vertexpos.x,vertexpos.y,vertexpos.z,1) ); \n"
"}\n"
};
std::stringstream fragmentshaderstringstreamChannelMonitor;
fragmentshaderstringstreamChannelMonitor << "#version 430\n";
fragmentshaderstringstreamChannelMonitor << "uniform int numRows;\n";
fragmentshaderstringstreamChannelMonitor << "uniform int numCols;\n";
fragmentshaderstringstreamChannelMonitor << "uniform float dataRangeMin;\n";
fragmentshaderstringstreamChannelMonitor << "uniform float dataRangeMax;\n";
fragmentshaderstringstreamChannelMonitor << "in vec2 texCoordFromVertexShader;\n";
fragmentshaderstringstreamChannelMonitor << "struct particle{ float x; float y; float z; float w;};";
fragmentshaderstringstreamChannelMonitor << "layout(std140, binding=0) coherent buffer particles{particle p[];}; ";
fragmentshaderstringstreamChannelMonitor << "\n";
fragmentshaderstringstreamChannelMonitor << "void main(void)\n";
fragmentshaderstringstreamChannelMonitor << "{\n";
fragmentshaderstringstreamChannelMonitor << "ivec2 storePos = ivec2(numRows*texCoordFromVertexShader.x, numCols*texCoordFromVertexShader.y); particle particleData = p[" << shaderStorageBufferOffset * NUM_ELEMENTS_X*NUM_ELEMENTS_Y << " + (storePos.x*numRows + storePos.y)]; ";
//fragmentshaderstringstreamChannelMonitor << " memoryBarrierBuffer(); \n";
fragmentshaderstringstreamChannelMonitor << " float dataRangeMultiplier = 1.0 / abs(dataRangeMax - dataRangeMin); \n";
switch (colorchannel)
{
case RED_CHANNEL:
{
fragmentshaderstringstreamChannelMonitor << " vec4 color; color.x = 0.5+dataRangeMultiplier*particleData.x; color.y =0.0; color.z = 0.0; color.w = 1.0; gl_FragColor = color;\n";
break;
}
case GREEN_CHANNEL:
{
fragmentshaderstringstreamChannelMonitor << " vec4 color; color.x = 0.0; color.y = 0.5+dataRangeMultiplier*particleData.y; color.z = 0.0; color.w = 1.0; gl_FragColor = color;\n";
break;
}
case BLUE_CHANNEL:
{
fragmentshaderstringstreamChannelMonitor << " vec4 color; color.x = 0.0; color.y = 0.0; color.z = 0.5+dataRangeMultiplier*particleData.z; color.w = 0.0 ; gl_FragColor = color;\n";
break;
}
case ALPHA_CHANNEL:
{
fragmentshaderstringstreamChannelMonitor << " vec4 color; color.x = 0.5+dataRangeMultiplier*particleData.w; color.y = 0.5+dataRangeMultiplier*particleData.w; color.z = 0.5+dataRangeMultiplier*particleData.w; color.w = 0.5+0.5*particleData.w; gl_FragColor = color;\n";
break;
}
case RGB_CHANNEL:
{
fragmentshaderstringstreamChannelMonitor << " vec4 color; color.x = 0.5+dataRangeMultiplier*particleData.x; color.y = 0.5+dataRangeMultiplier*particleData.y; color.z = 0.5+dataRangeMultiplier*particleData.z; color.w = 1.0; gl_FragColor = color;\n";
break;
}
case RGBA_CHANNEL:
{
fragmentshaderstringstreamChannelMonitor << " vec4 color; color.x = 0.5+dataRangeMultiplier*particleData.x; color.y = 0.5+dataRangeMultiplier*particleData.y; color.z = 0.5+dataRangeMultiplier*particleData.z; color.w = 0.5+0.5*particleData.w; gl_FragColor = color;\n";
break;
}
}
fragmentshaderstringstreamChannelMonitor << "}\n";
osg::Program * program = new osg::Program;
program->addShader(new osg::Shader(osg::Shader::VERTEX, vertexShaderSrcChannelMonitor));
program->addShader(new osg::Shader(osg::Shader::FRAGMENT, fragmentshaderstringstreamChannelMonitor.str().c_str()));
program->addBindAttribLocation("tex_coords", 1);
osg::StateSet* ss = geom->getOrCreateStateSet();
ss->setAttributeAndModes(program, osg::StateAttribute::ON);
ss->addUniform(new osg::Uniform("numRows", (int)NUM_ELEMENTS_X));
ss->addUniform(new osg::Uniform("numCols", (int)NUM_ELEMENTS_Y));
ss->addUniform(new osg::Uniform("dataRangeMin", (float)minDataRange));
ss->addUniform(new osg::Uniform("dataRangeMax", (float)maxDataRange));
ss->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
//add a label
osg::ref_ptr<osgText::Text> text = new osgText::Text;
osg::ref_ptr<osgText::Font> font = osgText::readRefFontFile("fonts/arial.ttf");
text->setFont(font);
text->setColor(osg::Vec4(1, 1, 1, 1));
text->setCharacterSize(0.1*scale);
text->setPosition(placement + osg::Vec3(0.05, 0.05, 0));
pat->setName(labelCaption);
text->setText(pat->getName());
text->setBackdropType(osgText::Text::OUTLINE);
text->setBackdropImplementation(osgText::Text::POLYGON_OFFSET);
text->setBackdropOffset(0.05f);
text->setBackdropColor(osg::Vec4(0.0f, 0.0f, 0.0f, 1.0f));
quad->addDrawable(text);
pat->addChild(quad.get());
}
//compute texture image , taken from osgspotlight
osg::Image* createSpotLightImage(const osg::Vec4& centerColour, const osg::Vec4& backgroudColour, unsigned int size, float power)
{
osg::Image* image = new osg::Image;
image->allocateImage(size, size, 1,
GL_RGBA, GL_UNSIGNED_BYTE);
float mid = (float(size) - 1)*0.5f;
float div = 2.0f / float(size);
for (unsigned int r = 0; r < size; ++r)
{
unsigned char* ptr = image->data(0, r, 0);
for (unsigned int c = 0; c < size; ++c)
{
float dx = (float(c) - mid)*div;
float dy = (float(r) - mid)*div;
float r = powf(1.0f - sqrtf(dx*dx + dy*dy), power);
if (r < 0.0f) r = 0.0f;
osg::Vec4 color = centerColour*r + backgroudColour*(1.0f - r);
*ptr++ = (unsigned char)((color[0])*255.0f);
*ptr++ = (unsigned char)((color[1])*255.0f);
*ptr++ = (unsigned char)((color[2])*255.0f);
*ptr++ = (unsigned char)((color[3])*255.0f);
}
}
return image;
}
void ComputeNode::addComputationResultsRenderTree()
{
_computationResultsRenderProgram = new osg::Program;
_vertexShader = osg::Shader::readShaderFile(osg::Shader::VERTEX, _vertexShaderSourcePath);
_computationResultsRenderProgram->addShader(_vertexShader.get());
_geometryShader = osg::Shader::readShaderFile(osg::Shader::GEOMETRY, _geometryShaderSourcePath);
_computationResultsRenderProgram->addShader(_geometryShader.get());
_fragmentShader = osg::Shader::readShaderFile(osg::Shader::FRAGMENT, _fragmentShaderSourcePath);
_computationResultsRenderProgram->addShader(_fragmentShader.get());
_computationResultsRenderProgram->addBindAttribLocation("tex_coords", 1);
_computationResultsRenderGroup = new osg::Group;
_computationResultsRenderGroup->setDataVariance(osg::Object::DYNAMIC);
_computationResultsRenderStateSet = _computationResultsRenderGroup->getOrCreateStateSet();
_computationResultsRenderStateSet->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
osg::PointSprite *sprite = new osg::PointSprite;
int texture_unit = 0;
_computationResultsRenderStateSet->setTextureAttributeAndModes(texture_unit, sprite, osg::StateAttribute::ON);
_computationResultsRenderStateSet->setAttributeAndModes(_computationResultsRenderProgram.get(), osg::StateAttribute::ON);
_computationResultsRenderStateSet->addUniform(new osg::Uniform("particleTexture", texture_unit));
_computationResultsRenderStateSet->addUniform(new osg::Uniform("numRows", (int)NUM_ELEMENTS_X));
_computationResultsRenderStateSet->addUniform(new osg::Uniform("numCols", (int)NUM_ELEMENTS_Y));
_computationResultsRenderStateSet->setMode(GL_POINT_SMOOTH, osg::StateAttribute::ON);
_computationResultsRenderStateSet->setMode(GL_VERTEX_PROGRAM_POINT_SIZE_ARB, osg::StateAttribute::ON);
_computationResultsRenderStateSet->setMode(GL_ALPHA_TEST, osg::StateAttribute::ON);
_computationResultsRenderStateSet->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
osg::Texture2D *tex = new osg::Texture2D();
osg::Image* particleImage = createSpotLightImage(osg::Vec4(1, 0, 0, 1), osg::Vec4(0.5, 0, 0, 0.0), 32, 0.7);
if (particleImage)
{
tex->setImage(particleImage);
}
_computationResultsRenderStateSet->setTextureAttributeAndModes(texture_unit, tex, osg::StateAttribute::ON);
osg::BlendFunc *blend = new osg::BlendFunc;
if (false) //emissive particles
{
blend->setFunction(osg::BlendFunc::SRC_ALPHA, osg::BlendFunc::ONE);
}
else
{
blend->setFunction(osg::BlendFunc::SRC_ALPHA, osg::BlendFunc::ONE_MINUS_SRC_ALPHA);
}
_computationResultsRenderStateSet->setAttributeAndModes(blend, osg::StateAttribute::ON);
osg::Depth* depth = new osg::Depth;
depth->setRange(0.0f, 0.0f);
depth->setFunction(osg::Depth::ALWAYS);
depth->setWriteMask(false);
depth->setFunction(osg::Depth::ALWAYS);
_computationResultsRenderStateSet->setAttributeAndModes(depth, osg::StateAttribute::OFF);
osg::Geode* particleGeode = new osg::Geode;
unsigned int numVertices = NUM_ELEMENTS_X*NUM_ELEMENTS_Y;
osg::Geometry* particleGeometry = new osg::Geometry;
particleGeometry->setUseDisplayList(false);
particleGeometry->setUseVertexBufferObjects(true);
osg::Vec3Array* vertexarray = new osg::Vec3Array;
osg::Vec2Array* tcoords = new osg::Vec2Array;
osg::Vec2 bottom_texcoord(0.0f, 0.0f);
osg::Vec2 dx_texcoord(1.0f / (float)(NUM_ELEMENTS_X), 0.0f);
osg::Vec2 dy_texcoord(0.0f, 1.0f / (float)(NUM_ELEMENTS_Y));
for (int i = 0; i < NUM_ELEMENTS_X; i++)
{
osg::Vec2 texcoord = bottom_texcoord + dy_texcoord*(float)i;
for (int j = 0; j < NUM_ELEMENTS_Y; j++)
{
vertexarray->push_back(osg::Vec3(texcoord.x(), texcoord.y(), 0.0));
tcoords->push_back(osg::Vec2(texcoord.x(), texcoord.y()));
texcoord += dx_texcoord;
}
}
particleGeometry->setVertexArray(vertexarray);
particleGeometry->addPrimitiveSet(new osg::DrawArrays(GL_POINTS, 0, numVertices));
particleGeometry->setTexCoordArray(0, tcoords);
//this glMemoryBarrier thing... not sure if we could better do instanced drawing? all the data is in Shader Storage Buffer..
particleGeometry->setVertexAttribArray(1, particleGeometry->getTexCoordArray(0), osg::Array::BIND_PER_VERTEX);
_computationResultsRenderGroup->addChild(particleGeode);
particleGeode->addDrawable(particleGeometry);
addChild(_computationResultsRenderGroup.get());
}
void ComputeNode::initComputingSetup()
{
_computeProgram = new osg::Program;
_computeProgram->setComputeGroups((NUM_ELEMENTS_X / WORK_GROUP_SIZE) <= 1 ? 1 : (NUM_ELEMENTS_X / WORK_GROUP_SIZE), (NUM_ELEMENTS_Y / WORK_GROUP_SIZE) <= 1 ? 1 : (NUM_ELEMENTS_Y / WORK_GROUP_SIZE), 1);
_computeShader = osg::Shader::readShaderFile(osg::Shader::COMPUTE, _computeShaderSourcePath);
_computeProgram->addShader(_computeShader.get());
setDataVariance(osg::Object::DYNAMIC);
osg::StateSet* statesetComputation = getOrCreateStateSet();
statesetComputation->setAttributeAndModes(_computeProgram.get());
statesetComputation->addUniform(new osg::Uniform("numCols", (int)NUM_ELEMENTS_X));
statesetComputation->addUniform(new osg::Uniform("numRows", (int)NUM_ELEMENTS_Y));
statesetComputation->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
//blocksize
int numParticles = NUM_ELEMENTS_X * NUM_ELEMENTS_Y;
const unsigned blockSize = numParticles * __numChannels * __numDataValuesPerChannel* sizeof(GLfloat);
//init all the particle data array
int idx = 0;
_data = new GLfloat[NUM_ELEMENTS_X * NUM_ELEMENTS_Y * __numChannels * __numDataValuesPerChannel];
_dataArray = new FloatArray;
//init the data array somehow, this way all is stored in one BufferObject. maybe better using multiple buffers instead? not sure what is faster and better for threading
for (int d = 0; d < __numDataValuesPerChannel; ++d)
{
for (int i = 0; i < NUM_ELEMENTS_X; ++i)
{
for (int j = 0; j < NUM_ELEMENTS_Y; ++j)
{
for (int k = 0; k < __numChannels; ++k)
{
switch (k)
{
case (RED_CHANNEL) :
{
if ((d == POSITION_NOW_OFFSET) || (d == POSITION_OLD_OFFSET) || (d == POSITION_INIT_OFFSET))//position
{
*_data = random(0.25, 0.75);
}
if ((d == VELOCITY_NOW_OFFSET) || (d == VELOCITY_OLD_OFFSET) || (d == VELOCITY_INIT_OFFSET))//velocity
{
*_data = random(-2.4, 2.4);
}
if (d == ACCELERATION_OFFSET) //acceleration
{
*_data = random(-3.0, 3.0);
}
if (d == PROPERTIES_OFFSET) //property particle mass (compute shader is computing sphere mass from radius instead)
{
*_data = random(0.2, 15.0);
}
break;
}
case (GREEN_CHANNEL) :
{
if ((d == POSITION_NOW_OFFSET) || (d == POSITION_OLD_OFFSET) || (d == POSITION_INIT_OFFSET))//position
{
*_data = random(0.25, 0.75);
}
if ((d == VELOCITY_NOW_OFFSET) || (d == VELOCITY_OLD_OFFSET) || (d == VELOCITY_INIT_OFFSET))//velocity
{
*_data = random(-2.4, 2.4);
}
if (d == ACCELERATION_OFFSET)//acceleration
{
*_data = random(-3.0, 3.0);
}
if (d == PROPERTIES_OFFSET) //property particle radius
{
*_data = random(0.07, 0.219);
}
break;
}
case (BLUE_CHANNEL) :
{
if ((d == POSITION_NOW_OFFSET) || (d == POSITION_OLD_OFFSET) || (d == POSITION_INIT_OFFSET))//position
{
*_data = random(0.25, 0.75);
}
if ((d == VELOCITY_NOW_OFFSET) || (d == VELOCITY_OLD_OFFSET) || (d == VELOCITY_INIT_OFFSET))//velocity
{
*_data = random(-2.4, 2.4);
}
if (d == ACCELERATION_OFFSET)//acceleration
{
*_data = random(-3.0, 3.0);
}
if (d == PROPERTIES_OFFSET) //place for some other property
{
*_data = random(0.0, 0.0);
}
break;
}
case (ALPHA_CHANNEL) :
{
if ((d == POSITION_NOW_OFFSET) || (d == POSITION_OLD_OFFSET) || (d == POSITION_INIT_OFFSET))//position
{
*_data = random(1.0, 1.0);
}
if ((d == VELOCITY_NOW_OFFSET) || (d == VELOCITY_OLD_OFFSET) || (d == VELOCITY_INIT_OFFSET))//velocity
{
*_data = random(-2.4, 2.4);
}
if (d == ACCELERATION_OFFSET) //acceleration
{
//*_data = random(1.0, 1.0);
*_data = random(0.0, 0.0);
}
if (d == PROPERTIES_OFFSET) //place for some other property
{
*_data = random(0.3, 0.3);
}
break;
}
}
_dataArray->push_back(*_data);
_data++;
idx++;
}
}
}
}
_ssbo = new osg::ShaderStorageBufferObject;
_dataArray->setBufferObject(_ssbo.get());
_ssbb = new osg::ShaderStorageBufferBinding(0, _ssbo.get(), 0, blockSize);
statesetComputation->setAttributeAndModes(_ssbb.get(), osg::StateAttribute::ON);
//option, do something useful with data or test the transfer speed
//_ssbb->setUpdateCallback(new ShaderStorageBufferCallback);
//adding a quad , visualizing data in buffer
addDataMonitor(osg::Vec3(0, -1, 0), osg::Vec3(SUB_PLACEMENT_OFFSET_HORIZONTAL * 0, -SUB_PLACEMENT_OFFSET_VERTICAL * -2.0, SUB_PLACEMENT_OFFSET_HORIZONTAL * 0), 1.0, RGB_CHANNEL, POSITION_NOW_OFFSET, "X,Y,Z - PositionNow", -1.0, 1.0);
//the coord from default dataset
addHelperGeometry();
addComputationResultsRenderTree();
}
//taken from osgdistorsion example for getting it nice on screen with antialiasing
osg::Node* createPrerenderSubgraph(osg::Node* subgraph, const osg::Vec4& clearColour)
{
osg::Group* prerenderNode = new osg::Group;
unsigned int tex_width = PRERENDER_WIDTH;
unsigned int tex_height = PRERENDER_HEIGHT;
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);
{
osg::Camera* prerenderCamera = new osg::Camera;
prerenderCamera->setClearColor(clearColour);
prerenderCamera->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
prerenderCamera->setReferenceFrame(osg::Transform::RELATIVE_RF);
prerenderCamera->setProjectionMatrix(osg::Matrixd::identity());
prerenderCamera->setViewMatrix(osg::Matrixd::identity());
prerenderCamera->setViewport(0, 0, tex_width, tex_height);
prerenderCamera->setRenderOrder(osg::Camera::PRE_RENDER);
prerenderCamera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
prerenderCamera->attach(osg::Camera::COLOR_BUFFER0, texture, 0, 0, false, PRERENDER_ANTIALIASINGMULTISAMPLES, PRERENDER_ANTIALIASINGMULTISAMPLES);
prerenderCamera->addChild(subgraph);
prerenderNode->addChild(prerenderCamera);
}
{
osg::Geometry* polyGeom = new osg::Geometry();
polyGeom->setSupportsDisplayList(false);
osg::Vec3 origin(0.0f, 0.0f, 0.0f);
osg::Vec3 xAxis(1.0f, 0.0f, 0.0f);
osg::Vec3 yAxis(0.0f, 1.0f, 0.0f);
float height = 1024.0f;
float width = 1280.0f;
int noSteps = 3;
osg::Vec3Array* vertices = new osg::Vec3Array;
osg::Vec2Array* texcoords = new osg::Vec2Array;
osg::Vec4Array* colors = new osg::Vec4Array;
osg::Vec3 bottom = origin;
osg::Vec3 dx = xAxis*(width / ((float)(noSteps - 1)));
osg::Vec3 dy = yAxis*(height / ((float)(noSteps - 1)));
osg::Vec2 bottom_texcoord(0.0f, 0.0f);
osg::Vec2 dx_texcoord(1.0f / (float)(noSteps - 1), 0.0f);
osg::Vec2 dy_texcoord(0.0f, 1.0f / (float)(noSteps - 1));
int i, j;
for (i = 0; i < noSteps; ++i)
{
osg::Vec3 cursor = bottom + dy*(float)i;
osg::Vec2 texcoord = bottom_texcoord + dy_texcoord*(float)i;
for (j = 0; j < noSteps; ++j)
{
vertices->push_back(cursor);
texcoords->push_back(osg::Vec2((sin(texcoord.x()*osg::PI - osg::PI*0.5) + 1.0f)*0.5f, (sin(texcoord.y()*osg::PI - osg::PI*0.5) + 1.0f)*0.5f));
colors->push_back(osg::Vec4(1.0f, 1.0f, 1.0f, 1.0f));
cursor += dx;
texcoord += dx_texcoord;
}
}
polyGeom->setVertexArray(vertices);
polyGeom->setColorArray(colors, osg::Array::BIND_PER_VERTEX);
polyGeom->setTexCoordArray(0, texcoords);
for (i = 0; i < noSteps - 1; ++i)
{
osg::DrawElementsUShort* elements = new osg::DrawElementsUShort(osg::PrimitiveSet::QUAD_STRIP);
for (j = 0; j < noSteps; ++j)
{
elements->push_back(j + (i + 1)*noSteps);
elements->push_back(j + (i)*noSteps);
}
polyGeom->addPrimitiveSet(elements);
}
osg::StateSet* stateset = polyGeom->getOrCreateStateSet();
stateset->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON);
stateset->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
osg::Geode* geode = new osg::Geode();
geode->addDrawable(polyGeom);
osg::Camera* nestedRenderCamera = new osg::Camera;
nestedRenderCamera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
nestedRenderCamera->setViewMatrix(osg::Matrix::identity());
nestedRenderCamera->setProjectionMatrixAsOrtho2D(0, 1280, 0, 1024);
nestedRenderCamera->setRenderOrder(osg::Camera::NESTED_RENDER);
nestedRenderCamera->addChild(geode);
prerenderNode->addChild(nestedRenderCamera);
}
return prerenderNode;
}
int main(int argc, char** argv)
{
osg::ArgumentParser arguments(&argc, argv);
osgViewer::Viewer viewer;
osg::ref_ptr<osg::Group> scene = new osg::Group;
viewer.addEventHandler(new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()));
viewer.addEventHandler(new osgViewer::StatsHandler);
viewer.addEventHandler(new osgViewer::WindowSizeHandler);
viewer.addEventHandler(new osgViewer::ThreadingHandler);
viewer.getCamera()->setProjectionMatrixAsPerspective(60.0f, 1.33333, 0.01, 100.0);
viewer.setCameraManipulator(new osgGA::TrackballManipulator());
viewer.setUpViewInWindow(11, 11, 800 + 11, 600 + 11);
//viewer.setUpViewOnSingleScreen(0); // !!
viewer.getCamera()->setClearColor(osg::Vec4(0.3, 0.3, 0.3, 1.0));
viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded);// we can play with threading models later
osg::ref_ptr<ComputeNode> computeNode = new ComputeNode();
computeNode->setPosition(osg::Vec3(0, 0, 0));
computeNode->setUpdateCallback(new ComputeNodeUpdateCallback(computeNode.get())); // on-the-fly reloading the shaders if shader source on disk is changed
computeNode->initComputingSetup();
scene->addChild(computeNode.get());
scene->addChild(computeNode->_computationResultsRenderGroup.get());
#ifdef PRERENDER_HIGH_QUALITY_ANTIALIASING
viewer.setSceneData(createPrerenderSubgraph(scene.get(), osg::Vec4(0.3, 0.4, 0.6, 1)));
#else
viewer.setSceneData(scene.get());
#endif
viewer.realize();
viewer.getCamera()->getGraphicsContext()->getState()->setUseModelViewAndProjectionUniforms(true);
viewer.run();
return 1;
}

View File

@@ -56,18 +56,7 @@ public:
traverse(node);
}
void apply(osg::Geode& node)
{
if (!_useStateSets && node.getStateSet()) node.setStateSet(0);
for(unsigned int i = 0; i<node.getNumDrawables(); ++i)
{
process(*node.getDrawable(i));
}
traverse(node);
}
void process(osg::Drawable& drawable)
void apply(osg::Drawable& drawable)
{
if (!_useStateSets && drawable.getStateSet())
{
@@ -515,7 +504,7 @@ protected:
optimizeVertexOrder = false;
reallocateMemory = false;
modifyTextureSettings = false;
buildImageMipmaps = false;
compressImages = false;
@@ -535,22 +524,23 @@ protected:
bool optimizeVertexOrder;
bool reallocateMemory;
bool modifyTextureSettings;
bool buildImageMipmaps;
bool compressImages;
bool disableMipmaps;
};
//
//
class DatabasePagingOperation : public osg::Operation, public osgUtil::IncrementalCompileOperation::CompileCompletedCallback
{
public:
DatabasePagingOperation(const std::string& filename,
const std::string& outputFilename,
SceneGraphProcessor* sceneGraphProcessor,
SceneGraphProcessor* sceneGraphProcessor,
osgUtil::IncrementalCompileOperation* ico):
osg::Referenced(true),
Operation("DatabasePaging Operation", false),
_filename(filename),
_outputFilename(outputFilename),
@@ -565,7 +555,7 @@ public:
osg::notify(osg::NOTICE)<<"LoadAndCompileOperation "<<_filename<<std::endl;
_modelReadyToMerge = false;
_loadedModel = osgDB::readNodeFile(_filename);
_loadedModel = osgDB::readRefNodeFile(_filename);
if (_loadedModel.valid())
{
@@ -580,7 +570,7 @@ public:
if (!_outputFilename.empty())
{
OSG_NOTICE<<"Writing out file "<<_outputFilename<<std::endl;
osgDB::writeNodeFile(*_loadedModel, _outputFilename);
}
@@ -674,7 +664,7 @@ int main(int argc, char** argv)
{
apm->setTimeScale(animationSpeed);
apm->setAnimationCompletedCallback(new ReportStatsAnimationCompletedCallback());
unsigned int num = keyswitchManipulator->getNumMatrixManipulators();
keyswitchManipulator->addMatrixManipulator( keyForAnimationPath, "Path", apm );
keyswitchManipulator->selectMatrixManipulator(num);
@@ -685,7 +675,7 @@ int main(int argc, char** argv)
viewer.setCameraManipulator( keyswitchManipulator.get() );
}
// set up event handlers
// set up event handlers
{
viewer.addEventHandler( new osgViewer::StatsHandler());
viewer.addEventHandler( new osgViewer::WindowSizeHandler() );
@@ -807,7 +797,7 @@ int main(int argc, char** argv)
if (databasePagingOperation.get() && databasePagingOperation->_modelReadyToMerge)
{
OSG_NOTICE<<"Merging subgraph"<<std::endl;
timeOfLastMerge = currentTime;
group->removeChildren(0,group->getNumChildren());

View File

@@ -136,9 +136,9 @@ osg::Node* createMovingModel(const osg::Vec3& center, float radius)
osg::AnimationPath* animationPath = createAnimationPath(center,radius,animationLength);
osg::Group* model = new osg::Group;
osg::ref_ptr<osg::Group> model = new osg::Group;
osg::Node* glider = osgDB::readNodeFile("glider.osgt");
osg::ref_ptr<osg::Node> glider = osgDB::readRefNodeFile("glider.osgt");
if (glider)
{
const osg::BoundingSphere& bs = glider->getBound();
@@ -159,7 +159,7 @@ osg::Node* createMovingModel(const osg::Vec3& center, float radius)
model->addChild(xform);
}
osg::Node* cessna = osgDB::readNodeFile("cessna.osgt");
osg::ref_ptr<osg::Node> cessna = osgDB::readRefNodeFile("cessna.osgt");
if (cessna)
{
const osg::BoundingSphere& bs = cessna->getBound();
@@ -173,26 +173,26 @@ osg::Node* createMovingModel(const osg::Vec3& center, float radius)
positioned->addChild(cessna);
osg::MatrixTransform* xform = new osg::MatrixTransform;
osg::ref_ptr<osg::MatrixTransform> xform = new osg::MatrixTransform;
xform->setUpdateCallback(new osg::AnimationPathCallback(animationPath,0.0f,2.0));
xform->addChild(positioned);
model->addChild(xform);
}
return model;
return model.release();
}
osg::Node* createModel(bool overlay, osgSim::OverlayNode::OverlayTechnique technique)
osg::ref_ptr<osg::Group> createModel(bool overlay, osgSim::OverlayNode::OverlayTechnique technique)
{
osg::Vec3 center(0.0f,0.0f,0.0f);
float radius = 100.0f;
osg::Group* root = new osg::Group;
osg::ref_ptr<osg::Group> root = new osg::Group;
float baseHeight = center.z()-radius*0.5;
osg::Node* baseModel = createBase(osg::Vec3(center.x(), center.y(), baseHeight),radius);
osg::Node* movingModel = createMovingModel(center,radius*0.8f);
osg::ref_ptr<osg::Node> baseModel = createBase(osg::Vec3(center.x(), center.y(), baseHeight),radius);
osg::ref_ptr<osg::Node> movingModel = createMovingModel(center,radius*0.8f);
if (overlay)
{
@@ -232,14 +232,14 @@ int main( int argc, char **argv )
osgViewer::Viewer viewer;
// load the nodes from the commandline arguments.
osg::Node* model = createModel(overlay, technique);
osg::ref_ptr<osg::Group> model = createModel(overlay, technique);
if (!model)
{
return 1;
}
// tilt the scene so the default eye position is looking down on the model.
osg::MatrixTransform* rootnode = new osg::MatrixTransform;
osg::ref_ptr<osg::MatrixTransform> rootnode = new osg::MatrixTransform;
rootnode->setMatrix(osg::Matrix::rotate(osg::inDegrees(30.0f),1.0f,0.0f,0.0f));
rootnode->addChild(model);

View File

@@ -1,14 +1,14 @@
/* -*-c++-*-
/* -*-c++-*-
* Copyright (C) 2009 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.
*/
@@ -110,7 +110,7 @@ struct MyRigTransformHardware : public osgAnimation::RigTransformHardware
osg::notify(osg::INFO) << "set vertex attrib " << ss.str() << std::endl;
}
}
}
for (int i = 0; i < nbAttribs; i++)
{
std::stringstream ss;
@@ -134,7 +134,7 @@ struct SetupRigGeometry : public osg::NodeVisitor
{
bool _hardware;
SetupRigGeometry( bool hardware = true) : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN), _hardware(hardware) {}
void apply(osg::Geode& geode)
{
for (unsigned int i = 0; i < geode.getNumDrawables(); i++)
@@ -173,7 +173,7 @@ osg::Group* createCharacterInstance(osg::Group* character, bool hardware)
anim->playAnimation(list[v].get());
v = (v + 1)%list.size();
}
anim->playAnimation(list[v].get());
SetupRigGeometry switcher(hardware);
@@ -196,9 +196,9 @@ int main (int argc, char* argv[])
while (psr.read("--software")) { hardware = false; }
while (psr.read("--number", maxChar)) {}
osg::ref_ptr<osg::Group> root = dynamic_cast<osg::Group*>(osgDB::readNodeFiles(psr));
if (!root)
osg::ref_ptr<osg::Node> node = osgDB::readRefNodeFiles(psr);
osg::ref_ptr<osg::Group> root = dynamic_cast<osg::Group*>(node.get());
if (!root)
{
std::cout << psr.getApplicationName() <<": No data loaded" << std::endl;
return 1;
@@ -206,7 +206,7 @@ int main (int argc, char* argv[])
{
osgAnimation::AnimationManagerBase* animationManager = dynamic_cast<osgAnimation::AnimationManagerBase*>(root->getUpdateCallback());
if(!animationManager)
if(!animationManager)
{
osg::notify(osg::FATAL) << "no AnimationManagerBase found, updateCallback need to animate elements" << std::endl;
return 1;
@@ -218,13 +218,13 @@ int main (int argc, char* argv[])
// 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);

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.
*/
@@ -33,11 +33,11 @@ struct GeometryFinder : public osg::NodeVisitor
{
osg::ref_ptr<osg::Geometry> _geom;
GeometryFinder() : osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}
void apply(osg::Geode& geode)
void apply(osg::Geode& geode)
{
if (_geom.valid())
return;
for (unsigned int i = 0; i < geode.getNumDrawables(); i++)
for (unsigned int i = 0; i < geode.getNumDrawables(); i++)
{
osg::Geometry* geom = dynamic_cast<osg::Geometry*>(geode.getDrawable(i));
if (geom) {
@@ -50,7 +50,7 @@ struct GeometryFinder : public osg::NodeVisitor
osg::ref_ptr<osg::Geometry> getShape(const std::string& name)
{
osg::ref_ptr<osg::Node> shape0 = osgDB::readNodeFile(name);
osg::ref_ptr<osg::Node> shape0 = osgDB::readRefNodeFile(name);
if (shape0)
{
GeometryFinder finder;
@@ -104,7 +104,7 @@ int main (int argc, char* argv[])
osg::Group* scene = new osg::Group;
scene->addUpdateCallback(bam);
osg::Geode* geode = new osg::Geode;
geode->addDrawable(morph);
geode->addUpdateCallback(new osgAnimation::UpdateMorph("MorphNodeCallback"));

View File

@@ -71,7 +71,7 @@ int main (int argc, char* argv[])
osg::ref_ptr<osg::Geode> geode = new osg::Geode;
geode->addDrawable(new osg::ShapeDrawable(new osg::Box(osg::Vec3(0.0f,0.0f,0.0f),0.5)));
//Tranformation to be manipulated by the animation
//Transformation to be manipulated by the animation
osg::ref_ptr<osg::MatrixTransform> trans = new osg::MatrixTransform();
trans->setName("AnimatedNode");
//Dynamic object, has to be updated during update traversal
@@ -84,7 +84,7 @@ int main (int argc, char* argv[])
//The second element modifies the rotation around x-axis
updatecb->getStackedTransforms().push_back(new osgAnimation::StackedTranslateElement("position"));
updatecb->getStackedTransforms().push_back(new osgAnimation::StackedRotateAxisElement("euler",osg::Vec3(1,0,0),0));
//connect the UpdateMatrixTransform callback to the MatrixTRanform
//connect the UpdateMatrixTransform callback to the MatrixTransform
trans->setUpdateCallback(updatecb);
//initialize MatrixTranform
trans->setMatrix(osg::Matrix::identity());
@@ -102,7 +102,7 @@ int main (int argc, char* argv[])
//add the rest of the scene to the grp node
grp->addChild(root);
// And we finaly define our channel for linear Vector interpolation
// And we finally define our channel for linear Vector interpolation
osgAnimation::Vec3LinearChannel* channelAnimation1 = new osgAnimation::Vec3LinearChannel;
//name of the AnimationUpdateCallback
channelAnimation1->setTargetName("AnimatedCallback");

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.
*/
@@ -84,7 +84,7 @@ struct ExampleTimelineUsage : public osgGA::GUIEventHandler
_scratchNose->setLoop(1); // one time
// add the main loop at priority 0 at time 0.
osgAnimation::Timeline* tml = _manager->getTimeline();
tml->play();
tml->addActionAt(0.0, _mainLoop.get(), 0);
@@ -98,9 +98,9 @@ struct ExampleTimelineUsage : public osgGA::GUIEventHandler
{
// we add a scratch head priority 1 each 10 second
// note:
// it's possible to add the same instance more then once on the timeline
// it's possible to add the same instance more than once on the timeline
// the only things you need to take care is if you remove it. It will remove
// all instance that exist on the timeline. If you need to differtiate
// all instance that exist on the timeline. If you need to differentiate
// it's better to create a new instance
tml->addActionAt(5.0 + 10.0 * i, _scratchHead.get(), 1);
}
@@ -139,21 +139,12 @@ struct ExampleTimelineUsage : public osgGA::GUIEventHandler
}
_releaseKey = false;
}
traverse(node, nv);
}
else
{
osgGA::EventVisitor* ev = dynamic_cast<osgGA::EventVisitor*>(nv);
if (ev && ev->getActionAdapter() && !ev->getEvents().empty())
{
for(osgGA::EventQueue::Events::iterator itr = ev->getEvents().begin();
itr != ev->getEvents().end();
++itr)
{
handleWithCheckAgainstIgnoreHandledEventsMask(*(*itr), *(ev->getActionAdapter()), node, nv);
}
}
}
traverse(node, nv);
osgGA::GUIEventHandler::operator()(node, nv);
}
}
};
@@ -168,17 +159,18 @@ int main (int argc, char* argv[])
osgViewer::Viewer viewer(psr);
std::string file = "nathan.osg";
if(argc >= 2)
if(argc >= 2)
file = psr[1];
// replace the manager
osg::Group* root = dynamic_cast<osg::Group*>(osgDB::readNodeFile(file));
osg::ref_ptr<osg::Node> loadedmodel = osgDB::readRefNodeFile(file);
osg::Group* root = dynamic_cast<osg::Group*>(loadedmodel.get());
if (!root) {
osg::notify(osg::FATAL) << "can't read file " << file << std::endl;
return 1;
}
osgAnimation::AnimationManagerBase* animationManager = dynamic_cast<osgAnimation::AnimationManagerBase*>(root->getUpdateCallback());
if(!animationManager)
if(!animationManager)
{
osg::notify(osg::FATAL) << "Did not find AnimationManagerBase updateCallback needed to animate elements" << std::endl;
return 1;
@@ -186,22 +178,22 @@ int main (int argc, char* argv[])
osg::ref_ptr<osgAnimation::TimelineAnimationManager> tl = new osgAnimation::TimelineAnimationManager(*animationManager);
root->setUpdateCallback(tl.get());
ExampleTimelineUsage* callback = new ExampleTimelineUsage(tl.get());
root->setEventCallback(callback);
root->getUpdateCallback()->addNestedCallback(callback);
// 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);

View File

@@ -24,6 +24,7 @@
#include <osg/Geometry>
#include <osg/MatrixTransform>
#include <osg/Geode>
#include <osgDB/FileNameUtils>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgWidget/ViewerEventHandlers>
@@ -126,7 +127,8 @@ int main(int argc, char** argv)
osgViewer::Viewer viewer(arguments);
osg::ref_ptr<osg::Group> group = new osg::Group();
osg::Group* node = dynamic_cast<osg::Group*>(osgDB::readNodeFiles(arguments)); //dynamic_cast<osgAnimation::AnimationManager*>(osgDB::readNodeFile(psr[1]));
osg::ref_ptr<osg::Node> loadedmodel = osgDB::readRefNodeFiles(arguments);
osg::Group* node = dynamic_cast<osg::Group*>(loadedmodel.get());
if(!node)
{
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
@@ -136,10 +138,30 @@ int main(int argc, char** argv)
// Set our Singleton's model.
AnimationManagerFinder finder;
node->accept(finder);
if (finder._am.valid()) {
if (finder._am.valid())
{
std::string playModeOpt;
if (arguments.read("--play-mode", playModeOpt))
{
osgAnimation::Animation::PlayMode playMode = osgAnimation::Animation::LOOP;
if (osgDB::equalCaseInsensitive(playModeOpt, "ONCE")) playMode = osgAnimation::Animation::ONCE;
else if (osgDB::equalCaseInsensitive(playModeOpt, "STAY")) playMode = osgAnimation::Animation::STAY;
else if (osgDB::equalCaseInsensitive(playModeOpt, "LOOP")) playMode = osgAnimation::Animation::LOOP;
else if (osgDB::equalCaseInsensitive(playModeOpt, "PPONG")) playMode = osgAnimation::Animation::PPONG;
for (osgAnimation::AnimationList::const_iterator animIter = finder._am->getAnimationList().begin();
animIter != finder._am->getAnimationList().end(); ++animIter)
{
(*animIter)->setPlayMode(playMode);
}
}
node->setUpdateCallback(finder._am.get());
AnimtkViewerModelController::setModel(finder._am.get());
} else {
}
else
{
osg::notify(osg::WARN) << "no osgAnimation::AnimationManagerBase found in the subgraph, no animations available" << std::endl;
}

View File

@@ -165,7 +165,7 @@ int main(int argc, char** argv)
viewer.addEventHandler(new osgViewer::ScreenCaptureHandler);
// load the data
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles(arguments);
if (!loadedModel)
{
osg::Geometry * quad = osg::createTexturedQuadGeometry(osg::Vec3f(-2.0f, 0.0f, -2.0f),

View File

@@ -28,7 +28,7 @@
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgViewer/Renderer>
#include <iostream>
#include <sstream>
@@ -41,7 +41,7 @@ public:
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN),
_foundNode(0)
{}
void apply(osg::Node& node)
{
T* result = dynamic_cast<T*>(&node);
@@ -50,7 +50,7 @@ public:
else
traverse(node);
}
T* _foundNode;
};
@@ -62,21 +62,21 @@ T* findTopMostNodeOfType(osg::Node* node)
FindTopMostNodeOfTypeVisitor<T> fnotv;
node->accept(fnotv);
return fnotv._foundNode;
}
/** Capture the frame buffer and write image to disk*/
class WindowCaptureCallback : public osg::Camera::DrawCallback
{
public:
public:
WindowCaptureCallback(GLenum readBuffer, const std::string& name):
_readBuffer(readBuffer),
_fileName(name)
{
_image = new osg::Image;
}
virtual void operator () (osg::RenderInfo& renderInfo) const
{
#if !defined(OSG_GLES1_AVAILABLE) && !defined(OSG_GLES2_AVAILABLE)
@@ -93,9 +93,9 @@ public:
if (gc->getTraits()->alpha)
pixelFormat = GL_RGBA;
else
else
pixelFormat = GL_RGB;
#if defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE)
if (pixelFormat == GL_RGB)
{
@@ -118,7 +118,7 @@ public:
_image->readPixels(0, 0, width, height, pixelFormat, GL_UNSIGNED_BYTE);
}
if (!_fileName.empty())
{
std::cout << "Writing to: " << _fileName << std::endl;
@@ -126,7 +126,7 @@ public:
}
}
protected:
protected:
GLenum _readBuffer;
std::string _fileName;
osg::ref_ptr<osg::Image> _image;
@@ -138,7 +138,7 @@ protected:
class CustomRenderer : public osgViewer::Renderer
{
public:
CustomRenderer(osg::Camera* camera)
CustomRenderer(osg::Camera* camera)
: osgViewer::Renderer(camera),
_cullOnly(true)
{
@@ -162,19 +162,19 @@ public:
{
osgUtil::SceneView* sceneView = _sceneView[0].get();
if (!sceneView || _done ) return;
updateSceneView(sceneView);
osgViewer::View* view = dynamic_cast<osgViewer::View*>(_camera->getView());
if (view) sceneView->setFusionDistance(view->getFusionDistanceMode(), view->getFusionDistanceValue());
sceneView->inheritCullSettings(*(sceneView->getCamera()));
sceneView->cull();
}
bool _cullOnly;
};
//===============================================================
// MAIN
@@ -287,8 +287,8 @@ int main( int argc, char **argv )
}
// load the data
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
if (!loadedModel)
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles(arguments);
if (!loadedModel)
{
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
return 1;
@@ -309,7 +309,7 @@ int main( int argc, char **argv )
{
osg::CoordinateSystemNode* csn = findTopMostNodeOfType<osg::CoordinateSystemNode>(loadedModel.get());
if(!csn) return 1;
// Compute eye point in world coordiantes
osg::Vec3d eye;
csn->getEllipsoidModel()->convertLatLongHeightToXYZ(lat, lon, alt, eye.x(), eye.y(), eye.z());
@@ -331,11 +331,11 @@ int main( int argc, char **argv )
osg::Vec3d up_cross_tangent = up ^ tangent;
osg::Matrixd incline_matrix = osg::Matrixd::rotate(incline, up_cross_tangent);
osg::Vec3d target = incline_matrix.preMult(tangent);
// Roll by rotating the up vector around the target vector ...
osg::Matrixd roll_matrix = incline_matrix * osg::Matrixd::rotate(roll, target);
up = roll_matrix.preMult(up);
viewer.getCamera()->setViewMatrixAsLookAt(eye, eye+target, up);
}
else
@@ -349,10 +349,10 @@ int main( int argc, char **argv )
keyswitchManipulator->addMatrixManipulator( '3', "Drive", new osgGA::DriveManipulator() );
keyswitchManipulator->addMatrixManipulator( '4', "Terrain", new osgGA::TerrainManipulator() );
viewer.setCameraManipulator( keyswitchManipulator.get() );
viewer.setCameraManipulator( keyswitchManipulator.get() );
}
// Optimize DatabasePager for auto-capture
osgDB::DatabasePager* pager = viewer.getDatabasePager();
pager->setDoPreCompile(false);
@@ -374,9 +374,9 @@ int main( int argc, char **argv )
// Initiate the first PagedLOD request
viewer.frame();
osg::Timer_t beforeLoadTick = osg::Timer::instance()->tick();
// Keep updating and culling until full level of detail is reached
while(!viewer.done() && pager->getRequestsInProgress())
{
@@ -385,14 +385,14 @@ int main( int argc, char **argv )
viewer.renderingTraversals();
}
// std::cout<<std::endl;
osg::Timer_t afterLoadTick = osg::Timer::instance()->tick();
std::cout<<"Load and Compile time = "<<osg::Timer::instance()->delta_s(beforeLoadTick, afterLoadTick)<<" seconds"<<std::endl;
// Do cull and draw to render the scene correctly
customRenderer->setCullOnly(false);
//--- Capture the image!!! ---
if (!activeMode)
{
@@ -406,7 +406,7 @@ int main( int argc, char **argv )
viewer.renderingTraversals();
osg::Timer_t afterRenderTick = osg::Timer::instance()->tick();
std::cout<<"Rendring time = "<<osg::Timer::instance()->delta_s(beforeRenderTick, afterRenderTick) <<" seconds"<<std::endl;
std::cout<<"Rendering time = "<<osg::Timer::instance()->delta_s(beforeRenderTick, afterRenderTick) <<" seconds"<<std::endl;
return 0;
}

View File

@@ -42,10 +42,10 @@
typedef std::vector< osg::ref_ptr<osg::Image> > ImageList;
/** create quad at specified position. */
osg::Drawable* createSquare(const osg::Vec3& corner,const osg::Vec3& width,const osg::Vec3& height, osg::Image* image=NULL)
osg::Drawable* createSquare(const osg::Vec3& corner,const osg::Vec3& width,const osg::Vec3& height, osg::ref_ptr<osg::Image> image)
{
// set up the Geometry.
osg::Geometry* geom = new osg::Geometry;
osg::ref_ptr<osg::Geometry> geom = new osg::Geometry;
osg::Vec3Array* coords = new osg::Vec3Array(4);
(*coords)[0] = corner;
@@ -80,13 +80,13 @@ osg::Drawable* createSquare(const osg::Vec3& corner,const osg::Vec3& width,const
geom->setStateSet(stateset);
}
return geom;
return geom.release();
}
osg::Drawable* createAxis(const osg::Vec3& corner,const osg::Vec3& xdir,const osg::Vec3& ydir,const osg::Vec3& zdir)
{
// set up the Geometry.
osg::Geometry* geom = new osg::Geometry;
osg::ref_ptr<osg::Geometry> geom = new osg::Geometry;
osg::Vec3Array* coords = new osg::Vec3Array(6);
(*coords)[0] = corner;
@@ -121,20 +121,20 @@ osg::Drawable* createAxis(const osg::Vec3& corner,const osg::Vec3& xdir,const os
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
geom->setStateSet(stateset);
return geom;
return geom.release();
}
osg::Node* createModel()
osg::ref_ptr<osg::Node> createModel()
{
// create the root node which will hold the model.
osg::Group* root = new osg::Group();
osg::ref_ptr<osg::Group> root = new osg::Group();
// add the drawable into a single goede to be shared...
// add the drawable into a single geode to be shared...
osg::Billboard* center = new osg::Billboard();
center->setMode(osg::Billboard::POINT_ROT_EYE);
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")),
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::readRefImageFile("Images/reflect.rgb")),
osg::Vec3(0.0f,0.0f,0.0f));
osg::Billboard* x_arrow = new osg::Billboard();
@@ -142,7 +142,7 @@ osg::Node* createModel()
x_arrow->setAxis(osg::Vec3(1.0f,0.0f,0.0f));
x_arrow->setNormal(osg::Vec3(0.0f,-1.0f,0.0f));
x_arrow->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("Cubemap_axis/posx.png")),
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::readRefImageFile("Cubemap_axis/posx.png")),
osg::Vec3(5.0f,0.0f,0.0f));
osg::Billboard* y_arrow = new osg::Billboard();
@@ -150,7 +150,7 @@ osg::Node* createModel()
y_arrow->setAxis(osg::Vec3(0.0f,1.0f,0.0f));
y_arrow->setNormal(osg::Vec3(1.0f,0.0f,0.0f));
y_arrow->addDrawable(
createSquare(osg::Vec3(0.0f,-0.5f,-0.5f),osg::Vec3(0.0f,1.0f,0.0f),osg::Vec3(0.0f,0.0f,1.0f),osgDB::readImageFile("Cubemap_axis/posy.png")),
createSquare(osg::Vec3(0.0f,-0.5f,-0.5f),osg::Vec3(0.0f,1.0f,0.0f),osg::Vec3(0.0f,0.0f,1.0f),osgDB::readRefImageFile("Cubemap_axis/posy.png")),
osg::Vec3(0.0f,5.0f,0.0f));
osg::Billboard* z_arrow = new osg::Billboard();
@@ -158,7 +158,7 @@ osg::Node* createModel()
z_arrow->setAxis(osg::Vec3(0.0f,0.0f,1.0f));
z_arrow->setNormal(osg::Vec3(0.0f,-1.0f,0.0f));
z_arrow->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("Cubemap_axis/posz.png")),
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::readRefImageFile("Cubemap_axis/posz.png")),
osg::Vec3(0.0f,0.0f,5.0f));

View File

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

View File

@@ -0,0 +1,155 @@
/* OpenSceneGraph example, osgblenddrawbuffers.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <osg/Geometry>
#include <osg/Geode>
#include <osg/Camera>
#include <osg/Texture2D>
#include <osg/BlendFunci>
#include <osg/ColorMaski>
#include <osg/Capability>
#include <osgDB/ReadFile>
#include <osgViewer/Viewer>
#include <iostream>
osg::Camera* createMRTCamera( std::vector<osg::Texture*>& attachedTextures )
{
osg::ref_ptr<osg::Camera> camera = new osg::Camera;
camera->setClearColor( osg::Vec4(0.0f, 0.0f, 0.0f, 1.0f) );
camera->setClearMask( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT );
camera->setRenderTargetImplementation( osg::Camera::FRAME_BUFFER_OBJECT );
camera->setRenderOrder( osg::Camera::PRE_RENDER );
for ( int i=0; i<4; ++i )
{
osg::Texture2D* tex = new osg::Texture2D;
tex->setTextureSize( 1024, 1024 );
tex->setInternalFormat( GL_RGBA );
tex->setFilter( osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR );
tex->setFilter( osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR );
attachedTextures.push_back( tex );
camera->setViewport( 0, 0, tex->getTextureWidth(), tex->getTextureHeight() );
camera->attach( osg::Camera::BufferComponent(osg::Camera::COLOR_BUFFER0+i), tex );
}
return camera.release();
}
osg::Camera* createHUDCamera( double left, double right, double bottom, double top )
{
osg::ref_ptr<osg::Camera> camera = new osg::Camera;
camera->setReferenceFrame( osg::Transform::ABSOLUTE_RF );
camera->setClearMask( GL_DEPTH_BUFFER_BIT );
camera->setRenderOrder( osg::Camera::POST_RENDER );
camera->setAllowEventFocus( false );
camera->setProjectionMatrix( osg::Matrix::ortho2D(left, right, bottom, top) );
camera->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
return camera.release();
}
int main( int argc, char **argv )
{
osg::ArgumentParser arguments(&argc, argv);
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName() + " is the example which demonstrates how to enable/disable blending on specified draw buffers in multi-rendering-target cases.");
std::vector<osg::Texture*> textures;
bool useGlobalBlending = false;
if ( arguments.read("--no-draw-buffers") ) useGlobalBlending = true;
osg::ref_ptr<osg::Node> cessna = osgDB::readRefNodeFile("cessna.osgt");
if (!cessna)
{
OSG_NOTICE<<"Cannot not find model 'cessna.osg' to render"<<std::endl;
return 1;
}
// Create a camera to output multi-rendering-targets (MRT)
osg::ref_ptr<osg::Camera> mrtCam = createMRTCamera( textures );
mrtCam->addChild( cessna );
// Create shader program to be used
const char* mrtFragmentCode = {
"void main() {\n"
" gl_FragData[0] = gl_Color * vec4(1.0, 1.0, 1.0, 0.7);\n"
" gl_FragData[1] = vec4(0.0, 1.0, 1.0, 0.0);\n"
" gl_FragData[2] = vec4(1.0, 0.0, 1.0, 0.3);\n"
" gl_FragData[3] = vec4(1.0, 1.0, 0.0, 1.0);\n"
"}\n"
};
osg::ref_ptr<osg::Program> program = new osg::Program;
program->addShader( new osg::Shader(osg::Shader::FRAGMENT, mrtFragmentCode) );
osg::ref_ptr<osg::StateSet> ss = mrtCam->getOrCreateStateSet();
ss->setAttributeAndModes( program );
// Apply blending to the original scene in MRT
if ( !useGlobalBlending )
{
// Only enable blending on the first draw buffer so other three outputs are
// totally opaque, which is important for MRT cases
ss->setAttribute( new osg::Enablei(GL_BLEND, 0) );
ss->setAttribute( new osg::Disablei(GL_BLEND, 1) );
ss->setAttribute( new osg::Disablei(GL_BLEND, 2) );
ss->setAttribute( new osg::Disablei(GL_BLEND, 3) );
// Accept different blend/colormask attributes on multiple render targets
osg::ref_ptr<osg::BlendFunci> blend0 = new osg::BlendFunci(0, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
osg::ref_ptr<osg::ColorMaski> colormask3 = new osg::ColorMaski(3, false, true, false, true);
ss->setAttribute( blend0 );
ss->setAttributeAndModes( colormask3 );
}
else
{
// When separated blending is disabled, all rendering targets will be affected
// by its alpha channel and you will see each output blended with the background.
//
// This causes a big program in situations like deferred shading because we may
// have to save different scene data to MRT 'GBuffer', in which alpha channels are
// used to store certain attributes rather than opacity. These attributes can be
// reused in following post-processing steps.
//
// For such targets, alpha blending must be disabled; otherwise it will mess the
// output. That is why this example exists!
osg::ref_ptr<osg::BlendFunc> blend = new osg::BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
ss->setAttributeAndModes( blend.get() );
}
// Create some quads to be shown on screen to contain the MRT result
osg::ref_ptr<osg::Geode> quad = new osg::Geode;
for ( unsigned int i=0; i<textures.size(); ++i )
{
osg::Geometry* geom = osg::createTexturedQuadGeometry(
osg::Vec3((float)i/(float)textures.size(), 0.0f, 0.0f),
osg::Vec3(1.0f/(float)textures.size()-0.01f,0.0f,0.0f), osg::Vec3(0.0f,1.0f,0.0f) );
geom->getOrCreateStateSet()->setTextureAttributeAndModes( 0, textures[i] );
quad->addDrawable( geom );
}
osg::Camera* hudCam = createHUDCamera( 0.0, 1.0, 0.0, 1.0 );
hudCam->addChild( quad.get() );
// Construct scene graph and viewer
osg::ref_ptr<osg::Group> root = new osg::Group;
root->addChild( mrtCam );
root->addChild( hudCam );
osgViewer::Viewer viewer;
viewer.setSceneData( root.get() );
return viewer.run();
}

View File

@@ -82,7 +82,7 @@ protected:
bool TechniqueEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&)
{
switch(ea.getEventType())
@@ -104,7 +104,7 @@ bool TechniqueEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAc
_eq_index--;
if (_eq_index<0) _eq_index=_eq_nb-1;
_blendEq->setEquation(_equations[_eq_index]);
std::cout<<"Operation name = "<<_equations_name[_eq_index]<<std::endl;
std::cout<<"Equation name = "<<_equations_name[_eq_index]<<std::endl;
return true;
}
return false;
@@ -134,36 +134,36 @@ int main( int argc, char **argv )
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates how to use glBlendEquation for mixing rendered scene and the frame-buffer.");
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
// construct the viewer.
osgViewer::Viewer viewer;
// load the nodes from the commandline arguments.
osg::Node* loadedModel = osgDB::readNodeFiles(arguments);
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles(arguments);
// if not loaded assume no arguments passed in, try use default mode instead.
if (!loadedModel) loadedModel = osgDB::readNodeFile("cessnafire.osgt");
if (!loadedModel) loadedModel = osgDB::readRefNodeFile("cessnafire.osgt");
if (!loadedModel)
{
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
return 1;
}
osg::Group* root = new osg::Group;
osg::ref_ptr<osg::Group> root = new osg::Group;
root->addChild(loadedModel);
osg::StateSet* stateset = new osg::StateSet;
osg::ref_ptr<osg::StateSet> stateset = new osg::StateSet;
stateset->setDataVariance(osg::Object::DYNAMIC);
osg::BlendEquation* blendEquation = new osg::BlendEquation(osg::BlendEquation::FUNC_ADD);
blendEquation->setDataVariance(osg::Object::DYNAMIC);
stateset->setAttributeAndModes(blendEquation,osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);
//tell to sort the mesh before displaying it
stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
loadedModel->setStateSet(stateset);
@@ -171,6 +171,6 @@ int main( int argc, char **argv )
// add a viewport to the viewer and attach the scene graph.
viewer.setSceneData( root );
return viewer.run();
}

View File

@@ -38,7 +38,7 @@
class UpdateCallback : public osg::NodeCallback
{
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
{
std::cout<<"update callback - pre traverse"<<node<<std::endl;
traverse(node,nv);
std::cout<<"update callback - post traverse"<<node<<std::endl;
@@ -48,7 +48,7 @@ class UpdateCallback : public osg::NodeCallback
class CullCallback : public osg::NodeCallback
{
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
{
std::cout<<"cull callback - pre traverse"<<node<<std::endl;
traverse(node,nv);
std::cout<<"cull callback - post traverse"<<node<<std::endl;
@@ -87,11 +87,11 @@ class InsertCallbacksVisitor : public osg::NodeVisitor
{
public:
InsertCallbacksVisitor():osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN)
{
}
virtual void apply(osg::Node& node)
{
node.setUpdateCallback(new UpdateCallback());
@@ -102,7 +102,7 @@ class InsertCallbacksVisitor : public osg::NodeVisitor
virtual void apply(osg::Geode& geode)
{
geode.setUpdateCallback(new UpdateCallback());
//note, it makes no sense to attach a cull callback to the node
//at there are no nodes to traverse below the geode, only
//drawables, and as such the Cull node callbacks is ignored.
@@ -116,7 +116,7 @@ class InsertCallbacksVisitor : public osg::NodeVisitor
geode.getDrawable(i)->setDrawCallback(new DrawableDrawCallback());
}
}
virtual void apply(osg::Transform& node)
{
apply((osg::Node&)node);
@@ -140,7 +140,7 @@ public:
class CameraUpdateCallback : public osg::NodeCallback
{
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
{
std::cout<<"Camera update callback - pre traverse"<<node<<std::endl;
traverse(node,nv);
std::cout<<"Camera update callback - post traverse"<<node<<std::endl;
@@ -150,50 +150,131 @@ class CameraUpdateCallback : public osg::NodeCallback
class CameraEventCallback : public osg::NodeCallback
{
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
{
std::cout<<"Camera event callback - pre traverse"<<node<<std::endl;
traverse(node,nv);
std::cout<<"Camera event callback - post traverse"<<node<<std::endl;
}
};
struct TestDrawableUpdateCallback : public osg::Drawable::UpdateCallback
{
TestDrawableUpdateCallback(const std::string &message): _message(message) {}
virtual void update(osg::NodeVisitor*, osg::Drawable* drw) {
printf("%s\n", _message.c_str());
}
std::string _message;
};
struct TestNodeUpdateCallback : public osg::NodeCallback
{
TestNodeUpdateCallback(const std::string &message): _message(message) {}
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv) {
printf("%s\n", _message.c_str());
}
std::string _message;
};
int main( int argc, char **argv )
{
// use an ArgumentParser object to manage the program arguments.
osg::ArgumentParser arguments(&argc,argv);
// set the osgDB::Registy read file callback to catch all requests for reading files.
osgDB::Registry::instance()->setReadFileCallback(new MyReadFileCallback());
// initialize the viewer.
osgViewer::Viewer viewer;
// load the nodes from the commandline arguments.
osg::Node* rootnode = osgDB::readNodeFiles(arguments);
osg::ref_ptr<osg::Node> rootnode;
// if not loaded assume no arguments passed in, try use default mode instead.
if (!rootnode) rootnode = osgDB::readNodeFile("cow.osgt");
if (!rootnode)
if (arguments.read("--test"))
{
osg::notify(osg::NOTICE)<<"Please specify a file on the command line"<<std::endl;
osg::ref_ptr<osg::Group> root = new osg::Group();
rootnode = root;
osg::Node *test1 = new osg::Node();
test1->setUpdateCallback(new TestNodeUpdateCallback("test1"));
root->addChild(test1);
osg::Drawable *test2 = new osg::Drawable();
test2->osg::Node::setUpdateCallback(new TestNodeUpdateCallback("test2"));
root->addChild(test2);
osg::Drawable *test3 = new osg::Drawable();
test3->setUpdateCallback(new TestDrawableUpdateCallback("test3"));
root->addChild(test3);
osg::Geode *test4 = new osg::Geode();
osg::Drawable *drawable1 = new osg::Drawable();
drawable1->osg::Node::setUpdateCallback(new TestNodeUpdateCallback("test4"));
test4->addDrawable(drawable1);
root->addChild(test4);
osg::Geode *test5 = new osg::Geode();
osg::Drawable *drawable2 = new osg::Drawable();
drawable2->setUpdateCallback(new TestDrawableUpdateCallback("test5"));
test5->addDrawable(drawable2);
root->addChild(test5);
osg::Geode *test6 = new osg::Geode();
osg::Drawable *drawable3 = new osg::Drawable();
drawable3->setUpdateCallback(new TestDrawableUpdateCallback("test6"));
test6->addChild(drawable3);
root->addChild(test6);
osg::Geode *test7 = new osg::Geode();
osg::Drawable *drawable4 = new osg::Drawable();
drawable4->osg::Node::setUpdateCallback(new TestNodeUpdateCallback("test7"));
test7->addChild(drawable4);
root->addChild(test7);
printf("Numchildren with updates %u\n", rootnode->getNumChildrenRequiringUpdateTraversal());
return 1;
}
// run optimization over the scene graph
osgUtil::Optimizer optimzer;
optimzer.optimize(rootnode);
// insert all the callbacks
InsertCallbacksVisitor icv;
rootnode->accept(icv);
else
{
rootnode = osgDB::readRefNodeFiles(arguments);
// if not loaded assume no arguments passed in, try use default mode instead.
if (!rootnode) rootnode = osgDB::readRefNodeFile("cow.osgt");
if (!rootnode)
{
osg::notify(osg::NOTICE)<<"Please specify a file on the command line"<<std::endl;
return 1;
}
// run optimization over the scene graph
osgUtil::Optimizer optimzer;
optimzer.optimize(rootnode.get());
// insert all the callbacks
InsertCallbacksVisitor icv;
rootnode->accept(icv);
}
viewer.getCamera()->setUpdateCallback(new CameraUpdateCallback());
viewer.getCamera()->setEventCallback(new CameraEventCallback());
// set the scene to render
viewer.setSceneData(rootnode);
viewer.setSceneData(rootnode.get());
return viewer.run();
viewer.setCameraManipulator(new osgGA::TrackballManipulator);
viewer.realize();
while(!viewer.done())
{
OSG_NOTICE<<std::endl<<"New Frame"<<std::endl;
viewer.frame();
}
return 0;
}

View File

@@ -25,50 +25,50 @@
#include <osgGA/AnimationPathManipulator>
#include <iostream>
class ModelHandler : public osgGA::GUIEventHandler
class ModelHandler : public osgGA::GUIEventHandler
{
public:
public:
ModelHandler():
_position(0) {}
typedef std::vector<std::string> Filenames;
Filenames _filenames;
unsigned int _position;
void add(const std::string& filename) { _filenames.push_back(filename); }
bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa)
{
osgViewer::Viewer* viewer = dynamic_cast<osgViewer::Viewer*>(&aa);
if (!viewer) return false;
if (_filenames.empty()) return false;
switch(ea.getEventType())
{
case(osgGA::GUIEventAdapter::KEYUP):
{
if (ea.getKey()=='l')
{
osg::ref_ptr<osg::Node> model = osgDB::readNodeFile( _filenames[_position] );
{
osg::ref_ptr<osg::Node> model = osgDB::readRefNodeFile( _filenames[_position] );
++_position;
if (_position>=_filenames.size()) _position = 0;
if (model.valid())
{
viewer->setSceneData(model.get());
}
return true;
}
}
default: break;
}
return false;
}
bool _done;
};
@@ -76,12 +76,12 @@ public:
void singleWindowMultipleCameras(osgViewer::Viewer& viewer)
{
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;
}
unsigned int width, height;
wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height);
@@ -127,12 +127,12 @@ void singleWindowMultipleCameras(osgViewer::Viewer& viewer)
void multipleWindowMultipleCameras(osgViewer::Viewer& viewer, bool multipleScreens)
{
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;
}
unsigned int width, height;
wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height);
@@ -198,7 +198,7 @@ int main( int argc, char **argv )
// use an ArgumentParser object to manage the program arguments.
osg::ArgumentParser arguments(&argc,argv);
if (argc<2)
if (argc<2)
{
std::cout << argv[0] <<": requires filename argument." << std::endl;
return 1;
@@ -214,7 +214,7 @@ int main( int argc, char **argv )
osg::ref_ptr<osg::Node> model;
if (sharedModel)
{
model = osgDB::readNodeFiles(arguments);
model = osgDB::readRefNodeFiles(arguments);
if (!model) return 0;
if (enableVBO)
@@ -242,7 +242,7 @@ int main( int argc, char **argv )
if (sharedModel) viewer.setSceneData(model.get());
else
{
osg::ref_ptr<osg::Node> node = osgDB::readNodeFiles(arguments);
osg::ref_ptr<osg::Node> node = osgDB::readRefNodeFiles(arguments);
if (!node) return 0;
if (enableVBO)
@@ -268,19 +268,19 @@ int main( int argc, char **argv )
while (arguments.read("-p",pathfile))
{
apm = new osgGA::AnimationPathManipulator(pathfile);
if (!apm.valid() || !(apm->valid()) )
if (!apm.valid() || !(apm->valid()) )
{
apm = 0;
}
}
osgViewer::Viewer viewer(arguments);
while (arguments.read("-s")) { viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded); }
while (arguments.read("-g")) { viewer.setThreadingModel(osgViewer::Viewer::CullDrawThreadPerContext); }
while (arguments.read("-d")) { viewer.setThreadingModel(osgViewer::Viewer::DrawThreadPerContext); }
while (arguments.read("-c")) { viewer.setThreadingModel(osgViewer::Viewer::CullThreadPerCameraDrawThreadPerContext); }
bool limitNumberOfFrames = false;
unsigned int maxFrames = 10;
while (arguments.read("--run-till-frame-number",maxFrames)) { limitNumberOfFrames = true; }
@@ -292,7 +292,7 @@ int main( int argc, char **argv )
if (apm.valid()) viewer.setCameraManipulator(apm.get());
else viewer.setCameraManipulator( new osgGA::TrackballManipulator() );
viewer.addEventHandler(new osgViewer::StatsHandler);
viewer.addEventHandler(new osgViewer::ThreadingHandler);
@@ -300,11 +300,11 @@ int main( int argc, char **argv )
while (arguments.read("--config", configfile))
{
osg::notify(osg::NOTICE)<<"Trying to read config file "<<configfile<<std::endl;
osg::ref_ptr<osg::Object> object = osgDB::readObjectFile(configfile);
osg::ref_ptr<osg::Object> object = osgDB::readRefObjectFile(configfile);
osgViewer::View* view = dynamic_cast<osgViewer::View*>(object.get());
if (view)
{
osg::notify(osg::NOTICE)<<"Read config file succesfully"<<std::endl;
osg::notify(osg::NOTICE)<<"Read config file successfully"<<std::endl;
}
else
{
@@ -329,19 +329,19 @@ int main( int argc, char **argv )
else
{
// load the scene.
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles(arguments);
if (!loadedModel) loadedModel = osgDB::readNodeFile("cow.osgt");
if (!loadedModel) loadedModel = osgDB::readRefNodeFile("cow.osgt");
if (!loadedModel)
if (!loadedModel)
{
std::cout << argv[0] <<": No data loaded." << std::endl;
return 1;
}
viewer.setSceneData(loadedModel.get());
viewer.setSceneData(loadedModel);
}
viewer.realize();
unsigned int numFrames = 0;

View File

@@ -55,11 +55,11 @@ class Character : public osg::Referenced
{
public:
Character();
void setCharacter(const std::string& filename, const std::string& name, const osg::Vec3& orgin, const osg::Vec3& width, const osg::Vec3& catchPos, float positionRatio);
void setLives(const std::string& filename, const osg::Vec3& orgin, const osg::Vec3& delta, unsigned int numLives);
void setCatches(const std::string& filename, const osg::Vec3& orgin, const osg::Vec3& delta, unsigned int numLives);
void moveLeft();
@@ -71,7 +71,7 @@ public:
void resetCatches();
bool addCatch();
bool looseLife();
osg::Vec3 getCurrentCenterOfBasket() const { return _character->getPosition()+_centerBasket; }
@@ -91,12 +91,12 @@ public:
unsigned int _numCatches;
osg::ref_ptr<osg::Switch> _catchSwitch;
osg::ref_ptr<osg::Group> _objectsGroup;
osg::Vec3 _centerBasket;
float _radiusBasket;
};
Character::Character():
@@ -117,7 +117,7 @@ void Character::setCharacter(const std::string& filename, const std::string& nam
float _characterSize = _width.length()*0.2f;
osg::Image* image = osgDB::readImageFile(filename);
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(filename);
if (image)
{
osg::Vec3 pos(-0.5f*_characterSize,0.0f,0.0f);
@@ -136,14 +136,14 @@ void Character::setCharacter(const std::string& filename, const std::string& nam
_character = new osg::PositionAttitudeTransform;
_character->setName(name);
_character->addChild(geode);
moveTo(positionRatio);
_centerBasket = width*catchPos.x() + height*catchPos.y() + pos;
_radiusBasket = width.length()*catchPos.z();
}
}
void Character::setLives(const std::string& filename, const osg::Vec3& origin, const osg::Vec3& delta, unsigned int numLives)
@@ -153,7 +153,7 @@ void Character::setLives(const std::string& filename, const osg::Vec3& origin, c
_numLives = numLives;
_livesSwitch = new osg::Switch;
osg::Image* image = osgDB::readImageFile(filename);
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(filename);
if (image)
{
osg::StateSet* stateset = _livesSwitch->getOrCreateStateSet();
@@ -186,7 +186,7 @@ void Character::setCatches(const std::string& filename, const osg::Vec3& origin,
_numCatches = 0;
_catchSwitch = new osg::Switch;
osg::Image* image = osgDB::readImageFile(filename);
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(filename);
if (image)
{
osg::StateSet* stateset = _catchSwitch->getOrCreateStateSet();
@@ -249,20 +249,20 @@ void Character::resetCatches()
bool Character::addCatch()
{
if (!_catchSwitch || _numCatches>=_catchSwitch->getNumChildren()) return false;
_catchSwitch->setValue(_numCatches,true);
++_numCatches;
return true;
}
bool Character::looseLife()
{
if (!_livesSwitch || _numLives==0) return false;
--_numLives;
_livesSwitch->setValue(_numLives,false);
return (_numLives!=0);
}
@@ -279,21 +279,21 @@ class CatchableObject : public osg::Referenced
bool anyInside(const osg::Vec3& lower_left, const osg::Vec3& top_right);
bool centerInside(const osg::Vec3& center, float radius);
void explode();
bool dangerous() { return _dangerous; }
void stop() { _stopped = true; }
bool stopped() { return _stopped; }
void setTimeToRemove(double time) { _timeToRemove=time; }
double getTimeToRemove() { return _timeToRemove; }
bool needToRemove(double time) { return _timeToRemove>=0.0 && time>_timeToRemove; }
osg::ref_ptr<osg::PositionAttitudeTransform> _object;
osg::Vec3 _velocity;
float _mass;
@@ -307,7 +307,7 @@ class CatchableObject : public osg::Referenced
static void setUpCatchablesMap(const FileList& fileList);
public:
// update position and velocity
void update(double dt);
@@ -317,7 +317,7 @@ class CatchableObject : public osg::Referenced
_viscosity = v;
_viscosityCoefficient = 6 * osg::PI * _viscosity;
}
/// Get the viscosity of the fluid.
inline float getFluidViscosity() const { return _viscosity; }
@@ -330,17 +330,17 @@ class CatchableObject : public osg::Referenced
/// Get the density of the fluid.
inline float getFluidDensity() const { return _density; }
/// Set the wind vector.
inline void setWind(const osg::Vec3& wind) { _wind = wind; }
/// Get the wind vector.
inline const osg::Vec3& getWind() const { return _wind; }
/// Set the acceleration vector.
inline void setAcceleration(const osg::Vec3& v) { _acceleration = v; }
/// Get the acceleration vector.
inline const osg::Vec3& getAcceleration() const { return _acceleration; }
@@ -349,22 +349,22 @@ class CatchableObject : public osg::Referenced
*/
inline void setToGravity(float scale = 1.0f) { _acceleration.set(0, 0, -9.81f*scale); }
/// Set the fluid parameters as for air (20<EFBFBD>C temperature).
/// Set the fluid parameters as for air (20C temperature).
inline void setFluidToAir()
{
setToGravity(1.0f);
setFluidDensity(1.2929f);
setFluidViscosity(1.8e-5f);
}
/// Set the fluid parameters as for pure water (20<EFBFBD>C temperature).
/// Set the fluid parameters as for pure water (20C temperature).
inline void setFluidToWater()
{
setToGravity(1.0f);
setFluidDensity(1.0f);
setFluidViscosity(1.002e-3f);
}
protected:
@@ -375,15 +375,15 @@ class CatchableObject : public osg::Referenced
float _viscosityCoefficient;
float _densityCoefficeint;
};
CatchableObject::CatchableObject()
{
_stopped = false;
_dangerous = false;
_timeToRemove = -1.0; // do not remove.
setFluidToAir();
}
@@ -395,14 +395,14 @@ void CatchableObject::setUpCatchablesMap(const FileList& fileList)
++itr)
{
const std::string& filename = *itr;
osg::Image* image = osgDB::readImageFile(filename);
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(filename);
if (image)
{
osg::ref_ptr<osg::StateSet> stateset = new osg::StateSet();
stateset->setTextureAttributeAndModes(0,new osg::Texture2D(image),osg::StateAttribute::ON);
stateset->setMode(GL_BLEND,osg::StateAttribute::ON);
stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
osg::Vec3 width((float)(image->s())/(float)(image->t()),0.0f,0.0);
osg::Vec3 height(0.0f,0.0f,1.0f);
osg::Vec3 pos = (width+height)*-0.5f;
@@ -455,8 +455,8 @@ void CatchableObject::update(double dt)
osg::Vec3 force = _acceleration * (_mass - _density*Volume);
// compute force due to friction
osg::Vec3 relative_wind = _velocity-_wind;
force -= relative_wind * Area * (_viscosityCoefficient + _densityCoefficeint*relative_wind.length());
osg::Vec3 relative_wind = _velocity-_wind;
force -= relative_wind * Area * (_viscosityCoefficient + _densityCoefficeint*relative_wind.length());
// divide force by mass to get acceleration.
_velocity += force*(dt/_mass);
@@ -466,7 +466,7 @@ void CatchableObject::update(double dt)
bool CatchableObject::anyInside(const osg::Vec3& lower_left, const osg::Vec3& upper_right)
{
osg::Vec3 pos = _object->getPosition();
if (pos.x()+_radius < lower_left.x()) return false;
if (pos.x()-_radius > upper_right.x()) return false;
if (pos.z()+_radius < lower_left.z()) return false;
@@ -513,20 +513,20 @@ class GameEventHandler : public osgGA::GUIEventHandler
public:
GameEventHandler();
META_Object(osgStereImageApp,GameEventHandler);
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&);
virtual void getUsage(osg::ApplicationUsage& usage) const;
osg::Matrix getCameraPosition();
void compileGLObjects(osg::State& state)
{
osgUtil::GLObjectsVisitor compile;
compile.setState(&state);
for(ObjectMap::iterator itr = s_objectMap.begin();
itr != s_objectMap.end();
++itr)
@@ -534,14 +534,14 @@ public:
itr->second->accept(compile);
}
}
osg::Node* createScene();
void setFOVY(float fovy) { _fovy = fovy; }
float getFOVY() const { return _fovy; }
void createNewCatchable();
void clearCatchables()
{
for(CatchableObjectList::iterator itr=_catchableObjects.begin();
@@ -562,7 +562,7 @@ public:
_catchableObjects.clear();
}
void resetLevel()
{
_level = 0;
@@ -573,7 +573,7 @@ public:
_levelStartTick = osg::Timer::instance()->tick();
}
void nextLevel()
{
++_level;
@@ -596,12 +596,12 @@ public:
void resetGame()
{
_currentScore = 0;
updateTextWithScore();
clearCatchables();
resetLevel();
for(unsigned int i=0;i<_numberOfPlayers;++i)
{
_players[i].reset();
@@ -629,12 +629,12 @@ public:
livesPosition = _originBaseLine+osg::Vec3(1000.0f,-0.5f,000.0f);
catchesPosition = _originBaseLine+osg::Vec3(1100.0f,-0.5f,0.0f);
}
switch(player)
{
case PLAYER_GIRL:
{
std::string player_one = "Catch/girl.png";
std::string player_one = "Catch/girl.png";
osg::Vec3 catchPos(0.2, 0.57, 0.34);
_players[_numberOfPlayers].setCharacter(player_one,"girl", _originBaseLine + osg::Vec3(0.0f,-1.0f,0.0f), _widthBaseLine, catchPos, 0.5f);
@@ -646,7 +646,7 @@ public:
}
case PLAYER_BOY:
{
std::string player_two = "Catch/boy.png";
std::string player_two = "Catch/boy.png";
osg::Vec3 catchPos(0.8, 0.57, 0.34);
_players[_numberOfPlayers].setCharacter(player_two,"boy", _originBaseLine + osg::Vec3(0.0f,-2.0f,0.0f), _widthBaseLine, catchPos, 0.5f);
@@ -656,10 +656,10 @@ public:
++_numberOfPlayers;
break;
}
}
}
}
typedef std::vector< osg::ref_ptr<osgText::Text> > TextList;
void updateScoreWithCatch()
@@ -673,8 +673,8 @@ public:
osg::Timer_t newTick = osg::Timer::instance()->tick();
double timeForLevel = osg::Timer::instance()->delta_s(_levelStartTick, newTick);
// a ten second level gets you 10 points,
// a twenty second levels gets you 5 points.
// a ten second level gets you 10 points,
// a twenty second levels gets you 5 points.
_currentScore += static_cast<unsigned int>(10000.0f/(timeForLevel*timeForLevel));
updateTextWithScore();
@@ -685,24 +685,24 @@ public:
{
std::ostringstream os;
os<<"Score: "<<_currentScore;
std::string textString = os.str();
for(TextList::iterator itr = _scoreTextList.begin();
itr != _scoreTextList.end();
++itr)
{
(*itr)->setText(textString);
}
}
}
void updateLevelText()
{
std::ostringstream os;
os<<"Level: "<<_level+1;
_levelText->setText(os.str());
}
protected:
@@ -715,45 +715,45 @@ protected:
osg::Vec3 _originBaseLine;
osg::Vec3 _widthBaseLine;
float _characterSize;
float _fovy;
unsigned _level;
float _chanceOfExplodingAtStart;
float _initialNumDropsPerSecond;
osg::ref_ptr<osg::Switch> _gameSwitch;
osg::ref_ptr<osg::Group> _gameGroup;
osg::ref_ptr<osg::Switch> _levelSwitch;
unsigned int _currentIndex;
unsigned int _welcomeIndex;
unsigned int _lostIndex;
unsigned int _wonIndex;
unsigned int _gameIndex;
osg::Timer_t _levelStartTick;
unsigned int _currentScore;
osg::ref_ptr<osgText::Text> _levelText;
TextList _scoreTextList;
unsigned int _numberOfPlayers;
Character _players[2];
typedef std::list< osg::ref_ptr<CatchableObject> > CatchableObjectList;
CatchableObjectList _catchableObjects;
FileList _backgroundFiles;
FileList _benignCatachables;
bool _leftKeyPressed;
bool _rightKeyPressed;
osg::ref_ptr<CatchableObject> _dummyCatchable;
};
@@ -791,11 +791,11 @@ GameEventHandler::GameEventHandler()
_benignCatachables.push_back("Catch/t.png");
_benignCatachables.push_back("Catch/u.png");
_benignCatachables.push_back("Catch/ball.png");
CatchableObject::setUpCatchablesMap(_benignCatachables);
_currentScore = 0;
setFOVY(osg::DegreesToRadians(60.0));
}
@@ -817,7 +817,7 @@ bool GameEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
default:
return false;
}
}
else if (_currentIndex==_lostIndex)
{
@@ -834,7 +834,7 @@ bool GameEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
default:
return false;
}
}
else if (_currentIndex==_wonIndex)
{
@@ -851,7 +851,7 @@ bool GameEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
default:
return false;
}
}
else if (_currentIndex==_gameIndex)
{
@@ -888,7 +888,7 @@ bool GameEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
for(unsigned int i=0;i<_numberOfPlayers;++i)
{
bool inBasket = ((*itr)->centerInside(_players[i].getCurrentCenterOfBasket(),_players[i].getCurrentRadiusOfBasket()));
if ((*itr)->dangerous())
{
if ((*itr)->anyInside(_players[i].getLowerLeft(),_players[i].getUpperRight()) || inBasket)
@@ -912,7 +912,7 @@ bool GameEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
{
// player has caught a safe object.
updateScoreWithCatch();
if (!_players[i].addCatch())
{
_players[i].resetCatches();
@@ -930,7 +930,7 @@ bool GameEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
}
}
if (!(*itr)->anyInside(_origin, _origin+_width+_height) ||
if (!(*itr)->anyInside(_origin, _origin+_width+_height) ||
(*itr)->needToRemove(ea.getTime()) ||
removeEntry)
{
@@ -968,7 +968,7 @@ bool GameEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
float numDropsPerSecond = _initialNumDropsPerSecond * (_level+1);
float r = (float)rand()/(float)RAND_MAX;
if (r < deltaTime*numDropsPerSecond)
{
{
createNewCatchable();
}
@@ -1015,7 +1015,7 @@ bool GameEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
return false;
}
}
return false;
return false;
}
void GameEventHandler::getUsage(osg::ApplicationUsage&) const
@@ -1026,9 +1026,9 @@ osg::Matrix GameEventHandler::getCameraPosition()
{
osg::Matrix cameraPosition;
osg::Vec3 center = _origin+(_width+_height)*0.5f;
float distance = _height.length()/(2.0f*tanf(_fovy*0.5f));
cameraPosition.makeLookAt(center-osg::Vec3(0.0f,distance,0.0f),center,osg::Vec3(0.0f,0.0f,1.0f));
return cameraPosition;
}
@@ -1036,8 +1036,8 @@ osg::Matrix GameEventHandler::getCameraPosition()
osg::Node* GameEventHandler::createScene()
{
_gameSwitch = new osg::Switch;
// create a dummy catchable to load all the particule textures to reduce
// create a dummy catchable to load all the particule textures to reduce
// latency later on..
_dummyCatchable = new CatchableObject;
_dummyCatchable->setObject("Catch/a.png","a",osg::Vec3(0.0f,0.0,0.0f),1.0f,osg::Vec3(0.0f,0.0,0.0f));
@@ -1045,10 +1045,10 @@ osg::Node* GameEventHandler::createScene()
// set up welcome subgraph
{
osg::Geode* geode = new osg::Geode;
osg::ref_ptr<osg::Geode> geode = new osg::Geode;
// set up the background
osg::Image* image = osgDB::readImageFile("Catch/Welcome.jpg");
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile("Catch/Welcome.jpg");
if (image)
{
osg::Geometry* geometry = osg::createTexturedQuadGeometry(_origin,_width,_height);
@@ -1057,7 +1057,7 @@ osg::Node* GameEventHandler::createScene()
geode->addDrawable(geometry);
}
// set up the text
osg::Vec3 textPosition = _origin+_width*0.5f+_height*0.8f -osg::Vec3(0.0f,0.1f,0.0f);
{
@@ -1072,7 +1072,7 @@ osg::Node* GameEventHandler::createScene()
geode->addDrawable(text);
}
{
textPosition -= _height*0.25f;
osgText::Text* text = new osgText::Text;
@@ -1121,9 +1121,9 @@ osg::Node* GameEventHandler::createScene()
// set up you've lost subgraph
{
osg::Geode* geode = new osg::Geode;
osg::ref_ptr<osg::Geode> geode = new osg::Geode;
osg::Image* image = osgDB::readImageFile("Catch/YouLost.jpg");
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile("Catch/YouLost.jpg");
if (image)
{
osg::Geometry* geometry = osg::createTexturedQuadGeometry(_origin,_width,_height);
@@ -1132,7 +1132,7 @@ osg::Node* GameEventHandler::createScene()
geode->addDrawable(geometry);
}
// set up the text
osg::Vec3 textPosition = _origin+_width*0.5f+_height*0.75f -osg::Vec3(0.0f,0.1f,0.0f);
{
@@ -1147,7 +1147,7 @@ osg::Node* GameEventHandler::createScene()
geode->addDrawable(text);
}
{
textPosition -= _height*0.25f;
osgText::Text* text = new osgText::Text;
@@ -1184,9 +1184,9 @@ osg::Node* GameEventHandler::createScene()
// set up you've won subgraph
{
osg::Geode* geode = new osg::Geode;
osg::ref_ptr<osg::Geode> geode = new osg::Geode;
osg::Image* image = osgDB::readImageFile("Catch/YouWon.jpg");
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile("Catch/YouWon.jpg");
if (image)
{
osg::Geometry* geometry = osg::createTexturedQuadGeometry(_origin,_width,_height);
@@ -1195,7 +1195,7 @@ osg::Node* GameEventHandler::createScene()
geode->addDrawable(geometry);
}
// set up the text
osg::Vec3 textPosition = _origin+_width*0.5f+_height*0.75f -osg::Vec3(0.0f,0.1f,0.0f);
{
@@ -1210,7 +1210,7 @@ osg::Node* GameEventHandler::createScene()
geode->addDrawable(text);
}
{
textPosition -= _height*0.25f;
osgText::Text* text = new osgText::Text;
@@ -1258,7 +1258,7 @@ osg::Node* GameEventHandler::createScene()
_gameGroup->addChild(_players[i]._character.get());
_gameGroup->addChild(_players[i]._livesSwitch.get());
_gameGroup->addChild(_players[i]._catchSwitch.get());
}
}
// background
{
@@ -1269,7 +1269,7 @@ osg::Node* GameEventHandler::createScene()
++itr)
{
osg::Image* image = osgDB::readImageFile(*itr);
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(*itr);
if (image)
{
osg::Geometry* geometry = osg::createTexturedQuadGeometry(_origin,_width,_height);
@@ -1305,7 +1305,7 @@ osg::Node* GameEventHandler::createScene()
osg::Geode* geode = new osg::Geode;
geode->addDrawable(text);
_scoreTextList.push_back(text);
textPosition -= _height*0.05f;
_levelText = new osgText::Text;
_levelText->setText("Level : 0");
@@ -1317,7 +1317,7 @@ osg::Node* GameEventHandler::createScene()
_levelText->setAxisAlignment(osgText::Text::XZ_PLANE);
geode->addDrawable(_levelText.get());
_gameGroup->addChild(geode);
@@ -1325,7 +1325,7 @@ osg::Node* GameEventHandler::createScene()
}
_currentIndex = _welcomeIndex;
_gameSwitch->setSingleChildOn(_currentIndex);
@@ -1338,7 +1338,7 @@ void GameEventHandler::createNewCatchable()
unsigned int catachableIndex = (unsigned int)((float)_benignCatachables.size()*(float)rand()/(float)RAND_MAX);
if (catachableIndex>=_benignCatachables.size()) catachableIndex = _benignCatachables.size()-1;
const std::string& filename = _benignCatachables[catachableIndex];
float ratio = ((float)rand() / (float)RAND_MAX);
@@ -1356,7 +1356,7 @@ void GameEventHandler::createNewCatchable()
float r = (float)rand() / (float)RAND_MAX;
if (r < _chanceOfExplodingAtStart)
{
catchableObject->explode();
catchableObject->explode();
}
_gameGroup->addChild(catchableObject->_object.get());
@@ -1366,9 +1366,10 @@ class CompileStateCallback : public osg::Operation
{
public:
CompileStateCallback(GameEventHandler* eh):
osg::Referenced(true),
osg::Operation("CompileStateCallback", false),
_gameEventHandler(eh) {}
virtual void operator () (osg::Object* object)
{
osg::GraphicsContext* context = dynamic_cast<osg::GraphicsContext*>(object);
@@ -1379,7 +1380,7 @@ class CompileStateCallback : public osg::Operation
_gameEventHandler->compileGLObjects(*(context->getState()));
}
}
OpenThreads::Mutex _mutex;
GameEventHandler* _gameEventHandler;
};
@@ -1389,7 +1390,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 use node masks to create stereo images.");
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] image_file_left_eye image_file_right_eye");
@@ -1409,8 +1410,8 @@ int main( int argc, char **argv )
while (arguments.read("--boy")) seh->addPlayer(GameEventHandler::PLAYER_BOY);
while (arguments.read("--girl")) seh->addPlayer(GameEventHandler::PLAYER_GIRL);
// if user request help write it out to cout.
if (arguments.read("-h") || arguments.read("--help"))
{
@@ -1427,8 +1428,8 @@ int main( int argc, char **argv )
arguments.writeErrorMessages(std::cout);
return 1;
}
// enable the image cache so we don't need to keep loading the particle files
osgDB::ReaderWriter::Options* options = new osgDB::ReaderWriter::Options;
options->setObjectCacheHint(osgDB::ReaderWriter::Options::CACHE_IMAGES);
@@ -1453,7 +1454,7 @@ int main( int argc, char **argv )
double fovy, aspectRatio, zNear, zFar;
viewer.getCamera()->getProjectionMatrixAsPerspective(fovy, aspectRatio, zNear, zFar);
seh->setFOVY(osg::DegreesToRadians(fovy));
seh->setFOVY(osg::DegreesToRadians(fovy));
// todo for osgViewer - create default set up.
viewer.setUpViewAcrossAllScreens();
@@ -1471,7 +1472,7 @@ int main( int argc, char **argv )
}
// todo for osgViewer - implement warp pointer that can be done relative to different coordinate frames
// viewer.requestWarpPointer(0.5f,0.5f);
// viewer.requestWarpPointer(0.5f,0.5f);
while( !viewer.done() )
{
@@ -1479,8 +1480,8 @@ int main( int argc, char **argv )
// fire off the cull and draw traversals of the scene.
viewer.frame();
}
return 0;
}

View File

@@ -40,10 +40,9 @@
#include <osgUtil/Optimizer>
osg::Node* decorate_with_clip_node(osg::Node* subgraph)
osg::ref_ptr<osg::Node> decorate_with_clip_node(const osg::ref_ptr<osg::Node>& subgraph)
{
osg::Group* rootnode = new osg::Group;
osg::ref_ptr<osg::Group> rootnode = new osg::Group;
// create wireframe view of the model so the user can see
// what parts are being culled away.
@@ -52,14 +51,14 @@ osg::Node* decorate_with_clip_node(osg::Node* subgraph)
osg::PolygonMode* polymode = new osg::PolygonMode;
polymode->setMode(osg::PolygonMode::FRONT_AND_BACK,osg::PolygonMode::LINE);
stateset->setAttributeAndModes(polymode,osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);
osg::Group* wireframe_subgraph = new osg::Group;
wireframe_subgraph->setStateSet(stateset);
wireframe_subgraph->addChild(subgraph);
rootnode->addChild(wireframe_subgraph);
/*
// simple approach to adding a clipnode above a subrgaph.
// simple approach to adding a clipnode above a subgraph.
// create clipped part.
osg::ClipNode* clipped_subgraph = new osg::ClipNode;
@@ -78,9 +77,9 @@ osg::Node* decorate_with_clip_node(osg::Node* subgraph)
// more complex approach to managing ClipNode, allowing
// ClipNode node to be transformed independantly from the subgraph
// ClipNode node to be transformed independently from the subgraph
// that it is clipping.
osg::MatrixTransform* transform= new osg::MatrixTransform;
osg::NodeCallback* nc = new osg::AnimationPathCallback(subgraph->getBound().center(),osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(45.0f));
@@ -117,28 +116,28 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc,argv);
// load the nodes from the commandline arguments.
osg::Node* loadedModel = osgDB::readNodeFiles(arguments);
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles(arguments);
// if not loaded assume no arguments passed in, try use default mode instead.
if (!loadedModel) loadedModel = osgDB::readNodeFile("cow.osgt");
if (!loadedModel) loadedModel = osgDB::readRefNodeFile("cow.osgt");
if (!loadedModel)
{
osg::notify(osg::NOTICE)<<"Please specifiy a filename and the command line"<<std::endl;
osg::notify(osg::NOTICE)<<"Please specify a filename on the command line"<<std::endl;
return 1;
}
// decorate the scenegraph with a clip node.
osg::Node* rootnode = decorate_with_clip_node(loadedModel);
osg::ref_ptr<osg::Node> rootnode = decorate_with_clip_node(loadedModel);
// run optimization over the scene graph
osgUtil::Optimizer optimzer;
optimzer.optimize(rootnode);
osgViewer::Viewer viewer;
// set the scene to render
viewer.setSceneData(rootnode);

View File

@@ -45,6 +45,8 @@
#include <net/soioctl.h>
#elif defined(__CYGWIN__)
#include <unistd.h>
#elif defined (__GNU__)
#include <unistd.h>
#elif defined(__sun)
#include <unistd.h>
#include <sys/sockio.h>

View File

@@ -44,17 +44,16 @@
#include "broadcaster.h"
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 +62,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 +83,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 +111,7 @@ class DataConverter
bool _swapBytes;
char* _currentPtr;
void reset()
{
_currentPtr = _startPtr;
@@ -122,22 +121,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 +145,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 +159,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 +171,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 +189,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 +207,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 +240,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,22 +360,23 @@ 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();
++itr)
{
write(*(*itr));
osgGA::GUIEventAdapter* event = (*itr)->asGUIEventAdapter();
if (event) write(*event);
}
}
@@ -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);
@@ -505,7 +505,7 @@ int main( int argc, char **argv )
}
// load model.
osg::ref_ptr<osg::Node> rootnode = osgDB::readNodeFiles(arguments);
osg::ref_ptr<osg::Node> rootnode = osgDB::readRefNodeFiles(arguments);
// set the scene to render
viewer.setSceneData(rootnode.get());
@@ -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,12 +609,12 @@ 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
// update the scene by traversing it with the update visitor which will
// call all node update callbacks and animations.
viewer.eventTraversal();
viewer.updateTraversal();
@@ -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

@@ -122,7 +122,7 @@ void Receiver::sync( void )
return;
}
#if defined(__linux) || defined(__FreeBSD__) || defined( __APPLE__ )
#if defined(__linux) || defined(__FreeBSD__) || defined( __APPLE__ ) || defined(__FreeBSD_kernel__) || defined(__GNU__)
socklen_t size;
#else
int size;

View File

@@ -133,7 +133,7 @@ int main( int argc, char **argv )
osg::ArgumentParser arguments(&argc,argv);
// read the scene from the list of file specified commandline args.
osg::ref_ptr<osg::Node> scene = osgDB::readNodeFiles(arguments);
osg::ref_ptr<osg::Node> scene = osgDB::readRefNodeFiles(arguments);
if (!scene)
{
@@ -149,7 +149,7 @@ int main( int argc, char **argv )
{
osgViewer::View* view = new osgViewer::View;
view->setName("Single view");
view->setSceneData(osgDB::readNodeFile("fountain.osgt"));
view->setSceneData(osgDB::readRefNodeFile("fountain.osgt"));
view->addEventHandler( new osgViewer::StatsHandler );
@@ -283,7 +283,7 @@ int main( int argc, char **argv )
view->setName("View three");
viewer.addView(view);
view->setSceneData(osgDB::readNodeFile("cessnafire.osgt"));
view->setSceneData(osgDB::readRefNodeFile("cessnafire.osgt"));
view->getCamera()->setName("Cam three");
view->getCamera()->setProjectionMatrixAsPerspective(30.0, double(traits->width) / double(traits->height/2), 1.0, 1000.0);

View File

@@ -30,7 +30,7 @@
static const char* computeSrc = {
"#version 430\n"
"uniform float osg_FrameTime;\n"
"uniform image2D targetTex;\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"
@@ -43,7 +43,7 @@ static const char* computeSrc = {
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 );
@@ -53,23 +53,23 @@ int main( int argc, char** argv )
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");
osg::ref_ptr<osg::Node> sourceNode = osgDB::readRefNodeFile("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) );
@@ -77,12 +77,12 @@ int main( int argc, char** argv )
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 );

View File

@@ -33,12 +33,12 @@
#include <iostream>
// Customize the CopyOp so that we add our own verbose
// Customize the CopyOp so that we add our own verbose
// output of what's being copied.
class MyCopyOp : public osg::CopyOp
{
public:
inline MyCopyOp(CopyFlags flags=SHALLOW_COPY):
osg::CopyOp(flags),
_indent(0),
@@ -46,11 +46,11 @@ class MyCopyOp : public osg::CopyOp
inline void moveIn() const { _indent += _step; }
inline void moveOut() const { _indent -= _step; }
inline void writeIndent() const
inline void writeIndent() const
{
for(int i=0;i<_indent;++i) std::cout << " ";
}
virtual osg::Referenced* operator() (const osg::Referenced* ref) const
{
writeIndent(); std::cout << "copying Referenced "<<ref<<std::endl;
@@ -59,7 +59,7 @@ class MyCopyOp : public osg::CopyOp
moveOut();
return ret_ref;
}
virtual osg::Object* operator() (const osg::Object* obj) const
{
writeIndent(); std::cout << "copying Object "<<obj;
@@ -70,7 +70,7 @@ class MyCopyOp : public osg::CopyOp
moveOut();
return ret_obj;
}
virtual osg::Node* operator() (const osg::Node* node) const
{
writeIndent(); std::cout << "copying Node "<<node;
@@ -136,25 +136,25 @@ class MyCopyOp : public osg::CopyOp
moveOut();
return ret_image;
}
protected:
// must be mutable since CopyOp is passed around as const to
// the various clone/copy constructors.
mutable int _indent;
mutable int _step;
};
// this CopyOp class will preserve the multi-parent structure of the copied
// object, instead of expanding it into a tree. Works with the
// this CopyOp class will preserve the multi-parent structure of the copied
// object, instead of expanding it into a tree. Works with the
// DEEP_COPY_NODES flag.
class GraphCopyOp : public osg::CopyOp
{
public:
inline GraphCopyOp(CopyFlags flags=SHALLOW_COPY):
osg::CopyOp(flags) { _nodeCopyMap.clear();}
virtual osg::Node* operator() (const osg::Node* node) const
{
if (node && _flags&DEEP_COPY_NODES)
@@ -180,9 +180,9 @@ class GraphCopyOp : public osg::CopyOp
else
return const_cast<osg::Node*>(node);
}
protected:
// must be mutable since CopyOp is passed around as const to
// the various clone/copy constructors.
mutable std::map<const osg::Node*,osg::Node*> _nodeCopyMap;
@@ -198,20 +198,20 @@ int main( int argc, char **argv )
osgViewer::Viewer viewer;
// load the nodes from the commandline arguments.
osg::Node* rootnode = osgDB::readNodeFiles(arguments);
osg::ref_ptr<osg::Node> rootnode = osgDB::readRefNodeFiles(arguments);
if (!rootnode)
{
osg::notify(osg::NOTICE)<<"Please specify a model filename on the command line."<<std::endl;
return 1;
}
// run optimization over the scene graph
osgUtil::Optimizer optimzer;
optimzer.optimize(rootnode);
// ------------- Start of copy specific code -------------------------------------------------------
// do a deep copy, using MyCopyOp to reveal whats going on under the good,
// do a deep copy, using MyCopyOp to reveal whats going on under the hood,
// in your own code you'd typically just use the basic osg::CopyOp something like
osg::ref_ptr<osg::Node> mycopy = dynamic_cast<osg::Node*>(rootnode->clone(osg::CopyOp::DEEP_COPY_ALL));
std::cout << "Doing a deep copy of scene graph"<<std::endl;
@@ -219,7 +219,7 @@ int main( int argc, char **argv )
// note, we need the dyanmic_cast because MS Visual Studio can't handle covarient
// return types, so that clone has return just Object*. bahh hum bug
osg::ref_ptr<osg::Node> deep_copy = dynamic_cast<osg::Node*>(rootnode->clone(MyCopyOp(osg::CopyOp::DEEP_COPY_ALL)));
std::cout << "----------------------------------------------------------------"<<std::endl;
// do a graph preserving deep copy.
@@ -260,18 +260,18 @@ int main( int argc, char **argv )
// DEEP_COPY_IMAGES = 64,
// DEEP_COPY_ALL = 0xffffffff
// };
//
//
// These options you can use together such as :
// osg::Node* mycopy = dynamic_cast<osg::Node*>(rootnode->clone(osg::CopyOp::DEEP_COPY_NODES | DEEP_COPY_DRAWABLES));
// Which shares state but creates copies of all nodes and drawables (which contain the geometry).
//
//
// You may also want to subclass from CopyOp to provide finer grained control of what gets shared (shallow copy) vs
// cloned (deep copy).
// ------------- End of copy specific code -------------------------------------------------------
// set the scene to render
viewer.setSceneData(rootnode);

View File

@@ -43,21 +43,21 @@
void create_specular_highlights(osg::Node *node)
{
osg::StateSet *ss = node->getOrCreateStateSet();
// create and setup the texture object
osg::TextureCubeMap *tcm = new osg::TextureCubeMap;
tcm->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP);
tcm->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP);
tcm->setWrap(osg::Texture::WRAP_R, osg::Texture::CLAMP);
tcm->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR_MIPMAP_LINEAR);
tcm->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR);
tcm->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR);
// generate the six highlight map images (light direction = [1, 1, -1])
osgUtil::HighlightMapGenerator *mapgen = new osgUtil::HighlightMapGenerator(
osg::Vec3(1, 1, -1), // light direction
osg::Vec4(1, 0.9f, 0.8f, 1), // light color
8); // specular exponent
mapgen->generateMap();
// assign the six images to the texture object
@@ -77,7 +77,7 @@ void create_specular_highlights(osg::Node *node)
ss->setTextureAttributeAndModes(0, tg, osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON);
// use TexEnvCombine to add the highlights to the original lighting
osg::TexEnvCombine *te = new osg::TexEnvCombine;
osg::TexEnvCombine *te = new osg::TexEnvCombine;
te->setCombine_RGB(osg::TexEnvCombine::ADD);
te->setSource0_RGB(osg::TexEnvCombine::TEXTURE);
te->setOperand0_RGB(osg::TexEnvCombine::SRC_COLOR);
@@ -93,12 +93,12 @@ int main(int argc, char *argv[])
// construct the viewer.
osgViewer::Viewer viewer;
// load the nodes from the commandline arguments.
osg::Node* rootnode = osgDB::readNodeFiles(arguments);
osg::ref_ptr<osg::Node> rootnode = osgDB::readRefNodeFiles(arguments);
// if not loaded assume no arguments passed in, try use default mode instead.
if (!rootnode) rootnode = osgDB::readNodeFile("cessna.osgt");
if (!rootnode) rootnode = osgDB::readRefNodeFile("cessna.osgt");
if (!rootnode)
{
@@ -107,33 +107,17 @@ int main(int argc, char *argv[])
}
// create specular highlights
create_specular_highlights(rootnode);
create_specular_highlights(rootnode.get());
// 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);
// create the windows and run the threads.
viewer.realize();
// now check to see if texture cube map is supported.
for(unsigned int contextID = 0;
contextID<osg::DisplaySettings::instance()->getMaxNumberOfGraphicsContexts();
++contextID)
{
osg::TextureCubeMap::Extensions* tcmExt = osg::TextureCubeMap::getExtensions(contextID,false);
if (tcmExt)
{
if (!tcmExt->isCubeMapSupported())
{
std::cout<<"Warning: texture_cube_map not supported by OpenGL drivers, unable to run application."<<std::endl;
return 1;
}
}
}
return viewer.run();
}

View File

@@ -1,9 +1,9 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This application is open source and may be redistributed and/or modified
* 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.
@@ -50,7 +50,7 @@ int main(int argc, char** argv)
arguments.getApplicationUsage()->write(std::cout, helpType);
return 1;
}
// report any errors if they have occurred when parsing the program arguments.
if (arguments.errors())
{
@@ -81,7 +81,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 );
@@ -95,13 +95,13 @@ int main(int argc, char** argv)
// 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);
@@ -129,8 +129,8 @@ int main(int argc, char** argv)
// load the data
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFile(file);
if (!loadedModel)
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFile(file);
if (!loadedModel)
{
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
return 1;

View File

@@ -224,7 +224,7 @@ public:
osg::StateSet *dstate= gm->getOrCreateStateSet( );
dstate->setMode( GL_LIGHTING, osg::StateAttribute::ON );
osg::Image* image = osgDB::readImageFile("Images/Brick-Std-Orange.TGA");
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile("Images/Brick-Std-Orange.TGA");
if (image)
{
osg::Texture2D* txt = new osg::Texture2D;
@@ -354,7 +354,7 @@ osg::Group *makedelaunay(const int ndcs)
osg::Vec3Array *points=new osg::Vec3Array;
osg::Image* image = osgDB::readImageFile("Images/blueFlowers.png");
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile("Images/blueFlowers.png");
if (image)
{
osg::Texture2D* texture = new osg::Texture2D;
@@ -817,7 +817,7 @@ osg::Geometry *WallConstraint::makeWallGeometry() const
{
osg::ref_ptr<osg::Geometry> gm=new osg::Geometry; // the wall
if (texture!="") {
osg::Image* image = osgDB::readImageFile(texture.c_str());
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(texture.c_str());
if (image)
{
osg::Texture2D* txt = new osg::Texture2D;
@@ -1005,7 +1005,7 @@ deprecated_osg::Geometry *ArealConstraint::makeWallGeometry( osg::Vec3Array *pt)
tscx->retessellatePolygons(*(edges)); // find all edges
if (walltexture!="") {
osg::Image* image = osgDB::readImageFile(walltexture.c_str());
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(walltexture.c_str());
if (image)
{
osg::Texture2D* txt = new osg::Texture2D;
@@ -1062,7 +1062,7 @@ deprecated_osg::Geometry * ArealConstraint::makeAreal( osg::Vec3Array *points)
gm->setNormalArray(getCanopyNormals(points));
gm->setNormalBinding(deprecated_osg::Geometry::BIND_PER_PRIMITIVE);
gm->setTexCoordArray(0,getCanopyTexcoords(points));
osg::Image* image = osgDB::readImageFile(texture);
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(texture);
if (image)
{
osg::Texture2D* txt = new osg::Texture2D;
@@ -1238,7 +1238,7 @@ deprecated_osg::Geometry * LinearConstraint::makeGeometry(const osg::Vec3Array *
if (_midline->size()>0) {
osg::ref_ptr<osg::Vec3Array> locpts=getPoints(points);
if (texture!="") {
osg::Image* image = osgDB::readImageFile(texture.c_str());
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile(texture.c_str());
if (image)
{
osg::Texture2D* txt = new osg::Texture2D;

View File

@@ -139,7 +139,7 @@ int main( int argc, char **argv )
bool needToSetHomePosition = false;
// read the scene from the list of file specified commandline args.
osg::ref_ptr<osg::Node> scene = osgDB::readNodeFiles(arguments);
osg::ref_ptr<osg::Node> scene = osgDB::readRefNodeFiles(arguments);
// if one hasn't been loaded create an earth and sun test model.
if (!scene)

View File

@@ -303,7 +303,7 @@ bool DePee::createHUD()
osg::BoundingBox bb;
for(unsigned int i=0;i<geode->getNumDrawables();++i)
{
bb.expandBy(geode->getDrawable(i)->getBound());
bb.expandBy(geode->getDrawable(i)->getBoundingBox());
}
osg::Geometry* geom = new osg::Geometry;

View File

@@ -20,7 +20,7 @@
/*!
The DePee class is main class for setting up and managing depth peeling.
A DePee object can be seen as a virtual node, that has one parent and one child. The rendering of every child and subchil of this child is managed by the the DePee node. Besides that, it handles a head up display.
A DePee object can be seen as a virtual node, that has one parent and one child. The rendering of every child and subchil of this child is managed by the DePee node. Besides that, it handles a head up display.
*/
class DePee : public osg::Referenced
{

View File

@@ -18,7 +18,7 @@
#include <iostream>
#include "DePee.h"
#include "DePee.h"
/*!
Handles keyboard events.
@@ -28,7 +28,7 @@
class KeyboardEventHandler : public osgGA::GUIEventHandler
{
public:
KeyboardEventHandler(DePee* dePee)
{
_apc = 0;
@@ -41,12 +41,12 @@ public:
_dePee->setSketchy(_sketchy);
_dePee->setColored(_colored);
}
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&)
{
switch(ea.getEventType())
{
case(osgGA::GUIEventAdapter::KEYDOWN):
{
if (ea.getKey()==osgGA::GUIEventAdapter::KEY_Space)
@@ -77,7 +77,7 @@ public:
_dePee->setSketchy(_sketchy);
return true;
}
else if (ea.getKey() == 'e')
{
_edgy = !_edgy;
@@ -106,13 +106,13 @@ public:
_crayon = !_crayon;
_dePee->setCrayon(_crayon);
}
break;
}
default:
break;
}
return false;
}
@@ -139,12 +139,12 @@ private:
class MouseEventHandler : public osgGA::GUIEventHandler
{
public:
MouseEventHandler(DePee* dePee)
{
_dePee = dePee;
}
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&)
{
switch(ea.getEventType())
@@ -152,17 +152,17 @@ public:
//mouse
case(osgGA::GUIEventAdapter::DRAG):
{
rotate(ea.getXnormalized(), ea.getYnormalized());
rotate(ea.getXnormalized(), ea.getYnormalized());
break;
}
case(osgGA::GUIEventAdapter::MOVE):
_prevX = ea.getXnormalized();
_prevX = ea.getXnormalized();
_prevY = ea.getYnormalized();
break;
default:
break;
}
return false;
}
@@ -175,25 +175,25 @@ private:
void rotate(float x, float y)
{
osg::Matrix baseMatrix = _modelGroupTransform->getMatrix();
baseMatrix.preMultTranslate(_rotCenter);
baseMatrix.preMultRotate(osg::Quat((x - _prevX) * 3, osg::Vec3d(0.0, 0.0, 1.0)));
baseMatrix.preMultRotate(osg::Quat(-(y - _prevY) * 3, (baseMatrix * osg::Vec3d(1.0, 0.0, 0.0))));
baseMatrix.preMultTranslate(-_rotCenter);
_modelGroupTransform->setMatrix(baseMatrix);
_prevX = x;
_prevX = x;
_prevY = y;
};
DePee* _dePee;
float _prevX;
float _prevX;
float _prevY;
osg::Vec3 _rotCenter;
osg::MatrixTransform* _modelGroupTransform;
osg::MatrixTransform* _modelGroupTransform;
};
@@ -202,25 +202,25 @@ int main( int argc, char **argv )
{
// use an ArgumentParser object to manage the program arguments.
osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates Depth Peeling");
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" filename");
// construct the viewer
osgViewer::Viewer viewer(arguments);
// any option left unread are converted into errors to write out later.
arguments.reportRemainingOptionsAsUnrecognized();
// report any errors if they have occurred when parsing the program arguments.
if (arguments.errors())
{
arguments.writeErrorMessages(std::cout);
return 1;
}
if (arguments.argc()<=1 || arguments.argc() > 3)
{
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
@@ -232,29 +232,29 @@ int main( int argc, char **argv )
viewer.getCamera()->setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);
// read the model to do depth peeling with
osg::Node* loadedModel = osgDB::readNodeFile(arguments.argv()[1]);
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFile(arguments.argv()[1]);
if (!loadedModel)
return 1;
// create a transform to spin the model.
osg::MatrixTransform* modelGroupTransform = new osg::MatrixTransform;
osg::Group* modelGroup = new osg::Group;
modelGroupTransform->addChild(modelGroup);
modelGroup->addChild(loadedModel);
osg::Group* rootNode = new osg::Group();
// add model to the viewer.
viewer.setSceneData(rootNode);
// Depth peel example only works on a single graphics context right now
// so open up viewer on single screen to prevent problems
viewer.setUpViewOnSingleScreen(0);
// create the windows and run the threads.
viewer.realize();
unsigned int width = 1280;
unsigned int height = 1280;
osgViewer::Viewer::Windows windows;
@@ -266,11 +266,11 @@ int main( int argc, char **argv )
}
osg::ref_ptr<DePee> dePee = new DePee(rootNode,
modelGroupTransform,
osg::ref_ptr<DePee> dePee = new DePee(rootNode,
modelGroupTransform,
width,
height);
//create event handlers
KeyboardEventHandler* keyboardEventHandler = new KeyboardEventHandler(dePee.get());
MouseEventHandler* mouseEventHandler = new MouseEventHandler(dePee.get());
@@ -278,7 +278,7 @@ int main( int argc, char **argv )
viewer.addEventHandler(mouseEventHandler);
//viewer.setCameraManipulator(new osgGA::TrackballManipulator);
osg::StateSet* stateset = modelGroupTransform->getOrCreateStateSet();
stateset->setMode(GL_BLEND, osg::StateAttribute::OFF);
@@ -287,15 +287,15 @@ int main( int argc, char **argv )
osg::AnimationPathCallback* apc = new osg::AnimationPathCallback(modelGroupTransform->getBound().center(),osg::Vec3(0.0f,0.0f,1.0f),osg::inDegrees(45.0f));
apc->setPause(true);
modelGroupTransform->setUpdateCallback(apc);
keyboardEventHandler->registerAnimationPathCallback(apc);
mouseEventHandler->registerModelGroupTransform(modelGroupTransform);
//setup stuff that is necessary for measuring fps
osg::Timer_t current_tick, previous_tick = 1;
double* fps = new double;
dePee->setFPS(fps);
while(!viewer.done())
{
current_tick = osg::Timer::instance()->tick();

View File

@@ -52,18 +52,96 @@
using namespace osg;
osg::Node* createDistortionSubgraph(osg::Node* subgraph, const osg::Vec4& clearColour)
struct CommandLineOptions
{
unsigned int width;
unsigned int height;
unsigned int tex_width;
unsigned int tex_height;
double sphere_radius;
double collar_radius;
double distance;
CommandLineOptions():
width(1024),
height(1024),
tex_width(1024),
tex_height(1024),
sphere_radius(1.0),
collar_radius(0.45),
distance(1.0)
{
osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface();
if (!wsi)
{
osg::notify(osg::NOTICE)<<"Error, no WindowSystemInterface available, cannot create windows."<<std::endl;
return;
}
unsigned int width, height;
wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height);
distance = sqrt(sphere_radius*sphere_radius - collar_radius*collar_radius);
}
void read(osg::ArgumentParser& arguments)
{
while (arguments.read("--width",width)) {}
while (arguments.read("--height",height)) {}
while (arguments.read("--texture-width",tex_width) || arguments.read("--tx",tex_width) ) {}
while (arguments.read("--texture-height",tex_height) || arguments.read("--ty",tex_height) ) {}
while (arguments.read("--radius", sphere_radius)) {}
while (arguments.read("--collar", collar_radius)) {}
distance = sqrt(sphere_radius*sphere_radius - collar_radius*collar_radius);
while (arguments.read("--distance", distance)) {}
}
};
class WindowResizedHandler : public osgGA::GUIEventHandler
{
public:
WindowResizedHandler()
{
}
virtual bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa, osg::Object* object, osg::NodeVisitor* nv)
{
osg::Camera* camera = dynamic_cast<osg::Camera*>(object);
if (!camera) return false;
const osg::FrameStamp* fs = nv->getFrameStamp();
if (ea.getEventType()==osgGA::GUIEventAdapter::RESIZE)
{
OSG_NOTICE<<"Window resized event context="<<ea.getGraphicsContext()<<" frameNumber = "<<fs->getFrameNumber()<<std::endl;
OSG_NOTICE<<" WindowX="<<ea.getWindowX()<<std::endl;
OSG_NOTICE<<" WindowY="<<ea.getWindowY()<<std::endl;
OSG_NOTICE<<" WindowWidth="<<ea.getWindowWidth()<<std::endl;
OSG_NOTICE<<" WindowHeight="<<ea.getWindowHeight()<<std::endl;
// reset the Camera viewport and associated Texture's to make sure it tracks the new window size.
camera->resize(ea.getWindowWidth(), ea.getWindowHeight());
}
return false;
}
};
osg::Node* createDistortionSubgraph(CommandLineOptions& options, 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->setTextureSize(options.tex_width, options.tex_height);
texture->setInternalFormat(GL_RGBA);
texture->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);
texture->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);
texture->setWrap(osg::Texture2D::WRAP_S, osg::Texture2D::CLAMP_TO_EDGE);
texture->setWrap(osg::Texture2D::WRAP_T, osg::Texture2D::CLAMP_TO_EDGE);
// set up the render to texture camera.
{
@@ -79,7 +157,7 @@ osg::Node* createDistortionSubgraph(osg::Node* subgraph, const osg::Vec4& clearC
camera->setViewMatrix(osg::Matrixd::identity());
// set viewport
camera->setViewport(0,0,tex_width,tex_height);
camera->setViewport(0,0,options.tex_width,options.tex_height);
// set the camera to render before the main camera.
camera->setRenderOrder(osg::Camera::PRE_RENDER);
@@ -94,6 +172,8 @@ osg::Node* createDistortionSubgraph(osg::Node* subgraph, const osg::Vec4& clearC
camera->addChild(subgraph);
distortionNode->addChild(camera);
camera->addEventCallback(new WindowResizedHandler());
}
// set up the hud camera
@@ -186,27 +266,13 @@ osg::Node* createDistortionSubgraph(osg::Node* subgraph, const osg::Vec4& clearC
return distortionNode;
}
void setDomeFaces(osgViewer::Viewer& viewer, osg::ArgumentParser& arguments)
void setDomeFaces(osgViewer::Viewer& viewer, CommandLineOptions& options)
{
osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface();
if (!wsi)
{
osg::notify(osg::NOTICE)<<"Error, no WindowSystemInterface available, cannot create windows."<<std::endl;
return;
}
unsigned int width, height;
wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height);
while (arguments.read("--width",width)) {}
while (arguments.read("--height",height)) {}
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
traits->x = 0;
traits->y = 0;
traits->width = width;
traits->height = height;
traits->width = options.width;
traits->height = options.height;
traits->windowDecoration = true;
traits->doubleBuffer = true;
traits->sharedContext = 0;
@@ -219,8 +285,8 @@ void setDomeFaces(osgViewer::Viewer& viewer, osg::ArgumentParser& arguments)
}
int center_x = width/2;
int center_y = height/2;
int center_x = options.width/2;
int center_y = options.height/2;
int camera_width = 256;
int camera_height = 256;
@@ -303,27 +369,18 @@ void setDomeFaces(osgViewer::Viewer& viewer, osg::ArgumentParser& arguments)
}
osg::Geometry* createDomeDistortionMesh(const osg::Vec3& origin, const osg::Vec3& widthVector, const osg::Vec3& heightVector,
osg::ArgumentParser& arguments)
CommandLineOptions& options)
{
double sphere_radius = 1.0;
if (arguments.read("--radius", sphere_radius)) {}
double collar_radius = 0.45;
if (arguments.read("--collar", collar_radius)) {}
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::Vec3d projector = eye - osg::Vec3d(0.0,0.0, options.distance);
osg::notify(osg::NOTICE)<<"Projector position = "<<projector<<std::endl;
osg::notify(osg::NOTICE)<<"distance = "<<distance<<std::endl;
osg::notify(osg::NOTICE)<<"distance = "<<options.distance<<std::endl;
// create the quad to visualize.
@@ -396,15 +453,15 @@ osg::Geometry* createDomeDistortionMesh(const osg::Vec3& origin, const osg::Vec3
// 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 f = options.distance * sin(phi);
double e = options.distance * cos(phi) + sqrt( options.sphere_radius*options.sphere_radius - f*f);
double l = e * cos(phi);
double h = e * sin(phi);
double z = l - distance;
double z = l - options.distance;
osg::Vec3 texcoord(h * cos(theta) / sphere_radius,
h * sin(theta) / sphere_radius,
z / sphere_radius);
osg::Vec3 texcoord(h * cos(theta) / options.sphere_radius,
h * sin(theta) / options.sphere_radius,
z / options.sphere_radius);
vertices->push_back(cursor);
colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
@@ -437,33 +494,17 @@ osg::Geometry* createDomeDistortionMesh(const osg::Vec3& origin, const osg::Vec3
return geometry;
}
void setDomeCorrection(osgViewer::Viewer& viewer, osg::ArgumentParser& arguments)
void setDomeCorrection(osgViewer::Viewer& viewer, CommandLineOptions& options)
{
osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface();
if (!wsi)
{
osg::notify(osg::NOTICE)<<"Error, no WindowSystemInterface available, cannot create windows."<<std::endl;
return;
}
unsigned int width, height;
wsi->getScreenResolution(osg::GraphicsContext::ScreenIdentifier(0), width, height);
while (arguments.read("--width",width)) {}
while (arguments.read("--height",height)) {}
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
traits->x = 0;
traits->y = 0;
traits->width = width;
traits->height = height;
traits->width = options.width;
traits->height = options.height;
traits->windowDecoration = false;
traits->doubleBuffer = true;
traits->sharedContext = 0;
osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get());
if (!gc)
{
@@ -471,18 +512,18 @@ void setDomeCorrection(osgViewer::Viewer& viewer, osg::ArgumentParser& arguments
return;
}
int tex_width = 512;
int tex_height = 512;
int camera_width = tex_width;
int camera_height = tex_height;
int camera_width = options.tex_width;
int camera_height = options.tex_height;
osg::TextureCubeMap* texture = new osg::TextureCubeMap;
texture->setTextureSize(tex_width, tex_height);
texture->setTextureSize(options.tex_width, options.tex_height);
texture->setInternalFormat(GL_RGB);
texture->setFilter(osg::Texture::MIN_FILTER,osg::Texture::LINEAR);
texture->setFilter(osg::Texture::MAG_FILTER,osg::Texture::LINEAR);
texture->setWrap(osg::Texture::WRAP_S,osg::Texture::CLAMP_TO_EDGE);
texture->setWrap(osg::Texture::WRAP_T,osg::Texture::CLAMP_TO_EDGE);
texture->setWrap(osg::Texture::WRAP_R,osg::Texture::CLAMP_TO_EDGE);
#if 0
osg::Camera::RenderTargetImplementation renderTargetImplementation = osg::Camera::SEPERATE_WINDOW;
@@ -614,7 +655,7 @@ void setDomeCorrection(osgViewer::Viewer& viewer, osg::ArgumentParser& arguments
// distortion correction set up.
{
osg::Geode* geode = new osg::Geode();
geode->addDrawable(createDomeDistortionMesh(osg::Vec3(0.0f,0.0f,0.0f), osg::Vec3(width,0.0f,0.0f), osg::Vec3(0.0f,height,0.0f), arguments));
geode->addDrawable(createDomeDistortionMesh(osg::Vec3(0.0f,0.0f,0.0f), osg::Vec3(options.width,0.0f,0.0f), osg::Vec3(0.0f,options.height,0.0f), options));
// new we need to add the texture to the mesh, we do so by creating a
// StateSet to contain the Texture StateAttribute.
@@ -626,7 +667,7 @@ void setDomeCorrection(osgViewer::Viewer& viewer, osg::ArgumentParser& arguments
camera->setGraphicsContext(gc.get());
camera->setClearMask(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT );
camera->setClearColor( osg::Vec4(0.1,0.1,1.0,1.0) );
camera->setViewport(new osg::Viewport(0, 0, width, height));
camera->setViewport(new osg::Viewport(0, 0, options.width, options.height));
GLenum buffer = traits->doubleBuffer ? GL_BACK : GL_FRONT;
camera->setDrawBuffer(buffer);
camera->setReadBuffer(buffer);
@@ -635,7 +676,7 @@ void setDomeCorrection(osgViewer::Viewer& viewer, osg::ArgumentParser& arguments
//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->setProjectionMatrixAsOrtho2D(0,options.width,0,options.height);
camera->setViewMatrix(osg::Matrix::identity());
// add subgraph to render
@@ -655,14 +696,17 @@ int main(int argc, char** argv)
// use an ArgumentParser object to manage the program arguments.
osg::ArgumentParser arguments(&argc,argv);
CommandLineOptions options;
options.read(arguments);
// construct the viewer.
osgViewer::Viewer viewer;
osgViewer::Viewer viewer(arguments);
// load the nodes from the commandline arguments.
osg::Node* loadedModel = osgDB::readNodeFiles(arguments);
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles(arguments);
// if not loaded assume no arguments passed in, try use default mode instead.
if (!loadedModel) loadedModel = osgDB::readNodeFile("cow.osgt");
if (!loadedModel) loadedModel = osgDB::readRefNodeFile("cow.osgt");
if (!loadedModel)
{
@@ -674,20 +718,20 @@ int main(int argc, char** argv)
if (arguments.read("--dome") || arguments.read("--puffer") )
{
setDomeCorrection(viewer, arguments);
setDomeCorrection(viewer, options);
viewer.setSceneData( loadedModel );
}
else if (arguments.read("--faces"))
{
setDomeFaces(viewer, arguments);
setDomeFaces(viewer, options);
viewer.setSceneData( loadedModel );
}
else
{
osg::Node* distortionNode = createDistortionSubgraph( loadedModel, viewer.getCamera()->getClearColor());
osg::Node* distortionNode = createDistortionSubgraph( options, loadedModel.get(), viewer.getCamera()->getClearColor());
viewer.setSceneData( distortionNode );
}
@@ -738,6 +782,9 @@ int main(int argc, char** argv)
viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded);
// add window resize handler
viewer.addEventHandler(new osgViewer::WindowSizeHandler);
// add the state manipulator
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );

View File

@@ -97,7 +97,7 @@ createStateSet()
ss->setAttribute( program.get(),
osg::StateAttribute::ON | osg::StateAttribute::PROTECTED );
osg::ref_ptr< osg::Image> iLogo = osgDB::readImageFile( "Images/osg128.png" );
osg::ref_ptr< osg::Image> iLogo = osgDB::readRefImageFile( "Images/osg128.png" );
if( !iLogo.valid() )
{
osg::notify( osg::ALWAYS ) << "Can't open image file osg128.png" << std::endl;

View File

@@ -44,21 +44,21 @@ osg::Node* createEarth()
osg::TessellationHints* hints = new osg::TessellationHints;
hints->setDetailRatio(5.0f);
osg::ShapeDrawable* sd = new osg::ShapeDrawable(new osg::Sphere(osg::Vec3(0.0,0.0,0.0), osg::WGS_84_RADIUS_POLAR), hints);
osg::Geode* geode = new osg::Geode;
geode->addDrawable(sd);
std::string filename = osgDB::findDataFile("Images/land_shallow_topo_2048.jpg");
geode->getOrCreateStateSet()->setTextureAttributeAndModes(0, new osg::Texture2D(osgDB::readImageFile(filename)));
geode->getOrCreateStateSet()->setTextureAttributeAndModes(0, new osg::Texture2D(osgDB::readRefImageFile(filename)));
osg::CoordinateSystemNode* csn = new osg::CoordinateSystemNode;
csn->setEllipsoidModel(new osg::EllipsoidModel());
csn->addChild(geode);
return csn;
}
osgText::Text* createText(osg::EllipsoidModel* ellipsoid, double latitude, double longitude, double height, const std::string& str)
@@ -78,7 +78,7 @@ osgText::Text* createText(osg::EllipsoidModel* ellipsoid, double latitude, doubl
text->setCharacterSize(300000.0f);
text->setCharacterSizeMode(osgText::Text::OBJECT_COORDS_WITH_MAXIMUM_SCREEN_SIZE_CAPPED_BY_FONT_HEIGHT);
text->setAutoRotateToScreen(true);
return text;
}
@@ -87,10 +87,10 @@ osg::Node* createFadeText(osg::EllipsoidModel* ellipsoid)
osg::Group* group = new osg::Group;
group->getOrCreateStateSet()->setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);
osg::Geode* geode = new osg::Geode;
group->addChild(geode);
std::vector<std::string> textList;
textList.push_back("Town");
textList.push_back("City");
@@ -99,7 +99,7 @@ osg::Node* createFadeText(osg::EllipsoidModel* ellipsoid)
textList.push_back("Mountain");
textList.push_back("Road");
textList.push_back("Lake");
unsigned int numLat = 15;
unsigned int numLong = 20;
double latitude = 0.0;
@@ -118,7 +118,7 @@ osg::Node* createFadeText(osg::EllipsoidModel* ellipsoid)
}
return group;
}
}
int main(int, char**)
@@ -128,10 +128,10 @@ int main(int, char**)
viewer.getCamera()->setComputeNearFarMode(osg::CullSettings::COMPUTE_NEAR_FAR_USING_PRIMITIVES);
viewer.getCamera()->setNearFarRatio(0.00001f);
// read the scene from the list of file specified commandline args.
osg::ref_ptr<osg::Node> root = createEarth();
if (!root) return 0;
// add a viewport to the viewer and attach the scene graph.
@@ -142,7 +142,7 @@ int main(int, char**)
{
// add fade text around the globe
csn->addChild(createFadeText(csn->getEllipsoidModel()));
}
}
viewer.setCameraManipulator(new osgGA::TerrainManipulator);

View File

@@ -19,17 +19,10 @@ void textInfo(osgText::Text* text)
for(unsigned int i = 0; i < s.size(); i++)
{
osg::Vec2 ul = gq.getCoords()[0 + (i * 4)]; // upperLeft
osg::Vec2 ll = gq.getCoords()[1 + (i * 4)]; // lowerLeft
osg::Vec2 lr = gq.getCoords()[2 + (i * 4)]; // lowerRight
osg::Vec2 ur = gq.getCoords()[3 + (i * 4)]; // upperRight
/*
osg::Vec3 ul = gq.getTransformedCoords(0)[0 + (i * 4)];
osg::Vec3 ll = gq.getTransformedCoords(0)[1 + (i * 4)];
osg::Vec3 lr = gq.getTransformedCoords(0)[2 + (i * 4)];
osg::Vec3 ur = gq.getTransformedCoords(0)[3 + (i * 4)];
*/
osg::Vec2 ul = (*gq.getCoords())[0 + (i * 4)]; // upperLeft
osg::Vec2 ll = (*gq.getCoords())[1 + (i * 4)]; // lowerLeft
osg::Vec2 lr = (*gq.getCoords())[2 + (i * 4)]; // lowerRight
osg::Vec2 ur = (*gq.getCoords())[3 + (i * 4)]; // upperRight
osg::notify(osg::NOTICE)
<< "'" << static_cast<char>(s[i]) << "':"
@@ -69,7 +62,7 @@ osgText::Text* createLabel(const std::string& l, const char* f, unsigned int siz
static osg::Vec3 pos(10.0f, 10.0f, 0.0f);
osgText::Text* label = new osgText::Text();
osgText::Font* font = osgText::readFontFile(f);
osg::ref_ptr<osgText::Font> font = osgText::readRefFontFile(f);
label->setFont(font);
label->setCharacterSize(size);

View File

@@ -388,7 +388,7 @@ osg::Geode* ForestTechniqueManager::createTerrain(const osg::Vec3& origin, const
// ---------------------------------------
osg::StateSet* stateset = new osg::StateSet();
osg::Image* image = osgDB::readImageFile("Images/lz.rgb");
osg::ref_ptr<osg::Image> image = osgDB::readRefImageFile("Images/lz.rgb");
if (image)
{
osg::Texture2D* texture = new osg::Texture2D;
@@ -812,9 +812,9 @@ class ShaderGeometry : public osg::Drawable
}
}
virtual osg::BoundingBox computeBound() const
virtual osg::BoundingBox computeBoundingBox() const
{
osg::BoundingBox geom_box = _geometry->getBound();
osg::BoundingBox geom_box = _geometry->getBoundingBox();
osg::BoundingBox bb;
for(PositionSizeList::const_iterator itr = _trees.begin();
itr != _trees.end();
@@ -1182,7 +1182,7 @@ osg::Node* ForestTechniqueManager::createScene(unsigned int numTreesToCreates, u
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"));
tex->setImage(osgDB::readRefImageFile("Images/tree0.rgba"));
osg::StateSet *dstate = new osg::StateSet;
{

View File

@@ -23,7 +23,6 @@
#include <osg/Geometry>
#include <osg/GLExtensions>
#include <osg/Node>
#include <osg/NodeCallback>
#include <osg/Notify>
#include <osg/observer_ptr>
#include <osg/Projection>
@@ -133,10 +132,10 @@ void getPossibleConfigs(GraphicsContext* gc, BufferConfigList& colorConfigs,
unsigned contextID = gc->getState()->getContextID();
colorConfigs.push_back(BufferConfig("RGBA8", GL_RGBA8, 8));
depthConfigs.push_back(BufferConfig("D24", GL_DEPTH_COMPONENT24, 24));
FBOExtensions* fboe = FBOExtensions::instance(contextID, true);
if (!fboe->isSupported())
osg::GLExtensions* ext = gc->getState()->get<GLExtensions>();
if (!ext->isRenderbufferMultisampleSupported())
return;
if (fboe->isMultisampleSupported())
if (ext->isMultisampleSupported)
glGetIntegerv(GL_MAX_SAMPLES_EXT, &maxSamples);
// isMultisampleCoverageSupported
if (isGLExtensionSupported(contextID,
@@ -157,9 +156,8 @@ void getPossibleConfigs(GraphicsContext* gc, BufferConfigList& colorConfigs,
bool checkFramebufferStatus(GraphicsContext* gc, bool silent = false)
{
State& state = *gc->getState();
unsigned contextID = state.getContextID();
FBOExtensions* fboe = FBOExtensions::instance(contextID, true);
switch(fboe->glCheckFramebufferStatus(GL_FRAMEBUFFER_EXT)) {
osg::GLExtensions* ext = state.get<GLExtensions>();
switch(ext->glCheckFramebufferStatus(GL_FRAMEBUFFER_EXT)) {
case GL_FRAMEBUFFER_COMPLETE_EXT:
break;
case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
@@ -243,30 +241,30 @@ bool createFBO(GraphicsContext* gc, FboConfig &config, FboData &data)
}
State& state = *gc->getState();
unsigned int contextID = state.getContextID();
FBOExtensions* fboe = FBOExtensions::instance(contextID, true);
osg::GLExtensions* ext = gc->getState()->get<GLExtensions>();
data.fb->apply(state);
result = checkFramebufferStatus(gc, true);
if (!result)
{
fboe->glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0);
ext->glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0);
return false;
}
int query;
if (multisample)
{
GLuint colorRBID = colorRB->getObjectID(contextID, fboe);
fboe->glBindRenderbuffer(GL_RENDERBUFFER_EXT, colorRBID);
GLuint colorRBID = colorRB->getObjectID(contextID, ext);
ext->glBindRenderbuffer(GL_RENDERBUFFER_EXT, colorRBID);
if (csaa)
{
fboe->glGetRenderbufferParameteriv(GL_RENDERBUFFER_EXT,
ext->glGetRenderbufferParameteriv(GL_RENDERBUFFER_EXT,
GL_RENDERBUFFER_COVERAGE_SAMPLES_NV,
&query);
if (query < config.coverageSamples)
result = false;
else
config.coverageSamples = query;
fboe->glGetRenderbufferParameteriv(GL_RENDERBUFFER_EXT,
ext->glGetRenderbufferParameteriv(GL_RENDERBUFFER_EXT,
GL_RENDERBUFFER_COLOR_SAMPLES_NV,
&query);
@@ -278,7 +276,7 @@ bool createFBO(GraphicsContext* gc, FboConfig &config, FboData &data)
}
else
{
fboe->glGetRenderbufferParameteriv(GL_RENDERBUFFER_EXT,
ext->glGetRenderbufferParameteriv(GL_RENDERBUFFER_EXT,
GL_RENDERBUFFER_SAMPLES_EXT,
&query);
if (query < config.depthSamples)
@@ -304,7 +302,7 @@ bool createFBO(GraphicsContext* gc, FboConfig &config, FboData &data)
result = false;
}
}
fboe->glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0);
ext->glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0);
return result;
}
@@ -697,15 +695,15 @@ GraphicsContext* setupGC(osgViewer::Viewer& viewer, ArgumentParser& arguments)
DisplaySettings* ds = viewer.getDisplaySettings() ? viewer.getDisplaySettings() : DisplaySettings::instance().get();
GraphicsContext::ScreenIdentifier si;
si.readDISPLAY();
// displayNum has not been set so reset it to 0.
if (si.displayNum<0) si.displayNum = 0;
si.setUndefinedScreenDetailsToDefaultScreen();
bool decoration = true;
if (x < 0)
{
unsigned int w, h;
wsi->getScreenResolution(si, w, h);
OSG_NOTICE<<"Screen resolution is "<<w<<", "<<h<<std::endl;
OSG_NOTICE<<"ScreenIdentifier "<<si.displayNum<<", "<<si.screenNum<<std::endl;
x = 0;
y = 0;
width = w;
@@ -713,8 +711,9 @@ GraphicsContext* setupGC(osgViewer::Viewer& viewer, ArgumentParser& arguments)
decoration = false;
}
ref_ptr<GraphicsContext::Traits> traits
= new GraphicsContext::Traits(ds);
OSG_NOTICE<<"x = "<<x<<", y = "<<y<<", width = "<<width<<", height = "<<height<<std::endl;
ref_ptr<GraphicsContext::Traits> traits = new GraphicsContext::Traits(ds);
traits->hostName = si.hostName;
traits->displayNum = si.displayNum;
traits->screenNum = si.screenNum;
@@ -725,10 +724,9 @@ GraphicsContext* setupGC(osgViewer::Viewer& viewer, ArgumentParser& arguments)
traits->windowDecoration = decoration;
traits->doubleBuffer = true;
traits->sharedContext = 0;
ref_ptr<GraphicsContext> gc
= GraphicsContext::createGraphicsContext(traits.get());
osgViewer::GraphicsWindow* gw
= dynamic_cast<osgViewer::GraphicsWindow*>(gc.get());
ref_ptr<GraphicsContext> gc = GraphicsContext::createGraphicsContext(traits.get());
osgViewer::GraphicsWindow* gw = dynamic_cast<osgViewer::GraphicsWindow*>(gc.get());
if (gw)
{
OSG_NOTIFY(INFO)<<"View::setUpViewOnSingleScreen - GraphicsWindow has been created successfully."<<std::endl;
@@ -751,20 +749,29 @@ GraphicsContext* setupGC(osgViewer::Viewer& viewer, ArgumentParser& arguments)
}
// Context has to be current to test for extensions
gc->realize();
gc->makeCurrent();
if (!gc->makeCurrent())
{
OSG_NOTIFY(NOTICE) << "Unable to create GraphicsWindow"<<std::endl;
gc->releaseContext();
gc->close(true);
return 0;
}
unsigned int contextID = gc->getState()->getContextID();
FBOExtensions* fboe = FBOExtensions::instance(contextID, true);
if (!fboe->isSupported())
osg::GLExtensions* ext = gc->getState()->get<GLExtensions>();
if (!ext->isFrameBufferObjectSupported)
{
OSG_NOTIFY(NOTICE) << "Frame buffer objects are not supported\n";
gc->releaseContext();
gc->close(true);
return 0;
}
if (isGLExtensionSupported(contextID, "GL_ARB_depth_buffer_float"))
depthTextureEnum = GL_DEPTH_COMPONENT32F;
else if (isGLExtensionSupported(contextID, "GL_NV_depth_buffer_float"))
depthTextureEnum = GL_DEPTH_COMPONENT32F_NV;
BufferConfigList colorConfigs;
BufferConfigList depthConfigs;
vector<int> coverageConfigs;
@@ -956,7 +963,7 @@ int main(int argc, char **argv)
arguments.getApplicationUsage()->write(std::cout,osg::ApplicationUsage::COMMAND_LINE_OPTION);
return 1;
}
ref_ptr<Node> loadedModel = osgDB::readNodeFiles(arguments);
ref_ptr<Node> loadedModel = osgDB::readRefNodeFiles(arguments);
if (!loadedModel) {
cerr << "couldn't load " << argv[1] << "\n";
return 1;

View File

@@ -127,7 +127,7 @@ public:
for (osgFX::Registry::EffectMap::const_iterator i=emap.begin(); i!=emap.end(); ++i) {
std::cout << "INFO: \t" << i->first << "\n";
osg::ref_ptr<osgFX::Effect> effect = static_cast<osgFX::Effect *>(i->second->cloneType());
_effects.push_back(effect.get());
_effects.push_back(effect.get());
}
std::cout << "INFO: " << emap.size() << " effect(s) ready.\n";
@@ -144,9 +144,9 @@ public:
inline void setScene(osg::Node* node) { _scene = node; }
inline bool getEffectsEnabled() const { return _fxen; }
inline void setEffectsEnabled(bool v)
{
_fxen = v;
inline void setEffectsEnabled(bool v)
{
_fxen = v;
if (getSelectedEffect()) {
getSelectedEffect()->setEnabled(_fxen);
}
@@ -156,7 +156,7 @@ public:
inline void setEffectIndex(int i)
{
if (i >= static_cast<int>(_effects.size())) i = 0;
if (i < 0) i = static_cast<int>(_effects.size()-1);
if (i < 0) i = static_cast<int>(_effects.size()-1);
_selected_fx = i;
rebuild();
}
@@ -174,11 +174,11 @@ protected:
{
float zPos = -0.1; // note from Robert, was 0.1f, but now must be -0.1f to keep text visible??#!? due
// to some other change in the OSG not tracked down yet...
osg::ref_ptr<osgText::Font> arial = osgText::readFontFile("fonts/arial.ttf");
osg::ref_ptr<osgText::Font> arial = osgText::readRefFontFile("fonts/arial.ttf");
osg::ref_ptr<osgText::Text> hints = new osgText::Text;
hints->setFont(arial.get());
hints->setFont(arial);
hints->setColor(_hints_color);
hints->setAlignment(osgText::Text::CENTER_BOTTOM);
hints->setCharacterSize(13);
@@ -195,7 +195,7 @@ protected:
if (!author_name.empty()) {
effect_description = author_name = "AUTHOR: " + std::string(_effects[_selected_fx]->effectAuthor()) + std::string("\n\n");
}
effect_description += "DESCRIPTION:\n" + std::string(_effects[_selected_fx]->effectDescription());
effect_description += "DESCRIPTION:\n" + std::string(_effects[_selected_fx]->effectDescription());
if (_scene.valid() && _root.valid()) {
_root->removeChildren(0, _root->getNumChildren());
@@ -268,7 +268,7 @@ EffectPanel* build_gui(osg::Group* root)
osg::ref_ptr<EffectPanel> effect_panel = new EffectPanel;
effect_panel->setCaption("osgFX Effect Browser");
effect_panel->setRect(osgfxbrowser::Rect(20, 20, 1000, 280));
effect_panel->setRect(osgfxbrowser::Rect(20, 20, 1000, 280));
hud->addChild(effect_panel.get());
@@ -325,7 +325,7 @@ int main(int argc, char *argv[])
unsigned int clearMask = viewer.getCamera()->getClearMask();
viewer.getCamera()->setClearMask(clearMask | GL_STENCIL_BUFFER_BIT);
viewer.getCamera()->setClearStencil(0);
// any option left unread are converted into errors to write out later.
arguments.reportRemainingOptionsAsUnrecognized();
@@ -336,11 +336,11 @@ int main(int argc, char *argv[])
}
// read the scene from the list of file specified commandline args.
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(arguments);
osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles(arguments);
// if not loaded assume no arguments passed in, try use default mode instead.
if (!loadedModel) loadedModel = osgDB::readNodeFile("dumptruck.osgt");
if (!loadedModel) loadedModel = osgDB::readRefNodeFile("dumptruck.osgt");
if (!loadedModel)
{
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;

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