Compare commits

..

60 Commits

Author SHA1 Message Date
Robert Osfield
b50d199ded Release OpenSceneGraph-3.0.0 2011-06-28 09:27:02 +00:00
Robert Osfield
806993f3e0 Updated ChangeLog and add fix for typo of name 2011-06-28 07:52:55 +00:00
Robert Osfield
8f4c026a85 Fixed typo and added entry about osgParticle. 2011-06-28 07:37:19 +00:00
Robert Osfield
373687b72f From Wang Rui, merged from changeset 12674. "I've found a small problem which causes crashes in the 3ds plugin
while trying to load a model. The fix here will ensure that the
texture map is valid and everything could work well then."
2011-06-28 07:28:10 +00:00
Robert Osfield
73026ea973 Merged from svn/trunk changeset 12675, "Added #if lib curl version check around #include <curl/types.h> as this header was deprecated and now
removed entirely from libcurl-7.21.7."
2011-06-28 07:25:43 +00:00
Robert Osfield
55ff7019a1 Updated dates in prep for release. 2011-06-27 22:04:22 +00:00
Robert Osfield
efa37bd4c4 From Jean-Sebestien Guay, merged from svn/trunk changeset 12669/12670 - fix for windows bug when reading ascii files with unix file endings. 2011-06-27 21:36:21 +00:00
Robert Osfield
b4a32f6cab Updated NEWS 2011-06-27 13:42:56 +00:00
Robert Osfield
9ffd6d1dc0 Updated NEWS for 3.0.0 2011-06-27 13:16:22 +00:00
Robert Osfield
701c976495 Update AUTHORS file for 3.0.0. 2011-06-27 12:59:45 +00:00
Robert Osfield
3f7406e903 Updated ChangeLOG, NEWS and READE for 3.0.0 release 2011-06-27 12:08:05 +00:00
Robert Osfield
0079c132a7 Updated Version number to final 3.0.0 configuration. 2011-06-27 10:45:36 +00:00
Robert Osfield
3254630625 Merged doxygen comment improvement from svn/trunk. 2011-06-27 10:22:03 +00:00
Robert Osfield
125fa6d05d Merged from svn/trunk changeset 12656. From Andreas Eskland, "I found that a binary PNM file couldn't be read by the PNM plugin in the 3.0 branch. Attached is a small fix in ReaderWriterPNM.cpp, simply opening the file in binary mode." 2011-06-25 20:55:01 +00:00
Robert Osfield
a92241d40d Merged from svn/trunk changset 12654. Fixed memory growth issue when using Texture2D::SubloadCallbacks that don't set the TextureObjects sizes. 2011-06-25 11:02:09 +00:00
Robert Osfield
8ea9d68c9c Merged from svn/trunk changeset 12652, Tighten up float usage 2011-06-25 07:07:58 +00:00
Robert Osfield
1e94ed9fa8 Updated ChangeLog and AUTHORS file for 3.0.0-rc5 2011-06-24 19:45:21 +00:00
Robert Osfield
cd7dc0f161 Merged from svn/trunk changeset 12648, tightened up float/double usage 2011-06-24 19:18:53 +00:00
Robert Osfield
6779944c0e Updated ChangeLog, NEWS and READE for 3.0.0-rc5 2011-06-24 16:27:42 +00:00
Robert Osfield
d5f476a822 Merged from svn/trunk changeset 12645. Removed redundent assert and associated variables to fix warnings. 2011-06-24 16:16:04 +00:00
Robert Osfield
b361047aa0 Updated release candidate number to 5 for 3.0.0-rc5 2011-06-24 16:05:23 +00:00
Robert Osfield
bd2ad48c00 Merged from svn/trunk changeset 12642, "Implemented missing writeShader" 2011-06-24 15:05:28 +00:00
Robert Osfield
e306f27e23 Merged from svn/trunk changeset 12640, From Martin Innus, fixed erroneous change of INTEGER to UNKNOWN, reverting back to INTEGER. 2011-06-24 13:36:45 +00:00
Robert Osfield
26ee7e07d3 Merged from svn/trunk changeset 12638:
Implemented missing Archive::readShader/writeShader, and added searching of the archive list in Registr::read() so that files
that are stored in the archives can be found.
2011-06-24 12:52:11 +00:00
Robert Osfield
3660e3a3c3 Merged from svn/trunk changeset 12636, "While we're on osgSim/ShapeAttribute, here's a fix that fixes the 'UNKNOW' typo and some
doxygen"
2011-06-24 08:33:58 +00:00
Robert Osfield
cb627520a7 From Wang Rui, Merged from svn/trunk changeset 12633.
"I've modified the code to handle -1.#IND and other kinds of infinite
values. Please see the attachments for details"
2011-06-24 08:16:59 +00:00
Robert Osfield
c5867e4957 Merged from svn/trunk changeset 12632. Added operator ==, != and < to fix VS build 2011-06-24 08:15:51 +00:00
Robert Osfield
8f20178748 Merged from svn/trunk changeset r12628.
Fixed warnings generated by clang,

src/osgAnimation/Skeleton.cpp:25:87: warning: addition of default argument on redeclaration makes this constructor a copy constructor [-Wdefault-arg-special-member]
Skeleton::UpdateSkeleton::UpdateSkeleton(const UpdateSkeleton& us, const osg::CopyOp& copyop= osg::CopyOp::SHALLOW_COPY) : osg::Object(us, copyop), osg::NodeCallback(us, copyop)

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

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

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

src/osgManipulator/Dragger.cpp:187:18: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
        if (*itr = constraint)
2011-06-23 20:09:26 +00:00
Robert Osfield
c93ef23d2f Updated release candidate number to 4. 2011-06-23 20:03:16 +00:00
Robert Osfield
69659ade08 Merged from svn/trunk changeset r12573, Added catch for window manager doesn't set the window size to full screen. 2011-06-23 18:29:35 +00:00
Robert Osfield
d4e68e5d73 Merged from svn/trunk changeset 12625. Warning fixes for:
OpenSceneGraph/src/osgPlugins/Inventor/ConvertFromInventor.cpp: In member function ?virtual SbBool SoVRMLImageTextureOsg::readInstance(SoInput*, short unsigned int)?:
OpenSceneGraph/src/osgPlugins/Inventor/ConvertFromInventor.cpp:1264:16: warning: variable ?retval? set but not used [-Wunused-but-set-variable]
OpenSceneGraph/src/osgPlugins/ac/Geode.cpp: In member function ?void ac3d::Geode::ProcessGeometry(std::ostream&, unsigned int)?:
OpenSceneGraph/src/osgPlugins/ac/Geode.cpp:806:35: warning: variable ?fRep_s? set but not used [-Wunused-but-set-variable]
OpenSceneGraph/src/osgPlugins/ac/Geode.cpp:806:43: warning: variable ?fRep_t? set but not used [-Wunused-but-set-variable]
OpenSceneGraph/src/osgPlugins/ac/Geode.cpp:807:35: warning: variable ?fOffset_s? set but not used [-Wunused-but-set-variable]
OpenSceneGraph/src/osgPlugins/ac/Geode.cpp:807:46: warning: variable ?fOffset_t? set but not used [-Wunused-but-set-variable]
OpenSceneGraph/src/osgViewer/GraphicsWindowX11.cpp: In member function ?virtual void osgViewer::GraphicsWindowX11::checkEvents()?:
OpenSceneGraph/src/osgViewer/GraphicsWindowX11.cpp:1181:10: warning: variable ?destroyWindowRequested? set but not used [-Wunused-but-set-variable]
2011-06-23 18:26:11 +00:00
Robert Osfield
b29bf3fe06 Merged from svn/trunk changeset 12623.Fixed virtual method mismtaches between subclasses and parent classes. 2011-06-23 16:39:25 +00:00
Robert Osfield
8f23b42ed2 From Ulrich Hertlein, build fix for OSX. 2011-06-23 15:42:44 +00:00
Robert Osfield
17d876f787 Merged from svn/trunk, changeset 12619, "Added better handling of archives in ReaderWriterZip::readNode() so that if there is no master file definition it
loads all the available nodes in the zip archive and returns an osg::Group containing all the nodes if there is more
than one, or just returns the node if there is just one.  Also implemented this functionality for ReaderWriterZip::readImage()."
2011-06-23 15:39:11 +00:00
Robert Osfield
5cb72e06c2 Fixed typo in name 2011-06-23 12:25:52 +00:00
Robert Osfield
68ac058045 Updated ChangeLog and AUTHORS files 2011-06-23 11:32:24 +00:00
Robert Osfield
75fa5c0555 Fixed name typos 2011-06-23 11:32:09 +00:00
Robert Osfield
3159b36acd Merged from svn/trunk changeset r12611.
Fixed warnings.

OpenSceneGraph/src/osgGA/NodeTrackerManipulator.cpp:32:1: warning: base class ?class osg::Object? should be explicitly initialized in the copy constructor
OpenSceneGraph/src/osgGA/TerrainManipulator.cpp:31:1: warning: base class ?class osg::Object? should be explicitly initialized in the copy constructor
OpenSceneGraph/include/osgSim/ShapeAttribute:99:9: warning: base class ?class std::vector<osgSim::ShapeAttribute>? should be explicitly initialized in the copy constructor
OpenSceneGraph/src/osgPlugins/zip/unzip.cpp:3102:14: warning: missing initializer for member ?unz_s::gi?
OpenSceneGraph/src/osgPlugins/zip/unzip.cpp:3102:14: warning: missing initializer for member ?unz_s::byte_before_the_zipfile?
OpenSceneGraph/src/osgPlugins/zip/unzip.cpp:3102:14: warning: missing initializer for member ?unz_s::num_file?
OpenSceneGraph/src/osgPlugins/zip/unzip.cpp:3102:14: warning: missing initializer for member ?unz_s::pos_in_central_dir?
OpenSceneGraph/src/osgPlugins/zip/unzip.cpp:3102:14: warning: missing initializer for member ?unz_s::current_file_ok?
OpenSceneGraph/src/osgPlugins/zip/unzip.cpp:3102:14: warning: missing initializer for member ?unz_s::central_pos?
OpenSceneGraph/src/osgPlugins/zip/unzip.cpp:3102:14: warning: missing initializer for member ?unz_s::size_central_dir?
OpenSceneGraph/src/osgPlugins/zip/unzip.cpp:3102:14: warning: missing initializer for member ?unz_s::offset_central_dir?
OpenSceneGraph/src/osgPlugins/zip/unzip.cpp:3102:14: warning: missing initializer for member ?unz_s::cur_file_info?
OpenSceneGraph/src/osgPlugins/zip/unzip.cpp:3102:14: warning: missing initializer for member ?unz_s::cur_file_info_internal?
OpenSceneGraph/src/osgPlugins/zip/unzip.cpp:3102:14: warning: missing initializer for member ?unz_s::pfile_in_zip_read?
OpenSceneGraph/src/osgViewer/CompositeViewer.cpp:30:1: warning: base class ?class osg::Object? should be explicitly initialized in the copy constructor
OpenSceneGraph/src/osgViewer/View.cpp:159:1: warning: base class ?class osg::Object? should be explicitly initialized in the copy constructor
OpenSceneGraph/src/osgViewer/Viewer.cpp:196:1: warning: base class ?class osg::Object? should be explicitly initialized in the copy constructor
OpenSceneGraph/src/osgViewer/Viewer.cpp:196:1: warning: base class ?class osgViewer::ViewerBase? should be explicitly initialized in the copy constructor
OpenSceneGraph/include/osgManipulator/Dragger:47:9: warning: base class ?class osg::Object? should be explicitly initialized in the copy constructor
2011-06-23 11:10:54 +00:00
Robert Osfield
893a6365a4 From Ryan Pavlik, merge from svn/trunk changeset 12608, "I have successfully compiled OpenSceneGraph trunk using the Clang compiler (using a recent trunk build of llvm and clang, haven't tested an older release). The attached files contain the change shown in the diff below, which was required to finish the build with Clang. It fixes an issue with two-phase name lookup - there's more information here http://blog.llvm.org/2009/12/dreaded-two-phase-name-lookup.html" 2011-06-23 09:39:45 +00:00
Robert Osfield
e330051cf3 Converted tabs to four spaces 2011-06-23 09:27:25 +00:00
Robert Osfield
672777189a From Dimi Christopoulos, merged from svn/trunk changeset 12606."I attach a fixed version of mipmap.cpp which produced a lot of warning on my gcc
compiler."
2011-06-23 09:24:38 +00:00
Robert Osfield
1ef313787d Update ChangeLog and AUTHORs file for 3.0.0-rc3 2011-06-22 16:34:46 +00:00
Robert Osfield
35c26bb5aa From Magnus Kessler, "I have recently installed the latest version of collada-dom on Linux, and
found that the include path has changed. By default, collada-dom now installs
its header files under /usr/local/include/collada-dom or/usr/include/collada-
dom. The attached FindCollada.cmake has been updated to look for these
locations in addition to the previous candidate locations."
2011-06-22 16:18:52 +00:00
Robert Osfield
8aee244e64 Updated ChangeLog and AUTHORS file for release 2011-06-22 15:41:57 +00:00
Robert Osfield
12ca59d3e5 Updated RC number for the 3.0.0-rc3 2011-06-22 12:45:35 +00:00
Robert Osfield
93156fd2ce Merged from svn/trunk changeset 12597:
Resolved warnings reported by g++ 4.6's -Wunused-but-set-variable.

Warnings were:

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

Find attached the corrected CMake module. "
2011-06-21 13:03:24 +00:00
Robert Osfield
80e1adfb6c Updated ChangeLog and AUTHORS file for 3.0.0-rc2 2011-06-21 10:26:30 +00:00
Robert Osfield
ff216c2100 Merged changeset 12581 from svn/trunk to address VisualStudio warning 2011-06-21 10:07:59 +00:00
Robert Osfield
7f6938ebad Merged from svn/trunk warnings fixes provided by Changeset 12582 from Michael Platings, along with addition
of returns at ends of files and changes to tabs to four spaces.
2011-06-21 09:58:31 +00:00
Robert Osfield
1dc91aa355 Updated release candidate number 2011-06-20 19:41:39 +00:00
Robert Osfield
caa9e38d2b Merged from svn/trunk, r12574.
From Farshid Lashkari, BGR write support for BMP, PNG and TGA
2011-06-20 19:37:40 +00:00
Robert Osfield
6402710910 Merged changes to svn/trunk that address cppcheck reported issues:
[examples/osgphotoalbum/PhotoArchive.cpp:56]: (error) Memory leak: fileIndentifier
[examples/osgphotoalbum/PhotoArchive.cpp:257]: (error) Deallocating a deallocated pointer: newData
[examples/osgphotoalbum/PhotoArchive.cpp:318]: (error) Deallocating a deallocated pointer: newData
[src/osg/ImageUtils.cpp:116]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/ImageUtils.cpp:307]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/ImageUtils.cpp:312]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/ImageUtils.cpp:367]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/ImageUtils.cpp:399]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/ImageUtils.cpp:400]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/ImageUtils.cpp:482]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/ImageUtils.cpp:483]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/ImageUtils.cpp:484]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/ImageUtils.cpp:519]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/ImageUtils.cpp:536]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/OcclusionQueryNode.cpp:71]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/OcclusionQueryNode.cpp:74]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/OcclusionQueryNode.cpp:77]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/OcclusionQueryNode.cpp:82]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/OcclusionQueryNode.cpp:102]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/OcclusionQueryNode.cpp:107]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/OcclusionQueryNode.cpp:599]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/OcclusionQueryNode.cpp:600]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/OcclusionQueryNode.cpp:601]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/OcclusionQueryNode.cpp:602]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/OcclusionQueryNode.cpp:603]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/OcclusionQueryNode.cpp:604]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/OcclusionQueryNode.cpp:605]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osg/OcclusionQueryNode.cpp:606]: (portability) Extra qualification 'osg::' unnecessary and considered an error by many compilers.
[src/osgDB/ExternalFileWriter.cpp:134]: (portability) Extra qualification 'osgDB::' unnecessary and considered an error by many compilers.
[src/osgDB/ExternalFileWriter.cpp:135]: (portability) Extra qualification 'osgDB::' unnecessary and considered an error by many compilers.
[src/osgDB/ExternalFileWriter.cpp:136]: (portability) Extra qualification 'osgDB::' unnecessary and considered an error by many compilers.
[src/osgDB/ExternalFileWriter.cpp:137]: (portability) Extra qualification 'osgDB::' unnecessary and considered an error by many compilers.
[src/osgDB/ExternalFileWriter.cpp:139]: (portability) Extra qualification 'osgDB::' unnecessary and considered an error by many compilers.
[src/osgDB/ExternalFileWriter.cpp:177]: (portability) Extra qualification 'osgDB::' unnecessary and considered an error by many compilers.
[src/osgDB/ExternalFileWriter.cpp:178]: (portability) Extra qualification 'osgDB::' unnecessary and considered an error by many compilers.
[src/osgDB/ExternalFileWriter.cpp:195]: (portability) Extra qualification 'osgDB::' unnecessary and considered an error by many compilers.
[src/osgDB/ExternalFileWriter.cpp:198]: (portability) Extra qualification 'osgDB::' unnecessary and considered an error by many compilers.
[src/osgDB/ExternalFileWriter.cpp:203]: (portability) Extra qualification 'osgDB::' unnecessary and considered an error by many compilers.
[src/osgDB/ExternalFileWriter.cpp:205]: (portability) Extra qualification 'osgDB::' unnecessary and considered an error by many compilers.
[src/osgDB/ExternalFileWriter.cpp:253]: (portability) Extra qualification 'osgDB::' unnecessary and considered an error by many compilers.
[src/osgDB/InputStream.cpp:553]: (error) Memory leak: data
[src/osgDB/OutputStream.cpp:393]: (error) Memory leak: data
[src/osgPlugins/Inventor/ConvertToInventor.cpp:656]: (error) Mismatching allocation and deallocation: tmpArray
[src/osgPlugins/Inventor/ReaderWriterIV.cpp:237]: (error) Common realloc mistake: 'buf' nulled but not freed upon failure
[src/osgPlugins/OpenFlight/expGeometryRecords.cpp:167]: (portability) Extra qualification 'flt::' unnecessary and considered an error by many compilers.
[src/osgPlugins/OpenFlight/expGeometryRecords.cpp:373]: (portability) Extra qualification 'flt::' unnecessary and considered an error by many compilers.
[src/osgPlugins/cfg/CameraConfig.cpp:635]: (error) Unusual pointer arithmetic
[src/osgPlugins/freetype/FreeTypeLibrary.cpp:122]: (error) Memory leak: buffer
[src/osgPlugins/geo/ReaderWriterGEO.cpp:210]: (error) Possible null pointer dereference: gfd - otherwise it is redundant to check if gfd is null at line 211
[src/osgPlugins/geo/ReaderWriterGEO.cpp:227]: (error) Possible null pointer dereference: gfd - otherwise it is redundant to check if gfd is null at line 228
[src/osgPlugins/geo/ReaderWriterGEO.cpp:903]: (error) Possible null pointer dereference: gfd - otherwise it is redundant to check if gfd is null at line 904
[src/osgPlugins/geo/osgGeoNodes.h:180]: (error) Memory leak: geoHeaderGeo::intVars
[src/osgPlugins/geo/osgGeoNodes.h:181]: (error) Memory leak: geoHeaderGeo::useVars
[src/osgPlugins/geo/osgGeoNodes.h:182]: (error) Memory leak: geoHeaderGeo::extVars
[src/osgPlugins/md2/ReaderWriterMD2.cpp:180]: (error) Memory leak: mapbase
[src/osgPlugins/md2/ReaderWriterMD2.cpp:166]: (error) Resource leak: file_fd
[src/osgPlugins/pic/ReaderWriterPIC.cpp:152]: (error) Mismatching allocation and deallocation: tmpbuf
[src/osgPlugins/pic/ReaderWriterPIC.cpp:153]: (error) Mismatching allocation and deallocation: buffer
[src/osgPlugins/ply/plyfile.cpp:843]: (error) Memory leak: plyfile
[src/osgPlugins/pvr/ReaderWriterPVR.cpp:179]: (error) Memory leak: imageData
[src/osgPlugins/shp/ESRIShapeParser.cpp:29]: (error) Resource leak: fd
[src/osgPlugins/shp/XBaseParser.cpp:96]: (error) Resource leak: fd
[src/osgPlugins/zip/unzip.cpp:3158]: (error) Possible null pointer dereference: s - otherwise it is redundant to check if s is null at line 3159
[src/osgPlugins/zip/unzip.cpp:4155]: (error) Dangerous usage of 'rd' (strncpy doesn't always 0-terminate it)
[src/osgShadow/MinimalCullBoundsShadowMap.cpp:334]: (error) Possible null pointer dereference: rl - otherwise it is redundant to check if rl is null at line 331
[src/osgViewer/ScreenCaptureHandler.cpp:617]: (error) Possible null pointer dereference: camera - otherwise it is redundant to check if camera is null at line 611
[src/osgViewer/ScreenCaptureHandler.cpp:632]: (error) Possible null pointer dereference: camera - otherwise it is redundant to check if camera is null at line 626
[src/osgVolume/Locator.cpp:209]: (error) Dangerous iterator usage after erase()-method.
[src/osgVolume/RayTracedTechnique.cpp:274]: (error) Possible null pointer dereference: imageLayer - otherwise it is redundant to check if imageLayer is null at line 259
[src/osgVolume/RayTracedTechnique.cpp:275]: (error) Possible null pointer dereference: imageLayer - otherwise it is redundant to check if imageLayer is null at line 259
[src/osgWrappers/serializers/osg/ShaderBinary.cpp:28]: (error) Mismatching allocation and deallocation: data
2011-06-20 19:33:47 +00:00
Robert Osfield
b087e0f952 Merged following revisions from svn/trunk which address problems with toggling fullscreen on/off under modern X11 window managers
------------------------------------------------------------------------

r12573 | robert | 2011-06-20 12:25:52 +0100 (Mon, 20 Jun 2011) | 2 lines

Added catch for window manager doesn't set the window size to full screen.

------------------------------------------------------------------------
r12572 | robert | 2011-06-20 10:28:39 +0100 (Mon, 20 Jun 2011) | 4 lines

Added check against Traits::overrideRedirct to prevent the fullscreen workaround being run when overrideRedirect
is on as overrideRedirect switches off the window managers ability to manage the fullscreen so the problem doesn't
need working around.

------------------------------------------------------------------------
r12571 | robert | 2011-06-20 10:22:57 +0100 (Mon, 20 Jun 2011) | 2 lines

Introduced a workaround for fullscreen toggle issues under modern X11 window managers.
2011-06-20 17:54:27 +00:00
Robert Osfield
98a2ec67a6 Merged from svn/trunk. Added sleep before window resizing to make it less likely that the previous frames rendering traversal is still
running when the window(s) is resized, something that creates what looks like a glitch in rendering.
2011-06-20 09:22:05 +00:00
Robert Osfield
d5d9f4c082 From Torben Dannhauer, "Just in time for OSG 3.0 I will present an updated 3rdParty package for VS2008 , which includes some updated libraries (libcurl, freetype, jpeg). It also provides now all debug databases (*.pdb), so all the annoying compile warnings about missing .pdb files are gone.
I extended the CMAKE module to find the new library."
2011-06-19 19:21:21 +00:00
Robert Osfield
a656e402b7 Reset OPENSCENEGRAPH_SVN setting to branches to enable the tags to be created on the branches rather svn/trunk. 2011-06-17 16:37:58 +00:00
Robert Osfield
f173ea4224 First cut of OpenSceneGraph-3.0 branch from svn/trunk. 2011-06-17 13:14:49 +00:00
2430 changed files with 61114 additions and 185090 deletions

View File

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

View File

@@ -20,43 +20,21 @@ if(COMMAND cmake_policy)
# statements. # statements.
cmake_policy(SET CMP0005 NEW) cmake_policy(SET CMP0005 NEW)
# tell CMake to prefer CMake's own CMake modules when available
# only available from cmake-2.8.4
if(${CMAKE_MAJOR_VERSION} GREATER 2 OR
(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 8) OR
(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 8 AND ${CMAKE_PATCH_VERSION} GREATER 3))
cmake_policy(SET CMP0017 NEW)
endif()
# cmake-2.6.1 introduces policy cmp0008 decide how to treat full path libraries that do not appear to be valid library file names # 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." # 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} GREATER 2 OR if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 4 AND ${CMAKE_PATCH_VERSION} GREATER 0)
(${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) cmake_policy(SET CMP0008 OLD)
endif() endif()
# disable autolinking to qtmain as we have our own main() functions (new in Qt 5.1)
if(${CMAKE_MAJOR_VERSION} GREATER 2 OR
(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} GREATER 8) OR
(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 8 AND ${CMAKE_PATCH_VERSION} GREATER 10))
cmake_policy(SET CMP0020 OLD)
endif()
# nicer version check - but needs at least CMake 2.6.2? Worth upgrading the requirements?
#if("${CMAKE_VERSION}" VERSION_GREATER 2.8.10)
# or even easier (available in cmake-2.6)
#if(POLICY CMPxyzw)
endif() endif()
PROJECT(OpenSceneGraph) PROJECT(OpenSceneGraph)
SET(OPENSCENEGRAPH_MAJOR_VERSION 3) SET(OPENSCENEGRAPH_MAJOR_VERSION 3)
SET(OPENSCENEGRAPH_MINOR_VERSION 4) SET(OPENSCENEGRAPH_MINOR_VERSION 0)
SET(OPENSCENEGRAPH_PATCH_VERSION 0) SET(OPENSCENEGRAPH_PATCH_VERSION 0)
SET(OPENSCENEGRAPH_SOVERSION 130) SET(OPENSCENEGRAPH_SOVERSION 80)
# set to 0 when not a release candidate, non zero means that any generated # set to 0 when not a release candidate, non zero means that any generated
# svn tags will be treated as release candidates of given number # svn tags will be treated as release candidates of given number
SET(OPENSCENEGRAPH_RELEASE_CANDIDATE 0) SET(OPENSCENEGRAPH_RELEASE_CANDIDATE 0)
@@ -85,16 +63,47 @@ SET(OpenThreads_SOURCE_DIR ${OpenSceneGraph_SOURCE_DIR})
# Maybe this can be used override existing behavior if needed? # Maybe this can be used override existing behavior if needed?
SET(CMAKE_MODULE_PATH "${OpenSceneGraph_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}") SET(CMAKE_MODULE_PATH "${OpenSceneGraph_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}")
# Change the default build type to Release ## Option to enable Android build using AndroidNDK
IF(NOT CMAKE_BUILD_TYPE) OPTION(OSG_BUILD_PLATFORM_ANDROID OFF)
SET(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE) IF(OSG_BUILD_PLATFORM_ANDROID)
ENDIF(NOT CMAKE_BUILD_TYPE)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR)
IF(ANDROID)
INCLUDE(OsgAndroidMacroUtils) INCLUDE(OsgAndroidMacroUtils)
SET(ANDROID TRUE)
SET(ANDROID_PLATFORM 5)
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() ENDIF()
# Okay, here's the problem: On some platforms, linking against OpenThreads # Okay, here's the problem: On some platforms, linking against OpenThreads
# is not enough and explicit linking to the underlying thread library # is not enough and explicit linking to the underlying thread library
# is also required (e.g. FreeBSD). But OpenThreads may be built with different # is also required (e.g. FreeBSD). But OpenThreads may be built with different
@@ -125,9 +134,9 @@ IF (OSG_MAINTAINER)
# Provide target for tagging a release # Provide target for tagging a release
# #
SET(SVNCOMMAND svn) SET(SVNCOMMAND svn)
SET(SVNTRUNKDIR http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk) SET(SVNTRUNKDIR http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk)
SET(SVNTAGDIR http://svn.openscenegraph.org/osg/OpenSceneGraph/tags) SET(SVNTAGDIR http://www.openscenegraph.org/svn/osg/OpenSceneGraph/tags)
SET(SVNBRANCHDIR http://svn.openscenegraph.org/osg/OpenSceneGraph/branches) SET(SVNBRANCHDIR http://www.openscenegraph.org/svn/osg/OpenSceneGraph/branches)
IF (OPENSCENEGRAPH_SVN STREQUAL "trunk") IF (OPENSCENEGRAPH_SVN STREQUAL "trunk")
SET(SVNSOURCEDIR ${SVNTRUNKDIR}) SET(SVNSOURCEDIR ${SVNTRUNKDIR})
@@ -168,22 +177,11 @@ IF (OSG_MAINTAINER)
COMMAND ${SVNCOMMAND} update COMMAND ${SVNCOMMAND} update
COMMAND ${GENERATELOGS} ${SVNSOURCEDIR} COMMAND ${GENERATELOGS} ${SVNSOURCEDIR}
) )
ENDIF(OSG_MAINTAINER) ENDIF(OSG_MAINTAINER)
IF(NOT ANDROID) IF(NOT ANDROID)
IF(APPLE) IF(APPLE)
# Determine the canonical name of the selected Platform SDK
EXECUTE_PROCESS(COMMAND "/usr/bin/sw_vers" "-productVersion"
OUTPUT_VARIABLE OSG_OSX_SDK_NAME
OUTPUT_STRIP_TRAILING_WHITESPACE)
STRING(REPLACE "." ";" MACOS_VERSION_LIST ${OSG_OSX_SDK_NAME})
LIST(GET MACOS_VERSION_LIST 0 MACOS_VERSION_MAJOR)
LIST(GET MACOS_VERSION_LIST 1 MACOS_VERSION_MINOR)
LIST(GET MACOS_VERSION_LIST 2 MACOS_VERSION_PATCH)
SET(OSG_OSX_SDK_NAME "macosx${MACOS_VERSION_MAJOR}.${MACOS_VERSION_MINOR}")
# Trying to get CMake to generate an XCode IPhone project, current efforts are to get iphoneos sdk 3.1 working # 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 # Added option which needs manually setting to select the IPhone SDK for building. We can only have one of the below
# set to true. Should realy have an OSG_BUILD_PLATFORM variable that we set to our desired platform # set to true. Should realy have an OSG_BUILD_PLATFORM variable that we set to our desired platform
@@ -193,24 +191,21 @@ IF(APPLE)
IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR) IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
#you need to manually set the default sdk version here #you need to manually set the default sdk version here
SET (IPHONE_SDKVER "6.0" CACHE STRING "IOS SDK-Version") SET (IPHONE_SDKVER "3.2")
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 #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 # Force gcc <= 4.2 on iPhone
IF(IPHONE_VERSION_MIN LESS "6.0") include(CMakeForceCompiler)
include(CMakeForceCompiler) CMAKE_FORCE_C_COMPILER(gcc-4.2 GNU)
CMAKE_FORCE_C_COMPILER(llvm-gcc-4.2 GNU) CMAKE_FORCE_CXX_COMPILER(gcc-4.2 GNU)
CMAKE_FORCE_CXX_COMPILER(llvm-gcc-4.2 GNU) SET(GCC_THUMB_SUPPORT NO)
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 #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) IF(OSG_BUILD_PLATFORM_IPHONE)
SET (IPHONE_DEVROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer") SET (IPHONE_DEVROOT "/Developer/Platforms/iPhoneOS.platform/Developer")
SET (IPHONE_SDKROOT "${IPHONE_DEVROOT}/SDKs/iPhoneOS${IPHONE_SDKVER}.sdk") SET (IPHONE_SDKROOT "${IPHONE_DEVROOT}/SDKs/iPhoneOS${IPHONE_SDKVER}.sdk")
ELSE() ELSE()
SET (IPHONE_DEVROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer") SET (IPHONE_DEVROOT "/Developer/Platforms/iPhoneSimulator.platform/Developer")
SET (IPHONE_SDKROOT "${IPHONE_DEVROOT}/SDKs/iPhoneSimulator${IPHONE_SDKVER}.sdk") SET (IPHONE_SDKROOT "${IPHONE_DEVROOT}/SDKs/iPhoneSimulator${IPHONE_SDKVER}.sdk")
ENDIF() ENDIF()
@@ -233,10 +228,6 @@ ELSE()
ENDIF() ENDIF()
ENDIF() ENDIF()
IF(UNIX AND NOT ANDROID) IF(UNIX AND NOT ANDROID)
# Not sure what this will do on Cygwin and Msys # 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. # Also, remember OS X X11 is a user installed option so it may not exist.
@@ -311,13 +302,7 @@ IF(WIN32 AND NOT ANDROID)
STRING(REGEX REPLACE "/STACK:[0-9]+" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}") STRING(REGEX REPLACE "/STACK:[0-9]+" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
STRING(REGEX REPLACE "/STACK:[0-9]+" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}") STRING(REGEX REPLACE "/STACK:[0-9]+" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}")
ENDIF(MSVC_USE_DEFAULT_STACK_SIZE) ENDIF(MSVC_USE_DEFAULT_STACK_SIZE)
get_filename_component( CMAKE_MAKE_PROGRAM_NAME ${CMAKE_MAKE_PROGRAM} NAME)
IF (CMAKE_MAKE_PROGRAM_NAME STREQUAL "VCExpress.exe")
OPTION(MSVC_BUILD_USE_SOLUTION_FOLDERS "Enable project grouping in VS - VCExpress detected, not supported in VCExpress )" OFF)
ELSE()
OPTION(MSVC_BUILD_USE_SOLUTION_FOLDERS "Enable project grouping in VS" ON)
ENDIF()
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ${MSVC_BUILD_USE_SOLUTION_FOLDERS})
ENDIF() ENDIF()
#needed for net plugin #needed for net plugin
@@ -400,225 +385,46 @@ MARK_AS_ADVANCED(OSG_DISABLE_MSVC_WARNINGS)
OPTION(OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION "Set to ON to use the ref_ptr<> T* operator() output conversion. " ON) OPTION(OSG_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)
# Map the OPENGL_PROFILE to OSG_GL*_AVAILABLE settings OPTION(OSG_GL2_AVAILABLE "Set to OFF to disable use of OpenGL 2.x functions library." ON)
SET(OPENGL_PROFILE "GL2" CACHE STRING "OpenGL Profile to use, choose from GL1, GL2, GL3, GLES1, GLES2, GLES3") 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)
IF ((OPENGL_PROFILE STREQUAL "GL1") OR (OPENGL_PROFILE STREQUAL "GL2")) OPTION(OSG_GLES2_AVAILABLE "Set to OFF to disable use of OpenGL ES 2.x functions library." OFF)
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) 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(OPENGL_egl_LIBRARY CACHE STRING "Set the OpenGL egl library.")
# Map the OSG_GL*_AVAILABLE settings to OSG_GL_* settings # SET(OSG_GL_DISPLAYLISTS_AVAILABLE ${OSG_GL1_AVAILABLE})
IF (OSG_GLES2_AVAILABLE OR OSG_GL3_AVAILABLE) # SET(OSG_GL_MATRICES_AVAILABLE ${OSG_GL1_AVAILABLE})
OPTION(OSG_GL_DISPLAYLISTS_AVAILABLE "Set to OFF to disable use of OpenGL display lists." OFF) # SET(OSG_GL_VERTEX_FUNCS_AVAILABLE ${OSG_GL1_AVAILABLE})
OPTION(OSG_GL_MATRICES_AVAILABLE "Set to OFF to disable use of OpenGL built-in matrices." OFF) # SET(OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE ${OSG_GL1_AVAILABLE})
OPTION(OSG_GL_VERTEX_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertex/glColor etc." OFF) # SET(OSG_GL_FIXED_FUNCTION_AVAILABLE ${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." 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()
IF (OSG_GLES1_AVAILABLE OR OSG_GLES2_AVAILABLE) OPTION(OSG_GL_DISPLAYLISTS_AVAILABLE "Set to OFF to disable use of OpenGL display lists." ${OSG_GL1_AVAILABLE})
OPTION(OSG_CPP_EXCEPTIONS_AVAILABLE "Set to OFF to disable compile of OSG components that use C++ exceptions." OFF) OPTION(OSG_GL_MATRICES_AVAILABLE "Set to OFF to disable use of OpenGL built-in matrices." ${OSG_GL1_AVAILABLE})
ELSE() 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_CPP_EXCEPTIONS_AVAILABLE "Set to OFF to disable compile of OSG components that use C++ exceptions." ON) OPTION(OSG_GL_VERTEX_ARRAY_FUNCS_AVAILABLE "Set to OFF to disable use of OpenGL vertex functions such as glVertex/glColor etc." ${OSG_GL1_AVAILABLE})
ENDIF() OPTION(OSG_GL_FIXED_FUNCTION_AVAILABLE "Set to OFF to disable use of OpenGL fixed function pipeline." ${OSG_GL1_AVAILABLE})
# 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 "true")
ELSE()
SET(OSG_GL1_FEATURES "false")
ENDIF()
IF (OSG_GL2_AVAILABLE)
SET(OSG_GL2_FEATURES "true")
ELSE()
SET(OSG_GL2_FEATURES "false")
ENDIF()
IF (OSG_GL3_AVAILABLE)
SET(OSG_GL3_FEATURES "true")
ELSE()
SET(OSG_GL3_FEATURES "false")
ENDIF()
IF (OSG_GLES1_AVAILABLE)
SET(OSG_GLES1_FEATURES "true")
ELSE()
SET(OSG_GLES1_FEATURES "false")
ENDIF()
IF (OSG_GLES2_AVAILABLE)
SET(OSG_GLES2_FEATURES "true")
ELSE()
SET(OSG_GLES2_FEATURES "false")
ENDIF()
IF (OSG_GLES3_AVAILABLE)
SET(OSG_GLES3_FEATURES "true")
ELSE()
SET(OSG_GLES3_FEATURES "false")
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 header file # Set Config file
SET(OPENSCENEGRAPH_CONFIG_HEADER "${PROJECT_BINARY_DIR}/include/osg/Config") SET(OPENSCENEGRAPH_CONFIG_HEADER "${PROJECT_BINARY_DIR}/include/osg/Config")
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/Config.in" CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/Config.in"
"${OPENSCENEGRAPH_CONFIG_HEADER}") "${OPENSCENEGRAPH_CONFIG_HEADER}")
SET(OPENSCENEGRAPH_VERSION_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/include/osg/Version")
################################################################################ CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/src/osg/Version.in"
# Set OpenGL header file "${OPENSCENEGRAPH_VERSION_HEADER}")
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}") # 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 # Set Version Info resource file
IF(MSVC) IF(MSVC)
SET(OPENSCENEGRAPH_VERSIONINFO_RC "${PROJECT_BINARY_DIR}/PlatformSpecifics/Windows/OpenSceneGraphVersionInfo.rc") SET(OPENSCENEGRAPH_VERSIONINFO_RC "${PROJECT_BINARY_DIR}/PlatformSpecifics/Windows/OpenSceneGraphVersionInfo.rc")
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/PlatformSpecifics/Windows/OpenSceneGraphVersionInfo.rc.in" CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/PlatformSpecifics/Windows/OpenSceneGraphVersionInfo.rc.in"
@@ -640,18 +446,11 @@ IF(WIN32 AND NOT ANDROID)
INCLUDE(Find3rdPartyDependencies) INCLUDE(Find3rdPartyDependencies)
ENDIF() 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) IF(ANDROID)
ANDROID_3RD_PARTY() ANDROID_3RD_PARTY()
ELSE() ELSE()
# Common to all platforms except android: # Common to all platforms except android:
FIND_PACKAGE(Freetype) FIND_PACKAGE(FreeType)
FIND_PACKAGE(Inventor) FIND_PACKAGE(Inventor)
FIND_PACKAGE(Jasper) FIND_PACKAGE(Jasper)
FIND_PACKAGE(OpenEXR) FIND_PACKAGE(OpenEXR)
@@ -662,103 +461,45 @@ ELSE()
FIND_PACKAGE(OpenVRML) FIND_PACKAGE(OpenVRML)
FIND_PACKAGE(Performer) FIND_PACKAGE(Performer)
FIND_PACKAGE(GDAL) FIND_PACKAGE(GDAL)
FIND_PACKAGE(GTA)
FIND_PACKAGE(CURL) FIND_PACKAGE(CURL)
FIND_PACKAGE(ITK)
FIND_PACKAGE(LibVNCServer) FIND_PACKAGE(LibVNCServer)
FIND_PACKAGE(OurDCMTK) FIND_PACKAGE(OurDCMTK)
FIND_PACKAGE(OpenAL)
FIND_PACKAGE(FFmpeg) FIND_PACKAGE(FFmpeg)
FIND_PACKAGE(GStreamer COMPONENTS app pbutils)
FIND_PACKAGE(GLIB COMPONENTS gobject)
FIND_PACKAGE(DirectShow) FIND_PACKAGE(DirectShow)
FIND_PACKAGE(SDL2)
FIND_PACKAGE(SDL) FIND_PACKAGE(SDL)
FIND_PACKAGE(Poppler-glib) FIND_PACKAGE(Poppler-glib)
FIND_PACKAGE(RSVG) FIND_PACKAGE(RSVG)
FIND_PACKAGE(GtkGl) FIND_PACKAGE(GtkGl)
FIND_PACKAGE(DirectInput) FIND_PACKAGE(DirectInput)
FIND_PACKAGE(NVTT) FIND_PACKAGE(NVTT)
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)
FIND_PACKAGE(ITK)
ENDIF() ENDIF()
# Include macro utilities here # Include macro utilities here
INCLUDE(OsgMacroUtils) INCLUDE(OsgMacroUtils)
OPTION(OSG_USE_QT "Enable to use Qt (build Qt-dependent libraries, plugins and examples)" ON) IF(NOT ANDROID)
IF(OSG_USE_QT AND NOT ANDROID)
# To select a specific version of QT define DESIRED_QT_VERSION # To select a specific version of QT define DESIRED_QT_VERSION
# via cmake -DDESIRED_QT_VERSION=5 # via cmake -DDESIRED_QT_VERSION=4
# QUIET option disables messages if the package cannot be found.
IF (DESIRED_QT_VERSION) IF (DESIRED_QT_VERSION)
IF (DESIRED_QT_VERSION MATCHES 5)
FIND_PACKAGE(Qt5Widgets) IF (DESIRED_QT_VERSION MATCHES 4)
ELSEIF (DESIRED_QT_VERSION MATCHES 4) FIND_PACKAGE(Qt4)
FIND_PACKAGE(Qt4)
ELSE() ELSE()
FIND_PACKAGE(Qt3) FIND_PACKAGE(Qt3)
ENDIF() ENDIF()
ELSE() ELSE()
FIND_PACKAGE(Qt5Widgets QUIET) FIND_PACKAGE(Qt4)
IF ( Qt5Widgets_FOUND ) IF (NOT QT4_FOUND)
# CMake 2.8.8 or greater required FIND_PACKAGE(Qt3)
BUILDER_VERSION_GREATER(2 8 7)
IF(NOT VALID_BUILDER_VERSION)
MESSAGE(
SEND_ERROR
"Qt5 requires CMake version 2.8.8 or greater!\n"
"Update CMake or set DESIRED_QT_VERSION to less than 5
or disable OSG_USE_QT."
)
ENDIF( )
ENDIF( )
IF ( NOT Qt5Widgets_FOUND )
FIND_PACKAGE(Qt4)
IF (NOT QT4_FOUND)
FIND_PACKAGE(Qt3)
ENDIF()
ENDIF() ENDIF()
ENDIF() ENDIF()
ENDIF(NOT ANDROID)
#If we have found Qt5, let's try to top off by getting the webkit as well
IF ( Qt5Widgets_FOUND )
FIND_PACKAGE(Qt5WebKitWidgets QUIET)
IF(COMMAND cmake_policy)
IF(${CMAKE_MAJOR_VERSION} GREATER 2)
# Qt5 qt5_use_modules usage was causing "Policy CMP0043 is not set: Ignore COMPILE_DEFINITIONS_<Config> properties." warnings
cmake_policy(SET CMP0043 NEW)
ENDIF()
ENDIF()
ENDIF()
ENDIF()
#optional example related dependencies #optional example related dependencies
IF (BUILD_OSG_EXAMPLES AND NOT ANDROID) IF (BUILD_OSG_EXAMPLES AND NOT ANDROID)
@@ -793,19 +534,16 @@ IF(NOT ANDROID)
FIND_PACKAGE(JPEG) FIND_PACKAGE(JPEG)
FIND_PACKAGE(PNG) FIND_PACKAGE(PNG)
FIND_PACKAGE(TIFF) FIND_PACKAGE(TIFF)
# QuickTime is required for OS X, but optional for Windows. # QuickTime is required for OS X, but optional for Windows.
IF(WIN32) IF(WIN32)
FIND_PACKAGE(QuickTime) FIND_PACKAGE(QuickTime)
ENDIF() ENDIF()
ELSE() ELSE()
FIND_PACKAGE(TIFF)
FIND_PACKAGE(QuickTime) FIND_PACKAGE(QuickTime)
FIND_PACKAGE(QTKit) FIND_PACKAGE(QTKit)
FIND_PACKAGE(CoreVideo) FIND_PACKAGE(CoreVideo)
FIND_PACKAGE(CoreMedia)
FIND_PACKAGE(QuartzCore)
FIND_PACKAGE(AVFoundation)
ENDIF() ENDIF()
ENDIF() ENDIF()
@@ -958,53 +696,24 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
# errors instead of warnings for certain issues, including superfluous # errors instead of warnings for certain issues, including superfluous
# semicolons and commas, and the use of long long. -fpermissive seems # semicolons and commas, and the use of long long. -fpermissive seems
# to be the workaround. # to be the workaround.
SET(OSG_AGGRESSIVE_WARNING_FLAGS -Wall -Wparentheses -Wno-long-long -Wno-import -pedantic -Wreturn-type -Wmissing-braces -Wunknown-pragmas -Wunused) SET(OSG_AGGRESSIVE_WARNING_FLAGS -Wall -Wparentheses -Wno-long-long -Wno-import -pedantic -Wreturn-type -Wmissing-braces -Wunknown-pragmas -Wunused -fpermissive)
# Previous included -Wformat=2 in OSG_AGGRESSIVE_WARNING_FLAGS but had to remove it due to standard library errors # Previous included -Wformat=2 in OSG_AGGRESSIVE_WARNING_FLAGS but had to remove it due to standard library errors
ELSEIF(MSVC) ELSE()
#disable specific warning level 4 warnings: IF(MSVC)
#C4100 'identifier' : unreferenced formal parameter # FIXME: What are good aggressive warning flags for Visual Studio?
#C4127 Error Message conditional expression is constant # And do we need to further subcase this for different versions of VS?
#C4706 assignment within conditional expression # CMake variables: MSVC60, MSVC70, MSVC71, MSVC80, CMAKE_COMPILER_2005
SET(OSG_AGGRESSIVE_WARNING_FLAGS /W4 /wd4706 /wd4127 /wd4100) SET(OSG_AGGRESSIVE_WARNING_FLAGS /W4 /wd4706 /wd4127 /wd4100)
ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
SET(OSG_AGGRESSIVE_WARNING_FLAGS -Wall -Wparentheses -Wno-long-long -Wno-import -pedantic -Wreturn-type -Wmissing-braces -Wunknown-pragmas -Wunused -Wno-overloaded-virtual)
ELSE()
# CMake lacks an elseif, so other non-gcc, non-VS compilers need # CMake lacks an elseif, so other non-gcc, non-VS compilers need
# to be listed below. If unhandled, OSG_AGGRESSIVE_WARNING_FLAGS should # to be listed below. If unhandled, OSG_AGGRESSIVE_WARNING_FLAGS should
# remain unset. # remain unset.
ENDIF()
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() ENDIF()
# This part is for the CMake menu option to toggle the warnings on/off. # This part is for the CMake menu option to toggle the warnings on/off.
@@ -1057,30 +766,19 @@ IF (BUILD_OSG_EXAMPLES)
ENDIF() ENDIF()
IF(APPLE AND NOT ANDROID) IF(APPLE)
#Here we check if the user specified IPhone SDK #Here we check if the user specified IPhone SDK
IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR) IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
#set iphone arch and flags taken from http://sites.google.com/site/michaelsafyan/coding/resources/how-to-guides/cross-compile-for-the-iphone/how-to-cross-compile-for-the-iphone-using-cmake #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) IF(OSG_BUILD_PLATFORM_IPHONE)
IF(${IPHONE_VERSION_MIN} LESS "7.0") SET(CMAKE_OSX_ARCHITECTURES "armv6;armv7" CACHE STRING "Build architectures for iOS" FORCE)
SET(CMAKE_OSX_ARCHITECTURES "armv6;armv7" CACHE STRING "Build architectures for iOS" FORCE) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -miphoneos-version-min=3.1 -mno-thumb -arch armv6 -pipe -no-cpp-precomp" CACHE STRING "Flags used by the compiler during all build types." FORCE)
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() ELSE()
#simulator uses i386 architectures #simulator uses i386 architectures
SET(CMAKE_OSX_ARCHITECTURES "i386" CACHE STRING "Build architectures for iOS Simulator" FORCE) 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} -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() 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 #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
@@ -1108,23 +806,18 @@ IF(APPLE AND NOT ANDROID)
# FORCE is used because the options are not reflected in the UI otherwise. # 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. # Seems like a good place to add version specific compiler flags too.
IF(NOT OSG_CONFIG_HAS_BEEN_RUN_BEFORE) IF(NOT OSG_CONFIG_HAS_BEEN_RUN_BEFORE)
IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.8" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.9" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.10") # This is really fragile, but CMake doesn't provide the OS system
SET(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "imageio" CACHE STRING "Forced imageio default image plugin for OSX" FORCE) # version information we need. (Darwin versions can be changed
# 64 Bit Works, i386,ppc is not supported any more # independently of OS X versions.)
SET(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Build architectures for OSX" FORCE) # It does look like CMake handles the CMAKE_OSX_SYSROOT automatically.
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.8 -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE) IF(EXISTS /Developer/SDKs/MacOSX10.5.sdk)
ELSEIF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.7") # 64-bit compiles are not supported with Carbon. We should enable
SET(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "imageio" CACHE STRING "Forced imageio default image plugin for OSX" FORCE) # 64-bit compilation by default once osgviewer has been
# 64 Bit Works, PPC is not supported any more # rewritten with Cocoa.
SET(CMAKE_OSX_ARCHITECTURES "i386;x86_64" CACHE STRING "Build architectures for OSX" FORCE) #SET(CMAKE_OSX_ARCHITECTURES "ppc;i386;ppc64;x86_64" CACHE STRING "Build architectures for OSX" FORCE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.7 -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE)
ELSEIF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.6" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.5")
SET(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "imageio" CACHE STRING "Forced imageio default image plugin for OSX" FORCE)
# 64-bit compiles are not supported with Carbon.
SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" FORCE) SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" FORCE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.5 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.5 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE)
ELSEIF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.4") ELSEIF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk)
SET(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX "quicktime" CACHE STRING "Forced imageio default image plugin for OSX" FORCE)
SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" FORCE) SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" FORCE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.4 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.4 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE)
ELSE() ELSE()
@@ -1132,21 +825,21 @@ IF(APPLE AND NOT ANDROID)
# Should break down further to set the -mmacosx-version-min, # Should break down further to set the -mmacosx-version-min,
# but the SDK detection is too unreliable here. # but the SDK detection is too unreliable here.
ENDIF() ENDIF()
ENDIF() ENDIF(NOT OSG_CONFIG_HAS_BEEN_RUN_BEFORE)
OPTION(OSG_BUILD_APPLICATION_BUNDLES "Enable the building of applications and examples as OSX Bundles" OFF) OPTION(OSG_BUILD_APPLICATION_BUNDLES "Enable the building of applications and examples as OSX Bundles" OFF)
ENDIF() ENDIF()
ENDIF() ENDIF(APPLE)
# For Doxygen # For Doxygen
INCLUDE(${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL) INCLUDE(${CMAKE_ROOT}/Modules/Documentation.cmake OPTIONAL)
OPTION(BUILD_DOCUMENTATION "Build OpenSceneGraph reference documentation using doxygen (use: make doc_openscenegraph doc_openthreads)" OFF) OPTION(BUILD_DOCUMENTATION "Build OpenSceneGraph reference documentation using doxygen (use: make DoxygenDoc)" OFF)
MARK_AS_ADVANCED(CLEAR BUILD_DOCUMENTATION) MARK_AS_ADVANCED(CLEAR BUILD_DOCUMENTATION)
# To build the documention, you will have to enable it # To build the documention, you will have to enable it
# and then do the equivalent of "make doc_openscenegraph doc_openthreads". # and then do the equivalent of "make DoxygenDoc".
IF(BUILD_DOCUMENTATION) IF(BUILD_DOCUMENTATION)
OPTION(BUILD_REF_DOCS_SEARCHENGINE "Enable doxygen's search engine (requires that documentation to be installed on a php enabled web server)" OFF) OPTION(BUILD_REF_DOCS_SEARCHENGINE "Enable doxygen's search engine (requires that documentation to be installed on a php enabled web server)" OFF)
@@ -1168,19 +861,19 @@ IF(BUILD_DOCUMENTATION)
ELSE() ELSE()
SET(HAVE_DOT NO) SET(HAVE_DOT NO)
ENDIF() ENDIF()
# If html help generation was requested. DOCUMENTATION_HTML_HELP is defined by Documentation.cmake # If html help generation was requested. DOCUMENTATION_HTML_HELP is defined by Documentation.cmake
SET(GENERATE_HTMLHELP "NO") SET(GENERATE_HTMLHELP "NO")
IF(DOCUMENTATION_HTML_HELP) IF(DOCUMENTATION_HTML_HELP)
# on windows Documentation.cmake finds the html help workshop if it exists. On u*ix we might have it with wine but no way to point it out # on windows Documentation.cmake finds the html help workshop fi it exists. On u*ix we might have it with wine but no way to point it out
IF(NOT WIN32) IF(NOT WIN32)
SET(HTML_HELP_COMPILER "" CACHE FILEPATH "Enter location of the HTML help compiler to let doxygen compile html") SET(HTML_HELP_COMPILER "" CACHE FILEPATH "Enter location of the HTML help compiler to let doxygen compile html")
MARK_AS_ADVANCED(HTML_HELP_COMPILER) MARK_AS_ADVANCED(HTML_HELP_COMPILER)
ENDIF() ENDIF()
# this var sets a proper value in .doxygen files when configuring them below # this var sets a proper value in .doxygen files when coniguring them below
SET(GENERATE_HTMLHELP "YES") SET(GENERATE_HTMLHELP "YES")
endif() endif()
# This processes our doxyfile.cmake and substitutes paths to generate # This processes our doxyfile.cmake and substitutes paths to generate
# a final Doxyfile # a final Doxyfile
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/Doxyfiles/doxyfile.cmake CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/Doxyfiles/doxyfile.cmake
@@ -1216,7 +909,7 @@ IF(BUILD_DOCUMENTATION)
${PROJECT_BINARY_DIR}/doc/auto_Doxyfile) ${PROJECT_BINARY_DIR}/doc/auto_Doxyfile)
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/Doxyfiles/core_Doxyfile CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/Doxyfiles/core_Doxyfile
${PROJECT_BINARY_DIR}/doc/core_Doxyfile) ${PROJECT_BINARY_DIR}/doc/core_Doxyfile)
# This creates a new target to build documentation. # This creates a new target to build documentation.
# It runs ${DOXYGEN} which is the full path and executable to # It runs ${DOXYGEN} which is the full path and executable to
# Doxygen on your system, set by the FindDoxygen.cmake module # Doxygen on your system, set by the FindDoxygen.cmake module
@@ -1227,17 +920,17 @@ IF(BUILD_DOCUMENTATION)
${PROJECT_BINARY_DIR}/doc/openscenegraph.doxyfile ${PROJECT_BINARY_DIR}/doc/openscenegraph.doxyfile
) )
SET_TARGET_PROPERTIES(doc_openscenegraph PROPERTIES FOLDER "Documentation") SET_TARGET_PROPERTIES(doc_openscenegraph PROPERTIES FOLDER "Documentation")
ADD_CUSTOM_TARGET(doc_openthreads ${DOXYGEN} ADD_CUSTOM_TARGET(doc_openthreads ${DOXYGEN}
${PROJECT_BINARY_DIR}/doc/openthreads.doxyfile ${PROJECT_BINARY_DIR}/doc/openthreads.doxyfile
) )
SET_TARGET_PROPERTIES(doc_openthreads PROPERTIES FOLDER "Documentation") SET_TARGET_PROPERTIES(doc_openthreads PROPERTIES FOLDER "Documentation")
ENDIF(BUILD_DOCUMENTATION) ENDIF(BUILD_DOCUMENTATION)
OPTION(BUILD_DASHBOARD_REPORTS "Set to ON to activate reporting of OpenSceneGraph builds here http://cdash.openscenegraph.org/index.php?project=OpenSceneGraph" OFF) OPTION(BUILD_DASHBOARD_REPORTS "Set to ON to activate reporting of OpenSceneGraph builds here http://www.cdash.org/CDashPublic/index.php?project=OpenSceneGraph" OFF)
IF(BUILD_DASHBOARD_REPORTS) IF(BUILD_DASHBOARD_REPORTS)
# The following are required to uses Dart and the Cdash dashboard # The following are required to uses Dart and the Cdash dashboard
# viewable here : http://cdash.openscenegraph.org/index.php?project=OpenSceneGraph # viewable here : http://www.cdash.org/CDashPublic/index.php?project=OpenSceneGraph
INCLUDE(Dart) INCLUDE(Dart)
ENDIF() ENDIF()
@@ -1270,9 +963,9 @@ SET(PKGCONFIG_FILES
openscenegraph-osgVolume openscenegraph-osgVolume
) )
IF(QT4_FOUND OR Qt5Widgets_FOUND ) IF(QT4_FOUND)
SET(PKGCONFIG_FILES ${PKGCONFIG_FILES} openscenegraph-osgQt) SET(PKGCONFIG_FILES ${PKGCONFIG_FILES} openscenegraph-osgQt)
ENDIF() ENDIF(QT4_FOUND)
FOREACH(PKGCONFIG_FILE ${PKGCONFIG_FILES}) FOREACH(PKGCONFIG_FILE ${PKGCONFIG_FILES})
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/packaging/pkgconfig/${PKGCONFIG_FILE}.pc.in CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/packaging/pkgconfig/${PKGCONFIG_FILE}.pc.in
@@ -1304,7 +997,7 @@ IF(REQUIRES_LIBPATH_MESSAGE)
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/packaging/ld.so.conf.d/openscenegraph.conf.in CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/packaging/ld.so.conf.d/openscenegraph.conf.in
${PROJECT_BINARY_DIR}/packaging/ld.so.conf.d/openscenegraph.conf ${PROJECT_BINARY_DIR}/packaging/ld.so.conf.d/openscenegraph.conf
) )
ADD_CUSTOM_TARGET(install_ld_conf ${CMAKE_COMMAND} -E copy_if_different ADD_CUSTOM_TARGET(install_ld_conf ${CMAKE_COMMAND} -E copy_if_different
${PROJECT_BINARY_DIR}/packaging/ld.so.conf.d/openscenegraph.conf ${PROJECT_BINARY_DIR}/packaging/ld.so.conf.d/openscenegraph.conf
/etc/ld.so.conf.d/openscenegraph.conf /etc/ld.so.conf.d/openscenegraph.conf
COMMAND ldconfig COMMAND ldconfig
@@ -1345,4 +1038,10 @@ ADD_CUSTOM_TARGET(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") "${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 # This module defines
# OPENTHREADS_HAVE_ATOMIC_OPS # OPENTHREADS_HAVE_ATOMIC_OPS
@@ -15,143 +15,123 @@ IF (OPENTHREADS_ATOMIC_USE_MUTEX)
SET(_OPENTHREADS_ATOMIC_USE_MUTEX 1) SET(_OPENTHREADS_ATOMIC_USE_MUTEX 1)
ELSE() 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)
SET(_OPENTHREADS_ATOMIC_USE_BSD_ATOMIC 1) INCLUDE(CheckCXXSourceRuns)
ELSE() # Do step by step checking,
INCLUDE(CheckCXXSourceRuns) CHECK_CXX_SOURCE_RUNS("
#include <cstdlib>
# Do step by step checking, int main()
CHECK_CXX_SOURCE_RUNS(" {
#include <cstdlib> 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;
int main() if (!__sync_bool_compare_and_swap(&ptr, ptr, ptr))
{ return EXIT_FAILURE;
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;
if (!__sync_bool_compare_and_swap(&ptr, ptr, ptr)) return EXIT_SUCCESS;
return EXIT_FAILURE; }
" _OPENTHREADS_ATOMIC_USE_GCC_BUILTINS)
return EXIT_SUCCESS; CHECK_CXX_SOURCE_RUNS("
} #include <stdlib.h>
" _OPENTHREADS_ATOMIC_USE_GCC_BUILTINS)
CHECK_CXX_SOURCE_RUNS(" int main(int, const char**)
#include <stdlib.h> {
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;
int main(int, const char**) if (!__compare_and_swap((unsigned long*)&ptr, (unsigned long)ptr, (unsigned long)ptr))
{ return EXIT_FAILURE;
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;
if (!__compare_and_swap((unsigned long*)&ptr, (unsigned long)ptr, (unsigned long)ptr)) return EXIT_SUCCESS;
return EXIT_FAILURE; }
" _OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS)
return EXIT_SUCCESS; CHECK_CXX_SOURCE_RUNS("
} #include <atomic.h>
" _OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS) #include <cstdlib>
CHECK_CXX_SOURCE_RUNS(" int main(int, const char**)
#include <atomic.h> {
#include <cstdlib> 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;
int main(int, const char**) if (ptr != atomic_cas_ptr(&ptr, ptr, ptr))
{ return EXIT_FAILURE;
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;
if (ptr != atomic_cas_ptr(&ptr, ptr, ptr)) return EXIT_SUCCESS;
return EXIT_FAILURE; }
" _OPENTHREADS_ATOMIC_USE_SUN)
return EXIT_SUCCESS; CHECK_CXX_SOURCE_RUNS("
} #include <windows.h>
" _OPENTHREADS_ATOMIC_USE_SUN) #include <intrin.h>
#include <cstdlib>
CHECK_CXX_SOURCE_RUNS(" #pragma intrinsic(_InterlockedAnd)
#include <windows.h> #pragma intrinsic(_InterlockedOr)
#include <intrin.h> #pragma intrinsic(_InterlockedXor)
#include <cstdlib>
#pragma intrinsic(_InterlockedAnd) int main(int, const char**)
#pragma intrinsic(_InterlockedOr) {
#pragma intrinsic(_InterlockedXor) volatile long value = 0;
long data = 0;
long* volatile ptr = &data;
int main(int, const char**) InterlockedIncrement(&value);
{ MemoryBarrier();
volatile long value = 0; InterlockedDecrement(&value);
long data = 0;
long* volatile ptr = &data;
InterlockedIncrement(&value); if (0 != InterlockedCompareExchange(&value, 1, 0))
MemoryBarrier(); return EXIT_FAILURE;
InterlockedDecrement(&value);
if (0 != InterlockedCompareExchange(&value, 1, 0)) if (ptr != InterlockedCompareExchangePointer((PVOID volatile*)&ptr, (PVOID)ptr, (PVOID)ptr))
return EXIT_FAILURE; return EXIT_FAILURE;
if (ptr != InterlockedCompareExchangePointer((PVOID volatile*)&ptr, (PVOID)ptr, (PVOID)ptr)) return EXIT_SUCCESS;
return EXIT_FAILURE; }
" _OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED)
return EXIT_SUCCESS; CHECK_CXX_SOURCE_RUNS("
} #include <libkern/OSAtomic.h>
" _OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED)
CHECK_CXX_SOURCE_RUNS(" int main()
#include <libkern/OSAtomic.h> {
volatile int32_t value = 0;
long data = 0;
long * volatile ptr = &data;
int main() OSAtomicIncrement32(&value);
{ OSMemoryBarrier();
volatile int32_t value = 0; OSAtomicDecrement32(&value);
long data = 0; OSAtomicCompareAndSwapInt(value, 1, &value);
long * volatile ptr = &data; OSAtomicCompareAndSwapPtr(ptr, ptr, (void * volatile *)&ptr);
}
OSAtomicIncrement32(&value); " _OPENTHREADS_ATOMIC_USE_BSD_ATOMIC)
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()
ENDIF() ENDIF()

View File

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

View File

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

View File

@@ -1,22 +0,0 @@
# Locate ASIO-headers (http://think-async.com/Asio)
# This module defines
# ASIO_FOUND, if false, do not try to link to gdal
# ASIO_INCLUDE_DIR, where to find the headers
#
# Created by Stephan Maximilian Huber
FIND_PATH(ASIO_INCLUDE_DIR
NAMES
asio.hpp
PATHS
/usr/include
/usr/local/include
)
SET(ASIO_FOUND "NO")
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 # $COLLADA_DIR is an environment variable that would
# correspond to the ./configure --prefix=$COLLADA_DIR # 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: # Check if COLLADA_DIR is set, otherwise use ACTUAL_3DPARTY_DIR:
SET( COLLADA_ENV_VAR_AVAILABLE $ENV{COLLADA_DIR} ) SET( COLLADA_ENV_VAR_AVAILABLE $ENV{COLLADA_DIR} )
IF ( COLLADA_ENV_VAR_AVAILABLE ) IF ( COLLADA_ENV_VAR_AVAILABLE )
SET(COLLADA_DOM_ROOT "$ENV{COLLADA_DIR}/dom" CACHE PATH "Location of Collada DOM directory" FORCE) SET(COLLADA_DOM_ROOT "$ENV{COLLADA_DIR}/dom" CACHE PATH "Location of Collada DOM directory" FORCE)
ELSE () ELSE ( COLLADA_ENV_VAR_AVAILABLE )
SET(COLLADA_DOM_ROOT "${ACTUAL_3DPARTY_DIR}/include/1.4/dom" CACHE PATH "Location of Collada DOM directory" FORCE) SET(COLLADA_DOM_ROOT "${ACTUAL_3DPARTY_DIR}/include/1.4/dom" CACHE PATH "Location of Collada DOM directory" FORCE)
ENDIF() ENDIF( COLLADA_ENV_VAR_AVAILABLE )
@@ -28,12 +28,6 @@ IF(APPLE)
SET(COLLADA_BUILDNAME "mac") SET(COLLADA_BUILDNAME "mac")
ELSEIF(MINGW) ELSEIF(MINGW)
SET(COLLADA_BUILDNAME "mingw") SET(COLLADA_BUILDNAME "mingw")
ELSEIF(MSVC12)
SET(COLLADA_BUILDNAME "vc12")
ELSEIF(MSVC11)
SET(COLLADA_BUILDNAME "vc11")
ELSEIF(MSVC10)
SET(COLLADA_BUILDNAME "vc10")
ELSEIF(MSVC90) ELSEIF(MSVC90)
SET(COLLADA_BUILDNAME "vc9") SET(COLLADA_BUILDNAME "vc9")
ELSEIF(MSVC80) ELSEIF(MSVC80)
@@ -53,7 +47,6 @@ FIND_PATH(COLLADA_INCLUDE_DIR dae.h
/usr/local/include /usr/local/include
/usr/local/include/colladadom /usr/local/include/colladadom
/usr/local/include/collada-dom /usr/local/include/collada-dom
/opt/local/include/collada-dom
/usr/include/ /usr/include/
/usr/include/colladadom /usr/include/colladadom
/usr/include/collada-dom /usr/include/collada-dom
@@ -65,17 +58,16 @@ FIND_PATH(COLLADA_INCLUDE_DIR dae.h
${ACTUAL_3DPARTY_DIR}/include ${ACTUAL_3DPARTY_DIR}/include
) )
FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY
NAMES collada_dom collada14dom Collada14Dom libcollada14dom21 libcollada14dom22 collada-dom2.4-dp NAMES collada_dom collada14dom Collada14Dom libcollada14dom21 libcollada14dom22
PATHS PATHS
${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4 ${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4
${COLLADA_DOM_ROOT}
$ENV{COLLADA_DIR}/build/${COLLADA_BUILDNAME}-1.4 $ENV{COLLADA_DIR}/build/${COLLADA_BUILDNAME}-1.4
$ENV{COLLADA_DIR}/lib $ENV{COLLADA_DIR}/lib
$ENV{COLLADA_DIR}/lib-dbg $ENV{COLLADA_DIR}/lib-dbg
$ENV{COLLADA_DIR} $ENV{COLLADA_DIR}
~/Library/Frameworks ~/Library/Frameworks
/Library/Frameworks /Library/Frameworks
/opt/local/Library/Frameworks #macports /opt/local/Library/Frameworks #macports
/usr/local/lib /usr/local/lib
/usr/local/lib64 /usr/local/lib64
@@ -89,11 +81,10 @@ FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY
${ACTUAL_3DPARTY_DIR}/lib ${ACTUAL_3DPARTY_DIR}/lib
) )
FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY_DEBUG FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY_DEBUG
NAMES collada_dom-d collada14dom-d Collada14Dom-d libcollada14dom21-d libcollada14dom22-d collada-dom2.4-dp-d NAMES collada_dom-d collada14dom-d Collada14Dom-d libcollada14dom21-d libcollada14dom22-d
PATHS PATHS
${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4-d ${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4-d
${COLLADA_DOM_ROOT}
$ENV{COLLADA_DIR}/build/${COLLADA_BUILDNAME}-1.4-d $ENV{COLLADA_DIR}/build/${COLLADA_BUILDNAME}-1.4-d
$ENV{COLLADA_DIR}/lib $ENV{COLLADA_DIR}/lib
$ENV{COLLADA_DIR}/lib-dbg $ENV{COLLADA_DIR}/lib-dbg
@@ -113,7 +104,7 @@ FIND_LIBRARY(COLLADA_DYNAMIC_LIBRARY_DEBUG
${ACTUAL_3DPARTY_DIR}/lib ${ACTUAL_3DPARTY_DIR}/lib
) )
FIND_LIBRARY(COLLADA_STATIC_LIBRARY FIND_LIBRARY(COLLADA_STATIC_LIBRARY
NAMES libcollada14dom21-s libcollada14dom22-s libcollada14dom.a NAMES libcollada14dom21-s libcollada14dom22-s libcollada14dom.a
PATHS PATHS
${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4 ${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4
@@ -136,7 +127,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY
${ACTUAL_3DPARTY_DIR}/lib ${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 NAMES collada_dom-sd collada14dom-sd libcollada14dom21-sd libcollada14dom22-sd libcollada14dom-d.a
PATHS PATHS
${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4-d ${COLLADA_DOM_ROOT}/build/${COLLADA_BUILDNAME}-1.4-d
@@ -175,7 +166,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
) )
ENDIF(WIN32) ENDIF(WIN32)
ENDIF(LIBXML2_FOUND) ENDIF(LIBXML2_FOUND)
FIND_PACKAGE(ZLIB) FIND_PACKAGE(ZLIB)
IF (ZLIB_FOUND) IF (ZLIB_FOUND)
SET(COLLADA_ZLIB_LIBRARY "${ZLIB_LIBRARY}" CACHE FILEPATH "" FORCE) SET(COLLADA_ZLIB_LIBRARY "${ZLIB_LIBRARY}" CACHE FILEPATH "" FORCE)
@@ -244,7 +235,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
) )
FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY
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 NAMES libboost_filesystem boost_filesystem libboost_filesystem-vc90-mt libboost_filesystem-vc100-mt
PATHS PATHS
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME} ${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw ${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
@@ -252,7 +243,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
) )
FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY_DEBUG FIND_LIBRARY(COLLADA_BOOST_FILESYSTEM_LIBRARY_DEBUG
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 NAMES libboost_filesystem-d boost_filesystem-d libboost_filesystem-vc90-mt-gd libboost_filesystem-vc100-mt-gd
PATHS PATHS
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME} ${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw ${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
@@ -260,7 +251,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
) )
FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY
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 NAMES libboost_system boost_system libboost_system-vc90-mt libboost_system-vc100-mt
PATHS PATHS
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME} ${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw ${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
@@ -268,7 +259,7 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
) )
FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY_DEBUG FIND_LIBRARY(COLLADA_BOOST_SYSTEM_LIBRARY_DEBUG
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 NAMES libboost_system-d boost_system-d libboost_system-vc90-mt-gd libboost_system-vc100-mt-gd
PATHS PATHS
${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME} ${COLLADA_DOM_ROOT}/external-libs/boost/lib/${COLLADA_BUILDNAME}
${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw ${COLLADA_DOM_ROOT}/external-libs/boost/lib/mingw
@@ -279,20 +270,6 @@ FIND_LIBRARY(COLLADA_STATIC_LIBRARY_DEBUG
SET(COLLADA_FOUND "NO") SET(COLLADA_FOUND "NO")
IF(COLLADA_DYNAMIC_LIBRARY OR COLLADA_STATIC_LIBRARY) IF(COLLADA_DYNAMIC_LIBRARY OR COLLADA_STATIC_LIBRARY)
IF (COLLADA_INCLUDE_DIR) IF (COLLADA_INCLUDE_DIR)
SET(COLLADA_FOUND "YES") SET(COLLADA_FOUND "YES")
ENDIF(COLLADA_INCLUDE_DIR)
FIND_PATH(COLLADA_INCLUDE_DOMANY_DIR 1.4/dom/domAny.h ENDIF(COLLADA_DYNAMIC_LIBRARY OR COLLADA_STATIC_LIBRARY)
${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

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

View File

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

View File

@@ -11,11 +11,10 @@
#In ffmpeg code, old version use "#include <header.h>" and newer use "#include <libname/header.h>" #In ffmpeg code, old version use "#include <header.h>" and newer use "#include <libname/header.h>"
#In OSG ffmpeg plugin, we used "#include <header.h>" for compatibility with old version of ffmpeg #In OSG ffmpeg plugin, we use "#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 (useful for old version) #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 (useful for new version) #and search the path which contain the libname/header.h (usefull for new version)
#Then we need to include ${FFMPEG_libname_INCLUDE_DIRS} (in old version case, use by ffmpeg header and osg plugin code) #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) # (in new version case, use by ffmpeg header)
@@ -32,8 +31,6 @@ MACRO(FFMPEG_FIND varname shortname headername)
PATHS PATHS
${FFMPEG_ROOT}/include ${FFMPEG_ROOT}/include
$ENV{FFMPEG_DIR}/include $ENV{FFMPEG_DIR}/include
${FFMPEG_ROOT}
$ENV{FFMPEG_DIR}
~/Library/Frameworks ~/Library/Frameworks
/Library/Frameworks /Library/Frameworks
/usr/local/include /usr/local/include
@@ -51,8 +48,6 @@ MACRO(FFMPEG_FIND varname shortname headername)
PATHS PATHS
${FFMPEG_ROOT}/include ${FFMPEG_ROOT}/include
$ENV{FFMPEG_DIR}/include $ENV{FFMPEG_DIR}/include
${FFMPEG_ROOT}
$ENV{FFMPEG_DIR}
~/Library/Frameworks ~/Library/Frameworks
/Library/Frameworks /Library/Frameworks
/usr/local/include /usr/local/include
@@ -71,8 +66,6 @@ MACRO(FFMPEG_FIND varname shortname headername)
PATHS PATHS
${FFMPEG_ROOT}/lib ${FFMPEG_ROOT}/lib
$ENV{FFMPEG_DIR}/lib $ENV{FFMPEG_DIR}/lib
${FFMPEG_ROOT}/lib${shortname}
$ENV{FFMPEG_DIR}/lib${shortname}
~/Library/Frameworks ~/Library/Frameworks
/Library/Frameworks /Library/Frameworks
/usr/local/lib /usr/local/lib
@@ -129,29 +122,29 @@ FFMPEG_FIND(LIBAVFORMAT avformat avformat.h)
FFMPEG_FIND(LIBAVDEVICE avdevice avdevice.h) FFMPEG_FIND(LIBAVDEVICE avdevice avdevice.h)
FFMPEG_FIND(LIBAVCODEC avcodec avcodec.h) FFMPEG_FIND(LIBAVCODEC avcodec avcodec.h)
FFMPEG_FIND(LIBAVUTIL avutil avutil.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. FFMPEG_FIND(LIBSWSCALE swscale swscale.h) # not sure about the header to look for here.
SET(FFMPEG_FOUND "NO") SET(FFMPEG_FOUND "NO")
# Note we don't check FFMPEG_LIBSWSCALE_FOUND here, it's optional. # 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") SET(FFMPEG_FOUND "YES")
SET(FFMPEG_INCLUDE_DIRS SET(FFMPEG_INCLUDE_DIRS
${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS} ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS} ${FFMPEG_LIBAVFORMAT_INCLUDE_DIRS}/libavformat
${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS} ${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS} ${FFMPEG_LIBAVDEVICE_INCLUDE_DIRS}/libavdevice
${FFMPEG_LIBAVCODEC_INCLUDE_DIRS} ${FFMPEG_LIBAVCODEC_INCLUDE_DIRS} ${FFMPEG_LIBAVCODEC_INCLUDE_DIRS}/libavcodec
${FFMPEG_LIBAVUTIL_INCLUDE_DIRS} ${FFMPEG_LIBAVUTIL_INCLUDE_DIRS} ${FFMPEG_LIBAVUTIL_INCLUDE_DIRS}/libavutil
) )
# Using the new include style for FFmpeg prevents issues with #include <time.h>
IF (FFMPEG_STDINT_INCLUDE_DIR) IF (FFMPEG_STDINT_INCLUDE_DIR)
SET(FFMPEG_INCLUDE_DIRS SET(FFMPEG_INCLUDE_DIRS
${FFMPEG_INCLUDE_DIRS} ${FFMPEG_INCLUDE_DIRS}
${FFMPEG_STDINT_INCLUDE_DIR} ${FFMPEG_STDINT_INCLUDE_DIR}
${FFMPEG_STDINT_INCLUDE_DIR}/libavformat
${FFMPEG_STDINT_INCLUDE_DIR}/libavdevice
${FFMPEG_STDINT_INCLUDE_DIR}/libavcodec
${FFMPEG_STDINT_INCLUDE_DIR}/libavutil
) )
ENDIF() ENDIF()

View File

@@ -9,15 +9,6 @@
# #
# Created by Robert Osfield. # 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 FIND_PATH(FLTK_INCLUDE_DIR Fl/Fl.H Fl/Fl.h
$ENV{FLTK_DIR}/include $ENV{FLTK_DIR}/include
$ENV{FLTK_DIR} $ENV{FLTK_DIR}

View File

@@ -12,15 +12,6 @@
# used in building FREETYPE. # used in building FREETYPE.
# Created by Eric Wing. # Created by Eric Wing.
# prefer FindFreetype from cmake distribution
if(EXISTS ${CMAKE_ROOT}/Modules/FindFreetype.cmake)
include(${CMAKE_ROOT}/Modules/FindFreetype.cmake)
if(FREETYPE_FOUND)
return()
endif()
endif()
# Ugh, FreeType seems to use some #include trickery which # Ugh, FreeType seems to use some #include trickery which
# makes this harder than it should be. It looks like they # makes this harder than it should be. It looks like they
# put ft2build.h in a common/easier-to-find location which # put ft2build.h in a common/easier-to-find location which
@@ -33,7 +24,6 @@ endif()
# wants explicit full paths and this trickery doesn't work too well. # wants explicit full paths and this trickery doesn't work too well.
# I'm going to attempt to cut out the middleman and hope # I'm going to attempt to cut out the middleman and hope
# everything still works. # everything still works.
FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
PATHS PATHS
$ENV{FREETYPE_DIR} $ENV{FREETYPE_DIR}
@@ -58,7 +48,7 @@ FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
/opt/csw /opt/csw
/opt /opt
/usr/freeware /usr/freeware
PATH_SUFFIXES include include/freetype2 PATH_SUFFIXES include
) )
FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h
@@ -84,20 +74,6 @@ FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h
/usr/freeware/include/freetype2 /usr/freeware/include/freetype2
) )
FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 config/ftheader.h
/usr/local/include/freetype2
/usr/include/freetype2
/usr/local/X11R6/include/freetype2
/usr/local/X11/include/freetype2
/usr/X11R6/include/freetype2
/usr/X11/include/freetype2
/sw/include/freetype2
/opt/local/include/freetype2
/opt/csw/include/freetype2
/opt/include/freetype2
/usr/freeware/include/freetype2
)
FIND_LIBRARY(FREETYPE_LIBRARY FIND_LIBRARY(FREETYPE_LIBRARY
NAMES freetype libfreetype freetype219 NAMES freetype libfreetype freetype219
PATHS PATHS

View File

@@ -19,15 +19,6 @@
# This makes the presumption that you are include gdal.h like # This makes the presumption that you are include gdal.h like
# #include "gdal.h" # #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 FIND_PATH(GDAL_INCLUDE_DIR gdal.h
PATHS PATHS
$ENV{GDAL_DIR} $ENV{GDAL_DIR}

View File

@@ -1,36 +0,0 @@
# 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
)

View File

@@ -1,142 +0,0 @@
# - 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

@@ -1,174 +0,0 @@
# - 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

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

View File

@@ -9,15 +9,6 @@
# #
# Created by Robert Osfield. # 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 FIND_PATH(JASPER_INCLUDE_DIR jasper/jasper.h
$ENV{JASPER_DIR}/include $ENV{JASPER_DIR}/include
$ENV{JASPER_DIR}/src/libjasper/include $ENV{JASPER_DIR}/src/libjasper/include

View File

@@ -1,107 +0,0 @@
#---
# 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

@@ -1,83 +0,0 @@
# 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,7 +15,6 @@ FIND_PATH(NVTT_INCLUDE_DIR nvtt/nvtt.h
PATH_SUFFIXES include PATH_SUFFIXES include
) )
# NVTT
FIND_LIBRARY(NVTT_LIBRARY FIND_LIBRARY(NVTT_LIBRARY
NAMES nvtt NAMES nvtt
PATHS PATHS
@@ -26,17 +25,6 @@ FIND_LIBRARY(NVTT_LIBRARY
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static 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 FIND_LIBRARY(NVIMAGE_LIBRARY
NAMES nvimage NAMES nvimage
PATHS PATHS
@@ -47,17 +35,6 @@ FIND_LIBRARY(NVIMAGE_LIBRARY
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static 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 FIND_LIBRARY(NVMATH_LIBRARY
NAMES nvmath NAMES nvmath
PATHS PATHS
@@ -68,17 +45,6 @@ FIND_LIBRARY(NVMATH_LIBRARY
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static 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 FIND_LIBRARY(NVCORE_LIBRARY
NAMES nvcore NAMES nvcore
PATHS PATHS
@@ -88,18 +54,6 @@ FIND_LIBRARY(NVCORE_LIBRARY
${3rdPartyRoot} ${3rdPartyRoot}
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
) )
FIND_LIBRARY(NVCORE_LIBRARY_DEBUG
NAMES nvcore_d
PATHS
/usr/local
/usr
$ENV{NVTT_DIR}
${3rdPartyRoot}
PATH_SUFFIXES lib64 lib lib/shared lib/static lib64/static
)
SET(NVTT_FOUND "NO") SET(NVTT_FOUND "NO")
IF(NVTT_LIBRARY AND NVTT_INCLUDE_DIR) IF(NVTT_LIBRARY AND NVTT_INCLUDE_DIR)

View File

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

View File

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

View File

@@ -17,16 +17,6 @@
# #
# Created by Eric Wing. # 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 # Header files are presumed to be included like
# #include <OpenThreads/Thread> # #include <OpenThreads/Thread>

View File

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

View File

@@ -1,14 +1,13 @@
# Locate QuickTime # Locate QuickTime
# This module defines # This module defines
# QUICKTIME_LIBRARY # 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_INCLUDE_DIR, where to find the headers
# #
# $QUICKTIME_DIR is an environment variable that would # $QUICKTIME_DIR is an environment variable that would
# correspond to the ./configure --prefix=$QUICKTIME_DIR # 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, # QuickTime on OS X looks different than QuickTime for Windows,
# so I am going to case the two. # so I am going to case the two.
@@ -50,24 +49,18 @@ ENDIF()
IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR) IF(OSG_BUILD_PLATFORM_IPHONE OR OSG_BUILD_PLATFORM_IPHONE_SIMULATOR)
SET(QUICKTIME_FOUND "NO") SET(QUICKTIME_FOUND "NO")
ELSE() ENDIF()
IF(APPLE)
#Quicktime is not supported under 64bit OSX build so we need to detect it and disable it. IF(APPLE)
#First check to see if we are running with a native 64-bit compiler (10.6 default) and implicit arch #Quicktime is not supported under 64bit OSX build so we need to detect it and disable it.
IF(NOT CMAKE_OSX_ARCHITECTURES AND CMAKE_SIZEOF_VOID_P EQUAL 8) #First check to see if we are running with a native 64-bit compiler (10.6 default) and implicit arch
SET(QUICKTIME_FOUND "NO") IF(NOT CMAKE_OSX_ARCHITECTURES AND CMAKE_SIZEOF_VOID_P EQUAL 8)
ELSE() SET(QUICKTIME_FOUND "NO")
#Otherwise check to see if 64-bit is explicitly called for. ELSE()
LIST(FIND CMAKE_OSX_ARCHITECTURES "x86_64" has64Compile) #Otherwise check to see if 64-bit is explicitly called for.
IF(NOT has64Compile EQUAL -1) LIST(FIND CMAKE_OSX_ARCHITECTURES "x86_64" has64Compile)
SET(QUICKTIME_FOUND "NO") IF(NOT has64Compile EQUAL -1)
ENDIF() SET(QUICKTIME_FOUND "NO")
ENDIF() ENDIF()
# Disable quicktime for >= 10.7, as it's officially deprecated ENDIF()
IF(${OSG_OSX_SDK_NAME} STREQUAL "macosx10.7" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.8" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.9" OR ${OSG_OSX_SDK_NAME} STREQUAL "macosx10.10")
MESSAGE("disabling quicktime because it's not supported by the selected SDK ${OSG_OSX_SDK_NAME}")
SET(QUICKTIME_FOUND "NO")
ENDIF()
ENDIF()
ENDIF() ENDIF()

View File

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

View File

@@ -1,178 +0,0 @@
# - 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)

View File

@@ -1,45 +0,0 @@
# 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,16 +10,6 @@
# #
# Created by Ulrich Hertlein. # 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 FIND_PATH(ZLIB_INCLUDE_DIR zlib.h
$ENV{ZLIB_DIR}/include $ENV{ZLIB_DIR}/include
$ENV{ZLIB_DIR} $ENV{ZLIB_DIR}

View File

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

View File

@@ -25,6 +25,14 @@ IF(MSVC AND OSG_MSVC_VERSIONED_DLL)
HANDLE_MSVC_DLL() HANDLE_MSVC_DLL()
ENDIF() ENDIF()
IF(ANDROID)
INSTALL (
FILES ${TARGET_H}
DESTINATION ${INSTALL_INCDIR}/${LIB_NAME}
COMPONENT libopenscenegraph-dev
)
ELSE(ANDROID)
INSTALL( INSTALL(
TARGETS ${LIB_NAME} TARGETS ${LIB_NAME}
RUNTIME DESTINATION ${INSTALL_BINDIR} COMPONENT libopenscenegraph RUNTIME DESTINATION ${INSTALL_BINDIR} COMPONENT libopenscenegraph
@@ -51,3 +59,4 @@ ELSE()
# MESSAGE("${OSG_COMPILE_FRAMEWORKS_INSTALL_NAME_DIR}") # MESSAGE("${OSG_COMPILE_FRAMEWORKS_INSTALL_NAME_DIR}")
ENDIF() ENDIF()
ENDIF(ANDROID)

View File

@@ -1,15 +1,12 @@
MACRO(SETUP_ANDROID_LIBRARY LIB_NAME) MACRO(SETUP_ANDROID_LIBRARY LIB_NAME)
#foreach(arg ${TARGET_LIBRARIES}) foreach(arg ${TARGET_LIBRARIES})
# set(MODULE_LIBS "${MODULE_LIBS} -l${arg}") set(MODULE_LIBS "${MODULE_LIBS} -l${arg}")
#endforeach(arg ${TARGET_LIBRARIES}) endforeach(arg ${TARGET_LIBRARIES})
foreach(arg ${TARGET_SRC}) foreach(arg ${TARGET_SRC})
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" n_f ${arg}) string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" n_f ${arg})
IF ("${arg}" MATCHES ".*\\.c$" OR "${arg}" MATCHES ".*\\.cpp$") set(MODULE_SOURCES "${MODULE_SOURCES} ${n_f}")
#We only include source files, not header files, this removes anoying warnings
set(MODULE_SOURCES "${MODULE_SOURCES} ${n_f}")
ENDIF()
endforeach(arg ${TARGET_SRC}) endforeach(arg ${TARGET_SRC})
#SET(MODULE_INCLUDES "${CMAKE_SOURCE_DIR}/include include") #SET(MODULE_INCLUDES "${CMAKE_SOURCE_DIR}/include include")
@@ -38,8 +35,7 @@ MACRO(SETUP_ANDROID_LIBRARY LIB_NAME)
ELSEIF(OSG_GLES2_AVAILABLE) ELSEIF(OSG_GLES2_AVAILABLE)
SET(OPENGLES_LIBRARY -lGLESv2) SET(OPENGLES_LIBRARY -lGLESv2)
ENDIF() ENDIF()
#${MODULE_LIBS} set(MODULE_LIBS "${MODULE_LIBS} ${OPENGLES_LIBRARY} -ldl")
set(MODULE_LIBS_FLAGS "${OPENGLES_LIBRARY} -ldl")
if(NOT CPP_EXTENSION) if(NOT CPP_EXTENSION)
set(CPP_EXTENSION "cpp") set(CPP_EXTENSION "cpp")
endif() endif()
@@ -48,12 +44,8 @@ MACRO(SETUP_ANDROID_LIBRARY LIB_NAME)
ENDIF() ENDIF()
IF("MODULE_USER_STATIC_OR_DYNAMIC" MATCHES "STATIC") IF("MODULE_USER_STATIC_OR_DYNAMIC" MATCHES "STATIC")
SET(MODULE_BUILD_TYPE "\$\(BUILD_STATIC_LIBRARY\)") SET(MODULE_BUILD_TYPE "\$\(BUILD_STATIC_LIBRARY\)")
SET(MODULE_LIBS_SHARED " ")
SET(MODULE_LIBS_STATIC ${TARGET_LIBRARIES})
ELSE() ELSE()
SET(MODULE_BUILD_TYPE "\$\(BUILD_SHARED_LIBRARY\)") SET(MODULE_BUILD_TYPE "\$\(BUILD_DYNAMIC_LIBRARY\)")
SET(MODULE_LIBS_SHARED ${TARGET_LIBRARIES})
SET(MODULE_LIBS_STATIC " ")
ENDIF() ENDIF()
set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} ${LIB_NAME}") set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} ${LIB_NAME}")
set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${CMAKE_CURRENT_BINARY_DIR}/Android.mk \n") set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${CMAKE_CURRENT_BINARY_DIR}/Android.mk \n")
@@ -67,7 +59,7 @@ MACRO(ANDROID_3RD_PARTY)
#JPEG #JPEG
################################################ ################################################
FIND_PATH(JPEG_INCLUDE_DIR Android.mk FIND_PATH(JPEG_INCLUDE_DIR Android.mk
${CMAKE_SOURCE_DIR}/3rdparty/libjpeg NO_CMAKE_FIND_ROOT_PATH ${CMAKE_SOURCE_DIR}/3rdparty/libjpeg
) )
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libjpeg") #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") #set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${JPEG_INCLUDE_DIR}/Android.mk \n")
@@ -82,7 +74,7 @@ MACRO(ANDROID_3RD_PARTY)
#PNG #PNG
################################################ ################################################
FIND_PATH(PNG_INCLUDE_DIR Android.mk FIND_PATH(PNG_INCLUDE_DIR Android.mk
${CMAKE_SOURCE_DIR}/3rdparty/libpng NO_CMAKE_FIND_ROOT_PATH ${CMAKE_SOURCE_DIR}/3rdparty/libpng
) )
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libpng") #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") #set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${PNG_INCLUDE_DIR}/Android.mk \n")
@@ -97,7 +89,7 @@ MACRO(ANDROID_3RD_PARTY)
#GIF #GIF
################################################ ################################################
FIND_PATH(GIFLIB_INCLUDE_DIR Android.mk FIND_PATH(GIFLIB_INCLUDE_DIR Android.mk
${CMAKE_SOURCE_DIR}/3rdparty/giflib NO_CMAKE_FIND_ROOT_PATH ${CMAKE_SOURCE_DIR}/3rdparty/giflib
) )
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libgif") #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") #set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${GIFLIB_INCLUDE_DIR}/Android.mk \n")
@@ -112,7 +104,7 @@ MACRO(ANDROID_3RD_PARTY)
#TIF #TIF
################################################ ################################################
FIND_PATH(TIFF_INCLUDE_DIR Android.mk FIND_PATH(TIFF_INCLUDE_DIR Android.mk
${CMAKE_SOURCE_DIR}/3rdparty/libtiff NO_CMAKE_FIND_ROOT_PATH ${CMAKE_SOURCE_DIR}/3rdparty/libtiff
) )
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libtiff") #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") #set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${TIFF_INCLUDE_DIR}/Android.mk \n")
@@ -142,7 +134,7 @@ MACRO(ANDROID_3RD_PARTY)
#CURL #CURL
################################################ ################################################
FIND_PATH(CURL_DIR Android.mk FIND_PATH(CURL_DIR Android.mk
${CMAKE_SOURCE_DIR}/3rdparty/curl NO_CMAKE_FIND_ROOT_PATH ${CMAKE_SOURCE_DIR}/3rdparty/curl
) )
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libcurl") #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") #set(ENV{AND_OSG_LIB_PATHS} "$ENV{AND_OSG_LIB_PATHS}include ${CURL_DIR}/Android.mk \n")
@@ -159,11 +151,11 @@ MACRO(ANDROID_3RD_PARTY)
#FREETYPE #FREETYPE
################################################ ################################################
FIND_PATH(FREETYPE_DIR Android.mk FIND_PATH(FREETYPE_DIR Android.mk
${CMAKE_SOURCE_DIR}/3rdparty/freetype NO_CMAKE_FIND_ROOT_PATH ${CMAKE_SOURCE_DIR}/3rdparty/freetype
) )
#set(ENV{AND_OSG_LIB_NAMES} "$ENV{AND_OSG_LIB_NAMES} libft2") #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(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) if(FREETYPE_DIR)
message(STATUS "FREETYPE found ${FREETYPE_DIR}" ) message(STATUS "FREETYPE found ${FREETYPE_DIR}" )
set(FREETYPE_FOUND "Yes") set(FREETYPE_FOUND "Yes")
@@ -175,7 +167,7 @@ MACRO(ANDROID_3RD_PARTY)
#GDAL #GDAL
################################################ ################################################
FIND_PATH(GDAL_DIR gdal.h FIND_PATH(GDAL_DIR gdal.h
${CMAKE_SOURCE_DIR}/3rdparty/gdal/include NO_CMAKE_FIND_ROOT_PATH ${CMAKE_SOURCE_DIR}/3rdparty/gdal/include
) )
set(GDAL_INCLUDE_DIR "${GDAL_DIR}") set(GDAL_INCLUDE_DIR "${GDAL_DIR}")
if(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 # 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 # 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 # is intended as a list of variable names each one containing the path of the libraries to link to
# The existence of a variable name with _DEBUG appended is tested and, in case it' s value is used # The existance of a variable name with _DEBUG appended is tested and, in case it' s value is used
# for linking to when in debug mode # for linking to when in debug mode
# the content of this library for linking when in debugging # the content of this library for linking when in debugging
####################################################################################################### #######################################################################################################
@@ -87,12 +87,12 @@ MACRO(LINK_CORELIB_DEFAULT CORELIB_NAME)
SET(ALL_GL_LIBRARIES ${ALL_GL_LIBRARIES} ${OPENGL_egl_LIBRARY}) SET(ALL_GL_LIBRARIES ${ALL_GL_LIBRARIES} ${OPENGL_egl_LIBRARY})
ENDIF() ENDIF()
LINK_EXTERNAL(${CORELIB_NAME} ${ALL_GL_LIBRARIES}) LINK_EXTERNAL(${CORELIB_NAME} ${ALL_GL_LIBRARIES})
LINK_WITH_VARIABLES(${CORELIB_NAME} OPENTHREADS_LIBRARY) LINK_WITH_VARIABLES(${CORELIB_NAME} OPENTHREADS_LIBRARY)
IF(OPENSCENEGRAPH_SONAMES) IF(OPENSCENEGRAPH_SONAMES)
SET_TARGET_PROPERTIES(${CORELIB_NAME} PROPERTIES VERSION ${OPENSCENEGRAPH_VERSION} SOVERSION ${OPENSCENEGRAPH_SOVERSION}) SET_TARGET_PROPERTIES(${CORELIB_NAME} PROPERTIES VERSION ${OPENSCENEGRAPH_VERSION} SOVERSION ${OPENSCENEGRAPH_SOVERSION})
ENDIF(OPENSCENEGRAPH_SONAMES) ENDIF(OPENSCENEGRAPH_SONAMES)
ENDMACRO(LINK_CORELIB_DEFAULT CORELIB_NAME) ENDMACRO(LINK_CORELIB_DEFAULT CORELIB_NAME)
@@ -112,11 +112,11 @@ MACRO(SETUP_LINK_LIBRARIES)
###################################################################### ######################################################################
# #
# This set up the libraries to link to, it assumes there are two variable: one common for a group of examples or plugins # 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 # 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 # they are combined in a single list checked for unicity
# the suffix ${CMAKE_DEBUG_POSTFIX} is used for differentiating optimized and debug # 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}) SET(TARGET_LIBRARIES ${TARGET_COMMON_LIBRARIES})
@@ -151,7 +151,7 @@ MACRO(SETUP_LINK_LIBRARIES)
ENDIF(TARGET_LIBRARIES_VARS) ENDIF(TARGET_LIBRARIES_VARS)
IF(MSVC AND OSG_MSVC_VERSIONED_DLL) IF(MSVC AND OSG_MSVC_VERSIONED_DLL)
#when using full path name to specify linkage, it seems that already linked libs must be specified #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) ENDIF(MSVC AND OSG_MSVC_VERSIONED_DLL)
ENDMACRO(SETUP_LINK_LIBRARIES) ENDMACRO(SETUP_LINK_LIBRARIES)
@@ -212,10 +212,9 @@ ENDMACRO(SET_OUTPUT_DIR_PROPERTY_260 TARGET_TARGETNAME RELATIVE_OUTDIR)
########################################################################################################## ##########################################################################################################
MACRO(SETUP_LIBRARY LIB_NAME) MACRO(SETUP_LIBRARY LIB_NAME)
IF(GLCORE_FOUND) IF(ANDROID)
INCLUDE_DIRECTORIES( ${GLCORE_INCLUDE_DIR} ) SETUP_ANDROID_LIBRARY(${LIB_NAME})
ENDIF() ELSE()
SET(TARGET_NAME ${LIB_NAME} ) SET(TARGET_NAME ${LIB_NAME} )
SET(TARGET_TARGETNAME ${LIB_NAME} ) SET(TARGET_TARGETNAME ${LIB_NAME} )
ADD_LIBRARY(${LIB_NAME} ADD_LIBRARY(${LIB_NAME}
@@ -225,13 +224,10 @@ MACRO(SETUP_LIBRARY LIB_NAME)
${TARGET_SRC} ${TARGET_SRC}
) )
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES FOLDER "OSG Core") 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) IF(TARGET_LABEL)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL}") SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL}")
ENDIF(TARGET_LABEL) ENDIF(TARGET_LABEL)
IF(TARGET_LIBRARIES) IF(TARGET_LIBRARIES)
LINK_INTERNAL(${LIB_NAME} ${TARGET_LIBRARIES}) LINK_INTERNAL(${LIB_NAME} ${TARGET_LIBRARIES})
ENDIF() ENDIF()
@@ -242,14 +238,15 @@ MACRO(SETUP_LIBRARY LIB_NAME)
LINK_WITH_VARIABLES(${LIB_NAME} ${TARGET_LIBRARIES_VARS}) LINK_WITH_VARIABLES(${LIB_NAME} ${TARGET_LIBRARIES_VARS})
ENDIF(TARGET_LIBRARIES_VARS) ENDIF(TARGET_LIBRARIES_VARS)
LINK_CORELIB_DEFAULT(${LIB_NAME}) LINK_CORELIB_DEFAULT(${LIB_NAME})
ENDIF()
INCLUDE(ModuleInstall OPTIONAL) INCLUDE(ModuleInstall OPTIONAL)
ENDMACRO(SETUP_LIBRARY LIB_NAME) ENDMACRO(SETUP_LIBRARY LIB_NAME)
MACRO(SETUP_PLUGIN PLUGIN_NAME) MACRO(SETUP_PLUGIN PLUGIN_NAME)
IF(GLCORE_FOUND) IF(ANDROID)
INCLUDE_DIRECTORIES( ${GLCORE_INCLUDE_DIR} ) SETUP_ANDROID_LIBRARY(${TARGET_DEFAULT_PREFIX}${PLUGIN_NAME})
ENDIF() ELSE()
SET(TARGET_NAME ${PLUGIN_NAME} ) SET(TARGET_NAME ${PLUGIN_NAME} )
@@ -271,33 +268,38 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME)
SET(PACKAGE_COMPONENT libopenscenegraph) SET(PACKAGE_COMPONENT libopenscenegraph)
ENDIF(${ARGC} GREATER 1) ENDIF(${ARGC} GREATER 1)
# Add the VisualStudio versioning info # Add the VisualStudio versioning info
SET(TARGET_SRC ${TARGET_SRC} ${OPENSCENEGRAPH_VERSIONINFO_RC}) 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) IF (DYNAMIC_OPENSCENEGRAPH)
ADD_LIBRARY(${TARGET_TARGETNAME} MODULE ${TARGET_SRC} ${TARGET_H}) ADD_LIBRARY(${TARGET_TARGETNAME} MODULE ${TARGET_SRC} ${TARGET_H})
ELSE (DYNAMIC_OPENSCENEGRAPH) ELSE (DYNAMIC_OPENSCENEGRAPH)
ADD_LIBRARY(${TARGET_TARGETNAME} STATIC ${TARGET_SRC} ${TARGET_H}) ADD_LIBRARY(${TARGET_TARGETNAME} STATIC ${TARGET_SRC} ${TARGET_H})
ENDIF(DYNAMIC_OPENSCENEGRAPH) ENDIF(DYNAMIC_OPENSCENEGRAPH)
IF(MSVC) #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(NOT CMAKE24) 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 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) 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 #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 #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, #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 #it is hardcoded, we should compute OUTPUT_BINDIR position relative to OUTPUT_LIBDIR ... to be implemented
#changing bin to something else breaks this hack #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) 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) ELSE(NOT MSVC_IDE)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "../../bin/${OSG_PLUGINS}/" IMPORT_PREFIX "../") SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PREFIX "../../bin/${OSG_PLUGINS}/" IMPORT_PREFIX "../")
ENDIF(NOT MSVC_IDE) ENDIF(NOT MSVC_IDE)
@@ -311,18 +313,16 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME)
ENDIF(OSG_MSVC_VERSIONED_DLL) ENDIF(OSG_MSVC_VERSIONED_DLL)
ENDIF(NOT CMAKE24) ENDIF(NOT CMAKE24)
ENDIF(MSVC) ENDIF(NOT MSVC)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL}") SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL}")
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES FOLDER "Plugins") SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES FOLDER "Plugins")
IF(APPLE)
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES XCODE_ATTRIBUTE_WARNING_CFLAGS "")
ENDIF()
SETUP_LINK_LIBRARIES() 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} #the installation path are differentiated for win32 that install in bib versus other architecture that install in lib${LIB_POSTFIX}/${OSG_PLUGINS}
IF(WIN32) IF(WIN32)
INSTALL(TARGETS ${TARGET_TARGETNAME} INSTALL(TARGETS ${TARGET_TARGETNAME}
RUNTIME DESTINATION bin COMPONENT ${PACKAGE_COMPONENT} RUNTIME DESTINATION bin COMPONENT ${PACKAGE_COMPONENT}
ARCHIVE DESTINATION lib/${OSG_PLUGINS} COMPONENT libopenscenegraph-dev ARCHIVE DESTINATION lib/${OSG_PLUGINS} COMPONENT libopenscenegraph-dev
LIBRARY DESTINATION bin/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT}) LIBRARY DESTINATION bin/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT})
@@ -332,6 +332,7 @@ MACRO(SETUP_PLUGIN PLUGIN_NAME)
ARCHIVE DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} COMPONENT libopenscenegraph-dev ARCHIVE DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} COMPONENT libopenscenegraph-dev
LIBRARY DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT}) LIBRARY DESTINATION lib${LIB_POSTFIX}/${OSG_PLUGINS} COMPONENT ${PACKAGE_COMPONENT})
ENDIF(WIN32) ENDIF(WIN32)
ENDIF()
ENDMACRO(SETUP_PLUGIN) ENDMACRO(SETUP_PLUGIN)
@@ -341,10 +342,6 @@ ENDMACRO(SETUP_PLUGIN)
MACRO(SETUP_EXE IS_COMMANDLINE_APP) MACRO(SETUP_EXE IS_COMMANDLINE_APP)
#MESSAGE("in -->SETUP_EXE<-- ${TARGET_NAME}-->${TARGET_SRC} <--> ${TARGET_H}<--") #MESSAGE("in -->SETUP_EXE<-- ${TARGET_NAME}-->${TARGET_SRC} <--> ${TARGET_H}<--")
IF(GL3_FOUND)
INCLUDE_DIRECTORIES( ${GLCORE_INCLUDE_DIR} )
ENDIF()
IF(NOT TARGET_TARGETNAME) IF(NOT TARGET_TARGETNAME)
SET(TARGET_TARGETNAME "${TARGET_DEFAULT_PREFIX}${TARGET_NAME}") SET(TARGET_TARGETNAME "${TARGET_DEFAULT_PREFIX}${TARGET_NAME}")
ENDIF(NOT TARGET_TARGETNAME) ENDIF(NOT TARGET_TARGETNAME)
@@ -353,11 +350,11 @@ MACRO(SETUP_EXE IS_COMMANDLINE_APP)
ENDIF(NOT TARGET_LABEL) ENDIF(NOT TARGET_LABEL)
IF(${IS_COMMANDLINE_APP}) IF(${IS_COMMANDLINE_APP})
ADD_EXECUTABLE(${TARGET_TARGETNAME} ${TARGET_SRC} ${TARGET_H}) ADD_EXECUTABLE(${TARGET_TARGETNAME} ${TARGET_SRC} ${TARGET_H})
ELSE(${IS_COMMANDLINE_APP}) ELSE(${IS_COMMANDLINE_APP})
IF(APPLE) IF(APPLE)
# SET(MACOSX_BUNDLE_LONG_VERSION_STRING "${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION}.${OPENSCENEGRAPH_PATCH_VERSION}") # 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 # Short Version is the "marketing version". It is the version
@@ -366,8 +363,6 @@ MACRO(SETUP_EXE IS_COMMANDLINE_APP)
# Bundle version is the version the OS looks at. # 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_BUNDLE_VERSION "${OPENSCENEGRAPH_MAJOR_VERSION}.${OPENSCENEGRAPH_MINOR_VERSION}.${OPENSCENEGRAPH_PATCH_VERSION}")
SET(MACOSX_BUNDLE_GUI_IDENTIFIER "org.openscenegraph.${TARGET_TARGETNAME}" ) 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_BUNDLE_NAME "${TARGET_NAME}" )
# SET(MACOSX_BUNDLE_ICON_FILE "myicon.icns") # SET(MACOSX_BUNDLE_ICON_FILE "myicon.icns")
# SET(MACOSX_BUNDLE_COPYRIGHT "") # SET(MACOSX_BUNDLE_COPYRIGHT "")
@@ -387,7 +382,7 @@ MACRO(SETUP_EXE IS_COMMANDLINE_APP)
ENDIF(APPLE) ENDIF(APPLE)
ADD_EXECUTABLE(${TARGET_TARGETNAME} ${PLATFORM_SPECIFIC_CONTROL} ${TARGET_SRC} ${TARGET_H}) ADD_EXECUTABLE(${TARGET_TARGETNAME} ${PLATFORM_SPECIFIC_CONTROL} ${TARGET_SRC} ${TARGET_H})
ENDIF(${IS_COMMANDLINE_APP}) ENDIF(${IS_COMMANDLINE_APP})
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL}") SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES PROJECT_LABEL "${TARGET_LABEL}")
@@ -401,11 +396,7 @@ MACRO(SETUP_EXE IS_COMMANDLINE_APP)
SET_OUTPUT_DIR_PROPERTY_260(${TARGET_TARGETNAME} "") # Ensure the /Debug /Release are removed SET_OUTPUT_DIR_PROPERTY_260(${TARGET_TARGETNAME} "") # Ensure the /Debug /Release are removed
ENDIF(MSVC_IDE AND OSG_MSVC_VERSIONED_DLL) ENDIF(MSVC_IDE AND OSG_MSVC_VERSIONED_DLL)
IF(APPLE) SETUP_LINK_LIBRARIES()
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES XCODE_ATTRIBUTE_WARNING_CFLAGS "")
ENDIF()
SETUP_LINK_LIBRARIES()
ENDMACRO(SETUP_EXE) ENDMACRO(SETUP_EXE)
@@ -419,11 +410,11 @@ MACRO(SETUP_APPLICATION APPLICATION_NAME)
ELSE(${ARGC} GREATER 1) ELSE(${ARGC} GREATER 1)
SET(IS_COMMANDLINE_APP 0) SET(IS_COMMANDLINE_APP 0)
ENDIF(${ARGC} GREATER 1) ENDIF(${ARGC} GREATER 1)
SETUP_EXE(${IS_COMMANDLINE_APP}) SETUP_EXE(${IS_COMMANDLINE_APP})
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES FOLDER "Applications") SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES FOLDER "Applications")
IF(APPLE) IF(APPLE)
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION bin BUNDLE DESTINATION bin) INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION bin BUNDLE DESTINATION bin)
ELSE(APPLE) ELSE(APPLE)
@@ -448,13 +439,13 @@ MACRO(SETUP_EXAMPLE EXAMPLE_NAME)
ELSE(${ARGC} GREATER 1) ELSE(${ARGC} GREATER 1)
SET(IS_COMMANDLINE_APP 0) SET(IS_COMMANDLINE_APP 0)
ENDIF(${ARGC} GREATER 1) ENDIF(${ARGC} GREATER 1)
SETUP_EXE(${IS_COMMANDLINE_APP}) SETUP_EXE(${IS_COMMANDLINE_APP})
SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES FOLDER "Examples") SET_TARGET_PROPERTIES(${TARGET_TARGETNAME} PROPERTIES FOLDER "Examples")
IF(APPLE) 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) ELSE(APPLE)
INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION share/OpenSceneGraph/bin COMPONENT openscenegraph-examples ) INSTALL(TARGETS ${TARGET_TARGETNAME} RUNTIME DESTINATION share/OpenSceneGraph/bin COMPONENT openscenegraph-examples )
ENDIF(APPLE) ENDIF(APPLE)
@@ -492,7 +483,7 @@ MACRO(HANDLE_MSVC_DLL)
ENDIF(${ARGC} GREATER 1) ENDIF(${ARGC} GREATER 1)
SET_OUTPUT_DIR_PROPERTY_260(${LIB_NAME} "") # Ensure the /Debug /Release are removed SET_OUTPUT_DIR_PROPERTY_260(${LIB_NAME} "") # Ensure the /Debug /Release are removed
IF(NOT MSVC_IDE) IF(NOT MSVC_IDE)
IF (NOT CMAKE24) IF (NOT CMAKE24)
BUILDER_VERSION_GREATER(2 8 0) BUILDER_VERSION_GREATER(2 8 0)
IF(NOT VALID_BUILDER_VERSION) IF(NOT VALID_BUILDER_VERSION)
@@ -525,12 +516,8 @@ MACRO(HANDLE_MSVC_DLL)
ELSE (NOT CMAKE24) ELSE (NOT CMAKE24)
SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../../bin/${LIB_PREFIX}${LIB_SOVERSION}-" IMPORT_PREFIX "../") SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES PREFIX "../../bin/${LIB_PREFIX}${LIB_SOVERSION}-" IMPORT_PREFIX "../")
ENDIF (NOT CMAKE24) 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 PREFIX "../../bin/osg${OPENSCENEGRAPH_SOVERSION}-")
# SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES IMPORT_PREFIX "../") # SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES IMPORT_PREFIX "../")
ENDMACRO(HANDLE_MSVC_DLL) ENDMACRO(HANDLE_MSVC_DLL)
MACRO(REMOVE_CXX_FLAG flag)
STRING(REPLACE "${flag}" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
ENDMACRO()

15206
ChangeLog

File diff suppressed because it is too large Load Diff

835
NEWS.txt

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -1,14 +1,18 @@
Welcome to the OpenSceneGraph (OSG). Welcome to the OpenSceneGraph (OSG).
For up-to-date information on the project, in-depth details on how to 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 compile and run libraries and examples, see the documentation on the
OpenSceneGraph website: OpenSceneGraph website:
http://www.openscenegraph.org/index.php/documentation http://www.openscenegraph.org
For support subscribe to our public mailing list:
For support subscribe to our public mailing list or forum, details at: http://www.openscenegraph.org/projects/osg/wiki/MailingLists
http://www.openscenegraph.org/index.php/support or forum:
http://forum.openscenegraph.org/
For the impatient, we've included quick build instructions below, these For the impatient, we've included quick build instructions below, these
are are broken down is three parts: are are broken down is three parts:
@@ -23,64 +27,65 @@ more indepth instructions.
Robert Osfield. Robert Osfield.
Project Lead. Project Lead.
12th August 2015. 28th June 2011.
-- --
Section 1. How to build the OpenSceneGraph Section 1. How to build the OpenSceneGraph
========================================== ==========================================
The OpenSceneGraph uses the CMake build system to generate a The OpenSceneGraph uses the CMake build system to generate a
platform-specific build environment. CMake reads the CMakeLists.txt platform-specific build environment. CMake reads the CMakeLists.txt
files that you'll find throughout the OpenSceneGraph directories, files that you'll find throughout the OpenSceneGraph directories,
checks for installed dependenciesand then generates the appropriate checks for installed dependenciesand then generates the appropriate
build system. build system.
If you don't already have CMake installed on your system you can grab 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 it from http://www.cmake.org, use version 2.4.6 or later. Details on the
OpenSceneGraph's CMake build can be found at: OpenSceneGraph's CMake build can be found at:
http://www.openscenegraph.org/projects/osg/wiki/Build/CMake http://www.openscenegraph.org/projects/osg/wiki/Build/CMake
Under unices (i.e. Linux, IRIX, Solaris, Free-BSD, HP-Ux, AIX, OSX) 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 use the cmake or ccmake command-line utils, or use the included tiny
to building Release to ensure that you get the best performance from configure script that'll run cmake for you. The configure script
your final libraries/applications. simply runs 'cmake . -DCMAKE_BUILD_TYPE=Release' to ensure that you
get the best performance from your final libraries/applications.
cd OpenSceneGraph cd OpenSceneGraph
cmake . ./configure
make make
sudo make install sudo make install
Alternatively, you can create an out-of-source build directory and run 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 cmake or ccmake from there. The advantage to this approach is that the
temporary files created by CMake won't clutter the OpenSceneGraph temporary files created by CMake won't clutter the OpenSceneGraph
source directory, and also makes it possible to have multiple source directory, and also makes it possible to have multiple
independent build targets by creating multiple build directories. In a independent build targets by creating multiple build directories. In a
directory alongside the OpenSceneGraph use: directory alongside the OpenSceneGraph use:
mkdir build mkdir build
cd build cd build
cmake ../OpenSceneGraph cmake ../OpenSceneGraph -DCMAKE_BUILD_TYPE=Release
make make
sudo make install sudo make install
Under Windows use the GUI tool CMakeSetup to build your VisualStudio Under Windows use the GUI tool CMakeSetup to build your VisualStudio
files. The following page on our wiki dedicated to the CMake build files. The following page on our wiki dedicated to the CMake build
system should help guide you through the process: system should help guide you through the process:
http://www.openscenegraph.org/index.php/documentation/platform-specifics/windows http://www.openscenegraph.org/projects/osg/wiki/Support/PlatformSpecifics/VisualStudio
Under OSX you can either use the CMake build system above, or use the Under OSX you can either use the CMake build system above, or use the
Xcode projects that you will find in the OpenSceneGraph/Xcode Xcode projects that you will find in the OpenSceneGraph/Xcode
directory. See release notes on OSX CMake build below. 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: information read "Getting Started" guide:
http://www.openscenegraph.org/index.php/documentation/10-getting-started http://www.openscenegraph.org/projects/osg/wiki/Support/GettingStarted
Section 2. Release notes on OSX build, by Eric Sokolowsky, August 5, 2008 Section 2. Release notes on OSX build, by Eric Sokolowsky, August 5, 2008
========================================================================= =========================================================================
@@ -164,11 +169,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 * Check that CMAKE_OSX_ARCHITECTURE is i386 for the simulator or armv6;armv7 for the device
* Disable DYNAMIC_OPENSCENEGRAPH, DYNAMIC_OPENTHREADS * Disable DYNAMIC_OPENSCENEGRAPH, DYNAMIC_OPENTHREADS
This will give us the static build we need for iPhone. 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 OSG_GL_DISPLAYLISTS_AVAILABLE, OSG_GL_VERTEX_FUNCS_AVAILABLE
* Enable OSG_GLES1_AVAILABLE *OR* OSG_GLES2_AVAILABLE *OR* OSG_GLES3_AVAILABLE (GLES3 will enable GLES2 features) * Enable OSG_GLES1_AVAILABLE *OR* OSG_GLES2_AVAILABLE
* Ensure OSG_WINDOWING_SYSTEM is set to IOS * 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) (OpenFrameworks has one bundled with its distribution)
* Ensure that CMake_OSX_SYSROOT points to your iOS SDK. * Ensure that CMake_OSX_SYSROOT points to your iOS SDK.
* Generate the Xcode project * Generate the Xcode project
@@ -201,9 +206,9 @@ $ cmake -G Xcode \
Known issues: 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. the 'Other linker flags' list.
* Apps and exes don't get created * Apps and exes don't get created
* You can only select Simulator, or Device projects. In the XCode * You can only select Simulator, or Device projects. In the XCode
project you will see both types but the sdk they link will project you will see both types but the sdk they link will
be the same. be the same.

View File

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

View File

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

View File

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

View File

@@ -122,7 +122,6 @@ const char* invalidNames[] =
"LineStipple", "LineStipple",
"Logos", "Logos",
"LongIDRecord", "LongIDRecord",
"InputIterator",
"Make", "Make",
"Makefile", "Makefile",
"Material", "Material",
@@ -248,20 +247,7 @@ const char* invalidNames[] =
"UpdateSkeleton", "UpdateSkeleton",
"Vec3", "Vec3",
"Plugin", "Plugin",
"Get", "Get"
"LightSource",
"SlideEventHandler",
"GraphicsContext*",
"Apple",
"GeometryNew",
"FrameBufferObject",
"Lua",
"VolumeTile",
"PushStackValueVisitor",
"RayIntersector",
"OpenSceneGraph-Data",
"Node",
"AlphaFunc"
}; };
@@ -273,7 +259,6 @@ struct TypoCorrection
TypoCorrection typoCorrections[] = TypoCorrection typoCorrections[] =
{ {
{"Cheaev", "Chebaev"},
{"Alaxandre", "Alexandre"}, {"Alaxandre", "Alexandre"},
{"Aderian", "Adrian"}, {"Aderian", "Adrian"},
{"Adndre", "Andre"}, {"Adndre", "Andre"},
@@ -283,7 +268,6 @@ TypoCorrection typoCorrections[] =
{"André", "Andr<EFBFBD>"}, {"André", "Andr<EFBFBD>"},
{"Antione", "Antoine"}, {"Antione", "Antoine"},
{"Antonoine", "Antoine"}, {"Antonoine", "Antoine"},
{"Aurelein", "Aurelien"},
{"Atr", "Art"}, {"Atr", "Art"},
{"Baverage", "Beverage"}, {"Baverage", "Beverage"},
{"Bistroviae", "Bistrovic"}, {"Bistroviae", "Bistrovic"},
@@ -302,7 +286,6 @@ TypoCorrection typoCorrections[] =
{"Fabian", "Fabien"}, {"Fabian", "Fabien"},
{"Fautre", "Fautr<EFBFBD>"}, {"Fautre", "Fautr<EFBFBD>"},
{"Frashid", "Farshid"}, {"Frashid", "Farshid"},
{"Farshild", "Farshid"},
{"Fred", "Frederic"}, {"Fred", "Frederic"},
{"Fredrick", "Frederic"}, {"Fredrick", "Frederic"},
{"Fredric", "Frederic"}, {"Fredric", "Frederic"},
@@ -328,8 +311,6 @@ TypoCorrection typoCorrections[] =
{"Happalahti", "Haapalahti"}, {"Happalahti", "Haapalahti"},
{"Hertlien", "Hertlein"}, {"Hertlien", "Hertlein"},
{"Hatwig", "Hartwig"}, {"Hatwig", "Hartwig"},
{"Hauknes", "Haukness"},
{"Hunber", "Huber"},
{"Hi", "He"}, {"Hi", "He"},
{"Hooper", "Hopper"}, {"Hooper", "Hopper"},
{"Inverson", "Iverson"}, {"Inverson", "Iverson"},
@@ -354,7 +335,6 @@ TypoCorrection typoCorrections[] =
{"Krulthof", "Kruithof"}, {"Krulthof", "Kruithof"},
{"Lagrade", "Lagarde"}, {"Lagrade", "Lagarde"},
{"Largade", "Lagarde"}, {"Largade", "Lagarde"},
{"Largarde", "Lagarde"},
{"Larshkari", "Lashkari"}, {"Larshkari", "Lashkari"},
{"Lashakari", "Lashkari"}, {"Lashakari", "Lashkari"},
{"Lashari", "Lashkari"}, {"Lashari", "Lashkari"},
@@ -400,7 +380,6 @@ TypoCorrection typoCorrections[] =
{"Oritz", "Ortiz"}, {"Oritz", "Ortiz"},
{"Osfeld", "Osfield"}, {"Osfeld", "Osfield"},
{"Osfied", "Osfield"}, {"Osfied", "Osfield"},
{"Paulk", "Paul"},
{"Pail", "Paul"}, {"Pail", "Paul"},
{"Perciva", "Peciva"}, {"Perciva", "Peciva"},
{"Pecvia", "Peciva"}, {"Pecvia", "Peciva"},
@@ -461,30 +440,7 @@ TypoCorrection typoCorrections[] =
{"Jahannes","Johannes"}, {"Jahannes","Johannes"},
{"Eskland","Ekstrand"}, {"Eskland","Ekstrand"},
{"Baeuerele","Baeuerle"}, {"Baeuerele","Baeuerle"},
{"Bauerle","Baeuerle"}, {"Bauerle","Baeuerle"}
{"Baeurele","Baeuerle"},
{"Nillson","Nilsson"},
{"Bjorn","Bj<EFBFBD>rn"},
{"Björn","Bj<EFBFBD>rn"},
{"Stepan","Stephan"},
{"Kristoger","Kristofer"},
{"Blessing","Blissing"},
{"Dannahuer","Dannhauer"},
{"Chebeav", "Chebaev"},
{"Messershmidt","Messerschmidt"},
{"Auelien","Aurelien"},
{"Aurélien","Aur<EFBFBD>lien"},
{"McDonnel","Mc Donnell"},
{"McDonnell","Mc Donnell"},
{"Delallée","Delall<EFBFBD>e"},
{"Gjøl","Gj<EFBFBD>l"},
{"Ravšelj","Rav<EFBFBD>elj"},
{"Ravsel", "Rav<EFBFBD>elj"},
{"Ravselj", "Rav<EFBFBD>elj"},
{"Janik", "Jannik"},
{"Viganò", "Vigan<EFBFBD>"},
{"Vigano", "Vigan<EFBFBD>"},
{"Frashud", "Farshid"}
}; };
@@ -498,28 +454,16 @@ struct NameCorrection
NameCorrection nameCorrections[] = NameCorrection nameCorrections[] =
{ {
{"FrancoisTigeot","",
"Francois", "Tigeot"},
{"Juan","Manuel",
"Juan", "Manuel Alvarez"},
{"Jaap","Gas",
"Jaap", "Glas"},
{"Philip","Lamp",
"Philip", "Lamb"},
{"Dimi","Christop", {"Dimi","Christop",
"Dimi", "Christopoulos"}, "Dimi", "Christopoulos"},
{"Jorge","Ciges", {"Jorge","Ciges",
"Jorge", "Izquierdo Ciges"}, "Jorge", "Izquierdo"},
{"Jorge","Izquierdo",
"Jorge", "Izquierdo Ciges"},
{"Rafa","Gata", {"Rafa","Gata",
"Rafa", "Gaitan"}, "Rafa", "Gaitan"},
{"Sukender","I", {"Sukender","I",
"Sukender", ""}, "Sukender", ""},
{"Sukender","Here", {"Sukender","Here",
"Sukender", ""}, "Sukender", ""},
{"Sukender","Fix",
"Sukender", ""},
{"Ewe","Woessner", {"Ewe","Woessner",
"Uwe", "Woessner"}, "Uwe", "Woessner"},
{"Martin","von", {"Martin","von",
@@ -534,8 +478,6 @@ NameCorrection nameCorrections[] =
"Thomas", "Hogarth"}, "Thomas", "Hogarth"},
{"Marin", "Lavery", {"Marin", "Lavery",
"Martin", "Lavery"}, "Martin", "Lavery"},
{"Michael", "Bach",
"Michael", "Bach Jensen"},
{"Nguyen", "Van", {"Nguyen", "Van",
"Nguyen", "Van Truong"}, "Nguyen", "Van Truong"},
{"Thom", "Carlo", {"Thom", "Carlo",
@@ -592,8 +534,6 @@ NameCorrection nameCorrections[] =
"Melchior", "Franz"}, "Melchior", "Franz"},
{"Glen", "Waldon", {"Glen", "Waldon",
"Glenn", "Waldron"}, "Glenn", "Waldron"},
{"Glen", "Waldron",
"Glenn", "Waldron"},
{"Ralf", "Karn", {"Ralf", "Karn",
"Ralf", "Kern"}, "Ralf", "Kern"},
{"Donny", "Cipperly", {"Donny", "Cipperly",
@@ -626,12 +566,8 @@ NameCorrection nameCorrections[] =
"Romano", "Jos<EFBFBD> Magacho da Silva"}, "Romano", "Jos<EFBFBD> Magacho da Silva"},
{"Rommano", "Silva", {"Rommano", "Silva",
"Romano", "Jos<EFBFBD> Magacho da Silva"}, "Romano", "Jos<EFBFBD> Magacho da Silva"},
{"Romano", "Magacho",
"Romano", "Jos<EFBFBD> Magacho da Silva"},
{"Leandro", "Motta", {"Leandro", "Motta",
"Leandro", "Motta Barros"}, "Leandro", "Motta Barros"},
{"Leandro", "Motto",
"Leandro", "Motta Barros"},
{"A", "Botorabi", {"A", "Botorabi",
"Ali", "Botorabi"}, "Ali", "Botorabi"},
{"Waltice", "", {"Waltice", "",
@@ -648,32 +584,10 @@ NameCorrection nameCorrections[] =
"Luc", "Frauciel"}, "Luc", "Frauciel"},
{"Alberto", "Lucas", {"Alberto", "Lucas",
"Alberto", "Luaces"}, "Alberto", "Luaces"},
{"Alberto", "Luacus",
"Alberto", "Luaces"},
{"Tyge", "", {"Tyge", "",
"Tyge", "L<EFBFBD>vset"}, "Tyge", "L<EFBFBD>vset"},
{"Ricard", "Schmidt", {"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"}
}; };
@@ -1005,9 +919,7 @@ void printContributors(const std::string& changeLog, bool printNumEntries)
cout << "-------------------------" << endl; cout << "-------------------------" << endl;
for (SortedNameMap::reverse_iterator sitr = sortedNames.rbegin(); sitr != sortedNames.rend(); ++sitr) for (SortedNameMap::reverse_iterator sitr = sortedNames.rbegin(); sitr != sortedNames.rend(); ++sitr)
{ {
cout << sitr->first << "\t" << sitr->second.first; cout << sitr->first << "\t" << sitr->second.first << " " << sitr->second.second << endl;
if (!sitr->second.second.empty()) cout << " " << sitr->second.second;
cout << endl;
} }
} }
else else
@@ -1016,9 +928,7 @@ void printContributors(const std::string& changeLog, bool printNumEntries)
cout << "-----------------" << endl; cout << "-----------------" << endl;
for (SortedNameMap::reverse_iterator sitr = sortedNames.rbegin(); sitr != sortedNames.rend(); ++sitr) for (SortedNameMap::reverse_iterator sitr = sortedNames.rbegin(); sitr != sortedNames.rend(); ++sitr)
{ {
cout << sitr->second.first; cout << sitr->second.first << " " << sitr->second.second << endl;
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 // The majority of the application is dedicated to building the
// current contributors list by parsing the ChangeLog, it just takes // current contribitors list by parsing the ChangeLog, it just takes
// one line in the main itself to report the version number. // one line in the main itself to report the version number.
#include <set> #include <set>

View File

@@ -14,7 +14,6 @@
#include <osg/CoordinateSystemNode> #include <osg/CoordinateSystemNode>
#include <osg/Switch> #include <osg/Switch>
#include <osg/Types>
#include <osgText/Text> #include <osgText/Text>
#include <osgViewer/Viewer> #include <osgViewer/Viewer>
@@ -29,11 +28,8 @@
#include <osgGA/TerrainManipulator> #include <osgGA/TerrainManipulator>
#include <osgGA/SphericalManipulator> #include <osgGA/SphericalManipulator>
#include <osgGA/Device>
#include <iostream> #include <iostream>
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
// use an ArgumentParser object to manage the program arguments. // use an ArgumentParser object to manage the program arguments.
@@ -45,9 +41,6 @@ int main(int argc, char** argv)
arguments.getApplicationUsage()->addCommandLineOption("--image <filename>","Load an image and render it on a quad"); arguments.getApplicationUsage()->addCommandLineOption("--image <filename>","Load an image and render it on a quad");
arguments.getApplicationUsage()->addCommandLineOption("--dem <filename>","Load an image/DEM and render it on a HeightField"); arguments.getApplicationUsage()->addCommandLineOption("--dem <filename>","Load an image/DEM and render it on a HeightField");
arguments.getApplicationUsage()->addCommandLineOption("--login <url> <username> <password>","Provide authentication information for http file access."); arguments.getApplicationUsage()->addCommandLineOption("--login <url> <username> <password>","Provide authentication information for http file access.");
arguments.getApplicationUsage()->addCommandLineOption("-p <filename>","Play specified camera path animation file, previously saved with 'z' key.");
arguments.getApplicationUsage()->addCommandLineOption("--speed <factor>","Speed factor for animation playing (1 == normal speed).");
arguments.getApplicationUsage()->addCommandLineOption("--device <device-name>","add named device to the viewer");
osgViewer::Viewer viewer(arguments); osgViewer::Viewer viewer(arguments);
@@ -84,16 +77,6 @@ int main(int argc, char** argv)
} }
} }
std::string device;
while(arguments.read("--device", device))
{
osg::ref_ptr<osgGA::Device> dev = osgDB::readFile<osgGA::Device>(device);
if (dev.valid())
{
viewer.addDevice(dev.get());
}
}
// set up the camera manipulators. // set up the camera manipulators.
{ {
osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator; osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator;

View File

@@ -54,7 +54,7 @@ IF (NOT DYNAMIC_OPENSCENEGRAPH)
osgdb_openflight osgdb_openflight
osgdb_obj osgdb_obj
) )
SET(TARGET_ADDED_LIBRARIES ${TARGET_ADDED_LIBRARIES} SET(TARGET_ADDED_LIBRARIES ${TARGET_ADDED_LIBRARIES}
osgdb_deprecated_osg osgdb_deprecated_osgparticle osgdb_deprecated_osganimation osgdb_deprecated_osg osgdb_deprecated_osgparticle osgdb_deprecated_osganimation
osgdb_deprecated_osgfx osgdb_deprecated_osgsim osgdb_deprecated_osgtext 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 terms of the GNU General Public License (GPL) version 2.0.
* The full license is in LICENSE.txt file included with this distribution,. * The full license is in LICENSE.txt file included with this distribution,.
* *
* This software is distributed in the hope that it will be useful, * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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 LICENSE.txt for more details.
*/ */
@@ -33,15 +33,15 @@
#if defined(__linux) #if defined(__linux)
#include <unistd.h> #include <unistd.h>
#include <linux/sockios.h> #include <linux/sockios.h>
#elif defined(__FreeBSD__) || defined(__DragonFly__) #elif defined(__FreeBSD__)
#include <unistd.h> #include <unistd.h>
#include <sys/sockio.h> #include <sys/sockio.h>
#elif defined(__sgi) #elif defined(__sgi)
#include <unistd.h> #include <unistd.h>
#include <net/soioctl.h> #include <net/soioctl.h>
#elif defined(__CYGWIN__) #elif defined(__CYGWIN__)
#include <unistd.h> #include <unistd.h>
#elif defined(__sun) #elif defined(__sun)
#include <unistd.h> #include <unistd.h>
#include <sys/sockio.h> #include <sys/sockio.h>
#elif defined (__APPLE__) #elif defined (__APPLE__)
@@ -202,8 +202,7 @@ void DataConverter::write(CameraPacket& cameraPacket)
itr != cameraPacket._events.end(); itr != cameraPacket._events.end();
++itr) ++itr)
{ {
osgGA::GUIEventAdapter* event = (*itr)->asGUIEventAdapter(); write(*(*itr));
if (event) write(*(event));
} }
} }
@@ -241,7 +240,7 @@ void CameraPacket::readEventQueue(osgViewer::Viewer& viewer)
void CameraPacket::writeEventQueue(osgViewer::Viewer& viewer) void CameraPacket::writeEventQueue(osgViewer::Viewer& viewer)
{ {
osg::notify(osg::INFO)<<"received events = "<<_events.size()<<std::endl; osg::notify(osg::INFO)<<"recieved events = "<<_events.size()<<std::endl;
// copy the events to osgProducer style events. // copy the events to osgProducer style events.
viewer.getEventQueue()->appendEvents(_events); viewer.getEventQueue()->appendEvents(_events);
@@ -250,7 +249,7 @@ void CameraPacket::writeEventQueue(osgViewer::Viewer& viewer)
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// Receiver // Reciever
// //
Receiver::Receiver( void ) Receiver::Receiver( void )
{ {
@@ -337,9 +336,8 @@ void Receiver::sync( void )
return; return;
} }
#if defined(__linux) || defined(__FreeBSD__) || defined( __APPLE__ ) || \ #if defined(__linux) || defined(__FreeBSD__) || defined( __APPLE__ )
defined(__DragonFly__) socklen_t
socklen_t
#else #else
int int
#endif #endif
@@ -382,7 +380,7 @@ void Receiver::sync( void )
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// Broadcaster // Broadcaster
// //
Broadcaster::Broadcaster( void ) 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 terms of the GNU General Public License (GPL) version 2.0.
* The full license is in LICENSE.txt file included with this distribution,. * The full license is in LICENSE.txt file included with this distribution,.
* *
* This software is distributed in the hope that it will be useful, * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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 LICENSE.txt for more details.
*/ */
@@ -29,25 +29,25 @@
// //
// Class definition for the recipient of a broadcasted message // Class definition for the recipient of a broadcasted message
// //
class Receiver class Receiver
{ {
public : public :
Receiver(); Receiver();
~Receiver(); ~Receiver();
// setBuffer defines the buffer into which the broadcasted // setBuffer defines the buffer into which the broadcasted
// message will be received. // message will be received.
void setBuffer( void *buffer, const unsigned int size ); void setBuffer( void *buffer, const unsigned int size );
// Define what port to listen and bind to // Define what port to listen and bind to
void setPort( const short port ); void setPort( const short port );
// Sync does a blocking wait to recieve next message // Sync does a blocking wait to recieve next message
void sync( void ); void sync( void );
private : private :
bool init( void ); bool init( void );
private : private :
#if defined (WIN32) && !defined(__CYGWIN__) #if defined (WIN32) && !defined(__CYGWIN__)
@@ -68,29 +68,29 @@ class Receiver
// //
// Class definition for broadcasting a buffer to a LAN // Class definition for broadcasting a buffer to a LAN
// //
class Broadcaster class Broadcaster
{ {
public : public :
Broadcaster( void ); Broadcaster( void );
~Broadcaster( void ); ~Broadcaster( void );
// Set the broadcast port // Set the broadcast port
void setPort( const short port ); void setPort( const short port );
// Set the buffer to be broadcast // Set the buffer to be broadcast
void setBuffer( void *buffer, const unsigned int buffer_size ); void setBuffer( void *buffer, const unsigned int buffer_size );
// Set a recipient host. If this is used, the Broadcaster // Set a recipient host. If this is used, the Broadcaster
// no longer broadcasts, but rather directs UDP packets at // no longer broadcasts, but rather directs UDP packets at
// host. // host.
void setHost( const char *hostname ); void setHost( const char *hostname );
// Sync broadcasts the buffer // Sync broadcasts the buffer
void sync( void ); void sync( void );
private : private :
bool init( void ); bool init( void );
private : private :
#if defined(WIN32) && !defined(__CYGWIN__) #if defined(WIN32) && !defined(__CYGWIN__)
@@ -112,15 +112,15 @@ class Broadcaster
class CameraPacket { class CameraPacket {
public: public:
static const unsigned int MAX_NUM_EVENTS; static const unsigned int MAX_NUM_EVENTS;
static const unsigned int SWAP_BYTES_COMPARE; static const unsigned int SWAP_BYTES_COMPARE;
CameraPacket():_masterKilled(false) CameraPacket():_masterKilled(false)
{ {
_byte_order = SWAP_BYTES_COMPARE; _byte_order = SWAP_BYTES_COMPARE;
} }
void setPacket(const osg::Matrix& matrix,const osg::FrameStamp* frameStamp) void setPacket(const osg::Matrix& matrix,const osg::FrameStamp* frameStamp)
{ {
_matrix = matrix; _matrix = matrix;
@@ -129,20 +129,20 @@ class CameraPacket {
_frameStamp = *frameStamp; _frameStamp = *frameStamp;
} }
} }
void getModelView(osg::Matrix& matrix,float angle_offset=0.0f) 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); matrix = _matrix * osg::Matrix::rotate(osg::DegreesToRadians(angle_offset),0.0f,1.0f,0.0f);
} }
void readEventQueue(osgViewer::Viewer& viewer); void readEventQueue(osgViewer::Viewer& viewer);
void writeEventQueue(osgViewer::Viewer& viewer); void writeEventQueue(osgViewer::Viewer& viewer);
void setMasterKilled(const bool flag) { _masterKilled = flag; } void setMasterKilled(const bool flag) { _masterKilled = flag; }
const bool getMasterKilled() const { return _masterKilled; } const bool getMasterKilled() const { return _masterKilled; }
unsigned int _byte_order; unsigned int _byte_order;
bool _masterKilled; bool _masterKilled;
osg::Matrix _matrix; osg::Matrix _matrix;
@@ -150,11 +150,11 @@ class CameraPacket {
// note don't use a ref_ptr as used elsewhere for FrameStamp // note don't use a ref_ptr as used elsewhere for FrameStamp
// since we don't want to copy the pointer - but the memory. // since we don't want to copy the pointer - but the memory.
// FrameStamp doesn't have a private destructor to allow // 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; osg::FrameStamp _frameStamp;
osgGA::EventQueue::Events _events; osgGA::EventQueue::Events _events;
}; };
class DataConverter class DataConverter
@@ -186,22 +186,22 @@ class DataConverter
{ {
if (_currentPtr+1>=_endPtr) return; if (_currentPtr+1>=_endPtr) return;
*(_currentPtr++) = *(ptr); *(_currentPtr++) = *(ptr);
} }
inline void read1(char* ptr) inline void read1(char* ptr)
{ {
if (_currentPtr+1>=_endPtr) return; if (_currentPtr+1>=_endPtr) return;
*(ptr) = *(_currentPtr++); *(ptr) = *(_currentPtr++);
} }
inline void write2(char* ptr) inline void write2(char* ptr)
{ {
if (_currentPtr+2>=_endPtr) return; if (_currentPtr+2>=_endPtr) return;
*(_currentPtr++) = *(ptr++); *(_currentPtr++) = *(ptr++);
*(_currentPtr++) = *(ptr); *(_currentPtr++) = *(ptr);
} }
inline void read2(char* ptr) inline void read2(char* ptr)
@@ -210,13 +210,13 @@ class DataConverter
if (_swapBytes) if (_swapBytes)
{ {
*(ptr+1) = *(_currentPtr++); *(ptr+1) = *(_currentPtr++);
*(ptr) = *(_currentPtr++); *(ptr) = *(_currentPtr++);
} }
else else
{ {
*(ptr++) = *(_currentPtr++); *(ptr++) = *(_currentPtr++);
*(ptr) = *(_currentPtr++); *(ptr) = *(_currentPtr++);
} }
} }
@@ -224,10 +224,10 @@ class DataConverter
{ {
if (_currentPtr+4>=_endPtr) return; 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) inline void read4(char* ptr)
@@ -236,17 +236,17 @@ class DataConverter
if (_swapBytes) if (_swapBytes)
{ {
*(ptr+3) = *(_currentPtr++); *(ptr+3) = *(_currentPtr++);
*(ptr+2) = *(_currentPtr++); *(ptr+2) = *(_currentPtr++);
*(ptr+1) = *(_currentPtr++); *(ptr+1) = *(_currentPtr++);
*(ptr) = *(_currentPtr++); *(ptr) = *(_currentPtr++);
} }
else 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; 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) inline void read8(char* ptr)
@@ -272,27 +272,27 @@ class DataConverter
if (_swapBytes) if (_swapBytes)
{ {
*(ptr+7) = *(_currentPtr++); *(ptr+7) = *(_currentPtr++);
*(ptr+6) = *(_currentPtr++); *(ptr+6) = *(_currentPtr++);
*(ptr+5) = *(_currentPtr++); *(ptr+5) = *(_currentPtr++);
*(ptr+4) = *(_currentPtr++); *(ptr+4) = *(_currentPtr++);
*(ptr+3) = *(_currentPtr++); *(ptr+3) = *(_currentPtr++);
*(ptr+2) = *(_currentPtr++); *(ptr+2) = *(_currentPtr++);
*(ptr+1) = *(_currentPtr++); *(ptr+1) = *(_currentPtr++);
*(ptr) = *(_currentPtr++); *(ptr) = *(_currentPtr++);
} }
else 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 writeFloat(float c) { write4((char*)&c); }
inline void writeDouble(double c) { write8((char*)&c); } inline void writeDouble(double c) { write8((char*)&c); }
inline char readChar() { char c=0; read1(&c); return c; } inline char readChar() { char c; read1(&c); return c; }
inline unsigned char readUChar() { unsigned char c=0; read1((char*)&c); return c; } inline unsigned char readUChar() { unsigned char c; read1((char*)&c); return c; }
inline short readShort() { short c=0; read2((char*)&c); return c; } inline short readShort() { short c; read2((char*)&c); return c; }
inline unsigned short readUShort() { unsigned short c=0; read2((char*)&c); return c; } inline unsigned short readUShort() { unsigned short c; read2((char*)&c); return c; }
inline int readInt() { int c=0; read4((char*)&c); return c; } inline int readInt() { int c; read4((char*)&c); return c; }
inline unsigned int readUInt() { unsigned int c=0; read4((char*)&c); return c; } inline unsigned int readUInt() { unsigned int c; read4((char*)&c); return c; }
inline float readFloat() { float c=0.0f; read4((char*)&c); return c; } inline float readFloat() { float c; read4((char*)&c); return c; }
inline double readDouble() { double c=0.0; read8((char*)&c); return c; } inline double readDouble() { double c; read8((char*)&c); return c; }
void write(const osg::FrameStamp& fs); void write(const osg::FrameStamp& fs);
void read(osg::FrameStamp& fs); void read(osg::FrameStamp& fs);
@@ -322,13 +322,13 @@ class DataConverter
void write(const osgGA::GUIEventAdapter& event); void write(const osgGA::GUIEventAdapter& event);
void read(osgGA::GUIEventAdapter& event); void read(osgGA::GUIEventAdapter& event);
void write(CameraPacket& cameraPacket); void write(CameraPacket& cameraPacket);
void read(CameraPacket& cameraPacket); void read(CameraPacket& cameraPacket);
char* startPtr() { return _startPtr; } char* startPtr() { return _startPtr; }
unsigned int numBytes() { return _numBytes; } unsigned int numBytes() { return _numBytes; }
protected: protected:
char* _startPtr; 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 terms of the GNU General Public License (GPL) version 2.0.
* The full license is in LICENSE.txt file included with this distribution,. * The full license is in LICENSE.txt file included with this distribution,.
* *
* This software is distributed in the hope that it will be useful, * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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 LICENSE.txt for more details.
*/ */
@@ -46,16 +46,16 @@ public:
void setSnapImageOnNextFrame(bool flag) { _snapImageOnNextFrame = flag; } void setSnapImageOnNextFrame(bool flag) { _snapImageOnNextFrame = flag; }
bool getSnapImageOnNextFrame() const { return _snapImageOnNextFrame; } bool getSnapImageOnNextFrame() const { return _snapImageOnNextFrame; }
virtual void operator () (const osg::Camera& camera) const virtual void operator () (const osg::Camera& camera) const
{ {
if (!_snapImageOnNextFrame) return; if (!_snapImageOnNextFrame) return;
int x = static_cast<int>(camera.getViewport()->x()); int x = static_cast<int>(camera.getViewport()->x());
int y = static_cast<int>(camera.getViewport()->y()); int y = static_cast<int>(camera.getViewport()->y());
unsigned int width = static_cast<unsigned int>(camera.getViewport()->width()); unsigned int width = static_cast<unsigned int>(camera.getViewport()->width());
unsigned int height = static_cast<unsigned int>(camera.getViewport()->height()); unsigned int height = static_cast<unsigned int>(camera.getViewport()->height());
osg::ref_ptr<osg::Image> image = new osg::Image; osg::ref_ptr<osg::Image> image = new osg::Image;
image->readPixels(x,y,width,height, image->readPixels(x,y,width,height,
GL_RGB,GL_UNSIGNED_BYTE); GL_RGB,GL_UNSIGNED_BYTE);
@@ -64,16 +64,16 @@ public:
{ {
osg::notify(osg::NOTICE) << "Saved screen image to `"<<_filename<<"`"<< std::endl; osg::notify(osg::NOTICE) << "Saved screen image to `"<<_filename<<"`"<< std::endl;
} }
_snapImageOnNextFrame = false; _snapImageOnNextFrame = false;
} }
protected: protected:
std::string _filename; std::string _filename;
mutable bool _snapImageOnNextFrame; mutable bool _snapImageOnNextFrame;
}; };
std::string ExportHTML::createFileName(const std::string& basename, unsigned int page, const std::string& ext) 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_basename = osgDB::getNameLessExtension(filename);
image_ext = ".jpg"; image_ext = ".jpg";
} }
std::cout<<"Writing slides to "<<image_basename<<"_[slidenumber]"<<image_ext<<std::endl; std::cout<<"Writing slides to "<<image_basename<<"_[slidenumber]"<<image_ext<<std::endl;
osg::ref_ptr<SnapImageDrawCallback> sidc = new SnapImageDrawCallback; osg::ref_ptr<SnapImageDrawCallback> sidc = new SnapImageDrawCallback;
@@ -169,7 +169,7 @@ bool ExportHTML::write(osgPresentation::SlideEventHandler* seh, osgViewer::Viewe
} }
fout<<"</tr>"<<std::endl; fout<<"</tr>"<<std::endl;
fout<<"</table>"<<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; fout<<"</html>"<<std::endl;
} }
else 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 terms of the GNU General Public License (GPL) version 2.0.
* The full license is in LICENSE.txt file included with this distribution,. * The full license is in LICENSE.txt file included with this distribution,.
* *
* This software is distributed in the hope that it will be useful, * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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 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 terms of the GNU General Public License (GPL) version 2.0.
* The full license is in LICENSE.txt file included with this distribution,. * The full license is in LICENSE.txt file included with this distribution,.
* *
* This software is distributed in the hope that it will be useful, * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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 LICENSE.txt for more details.
*/ */
@@ -54,6 +54,11 @@ bool PointsEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActio
return false; return false;
} }
void PointsEventHandler::accept(osgGA::GUIEventHandlerVisitor& v)
{
v.visit(*this);
}
void PointsEventHandler::getUsage(osg::ApplicationUsage& usage) const void PointsEventHandler::getUsage(osg::ApplicationUsage& usage) const
{ {
usage.addKeyboardMouseBinding("+","Increase point size"); 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 terms of the GNU General Public License (GPL) version 2.0.
* The full license is in LICENSE.txt file included with this distribution,. * The full license is in LICENSE.txt file included with this distribution,.
* *
* This software is distributed in the hope that it will be useful, * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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 LICENSE.txt for more details.
*/ */
@@ -22,23 +22,25 @@ class PointsEventHandler : public osgGA::GUIEventHandler
{ {
public: public:
PointsEventHandler(); PointsEventHandler();
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&); virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&);
virtual void accept(osgGA::GUIEventHandlerVisitor& v);
void getUsage(osg::ApplicationUsage& usage) const; void getUsage(osg::ApplicationUsage& usage) const;
void setStateSet(osg::StateSet* stateset) { _stateset=stateset; } void setStateSet(osg::StateSet* stateset) { _stateset=stateset; }
osg::StateSet* getStateSet() { return _stateset.get(); } osg::StateSet* getStateSet() { return _stateset.get(); }
const osg::StateSet* getStateSet() const { return _stateset.get(); } const osg::StateSet* getStateSet() const { return _stateset.get(); }
void setPointSize(float psize); void setPointSize(float psize);
float getPointSize() const; float getPointSize() const;
void changePointSize(float delta); void changePointSize(float delta);
void changePointAttenuation(float scale); void changePointAttenuation(float scale);
osg::ref_ptr<osg::StateSet> _stateset; 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 terms of the GNU General Public License (GPL) version 2.0.
* The full license is in LICENSE.txt file included with this distribution,. * The full license is in LICENSE.txt file included with this distribution,.
* *
* This software is distributed in the hope that it will be useful, * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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 LICENSE.txt for more details.
*/ */
@@ -35,7 +35,7 @@ class AddVolumeEditingCallbackVisitor : public osg::NodeVisitor
public: public:
AddVolumeEditingCallbackVisitor(): AddVolumeEditingCallbackVisitor():
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {} osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {}
void apply(osg::Group& group) void apply(osg::Group& group)
{ {
osgVolume::VolumeTile* volumeTile = dynamic_cast<osgVolume::VolumeTile*>(&group); osgVolume::VolumeTile* volumeTile = dynamic_cast<osgVolume::VolumeTile*>(&group);
@@ -51,7 +51,7 @@ public:
traverse(group); traverse(group);
} }
} }
}; };
bool p3d::getFileNames(osg::ArgumentParser& arguments, FileNameList& xmlFiles, FileNameList& normalFiles) 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)) if (!arguments.isOption(pos))
{ {
std::string ext = osgDB::getFileExtension(arguments[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]); xmlFiles.push_back(arguments[pos]);
} }
@@ -73,7 +73,7 @@ bool p3d::getFileNames(osg::ArgumentParser& arguments, FileNameList& xmlFiles, F
} }
} }
return (!xmlFiles.empty() || !normalFiles.empty()); return (!xmlFiles.empty() || !normalFiles.empty());
} }
bool p3d::readEnvVars(osg::ArgumentParser& arguments) bool p3d::readEnvVars(osg::ArgumentParser& arguments)
{ {
@@ -94,23 +94,23 @@ bool p3d::readEnvVars(osg::ArgumentParser& arguments)
{ {
osgDB::getDataFilePathList().push_front(path); osgDB::getDataFilePathList().push_front(path);
} }
if (p3d::readEnvVars(file)) readVars = true; if (p3d::readEnvVars(file)) readVars = true;
} }
} }
} }
} }
return readVars; return readVars;
} }
bool p3d::readEnvVars(const std::string& fileName) bool p3d::readEnvVars(const std::string& fileName)
{ {
std::string ext = osgDB::getFileExtension(fileName); std::string ext = osgDB::getFileExtension(fileName);
if (!osgDB::equalCaseInsensitive(ext,"xml") && if (!osgDB::equalCaseInsensitive(ext,"xml") &&
!osgDB::equalCaseInsensitive(ext,"p3d")) return false; !osgDB::equalCaseInsensitive(ext,"p3d")) return false;
osg::ref_ptr<osgDB::XmlNode> doc = new osgDB::XmlNode; osg::ref_ptr<osgDB::XmlNode> doc = new osgDB::XmlNode;
osgDB::XmlNode* root = 0; osgDB::XmlNode* root = 0;
@@ -146,7 +146,7 @@ bool p3d::readEnvVars(const std::string& fileName)
} }
bool readVars = false; bool readVars = false;
for(osgDB::XmlNode::Children::iterator itr = root->children.begin(); for(osgDB::XmlNode::Children::iterator itr = root->children.begin();
itr != root->children.end(); itr != root->children.end();
++itr) ++itr)
@@ -182,7 +182,7 @@ osgDB::Options* createOptions(const osgDB::ReaderWriter::Options* options)
osg::ref_ptr<osg::Node> p3d::readHoldingSlide(const std::string& filename) osg::ref_ptr<osg::Node> p3d::readHoldingSlide(const std::string& filename)
{ {
std::string ext = osgDB::getFileExtension(filename); std::string ext = osgDB::getFileExtension(filename);
if (!osgDB::equalCaseInsensitive(ext,"xml") && if (!osgDB::equalCaseInsensitive(ext,"xml") &&
!osgDB::equalCaseInsensitive(ext,"p3d")) return 0; !osgDB::equalCaseInsensitive(ext,"p3d")) return 0;
osg::ref_ptr<osgDB::ReaderWriter::Options> options = createOptions(0); osg::ref_ptr<osgDB::ReaderWriter::Options> options = createOptions(0);
@@ -251,21 +251,17 @@ osg::ref_ptr<osg::Node> p3d::readShowFiles(osg::ArgumentParser& arguments,const
if(node) if(node)
{ {
if (node->getName().empty()) node->setName( arguments[pos] ); if (node->getName().empty()) node->setName( arguments[pos] );
nodeList.push_back(node); nodeList.push_back(node);
// make sure that this presentation isn't cached
osgDB::Registry::instance()->removeFromObjectCache( arguments[pos] );
} }
} }
} }
if (nodeList.empty()) if (nodeList.empty())
{ {
return NULL; return NULL;
} }
osg::ref_ptr<osg::Node> root; osg::ref_ptr<osg::Node> root;
if (nodeList.size()==1) if (nodeList.size()==1)
@@ -274,7 +270,7 @@ osg::ref_ptr<osg::Node> p3d::readShowFiles(osg::ArgumentParser& arguments,const
} }
else // size >1 else // size >1
{ {
osg::Switch* sw = new osg::Switch; osg::Switch* sw = new osg::Switch;
for(NodeList::iterator itr=nodeList.begin(); for(NodeList::iterator itr=nodeList.begin();
itr!=nodeList.end(); itr!=nodeList.end();
@@ -283,7 +279,7 @@ osg::ref_ptr<osg::Node> p3d::readShowFiles(osg::ArgumentParser& arguments,const
sw->addChild((*itr).get()); sw->addChild((*itr).get());
} }
sw->setSingleChildOn(0); sw->setSingleChildOn(0);
sw->setEventCallback(new p3d::ShowEventHandler()); sw->setEventCallback(new p3d::ShowEventHandler());
root = sw; root = sw;
@@ -292,7 +288,7 @@ osg::ref_ptr<osg::Node> p3d::readShowFiles(osg::ArgumentParser& arguments,const
if (root.valid()) if (root.valid())
{ {
osg::notify(osg::INFO)<<"Got node now adding callback"<<std::endl; osg::notify(osg::INFO)<<"Got node now adding callback"<<std::endl;
AddVolumeEditingCallbackVisitor avecv; AddVolumeEditingCallbackVisitor avecv;
root->accept(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 terms of the GNU General Public License (GPL) version 2.0.
* The full license is in LICENSE.txt file included with this distribution,. * The full license is in LICENSE.txt file included with this distribution,.
* *
* This software is distributed in the hope that it will be useful, * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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 LICENSE.txt for more details.
*/ */
@@ -28,13 +28,13 @@ bool ShowEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
case(osgGA::GUIEventAdapter::KEYUP): case(osgGA::GUIEventAdapter::KEYUP):
{ {
osg::notify(osg::INFO)<<"ShowEventHandler KEYUP "<<(int)ea.getKey()<<std::endl; 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) ea.getKey()<=osgGA::GUIEventAdapter::KEY_F8)
{ {
unsigned int child = ea.getKey()-osgGA::GUIEventAdapter::KEY_F1; unsigned int child = ea.getKey()-osgGA::GUIEventAdapter::KEY_F1;
osg::notify(osg::INFO)<<" Select "<<child<<std::endl; osg::notify(osg::INFO)<<" Select "<<child<<std::endl;
osg::Switch* showSwitch = dynamic_cast<osg::Switch*>(object); osg::Switch* showSwitch = dynamic_cast<osg::Switch*>(object);
if (showSwitch) if (showSwitch)
{ {
if (child<showSwitch->getNumChildren()) if (child<showSwitch->getNumChildren())
{ {
@@ -52,6 +52,12 @@ bool ShowEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionA
return false; return false;
} }
void ShowEventHandler::accept(osgGA::GUIEventHandlerVisitor& v)
{
v.visit(*this);
}
void ShowEventHandler::getUsage(osg::ApplicationUsage& /*usage*/) const 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 terms of the GNU General Public License (GPL) version 2.0.
* The full license is in LICENSE.txt file included with this distribution,. * The full license is in LICENSE.txt file included with this distribution,.
* *
* This software is distributed in the hope that it will be useful, * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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 LICENSE.txt for more details.
*/ */
@@ -28,9 +28,11 @@ class ShowEventHandler : public osgGA::GUIEventHandler
ShowEventHandler(); ShowEventHandler();
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object* object, osg::NodeVisitor* nv); 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; virtual void getUsage(osg::ApplicationUsage& usage) const;
}; };
} }

View File

@@ -1,16 +1,17 @@
/* -*-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 terms of the GNU General Public License (GPL) version 2.0.
* The full license is in LICENSE.txt file included with this distribution,. * The full license is in LICENSE.txt file included with this distribution,.
* *
* This software is distributed in the hope that it will be useful, * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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 LICENSE.txt for more details.
*/ */
#include <osg/Geometry> #include <osg/Geometry>
#include <osg/CameraNode>
#include <osg/Texture2D> #include <osg/Texture2D>
#include <osg/AutoTransform> #include <osg/AutoTransform>
#include <osg/Notify> #include <osg/Notify>
@@ -27,7 +28,6 @@
#include <OpenThreads/Thread> #include <OpenThreads/Thread>
#include <osgGA/GUIEventHandler>
#include <osgGA/TrackballManipulator> #include <osgGA/TrackballManipulator>
#include <osgGA/FlightManipulator> #include <osgGA/FlightManipulator>
#include <osgGA/DriveManipulator> #include <osgGA/DriveManipulator>
@@ -36,10 +36,9 @@
#include <osgGA/TerrainManipulator> #include <osgGA/TerrainManipulator>
#include <osgGA/AnimationPathManipulator> #include <osgGA/AnimationPathManipulator>
#include <osgGA/StateSetManipulator> #include <osgGA/StateSetManipulator>
#include <osgGA/MultiTouchTrackballManipulator>
#include <osgPresentation/SlideEventHandler> #include <osgPresentation/SlideEventHandler>
#include <osgPresentation/Cursor> #include <osgPresentation/SlideShowConstructor>
#include "ReadShowFile.h" #include "ReadShowFile.h"
#include "PointsEventHandler.h" #include "PointsEventHandler.h"
@@ -51,7 +50,6 @@
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include <string.h> #include <string.h>
#ifdef USE_SDL #ifdef USE_SDL
@@ -129,104 +127,265 @@ void setViewer(osgViewer::Viewer& viewer, float width, float height, float dista
// double hfov = osg::RadiansToDegrees(atan2(width/2.0f,distance)*2.0); // double hfov = osg::RadiansToDegrees(atan2(width/2.0f,distance)*2.0);
viewer.getCamera()->setProjectionMatrixAsPerspective( vfov, width/height, 0.1, 1000.0); viewer.getCamera()->setProjectionMatrixAsPerspective( vfov, width/height, 0.1, 1000.0);
OSG_INFO<<"setProjectionMatrixAsPerspective( "<<vfov<<", "<<width/height<<", "<<0.1<<", "<<1000.0<<");"<<std::endl;
} }
class ForwardToDeviceEventHandler : public osgGA::GUIEventHandler { #if 1
public:
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 *) class RayFollowsMouseCallback : public osg::Drawable::EventCallback
{
RayFollowsMouseCallback() {}
/** do customized Event code. */
virtual void event(osg::NodeVisitor* nv, osg::Drawable* drawable)
{ {
switch (ea.getEventType()) osg::Geometry* geometry = drawable->asGeometry();
{ osgGA::EventVisitor* ev = dynamic_cast<osgGA::EventVisitor*>(nv);
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: if (!ev || !geometry) return;
_device->sendEvent(ea);
break; osgGA::GUIActionAdapter* aa = ev->getActionAdapter();
osgViewer::View* view = dynamic_cast<osgViewer::View*>(aa);
if (!view) return;
osg::Vec3Array* vertices = dynamic_cast<osg::Vec3Array*>(geometry->getVertexArray());
if (!vertices) return;
osg::Camera* camera = view->getCamera();
osg::Matrix VP = camera->getViewMatrix() * camera->getProjectionMatrix();
osg::Matrix inverse_VP;
inverse_VP.invert(VP);
osgGA::EventQueue::Events& events = ev->getEvents();
for(osgGA::EventQueue::Events::iterator itr = events.begin();
itr != events.end();
++itr)
{
handle(inverse_VP, *(*itr), vertices);
} }
return false;
} }
void handle(const osg::Matrix& inverse_VP, osgGA::GUIEventAdapter& ea, osg::Vec3Array* vertices)
bool handle(osgGA::Event* event, osg::Object* object, osg::NodeVisitor* nv)
{ {
if (event->asGUIEventAdapter()) osg::Vec3d start_eye(ea.getXnormalized(), ea.getYnormalized(), 0.0);
return osgGA::GUIEventHandler::handle(event, object, nv); osg::Vec3d end_eye(ea.getXnormalized(), ea.getYnormalized(), 1.0);
else
{ osg::Vec3d start_world = start_eye * inverse_VP;
_device->sendEvent(*event); osg::Vec3d end_world = start_eye * inverse_VP;
return false;
} osg::notify(osg::NOTICE)<<"start_world="<<start_world<<std::endl;
osg::notify(osg::NOTICE)<<"end_world="<<end_world<<std::endl;
(*vertices)[0] = start_world;
(*vertices)[1] = end_world;
} }
private:
osg::ref_ptr<osgGA::Device> _device;
bool _forwardMouseEvents;
}; };
class FollowMouseCallback: public osgGA::GUIEventHandler
{
public:
class DumpEventHandler : public osgGA::GUIEventHandler { virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object* object, osg::NodeVisitor* nv)
public:
DumpEventHandler() : osgGA::GUIEventHandler() {}
virtual bool handle (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa, osg::Object *, osg::NodeVisitor *)
{
switch (ea.getEventType())
{ {
case osgGA::GUIEventAdapter::FRAME: osg::AutoTransform* transform = dynamic_cast<osg::AutoTransform*>(object);
return false; if (!transform) 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: switch(ea.getEventType())
std::cout << ea.getEventType() << " "; {
break; case(osgGA::GUIEventAdapter::FRAME):
} //case(osgGA::GUIEventAdapter::MOVE):
std::cout << ea.getX() << "/" << ea.getY() << " " << ea.isMultiTouchEvent() << std::endl; //case(osgGA::GUIEventAdapter::DRAG):
return false; {
} osgViewer::View* view = dynamic_cast<osgViewer::View*>(&aa);
transform->setNodeMask(0x0);
bool handle(osgGA::Event* event, osg::Object* object, osg::NodeVisitor* nv) osg::notify(osg::NOTICE)<<std::endl<<"ea.getGraphicsContext()="<<ea.getGraphicsContext()<<std::endl;
{ osg::notify(osg::NOTICE)<<"ea.getWindowWidth()="<<ea.getWindowWidth()<<std::endl;
if (event->asGUIEventAdapter()) osg::notify(osg::NOTICE)<<"ea.getWindowHeight()="<<ea.getWindowHeight()<<std::endl;
return osgGA::GUIEventHandler::handle(event, object, nv); osg::notify(osg::NOTICE)<<"ea.getX()="<<ea.getX()<<std::endl;
else osg::notify(osg::NOTICE)<<"ea.getXin()="<<ea.getXmin()<<std::endl;
{ osg::notify(osg::NOTICE)<<"ea.getXmax()="<<ea.getXmax()<<std::endl;
osg::notify(osg::NOTICE)<<"ea.getY()="<<ea.getY()<<std::endl;
osg::notify(osg::NOTICE)<<"ea.getYin()="<<ea.getYmin()<<std::endl;
osg::notify(osg::NOTICE)<<"ea.getYmax()="<<ea.getYmax()<<std::endl;
osg::Camera* camera = view->getCamera();
osg::Matrix VP = camera->getViewMatrix() * camera->getProjectionMatrix();
osg::Matrix inverse_VP;
inverse_VP.invert(VP);
osg::Vec3d start_eye(ea.getXnormalized(), ea.getYnormalized(), 0.0);
osg::Vec3d end_eye(ea.getXnormalized(), ea.getYnormalized(), 1.0);
osg::Vec3d start_world = start_eye * inverse_VP;
osg::Vec3d end_world = start_eye * inverse_VP;
osg::notify(osg::NOTICE)<<"start_world="<<start_world<<std::endl;
osg::notify(osg::NOTICE)<<"end_world="<<end_world<<std::endl;
transform->setPosition(end_world);
transform->setNodeMask(0xffffffff);
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;
}
return false; return false;
} }
}
virtual void accept(osgGA::GUIEventHandlerVisitor& v)
{
v.visit(*this);
}
private:
}; };
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));
osg::Image* image = osgDB::readImageFile(osgDB::findDataFile(filename));
if (image)
{
osg::StateSet* stateset = geom->getOrCreateStateSet();
stateset->setTextureAttributeAndModes(0, new osg::Texture2D(image),osg::StateAttribute::ON);
stateset->setMode(GL_BLEND,osg::StateAttribute::ON);
// stateset->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);
transform->addChild(geode);
transform->setEventCallback(new FollowMouseCallback());
return transform;
}
#else
class FollowMouseCallback: public osgGA::GUIEventHandler
{
public:
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&, osg::Object* object, osg::NodeVisitor*)
{
switch(ea.getEventType())
{
case(osgGA::GUIEventAdapter::MOVE):
case(osgGA::GUIEventAdapter::DRAG):
{
osg::Camera* camera = dynamic_cast<osg::Camera*>(object);
if (camera)
{
double x = ea.getXnormalized();
double y = ea.getYnormalized();
camera->setViewMatrix(osg::Matrixd::translate(x,y,0.0));
}
break;
}
case(osgGA::GUIEventAdapter::KEYDOWN):
{
if (ea.getKey()=='c')
{
osg::Camera* camera = dynamic_cast<osg::Camera*>(object);
if (camera)
{
for(unsigned int i=0; i< camera->getNumChildren(); ++i)
{
osg::Node* node = camera->getChild(i);
node->setNodeMask(
node->getNodeMask()!=0 ?
0 :
0xffffff);
}
}
}
break;
}
default:
break;
}
return false;
}
virtual void accept(osgGA::GUIEventHandlerVisitor& v)
{
v.visit(*this);
}
};
osg::Node* createCursorSubgraph(const std::string& filename, float size)
{
osg::Geode* geode = new osg::Geode;
osg::Geometry* geom = osg::createTexturedQuadGeometry(osg::Vec3(-size*0.5f,-size*0.5f,0.0f),osg::Vec3(size,0.0f,0.0f),osg::Vec3(0.0f,size,0.0f));
osg::Image* image = osgDB::readImageFile(osgDB::findDataFile(filename));
if (image)
{
osg::StateSet* stateset = geom->getOrCreateStateSet();
stateset->setTextureAttributeAndModes(0, new osg::Texture2D(image),osg::StateAttribute::ON);
stateset->setMode(GL_BLEND,osg::StateAttribute::ON);
stateset->setRenderBinDetails(1000, "DepthSortedBin");
}
geode->addDrawable(geom);
osg::Camera* camera = new osg::Camera;
// set the projection matrix
camera->setProjectionMatrix(osg::Matrix::ortho2D(-1,1,-1,1));
// set the view matrix
camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
camera->setViewMatrix(osg::Matrix::identity());
// only clear the depth buffer
camera->setClearMask(GL_DEPTH_BUFFER_BIT);
// draw subgraph after main camera view.
camera->setRenderOrder(osg::CameraNode::NESTED_RENDER);
camera->addChild(geode);
camera->setEventCallback(new FollowMouseCallback());
return camera;
}
#endif
enum P3DApplicationType enum P3DApplicationType
@@ -237,56 +396,12 @@ enum P3DApplicationType
}; };
void processLoadedModel(osg::ref_ptr<osg::Node>& loadedModel, int optimizer_options, const std::string& cursorFileName)
{
if (!loadedModel) return;
#if !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
// add back in enabling of the GL_ALPHA_TEST to get around the core OSG no longer setting it by default for opaque bins.
// the alpha test is required for the volume rendering alpha clipping to work.
loadedModel->getOrCreateStateSet()->setMode(GL_ALPHA_TEST, osg::StateAttribute::ON);
#endif
// optimize the scene graph, remove redundant nodes and state etc.
osgUtil::Optimizer optimizer;
optimizer.optimize(loadedModel.get(), optimizer_options);
if (!cursorFileName.empty())
{
osg::ref_ptr<osg::Group> group = new osg::Group;
group->addChild(loadedModel.get());
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, bool forward_mouse_events)
{
osg::ref_ptr<osgGA::Device> dev = osgDB::readFile<osgGA::Device>(device_name);
if (dev.valid())
{
OSG_INFO << "Adding Device : " << device_name << std::endl;
viewer.addDevice(dev.get());
if ((dev->getCapabilities() & osgGA::Device::SEND_EVENTS))
viewer.getEventHandlers().push_front(new ForwardToDeviceEventHandler(dev.get(), forward_mouse_events));
}
else
{
OSG_WARN << "could not open device: " << device_name << std::endl;
}
}
int main( int argc, char **argv ) int main( int argc, char **argv )
{ {
// use an ArgumentParser object to manage the program arguments. // use an ArgumentParser object to manage the program arguments.
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName()); arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the application for presenting 3D interactive slide shows."); arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the application for presenting 3D interactive slide shows.");
@@ -307,8 +422,6 @@ int main( int argc, char **argv )
arguments.getApplicationUsage()->addCommandLineOption("--html <filename>","Print out slides to a series of html & image files."); 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("--loop","Switch on looping of presentation.");
arguments.getApplicationUsage()->addCommandLineOption("--devices","Print the Video input capability via QuickTime and exit."); 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. // add alias from xml to p3d to provide backwards compatibility for old p3d files.
osgDB::Registry::instance()->addFileExtensionAlias("xml","p3d"); osgDB::Registry::instance()->addFileExtensionAlias("xml","p3d");
@@ -321,39 +434,21 @@ int main( int argc, char **argv )
return 1; 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 // read any env vars from presentations before we create viewer to make sure the viewer
// utilises these env vars // utilises these env vars
if (!suppress_env_tags && p3d::readEnvVars(arguments)) if (p3d::readEnvVars(arguments))
{ {
osg::DisplaySettings::instance()->readEnvironmentalVariables(); osg::DisplaySettings::instance()->readEnvironmentalVariables();
} }
// set up any logins required for http access
std::string url, username, password;
while(arguments.read("--login",url, username, password))
{
if (!osgDB::Registry::instance()->getAuthenticationMap())
{
osgDB::Registry::instance()->setAuthenticationMap(new osgDB::AuthenticationMap);
osgDB::Registry::instance()->getAuthenticationMap()->addAuthenticationDetails(
url,
new osgDB::AuthenticationDetails(username, password)
);
}
}
#ifdef USE_SDL #ifdef USE_SDL
SDLIntegration sdlIntegration; SDLIntegration sdlIntegration;
osg::notify(osg::INFO)<<"USE_SDL"<<std::endl; osg::notify(osg::INFO)<<"USE_SDL"<<std::endl;
#endif #endif
bool doSetViewer = true; bool doSetViewer = true;
std::string configurationFile; std::string configurationFile;
@@ -366,7 +461,7 @@ int main( int argc, char **argv )
while (arguments.read("-c",configurationFile)) {} while (arguments.read("-c",configurationFile)) {}
osg::Vec4 clearColor(0.0f,0.0f,0.0f,0.0f); osg::Vec4 clearColor(0.0f,0.0f,0.0f,0.0f);
while (arguments.read("--clear-color",clearColor[0],clearColor[1],clearColor[2],clearColor[3])) {} while (arguments.read("--clear-color",clearColor[0],clearColor[1],clearColor[2],clearColor[3])) {}
std::string filename; std::string filename;
@@ -405,7 +500,7 @@ int main( int argc, char **argv )
// construct the viewer. // construct the viewer.
osgViewer::Viewer viewer(arguments); osgViewer::Viewer viewer(arguments);
// set clear colour to black by default. // set clear colour to black by default.
viewer.getCamera()->setClearColor(clearColor); viewer.getCamera()->setClearColor(clearColor);
@@ -414,70 +509,17 @@ int main( int argc, char **argv )
viewer.readConfiguration(configurationFile); viewer.readConfiguration(configurationFile);
doSetViewer = false; doSetViewer = false;
} }
bool forwardMouseEvents = false;
if (arguments.read("--forwardMouseEvents"))
forwardMouseEvents = true;
const char* p3dDevice = getenv("P3D_DEVICE");
if (p3dDevice)
{
osgDB::StringList devices;
osgDB::split(p3dDevice, devices);
for(osgDB::StringList::iterator i = devices.begin(); i != devices.end(); ++i)
{
addDeviceTo(viewer, *i, forwardMouseEvents);
}
}
std::string device;
while (arguments.read("--device", 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";
while (arguments.read("--http-server-address", server_address)) {}
while (arguments.read("--http-server-port", server_port)) {}
while (arguments.read("--http-document-root", document_root)) {}
osg::ref_ptr<osgDB::Options> device_options = new osgDB::Options("documentRegisteredHandlers");
osg::ref_ptr<osgGA::Device> rest_http_device = osgDB::readFile<osgGA::Device>(server_address+":"+server_port+"/"+document_root+".resthttp", device_options.get());
if (rest_http_device.valid())
{
viewer.addDevice(rest_http_device.get());
}
}
// set up stereo masks // set up stereo masks
viewer.getCamera()->setCullMask(0xffffffff);
viewer.getCamera()->setCullMaskLeft(0x00000001); 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. // set up the camera manipulators.
{ {
osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator; osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator;
keyswitchManipulator->addMatrixManipulator( '1', "Trackball", new osgGA::MultiTouchTrackballManipulator() ); keyswitchManipulator->addMatrixManipulator( '1', "Trackball", new osgGA::TrackballManipulator() );
keyswitchManipulator->addMatrixManipulator( '2', "Flight", new osgGA::FlightManipulator() ); keyswitchManipulator->addMatrixManipulator( '2', "Flight", new osgGA::FlightManipulator() );
keyswitchManipulator->addMatrixManipulator( '3', "Drive", new osgGA::DriveManipulator() ); keyswitchManipulator->addMatrixManipulator( '3', "Drive", new osgGA::DriveManipulator() );
keyswitchManipulator->addMatrixManipulator( '4', "Terrain", new osgGA::TerrainManipulator() ); keyswitchManipulator->addMatrixManipulator( '4', "Terrain", new osgGA::TerrainManipulator() );
@@ -487,7 +529,7 @@ int main( int argc, char **argv )
while (arguments.read("-p",pathfile)) while (arguments.read("-p",pathfile))
{ {
osgGA::AnimationPathManipulator* apm = new osgGA::AnimationPathManipulator(pathfile); osgGA::AnimationPathManipulator* apm = new osgGA::AnimationPathManipulator(pathfile);
if (apm || !apm->valid()) if (apm || !apm->valid())
{ {
unsigned int num = keyswitchManipulator->getNumMatrixManipulators(); unsigned int num = keyswitchManipulator->getNumMatrixManipulators();
keyswitchManipulator->addMatrixManipulator( keyForAnimationPath, "Path", apm ); keyswitchManipulator->addMatrixManipulator( keyForAnimationPath, "Path", apm );
@@ -499,12 +541,8 @@ int main( int argc, char **argv )
viewer.setCameraManipulator( keyswitchManipulator.get() ); viewer.setCameraManipulator( keyswitchManipulator.get() );
} }
//viewer.getEventHandlers().push_front(new DumpEventHandler());
// add the state manipulator // add the state manipulator
osg::ref_ptr<osgGA::StateSetManipulator> ssManipulator = new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()); viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
ssManipulator->setKeyEventToggleTexturing('e');
viewer.addEventHandler( ssManipulator.get() );
// add the state manipulator // add the state manipulator
viewer.addEventHandler( new osgViewer::StatsHandler() ); viewer.addEventHandler( new osgViewer::StatsHandler() );
@@ -519,20 +557,11 @@ int main( int argc, char **argv )
std::string cursorFileName( p3dCursor ? p3dCursor : ""); std::string cursorFileName( p3dCursor ? p3dCursor : "");
while (arguments.read("--cursor",cursorFileName)) {} while (arguments.read("--cursor",cursorFileName)) {}
const char* p3dShowCursor = getenv("P3D_SHOW_CURSOR");
std::string showCursor( p3dShowCursor ? p3dShowCursor : "YES");
while (arguments.read("--show-cursor")) { showCursor="YES"; }
while (arguments.read("--hide-cursor")) { showCursor="NO"; }
bool hideCursor = (showCursor=="No" || showCursor=="NO" || showCursor=="no");
while (arguments.read("--set-viewer")) { doSetViewer = true; } while (arguments.read("--set-viewer")) { doSetViewer = true; }
while (arguments.read("--no-set-viewer")) { doSetViewer = false; } 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. // cluster related entries.
int socketNumber=8100; int socketNumber=8100;
@@ -560,29 +589,10 @@ int main( int argc, char **argv )
bool loopPresentation = false; bool loopPresentation = false;
while (arguments.read("--loop")) loopPresentation = true; while (arguments.read("--loop")) loopPresentation = true;
{
// set update hte default traversal mode settings for update visitor
// default to osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN.
osg::NodeVisitor::TraversalMode updateTraversalMode = osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN; // viewer.getUpdateVisitor()->getTraversalMode();
const char* p3dUpdateStr = getenv("P3D_UPDATE");
if (p3dUpdateStr)
{
std::string updateStr(p3dUpdateStr);
if (updateStr=="active" || updateStr=="Active" || updateStr=="ACTIVE") updateTraversalMode = osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN;
else if (updateStr=="all" || updateStr=="All" || updateStr=="ALL") updateTraversalMode = osg::NodeVisitor::TRAVERSE_ALL_CHILDREN;
}
while(arguments.read("--update-active")) updateTraversalMode = osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN;
while(arguments.read("--update-all")) updateTraversalMode = osg::NodeVisitor::TRAVERSE_ALL_CHILDREN;
viewer.getUpdateVisitor()->setTraversalMode(updateTraversalMode);
}
// register the slide event handler - which moves the presentation from slide to slide, layer to layer. // 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); osgPresentation::SlideEventHandler* seh = new osgPresentation::SlideEventHandler(&viewer);
viewer.addEventHandler(seh.get()); viewer.addEventHandler(seh);
seh->setAutoSteppingActive(autoSteppingActive); seh->setAutoSteppingActive(autoSteppingActive);
seh->setTimeDelayBetweenSlides(timeDelayBetweenSlides); seh->setTimeDelayBetweenSlides(timeDelayBetweenSlides);
@@ -599,45 +609,34 @@ int main( int argc, char **argv )
// set up optimizer options // set up optimizer options
unsigned int optimizer_options = osgUtil::Optimizer::DEFAULT_OPTIMIZATIONS; unsigned int optimizer_options = osgUtil::Optimizer::DEFAULT_OPTIMIZATIONS;
bool release_and_compile = false; bool relase_and_compile = false;
while (arguments.read("--release-and-compile")) while (arguments.read("--release-and-compile"))
{ {
release_and_compile = true; relase_and_compile = true;
} }
seh->setReleaseAndCompileOnEachNewSlide(release_and_compile); seh->setReleaseAndCompileOnEachNewSlide(relase_and_compile);
if (release_and_compile) if (relase_and_compile)
{ {
// make sure that imagery stays around after being applied to textures. // make sure that imagery stays around after being applied to textures.
viewer.getDatabasePager()->setUnrefImageDataAfterApplyPolicy(true,false); viewer.getDatabasePager()->setUnrefImageDataAfterApplyPolicy(true,false);
optimizer_options &= ~osgUtil::Optimizer::OPTIMIZE_TEXTURE_SETTINGS; optimizer_options &= ~osgUtil::Optimizer::OPTIMIZE_TEXTURE_SETTINGS;
} }
// //
// osgDB::Registry::instance()->getOrCreateDatabasePager()->setUnrefImageDataAfterApplyPolicy(true,false); // osgDB::Registry::instance()->getOrCreateDatabasePager()->setUnrefImageDataAfterApplyPolicy(true,false);
// optimizer_options &= ~osgUtil::Optimizer::OPTIMIZE_TEXTURE_SETTINGS; // optimizer_options &= ~osgUtil::Optimizer::OPTIMIZE_TEXTURE_SETTINGS;
// osg::Texture::getTextureObjectManager()->setExpiryDelay(0.0f); // osg::Texture::getTextureObjectManager()->setExpiryDelay(0.0f);
// osgDB::Registry::instance()->getOrCreateDatabasePager()->setExpiryDelay(1.0f); // osgDB::Registry::instance()->getOrCreateDatabasePager()->setExpiryDelay(1.0f);
// register the handler for modifying the point size // register the handler for modifying the point size
osg::ref_ptr<PointsEventHandler> peh = new PointsEventHandler; PointsEventHandler* peh = new PointsEventHandler;
viewer.addEventHandler(peh.get()); viewer.addEventHandler(peh);
// add the screen capture handler
std::string screenCaptureFilename = "screen_shot.jpg";
while(arguments.read("--screenshot", screenCaptureFilename)) {}
osg::ref_ptr<osgViewer::ScreenCaptureHandler::WriteToFile> writeFile = new osgViewer::ScreenCaptureHandler::WriteToFile(
osgDB::getNameLessExtension(screenCaptureFilename),
osgDB::getFileExtension(screenCaptureFilename) );
osg::ref_ptr<osgViewer::ScreenCaptureHandler> screenCaptureHandler = new osgViewer::ScreenCaptureHandler(writeFile.get());
screenCaptureHandler->setKeyEventTakeScreenShot('m');//osgGA::GUIEventAdapter::KEY_Print);
screenCaptureHandler->setKeyEventToggleContinuousCapture('M');
viewer.addEventHandler(screenCaptureHandler.get());
// osg::DisplaySettings::instance()->setSplitStereoAutoAjustAspectRatio(false); // osg::DisplaySettings::instance()->setSplitStereoAutoAjustAspectRatio(false);
float width = osg::DisplaySettings::instance()->getScreenWidth(); float width = osg::DisplaySettings::instance()->getScreenWidth();
float height = osg::DisplaySettings::instance()->getScreenHeight(); float height = osg::DisplaySettings::instance()->getScreenHeight();
float distance = osg::DisplaySettings::instance()->getScreenDistance(); 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()->setScreenDistance(distance);
osg::DisplaySettings::instance()->setScreenHeight(height); osg::DisplaySettings::instance()->setScreenHeight(height);
@@ -652,10 +651,9 @@ int main( int argc, char **argv )
viewer.getUsage(*arguments.getApplicationUsage()); viewer.getUsage(*arguments.getApplicationUsage());
// if user request help write it out to cout. // if user request help write it out to cout.
unsigned int helpType = 0; if (arguments.read("-h") || arguments.read("--help"))
if ((helpType = arguments.readHelpType()))
{ {
arguments.getApplicationUsage()->write(std::cout, helpType); arguments.getApplicationUsage()->write(osg::notify(osg::NOTICE));
return 1; return 1;
} }
@@ -668,11 +666,11 @@ int main( int argc, char **argv )
else if (strcmp(str,"master")==0) P3DApplicationType = MASTER; else if (strcmp(str,"master")==0) P3DApplicationType = MASTER;
else if (strcmp(str,"slave")==0) P3DApplicationType = SLAVE; else if (strcmp(str,"slave")==0) P3DApplicationType = SLAVE;
} }
while (arguments.read("--viewer")) { P3DApplicationType = VIEWER; } while (arguments.read("--viewer")) { P3DApplicationType = VIEWER; }
while (arguments.read("--master")) { P3DApplicationType = MASTER; } while (arguments.read("--master")) { P3DApplicationType = MASTER; }
while (arguments.read("--slave")) { P3DApplicationType = SLAVE; } while (arguments.read("--slave")) { P3DApplicationType = SLAVE; }
while (arguments.read("--version")) while (arguments.read("--version"))
{ {
std::string appTypeName = "invalid"; std::string appTypeName = "invalid";
@@ -750,9 +748,6 @@ int main( int argc, char **argv )
osg::ref_ptr<osgDB::ReaderWriter::Options> cacheAllOption = new osgDB::ReaderWriter::Options; 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); cacheAllOption->setObjectCacheHint(osgDB::ReaderWriter::Options::CACHE_ALL);
osgDB::Registry::instance()->setOptions(cacheAllOption.get()); osgDB::Registry::instance()->setOptions(cacheAllOption.get());
@@ -764,7 +759,7 @@ int main( int argc, char **argv )
// if no model has been successfully loaded report failure. // if no model has been successfully loaded report failure.
if (!loadedModel) if (!loadedModel)
{ {
osg::notify(osg::INFO) << arguments.getApplicationName() <<": No data loaded" << std::endl; osg::notify(osg::INFO) << arguments.getApplicationName() <<": No data loaded" << std::endl;
return 1; return 1;
@@ -780,12 +775,12 @@ int main( int argc, char **argv )
for(unsigned int i=0; i<loadedModel->getNumDescriptions(); ++i) for(unsigned int i=0; i<loadedModel->getNumDescriptions(); ++i)
{ {
const std::string& desc = loadedModel->getDescription(i); const std::string& desc = loadedModel->getDescription(i);
if (desc=="loop") if (desc=="loop")
{ {
osg::notify(osg::NOTICE)<<"Enabling looping"<<std::endl; osg::notify(osg::NOTICE)<<"Enabling looping"<<std::endl;
seh->setLoopPresentation(true); seh->setLoopPresentation(true);
} }
else if (desc=="auto") else if (desc=="auto")
{ {
osg::notify(osg::NOTICE)<<"Enabling auto run"<<std::endl; osg::notify(osg::NOTICE)<<"Enabling auto run"<<std::endl;
seh->setAutoSteppingActive(true); seh->setAutoSteppingActive(true);
@@ -794,7 +789,26 @@ int main( int argc, char **argv )
} }
processLoadedModel(loadedModel, optimizer_options, cursorFileName); #if !defined(OSG_GLES2_AVAILABLE) && !defined(OSG_GL3_AVAILABLE)
// add back in enabling of the GL_ALPHA_TEST to get around the core OSG no longer setting it by default for opaque bins.
// the alpha test is required for the volume rendering alpha clipping to work.
loadedModel->getOrCreateStateSet()->setMode(GL_ALPHA_TEST, osg::StateAttribute::ON);
#endif
// optimize the scene graph, remove rendundent nodes and state etc.
osgUtil::Optimizer optimizer;
optimizer.optimize(loadedModel.get(), optimizer_options);
if (!cursorFileName.empty())
{
osg::ref_ptr<osg::Group> group = new osg::Group;
group->addChild(loadedModel.get());
group->addChild(createCursorSubgraph(cursorFileName, 0.05f));
loadedModel = group.get();
}
// set the scene to render // set the scene to render
viewer.setSceneData(loadedModel.get()); viewer.setSceneData(loadedModel.get());
@@ -813,23 +827,7 @@ int main( int argc, char **argv )
viewerInitialized = true; viewerInitialized = true;
} }
if (!cursorFileName.empty())
// pass the model to the slide event handler so it knows which to manipulate.
seh->set(loadedModel.get());
seh->selectSlide(0);
seh->home();
if (!outputFileName.empty())
{
osgDB::writeNodeFile(*loadedModel,outputFileName);
return 0;
}
if (!cursorFileName.empty() || hideCursor)
{ {
// have to add a frame in here to avoid problems with X11 threading issue on switching off the cursor // have to add a frame in here to avoid problems with X11 threading issue on switching off the cursor
// not yet sure why it makes a difference, but it at least fixes the crash that would otherwise occur // not yet sure why it makes a difference, but it at least fixes the crash that would otherwise occur
@@ -847,9 +845,21 @@ int main( int argc, char **argv )
} }
} }
// pass the model to the slide event handler so it knows which to manipulate.
seh->set(loadedModel.get());
seh->selectSlide(0);
seh->home();
if (!outputFileName.empty())
{
osgDB::writeNodeFile(*loadedModel,outputFileName);
return 0;
}
osg::Timer_t startOfFrameTick = osg::Timer::instance()->tick(); osg::Timer_t startOfFrameTick = osg::Timer::instance()->tick();
double targetFrameTime = 1.0/targetFrameRate; double targetFrameTime = 1.0/targetFrameRate;
if (exportName.empty()) if (exportName.empty())
{ {
// objects for managing the broadcasting and recieving of camera packets. // objects for managing the broadcasting and recieving of camera packets.
@@ -878,7 +888,7 @@ int main( int argc, char **argv )
startOfFrameTick = osg::Timer::instance()->tick(); startOfFrameTick = osg::Timer::instance()->tick();
#if 0 #if 0
if (kmcb) if (kmcb)
{ {
double time = kmcb->getTime(); double time = kmcb->getTime();
@@ -894,9 +904,9 @@ int main( int argc, char **argv )
{ {
// take camera zero as the guide. // take camera zero as the guide.
osg::Matrix modelview(viewer.getCamera()->getViewMatrix()); osg::Matrix modelview(viewer.getCamera()->getViewMatrix());
cp.setPacket(modelview,viewer.getFrameStamp()); cp.setPacket(modelview,viewer.getFrameStamp());
// cp.readEventQueue(viewer); // cp.readEventQueue(viewer);
scratchPad.reset(); scratchPad.reset();
@@ -906,7 +916,7 @@ int main( int argc, char **argv )
scratchPad.read(cp); scratchPad.read(cp);
bc.setBuffer(scratchPad.startPtr(), scratchPad.numBytes()); bc.setBuffer(scratchPad.startPtr(), scratchPad.numBytes());
std::cout << "bc.sync()"<<scratchPad.numBytes()<<std::endl; std::cout << "bc.sync()"<<scratchPad.numBytes()<<std::endl;
bc.sync(); bc.sync();
@@ -916,13 +926,13 @@ int main( int argc, char **argv )
rc.setBuffer(scratchPad.startPtr(), scratchPad.numBytes()); rc.setBuffer(scratchPad.startPtr(), scratchPad.numBytes());
rc.sync(); rc.sync();
scratchPad.reset(); scratchPad.reset();
scratchPad.read(cp); scratchPad.read(cp);
// cp.writeEventQueue(viewer); // cp.writeEventQueue(viewer);
if (cp.getMasterKilled()) if (cp.getMasterKilled())
{ {
std::cout << "Received master killed."<<std::endl; std::cout << "Received master killed."<<std::endl;
// break out of while (!done) loop since we've now want to shut down. // break out of while (!done) loop since we've now want to shut down.
@@ -930,36 +940,11 @@ int main( int argc, char **argv )
} }
} }
// update the scene by traversing it with the update visitor which will // update the scene by traversing it with the the update visitor which will
// call all node update callbacks and animations. // call all node update callbacks and animations.
viewer.eventTraversal(); viewer.eventTraversal();
if (seh->getRequestReload()) // update the scene by traversing it with the the update visitor which will
{
OSG_INFO<<"Reload requested"<<std::endl;
seh->setRequestReload(false);
int previous_ActiveSlide = seh->getActiveSlide();
int previous_ActiveLayer = seh->getActiveLayer();
// reset time so any event key generate
loadedModel = p3d::readShowFiles(arguments,cacheAllOption.get());
processLoadedModel(loadedModel, optimizer_options, cursorFileName);
if (!loadedModel)
{
return 0;
}
viewer.setSceneData(loadedModel.get());
seh->set(loadedModel.get());
seh->selectSlide(previous_ActiveSlide, previous_ActiveLayer);
continue;
}
// update the scene by traversing it with the update visitor which will
// call all node update callbacks and animations. // call all node update callbacks and animations.
viewer.updateTraversal(); viewer.updateTraversal();
@@ -978,9 +963,9 @@ int main( int argc, char **argv )
} }
else else
{ {
ExportHTML::write(seh.get(), viewer, exportName); ExportHTML::write(seh, viewer, exportName);
} }
return 0; return 0;
} }

1
configure vendored Executable file
View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -4,14 +4,14 @@
SET(TARGET_DEFAULT_PREFIX "example_") SET(TARGET_DEFAULT_PREFIX "example_")
SET(TARGET_DEFAULT_LABEL_PREFIX "Examples") SET(TARGET_DEFAULT_LABEL_PREFIX "Examples")
SET(TARGET_COMMON_LIBRARIES SET(TARGET_COMMON_LIBRARIES
OpenThreads OpenThreads
osg osg
osgDB osgDB
osgUtil osgUtil
osgGA osgGA
osgViewer osgViewer
osgText osgText
) )
IF(ANDROID) IF(ANDROID)
@@ -23,11 +23,9 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osg2cpp) ADD_SUBDIRECTORY(osg2cpp)
ADD_SUBDIRECTORY(osganalysis) ADD_SUBDIRECTORY(osganalysis)
ADD_SUBDIRECTORY(osganimate) ADD_SUBDIRECTORY(osganimate)
ADD_SUBDIRECTORY(osgatomiccounter)
ADD_SUBDIRECTORY(osgautocapture) ADD_SUBDIRECTORY(osgautocapture)
ADD_SUBDIRECTORY(osgautotransform) ADD_SUBDIRECTORY(osgautotransform)
ADD_SUBDIRECTORY(osgbillboard) ADD_SUBDIRECTORY(osgbillboard)
ADD_SUBDIRECTORY(osgblenddrawbuffers)
ADD_SUBDIRECTORY(osgblendequation) ADD_SUBDIRECTORY(osgblendequation)
ADD_SUBDIRECTORY(osgcallback) ADD_SUBDIRECTORY(osgcallback)
ADD_SUBDIRECTORY(osgcamera) ADD_SUBDIRECTORY(osgcamera)
@@ -49,6 +47,7 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgfxbrowser) ADD_SUBDIRECTORY(osgfxbrowser)
ADD_SUBDIRECTORY(osgoutline) ADD_SUBDIRECTORY(osgoutline)
ADD_SUBDIRECTORY(osggameoflife) ADD_SUBDIRECTORY(osggameoflife)
ADD_SUBDIRECTORY(osggeodemo)
ADD_SUBDIRECTORY(osggeometry) ADD_SUBDIRECTORY(osggeometry)
ADD_SUBDIRECTORY(osggeometryshaders) ADD_SUBDIRECTORY(osggeometryshaders)
ADD_SUBDIRECTORY(osghangglide) ADD_SUBDIRECTORY(osghangglide)
@@ -59,27 +58,22 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgkdtree) ADD_SUBDIRECTORY(osgkdtree)
ADD_SUBDIRECTORY(osgkeyboard) ADD_SUBDIRECTORY(osgkeyboard)
ADD_SUBDIRECTORY(osgkeyboardmouse) ADD_SUBDIRECTORY(osgkeyboardmouse)
ADD_SUBDIRECTORY(osgkeystone)
ADD_SUBDIRECTORY(osglauncher) ADD_SUBDIRECTORY(osglauncher)
ADD_SUBDIRECTORY(osglight) ADD_SUBDIRECTORY(osglight)
ADD_SUBDIRECTORY(osglightpoint) ADD_SUBDIRECTORY(osglightpoint)
ADD_SUBDIRECTORY(osglogicop) ADD_SUBDIRECTORY(osglogicop)
ADD_SUBDIRECTORY(osglogo) ADD_SUBDIRECTORY(osglogo)
ADD_SUBDIRECTORY(osggpucull)
ADD_SUBDIRECTORY(osggpx) ADD_SUBDIRECTORY(osggpx)
ADD_SUBDIRECTORY(osggraphicscost) ADD_SUBDIRECTORY(osggraphicscost)
ADD_SUBDIRECTORY(osgmanipulator) ADD_SUBDIRECTORY(osgmanipulator)
ADD_SUBDIRECTORY(osgmovie) ADD_SUBDIRECTORY(osgmovie)
ADD_SUBDIRECTORY(osgmultiplemovies)
ADD_SUBDIRECTORY(osgmultiplerendertargets) ADD_SUBDIRECTORY(osgmultiplerendertargets)
ADD_SUBDIRECTORY(osgmultitexture) ADD_SUBDIRECTORY(osgmultitexture)
ADD_SUBDIRECTORY(osgmultitexturecontrol) ADD_SUBDIRECTORY(osgmultitexturecontrol)
ADD_SUBDIRECTORY(osgmultitouch)
ADD_SUBDIRECTORY(osgmultiviewpaging) ADD_SUBDIRECTORY(osgmultiviewpaging)
ADD_SUBDIRECTORY(osgoccluder) ADD_SUBDIRECTORY(osgoccluder)
ADD_SUBDIRECTORY(osgocclusionquery) ADD_SUBDIRECTORY(osgocclusionquery)
ADD_SUBDIRECTORY(osgoit) ADD_SUBDIRECTORY(osgoit)
ADD_SUBDIRECTORY(osgoscdevice)
ADD_SUBDIRECTORY(osgpackeddepthstencil) ADD_SUBDIRECTORY(osgpackeddepthstencil)
ADD_SUBDIRECTORY(osgpagedlod) ADD_SUBDIRECTORY(osgpagedlod)
ADD_SUBDIRECTORY(osgparametric) ADD_SUBDIRECTORY(osgparametric)
@@ -96,7 +90,6 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgprerendercubemap) ADD_SUBDIRECTORY(osgprerendercubemap)
ADD_SUBDIRECTORY(osgreflect) ADD_SUBDIRECTORY(osgreflect)
ADD_SUBDIRECTORY(osgrobot) ADD_SUBDIRECTORY(osgrobot)
ADD_SUBDIRECTORY(osgSSBO)
ADD_SUBDIRECTORY(osgscalarbar) ADD_SUBDIRECTORY(osgscalarbar)
ADD_SUBDIRECTORY(osgscribe) ADD_SUBDIRECTORY(osgscribe)
ADD_SUBDIRECTORY(osgsequence) ADD_SUBDIRECTORY(osgsequence)
@@ -108,7 +101,6 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgshadow) ADD_SUBDIRECTORY(osgshadow)
ADD_SUBDIRECTORY(osgshape) ADD_SUBDIRECTORY(osgshape)
ADD_SUBDIRECTORY(osgsharedarray) ADD_SUBDIRECTORY(osgsharedarray)
ADD_SUBDIRECTORY(osgsimpleshaders)
ADD_SUBDIRECTORY(osgsimplifier) ADD_SUBDIRECTORY(osgsimplifier)
ADD_SUBDIRECTORY(osgsimulation) ADD_SUBDIRECTORY(osgsimulation)
ADD_SUBDIRECTORY(osgsidebyside) ADD_SUBDIRECTORY(osgsidebyside)
@@ -120,17 +112,14 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgstereomatch) ADD_SUBDIRECTORY(osgstereomatch)
ADD_SUBDIRECTORY(osgterrain) ADD_SUBDIRECTORY(osgterrain)
ADD_SUBDIRECTORY(osgthreadedterrain) ADD_SUBDIRECTORY(osgthreadedterrain)
ADD_SUBDIRECTORY(osgtransferfunction)
ADD_SUBDIRECTORY(osgtext) ADD_SUBDIRECTORY(osgtext)
ADD_SUBDIRECTORY(osgtext3D) ADD_SUBDIRECTORY(osgtext3D)
ADD_SUBDIRECTORY(osgtexture1D) ADD_SUBDIRECTORY(osgtexture1D)
ADD_SUBDIRECTORY(osgtexture2D) ADD_SUBDIRECTORY(osgtexture2D)
ADD_SUBDIRECTORY(osgtexture2DArray)
ADD_SUBDIRECTORY(osgtexture3D) ADD_SUBDIRECTORY(osgtexture3D)
ADD_SUBDIRECTORY(osgtexturerectangle) ADD_SUBDIRECTORY(osgtexturerectangle)
ADD_SUBDIRECTORY(osgtexturecompression) ADD_SUBDIRECTORY(osgtexturecompression)
ADD_SUBDIRECTORY(osgthirdpersonview) ADD_SUBDIRECTORY(osgthirdpersonview)
ADD_SUBDIRECTORY(osgtransformfeedback)
ADD_SUBDIRECTORY(osguniformbuffer) ADD_SUBDIRECTORY(osguniformbuffer)
ADD_SUBDIRECTORY(osguserstats) ADD_SUBDIRECTORY(osguserstats)
ADD_SUBDIRECTORY(osgvertexprogram) ADD_SUBDIRECTORY(osgvertexprogram)
@@ -164,9 +153,6 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgwidgetwindow) ADD_SUBDIRECTORY(osgwidgetwindow)
ADD_SUBDIRECTORY(osguserdata) ADD_SUBDIRECTORY(osguserdata)
# GL3/GL4 example
ADD_SUBDIRECTORY(osgsimplegl3)
IF(OSG_CPP_EXCEPTIONS_AVAILABLE) IF(OSG_CPP_EXCEPTIONS_AVAILABLE)
ADD_SUBDIRECTORY(osgunittests) ADD_SUBDIRECTORY(osgunittests)
ADD_SUBDIRECTORY(osgmemorytest) ADD_SUBDIRECTORY(osgmemorytest)
@@ -184,8 +170,6 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgphotoalbum) ADD_SUBDIRECTORY(osgphotoalbum)
ADD_SUBDIRECTORY(osgtessellate) ADD_SUBDIRECTORY(osgtessellate)
ADD_SUBDIRECTORY(osgtessellationshaders)
ADD_SUBDIRECTORY(osgcomputeshaders)
ADD_SUBDIRECTORY(osgpdf) ADD_SUBDIRECTORY(osgpdf)
@@ -205,35 +189,34 @@ IF(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgviewerFOX) ADD_SUBDIRECTORY(osgviewerFOX)
ENDIF(FOX_FOUND) ENDIF(FOX_FOUND)
IF (wxWidgets_FOUND AND CMAKE_BUILD_TYPE) IF (wxWidgets_FOUND)
IF (${CMAKE_BUILD_TYPE} STREQUAL "Release") ADD_SUBDIRECTORY(osgviewerWX)
ADD_SUBDIRECTORY(osgviewerWX) ENDIF(wxWidgets_FOUND)
ENDIF()
ENDIF()
IF ( (QT4_FOUND OR Qt5Widgets_FOUND) AND NOT OSG_GLES1_AVAILABLE AND NOT OSG_GLES2_AVAILABLE AND NOT OSG_GL3_AVAILABLE) IF (QT_FOUND AND NOT OSG_GLES1_AVAILABLE AND NOT OSG_GLES2_AVAILABLE AND NOT OSG_GL3_AVAILABLE)
OPTION(BUILD_QT_EXAMPLES "Enable the build of the examples that depend on Qt" ON)
IF ( QT4_FOUND OR Qt5Widgets_FOUND) IF (BUILD_QT_EXAMPLES AND QT_QTOPENGL_LIBRARY)
ADD_SUBDIRECTORY(osgviewerQt) ADD_SUBDIRECTORY(osgviewerQt)
ADD_SUBDIRECTORY(osgqfont) ADD_SUBDIRECTORY(osgqfont)
ENDIF() ENDIF()
IF ( (QT4_FOUND AND QT_QTWEBKIT_FOUND) OR Qt5WebKitWidgets_FOUND ) IF (BUILD_QT_EXAMPLES AND QT4_FOUND AND QT_QTWEBKIT_FOUND)
ADD_SUBDIRECTORY(osgQtWidgets) ADD_SUBDIRECTORY(osgQtWidgets)
ADD_SUBDIRECTORY(osgQtBrowser) ADD_SUBDIRECTORY(osgQtBrowser)
ENDIF() ENDIF()
ENDIF() ENDIF()
IF (FLTK_FOUND AND FLTK_GL_LIBRARY) IF (FLTK_FOUND)
ADD_SUBDIRECTORY(osgviewerFLTK) ADD_SUBDIRECTORY(osgviewerFLTK)
ENDIF() ENDIF(FLTK_FOUND)
IF (WIN32) IF (WIN32)
OPTION(BUILD_MFC_EXAMPLE "Enable the build of the MFC Example" OFF) OPTION(BUILD_MFC_EXAMPLE "Enable the build of the MFC Example" OFF)
IF (BUILD_MFC_EXAMPLE) IF (BUILD_MFC_EXAMPLE)
ADD_SUBDIRECTORY(osgviewerMFC) ADD_SUBDIRECTORY(osgviewerMFC)
ENDIF(BUILD_MFC_EXAMPLE) ENDIF(BUILD_MFC_EXAMPLE)
@@ -264,7 +247,7 @@ ELSE(DYNAMIC_OPENSCENEGRAPH)
ADD_SUBDIRECTORY(osgviewerIPhone) ADD_SUBDIRECTORY(osgviewerIPhone)
ENDIF() ENDIF()
# IPHONE_PORT@tom # IPHONE_PORT@tom
ENDIF(DYNAMIC_OPENSCENEGRAPH) ENDIF(DYNAMIC_OPENSCENEGRAPH)
ENDIF(ANDROID) ENDIF(ANDROID)

View File

@@ -7,7 +7,7 @@
#include <iostream> #include <iostream>
// Search in str for all occurrences of spat and replace them with rpat. // Search in str for all occurences of spat and replace them with rpat.
void searchAndReplace(std::string& str, const std::string& spat, const std::string& rpat) void searchAndReplace(std::string& str, const std::string& spat, const std::string& rpat)
{ {
std::string::size_type pos = 0; 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", "\n");
searchAndReplace(shaderSource, "\r", "\n"); searchAndReplace(shaderSource, "\r", "\n");
searchAndReplace(shaderSource, "\"", "\\\""); searchAndReplace(shaderSource, "\"", "\\\"");
std::string variableString = std::string("char ")+variableName+std::string("[] = "); std::string variableString = std::string("char ")+variableName+std::string("[] = ");
std::string::size_type startOfLine = 0; std::string::size_type startOfLine = 0;
std::string::size_type endOfLine = shaderSource.find_first_of('\n', startOfLine); 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; fout<<variableString<<shaderSource<<"\\n\";"<<std::endl;
} }
@@ -63,25 +63,21 @@ int main( int argc, char **argv )
{ {
// use an ArgumentParser object to manage the program arguments. // use an ArgumentParser object to manage the program arguments.
osg::ArgumentParser arguments(&argc,argv); osg::ArgumentParser arguments(&argc,argv);
// set up the usage document, in case we need to print out how to use this program. // set up the usage document, in case we need to print out how to use this program.
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName()); 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()->setDescription(arguments.getApplicationName()+" is a utility for converting between various input and output databases formats.");
arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ..."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("--shader <filename>","Shader file to create a .cpp file for."); 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"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display command line parameters");
// if user request help write it out to cout. // if user request help write it out to cout.
if (arguments.read("-h") || arguments.read("--help")) if (arguments.read("-h") || arguments.read("--help"))
{ {
arguments.getApplicationUsage()->write(std::cout); arguments.getApplicationUsage()->write(std::cout);
return 1; return 1;
} }
bool useSamePathAsSourceFile = false;
if (arguments.read("--write-to-source-file-directory")) useSamePathAsSourceFile = true;
std::string filename; std::string filename;
if (arguments.read("--shader",filename)) if (arguments.read("--shader",filename))
{ {
@@ -98,11 +94,9 @@ int main( int argc, char **argv )
name[pos] = '_'; name[pos] = '_';
pos = name.find_first_of(invalidCharacters); pos = name.find_first_of(invalidCharacters);
} }
std::string ext = osgDB::getFileExtension(filename); std::string ext = osgDB::getFileExtension(filename);
std::string cppFileName = name + "_" + ext + ".cpp"; std::string cppFileName = osgDB::concatPaths(path, name + "_" + ext + ".cpp");
if (useSamePathAsSourceFile) cppFileName = osgDB::concatPaths(path, cppFileName);
std::string variableName = name + "_" + ext; std::string variableName = name + "_" + ext;
writeShader(shader.get(), cppFileName, variableName); writeShader(shader.get(), cppFileName, variableName);
@@ -113,7 +107,7 @@ int main( int argc, char **argv )
std::cout<<"Error: could not find file '"<<filename<<"'"<<std::endl; std::cout<<"Error: could not find file '"<<filename<<"'"<<std::endl;
return 1; return 1;
} }
} }
std::cout<<"No appropriate command line options used."<<std::endl; std::cout<<"No appropriate command line options used."<<std::endl;

View File

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

View File

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

View File

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

View File

@@ -29,20 +29,14 @@
#include <osgViewer/ViewerEventHandlers> #include <osgViewer/ViewerEventHandlers>
#include <osgWidget/Browser> #include <osgWidget/Browser>
#include <QtGlobal>
#if QT_VERSION >= 0x050000
# include <QtWebKitWidgets>
#else
# include <QtWebKit>
#endif
#include <QWebSettings> #include <QtWebKit/QWebSettings>
#include <QtWebKit/QtWebKit>
#include <QGraphicsScene> #include <QtGui/QGraphicsScene>
#include <QGraphicsView> #include <QtGui/QGraphicsView>
#include <QApplication> #include <QtGui/QApplication>
#include <QPainter> #include <QtGui/QPainter>
#include <QtEvents> #include <QtGui/QtEvents>
#include <osgQt/QGraphicsViewAdapter> #include <osgQt/QGraphicsViewAdapter>
#include <osgQt/QWebViewImage> #include <osgQt/QWebViewImage>
@@ -59,10 +53,10 @@ class ViewerFrameThread : public OpenThreads::Thread
~ViewerFrameThread() ~ViewerFrameThread()
{ {
if (isRunning()) cancel();
while(isRunning())
{ {
cancel(); OpenThreads::Thread::YieldCurrentThread();
join();
} }
} }

View File

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

View File

@@ -36,16 +36,17 @@
#include <osgWidget/Browser> #include <osgWidget/Browser>
//#include <QWebSettings> //#include <QtWebKit/QWebSettings>
#include <QGraphicsScene> //#include <QtWebKit/QtWebKit>
#include <QGraphicsView> #include <QtGui/QGraphicsScene>
#include <QApplication> #include <QtGui/QGraphicsView>
#include <QPainter> #include <QtGui/QApplication>
#include <QtEvents> #include <QtGui/QPainter>
#include <QDialog> #include <QtGui/QtEvents>
#include <QVBoxLayout> #include <QtGui/QDialog>
#include <QMainWindow> #include <QtGui/QVBoxLayout>
#include <QtOpenGL> #include <QtGui/QMainWindow>
#include <QtOpenGL/QtOpenGL>
#include <osgQt/QGraphicsViewAdapter> #include <osgQt/QGraphicsViewAdapter>
#include <osgQt/QWebViewImage> #include <osgQt/QWebViewImage>
@@ -97,35 +98,31 @@ protected:
virtual void mousePressEvent(QMouseEvent* e) virtual void mousePressEvent(QMouseEvent* e)
{ {
bool ok = false; bool ok = false;
#if QT_VERSION >= 0x040500
int val = QInputDialog::getInt(this, "Get integer", "Please enter an integer between 0 and pi", 0, 0, 3, 1, &ok);
#else
int val = QInputDialog::getInteger(this, "Get integer", "Please enter an integer between 0 and pi", 0, 0, 3, 1, &ok); int val = QInputDialog::getInteger(this, "Get integer", "Please enter an integer between 0 and pi", 0, 0, 3, 1, &ok);
#endif
std::cout << "Ok was " << (ok ? "" : "not") << " pressed, val is " << val << std::endl; std::cout << "Ok was " << (ok ? "" : "not") << " pressed, val is " << val << std::endl;
} }
}; };
//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... //what they need to use...
// //
//---------------------------------------------- //----------------------------------------------
//There are two angles to consider. //There are two angles to consider.
// //
//1. If someone wants a widget in their Qt app to be an OSG-rendered scene, they //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 //need GraphicsWindowQt (in the osgViewerQtContext example) or QOSGWidget (in the
//osgViewerQt example). These two allow both OSG and Qt to manage their threads //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 //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 //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 //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 //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 //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... //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 //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 //an interface on a computer screen which is inside the 3D scene, or even
//floating Qt widgets, for example). That's where QGraphicsViewAdapter + //floating Qt widgets, for example). That's where QGraphicsViewAdapter +
//QWidgetImage will be useful. //QWidgetImage will be useful.
//---------------------------------------------- //----------------------------------------------
@@ -160,7 +157,7 @@ int main(int argc, char **argv)
bool useLabel = false; bool useLabel = false;
if (arguments.read("--useLabel")) useLabel = true; 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 // QWebViewImage/QWidgetImage
// false = use QWebViewImage/QWidgetImage (depending on useWidgetImage) // false = use QWebViewImage/QWidgetImage (depending on useWidgetImage)
bool sanityCheck = false; bool sanityCheck = false;
@@ -183,9 +180,9 @@ int main(int argc, char **argv)
//------------------------------------------------------------------- //-------------------------------------------------------------------
// QWebViewImage test // QWebViewImage test
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Note: When the last few issues with QWidgetImage are fixed, // Note: When the last few issues with QWidgetImage are fixed,
// QWebViewImage and this if() {} section can be removed since // QWebViewImage and this if() {} section can be removed since
// QWidgetImage can display a QWebView just like QWebViewImage. Use // QWidgetImage can display a QWebView just like QWebViewImage. Use
// --useWidgetImage --useBrowser to see that in action. // --useWidgetImage --useBrowser to see that in action.
if (!sanityCheck) if (!sanityCheck)
@@ -193,7 +190,7 @@ int main(int argc, char **argv)
osg::ref_ptr<osgQt::QWebViewImage> image = new osgQt::QWebViewImage; osg::ref_ptr<osgQt::QWebViewImage> image = new osgQt::QWebViewImage;
if (arguments.argc()>1) image->navigateTo((arguments[1])); if (arguments.argc()>1) image->navigateTo((arguments[1]));
else image->navigateTo("http://www.openscenegraph.org/"); else image->navigateTo("http://www.youtube.com/");
osgWidget::GeometryHints hints(osg::Vec3(0.0f,0.0f,0.0f), osgWidget::GeometryHints hints(osg::Vec3(0.0f,0.0f,0.0f),
osg::Vec3(1.0f,0.0f,0.0f), osg::Vec3(1.0f,0.0f,0.0f),
@@ -208,7 +205,7 @@ int main(int argc, char **argv)
} }
else 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. // a separate Qt window.
QWebPage* webPage = new QWebPage; QWebPage* webPage = new QWebPage;
webPage->settings()->setAttribute(QWebSettings::JavascriptEnabled, true); webPage->settings()->setAttribute(QWebSettings::JavascriptEnabled, true);
@@ -218,7 +215,7 @@ int main(int argc, char **argv)
webView->setPage(webPage); webView->setPage(webPage);
if (arguments.argc()>1) webView->load(QUrl(arguments[1])); if (arguments.argc()>1) webView->load(QUrl(arguments[1]));
else webView->load(QUrl("http://www.openscenegraph.org/")); else webView->load(QUrl("http://www.youtube.com/"));
QGraphicsScene* graphicsScene = new QGraphicsScene; QGraphicsScene* graphicsScene = new QGraphicsScene;
graphicsScene->addWidget(webView); graphicsScene->addWidget(webView);
@@ -240,16 +237,14 @@ int main(int argc, char **argv)
// QWidgetImage test // QWidgetImage test
//------------------------------------------------------------------- //-------------------------------------------------------------------
// QWidgetImage still has some issues, some examples are: // QWidgetImage still has some issues, some examples are:
// //
// 1. Editing in the QTextEdit doesn't work. Also when started with // 1. Editing in the QTextEdit doesn't work. Also when started with
// --useBrowser, editing in the search field on YouTube doesn't // --useBrowser, editing in the search field on YouTube doesn't
// work. But that same search field when using QWebViewImage // work. But that same search field when using QWebViewImage
// works... And editing in the text field in the pop-up getInteger // works... And editing in the text field in the pop-up getInteger
// dialog works too. All these cases use QGraphicsViewAdapter // dialog works too. All these cases use QGraphicsViewAdapter
// under the hood, so why do some work and others don't? // under the hood, so why do some work and others don't?
// //
// <<< FIXED, need TextEditorInteraction >>>
//
// a) osgQtBrowser --useWidgetImage [--fullscreen] (optional) // a) osgQtBrowser --useWidgetImage [--fullscreen] (optional)
// b) Try to click in the QTextEdit and type, or to select text // b) Try to click in the QTextEdit and type, or to select text
// and drag-and-drop it somewhere else in the QTextEdit. These // and drag-and-drop it somewhere else in the QTextEdit. These
@@ -261,11 +256,11 @@ int main(int argc, char **argv)
// g) osgQtBrowser // g) osgQtBrowser
// h) Try the operation in f), it works. // h) Try the operation in f), it works.
// //
// 2. Operations on floating windows (--numFloatingWindows 1 or more). // 2. Operations on floating windows (--numFloatingWindows 1 or more).
// Moving by dragging the titlebar, clicking the close button, // Moving by dragging the titlebar, clicking the close button,
// resizing them, none of these work. I wonder if it's because the // resizing them, none of these work. I wonder if it's because the
// OS manages those functions (they're functions of the window // OS manages those functions (they're functions of the window
// decorations) so we need to do something special for that? But // decorations) so we need to do something special for that? But
// in --sanityCheck mode they work. // in --sanityCheck mode they work.
// //
// a) osgQtBrowser --useWidgetImage --numFloatingWindows 1 [--fullscreen] // a) osgQtBrowser --useWidgetImage --numFloatingWindows 1 [--fullscreen]
@@ -274,37 +269,35 @@ int main(int argc, char **argv)
// c) osgQtBrowser --useWidgetImage --numFloatingWindows 1 --sanityCheck // c) osgQtBrowser --useWidgetImage --numFloatingWindows 1 --sanityCheck
// d) Try the operations in b), all they work. // d) Try the operations in b), all they work.
// e) osgQtBrowser --useWidgetImage [--fullscreen] // e) osgQtBrowser --useWidgetImage [--fullscreen]
// f) Click the button so that the getInteger() dialog is // f) Click the button so that the getInteger() dialog is
// displayed, then try to move that dialog or close it with the // displayed, then try to move that dialog or close it with the
// close button, these don't work. // close button, these don't work.
// g) osgQtBrowser --useWidgetImage --sanityCheck // g) osgQtBrowser --useWidgetImage --sanityCheck
// h) Try the operation in f), it works. // h) Try the operation in f), it works.
// //
// 3. (Minor) The QGraphicsView's scrollbars don't appear when // 3. (Minor) The QGraphicsView's scrollbars don't appear when
// using QWidgetImage or QWebViewImage. QGraphicsView is a // using QWidgetImage or QWebViewImage. QGraphicsView is a
// QAbstractScrollArea and it should display scrollbars as soon as // QAbstractScrollArea and it should display scrollbars as soon as
// the scene is too large to fit the view. // the scene is too large to fit the view.
// //
// <<< FIXED >>>
//
// a) osgQtBrowser --useWidgetImage --fullscreen // a) osgQtBrowser --useWidgetImage --fullscreen
// b) Resize the OSG window so it's smaller than the QTextEdit. // b) Resize the OSG window so it's smaller than the QTextEdit.
// Scrollbars should appear but don't. // Scrollbars should appear but don't.
// c) osgQtBrowser --useWidgetImage --sanityCheck // c) osgQtBrowser --useWidgetImage --sanityCheck
// d) Try the operation in b), scrollbars appear. Even if you have // d) Try the operation in b), scrollbars appear. Even if you have
// floating windows (by clicking the button or by adding // floating windows (by clicking the button or by adding
// --numFloatingWindows 1) and move them outside the view, // --numFloatingWindows 1) and move them outside the view,
// scrollbars appear too. You can't test that case in OSG for // scrollbars appear too. You can't test that case in OSG for
// now because of problem 2 above, but that's pretty cool. // 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. // QGraphicsView is centered. With QGraphicsViewAdapter, it is not.
// //
// a) osgQtBrowser --useWidgetImage [--fullscreen] // a) osgQtBrowser --useWidgetImage [--fullscreen]
// b) The QTextEdit and button are not in the center of the image // b) The QTextEdit and button are not in the center of the image
// generated by the QGraphicsViewAdapter. // generated by the QGraphicsViewAdapter.
// c) osgQtBrowser --useWidgetImage --sanityCheck // 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. // QGraphicsView.
@@ -350,7 +343,7 @@ int main(int argc, char **argv)
{ {
QTextEdit* textEdit = new QTextEdit(text); QTextEdit* textEdit = new QTextEdit(text);
textEdit->setReadOnly(false); textEdit->setReadOnly(false);
textEdit->setTextInteractionFlags(Qt::TextEditorInteraction); textEdit->setTextInteractionFlags(Qt::TextEditable);
QPalette palette = textEdit->palette(); QPalette palette = textEdit->palette();
palette.setColor(QPalette::Highlight, Qt::darkBlue); palette.setColor(QPalette::Highlight, Qt::darkBlue);
@@ -392,7 +385,7 @@ int main(int argc, char **argv)
texture->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE); texture->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_EDGE);
mt->getOrCreateStateSet()->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON); mt->getOrCreateStateSet()->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON);
osgViewer::InteractiveImageHandler* handler; osgViewer::InteractiveImageHandler* handler;
if (inScene) if (inScene)
{ {
mt->setMatrix(osg::Matrix::rotate(osg::Vec3(0,1,0), osg::Vec3(0,0,1))); mt->setMatrix(osg::Matrix::rotate(osg::Vec3(0,1,0), osg::Vec3(0,0,1)));
@@ -402,9 +395,9 @@ int main(int argc, char **argv)
} }
else // fullscreen 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. // 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 // projection resize policy to FIXED takes care of them, so
// they can stay the same: (0,1,0,1) with a quad that fits. // they can stay the same: (0,1,0,1) with a quad that fits.
@@ -433,13 +426,13 @@ int main(int argc, char **argv)
overlay->addChild(mt); overlay->addChild(mt);
root->addChild(overlay); root->addChild(overlay);
quad->setEventCallback(handler); quad->setEventCallback(handler);
quad->setCullCallback(handler); quad->setCullCallback(handler);
} }
else 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. // QGraphicsViewAdapter but in a separate Qt window.
graphicsScene = new QGraphicsScene; graphicsScene = new QGraphicsScene;

View File

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

View File

@@ -1,949 +0,0 @@
//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::readNodeFile("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
osgText::Text* text = new osgText::Text;
osgText::Font* font = osgText::readFontFile("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,7 +56,18 @@ public:
traverse(node); traverse(node);
} }
void apply(osg::Drawable& drawable) 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)
{ {
if (!_useStateSets && drawable.getStateSet()) if (!_useStateSets && drawable.getStateSet())
{ {
@@ -123,11 +134,11 @@ public:
if (_imageProcessor.valid()) if (_imageProcessor.valid())
{ {
OSG_NOTICE<<"Will be using ImageProcessor to process image "<<image->getFileName()<<std::endl; OSG_NOTICE<<"Will be using ImageProcessor to proces image "<<image->getFileName()<<std::endl;
} }
else else
{ {
OSG_NOTICE<<"No ImageProcessor to process image "<<image->getFileName()<<std::endl; OSG_NOTICE<<"No ImageProcessor to proces image "<<image->getFileName()<<std::endl;
} }
OSG_NOTICE<<" compressImage "<<_compressImages<<std::endl; OSG_NOTICE<<" compressImage "<<_compressImages<<std::endl;
OSG_NOTICE<<" generateMipmaps "<<_generateMipmaps<<std::endl; OSG_NOTICE<<" generateMipmaps "<<_generateMipmaps<<std::endl;
@@ -540,7 +551,6 @@ public:
const std::string& outputFilename, const std::string& outputFilename,
SceneGraphProcessor* sceneGraphProcessor, SceneGraphProcessor* sceneGraphProcessor,
osgUtil::IncrementalCompileOperation* ico): osgUtil::IncrementalCompileOperation* ico):
osg::Referenced(true),
Operation("DatabasePaging Operation", false), Operation("DatabasePaging Operation", false),
_filename(filename), _filename(filename),
_outputFilename(outputFilename), _outputFilename(outputFilename),

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,14 +1,14 @@
/* -*-c++-*- /* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net> * Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
* *
* This library is open source and may be redistributed and/or modified under * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@@ -34,7 +34,7 @@
osg::Geode* createAxis() osg::Geode* createAxis()
{ {
osg::Geode* geode (new osg::Geode()); osg::Geode* geode (new osg::Geode());
osg::Geometry* geometry (new osg::Geometry()); osg::Geometry* geometry (new osg::Geometry());
osg::Vec3Array* vertices (new osg::Vec3Array()); osg::Vec3Array* vertices (new osg::Vec3Array());
@@ -53,7 +53,9 @@ osg::Geode* createAxis()
colors->push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f)); colors->push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f)); colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f)); colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
geometry->setColorArray (colors, osg::Array::BIND_PER_VERTEX); geometry->setColorArray (colors);
geometry->setColorBinding (osg::Geometry::BIND_PER_VERTEX);
geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6)); geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6));
geode->addDrawable( geometry ); geode->addDrawable( geometry );
@@ -68,11 +70,12 @@ osgAnimation::RigGeometry* createTesselatedBox(int nsplit, float size)
osg::ref_ptr<osg::Vec3Array> vertices (new osg::Vec3Array()); osg::ref_ptr<osg::Vec3Array> vertices (new osg::Vec3Array());
osg::ref_ptr<osg::Vec3Array> colors (new osg::Vec3Array()); osg::ref_ptr<osg::Vec3Array> colors (new osg::Vec3Array());
geometry->setVertexArray (vertices.get()); geometry->setVertexArray (vertices.get());
geometry->setColorArray (colors.get(), osg::Array::BIND_PER_VERTEX); geometry->setColorArray (colors.get());
geometry->setColorBinding (osg::Geometry::BIND_PER_VERTEX);
float step = size / static_cast<float>(nsplit); float step = size / static_cast<float>(nsplit);
float s = 0.5f/4.0f; float s = 0.5f/4.0f;
for (int i = 0; i < nsplit; i++) for (int i = 0; i < nsplit; i++)
{ {
float x = -1.0f + static_cast<float>(i) * step; float x = -1.0f + static_cast<float>(i) * step;
std::cout << x << std::endl; std::cout << x << std::endl;
@@ -89,7 +92,7 @@ osgAnimation::RigGeometry* createTesselatedBox(int nsplit, float size)
} }
osg::ref_ptr<osg::UIntArray> array = new osg::UIntArray; osg::ref_ptr<osg::UIntArray> array = new osg::UIntArray;
for (int i = 0; i < nsplit - 1; i++) for (int i = 0; i < nsplit - 1; i++)
{ {
int base = i * 4; int base = i * 4;
array->push_back(base); array->push_back(base);
@@ -120,7 +123,7 @@ osgAnimation::RigGeometry* createTesselatedBox(int nsplit, float size)
array->push_back(base+2); array->push_back(base+2);
array->push_back(base+7); array->push_back(base+7);
} }
geometry->addPrimitiveSet(new osg::DrawElementsUInt(osg::PrimitiveSet::TRIANGLES, array->size(), &array->front())); geometry->addPrimitiveSet(new osg::DrawElementsUInt(osg::PrimitiveSet::TRIANGLES, array->size(), &array->front()));
geometry->setUseDisplayList( false ); geometry->setUseDisplayList( false );
riggeometry->setSourceGeometry(geometry); riggeometry->setSourceGeometry(geometry);
@@ -141,7 +144,7 @@ void initVertexMap(osgAnimation::Bone* b0,
(*vim)[b1->getName()].setName(b1->getName()); (*vim)[b1->getName()].setName(b1->getName());
(*vim)[b2->getName()].setName(b2->getName()); (*vim)[b2->getName()].setName(b2->getName());
for (int i = 0; i < (int)array->size(); i++) for (int i = 0; i < (int)array->size(); i++)
{ {
float val = (*array)[i][0]; float val = (*array)[i][0];
std::cout << val << std::endl; std::cout << val << std::endl;
@@ -226,7 +229,7 @@ int main (int argc, char* argv[])
} }
manager->registerAnimation(anim); manager->registerAnimation(anim);
manager->buildTargetReference(); manager->buildTargetReference();
// let's start ! // let's start !
manager->playAnimation(anim); manager->playAnimation(anim);
@@ -244,7 +247,7 @@ int main (int argc, char* argv[])
trueroot->setDataVariance(osg::Object::DYNAMIC); trueroot->setDataVariance(osg::Object::DYNAMIC);
rootTransform->addChild(trueroot); rootTransform->addChild(trueroot);
scene->addChild(rootTransform); scene->addChild(rootTransform);
osgAnimation::RigGeometry* geom = createTesselatedBox(4, 4.0f); osgAnimation::RigGeometry* geom = createTesselatedBox(4, 4.0f);
osg::Geode* geode = new osg::Geode; osg::Geode* geode = new osg::Geode;
geode->addDrawable(geom); geode->addDrawable(geom);

View File

@@ -1,14 +1,14 @@
/* -*-c++-*- /* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net> * Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
* *
* This library is open source and may be redistributed and/or modified under * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@@ -30,7 +30,7 @@ using namespace osgAnimation;
osg::ref_ptr<osg::Geode> createAxis() osg::ref_ptr<osg::Geode> createAxis()
{ {
osg::ref_ptr<osg::Geode> geode (new osg::Geode()); osg::ref_ptr<osg::Geode> geode (new osg::Geode());
osg::ref_ptr<osg::Geometry> geometry (new osg::Geometry()); osg::ref_ptr<osg::Geometry> geometry (new osg::Geometry());
osg::ref_ptr<osg::Vec3Array> vertices (new osg::Vec3Array()); osg::ref_ptr<osg::Vec3Array> vertices (new osg::Vec3Array());
@@ -49,7 +49,9 @@ osg::ref_ptr<osg::Geode> createAxis()
colors->push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f)); colors->push_back (osg::Vec4 (0.0f, 1.0f, 0.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f)); colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f)); colors->push_back (osg::Vec4 (0.0f, 0.0f, 1.0f, 1.0f));
geometry->setColorArray (colors.get(), osg::Array::BIND_PER_VERTEX); geometry->setColorArray (colors.get());
geometry->setColorBinding (osg::Geometry::BIND_PER_VERTEX);
geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6)); geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6));
geode->addDrawable( geometry.get() ); geode->addDrawable( geometry.get() );
@@ -71,7 +73,7 @@ int main (int argc, char* argv[])
osg::ref_ptr<osg::Geode> geode = new osg::Geode; 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))); geode->addDrawable(new osg::ShapeDrawable(new osg::Box(osg::Vec3(0.0f,0.0f,0.0f),0.5)));
//Transformation to be manipulated by the animation //Tranformation to be manipulated by the animation
osg::ref_ptr<osg::MatrixTransform> trans = new osg::MatrixTransform(); osg::ref_ptr<osg::MatrixTransform> trans = new osg::MatrixTransform();
trans->setName("AnimatedNode"); trans->setName("AnimatedNode");
//Dynamic object, has to be updated during update traversal //Dynamic object, has to be updated during update traversal
@@ -84,7 +86,7 @@ int main (int argc, char* argv[])
//The second element modifies the rotation around x-axis //The second element modifies the rotation around x-axis
updatecb->getStackedTransforms().push_back(new osgAnimation::StackedTranslateElement("position")); updatecb->getStackedTransforms().push_back(new osgAnimation::StackedTranslateElement("position"));
updatecb->getStackedTransforms().push_back(new osgAnimation::StackedRotateAxisElement("euler",osg::Vec3(1,0,0),0)); updatecb->getStackedTransforms().push_back(new osgAnimation::StackedRotateAxisElement("euler",osg::Vec3(1,0,0),0));
//connect the UpdateMatrixTransform callback to the MatrixTransform //connect the UpdateMatrixTransform callback to the MatrixTRanform
trans->setUpdateCallback(updatecb); trans->setUpdateCallback(updatecb);
//initialize MatrixTranform //initialize MatrixTranform
trans->setMatrix(osg::Matrix::identity()); trans->setMatrix(osg::Matrix::identity());
@@ -102,7 +104,7 @@ int main (int argc, char* argv[])
//add the rest of the scene to the grp node //add the rest of the scene to the grp node
grp->addChild(root); grp->addChild(root);
// And we finally define our channel for linear Vector interpolation // And we finaly define our channel for linear Vector interpolation
osgAnimation::Vec3LinearChannel* channelAnimation1 = new osgAnimation::Vec3LinearChannel; osgAnimation::Vec3LinearChannel* channelAnimation1 = new osgAnimation::Vec3LinearChannel;
//name of the AnimationUpdateCallback //name of the AnimationUpdateCallback
channelAnimation1->setTargetName("AnimatedCallback"); channelAnimation1->setTargetName("AnimatedCallback");
@@ -112,7 +114,7 @@ int main (int argc, char* argv[])
channelAnimation1->getOrCreateSampler()->getOrCreateKeyframeContainer()->push_back(osgAnimation::Vec3Keyframe(0, osg::Vec3(0,0,0))); channelAnimation1->getOrCreateSampler()->getOrCreateKeyframeContainer()->push_back(osgAnimation::Vec3Keyframe(0, osg::Vec3(0,0,0)));
channelAnimation1->getOrCreateSampler()->getOrCreateKeyframeContainer()->push_back(osgAnimation::Vec3Keyframe(2, osg::Vec3(1,1,0))); channelAnimation1->getOrCreateSampler()->getOrCreateKeyframeContainer()->push_back(osgAnimation::Vec3Keyframe(2, osg::Vec3(1,1,0)));
osgAnimation::Animation* anim1 = new osgAnimation::Animation; osgAnimation::Animation* anim1 = new osgAnimation::Animation;
anim1->addChannel(channelAnimation1); anim1->addChannel(channelAnimation1);
anim1->setPlayMode(osgAnimation::Animation::PPONG); anim1->setPlayMode(osgAnimation::Animation::PPONG);
@@ -128,12 +130,12 @@ int main (int argc, char* argv[])
osgAnimation::Animation* anim2 = new osgAnimation::Animation; osgAnimation::Animation* anim2 = new osgAnimation::Animation;
anim2->addChannel(channelAnimation2); anim2->addChannel(channelAnimation2);
anim2->setPlayMode(osgAnimation::Animation::LOOP); anim2->setPlayMode(osgAnimation::Animation::LOOP);
// We register all animation inside the scheduler // We register all animation inside the scheduler
mng->registerAnimation(anim1); mng->registerAnimation(anim1);
mng->registerAnimation(anim2); mng->registerAnimation(anim2);
//start the animation //start the animation
mng->playAnimation(anim1); mng->playAnimation(anim1);
mng->playAnimation(anim2); mng->playAnimation(anim2);

View File

@@ -1,14 +1,14 @@
/* -*-c++-*- /* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net> * Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net>
* *
* This library is open source and may be redistributed and/or modified under * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
*/ */
@@ -84,7 +84,7 @@ struct ExampleTimelineUsage : public osgGA::GUIEventHandler
_scratchNose->setLoop(1); // one time _scratchNose->setLoop(1); // one time
// add the main loop at priority 0 at time 0. // add the main loop at priority 0 at time 0.
osgAnimation::Timeline* tml = _manager->getTimeline(); osgAnimation::Timeline* tml = _manager->getTimeline();
tml->play(); tml->play();
tml->addActionAt(0.0, _mainLoop.get(), 0); 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 // we add a scratch head priority 1 each 10 second
// note: // note:
// it's possible to add the same instance more than once on the timeline // it's possible to add the same instance more then once on the timeline
// the only things you need to take care is if you remove it. It will remove // 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 differentiate // all instance that exist on the timeline. If you need to differtiate
// it's better to create a new instance // it's better to create a new instance
tml->addActionAt(5.0 + 10.0 * i, _scratchHead.get(), 1); tml->addActionAt(5.0 + 10.0 * i, _scratchHead.get(), 1);
} }
@@ -139,12 +139,21 @@ struct ExampleTimelineUsage : public osgGA::GUIEventHandler
} }
_releaseKey = false; _releaseKey = false;
} }
traverse(node, nv);
} }
else else
{ {
osgGA::GUIEventHandler::operator()(node, nv); 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);
} }
}; };
@@ -159,7 +168,7 @@ int main (int argc, char* argv[])
osgViewer::Viewer viewer(psr); osgViewer::Viewer viewer(psr);
std::string file = "nathan.osg"; std::string file = "nathan.osg";
if(argc >= 2) if(argc >= 2)
file = psr[1]; file = psr[1];
// replace the manager // replace the manager
@@ -169,7 +178,7 @@ int main (int argc, char* argv[])
return 1; return 1;
} }
osgAnimation::AnimationManagerBase* animationManager = dynamic_cast<osgAnimation::AnimationManagerBase*>(root->getUpdateCallback()); 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; osg::notify(osg::FATAL) << "Did not find AnimationManagerBase updateCallback needed to animate elements" << std::endl;
return 1; return 1;
@@ -177,22 +186,22 @@ int main (int argc, char* argv[])
osg::ref_ptr<osgAnimation::TimelineAnimationManager> tl = new osgAnimation::TimelineAnimationManager(*animationManager); osg::ref_ptr<osgAnimation::TimelineAnimationManager> tl = new osgAnimation::TimelineAnimationManager(*animationManager);
root->setUpdateCallback(tl.get()); root->setUpdateCallback(tl.get());
ExampleTimelineUsage* callback = new ExampleTimelineUsage(tl.get()); ExampleTimelineUsage* callback = new ExampleTimelineUsage(tl.get());
root->setEventCallback(callback); root->setEventCallback(callback);
root->getUpdateCallback()->addNestedCallback(callback); root->getUpdateCallback()->addNestedCallback(callback);
// add the state manipulator // add the state manipulator
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) ); viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
// add the thread model handler // add the thread model handler
viewer.addEventHandler(new osgViewer::ThreadingHandler); viewer.addEventHandler(new osgViewer::ThreadingHandler);
// add the window size toggle handler // add the window size toggle handler
viewer.addEventHandler(new osgViewer::WindowSizeHandler); viewer.addEventHandler(new osgViewer::WindowSizeHandler);
// add the stats handler // add the stats handler
viewer.addEventHandler(new osgViewer::StatsHandler); viewer.addEventHandler(new osgViewer::StatsHandler);

View File

@@ -1,14 +1,14 @@
/* -*-c++-*- /* -*-c++-*-
* Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net> * Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net>
* *
* This library is open source and may be redistributed and/or modified under * 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 * 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 * (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website. * included with this distribution, and on the openscenegraph.org website.
* *
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * 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. * OpenSceneGraph Public License for more details.
* *
* Authors: * Authors:
@@ -24,7 +24,6 @@
#include <osg/Geometry> #include <osg/Geometry>
#include <osg/MatrixTransform> #include <osg/MatrixTransform>
#include <osg/Geode> #include <osg/Geode>
#include <osgDB/FileNameUtils>
#include <osgViewer/Viewer> #include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers> #include <osgViewer/ViewerEventHandlers>
#include <osgWidget/ViewerEventHandlers> #include <osgWidget/ViewerEventHandlers>
@@ -38,13 +37,13 @@ const int WIDTH = 1440;
const int HEIGHT = 900; const int HEIGHT = 900;
osg::Geode* createAxis() osg::Geode* createAxis()
{ {
osg::Geode* geode = new osg::Geode(); osg::Geode* geode = new osg::Geode();
osg::Geometry* geometry = new osg::Geometry(); osg::Geometry* geometry = new osg::Geometry();
osg::Vec3Array* vertices = new osg::Vec3Array(); osg::Vec3Array* vertices = new osg::Vec3Array();
osg::Vec4Array* colors = new osg::Vec4Array(); osg::Vec4Array* colors = new osg::Vec4Array();
vertices->push_back(osg::Vec3(0.0f, 0.0f, 0.0f)); vertices->push_back(osg::Vec3(0.0f, 0.0f, 0.0f));
vertices->push_back(osg::Vec3(1.0f, 0.0f, 0.0f)); vertices->push_back(osg::Vec3(1.0f, 0.0f, 0.0f));
vertices->push_back(osg::Vec3(0.0f, 0.0f, 0.0f)); vertices->push_back(osg::Vec3(0.0f, 0.0f, 0.0f));
@@ -58,9 +57,10 @@ osg::Geode* createAxis()
colors->push_back(osg::Vec4(0.0f, 1.0f, 0.0f, 1.0f)); colors->push_back(osg::Vec4(0.0f, 1.0f, 0.0f, 1.0f));
colors->push_back(osg::Vec4(0.0f, 0.0f, 1.0f, 1.0f)); colors->push_back(osg::Vec4(0.0f, 0.0f, 1.0f, 1.0f));
colors->push_back(osg::Vec4(0.0f, 0.0f, 1.0f, 1.0f)); colors->push_back(osg::Vec4(0.0f, 0.0f, 1.0f, 1.0f));
geometry->setVertexArray(vertices); geometry->setVertexArray(vertices);
geometry->setColorArray(colors, osg::Array::BIND_PER_VERTEX); geometry->setColorArray(colors);
geometry->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES, 0, 6)); geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES, 0, 6));
geometry->getOrCreateStateSet()->setMode(GL_LIGHTING, false); geometry->getOrCreateStateSet()->setMode(GL_LIGHTING, false);
@@ -100,7 +100,7 @@ struct AddHelperBone : public osg::NodeVisitor
} }
}; };
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
osg::ArgumentParser arguments(&argc, argv); osg::ArgumentParser arguments(&argc, argv);
arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName()); arguments.getApplicationUsage()->setApplicationName(arguments.getApplicationName());
@@ -137,30 +137,10 @@ int main(int argc, char** argv)
// Set our Singleton's model. // Set our Singleton's model.
AnimationManagerFinder finder; AnimationManagerFinder finder;
node->accept(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()); node->setUpdateCallback(finder._am.get());
AnimtkViewerModelController::setModel(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; osg::notify(osg::WARN) << "no osgAnimation::AnimationManagerBase found in the subgraph, no animations available" << std::endl;
} }
@@ -173,7 +153,7 @@ int main(int argc, char** argv)
AnimtkViewerGUI* gui = new AnimtkViewerGUI(&viewer, WIDTH, HEIGHT, 0x1234); AnimtkViewerGUI* gui = new AnimtkViewerGUI(&viewer, WIDTH, HEIGHT, 0x1234);
osg::Camera* camera = gui->createParentOrthoCamera(); osg::Camera* camera = gui->createParentOrthoCamera();
node->setNodeMask(0x0001); node->setNodeMask(0x0001);
group->addChild(node); group->addChild(node);

View File

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

View File

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

View File

@@ -348,8 +348,6 @@ int main( int argc, char **argv )
keyswitchManipulator->addMatrixManipulator( '2', "Flight", new osgGA::FlightManipulator() ); keyswitchManipulator->addMatrixManipulator( '2', "Flight", new osgGA::FlightManipulator() );
keyswitchManipulator->addMatrixManipulator( '3', "Drive", new osgGA::DriveManipulator() ); keyswitchManipulator->addMatrixManipulator( '3', "Drive", new osgGA::DriveManipulator() );
keyswitchManipulator->addMatrixManipulator( '4', "Terrain", new osgGA::TerrainManipulator() ); keyswitchManipulator->addMatrixManipulator( '4', "Terrain", new osgGA::TerrainManipulator() );
viewer.setCameraManipulator( keyswitchManipulator.get() );
} }
@@ -406,7 +404,7 @@ int main( int argc, char **argv )
viewer.renderingTraversals(); viewer.renderingTraversals();
osg::Timer_t afterRenderTick = osg::Timer::instance()->tick(); osg::Timer_t afterRenderTick = osg::Timer::instance()->tick();
std::cout<<"Rendering time = "<<osg::Timer::instance()->delta_s(beforeRenderTick, afterRenderTick) <<" seconds"<<std::endl; std::cout<<"Rendring time = "<<osg::Timer::instance()->delta_s(beforeRenderTick, afterRenderTick) <<" seconds"<<std::endl;
return 0; return 0;
} }

View File

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

View File

@@ -6,7 +6,7 @@
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is * copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions: * furnished to do so, subject to the following conditions:
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -34,7 +34,7 @@
#include <osgViewer/Viewer> #include <osgViewer/Viewer>
// //
// A simple demo demonstrating different texturing modes, // A simple demo demonstrating different texturing modes,
// including using of texture extensions. // including using of texture extensions.
// //
@@ -59,8 +59,9 @@ osg::Drawable* createSquare(const osg::Vec3& corner,const osg::Vec3& width,const
osg::Vec3Array* norms = new osg::Vec3Array(1); osg::Vec3Array* norms = new osg::Vec3Array(1);
(*norms)[0] = width^height; (*norms)[0] = width^height;
(*norms)[0].normalize(); (*norms)[0].normalize();
geom->setNormalArray(norms, osg::Array::BIND_OVERALL); geom->setNormalArray(norms);
geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
osg::Vec2Array* tcoords = new osg::Vec2Array(4); osg::Vec2Array* tcoords = new osg::Vec2Array(4);
(*tcoords)[0].set(0.0f,0.0f); (*tcoords)[0].set(0.0f,0.0f);
@@ -68,9 +69,9 @@ osg::Drawable* createSquare(const osg::Vec3& corner,const osg::Vec3& width,const
(*tcoords)[2].set(1.0f,1.0f); (*tcoords)[2].set(1.0f,1.0f);
(*tcoords)[3].set(0.0f,1.0f); (*tcoords)[3].set(0.0f,1.0f);
geom->setTexCoordArray(0,tcoords); geom->setTexCoordArray(0,tcoords);
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4)); geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4));
if (image) if (image)
{ {
osg::StateSet* stateset = new osg::StateSet; osg::StateSet* stateset = new osg::StateSet;
@@ -79,7 +80,7 @@ osg::Drawable* createSquare(const osg::Vec3& corner,const osg::Vec3& width,const
stateset->setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON); stateset->setTextureAttributeAndModes(0,texture,osg::StateAttribute::ON);
geom->setStateSet(stateset); geom->setStateSet(stateset);
} }
return geom; return geom;
} }
@@ -109,18 +110,19 @@ osg::Drawable* createAxis(const osg::Vec3& corner,const osg::Vec3& xdir,const os
(*color)[3] = y_color; (*color)[3] = y_color;
(*color)[4] = z_color; (*color)[4] = z_color;
(*color)[5] = z_color; (*color)[5] = z_color;
geom->setColorArray(color, osg::Array::BIND_PER_VERTEX); geom->setColorArray(color);
geom->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6)); geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,6));
osg::StateSet* stateset = new osg::StateSet; osg::StateSet* stateset = new osg::StateSet;
osg::LineWidth* linewidth = new osg::LineWidth(); osg::LineWidth* linewidth = new osg::LineWidth();
linewidth->setWidth(4.0f); linewidth->setWidth(4.0f);
stateset->setAttributeAndModes(linewidth,osg::StateAttribute::ON); stateset->setAttributeAndModes(linewidth,osg::StateAttribute::ON);
stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF); stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
geom->setStateSet(stateset); geom->setStateSet(stateset);
return geom; return geom;
} }
@@ -130,13 +132,13 @@ osg::Node* createModel()
// create the root node which will hold the model. // create the root node which will hold the model.
osg::Group* root = new osg::Group(); osg::Group* root = new osg::Group();
// add the drawable into a single geode to be shared... // add the drawable into a single goede to be shared...
osg::Billboard* center = new osg::Billboard(); osg::Billboard* center = new osg::Billboard();
center->setMode(osg::Billboard::POINT_ROT_EYE); center->setMode(osg::Billboard::POINT_ROT_EYE);
center->addDrawable( 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::readImageFile("Images/reflect.rgb")),
osg::Vec3(0.0f,0.0f,0.0f)); osg::Vec3(0.0f,0.0f,0.0f));
osg::Billboard* x_arrow = new osg::Billboard(); osg::Billboard* x_arrow = new osg::Billboard();
x_arrow->setMode(osg::Billboard::AXIAL_ROT); x_arrow->setMode(osg::Billboard::AXIAL_ROT);
x_arrow->setAxis(osg::Vec3(1.0f,0.0f,0.0f)); x_arrow->setAxis(osg::Vec3(1.0f,0.0f,0.0f));
@@ -180,7 +182,7 @@ int main(int, char**)
{ {
// construct the viewer // construct the viewer
osgViewer::Viewer viewer; osgViewer::Viewer viewer;
// set the scene to render // set the scene to render
viewer.setSceneData(createModel()); viewer.setSceneData(createModel());

View File

@@ -1,147 +0,0 @@
/* 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;
// Create a camera to output multi-rendering-targets (MRT)
osg::Camera* mrtCam = createMRTCamera( textures );
mrtCam->addChild( osgDB::readNodeFile("cessna.osgt") );
// 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::StateSet* ss = mrtCam->getOrCreateStateSet();
ss->setAttributeAndModes( program.get() );
// 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.get() );
ss->setAttributeAndModes( colormask3.get() );
}
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&) bool TechniqueEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&)
{ {
switch(ea.getEventType()) switch(ea.getEventType())
@@ -104,7 +104,7 @@ bool TechniqueEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIAc
_eq_index--; _eq_index--;
if (_eq_index<0) _eq_index=_eq_nb-1; if (_eq_index<0) _eq_index=_eq_nb-1;
_blendEq->setEquation(_equations[_eq_index]); _blendEq->setEquation(_equations[_eq_index]);
std::cout<<"Equation name = "<<_equations_name[_eq_index]<<std::endl; std::cout<<"Operation name = "<<_equations_name[_eq_index]<<std::endl;
return true; return true;
} }
return false; return false;
@@ -134,7 +134,7 @@ 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()->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()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ...");
arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information");
// construct the viewer. // construct the viewer.
osgViewer::Viewer viewer; osgViewer::Viewer viewer;
@@ -143,7 +143,7 @@ int main( int argc, char **argv )
// if not loaded assume no arguments passed in, try use default mode instead. // if not loaded assume no arguments passed in, try use default mode instead.
if (!loadedModel) loadedModel = osgDB::readNodeFile("cessnafire.osgt"); if (!loadedModel) loadedModel = osgDB::readNodeFile("cessnafire.osgt");
if (!loadedModel) if (!loadedModel)
{ {
std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl; std::cout << arguments.getApplicationName() <<": No data loaded" << std::endl;
@@ -152,18 +152,18 @@ int main( int argc, char **argv )
osg::Group* root = new osg::Group; osg::Group* root = new osg::Group;
root->addChild(loadedModel); root->addChild(loadedModel);
osg::StateSet* stateset = new osg::StateSet; osg::StateSet* stateset = new osg::StateSet;
stateset->setDataVariance(osg::Object::DYNAMIC); stateset->setDataVariance(osg::Object::DYNAMIC);
osg::BlendEquation* blendEquation = new osg::BlendEquation(osg::BlendEquation::FUNC_ADD); osg::BlendEquation* blendEquation = new osg::BlendEquation(osg::BlendEquation::FUNC_ADD);
blendEquation->setDataVariance(osg::Object::DYNAMIC); blendEquation->setDataVariance(osg::Object::DYNAMIC);
stateset->setAttributeAndModes(blendEquation,osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON); stateset->setAttributeAndModes(blendEquation,osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);
//tell to sort the mesh before displaying it //tell to sort the mesh before displaying it
stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN); stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
loadedModel->setStateSet(stateset); loadedModel->setStateSet(stateset);
@@ -171,6 +171,6 @@ int main( int argc, char **argv )
// add a viewport to the viewer and attach the scene graph. // add a viewport to the viewer and attach the scene graph.
viewer.setSceneData( root ); viewer.setSceneData( root );
return viewer.run(); return viewer.run();
} }

View File

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

View File

@@ -304,7 +304,7 @@ int main( int argc, char **argv )
osgViewer::View* view = dynamic_cast<osgViewer::View*>(object.get()); osgViewer::View* view = dynamic_cast<osgViewer::View*>(object.get());
if (view) if (view)
{ {
osg::notify(osg::NOTICE)<<"Read config file successfully"<<std::endl; osg::notify(osg::NOTICE)<<"Read config file succesfully"<<std::endl;
} }
else else
{ {

View File

@@ -1366,7 +1366,6 @@ class CompileStateCallback : public osg::Operation
{ {
public: public:
CompileStateCallback(GameEventHandler* eh): CompileStateCallback(GameEventHandler* eh):
osg::Referenced(true),
osg::Operation("CompileStateCallback", false), osg::Operation("CompileStateCallback", false),
_gameEventHandler(eh) {} _gameEventHandler(eh) {}

View File

@@ -59,7 +59,7 @@ osg::Node* decorate_with_clip_node(osg::Node* subgraph)
rootnode->addChild(wireframe_subgraph); rootnode->addChild(wireframe_subgraph);
/* /*
// simple approach to adding a clipnode above a subgraph. // simple approach to adding a clipnode above a subrgaph.
// create clipped part. // create clipped part.
osg::ClipNode* clipped_subgraph = new osg::ClipNode; osg::ClipNode* clipped_subgraph = new osg::ClipNode;
@@ -78,7 +78,7 @@ osg::Node* decorate_with_clip_node(osg::Node* subgraph)
// more complex approach to managing ClipNode, allowing // more complex approach to managing ClipNode, allowing
// ClipNode node to be transformed independently from the subgraph // ClipNode node to be transformed independantly from the subgraph
// that it is clipping. // that it is clipping.
osg::MatrixTransform* transform= new osg::MatrixTransform; osg::MatrixTransform* transform= new osg::MatrixTransform;
@@ -126,7 +126,7 @@ int main( int argc, char **argv )
if (!loadedModel) if (!loadedModel)
{ {
osg::notify(osg::NOTICE)<<"Please specify a filename on the command line"<<std::endl; osg::notify(osg::NOTICE)<<"Please specifiy a filename and the command line"<<std::endl;
return 1; return 1;
} }

View File

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

View File

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

View File

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

View File

@@ -1,92 +0,0 @@
/* -*-c++-*- OpenSceneGraph example, osgcomputeshaders.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
// Written by Wang Rui
// This example can work only if GL version is 4.3 or greater
#include <osg/Texture2D>
#include <osg/Geometry>
#include <osg/Geode>
#include <osgDB/ReadFile>
#include <osgGA/StateSetManipulator>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
static const char* computeSrc = {
"#version 430\n"
"uniform float osg_FrameTime;\n"
"layout (r32f, binding =0) uniform image2D targetTex;\n"
"layout (local_size_x = 16, local_size_y = 16) in;\n"
"void main() {\n"
" ivec2 storePos = ivec2(gl_GlobalInvocationID.xy);\n"
" float coeffcient = 0.5*sin(float(gl_WorkGroupID.x + gl_WorkGroupID.y)*0.1 + osg_FrameTime);\n"
" coeffcient *= length(vec2(ivec2(gl_LocalInvocationID.xy) - ivec2(8)) / vec2(8.0));\n"
" imageStore(targetTex, storePos, vec4(1.0-coeffcient, 0.0, 0.0, 0.0));\n"
"}\n"
};
int main( int argc, char** argv )
{
osg::ArgumentParser arguments( &argc, argv );
// Create the texture as both the output of compute shader and the input of a normal quad
osg::ref_ptr<osg::Texture2D> tex2D = new osg::Texture2D;
tex2D->setTextureSize( 512, 512 );
tex2D->setFilter( osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR );
tex2D->setFilter( osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR );
tex2D->setInternalFormat( GL_R32F );
tex2D->setSourceFormat( GL_RED );
tex2D->setSourceType( GL_FLOAT );
tex2D->bindToImageUnit( 0, osg::Texture::WRITE_ONLY ); // So we can use 'image2D' in the compute shader
// The compute shader can't work with other kinds of shaders
// It also requires the work group numbers. Setting them to 0 will disable the compute shader
osg::ref_ptr<osg::Program> computeProg = new osg::Program;
computeProg->setComputeGroups( 512/16, 512/16, 1 );
computeProg->addShader( new osg::Shader(osg::Shader::COMPUTE, computeSrc) );
// Create a node for outputting to the texture.
// It is OK to have just an empty node here, but seems inbuilt uniforms like osg_FrameTime won't work then.
// TODO: maybe we can have a custom drawable which also will implement glMemoryBarrier?
osg::Node* sourceNode = osgDB::readNodeFile("axes.osgt");
if ( !sourceNode ) sourceNode = new osg::Node;
sourceNode->setDataVariance( osg::Object::DYNAMIC );
sourceNode->getOrCreateStateSet()->setAttributeAndModes( computeProg.get() );
sourceNode->getOrCreateStateSet()->addUniform( new osg::Uniform("targetTex", (int)0) );
sourceNode->getOrCreateStateSet()->setTextureAttributeAndModes( 0, tex2D.get() );
// Display the texture on a quad. We will also be able to operate on the data if reading back to CPU side
osg::Geometry* geom = osg::createTexturedQuadGeometry(
osg::Vec3(), osg::Vec3(1.0f,0.0f,0.0f), osg::Vec3(0.0f,0.0f,1.0f) );
osg::ref_ptr<osg::Geode> quad = new osg::Geode;
quad->addDrawable( geom );
quad->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
quad->getOrCreateStateSet()->setTextureAttributeAndModes( 0, tex2D.get() );
// Create the scene graph and start the viewer
osg::ref_ptr<osg::Group> scene = new osg::Group;
scene->addChild( sourceNode );
scene->addChild( quad.get() );
osgViewer::Viewer viewer;
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
viewer.addEventHandler( new osgViewer::StatsHandler );
viewer.addEventHandler( new osgViewer::WindowSizeHandler );
viewer.setSceneData( scene.get() );
return viewer.run();
}

View File

@@ -211,7 +211,7 @@ int main( int argc, char **argv )
// ------------- Start of copy specific code ------------------------------------------------------- // ------------- Start of copy specific code -------------------------------------------------------
// do a deep copy, using MyCopyOp to reveal whats going on under the hood, // do a deep copy, using MyCopyOp to reveal whats going on under the good,
// in your own code you'd typically just use the basic osg::CopyOp something like // 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)); 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; std::cout << "Doing a deep copy of scene graph"<<std::endl;

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