diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 000000000..a83c0b9d7 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,44 @@ +# $Id$ +# +# The is a list of authors and contributors to the project. +# Feel free to add your name and change list. + +Robert Osfield + - osg and osgUtil. + - pfb, gif, jpeg, tiff, tga, pic plugins. + - sgv, various revisions, now most of code in osgGLUT. + - documentation?! + - visual studio workspace files/unix makefiles. + - project adim & lead. + +Don Burns + - libosg (particularily OpenGL) + - first version of sgv. + - fly database plugin. + - netscape plugin. + - unix makefiles. + +Graeme Harkness + - osg::Vec2,Vec3,Vec4 & osg::Quat classes. + - reworking of old sgv into osgGLUT and a slim line Demos/sgv. + - Demos/cube. + +Neil Salter + - first incarnation of osgUtil, Camera and Manipulators. + - web site. + +Brede Johansen + - flt loader. + - osg::Point. + - bug fixes. + - assistance on visual studio workspace files. + +Ben Discoe + - png plugin. + - a couple of bug fixes and code submissions. + +Karsten Weiss + - autoconfiscation of the project. + - rpm spec file. + - documentation. + - bug fixes. diff --git a/COPYING b/COPYING new file mode 100644 index 000000000..92b8903ff --- /dev/null +++ b/COPYING @@ -0,0 +1,481 @@ + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some +specially designated Free Software Foundation software, and to any +other libraries whose authors decide to use it. You can use it for +your libraries, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if +you distribute copies of the library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide +complete object files to the recipients so that they can relink them +with the library, after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright +the library, and (2) offer you this license which gives you legal +permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain +that everyone understands that there is no warranty for this free +library. If the library is modified by someone else and passed on, we +want its recipients to know that what they have is not the original +version, so that any problems introduced by others will not reflect on +the original authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that companies distributing free +software will individually obtain patent licenses, thus in effect +transforming the program into proprietary software. To prevent this, +we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary +GNU General Public License, which was designed for utility programs. This +license, the GNU Library General Public License, applies to certain +designated libraries. This license is quite different from the ordinary +one; be sure to read it in full, and don't assume that anything in it is +the same as in the ordinary license. + + The reason we have a separate public license for some libraries is that +they blur the distinction we usually make between modifying or adding to a +program and simply using it. Linking a program with a library, without +changing the library, is in some sense simply using the library, and is +analogous to running a utility program or application program. However, in +a textual and legal sense, the linked executable is a combined work, a +derivative of the original library, and the ordinary General Public License +treats it as such. + + Because of this blurred distinction, using the ordinary General +Public License for libraries did not effectively promote software +sharing, because most developers did not use the libraries. We +concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the +users of those programs of all benefit from the free status of the +libraries themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while +preserving your freedom as a user of such programs to change the free +libraries that are incorporated in them. (We have not seen how to achieve +this as regards changes in header files, but we have achieved it as regards +changes in the actual functions of the Library.) The hope is that this +will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, while the latter only +works together with the library. + + Note that it is possible for a library to be covered by the ordinary +General Public License rather than by this special one. + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which +contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is +addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also compile or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + c) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + d) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the source code distributed need not include anything that is normally +distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Library General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 000000000..922519eed --- /dev/null +++ b/ChangeLog @@ -0,0 +1,1046 @@ +OSG Change log +============== + + o Added src/osgPlugins/tgz for general tarball models. + o Added src/osgPlugins/zip for general zipped models. + o From Don, src/osgPlugins/osgtgz for a osg tarball models. + dist/Irix for creating IRIX binary distributions. + o Removed redundent NSPlugin and src/Viewer directorties. + o Fixed compilation error in src/osgPlugin/flt under IRIX + related to flt::Record::Record(const Record&):Referenced() {}. + + +6th December 2000 - osg_src-0.8-34.tar.gz + + o To bring the main branch inline with the autoconf branch, and inline + with standard open source conventions, have made the following changes. + + - Copied and doc/index.html to index.html and modified to ref. README + file and new relative paths of the documention. + - Added AUTHORS file. + - Rename and moved doc/CHANGES.txt to ChangeLog, + doc/TODO.txt to TODO, + doc/FAQ.txt to FAQ, + LICENSE to COPYING. + README.txt to README. + + Note, removing the .txt from files means that Windows won't be able to + pick up on the file type automatically. However, they didn't have the + Win32 style end of line conventions so they still wern't much use. By + adding the index.html to the root directory this now allows Win32 users + to browse the relevant files via Netscape or IE which can handle the + unix style text files. I felt this was the best compromise. + + o Added notify messages to osg::Registry::read/writeOject/Node/Image() + for when a plugin for a file extensions hasn't been found and for + when a file hasn't been successfully read. + o Added Axel Volley's UML diagrams to doc/UML. + o Added mind maps on DesignPatterns and MissionState to doc/MindMaps. + o Added new library command line options (see below) into src/Demos/sgv. + o Integrated Graeme Harkness's reworking of src/Viewer into src/osgGLUT + and Demos/sgv. Added Graeme's new Demos/cube which provides a simple + demonstration of animation. + o Added ReaderWriterPFB::readImage() to enable the loading of .pfu images + into the osg, even if .pfb arn't used. Note, you'll need to run the + viewer something like 'sgv -e pfb datfile.osg. + o Added pfMultiprocess(0) to ReaderWriterPFB.cpp. + o Added -W predatic warning option to compilation under Linux, and cleaned + up the headers and source in response. + o Added osg::Image::ensureDimensionsArePowerOfTwo() and a call + to it from osg::Texture::apply() when mip mapped textures are required. + Added packing aligment value to osg::Image, defaulting to 4 if the + image width is a factor of 4, otherwise defaulting to 1. + osg::Texture::apply() now used this osg::Image::_packing value to set + glPixelStorei(); + o Added sgv usage help to Viewer.cpp. Running 'sgv' will now report + the command line options for sgv. Outputs the following : + + usage: + sgv [options] infile1 [infile2 ...] + + options: + -l libraryName - load plugin of name libraryName + i.e. -l osgdb_pfb + Useful for loading reader/writers which can load + other file formats in addition to its extension. + -e extensionName - load reader/wrter plugin for file extension + i.e. -e pfb + Useful short hand for specifying full library name as + done with -l above, as it automatically expands to the + full library name appropriate for each platform. + + o Added command line options -l and -e to Viewer.cpp to assist usage + of plugins which can load more than indicated by their standard + file extension type. See above for details. For instance pfb plugin + can load *many* file formats. + Try 'sgv -e pfb /usr/share/Performer/data/teapot.dxf'. + o From Ben Discoe, added osg::Matrix::setTrans() and getTrans(). + o Moved src/pfPlugin to src/osgPlugins/pfb and added code to enable + the plugin to work with the osg as a plugin in addition to it + previous functionality as a Performer plugin. Creating a link + from lib/osgPlugins/osgdb_pfb.so to lib/libpfosg.so + should be sufficient from Performer to pick up on the library. + Added support for copying image data across from pfTexture to + osg::Image texture and handling of pfMaterial::getColorMode(). + Added to src/osgPlugins/pfbREADEME.txt to documentation some + of the features and issues of the Performer plugin. + o Fixed bug in osg::GeoState related to loading and saving of the + new alpha_test paramter, which wasn't initialised in the osg::GeoState + constructor. + + +22nd December 2000 - osg_src-0.8-33.tar.gz + + o Integated Brede Johansen's update to flt loader. + o Added function osg::getLowerCaseFileExtension() to osg/FileNameUtils, + modifed osg::Registry::createLibraryNameForFile() and + osg::ReaderWriterRGB::readImage() to use this function for correctly + recognising upper case extensions as equivilant to their lower case + counterpart, i.e. .RGB should be interepreted as .rgb. + o Fixed intersection bug which occured of osg:GeoSet's containing + osg::GeoSet::TRIANGLES primitive bug. Bug was due to compilers + incorrectly optimizing a templated function & functor, fixed + by small reordering of the code, works perflectly now?! + o Updated the README.txt with info on the dependancies of the new plugins. + o Created VisualC++ project files for gif,jpeg,tga,tiff image loaders. + o Commented out disabling of depth testing for transparent bin as it + was causing visual artifacts on several models. + + 21st Decemeber 2000 - osg_src-20001221.tar.gz + + o Added an osg::createGeodeForImage(Image* image) method in osg/Image + to create a geometry node around a image so that it can visualised + within the scene without having to create all the required Geode, + GeoSet, GeoState and Texture classes. Added a call to above from + each of the image loaders so that images themselves can be loaded + into sgv... Thereby making sgv an 3D image viewer! + o From Don, added facility in osg::Texture so that if + _min_filter == LINEAR || _min_filter == NEAREST then + create a glTexImate2D, otherwise create a gluBuild2DMipmaps texture. + o From Don, added code to display able depth testing of the transparent + bin in the osgUtil::RenderVisitor:render() method. + + 20th Decemeber 2000 - osg_src-20001220.tar.gz + + o Incorportated the following image loaders from the simage library. + src/osgPlugins/gif + /jpeg + /pic + /tga + /tiff + Note, have only written unix makefile's so far, VisualStudio files need + to be written before the next release. + o Changed osgGetVersion() and osgUtilGetVersion() so that they + return const char* instead of the original float. + o added osg::GeoSet::s/getUseDisplayList(),dirtyDisplayList() and + virtual method drawImmediateMode() which draws primitive without + ever calling or creating a display list. The draw() has been + changed to handle the new _useDisplayList flag so that it + automatically creates a display list if the flag is true and + uses the display list on further calls to draw(). draw() is nolonger + a virtual method and therfore should *not* be overriden, + drawImmediateMode() is now the method to override. This allows + subclasses of osg::GeoSet to automatically take advantage of display + lists. + o From Brede, added option to osgUtil::SceneView to enable the automatic + calculate of near and far planes on each frame to be switched on/off. + o From Kartsen, spelling fixes to comments in Switch and GeoSet. + + + 18th December 2000 - osg_src_20001218.tar.gz + + o Changed the directory structure in preperation for autoconf + integration. + o Converted pf2osg and osg2pf into a libpfosg.so plugin for Performer, + instead of stand alone conversion programs, new pffb plugin can be + found in src/pfPlugin. + o Changed the osg::Material default _colorMode to OFF, and + the global material _colorMode default to AMBIENT_AND_DIFFUSE. + o Added read/write support for interleaved arrays into osg::GeoSet. + + 16th December 2000 - osg_src_20001216.tar.gz + + o Added osg::AlphaFunc state object. + o Added support for osg::AlphaFunc into osg::GeoState. + o Added support for osg::AlphaFunc into flight_park.fly. + o Changed osg::Material::apply() so only required glMaterial's are + called. + o Integrated Don's work on adding glVertexArrays etc to osg::GeoSet. + + 12th December 2000 - osg_src-20001212.tar.gz + + o Integrated Karsten's standardisation of the library header guards. + o Added osg::LightSource node. + o Added get methods to osg::Light. + o Modified osgUtil::RenderVisitor is track osg::LightSource nodes. + o Modified osgUtil::SceneView so that it can handle headlight, + sky light, and no scene view lights for the extra lights it + adds to the scene for viewing. In the later mode only osg::LightSource's + will light the scene. + o Modified Viewer.cpp so that it toggles between the above scene view + lighting modes above using the 'L' key. + o Changed osg::Geode and osg::Group to rely upon ref_ptr<> for memory + management rather the previous mode which required explicit ref and + and unref statements. + o Made osg::GeoSet::draw() and osg::GeoSet::getBound() virtual functions + to allow user-drawn objects. A short term fix only. + + +8th December 2000 - osg_src-0.8-32.tar.gz + + o Added osg::Node::s/getNodeMask() as a fore runner to full implementation + of TraversalMasks. + o Added osg::loadNodeFile(),osg::loadImageFile() and osg::loadObjectFile() + to osg/Registry header, as convienince functions for loading data. + o Added osg::Camera::s/getFieldOfView() methods and split up the + draw method into draw_PROJECTION() and draw_MODELVIEW() methods. + Converted osg::SceneView is use these methods instead own gl calls. + o Added osg::Timer class for high resolution, low overhead time stamping, + converted sgv to use it. Timer class based on Don's real time frame + scheduling library. + o Added extension guards to .rgb reader/writer to prevent it from trying + to load non rgb models. Accepted extensions are rgb,rgba,int,inta & bw. + o Added osg::Node::setUserData(void*,MemoryAdapter*), osg::Node::getUserData() + and osg::Node::getMemoryAdapter() and osg::MemoryAdapter to support user data. + o Added png image file format loader. + o From Ben Discoe: + - updated LOD to use distance squared for evaluating child usage to + remove need to computing sqrt. + - png to osg::Image conversion code. + o From Kartsen Weiss, fixes and improvents to sgv help message. + o From Brede Johansen: + - added osg::Node::setName( const char* name )to get round a crash + under Windows, caused by a VisualC++ bug, which occurs under to + multiple assignment of C style string to C++ strings. + - bug fix for .rgb plug-in to solve problems with some textures + with alpha values. The water tower, fences and fences now render + properly in Performer Town! + o Added osgUtil::SceneView::set/getBackgroundColor() for setting the + background colour used by glClearColor(). + o Added osgUtil::SceneView::projectWindowIntoObject(), + projectWindowXYIntoObject() and projectObjectIntoWindow() to + assist converting to and from window coordinates and object + coordinates. + o Added osg::Image* osg::Texture::getImage() to osg::Texure and + converted it to use ref_ptr for handling the image memory. + Added osg::Texture::getFilter() && getWrap() and seperated out + enum TextureMode into enum WrapParameter & WrapMode, and + FilterParameter & FilterMode. + o Converted osg::GeoSet to use ref_ptr for handling the + geostate memory. + +2nd December 2000 - osg_src-0.8-31.tar.gz + + o Added osgUtil::SceneView to encapsulate the details required to + render a view of a scene - the scene data, light, global geostate, + camera and rendervisitor. + o Cleaned up Viewer/Viewer.h & .cpp to use the new osgUtil::SceneView. + o Integated Brede Johansen's update to flt loader. + o Added .txt extension to README,CHANGES,TODO and FAQ to aid reading + of files under Windows. + o Added osg/Version and osgUtil/Version which provide + external C functions for getting library name and version. + Also can be used by autoconf to check for existance of the + osg and osgUtil libraries. + o Implemented missing osg::Camera::home(); + o Fixed bug in osg::Material::apply() where no texture would + be appear on surfaces on the first frame. glBindTexture was not + being called with the correct parameter on creation of the OpenGL + texture. + o Removed redundent glEnable(GL_LIGHTING) from Viewer.cpp. + o Changed the osg::Light::setDirection(Vec4&) to setDirection(Vec3&). + o From Karsten Weiss : + Comments added to osg::Light and osg::RenderVisitor. + Fixes to make install parts of osg/src/Makefile. + + +28th November 2000 - osg_src-0.8-30.tar.gz + + o Added osg::Object::isSameKindAs(Object* obj) to aid object type + comparions. This allowed osg::Object::readClone(Input& fr) to + be extended to automatically detect 'Use ObjectID' syntax in .osg files, + which fixes errors in reading .osg files saved from some data models + created correctly by the flt loader. + o Integated Brede Johansen's update to flt to handle transparency. + o Commented out the flt::Registry::instance()->removedPrototype() call from RegisterRecordProxy() + flt::RegisterRecordProxy destructor, which was causing a segmentation + fault on exit under Linux due to destruction ordering - gnu c++ doesn't + seem to honour construction/destruction order?! Prior to this 'fix', + did the following changes to clean up memory allocation & + deallocation as an attempt to fix the segmentation fault on exit! + Changed the memory allocation of RegisterRecordProxy children to use + osg::ref_ptr<> for automatic deallocation. Removed the flt::Record::_init(), + _copy() and _free() moving the functionality into the constructor and + destructor to simplify. flt::Record copy operator and copy constructor + made private to prevent misuse. + o Rewrote osg::Material so that it handles both FRONT and BACK + face materials within one class, with support for FRONT_AND_BACK. + o Added two sided lighting toggle to Viewer and NSPlugin. + o Changed the LODBias in Viewer and NSPlugin to 1.0 (previously 2.0). + o Added '#define GL_GLEXT_LEGACY 1' to osg/GL to fix compilation problems + which occur on some implementation of OpenGL under Linux. + +18th Novemeber 2000 - osg_src-0.8-29.tar.gz + + o Integrated Don Burns' Linux Netscape plug-in. + o Added osg::PolygonOffset state attribute. + o Added support for osg::Point and osg::PolygonOffset into osg::GeoState. + o Extended osg::CullFace to encompass which face to cull, i.e + FRONT,BACK or FRONT_AND_BACK, and added IO support. + o Added read/write ascii to osg::Point and osg::PolygonOffset + o From Don, moved light source from above model, to behind eye point + for sgv and the Netscape plug-in. + o Fixed material inheritance bug, by modifing osg::GeoState so that + it now inherits attributes from the global state if they are not + set locally. + o From Brede Johansen, bug fixes in flt loader, setting of externals + and redudent 'dummy' groups in LOD's. + o Changed the default compilation of loaders so that pf2osg and osg2pf + are not compiled by default under Linux or IRIX, ideally the presence + of Performer should be detected automatically and compilation set + accordingly, however this may have to wait for autoconf work. + o Fixed warnings generated by gcc-2.96 in flt,fly,pf2osg and Viewer. + o Changed 'const int' and 'const bool' returns type in Loaders/flt to + 'int' and 'bool' respectively. This fixed silly warnings under IRIX. + o In Loaders/flt changed all cout, cerr and printf's to osg::notify(). + o From Karsten Weiss : + - Updated OSG_ROOT/README to account for sh shells & added contact details. + - Changed variable 'or' to 'ori' in Loaders/fly/base.cpp to enable compilator + under later versions of gnu c++. + - Comments added to BoundingBox, Lighting, CullFace and Quat. + - BoundingBox::contains() bug fixed. + - Changes to remove warnings generated in Loader/flt with gcc-2.96. + o Updated FAQ. + o Updated OSG_ROOT/README with contact details. + o Changed osg::Registry and flt::Registry to use ref_ptr<> to automatically + handle attached prototypes memory usage. + o Removed flt/Referenced.h and replaced flt::Referenced with osg::Referenced. + o Removed vnf loader is it was only a to help import a single file from + an now out of date format, its existance was clogging up the distribution. + +10th November 2000 - osg_src-0.8-28.tar.gz + + o Added Brede Johansen .flt loader. + o Integrated Neil Salter's new implementation of osg::notify() which + uses a NotifyInit class with a 'nifty' counter to ensure construction. + o Changed osg::TexEnv,TexMat,Fog,Point,Transparency & Material so that + they area all derived from osg::Object. All state components are + now derived from osg::Object. + o Changed osg::GeoState::setAttribute(..) and getAttribute() methods + so that they deal with osg::Object's rather than void*. + o Changed osg::GeoState so that it uses ref_ptr<> to automatically + manage attribute memory whilst supporting attribute sharing. + o Added to osg::ref_ptr<> extra operators =,==,!= & a valid() method. + o Added osg::Point which enables control of OpenGL point size. + o Added osg::ExtensionSupported which allows the querring of + support for OpenGL extensions. + o Changed the default global lighting mode to ON in sgv. + o Changed the toggling bahviour in sgv between lighting and texture + ON and OFF, new behaviour should be more consistent. + +6th November 2000 - osg_src-0.8-27.tar.gz + + o Added option in osgUtil::FlightManipulator for automatically yawing + the camera into the bank, and made it the default operation. + o Changed the implementation of osg::notify() to default to simply + cout for all platforms, rather than just Windows. This is a + temporary measure to fix the crashes under IRIX and Linux. + Work is underway to provide a robust implementation of osg::notify(). + o Added Neil Salter's Doxyfile makefile to docs/ for generating Doxygen + documetation. + o Changed the #define's in include/osg/Transparency to enumerated + types and removed the SGTRANSPARENCY_ prefix as its now within + the scope of the Transparency class itself. + o Changed the #define's in include/osg/TexEnv to enumerated + types and removed the SGTEXENV_MODE_ prefix as its now within + the scope of the TexEnv class itself. + o Changed the #define's in include/osg/TexGen to enumerated + types and removed the SGTEXGEN_ prefix as its now within + the scope of the TexGen class itself. + o Changed the #define's in include/osg/Material to enumerated + types and removed the SGMAT_ prefix as its now within + the scope of the Material class itself. + o Changed the #define's in include/osg/Fog to enumerated + types and removed the FOG_ prefix as its now within + the scope of the Fog class itself. + o Changed the #define MIN_CACHE_SIZE in include/osg/Field to enumerated + type, therefore keeping it within the Field's scope. + o Changed the #define MINIMUM_FIELD_READER_QUEUE_SIZE in include/osg/ + FieldReaderIteraor to enumerated type, therefore keeping it within + the FieldReaderIterator's scope. + +3rd November 2000 - osg_src-0.8-26.tar.gz + + o Removed the GSET_ prefix from the osg::GeoSet enumerated types as + its no longer required, since the enumerated types are within the + osg::GeoSet's scope. + o Added osg::notify() function for redirecting messages either to + stdout or stderr (cout or cerr) or /usr/tmp/osg.info, depending upon + the severity level set. The environmental variable OSGNOTIFYLEVEL can + be set to overide the default level which is osg::NOTICE. + See include/osg/Notify for more details of the levels available. + Current implementation only works under Linux and IRIX, under Windows + the output is simply directed to cout. + o In osgUtil::DriveManipulator added the option to use the mouse y poistion + to govern the speed in addition to the previous left button to speed up, + right button to slow down/reverse. The two modes can be toggled by pressing + 'q' and 'a' respectively. Default is using the mouse y position for speed. + o Changed osgUtil::TrackballManipulator so that it supports proper + trackball style manipulation. + o Added a zoom limit to the osgUtil::TrackballManipulator to prevent + the user from zooming into a point. Under this limit the zoom + operation nolonger zooms in but pushes the eye and look points + forward down the look vector, keeping the distance constant. + o Added osg::Camera::getLookVector() and osg::Camera::getFocalDistance() + methods. + o Added osgUtil::DriveManipulator. + o Renamed osgUtil::GUIUpdateState to osgUtill::GUIActionAdapter + and moved it to its own file. + o Fixed bug in osgUtil::IntersectVisitor related to reference counting + and NULL object. + o Added osgUtil::FlightManipulator. + o Modified sgv to enable support for multiple camera manipulators. + o Added resize event and window min and max to osgUtil::GUIEventAdapter. + o Added resize event and window min and max to GLUTEventAdapter. + +27th October 2000 - osg_src-0.8-25.tar.gz + + o Added support for string descriptions to be added to osg::Node's, + which can be saved and loaded via .osg data file. + o Fixed bugs in osg::FieldReaderIterator & osg::GeoSet related to the + osg::FieldReaderIterator::matchSequence() method, detected when + implementing string descripters IO. + o Modified osg::Light so its derives from osg::Object. + o Added osg::Matrix::preScale(),postScale() methods. + o Added methods to osgUtil::CameraManipulator. + o Added osgUtil::GUIEventAdapter::time() to log the time of an event. + o Rewrote osgUtil::GUIUpdateState so it now based on virtual functions. + o Implementated trackball functionality in osgUtil::TrackballManipulator. + o Ported sgv over to use new osgUtil::CameraManipulator rather than + old trackball functionality, removed original trackball code. + o Changed the frame delay in sgv to default to off, pressing '-' + turns the frame delay on, then successively slow sgv down, pressing + '+' reduces the frame delay again until it turns off as before. + o Added matrix multiplication methods into osg::Camera, and added + method for calculating the side vector of the camera. + o Added methods to osgUtil::CameraManipulator to extend the + functionality which can be exposed to users of a generic camera + maniupluator. + o Added osgUtil::RenderVisitor::setLookAt(const Camera&) method + to make it convinient to use camera's with the render visitor. + o From Don, added Unix Makefile support for make install, instlinks, + home and automatic detection of OS type. Changed target lib directory + for loader plug-in to lib/OSGLoaders. + o Added /usr/lib{32}/OSGLoaders DSO search path for and to prepend + file name with "OSGLoaders/" if the standard search fails. + o Renamed osgUtil::GUIEventAdaptor to osgUtil::GUIEventAdapter. + o Renamed osg::RP<> to osg::ref_ptr<> to make it clearer its + usage and to be more consistent with STL's auto_ptr<>. + o Added osgUtil::CompileGeoSetsVisitor, original existed in sgv. + o Changed the osg::GeoSet::compile() method so that it calls + the GeoSet's GeoState apply method before creating the + OpenGL Display List. Note, the state is still NOT compiled + into the Display List. This improves performance significantly + when running the program remotely. + o Cleaned up the methods in osgUtil::CameraManipulator. + o Added support for returning intersection normals from + osgUtil::IntersectVisitor. + +20th October 2000 - osg_src-0.8-24.tar.gz + + o With assistance for Simon Cooke and Brede Johansen added support + for relative include, lib and bin paths into the VisualStudio + workspace files. + o Changed the link to glut from glut.lib to glut32.lib in VisualStudio + workspace files. + o Updated the root READE to reflect the simplified Windows compilation. + o Added support for osg::GeoState into osg::Scene. + o Added osg::Quat::get(Matrix&) & osg::Quat::set(Matrix&) into osg::Quat, + submission from Brede Johansen, orginal source from gamasutra.com. + o Fixed crash in osgUtil::RenderVisitor::reset(), caused by an + unguarded ptr->unref(). + o Added -Wall to Linux makedefs, and fixed resultant warnings. + o Added preliminary interfaces to osgUtil::GUIEventAdaptor, + osgUtil::GUIUpdateState and base class osgUtil::CameraManipulator. + +14th October 2000 - osg_src-0.8-23.tar.gz + + o Updated the root README file to mention the Data download, + the dependancies (i.e GLUT) and slightly clearer Win32 + instructions. + o Added == operator into osg::Vec2, osg::Vec3 and osg::Vec4. + o Removed float* and const float* conversion operators from + osg::Vec2, osg::Vec3 and osg::Vec4. + o Added Neil Salter's osgUtil work on camera manipulators into + the osg distribution under include/osgUtil and src/osgUtil and + moved the original src directory to src/osg. Modified Linux + and IRIX makefile to account for new library and structure. + o Moved osgUtil::Camera into osg::Camera. + o Moved osg::RenderVisitor and osg::IntersectVisitor into + osgUtil:: RenderVisitor and osgUtil::IntersectVisitor. + o Added osgUtil/Export into osgUtil to handle DLL's under Windows. + o Modified Viewer.cpp to take account of the new osgUtil + library and placement of RenderVisitor and IntersectVisitor. + +7th October 2000 - osg_src-0.8-22.tar.gz + + o Fixed crash under Windows when activating the osg::IntersectVisitor + in the scene graph viewer sgv. Bug appears to be an MS Visual C++ + bug when using a std::multiset iterator and combining std::map and + std::multiset. Replacing the later by a std::vector has curred the + problem, but also required an explicit sort on the vector in + osg::IteratorVisitor::intersect() to achieve the desired functionality. + o Fixed the use of gluUnproject() in Viewer.cpp so that it properly + resolved the difference in window coordinates between GLUT mouse + position which origin is top left, and OpenGL which is bottom left. + This fixed picking problems apparent under previous release. + o Cleaned up the intersection messages and added timing code to report + the length of time required for the osg::IntersectVisitor to traverse + the scene. + o Added '-OPT:Olimit=0' compile flag to IRIX makedefs to allow large + methods, such as the osg::for_each_triangle() template function, + to be optimised. + o Streamlined the intersect code a little, improving performance by + around 20% over previous release. + + +5th October 2000 - osg_src-0.8-21.tar.gz + + o Added support for shooting a ray through the scene in Viewer.cpp, + by pressing 'i' a ray is shot from the mouse position projected onto + the near and far plane into the scene reporting back the hit objects, + uses the new osg::IntersectVisitor. Note, results are not 100% + reliable yet, to be worked on. + o Completed first iteration of osg::IntersectVisitor. + Visitor allows the intersection of specified segment with the scene, + reporting back node path to intersected geoset's and intersection + point and object to world transformation. + o Added templated function osg::for_each_triangle() to include/osg/GeoSet + which allows a functor to iterated through all triangles within a + osg::GeoSet. The function decomposses quads and polygons into triangles. + o Added osg::Node::getParent(), getParents() and getNumParents() to + osg::Node to allow public access to parent list. + o Added more doc++ comments to osg::Node & osg::Object. + +21st September 2000 - osg_src-0.8-20.tar.gz + + o Added new osg::Seg class for representing a single line segment, + providing methods for intersecting with BoundingSpheres, BoundingBoxes + and triangles(not implemented yet), and for transforming the segment. + Typical use is for ray based intersections of the scene. + o Added the beginnings of a new osg::IntersectVisitor for traversing + a scene to find the intersection of attached osg::Seg's with osg::GeoSet's. + osg::Seg and osg::IntersectVisitor should be completed for the next release. + o Added !operator to osg::RP<> and made osg::RP<>::get() const. + o Moved osg::BoundingBox from osg/Types to its own osg/BoundingBox + and added default constructor which initializes it to an invalid + bounding box (by setting xMaxxMax and other useful methods for + accessing and updating the bounding box. Changed the internal + representation from eight floats to two osg::Vec3 one each for + min and max values. + o Moved osg::BoundingSphere from osg/Types to its own osg/BoundingSphere + and added default constructor which initializes it to an invalid + bounding sphere (by setting radius<0), added isValid() method which + returns true if radius is zero or positive and other useful methods + for accessing and updating the bounding sphere. + o Modified osg::Node so that getBound() return a reference to the + internal node's BoundingSphere (which could be invalid), rather + than the previous version which required the passing of BoundingSphere + which was written to if there was a valid bounding box. This + new implementation is more efficient (less copying of data) and more + convenient to work with. + o Added culling active flags into osg::RenderVisitor and Viewer.cpp, + to allow view frustum and small feature culling to be switched on + and off at run-time, using 'C' and 'c' to toggle each culling technique + repsectively. + + +15th September 2000 - osg_src-0.8-19.tar.gz + + o Added osg::RenderVisitor::setTransparencySortMode() to allow two + modes of depth sorting the transparency bin - the original + implementation is set with LOOK_VECTOR_DISTANCE and new + implementation OBJECT_EYE_POINT_DISTANCE. The osg::RenderVisitor::apply + methods have been modified to support both modes. The later produces + better results when rendering billboards such a trees. + o Added osg::RenderVisitor::calcNearFar(double& near,double& far), to + be called after the cull traversal, which goes through the resultant + opaque and transparent binds for their depth range. Returns false + if the bins are empty and near and far planes cannot be set, true on + success. The near and far plane can then be used when setting OpenGL's + near and far planes. The near plane is return as is and may be zero or + negative and therefore will need to be clamped by the calling function + if the using gluPerpsective() when setting up the OpenGL projection + matrix. This clamping will not be required when use gluOrtho(). + o Viewing.cpp has been modified to support the new calcNearFar method, + and does the required clamping to capture invalid values. This has + solved problems with Z fighting which existed before on models such + as Tux_rocket.osg. + o Added project file VisualStudio/libFly/libFly.dsp to support the .fly + loader plug-in. Modified several of the .cpp & .h files in + Loaders/fly to enable compilation under Win32 and to remove the + resulting 'double to float conversion' warnings under Win32. + o Improved support for plug-ins under Win32 by adding the environmental + variable PATH to the search path used for located the required .dll. + o Modified osg::Registry::createLibraryNameForExt so that under Win32 + the when linking to the debug build of the osg library (osgd.dll) + the debug build of the plug-in is also sought (for instance osg_flyd.dll). + When using the release build of the osg library (osg.dll) it will + default to using the release build of the plug-in (i.e. osg_fly.dll). + Mixing debug and release builds under Win32 causes problems with + the osg::Registry - producing two or more versions of the singleton! + This is a appears to be MS linker bug as its does not resolve the symbols + correctly between debug and release builds **!! + o To README added example autoexect.bat extract for a helping Windows + users getting up and running. + +7th September 2000 - osg_src-0.8-18.tar.gz + + o Implemented a parent list for osg::Node to allow nodes to keep + track of their parents. The links to their parents are automatically + managed osg::Group::addChild() and removeChild() and destructor. + o Added osg::Node::ascend(NodeVisitor&) which traverses the nodes + parent list applying the node visitor to each node in turn. This + is equivalent to osg::Node::traverse(NodeVisitor&), but typically + won't need to be overridden like traverse() is. + o Added support for parent traversal into osg::NodeVisitor so that + scenes can be traversed upwards as well as the traditional top + down traversal. This is useful for propagating changes of leaf + and internal nodes upto their parents which enclose them. + o Added osg::Node::dirtyBound() method which set the _bound_computed + flag to zero so that the next osg::getBound() is forced to recompute + the bounding sphere. + o Added support into osg::DCS for calling dirtyBound() recursively + up the nodes parent paths. This fixes the report view frustum + culling bug when viewing Torus.osg. + o Changed the #define is osg::Texture to enum TextureMode. + o Removed the SGTEX_ prefix from osg::Texture::TextureMode's. + o Removed the SGSTATE_ prefix from osg::GeoState::AttributeType + and osg::GeoState::AttributeType. + +4th September 2000 - osg_src-0.8-17.tar.gz + + o Changed osg::Sequence so it derives from osg::Group rather than + osg::Switch. + o Improved the support for pfSwith in the Performer converter pf2osg. + o Changed osg::Node so that the node name _name is now a std::string + rather than a C style char* string. This clears up a problem with + osg:::Node::setName which was erronously handling the freeing of mememory. + o Changed Loader/osg2pf.cpp and Viewier/Viewer.cpp inlight of the + change to std::string name in osg::Node. + o Fixed (again?!) compilation problem on Irix (missing osg:: in + Loaders/osg2pf.) + o Fixed a bug in Viewer.cpp related to loading multiple files, which + resulted in sgv viewing an empty model. + + +3rd September 2000 - osg_src-0.8-16.tar.gz + + o Fixed compilation problem on Irix (missing osg:: in Loaders/osg2pf.) + o Basic Implemention of small feature culling in osg::RenderVisitor, based + on culling objects with small screen size projected into the + viewport. + o Added support for Don Burns real-time frame schedualer into sgv. + To compile the viewer with Don's library RTfs use the + Viewer/Makefile.rtfs which links with the appropriate libraries + and define's SGV_USE_RTFS which is now used in Viewer.cpp to + utilise the frame rate schedualing. + o Changed osg::Light::init() so that it set the internal variables + to predefined constants rather than capturing the values from + the current OpenGL state as done previously. The previous versions + of osg::Light needed to be constructed in a valid current context. + The capturing of the current OpenGL light state can now done with + a new method osg::Light::captureLightState(). + o Added osg::Image::scaleImage(int s,int t,int r) which uses + gluScaleImage to scale up/down the image. Useful for scaling down + images for graphics cards which can not handle large images, such + as the Voodoo1,2 & 3. + + +27th August 2000 - osg_src-0.8-15.tar.gz + + o Implemented osg::Switch node with similar functionality to performer, + allowing all, none or a single child to be selected. + o From Graeme, ostream << operator's added to osg::Vec2/3/4 and osg::Quat. + o From Graeme, Added osg::Qauat::makeRot which creates a rotation Quat + which will rotate vec1 to vec2. + o Fixed some of the /// comments on osg::Quat so that doc++ handles it + better as it doesn't seem to like multi-line usage of ///. + o Fixed compilation problem on Windows with GeoSet.cpp - required + the inclusion of to handle the use of FLT_MAX. + +25th August 2000 - osg_src-0.8-14.tar.gz + + o Implemented basic view frustum in the render visitor. + Performance is now pretty close to Performer on Performer + town on the Onyx2. + o Modified the iostream includes so that the .h versions + can be included by defining OSG_USE_IO_DOT_H, or by default + includes the standard C++ version without the .h. + + +21st August 2000 - osg_src-0.8-13.tar.gz + + o Removed old converter code in OSG.cpp as its is now enterirly replaced + by functionality in osg::Registry and osg::DynamicLibrary. + o Added support for '/' and '*' keys into sgv for altering the LOD bias. + o Added support for '?' key into sgv for printing out help. + o Added support for 'o' key into sgv for output scene to "saved_model.osg". + o Small improvements to osg2pf, now can handle normals. + o Added osg::GeoState::getMode and osg::GeoState::getAttribute() methods. + o Fixed compilation problem under Irix in sgv.cpp. + o Fixed compilation problems under Windows. + o Added new models Data/esprit.osg and Data/paraglider.osg. + o Re-exported Cow.osg, Tux.osg and Tux_rocket.osg from Performer, + correcting artifacts relating to state inheritance in the previous + .osg models. + o Removed Loaders/osg as it was only there to illustrate how to write and + reader/writer library (as loading functionalilty is is already built + into libosg.so.) Loaders/fly and Loaders/vnf both serve the purpose + of illustrating read/writer functionality, making Loaders/osg redundent. + +17th August 2000 - osg_src-0.8-12.tar.gz + + o Fixed a bug with the CompileGeoSets visitor in Viewer.cpp where + the visitor was not using the new traversal conventions. The + bug ment that 0.8-11 would have only compiled OpenGL display list + for the first child of an LOD, Switch and Sequence and leave the + rest to be rendered without display lists. This fix now allows + all osg::GeoSet to be visited and display lists compiled - which + should improve performance on systems where display list are + important. + o Implemented a *very* basic view frustum culling to get a handle + on the potential performance improvements. I've added the ability + cull objects wholely behind the eye point. This is clearly much + less powerful at culling than proper view frustum culling but is + much quicker to implement. Performance improvement is _non_existant_ + through to *AMAZING*. On lowly PI233 & TNT Linux box I'm now + getting 5 frames a sec when viewering the whole model, through + to 6-8 frames a sec looking close up to the town to 40-50 frames + when looking at the out-lying farms and mountains. Full view + frustum culling promises even better results! + +16th August 2000 - osg_src_0.8-11.tar.gz + + o Completed basic LOD functionality in osg:LOD and osg::RenderVisitor. + o Modified Performer to OSG converter to handle LOD's. + o Added a templated function write out arrays of data to osg::Output, + while enable multiple values to written out on each line, defaulting + to 10 values per line. + o Modified osg::GeoSet to use enabling duplicated code to be removed + and the .osg file format to be more compact virtual of the multiple + values values per line. + o Added the ablity to chain osg::NodeVisitor's together to enable + user defined traversers to be used in preferences to the standard + osg::Node::traverse(). + o Added a traversal mode to osg::NodeVisitor to enable osg::Node::traverse() + to distingush whether to traverse all children or only those which are + active such as when traversing a switch or sequence. + +10th August 2000 - osg_src_0.8-10.tar.gz + + o Further work of the OSG to Performer converter osg2pf. Can now + convert basic geometry. + o Fixed the osg::Billboard::computeBound() so it accounts for the + billboard positions correctly. + o Fixed a memory deallocation problem in RenderVisitor which caused + a serious memory leak which would eventually grind the system to + a halt on big models. + o Added support for a global osg::GeoState into Viewer.cpp and + osg::GeoState, also add the ability to overide local state modes + with the global state, or inherit the local state from the + global state. This enables the sgv keys 't' and 'l' to work + as would as one would expect. + o Created a new method osg::GeoState::apply(GeoState* global,GeoState* prev) + which takes the previously applied GeoState and then only applies the + differences. This is crude step to mimic the pushState and popState in + Performer's pfState class - but does achieve the lazy state updating. This + just a short term step, but does give some healthy performance improvements + - the old way produced a draw time of ~42ms on Performer town, with + the new lazy updating of state the draw time is ~25ms (on a Onyx2 IR.) + This is the about same draw time as Perfly when culling is + switched off. Enabling culling in Perfly more than halves the + draw time. + o Modified osg::Billboard::calcTransform() & calcRotation() to do the + hand coded maths calculations rather than using generic osg::Matrix + operations to do it. This has cut the cull traversal down for 16ms to + 12ms. Combined with the new lazy state updating frame rates on + Performer town now hits 24 frames a second. + o Added data access methods to osg::GeoSet and osg::Referenced. + +7th August 2000 - osg_src-0.8-09.tar.gz + + o Added some temporary timing code to Viewer to reveal rendering + bottle necks. + o Modified osg::RenderVisitor so it handles osg::Billboards more + efficiently by storing the inverse matrix stack in sync with the + current matrix stack. + o Changed Make/makedefs.linux and Make/makedefs.irix to use -O2 + instead of the previous -g setting. This speeds up the cull + traversal by 2-3 times. + +5th August 2000 - osg_src-0.8-08.tar.gz + + o Fixed build problems under Windows. + o Added basic support for pfLOD,pfSwitch and pfSequence into pf2osg. + o Implemented osg::Switch and osg::LOD to just traverse their first + child rather than all their children as osg::Group does. This is + a temporary measure to get round the lack of full implementations + of osg::Switch and osg::LOD. + o Added osg::Sequence basic interface, core functionality remains + to be implemented. + +3rd August 2000 - osg_src-0.8-07.tar.gz + + o Added osg/FileNameUtils which is a collection of useful functions + for parsing filenames. + o Further work on the Performer converter pf2osg, now can load + most models from the Performer distribution, including Performer + town. Performance with sgv compares well with perfly on most + models but Performer town is significantly slower than with + perfly (5fps vs 50fps on a Onyx2 IR). It looks like the OSG + current simplicistic state management needs a revamp to get + performance up where it belongs... This is will be done in + the near future. + o Added support for flat shaded primtives into osg::GeoSet as per + pfGeoSet, this was required to bring across several key peformer + models such as Performer town. + o Added bare bones of an OSG to Performer conversion program, + osg2pf under Loaders/osg2pf. + o Modified osg::Node so that it saves and loads its name if it has + one. + +28th July 2000 - osg-0.8-06.tar.gz + + o Futher work on Performer converter pf2osg. + o Bug fixes to osg::GeoSet revealled by the Performer work. + +26th July 2000 - osg-0.8-05.tar.gz + + o Added support for osg::Object sharing in the reading and writing of + the .osg format. This enables a MASSIVE speed up on models which + can share GeoState's. Expect order of magnitude of speed up on + models such as /usr/share/Performer/data/iris.flt (from the Performer + distribution and converted using the new pf2osg converter. + o Added support of pfObject sharing in the Performer converter, taking + advantage on the above. + o Bug fixes to the writing of osg::GeoSet's to .osg files. + +19th July 2000 - osg-0.8-04.tar.gz + + o Due to problems with integrating Performer as plug-in on Linux, + have converted it to work as a conversion program - now called + pf2osg and can be found in Loaders/pfb. + +5th July 2000 - osg-0.8-03.tar.gz + + o Bugs fixes to support in osg::GeoSet for normal, colour + and texture coordinate binding, and modified the .osg + ascii format to reflect this. + o Added glMaterialColor() to Viewer/Viewer.cpp to enable + colors to be activated on osg::GeoSet's. Without it + untextured models would turn only be coloured by + current glMaterial rather than the current glColor. + o Moved the compilation of the display lists from the init + stage into the draw function, as the requests to glGenLists + was failing within the Viewing::init's glContext. glDisplay + lists are now created correctly with a nice improvement in + speed :-) + +4th July 2000 - osg-0.8-02.tar.gz + + o new version numbering scheme to be consistent with the + RedHat scheme - ie. ProjectName-Version-Release. The + current alpah release has been assigned as version 0.8, + and the release number 02 reflecting this is the second + release under the new scheme (alot can happen in day:-) + o Support for RedHat RPM distributions has been added, and + can be found in OpenSceneGraph-0.8/dist/RedHatRPM. + o Further work on the Peformer loader, which can now read + in pfGroup,pfDCS,pfGeode, pfGeoSet and small bit of + pfGeoState/pfMaterial. + o Improved the support in osg::GeoSet for normal, colour + and texture coordinate binding, and modified the .osg + ascii format to reflect this. + o All .osg ascii files in Data were updated to reflect + the new binding information. + +3rd July 2000 - osg_src_20000703.tar.gz + + o Changed the return types for several of the operators in osg::Vec2/3/4. + o Further work on osg::Billboard. + o Further work on Loader/pfb. + +27th June 2000 - osg_src_20000627.tar.gz + + o Added make snapsrc and make snapdata to the root Makefile to + allow smaller source only and data only distributions. + o Completed Billboard::Mode::AXIAL_ROT functionalilty which fits + the case of billboarded trees, POINT_ROT_EYE and POINT_ROT_WORLD + left to complete. + o Removed the reference to Image library in pfb Makefile which caused + the build of the Performer loader to break under linux. + +26th June 2000 - osg_20000626.tar.gz + + o Added the Don Burns' hang gliding flight simulator database + loader example into distribtion under Loader/fly. The data + file used to select which components of the database to load + has been added as Data/flight_park.fly. The scene can be + loaded in the standard way i.e. "sgv flight_park.fly" + o Created the beginings of a Performer .pfb loader. The work is + ongoing, the first signs of life can be found in Loaders/pfb. + o Continued work on osg::Registry related to dynamic loading + of Reader/Writer plug-ins, its now works as intended! + o Continued work on the new osg::Billboard class, completing the + class interface and saving and loading functions. Calculation + of the rotation matrix used to orientate the billboard towards + the eye point is final element left to implement - coming soon! + o Added support for osg::Billboard into osg::RenderVisitor. + o Fixed a bug in osg::RenderVisitor::pushMatrix() relating to + pre/post multiplication of matrices. + o Changed the * operator in osg::Matrix to return a osg::Matrix + rather than a osg::Matrix*. + +20th June 2000 - osg_20000620.tar.gz + + o Fixed Irix compile problems related to missging std:: from use of + std library strings in Loaders/Osg/osg.cpp on Irix. + o Fixed crash in sgv due to Loaders/Osg/osg.cpp using the same static + variable name as src/ReaderWriterOSG.cpp. + o Removed temporary code (from osg_20000619) in Viewer.cpp which was + used for testing loading and closing at runtime of dynamic libraries + (plug-ins). + +19th June 2000 - osg_20000619.tar.gz + + o New osg::Vec2, Vec3 and Vec4 have been written and placed in individual + header files, replacing original typdef float[] versions in osg/Types. + The new Vec classes now add a range maths operations with them such + as multiplication, dot and cross product. + o New osg::DynamicLibrary class has been written to encapsulate the loading + and closing of dynamic libraries across different platforms with one + consistent interface. + o osg::DynamicLibrary support has been added to osg::Registry, + not fully implemented yet, but will soon replace the old style dso + support seen in osg/OSG.cpp. + o osg::Registry, osg::RegisterReaderWriterProxy, + osg::RegisterObjectProxy, have all been modified to support the + removal of automatically deleted Prototypes and ReaderWriters from + the Registry. Automatic deletion occurs when a dynamic library is + closed - the proxies now deregister themselves when this happens + ensuring that these deleted objects are never referenced. + This facility enables reader/writer plug-ins to be loaded when + needed then closed to free up the space again, all at run-time. + o Renamed include/osg/ReferencedPointer to include/osg/Referenced to + reflect the main class it defines. + +6th June 20000 - osg_20000606.tar.gz + + o Modified the root Makefile so that it can target linux or irix + compilation directly by copying the appropriate makerules/makedefs. + README now reflects the simplified make. + o Changed the names of Make/makedefs.sgi and Make/makedefs.sgi + to Make/makedefs.irix and Make/makedefs.irix to make it more + consistent and allow for sgi's new Linux boxes:-) + +29th May 20000 - osg_20000529.tar.gz + + o Added clean up of 'so_locations' & 'ii_files' into sgi build rules. + o Fixed compilation problems due to shortcomming of MicroSoft C++ 6.0 + when handling static const's declared within the scope of class. + Have changed to #define, less C++ but works... + +28th May 20000 - osg_20000528.tar.gz + + o Moved the doc directory to docs to be consistent with other Open Source + software projects. + o Created osg::Billboard class, currently only 1/3rd complete. + o Implemented the .osg ASCCII file read and write methods for osg::DCS. + o Moved defines & enums which were in the osg global namespace into the + classes they are associated (this has now broken the Win32 - + currently investigating.) + o Removed the virtual int osg::Node::classType() function as its + function is better served by RTTI such as dynamic_cast<>. + o Added automatic register proxy to osg::Scene so it properly + registers itself with osg::Registry. + o Added shell of the osg::LOD and osg::Switch classes which will + be implemented fully at a later date. + o Changed a cout to printf in src/Registry.cpp to fix a dumb + crash under Win32 - MicroSoft still can't write decent compilers... + o Modified several library class so that they use the convention of + _variableName for class member variables, these classes were + developed before the the above convention was adopted as standard. + o Fixed bug in Geoset_osg.cpp related to GL Display Lists. + o Merged file_p.cpp into file.cpp files and removed file_p.cpp + exept for GeoSet_p.cpp which was kepth seperate due to its size. + GeoSet_p.cpp has been renamed GeoSet_ogl.cpp to reflect its primary + function. + +25th May 2000 - osg_20000525.tar.gz + + o Changed library header files in include/osg/ from C style .h + to the new Standard C++ style without suffix. For instance + include/osg/Node.h has become include/osg/Node. + o Moved all osg::Branch functionality to osg::Group, and removed + osg::Branch. + o Changes to src/*.cpp, Viewer/* and Loaders/Osg/* to account for + the above header and osg::Group changs. + o Fixed some inappropriate permission in the data directory. + +22nd May 2000 - osg_20000522.tar.gz + + o Added to the FAQ. + o Added more functionality to the osg::Matrix. + o Incorportated makedefs.sgi fix to handle .cpp extensions. + +16th May 2000 - osg_20000516.tar.gz + + o Added more doc++ comments to headers file. + +14th May 2000 - osg_20000514.tar.gz + + o moved .cxx extensions to .cpp. + o removed sg prefix from all library files and class as they were + redudent virtue of the new osg namespace. + o changed the include/OSG to include/osg to keep it consistent with + library and namespace capitilization. + o added osg namespace it the remaining classes which were missed the + first time round! + o add first iteration of the FAQ. + o fixed the permission of files - many incorrectly had executable + permissions. + +9th May 2000 - osg_20000509.tar.gz + + o reduced the STL platform specific #ifdef's. + o remove using namespace from all header files, so not to pollute user space. + +8th May 2000 - osg_20000508.tar.gz + + o osg namespace implemented. + +6th May 2000 - osg_20000506.tar.gz + + o Added CHANGES list for logging changes from version to version. + o Added TODO list for list desired functionality and development activity. + o Beautified the code using bcpp. + +2nd May 2000 - osg_20000502.tar.gz + + Release first alpha version, compiles under Windows95, Linux and Irix, + distribtion includes : + + o unix makefiles for Linux, Irix and Win32 via MS VC++6.0 workspace files. + o basic GLUT based scene graph viewer - sgv. + o basic Scene Graph nodes, such as sgBranch, sgGeode. + o basic Drawing primitive and state containers GeoSet and GeoState. + o basic Maths/Geometry classes such as sgMatrix, sgVec2/3/4. + o refence counting and smart pointers via sgReferenced and sgRP<> classes. + o support for automatic object registration with sgRegistry. + o support for automatic reader writer plug-ins with sgReaderWriter/sgRegistry. + o input parsing classes sgField,sgFieldReader. + o .osg ascii file reader/writer. + o .rgb/.rgba (sgi format) images reader. + o automatically generated documention from header files using doc++. diff --git a/FAQ b/FAQ new file mode 100644 index 000000000..51e23ddab --- /dev/null +++ b/FAQ @@ -0,0 +1,345 @@ +o API's feature set + + - scene graph based? + + The scene graph is arranged with geometry nodes (osg::Geode's) as leaf + nodes and internal nodes such as osg::DCS's/Groups/LOD etc for position the + geometry objects within the scene and organising scene behaviour. + + - culling techniques? + + Currently view frustum culling, small feature culling, and OpenGL's + native backface culling. The OSG has been designed so it can be + easily extended, so if you have a favoured culling technique it + won't be difficult to utilise it in the OSG. + + - terrain / indoor support + + The osg::GeoSet encapsulates all the main OpenGL drawing primitive + so its possible to represent pretty well anything you can with straight + OpenGL including terrain and room objects and characters. More + details below. + + However, if you wish to take advantage of specific optimization such + as adaptive meshing such as ROAM, or procedural culling such as when + entering a room or when racing round a track then the OSG's could be + easily extend to achieve this. + + These features are not currently on the todo list for version 1.0 as + we intend to keep the OSG focused on the core scene graph. However, + you're more than welcome to take on the challenge yourself. + + - etc, etc (the viz sim capabilities of it) + + Key features of OpenGL are encapsulated such as Points, Lines, Triangle + and Quad Meshed primitives in osg::GeoSet, and Textures, Projected & + Environmental Textures, Transparency etc. in osg::GeoState. + + The osgUtil::RenderVisitor currently implements the cull/draw traversal + placing objects to be rendered in either a transparency bin or a + opaque bin. The transparent bin is depth sorting w.r.t to the eye point + to ensure transparent objects appear correctly. The opaque bin + is sorted w.r.t to their osg::GeoState to minimize OpenGL state changes + to avoid cache misses in the rendering pipeline. + + osg::Billboards can be used for rendering trees, or even particle + effects such a smoke, snow, explosions etc. + + +o What is the design philosophy behind the OSG. + + (An extract from an email from Don Burns beginnings of the OSG.) + + Thought I'd jot a couple of thoughts down regarding OSG. A full + simulation package should really be made up of four parts: + + - Scene Graph + - Traversers (App, Cull, Draw) + - An MP harness + - Channel configuration + + The Scene Graph is just that. It manages a tree structure of different + node types that allow management over the behaviour of graphical + objects. The Traversers allow us to use the scene graph to render + scenes in the most efficient manner, as well as providing maximum + functionality for a real-time simulation. The stages are (taken from + the Performer approach) : + + App - This is the application part of the simulation that interfaces + with the outside world, that is control devices, pilot input, animation + engines, effects, event engines, etc, etc (there's much more). This is + also the stage that determines what the viewpoint is and consequently + the viewing frustum. App does a full traversal of the scene graph, + calling callbacks that may be attached to nodes. + + Cull - This stage takes the information that has been updated by App + (mainly the viewing frustum) and effects a cull of all objects, based on + trivial accept or reject based on whether the bounds are contained in + the viewing frustum or not. Every node should have a bound associated + with it reflecting the bounds of all children under it. This way, Cull + can quickly prune a large section of the scene graph, during traversal. + It also implies that scene graphs should be organized spatially, such + that groups of objects that are close to each other should also be close + to each other on the scene graph. During traversal, Cull gathers all + leaf nodes that wind up being trivially accepted and creates a display + list of geosets with their geostates. These are then sorted by + geostate, binning things like states that contain transparencies, and + need to be sorted back to front and drawn last. Cull can also perform + accepts/rejects of geosets based on their bounding boxes. Note that + geosets have bounding boxes and geodes have bounding spheres. This for + efficiency. + + Cull also needs to gather nodes that would cause any glcommands, such as + SCSs and DCSs which create transforms. + + Draw- This does not traverse the scene graph, but rather, traverses the + resultant display list produced by Cull. Draw is to be as brain-dead as + possible since it has the bulk of compute time reserved for actually + drawing. (Unless, of course you have the luxury of an SGI machine that + does all transforms down in the graphics hardware... perhaps NV10 will + help a bit on this end). + + The MP harness is a set of management routines for doing + multiprocessing. Ideally, you want to be able to run App, Cull and Draw + as separate processes on their own dedicated processors. Further, you + want to run one complete Draw process for every graphics subsystem that + you will be rendering to. In our case, we can assume that most of our + users will be on single processor PC's, in which case we stand to + benefit from Cull's capability to prune the scene graph, but not much + else. However, this day and age four processor PC's are not that + uncommon, and Linux does have pretty good support for this. + + The MP issues include, process (or thread) management and + synchronization. Performer has several MP models. We also need to + consider that this software will probably run on seperate PCs + altogether, so that the SGI concept of a single machine with multiple + rendering pipes needs to be extended to include multiple PC's, which + need to be synchronized across Ethernet or something. + + Note that each Draw process needs its own Cull process, but that there + can be only one App for multiple Cull/Draw pairs. This model might + extend quite nicely to a multiple PC environment, in which each PC runs + a Cull/Draw pair, and one central machine runs App, broadcasting the + viewing frustums for each viewing channel and synchronizing all. + + Lastly, channel configuration. Currently we now do this by opening a + window, choosing a visual, size, etc. It is often desirable to have + multiple channels (or viewports) for one simulator. There is a whole + package of routines that can be written to set this up and initialize + it. + + That all being said, as I write this my feeling is that we should limit + the scope of OSG to that of only the first item above. That is, Open + Scene Graph will be a Scene Graph and nothing more. Limiting the scope + will allow us to concentrate on quality and robust functionality. This + is one of the best software steps that was taken during the design of + OpenGL, in my opinion. I recall Iris GL and all of its end-all, be-all + approach, becoming very convoluted and confusing as it tried to be a + windowing system, an input device interface, an imaging package and so + forth. Once the spec defined it as being a rendering API and nothing + more, the picture got much clearer. + + Once OSG is in place and it becomes useful, we can then write the + traversers, etc, but not limit our version of traversers. My thinking + is that we can publish examples and documents on How to Write an + OSG Traverser, or some such and sit back and watch the world develop + the best. This will also leave us flexible to use the OSG as a protocol + for doing 3D on the web, or whatever. We can write the viewers, + traversers, MP harnesses, and channel config software as separate + packages. + + Further, I think this will help in the acceptability of OSG as a good + standard scene graph. One of Performer's biggest weaknesses is that it + is a huge API and the learning curve is so steep that many but the most + hearty are put off by it. We can make the Scene Graph that anyone can + use. + + +o Would the OSG be a good candidate for terrain visualisation. + + Terrain is one of the great candidates for scene graphs. Two management + schemes will help you out : Level Of Detail management and Visibility + Culling. + + LOD management consists of defining your visual database (including your + terrain) with differing levels of detail. The further away you are the + less detail your terrain needs to have and you can cut down on the amount + of polygons required to render it. + + You can also do this with objects in your scene. For example from 10 + meters, you'd like a barn to have all the details present, but from 1000 + meters, you could probably get away with the lack of the silo, windows and + detail around the doors. From 10000 meters it could just as easily be a + square red box and at 15000 meters it might as well not be there since + its representation may be less than a pixel on the screen. + + Visibility Culling is also important to high performance rendering, + especially if your visual database is large. All nodes on the scene graph + have a bounding sphere. Each parent node has a bounding sphere that + encompasses all of its children. The Cull process traverses the scene + graph and tests each node for whether any part of it is in the current + viewing frustum. If not it throws it away. + + With this in mind, you can arrange your database to make best use of + culling. For example, if you have a lot of trees on your terrain. Rather + than having one Group node that contains all trees (in which case Cull + would have to test every tree for visibility), you arrange your trees in + a hierarchical fashion, such that trees are group by geographical + location. Then neighboring groups of trees can be parented together, + groups of groups can be parented together and so forth. This way Cull can + visit a high level node, determine that none of the trees under it are + visible and proceed to test the rest of the scene graph. + + This also works for terrain. Rather than defining one large piece of + terrain, you should break it up into smaller sections. This way, what is + not in the viewing frustum can be discarded and the rendering pipeline + left unbothered by transforming and clipping polygons that would never + appear anyway. + + One of the goals of OSG is to be, again, "Just a scene graph". Which + means that the Cull traversal would not be included as part of the + software. It would be up to the user to provide that, OR, we can add it + as a separate piece outside of the scene graph. We want users to not be + limited to what WE think might be the best cull traversal, but rather + leave it as an exercise to optimize, be creative and/or create specific + cull/draw traversals that best suit your needs. + + One such traversal I can think of is a game in which you are on a track. + At any point on this track you can know exactly what is in view and what + is not. You could do something much more creative with this if you are + not limited to the implementation "hard coded" in the scene graph + software. + +o What are the intended target platforms? + + Any platform which supports OpenGL and Standard C++! + + The real limit being the platforms available to the core developers, + if you have a platform which you need supported and have some time + to contribute please contact us. + + +o What platforms are currently supported? + + The OSG is currently developed under Windows95, Linux and Irix. Platform + specific makedefs are provided for Linux and Irix, and VisualC++ 6.0 + Workspace files for MS Windows platforms. + + The OSG should also compile under Windows98/NT and 2000 but has not yet + been tested. + + +o What further platforms will be supported in the near future? + + We will be developing autoconf makefiles to assist the porting to + other Unix's as well as improving things on Linux and Irix. + + +o I'm wondering when the OSG will be ready for release. + + An alpha version has been available since May 2000. The current + version is very much a work in progress will the API still in flux. + + Once the design converges to a stable API we will issue it as a beta, + depending on the various factors one would hope to have the API nailed + down during summer 2000. + + A full release with stable API and implementation will be available... + Can't set any dates but we can be sure it'll be after then beta release :-) + + +o What are the dependencies of the OSG? + + Kept to a minimum by design. The osg scene graph library simply requires OpenGL/Mesa + and compiler support for Standard C++. This means that there is not platform specific + depedancies, and should allow the OSG to be ported easily to new platforms. + + The scene graph viewer sgv depends upon the osg library and GLUT, so should be portable + to any platform which GLUT can be ported to. The viewer can also be compiled with FLTK + using its GLUT compatibility code. + + +o Do you think Open Scene Graph could be a nice replacement for Inventor? + + Depends what your want from your scene graph. If you primary interest + is a visual simulation application then the performance emphasis of the + OSG will be appropriate, if you want to develop a modeling + application and wish to take advantage out of the box UI tools then + Inventor may be better. + + +o What differentiation between the OSG and other OS projects such as OpenRM/ + SGL/OpenSG/DDG Toolkit? + + I have briefly looked both the SGL, DDG and the OpenSG. Both the SGL + are the OpenSG show some uncanny similarities with the OSG, especially + since they all were developed independently. The influence of sgi's Performer, + Inventor and Cosmo3D more than likely providing the starting place for designing + each of these scene graphs. DDG doesn't show quite the same heritage, + and possibly loses a little cleanness of design with it. OpenRM is + an attempt at a Object Orientated scene graph but it C... This is + about a close as I got with it, as IMHO C++ really is the best currently + language for a modern scene graph + + The OSG is also strongly influenced by Performer, this a due to the + application which the OSG was first developed for : a Hang Gliding + Flight simulator which can use either Performer or the OSG for its + scene graph. The OSG does not try to implement the whole of Performer + though, just concentrating of the scene graph to keep the scope in + manageable proportions. The need for the OSG comes about because + Performer is only available on Irix with Linux only happening very + recently, and Performer is closed source of course. + + The OSG also takes advantage of the features of Standard C++ and Design + Patterns to help make the library cleaner and improve its extensibility. + + Many of the current scene graphs, including Inventor and its clones, don't + use STL so end up having define their own container and many common + algorithms. We're glad to say that Standard C++ compilers are now + common enough that we don't have to descend the lowest common denominator + like many older scene graphs. + + The OpenSG design document looks like it describes a very powerful + scene graph design, taking on almost all what Performer tackles today. + However, this will mean that it will be big, and like the Inventor clones + will take *alot* of work to fully implement. If you need all the features + then the OpenSG may well be worth the wait. If you need less features then + the more humble goals of the OSG may well be right for you. + + +o Is there a class diagram for the OSG, or white paper on the projects goals? + + The documentation in the distribution has been generated automatically + using the excellent Open Source tool doc++, which creates class diagrams. + + We haven't written an official white paper on projects goals or a design + overview yet. Knowledge of Performer will help in understanding some of the basics + of design, as will a familiarity with Design Patterns. + + +o Do you need C++ coding support? + + Yes, indeed! Check out the TODO list which comes with the distribution, + and email us with what you fancy contributing to. + + +o Any recommendations for useful programming books to read to help understand + and contribute to the OSG? + + Good practices are suprisingly hard to come by. C and C++ give you so + much rope to hang yourself, but there's few books which really give a + developers the rule book of good coding practices. I found Effective + C++ a refreshing contribution to this end. The Design Patterns book can + be pretty useful as well. + + +o Is there a mailing list? + + Yes indeed, hosted by source forge, so to subscribe head to : + http://sourceforge.net/projects/openscenegraph and follow the + 'Lists' link and follow the intructions. + +o How do I submit my contributions? + + We will eventually be setting up CVS access, possibly with SourceForge. + Up till then send your changes, to diff --git a/Make/instrules b/Make/instrules new file mode 100644 index 000000000..1a1bb1019 --- /dev/null +++ b/Make/instrules @@ -0,0 +1,204 @@ + + +__install : $(TARGET) $(LIB) + @ [ -n "$(OSGHOME)" ] || echo Please define OSGHOME + @ [ -n "$(OSGHOME)" ] && echo > /dev/null; + @ [ `whoami` = "root" ] || echo YOU MUST BE ROOT to do this. + @ echo "`whoami`" | grep -q root + @ for dir in $(TARGET_DIRS);\ + do\ + [ -d $$dir ] || (echo Creating directory $$dir ... ; mkdir -m 755 $$dir)\ + done + @ if [ -n "$(TARGET_LIB_FILES)" ] ;\ + then\ + for f in $(TARGET_LIB_FILES);\ + do\ + (echo copying $(OSGHOME)/lib/$$f to $(TARGET_LIB)/$$f; \ + cp -f $(OSGHOME)/lib/$$f $(TARGET_LIB)/$$f;)\ + done\ + else\ + echo No libraries installed...;\ + fi + @ if [ -n "$(TARGET_BIN_FILES)" ] ;\ + then\ + for f in $(TARGET_BIN_FILES);\ + do\ + (echo copying $(OSGHOME)/bin/$$f to $(TARGET_BIN)/$$f; \ + cp -f $(OSGHOME)/bin/$$f $(TARGET_BIN)/$$f) ;\ + done \ + else\ + echo No executable binaries installed...;\ + fi + @ if [ -n "$(TARGET_INCLUDE_FILES)" ] ;\ + then\ + for f in $(TARGET_INCLUDE_FILES);\ + do\ + if [ "`dirname $(TARGET_INCLUDE)/$$f`" != "$(TARGET_INCLUDE)" ];\ + then\ + (echo copying $(OSGHOME)/include/$$f to $(TARGET_INCLUDE)/$$f; \ + cp -f $(OSGHOME)/include/$$f $(TARGET_INCLUDE)/$$f;) \ + else\ + echo %%%%%%%%% PLEASE DO NOT PUT INCLUDE FILES DIRECTLY INTO $(TARGET_INCLUDE);\ + echo Did not copy $(OSGHOME)/include/$$f to $(TARGET_INCLUDE)/$$f;\ + fi\ + done\ + else\ + echo No header files installed ...;\ + fi + @ if [ -n "$(TARGET_LOADER_FILES)" ] ;\ + then\ + for f in $(TARGET_LOADER_FILES);\ + do\ + if [ "`dirname $(TARGET_LIB)/$$f`" != "$(TARGET_LIB)" ];\ + then\ + (echo copying $(OSGHOME)/lib/$$f to $(TARGET_LIB)/$$f; \ + cp -f $(OSGHOME)/lib/$$f $(TARGET_LIB)/$$f;) \ + else\ + echo %%%%%%%%% PLEASE DO NOT PUT LOADER FILES DIRECTLY INTO $(TARGET_LIB);\ + echo Did not copy $(OSGHOME)/include/$$f to $(TARGET_INCLUDE)/$$f;\ + fi\ + done\ + else\ + echo No loaders installed ...;\ + fi + @if [ -n "$(TARGET_DATA_FILES)" ] ;\ + then\ + if [ -n "$(OSGDATA)" ] ;\ + then\ + for f in $(TARGET_DATA_FILES);\ + do\ + (echo copying $(OSGDATA)/$$f to $(TARGET_DATA)/$$f; \ + cp -f $(OSGDATA)/$$f $(TARGET_DATA)/$$f; )\ + done\ + else\ + echo;\ + echo "-------------- > Please define OSGDATA";\ + echo; \ + [ -n "$(OSGDATA)" ] && echo > /dev/null;\ + fi\ + fi + + +__instlinks : $(TARGET) $(LIB) + @ [ -n "$(OSGHOME)" ] || echo Please define OSGHOME + @ [ -n "$(OSGHOME)" ] && echo > /dev/null; + @ [ `whoami` = "root" ] || echo YOU MUST BE ROOT to do this. + @ echo "`whoami`" | grep -q root + @ for dir in $(TARGET_DIRS);\ + do\ + [ -d $$dir ] || (echo Creating directory $$dir ... ; mkdir -m 755 $$dir)\ + done + @ if [ -n "$(TARGET_LIB_FILES)" ] ;\ + then\ + for f in $(TARGET_LIB_FILES);\ + do\ + (echo Linking $(OSGHOME)/lib/$$f to $(TARGET_LIB)/$$f; \ + ln -sf $(OSGHOME)/lib/$$f $(TARGET_LIB)/$$f;)\ + done\ + else\ + echo No libraries linked...;\ + fi + @ if [ -n "$(TARGET_BIN_FILES)" ] ;\ + then\ + for f in $(TARGET_BIN_FILES);\ + do\ + (echo Linking $(OSGHOME)/bin/$$f to $(TARGET_BIN)/$$f; \ + ln -sf $(OSGHOME)/bin/$$f $(TARGET_BIN)/$$f) ;\ + done \ + else\ + echo No executable binaries linked...;\ + fi + @ if [ -n "$(TARGET_INCLUDE_FILES)" ] ;\ + then\ + for f in $(TARGET_INCLUDE_FILES);\ + do\ + if [ "`dirname $(TARGET_INCLUDE)/$$f`" != "$(TARGET_INCLUDE)" ];\ + then\ + (echo Linking $(OSGHOME)/include/$$f to $(TARGET_INCLUDE)/$$f; \ + ln -sf $(OSGHOME)/include/$$f $(TARGET_INCLUDE)/$$f;) \ + else\ + echo %%%%%%%%% PLEASE DO NOT PUT INCLUDE FILES DIRECTLY INTO /usr/include;\ + echo Did not copy $(OSGHOME)/include/$$f to $(TARGET_INCLUDE)/$$f;\ + fi\ + done\ + else\ + echo No header files linked ...;\ + fi + @ if [ -n "$(TARGET_LOADER_FILES)" ] ;\ + then\ + for f in $(TARGET_LOADER_FILES);\ + do\ + if [ "`dirname $(TARGET_LIB)/$$f`" != "$(TARGET_LIB)" ];\ + then\ + (echo Linking $(OSGHOME)/lib/$$f to $(TARGET_LIB)/$$f; \ + ln -sf $(OSGHOME)/lib/$$f $(TARGET_LIB)/$$f;) \ + else\ + echo %%%%%%%%% PLEASE DO NOT PUT LOADER FILES DIRECTLY INTO $(TARGET_LIB);\ + echo Did not copy $(OSGHOME)/include/$$f to $(TARGET_INCLUDE)/$$f;\ + fi\ + done\ + else\ + echo No loaders installed ...;\ + fi + @if [ -n "$(TARGET_DATA_FILES)" ] ;\ + then\ + if [ -n "$(OSGDATA)" ] ;\ + then\ + for f in $(TARGET_DATA_FILES);\ + do\ + (echo Linking $(OSGDATA)/$$f to $(TARGET_DATA)/$$f; \ + ln -sf $(OSGDATA)/$$f $(TARGET_DATA)/$$f; )\ + done\ + else\ + echo ;\ + echo "-------------- > Please define OSGDATA ";\ + echo ;\ + [ -n "$(OSGDATA)" ] && echo > /dev/null;\ + fi\ + fi + + +__instclean : + @ [ `whoami` = "root" ] || echo YOU MUST BE ROOT to do this. + @ echo "`whoami`" | grep -q root + @ for dir in $(TARGET_DIRS);\ + do\ + [ -d $$dir ] && echo Removing $$dir; \ + [ -d $$dir ] && rm -rf $$dir || echo > /dev/null; \ + done + @ if [ -n "$(TARGET_LIB_FILES)" ] ;\ + then\ + for f in $(TARGET_LIB_FILES);\ + do\ + ([ -L $(TARGET_LIB)/$$f ] || [ -e $(TARGET_LIB)/$$f ]) && \ + (echo removing $(TARGET_LIB)/$$f; \ + rm -f $(TARGET_LIB)/$$f;) || echo >/dev/null;\ + done\ + fi + @ if [ -n "$(TARGET_BIN_FILES)" ] ;\ + then\ + for f in $(TARGET_BIN_FILES);\ + do\ + ([ -L $(TARGET_BIN)/$$f ] || [ -e $(TARGET_BIN)/$$f ]) && \ + (echo removing $(TARGET_BIN)/$$f; \ + rm -f $(TARGET_BIN)/$$f;) || echo > /dev/null;\ + done\ + fi + @ if [ -n "$(TARGET_INCLUDE_FILES)" ] ;\ + then\ + for f in $(TARGET_INCLUDE_FILES);\ + do\ + ([ -L $(TARGET_BIN)/$$f ] || [ -e $(TARGET_BIN)/$$f ]) && \ + (echo removing $(TARGET_INCLUDE)/$$f; \ + rm -f $(TARGET_INCLUDE)/$$f;) || echo > /dev/null;\ + done\ + fi + @ if [ -n "$(TARGET_DATA_FILES)" ] ;\ + then\ + for f in $(TARGET_DATA_FILES);\ + do\ + ([ -L $(TARGET_DATA)/$$f ] || [ -e $(TARGET_DATA)/$$f ]) && \ + (echo removing $(TARGET_DATA)/$$f; \ + rm -f $(TARGET_DATA)/$$f;) || echo > /dev/null;\ + done\ + fi diff --git a/Make/makedefs.irix.nonstd b/Make/makedefs.irix.nonstd new file mode 100644 index 000000000..0f3e2ef3e --- /dev/null +++ b/Make/makedefs.irix.nonstd @@ -0,0 +1,59 @@ +MAKEDIR = $(OSGHOME)/Make +INSTRULES = $(MAKEDIR)/instrules +MAKEDEPEND = Makedepend +OBJS = $(C++FILES:.cpp=.o) $(CFILES:.c=.o) $(YACCFILES:.y=.o) $(LEXFILES:.l=.o) + +DEPFILES = $(OBJS:.o=.d) + + +C++ = CC +YFLAGS = -d +#CFLAGS = -O2 -n32 -MDupdate $(MAKEDEPEND) +CFLAGS = -O2 -n32 -DOSG_USE_IO_DOT_H -OPT:Olimit=0 +C++FLAGS = ${CFLAGS} +CPPFLAGS = ${CFLAGS} + +LDFLAGS = -O2 -n32 -OPT:Olimit=0 + +.SUFFIXES: .cpp .o +.cpp.o: + $(C++) $(C++FLAGS) -c $< + +PFLIBS = -lpfdu -lpfutil -lpf -limage + + +# +# TARGET_DIRS are directories that would not exist on the system except +# for the presence of OpenSceneGraph. 'make instclean' removes these +# directories +# +TARGET_DIRS = \ + /usr/include/osg \ + /usr/include/osgUtil \ + /usr/share/OpenSceneGraph\ + /usr/share/OpenSceneGraph/data\ + /usr/share/OpenSceneGraph/data/Images\ + /usr/share/OpenSceneGraph/data/Test\ + /usr/lib32/osgPlugins\ + +TARGET_BIN = /usr/bin +TARGET_LIB = /usr/lib32 +TARGET_INCLUDE = /usr/include +TARGET_DATA = /usr/share/OpenSceneGraph/data +TARGET_LOADER_LIB = /usr/lib/osgPlugins + +# +# This definitions are necessary for IRIX. The following statement +# does not work for smake using a sh: +# +# for variable in $(LIST); do ...; done +# +# .. if $(LIST) is a NULL variable. So we have to define 0 length +# strings and check for them inside the for loop +# + +TARGET_LIB_FILES = "" +TARGET_BIN_FILES = "" +TARGET_INCLUDE_FILES = "" +TARGET_DATA_FILES = "" +TARGET_LOADER_FILES = "" diff --git a/Make/makedefs.irix.std b/Make/makedefs.irix.std new file mode 100644 index 000000000..f05944786 --- /dev/null +++ b/Make/makedefs.irix.std @@ -0,0 +1,59 @@ +MAKEDIR = $(OSGHOME)/Make +INSTRULES = $(MAKEDIR)/instrules +MAKEDEPEND = Makedepend +OBJS = $(C++FILES:.cpp=.o) $(CFILES:.c=.o) $(YACCFILES:.y=.o) $(LEXFILES:.l=.o) + +DEPFILES = $(OBJS:.o=.d) + + +C++ = CC +YFLAGS = -d +#CFLAGS = -O2 -n32 -MDupdate $(MAKEDEPEND) +CFLAGS = -O2 -n32 -LANG:std -OPT:Olimit=0 +C++FLAGS = ${CFLAGS} +CPPFLAGS = ${CFLAGS} + +LDFLAGS = -O2 -n32 -LANG:std -OPT:Olimit=0 + +.SUFFIXES: .cpp .o +.cpp.o: + $(C++) $(C++FLAGS) -c $< + +PFLIBS = -lpfdu -lpfutil -lpf -limage + +# +# TARGET_DIRS are directories that would not exist on the system except +# for the presence of OpenSceneGraph. 'make instclean' removes these +# directories +# +TARGET_DIRS = \ + /usr/include/osg \ + /usr/include/osgUtil \ + /usr/share/OpenSceneGraph\ + /usr/share/OpenSceneGraph/data\ + /usr/share/OpenSceneGraph/data/Images\ + /usr/share/OpenSceneGraph/data/Test\ + /usr/lib32/osgPlugins\ + + +TARGET_BIN = /usr/bin +TARGET_LIB = /usr/lib32 +TARGET_INCLUDE = /usr/include +TARGET_DATA = /usr/share/OpenSceneGraph/data +TARGET_LOADER_LIB = /usr/lib/osgPlugins + +# +# This definitions are necessary for IRIX. The following statement +# does not work for smake using a sh: +# +# for variable in $(LIST); do ...; done +# +# .. if $(LIST) is a NULL variable. So we have to define 0 length +# strings and check for them inside the for loop +# + +TARGET_LIB_FILES = "" +TARGET_BIN_FILES = "" +TARGET_INCLUDE_FILES = "" +TARGET_DATA_FILES = "" +TARGET_LOADER_FILES = "" diff --git a/Make/makedefs.linux b/Make/makedefs.linux new file mode 100644 index 000000000..bc8989f83 --- /dev/null +++ b/Make/makedefs.linux @@ -0,0 +1,56 @@ +MAKEDIR = $(OSGHOME)/Make +INSTRULES = $(MAKEDIR)/instrules +MAKEDEPEND = Makedepend +OBJS = $(C++FILES:.cpp=.o) $(CFILES:.c=.o) $(YACCFILES:.y=.o) $(LEXFILES:.l=.o) + +DEPFILES = $(OBJS:.o=.d) + + +C++ = g++ +YFLAGS = -d +LCINCS += -I/usr/X11R6/include +LC++INCS += ${LCINCS} +CFLAGS = -O2 -W -Wall $(LCINCS) +C++FLAGS = ${CFLAGS} +CPPFLAGS = ${CFLAGS} + +LDFLAGS = -O2 -W -Wall + +PFLIBS = -lpfdu -lpfutil -lpf -ldl + + +# +# TARGET_DIRS are directories that would not exist on the system except +# for the presence of OpenSceneGraph. 'make instclean' removes these +# directories +# +TARGET_DIRS = \ + /usr/include/osg \ + /usr/include/osgUtil \ + /usr/share/OpenSceneGraph\ + /usr/share/OpenSceneGraph/data\ + /usr/share/OpenSceneGraph/data/Images\ + /usr/share/OpenSceneGraph/data/Test\ + /usr/lib/osgPlugins\ + + +TARGET_BIN = /usr/bin +TARGET_LIB = /usr/lib +TARGET_INCLUDE = /usr/include +TARGET_DATA = /usr/share/OpenSceneGraph/data + +# +# This definitions are necessary for IRIX. The following statement +# does not work for smake using a sh: +# +# for variable in $(LIST); do ...; done +# +# .. if $(LIST) is a NULL variable. So we have to define 0 length +# strings and check for them inside the for loop +# + +TARGET_LIB_FILES = "" +TARGET_BIN_FILES = "" +TARGET_INCLUDE_FILES = "" +TARGET_DATA_FILES = "" +TARGET_LOADER_FILES = "" diff --git a/Make/makerules.irix b/Make/makerules.irix new file mode 100644 index 000000000..6304a7ab8 --- /dev/null +++ b/Make/makerules.irix @@ -0,0 +1,58 @@ + +all : $(TARGET) $(LIB) + +$(TARGET) : $(OBJS) + $(C++) $(LDFLAGS) $(OBJS) $(LIBS) -o $@ + +$(LIB) : $(OBJS) + $(C++) $(LDFLAGS) -shared $(OBJS) $(LIBS) -o $@ + +clean : + rm -rf $(OBJS) core so_locations ii_files $(TARGET) $(MAKEDEPEND) + touch $(MAKEDEPEND) + + +clobber : clean + rm -f $(TARGET) a.out $(LIB) + +to_unix : + for f in *.cpp ; do to_unix $$f $$f; done + for f in *.h ; do to_unix $$f $$f; done + + +# force it +depend : + $(C++) $(C++FLAGS) -M $(C++FILES) $(CFILES) > $(MAKEDEPEND) + +$(MAKEDEPEND) : $(C++FILES) $(CFILES) + $(C++) $(C++FLAGS) -M $(C++FILES) $(CFILES) > $(MAKEDEPEND) + +%.o : %.cpp + $(C++) $(C++FLAGS) -c $*.cpp -o $*.o + +docs: + [ "$(TARGET_BASENAME)" != "" ] && \ + mkdir -p ../../doc/$(TARGET_BASENAME) && \ + doc++ -d ../../doc/$(TARGET_BASENAME) -H -A ../../include/$(TARGET_BASENAME)/* && \ + echo $(TARGET_BASENAME) HTML documentation created in ../../doc/$(TARGET_BASENAME) + +install : home + @ make __install + +instlinks : home + @ make __instlinks + +instclean : home + @ make __instclean + + +home : + @ [ -n "$(OSGHOME)" ] || (echo ; echo "-------------> Please define OSGHOME"; echo) + @ [ -n "$(OSGHOME)" ] + + + + +sinclude $(INSTRULES) + +include $(MAKEDEPEND) diff --git a/Make/makerules.linux b/Make/makerules.linux new file mode 100644 index 000000000..bc539735f --- /dev/null +++ b/Make/makerules.linux @@ -0,0 +1,53 @@ + +all : $(MAKEDEPEND) $(TARGET) $(LIB) + +$(TARGET) : $(OBJS) + $(C++) $(LDFLAGS) $(OBJS) $(LIBS) -o $@ + +$(LIB) : $(OBJS) + $(C++) $(LDFLAGS) -shared $(OBJS) $(LIBS) -o $@ + +clean : + rm -f $(OBJS) core $(TARGET) $(MAKEDEPEND) + touch $(MAKEDEPEND) + +clobber : clean + rm -f $(TARGET) a.out $(LIB) + +to_unix : + for f in *.cpp ; do to_unix $$f $$f; done + for f in *.h ; do to_unix $$f $$f; done + +# force it +depend : + $(C++) $(C++FLAGS) -M $(C++FILES) $(CFILES) > $(MAKEDEPEND) + +$(MAKEDEPEND) : $(C++FILES) $(CFILES) + $(C++) $(C++FLAGS) -M $(C++FILES) $(CFILES) > $(MAKEDEPEND) + +%.o : %.cpp + $(C++) $(C++FLAGS) -c $*.cpp -o $*.o + +docs: + [ "$(TARGET_BASENAME)" != "" ] && \ + mkdir -p ../../doc/$(TARGET_BASENAME) && \ + doc++ -d ../../doc/$(TARGET_BASENAME) -H -A ../../include/$(TARGET_BASENAME)/* && \ + echo $(TARGET_BASENAME) HTML documentation created in ../../doc/$(TARGET_BASENAME) + +install : home + @ make __install + +instlinks : home + @ make __instlinks + +instclean : home + @ make __instclean + + +home : + @ [ -n "$(OSGHOME)" ] || (echo ; echo "-------------> Please define OSGHOME"; echo) + @ [ -n "$(OSGHOME)" ] && echo > /dev/null; + +sinclude $(INSTRULES) + +include $(MAKEDEPEND) diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..92982acd3 --- /dev/null +++ b/Makefile @@ -0,0 +1,98 @@ +#!smake +SHELL=/bin/sh +MAKE_PREP = Make/makedefs Make/makerules + +DIRS = src + + +all : $(MAKE_PREP) + for f in $(DIRS) ; do cd $$f; make; cd ..; done + +docs : + cd src; make docs; + + +Make/makedefs : + @ cd Make;\ + case `uname` in\ + IRIX|IRIX64) \ + ln -sf makedefs.irix.nonstd makedefs ;;\ + Linux) \ + ln -sf makedefs.linux makedefs;;\ + esac + +Make/makerules : + @ cd Make;\ + case `uname` in\ + IRIX|IRIX64) \ + ln -sf makerules.irix makerules ;; \ + Linux) \ + ln -sf makerules.linux makerules ;;\ + esac + +linux: + cd Make;\ + ln -sf makedefs.linux makedefs;\ + ln -sf makerules.linux makerules + make + +irix: + cd Make;\ + ln -sf makedefs.irix.nonstd makedefs ;\ + ln -sf makerules.irix makerules + make + +irix.std: + cd Make;\ + ln -sf makedefs.irix.std makedefs ;\ + ln -sf makerules.irix makerules + make + +help : + @echo Usage : + @echo \ make + @echo \ make linux + @echo \ make irix.std + @echo \ make irix.nonstd + @echo \ make depend + @echo \ make clean + @echo \ make clobber + @echo \ make doc + @echo \ make snapshot + @echo \ make install + @echo \ make instlinks + @echo \ make instclean + + +clean : $(MAKE_PREP) + for f in $(DIRS) ; do cd $$f; make clean; cd ..; done + find lib -type f -exec rm {} \; + rm -f bin/* + +clobber : $(MAKE_PREP) clean + for f in $(DIRS) ; do cd $$f; make clobber; cd ..; done + rm -f $(MAKE_PREP) + +depend : $(MAKE_PREP) + for f in $(DIRS) ; do cd $$f; make depend; cd ..; done + +to_unix : + for f in $(DIRS) ; do cd $$f; to_unix Makefile Makefile; cd ..; done + for f in $(DIRS) ; do cd $$f; make to_unix; cd ..; done + cd include/OSG; for f in *.h ; do to_unix $$f $$f; done + +snapshot: + make doc; + make clobber; + (cd ..; tar cvf - OpenSceneGraph-0.8 | gzip > osg_src-`date "+%Y%m%d"`.tar.gz) + + +install : + for f in $(DIRS) ; do cd $$f; make install; cd ..; done + +instlinks : + for f in $(DIRS) ; do cd $$f; make instlinks; cd ..; done + +instclean : + for f in $(DIRS) ; do cd $$f; make instclean; cd ..; done + diff --git a/NEWS b/NEWS new file mode 100644 index 000000000..a8e7c29c4 --- /dev/null +++ b/NEWS @@ -0,0 +1,22 @@ +OSG News (most significant items from ChangeLog) +================================================ + + +6th December 2000 - osg_src-0.8-34.tar.gz + + o New osgGLUT library assist writing of osg demos. + o New cube demo. + o Improved handling of image sizes which arn't a power of 2. + o Performer plugin can now work as of plugin to Performer or the + OSG (with a few caveates:) + + +22nd December 2000 - osg_src-0.8-33.tar.gz + + o Integrated Don's work on adding glVertexArrays etc to osg::GeoSet. + o Incorportated the following image loaders from the simage library. + src/osgPlugins/gif + /jpeg + /pic + /tga + /tiff diff --git a/README b/README new file mode 100644 index 000000000..5a80c5b26 --- /dev/null +++ b/README @@ -0,0 +1,178 @@ +The following is a very basic intro of how to get the OSG going under Linux, +IRIX and Windows. Each intro mentions OpenSceneGraph-Data, it is recommended +that you also download it alongside this source distribution. + +The scene graph depends upon Standard C++, STL and OpenGL so you need a C++ +compiler up to the task and OpenGL or Mesa installed. The viewer depends upon +GLUT which you'll need to download and install from the GLUT website. The +OSG has it own native ascii file format, and .rgb image reader inbuilt which +allows you read the example data with any dependancies othe then C++, STL and +OpenGL. + +The OSG also has several plug-ins which support non-native 3d database and +image formats, several have no dependancies on external libraries (flt,fly, +tga & pic), while others (pfb,jpeg,gif,tiff) require other libraries to be +installed to compile them. If you don't already have them installed then +don't worry, you'll still be able to use the OSG. The core osg library and +viewer is designed has been designed to load the plug-ins at run-time only +and if they are required to load a specific data set. If you don't need them +for your datasets then it won't matter that you havn't been able to compile +all the plug-ins. A full list of dependancies and where to download the +required libraries are near the bottom of this file. + +If you're comming across the OSG for the first time and want to get started +quickly, go right ahead and follow the compilation instructions. You can always +later download the libraries which the plug-ins require if you eventually need +them. + +If you havn't already checked it out, for a list of distribution contents, +contacts and links to documentation check out index.html. + + +Compiling under Linux : +----------------------- + + Add the following to your .cshrc : + + setenv OSGHOME + setenv OSGDATA + setenv OSGFILEPATH ./:${OSGDATA}:${OSGDATA}/Images: + setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${OSGHOME}/lib + setenv PATH ${PATH}:${OSGHOME}/bin + + Or the following if you're using a sh compatible shell : + + export OSGHOME= + export OSGDATA= + export OSGFILEPATH=./:${OSGDATA}:${OSGDATA}/Images: + export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${OSGHOME}/lib + export PATH=${PATH}:${OSGHOME}/bin + + To compile, from the OSG root directory, type : + + make + + Note, make should automatically detect linux and copy the + Make/makerules.linux and Make/makedefs.linux over the + default Make/makerules and Make/makedefs. If autodetection + does not work type 'make linux'. + + +Compiling under IRIX : +---------------------- + + Add the following to your .cshrc : + + setenv OSGHOME + setenv OSGDATA + setenv OSGFILEPATH ./:${OSGDATA}:${OSGDATA}/Images: + setenv LD_LIBRARYN32_PATH ${LD_LIBRARYN32_PATH}:${OSGHOME}/lib + setenv PATH ${PATH}:$OSGHOME/bin + + Or the following if you're using a sh compatible shell : + + export OSGHOME= + export OSGDATA= + export OSGFILEPATH=./:${OSGDATA}:${OSGDATA}/Images: + export LD_LIBRARYN32_PATH=${LD_LIBRARYN32_PATH}:${OSGHOME}/lib + export PATH=${PATH}:$OSGHOME/bin + + Since the OSG uses Standard C++ features such as STL it is important + to have an up to date version of the MIPSPro compilers. The library + has been tested under MIPSPro7.3 & MIPSPro7.2.1, and *may* compile + under previous versions but has yet to be tested. It is recommened + to use MIPSPro7.3.1.1m. + + To compile, from the OSG root directory, type : + + make + + Note, make should automatically detect IRIX and copy the + Make/makerules.irix and Make/makedefs.irix over the + default Make/makerules and Make/makedefs. If autodetection + does not work type 'make linux'. + + +Compiling under Windows : +------------------------- + + The Microsoft Visual C++ 6.0 workspace file is VisualStudio.dsw located + in the VisualStudio\ below the OSG this root directory. The OSG will + compile with the basic VisualC++6.0, but its recommended that you use + Service Pack 4 to fix MS compiler bugs which affect the OSG. + + To execute the viewer the file path for the .dll's and .exe, both compiled + into the OSG's bin directory, need to be setup, such as by adding the PATH + to your autoexec.bat, its also useful to add the OSGFILEPATH to your + autoexec.bat to help the location of datafiles. For example : + + SET OSGFILEPATH=D:\OpenSceneGraph-Data;D:\OpenSceneGraph-Data\Images + SET PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\Oglsdk\lib;D:\OpenSceneGraph-0.8\bin; + + +Running the viewer +------------------ + To run the viewer demo type (you made need to type rehash first under Unix) : + + sgv dumptruck.osg + sgv cow.osg + sgv e-s-bike.osg + sgv flight_park.fly + sgv lz.rgb + + Other run other demos type + + cube + + (Note: the file is picked up by checking the directories pointed to + by $OSGFILEPATH) + + +Plug-in dependancies +-------------------- + + src/osgPlugins/pfb + + There is Peformer plugin in this distribution for converting from + Performer to OSG and from OSG to Performer. This plugin requires + Performer to be installed and therefore is not compiled by default. + If you have Performer (available under Linux and IRIX) then edit + src/osgPlugins/Make to compile under the plugin. Performer can be + downloaded from http://sgi.com + + For further information about the Performer plugin please read the + src/osgPlugin/pfb/READEME.txt. + + src/osgPlugins/png + + The png plugin depends upon the libpng and zlib (for compression) + libraries, if you don't already have it installed, you'll need to + download, compile and install it. + Project home pages are: + http://www.libpng.org/pub/png/libpng.html + http://www.info-zip.org/pub/infozip/zlib/ + + src/osgPlugins/gif + + The gif plugin depends upon the libungif library, if you don't already + have it installed, you'll need to download, compile and install it. + Project home page is: + http://prtr-13.ucsc.edu/~badger/software/libungif/ + Ftp download at : + ftp://prtr-13.ucsc.edu/pub/libungif/ + + + src/osgPlugins/jpeg + + The jpeg plugin depends upon the libjpeg library, if you don't already + have it installed, you'll need to download, compile and install it. + Project home page is: + http://www.ijg.org + + src/osgPlugins/tiff + + The tiff plugin depends upon the libtiff library, if you don't already + have it installed, you'll need to download, compile and install it. + Project home page is: + http://www.libtiff.org + diff --git a/TODO b/TODO new file mode 100644 index 000000000..9739e2e26 --- /dev/null +++ b/TODO @@ -0,0 +1,141 @@ +OSG TODO List +============= + +Main categories +=============== + +o Core OSG Library + - the core OSG library itself (include/OSG and src/) +o Reader/writer plug-ins + - the reader/writers plug-ins for third party file formats. +o Viewers & Application plug-ins + - osg viewers and plug-ins to third party applications such as Netscape. +o Under development + - listing of TODO items which are currently under developement. +o Work completed + - listing of TODO items which have been done and hence removed + from the above TODO catagories. +-- + +o Core OSG Library + ================ + - General + . Header & code documentation/reference guide. + . Programming guide. + . Naming conventions. + . mutli-threading/shared memory support. + + - Maths + . full maths support in osg::Matrix class. + . double matrix class. + . osg::Plane class. + + - Nodes + . create a base class to provide interface to objects which can render, + derive osg::GeoSet from this. + . add osg::Sequence for basic animation. + . add osg::Morph for interpolating between geometries. + . add support for Multi-texturing into osg::GeoSet/osg::GeoState. + . add support for multi-pass rendering. + . utilise stl vectors for osg::GeoSets? + . improve osg::GeoState. + . add osg::State for mainting image of the OpenGL state. + . add osg::Terrain node. + . add osg::EarthSky class for rendering earth and sky backgrounds. + . add proxy node for lazy loading of nodes, when needed. + . implement visual proximity to assist loading of proxied data + when the view frustum nears an unloaded proxy node, and deleting + of unused proxied data. + . implement support for modified status/lazy evaluation of node data + and observer style pattern. + . manipulator decoration nodes? + . spacial subdivision decoration nodes? + + - Visitors + . improve state sorting of opaque bins in osg::RenderVistor. + . add statistics visitor for logging the stats of the scene graph. + . add OpenGL picking visitor. + + - IO/Plug-in support + . improve the ascii parsing class osg::Field, osg::FieldReader etc. + . change the osg::Registry to timestamp registrations of objects/RW's. + . add support for file path logging into osg::Input. + . add binary data reading and writing into osg::Input/osg::Output to + support part binary .osg files. + . return error messages of on failed loading/saving. + + +o Reader/writer plug-ins + ======================= + - .iv/.wrl Inventor/VRML ascii. + - .obj Alias wavefront's format. + - .dxf Autocads ascii format. + - .3ds 3D Studio format. + - .dem digital elevation map. + - .d3d? MS's Direct 3D file formats if they have one.. + - .bmp Windows Bitmap files. + - .gz Automatic unzipping of GNU zipped files. + - .zip Automatic unzipping of windows zipped files. + - .Z Automatic unzipping of Unix Compress files. + - .tar Automatic unpacking of directories and loading of contents. + + +o Viewers & Application plug-ins + =============================== + - OSG scene graph viewer - sgv. + . add command line reading for specifying data search paths and data, + -D for data search path, -d for data. + . add command line reading for specifying library search paths and + libraries/plug-ins, -D for library search path, -l for libraries. + - Internet Explorer plug-in. + - .osg to Inventor file plug-in. + - Tutorials example programs. + + +o Under development + ================= + Sign up here if would like to take on a task :-) + - add osg::Billboard for trees etc. + - .pfb loader for Performer binary files. + - full maths support in osg::Matrix class. + - Netscape plug-in. + - add osg::Channel/sgCamera class. + - .flt Open Flight format. + - autoconf/configure support to aid portabilty to other unix's. + - CVS support for when source is made fully public. + + +o Work completed + ============== + - osg namespace implemented. + - reduce the STL platform specific #ifdef's. + - remove using namespace from all header files, so not to pollute user space. + - remove the sg prefix from sgNode etc, now that the osg namespaces exits. + - FAQ for distribution and web site. + - full maths support in osg::Vec2, osg::Vec3 and osg::Vec4. + - change the osg::Registry to use plug-in RW's on loading a plug-in + instead of the plug-in functions found in sg.cxx. + - add support for removal of plug-ins from osg::Registry, + - add .osg support into DCS node. + - clean up inheritance relationship between osg::Node, osg::Object etc. + - add osg::Switch for handling optional rendering of children. + - add osg::LOD (level of detail) group node for load management. + - add view frustrum culling into osg::RenderVisitor. + - add support for mutliply referenced nodes into osg::Input. + - add a quaternion class. + - improve osg::BoundingBox and osg::BoundingSphere. + - add hit and intersect classes for collision detection. + - add intersect visitor. + - add camera manipualotors for trackball, drive and flight mouse control. + - add compile OpenGL display lists visitor (currently in sgv). + - library version and description functions. + - add support for OpenGL Vertex Array into osg::GeoSet. + - .gif GIF Images! + - .jpg JPEG Images. + - .tiff TIFF Images. + - .png PNG Images. + - .tga TGA Images. + - .pic PIC Images. + - add timing/timestamp class. + - document how to get the OSG compiled and running under all + platforms, Win32 being priority as it's the least obvious. diff --git a/VisualStudio/Demos/cube/cube.dsp b/VisualStudio/Demos/cube/cube.dsp new file mode 100755 index 000000000..a2abab9a7 --- /dev/null +++ b/VisualStudio/Demos/cube/cube.dsp @@ -0,0 +1,97 @@ +# Microsoft Developer Studio Project File - Name="cube" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=cube - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "cube.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "cube.mak" CFG="cube - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "cube - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "cube - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "cube - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GR /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x809 /d "NDEBUG" +# ADD RSC /l 0x809 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 osgGLUT.lib osgUtil.lib osg.lib glut32.lib glu32.lib opengl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../../../bin/cube.exe" /libpath:"../../../lib" + +!ELSEIF "$(CFG)" == "cube - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /Gm /vd0 /GR /GX /ZI /Od /I "../../../include" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /D "_DEBUG" /D "FL_DLL" /FR /YX /FD /c +# ADD BASE RSC /l 0x809 /d "_DEBUG" +# ADD RSC /l 0x809 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 osgGLUTd.lib osgUtild.lib osgd.libglut32.lib glu32.lib opengl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libcmt" /out:"../../../bin/cubed.exe" /pdbtype:sept /libpath:"../../../lib" +# SUBTRACT LINK32 /incremental:no + +!ENDIF + +# Begin Target + +# Name "cube - Win32 Release" +# Name "cube - Win32 Debug" +# Begin Source File + +SOURCE=..\..\..\src\Demos\cube\cube.cpp +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project + diff --git a/VisualStudio/Demos/sgv/sgv.dsp b/VisualStudio/Demos/sgv/sgv.dsp new file mode 100755 index 000000000..a37982bc0 --- /dev/null +++ b/VisualStudio/Demos/sgv/sgv.dsp @@ -0,0 +1,96 @@ +# Microsoft Developer Studio Project File - Name="sgv" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=sgv - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "sgv.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "sgv.mak" CFG="sgv - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "sgv - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "sgv - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "sgv - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /GR /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x809 /d "NDEBUG" +# ADD RSC /l 0x809 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 osgGLUT.lib osgUtil.lib osg.lib glut32.lib glu32.lib opengl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"../../../bin/sgv.exe" /libpath:"../../../lib" + +!ELSEIF "$(CFG)" == "sgv - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /W3 /Gm /vd0 /GR /GX /ZI /Od /I "../../../include" /D "_CONSOLE" /D "_MBCS" /D "WIN32" /D "_DEBUG" /D "FL_DLL" /FR /YX /FD /c +# ADD BASE RSC /l 0x809 /d "_DEBUG" +# ADD RSC /l 0x809 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 osgGLUTd.lib osgUtild.lib osgd.lib glut32.lib glu32.lib opengl32.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"libcmt" /out:"../../../bin/sgvd.exe" /pdbtype:sept /libpath:"../../../lib" +# SUBTRACT LINK32 /incremental:no + +!ENDIF + +# Begin Target + +# Name "sgv - Win32 Release" +# Name "sgv - Win32 Debug" +# Begin Source File + +SOURCE=..\..\..\src\Demos\sgv\sgv.cpp +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/VisualStudio/VisualStudio.dsw b/VisualStudio/VisualStudio.dsw new file mode 100644 index 000000000..9fe86346d --- /dev/null +++ b/VisualStudio/VisualStudio.dsw @@ -0,0 +1,224 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "sgv"=".\Demos\sgv\sgv.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name osg + End Project Dependency + Begin Project Dependency + Project_Dep_Name osgUtil + End Project Dependency + Begin Project Dependency + Project_Dep_Name osgGLUT + End Project Dependency +}}} + +############################################################################### + +Project: "cube"=".\Demos\cube\cube.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name osg + End Project Dependency + Begin Project Dependency + Project_Dep_Name osgUtil + End Project Dependency + Begin Project Dependency + Project_Dep_Name osgGLUT + End Project Dependency +}}} + +############################################################################### + +Project: "flt"=".\osgPlugins\flt\flt.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name osg + End Project Dependency +}}} + +############################################################################### + +Project: "fly"=".\osgPlugins\fly\fly.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name osg + End Project Dependency +}}} + +############################################################################### + +Project: "gif"=".\osgPlugins\gif\gif.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name osg + End Project Dependency +}}} + +############################################################################### + +Project: "jpeg"=".\osgPlugins\jpeg\jpeg.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name osg + End Project Dependency +}}} + +############################################################################### + +Project: "pic"=".\osgPlugins\pic\pic.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name osg + End Project Dependency +}}} + +############################################################################### + +Project: "png"=".\osgPlugins\png\png.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name osg + End Project Dependency +}}} + +############################################################################### + +Project: "tga"=".\osgPlugins\tga\tga.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name osg + End Project Dependency +}}} + +############################################################################### + +Project: "tiff"=".\osgPlugins\tiff\tiff.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name osg + End Project Dependency +}}} + +############################################################################### + +Project: "osgGLUT"=".\osgGLUT\osgGLUT.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name osg + End Project Dependency + Begin Project Dependency + Project_Dep_Name osgUtil + End Project Dependency +}}} + +############################################################################### + +Project: "osgUtil"=".\osgUtil\osgUtil.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ + Begin Project Dependency + Project_Dep_Name osg + End Project Dependency +}}} + +############################################################################### + +Project: "osg"=".\osg\osg.dsp" - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/VisualStudio/osg/osg.dsp b/VisualStudio/osg/osg.dsp new file mode 100755 index 000000000..3346dd450 --- /dev/null +++ b/VisualStudio/osg/osg.dsp @@ -0,0 +1,525 @@ +# Microsoft Developer Studio Project File - Name="osg" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=osg - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "osg.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "osg.mak" CFG="osg - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "osg - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "osg - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "osg - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "../../lib" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBSCENEGRAPH_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GR /GX /O2 /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "SG_LIBRARY" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo /o"../../lib/osg.bsc" +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 opengl32.lib glu32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /pdb:"../../bin/osg.pdb" /machine:I386 /out:"../../bin/osg.dll" +# SUBTRACT LINK32 /pdb:none + +!ELSEIF "$(CFG)" == "osg - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "../../lib" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBSCENEGRAPH_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /vmg /vd0 /GR /GX /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "SG_LIBRARY" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo /o"../../lib/osg.bsc" +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 opengl32.lib glu32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /pdb:"../../bin/osgd.pdb" /debug /machine:I386 /out:"../../bin/osgd.dll" /pdbtype:sept +# SUBTRACT LINK32 /pdb:none /incremental:no + +!ENDIF + +# Begin Target + +# Name "osg - Win32 Release" +# Name "osg - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\..\Src\Osg\AlphaFunc.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\Billboard.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\BoundingBox.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\BoundingSphere.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\Camera.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\CullFace.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\DCS.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\DynamicLibrary.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\ExtensionSupported.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\Field.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\FieldReader.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\FieldReaderIterator.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\FileNameUtils.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\Fog.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\Geode.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\GeoSet.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\GeoSet_ogl.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\GeoState.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\Group.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\Image.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\Input.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\Light.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\LightSource.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\Lighting.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\LOD.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\Material.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\Matrix.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\Node.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\NodeVisitor.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\Notify.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\Object.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\OSG.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\Output.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\Point.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\src\osg\PolygonOffset.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\Quat.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\ReaderWriterOSG.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\ReaderWriterRGB.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\Registry.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\Scene.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\Seg.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\Sequence.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\Switch.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\TexEnv.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\TexGen.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\TexMat.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\Texture.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\Timer.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\Version.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\Osg\Transparency.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter ";h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\..\Include\Osg\AlphaFunc +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Billboard +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\BoundingBox +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\BoundingSphere +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Camera +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\CullFace +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Dcs +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\DynamicLibrary +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Export +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\ExtensionSupported +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Field +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\FieldReader +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\FieldReaderIterator +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\FileNameUtils +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Fog +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Geode +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\GeoSet +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\GeoState +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Gl +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Group +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Image +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Input +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Light +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\LightSource +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Lighting +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Lod +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Material +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Matrix +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Node +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\NodeVisitor +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Notify +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Object +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Osg +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Output +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Point +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\PolygonOffset +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Quat +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Referenced +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Registry +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Scene +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Seg +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Sequence +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\State +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Switch +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\TexEnv +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\TexGen +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\TexMat +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Texture +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Timer +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Transparency +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Types +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Vec2 +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Vec3 +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Version +# End Source File +# Begin Source File + +SOURCE=..\..\Include\Osg\Vec4 +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/VisualStudio/osgGLUT/osgGLUT.dsp b/VisualStudio/osgGLUT/osgGLUT.dsp new file mode 100755 index 000000000..e720a096a --- /dev/null +++ b/VisualStudio/osgGLUT/osgGLUT.dsp @@ -0,0 +1,135 @@ +# Microsoft Developer Studio Project File - Name="osgGLUT" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=osgGLUT - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "osgGLUT.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "osgGLUT.mak" CFG="osgGLUT - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "osgGLUT - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "osgGLUT - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "osgGLUT - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "../../lib" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "../../lib" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBOSGGLUT_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /vd1 /GR /GX /O2 /I "../../include" /D "NDEBUG" /D "_MBCS" /D "_USRDLL" /D "LIBOSGGLUT_EXPORTS" /D "OSGGLUT_LIBRARY" /D "WIN32" /D "_WINDOWS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "NDEBUG" +# ADD RSC /l 0x809 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 osgUtil.lib osg.lib opengl32.lib glu32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /pdb:"../../bin/osgGLUT.pdb" /machine:I386 /out:"../../bin/osgGLUT.dll" /libpath:"../../lib" +# SUBTRACT LINK32 /pdb:none + +!ELSEIF "$(CFG)" == "osgGLUT - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "../../lib" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBOSGGLUT_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /vmg /vd0 /GR /GX /ZI /Od /I "../../include" /D "_DEBUG" /D "OSGGLUT_LIBRARY" /D "WIN32" /D "_WINDOWS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "_DEBUG" +# ADD RSC /l 0x809 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 osgUtild.lib osgd.lib opengl32.lib glu32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /pdb:"../../bin/osgGLUTd.pdb" /debug /machine:I386 /out:"../../bin/osgGLUTd.dll" /pdbtype:sept /libpath:"../../lib" +# SUBTRACT LINK32 /pdb:none + +!ENDIF + +# Begin Target + +# Name "osgGLUT - Win32 Release" +# Name "osgGLUT - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\..\Src\osgGLUT\GLUTEventAdapter.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\osgGLUT\Viewer.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\osgGLUT\Version.cpp +# End Source File +# End Group + +# Begin Group "Header Files" + +# PROP Default_Filter ";h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\..\Include\osgGLUT\GLUTEventAdapter +# End Source File +# Begin Source File + +SOURCE=..\..\Include\osgGLUT\Viewer +# End Source File +# Begin Source File + +SOURCE=..\..\Include\osgGLUT\Export +# End Source File +# Begin Source File + +SOURCE=..\..\Include\osgGLUT\Version +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project + diff --git a/VisualStudio/osgPlugins/flt/flt.dsp b/VisualStudio/osgPlugins/flt/flt.dsp new file mode 100644 index 000000000..c6a3d863d --- /dev/null +++ b/VisualStudio/osgPlugins/flt/flt.dsp @@ -0,0 +1,404 @@ +# Microsoft Developer Studio Project File - Name="flt" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=flt - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "flt.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "flt.mak" CFG="flt - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "flt - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "flt - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "flt - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FLT_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GR /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FLT_LIBRARY" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x414 /d "NDEBUG" +# ADD RSC /l 0x417 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 osg.lib opengl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /pdb:none /machine:I386 /out:"../../../bin/osgdb_flt.dll" /libpath:"../../../lib" + +!ELSEIF "$(CFG)" == "flt - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "../../../lib" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FLT_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /vmg /vd0 /GR /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FLT_LIBRARY" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x414 /d "_DEBUG" +# ADD RSC /l 0x417 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 osgd.lib glut32.lib glu32.lib opengl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /pdb:"../../../bin/osgdb_fltd.pdb" /debug /machine:I386 /out:"../../../bin/osgdb_fltd.dll" /pdbtype:sept /libpath:"../../../lib" +# SUBTRACT LINK32 /pdb:none /incremental:no + +!ENDIF + +# Begin Target + +# Name "flt - Win32 Release" +# Name "flt - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\BoundingVolumeRecords.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\ColorPaletteRecord.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\CommentRecord.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\ControlRecord.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\DofRecord.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\ExtensionRecord.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\ExternalRecord.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\FaceRecord.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\flt.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\flt2osg.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\FltFile.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\GeoSetBuilder.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\GroupRecord.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\HeaderRecord.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\Input.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\InstanceRecords.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\LightPointRecord.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\LightSourcePaletteRecord.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\LightSourceRecord.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\LodRecord.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\LongIDRecord.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\MaterialPaletteRecord.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\ObjectRecord.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\OldVertexRecords.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\Pool.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\ReaderWriterFLT.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\Record.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\RecordVisitor.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\Registry.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\SwitchRecord.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\TextureMappingPaletteRecord.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\TexturePaletteRecord.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\TransformationRecords.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\UnknownRecord.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\VertexPoolRecords.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl;" +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\BoundingVolumeRecords.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\ColorPaletteRecord.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\CommentRecord.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\ControlRecord.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\DofRecord.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\export.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\ExtensionRecord.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\ExternalRecord.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\FaceRecord.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\flt.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\flt2osg.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\FltFile.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\FltRecords.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\GeoSetBuilder.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\GroupRecord.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\HeaderRecord.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\Input.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\InstanceRecords.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\LightPointRecord.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\LightSourcePaletteRecord.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\LightSourceRecord.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\LodRecord.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\LongIDRecord.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\MaterialPaletteRecord.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\ObjectRecord.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\OldVertexRecords.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\opcodes.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\Pool.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\ReaderWriterFLT.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\Record.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\RecordVisitor.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\Referenced.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\Registry.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\SwitchRecord.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\TextureMappingPaletteRecord.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\TexturePaletteRecord.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\TransformationRecords.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\UnknownRecord.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\VertexPoolRecords.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\flt\license.txt +# End Source File +# End Group +# End Target +# End Project diff --git a/VisualStudio/osgPlugins/fly/fly.dsp b/VisualStudio/osgPlugins/fly/fly.dsp new file mode 100755 index 000000000..90460ed4d --- /dev/null +++ b/VisualStudio/osgPlugins/fly/fly.dsp @@ -0,0 +1,155 @@ +# Microsoft Developer Studio Project File - Name="fly" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=fly - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "fly.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "fly.mak" CFG="fly - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "fly - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "fly - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "fly - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "../../../lib" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FLY_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GR /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FLY_EXPORTS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "NDEBUG" +# ADD RSC /l 0x809 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 osg.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"../../../bin/osgdb_fly.dll" /libpath:"../../../lib" + +!ELSEIF "$(CFG)" == "fly - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "../../../lib" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FLY_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /vmg /vd0 /GR /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "FLY_EXPORTS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "_DEBUG" +# ADD RSC /l 0x809 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 osgd.lib glu32.lib opengl32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"../../../bin/osgdb_flyd.dll" /pdbtype:sept /libpath:"../../../lib" + +!ENDIF + +# Begin Target + +# Name "fly - Win32 Release" +# Name "fly - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\Fly\Base.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\Fly\Fly.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\Fly\Hat.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\Fly\Matrix.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\Fly\Sky.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\Fly\Tank.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\Fly\Terrain.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\Fly\Trees.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\Fly\Vector.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\Fly\Hat.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\Fly\Matrix.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\Fly\terrain_data.h +# End Source File +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\Fly\Vector.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/VisualStudio/osgPlugins/gif/gif.dsp b/VisualStudio/osgPlugins/gif/gif.dsp new file mode 100755 index 000000000..bac94e1fb --- /dev/null +++ b/VisualStudio/osgPlugins/gif/gif.dsp @@ -0,0 +1,109 @@ +# Microsoft Developer Studio Project File - Name="gif" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=gif - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "gif.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "gif.mak" CFG="gif - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "gif - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "gif - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "gif - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "../../../lib" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "gif_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GR /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "gif_EXPORTS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "NDEBUG" +# ADD RSC /l 0x809 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 osg.lib /NODEFAULTLIB:LIBC ungif.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"../../../bin/osgdb_gif.dll" /libpath:"../../../lib" +# SUBTRACT LINK32 /nodefaultlib + +!ELSEIF "$(CFG)" == "gif - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "../../../lib" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "gif_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /vmg /vd0 /GR /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GIF_EXPORTS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "_DEBUG" +# ADD RSC /l 0x809 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 osgd.lib /NODEFAULTLIB:LIBC ungif.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"../../../bin/osgdb_gifd.dll" /pdbtype:sept /libpath:"../../../lib" +# SUBTRACT LINK32 /nodefaultlib + +!ENDIF + +# Begin Target + +# Name "gif - Win32 Release" +# Name "gif - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\gif\ReaderWriterGIF.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/VisualStudio/osgPlugins/jpeg/jpeg.dsp b/VisualStudio/osgPlugins/jpeg/jpeg.dsp new file mode 100755 index 000000000..58bd354dd --- /dev/null +++ b/VisualStudio/osgPlugins/jpeg/jpeg.dsp @@ -0,0 +1,109 @@ +# Microsoft Developer Studio Project File - Name="jpeg" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=jpeg - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "jpeg.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "jpeg.mak" CFG="jpeg - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "jpeg - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "jpeg - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "jpeg - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "../../../lib" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "jpeg_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GR /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "jpeg_EXPORTS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "NDEBUG" +# ADD RSC /l 0x809 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 osg.lib /NODEFAULTLIB:LIBC jpeg.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"../../../bin/osgdb_jpeg.dll" /libpath:"../../../lib" +# SUBTRACT LINK32 /nodefaultlib + +!ELSEIF "$(CFG)" == "jpeg - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "../../../lib" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "jpeg_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /vmg /vd0 /GR /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JPEG_EXPORTS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "_DEBUG" +# ADD RSC /l 0x809 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 osgd.lib /NODEFAULTLIB:LIBC jpeg.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"../../../bin/osgdb_jpegd.dll" /pdbtype:sept /libpath:"../../../lib" +# SUBTRACT LINK32 /nodefaultlib + +!ENDIF + +# Begin Target + +# Name "jpeg - Win32 Release" +# Name "jpeg - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\jpeg\ReaderWriterJPEG.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/VisualStudio/osgPlugins/pic/pic.dsp b/VisualStudio/osgPlugins/pic/pic.dsp new file mode 100755 index 000000000..cea44abcf --- /dev/null +++ b/VisualStudio/osgPlugins/pic/pic.dsp @@ -0,0 +1,109 @@ +# Microsoft Developer Studio Project File - Name="pic" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=pic - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "pic.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "pic.mak" CFG="pic - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "pic - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "pic - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "pic - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "../../../lib" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "pic_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GR /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "pic_EXPORTS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "NDEBUG" +# ADD RSC /l 0x809 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 osg.lib /NODEFAULTLIB:LIBC kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"../../../bin/osgdb_pic.dll" /libpath:"../../../lib" +# SUBTRACT LINK32 /nodefaultlib + +!ELSEIF "$(CFG)" == "pic - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "../../../lib" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "pic_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /vmg /vd0 /GR /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PIC_EXPORTS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "_DEBUG" +# ADD RSC /l 0x809 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 osgd.lib /NODEFAULTLIB:LIBC kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"../../../bin/osgdb_picd.dll" /pdbtype:sept /libpath:"../../../lib" +# SUBTRACT LINK32 /nodefaultlib + +!ENDIF + +# Begin Target + +# Name "pic - Win32 Release" +# Name "pic - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\pic\ReaderWriterPIC.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/VisualStudio/osgPlugins/png/png.dsp b/VisualStudio/osgPlugins/png/png.dsp new file mode 100755 index 000000000..27e0a3ecf --- /dev/null +++ b/VisualStudio/osgPlugins/png/png.dsp @@ -0,0 +1,109 @@ +# Microsoft Developer Studio Project File - Name="png" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=png - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "png.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "png.mak" CFG="png - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "png - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "png - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "png - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "../../../lib" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "png_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GR /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "png_EXPORTS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "NDEBUG" +# ADD RSC /l 0x809 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 osg.lib /NODEFAULTLIB:LIBC libpng.lib zlibstat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"../../../bin/osgdb_png.dll" /libpath:"../../../lib" +# SUBTRACT LINK32 /nodefaultlib + +!ELSEIF "$(CFG)" == "png - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "../../../lib" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "png_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /vmg /vd0 /GR /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PNG_EXPORTS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "_DEBUG" +# ADD RSC /l 0x809 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 osgd.lib /NODEFAULTLIB:LIBC libpng.lib zlibstat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"../../../bin/osgdb_pngd.dll" /pdbtype:sept /libpath:"../../../lib" +# SUBTRACT LINK32 /nodefaultlib + +!ENDIF + +# Begin Target + +# Name "png - Win32 Release" +# Name "png - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\png\ReaderWriterPNG.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/VisualStudio/osgPlugins/tga/tga.dsp b/VisualStudio/osgPlugins/tga/tga.dsp new file mode 100755 index 000000000..cb6730775 --- /dev/null +++ b/VisualStudio/osgPlugins/tga/tga.dsp @@ -0,0 +1,109 @@ +# Microsoft Developer Studio Project File - Name="tga" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=tga - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "tga.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "tga.mak" CFG="tga - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "tga - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "tga - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "tga - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "../../../lib" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "tga_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GR /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "tga_EXPORTS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "NDEBUG" +# ADD RSC /l 0x809 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 osg.lib /NODEFAULTLIB:LIBC kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"../../../bin/osgdb_tga.dll" /libpath:"../../../lib" +# SUBTRACT LINK32 /nodefaultlib + +!ELSEIF "$(CFG)" == "tga - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "../../../lib" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "tga_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /vmg /vd0 /GR /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TGA_EXPORTS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "_DEBUG" +# ADD RSC /l 0x809 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 osgd.lib /NODEFAULTLIB:LIBC kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"../../../bin/osgdb_tgad.dll" /pdbtype:sept /libpath:"../../../lib" +# SUBTRACT LINK32 /nodefaultlib + +!ENDIF + +# Begin Target + +# Name "tga - Win32 Release" +# Name "tga - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\tga\ReaderWriterTGA.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/VisualStudio/osgPlugins/tiff/tiff.dsp b/VisualStudio/osgPlugins/tiff/tiff.dsp new file mode 100755 index 000000000..d0cb831ea --- /dev/null +++ b/VisualStudio/osgPlugins/tiff/tiff.dsp @@ -0,0 +1,109 @@ +# Microsoft Developer Studio Project File - Name="tiff" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=tiff - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "tiff.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "tiff.mak" CFG="tiff - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "tiff - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "tiff - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "tiff - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "../../../lib" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "tiff_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /GR /GX /O2 /I "../../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "tiff_EXPORTS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "NDEBUG" +# ADD RSC /l 0x809 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 osg.lib /NODEFAULTLIB:LIBC tiff.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"../../../bin/osgdb_tiff.dll" /libpath:"../../../lib" +# SUBTRACT LINK32 /nodefaultlib + +!ELSEIF "$(CFG)" == "tiff - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "../../../lib" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "tiff_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /vmg /vd0 /GR /GX /ZI /Od /I "../../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TIFF_EXPORTS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "_DEBUG" +# ADD RSC /l 0x809 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 osgd.lib /NODEFAULTLIB:LIBC tiff.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"../../../bin/osgdb_tiffd.dll" /pdbtype:sept /libpath:"../../../lib" +# SUBTRACT LINK32 /nodefaultlib + +!ENDIF + +# Begin Target + +# Name "tiff - Win32 Release" +# Name "tiff - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\..\..\src\osgPlugins\tiff\ReaderWriterTIFF.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/VisualStudio/osgUtil/osgUtil.dsp b/VisualStudio/osgUtil/osgUtil.dsp new file mode 100755 index 000000000..fa80b88ac --- /dev/null +++ b/VisualStudio/osgUtil/osgUtil.dsp @@ -0,0 +1,189 @@ +# Microsoft Developer Studio Project File - Name="osgUtil" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=osgUtil - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "osgUtil.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "osgUtil.mak" CFG="osgUtil - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "osgUtil - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "osgUtil - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "osgUtil - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "../../lib" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "../../lib" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBOSGUTIL_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MT /W3 /vd1 /GR /GX /O2 /I "../../include" /D "NDEBUG" /D "_MBCS" /D "_USRDLL" /D "LIBOSGUTIL_EXPORTS" /D "OSGUTIL_LIBRARY" /D "WIN32" /D "_WINDOWS" /YX /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "NDEBUG" +# ADD RSC /l 0x809 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 osg.lib opengl32.lib glu32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /pdb:"../../bin/osgUtil.pdb" /machine:I386 /out:"../../bin/osgUtil.dll" /libpath:"../../lib" +# SUBTRACT LINK32 /pdb:none + +!ELSEIF "$(CFG)" == "osgUtil - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "../../lib" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBOSGUTIL_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MTd /W3 /Gm /vmg /vd0 /GR /GX /ZI /Od /I "../../include" /D "_DEBUG" /D "OSGUTIL_LIBRARY" /D "WIN32" /D "_WINDOWS" /YX /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "_DEBUG" +# ADD RSC /l 0x809 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 osgd.lib opengl32.lib glu32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /pdb:"../../bin/osgUtild.pdb" /debug /machine:I386 /out:"../../bin/osgUtild.dll" /pdbtype:sept /libpath:"../../lib" +# SUBTRACT LINK32 /pdb:none + +!ENDIF + +# Begin Target + +# Name "osgUtil - Win32 Release" +# Name "osgUtil - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=..\..\Src\osgUtil\CameraManipulator.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\osgUtil\DisplayListVisitor.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\src\osgUtil\DriveManipulator.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\src\osgUtil\FlightManipulator.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\osgUtil\IntersectVisitor.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\osgUtil\RenderVisitor.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\osgUtil\SceneView.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\osgUtil\Version.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\Src\osgUtil\TrackballManipulator.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter ";h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\..\Include\osgUtil\CameraManipulator +# End Source File +# Begin Source File + +SOURCE=..\..\Include\osgUtil\DisplayListVisitor +# End Source File +# Begin Source File + +SOURCE=..\..\include\osgUtil\DriveManipulator +# End Source File +# Begin Source File + +SOURCE=..\..\Include\osgUtil\Export +# End Source File +# Begin Source File + +SOURCE=..\..\include\osgUtil\FlightManipulator +# End Source File +# Begin Source File + +SOURCE=..\..\include\osgUtil\GUIActionAdapter +# End Source File +# Begin Source File + +SOURCE=..\..\include\osgUtil\GUIEventAdapter +# End Source File +# Begin Source File + +SOURCE=..\..\Include\osgUtil\IntersectVisitor +# End Source File +# Begin Source File + +SOURCE=..\..\Include\osgUtil\RenderVisitor +# End Source File +# Begin Source File + +SOURCE=..\..\Include\osgUtil\SceneView +# End Source File +# Begin Source File + +SOURCE=..\..\Include\osgUtil\Version +# End Source File +# Begin Source File + +SOURCE=..\..\include\osgUtil\TrackballManipulator +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# End Target +# End Project diff --git a/dist/.osg.spec.swp b/dist/.osg.spec.swp new file mode 100644 index 000000000..077699f42 Binary files /dev/null and b/dist/.osg.spec.swp differ diff --git a/dist/Irix/Makefile b/dist/Irix/Makefile new file mode 100644 index 000000000..201c0d515 --- /dev/null +++ b/dist/Irix/Makefile @@ -0,0 +1,16 @@ +SHELL = /bin/sh + + +all : irixdist tardist + + +irixdist : + cd ${OSGHOME}; [ -d irixdist ] || mkdir irixdist + cd ${OSGHOME}; \ + /usr/sbin/gendist -sbase ${OSGHOME} -idb dist/Irix/osg.idb -spec dist/Irix/osg.spec -dist irixdist -all + + +tardist : irixdist + cd ${OSGHOME}/irixdist;\ + tar cvf osg.tardist osg osg.idb osg.sw + diff --git a/dist/Irix/osg.idb b/dist/Irix/osg.idb new file mode 100644 index 000000000..76eb36b06 --- /dev/null +++ b/dist/Irix/osg.idb @@ -0,0 +1,80 @@ +f 0755 root sys usr/bin/sgv bin/sgv osg.sw.base +d 0755 root sys usr/include/osg include/osg osg.sw.base +f 0666 root sys usr/include/osg/AlphaFunc include/osg/AlphaFunc osg.sw.base +f 0666 root sys usr/include/osg/Billboard include/osg/Billboard osg.sw.base +f 0666 root sys usr/include/osg/BoundingBox include/osg/BoundingBox osg.sw.base +f 0666 root sys usr/include/osg/BoundingSphere include/osg/BoundingSphere osg.sw.base +f 0666 root sys usr/include/osg/Camera include/osg/Camera osg.sw.base +f 0666 root sys usr/include/osg/CullFace include/osg/CullFace osg.sw.base +f 0666 root sys usr/include/osg/DCS include/osg/DCS osg.sw.base +f 0666 root sys usr/include/osg/DynamicLibrary include/osg/DynamicLibrary osg.sw.base +f 0666 root sys usr/include/osg/Export include/osg/Export osg.sw.base +f 0666 root sys usr/include/osg/ExtensionSupported include/osg/ExtensionSupported osg.sw.base +f 0666 root sys usr/include/osg/Field include/osg/Field osg.sw.base +f 0666 root sys usr/include/osg/FieldReader include/osg/FieldReader osg.sw.base +f 0666 root sys usr/include/osg/FieldReaderIterator include/osg/FieldReaderIterator osg.sw.base +f 0666 root sys usr/include/osg/FileNameUtils include/osg/FileNameUtils osg.sw.base +f 0666 root sys usr/include/osg/Fog include/osg/Fog osg.sw.base +f 0666 root sys usr/include/osg/GL include/osg/GL osg.sw.base +f 0666 root sys usr/include/osg/GeoSet include/osg/GeoSet osg.sw.base +f 0666 root sys usr/include/osg/GeoState include/osg/GeoState osg.sw.base +f 0666 root sys usr/include/osg/Geode include/osg/Geode osg.sw.base +f 0666 root sys usr/include/osg/Group include/osg/Group osg.sw.base +f 0666 root sys usr/include/osg/Image include/osg/Image osg.sw.base +f 0666 root sys usr/include/osg/Input include/osg/Input osg.sw.base +f 0666 root sys usr/include/osg/LOD include/osg/LOD osg.sw.base +f 0666 root sys usr/include/osg/Light include/osg/Light osg.sw.base +f 0666 root sys usr/include/osg/LightSource include/osg/LightSource osg.sw.base +f 0666 root sys usr/include/osg/Lighting include/osg/Lighting osg.sw.base +f 0666 root sys usr/include/osg/Material include/osg/Material osg.sw.base +f 0666 root sys usr/include/osg/Matrix include/osg/Matrix osg.sw.base +f 0666 root sys usr/include/osg/Node include/osg/Node osg.sw.base +f 0666 root sys usr/include/osg/NodeVisitor include/osg/NodeVisitor osg.sw.base +f 0666 root sys usr/include/osg/Notify include/osg/Notify osg.sw.base +f 0666 root sys usr/include/osg/OSG include/osg/OSG osg.sw.base +f 0666 root sys usr/include/osg/Object include/osg/Object osg.sw.base +f 0666 root sys usr/include/osg/Output include/osg/Output osg.sw.base +f 0666 root sys usr/include/osg/Point include/osg/Point osg.sw.base +f 0666 root sys usr/include/osg/PolygonOffset include/osg/PolygonOffset osg.sw.base +f 0666 root sys usr/include/osg/Quat include/osg/Quat osg.sw.base +f 0666 root sys usr/include/osg/Referenced include/osg/Referenced osg.sw.base +f 0666 root sys usr/include/osg/Registry include/osg/Registry osg.sw.base +f 0666 root sys usr/include/osg/Scene include/osg/Scene osg.sw.base +f 0666 root sys usr/include/osg/Seg include/osg/Seg osg.sw.base +f 0666 root sys usr/include/osg/Sequence include/osg/Sequence osg.sw.base +f 0666 root sys usr/include/osg/State include/osg/State osg.sw.base +f 0666 root sys usr/include/osg/Switch include/osg/Switch osg.sw.base +f 0666 root sys usr/include/osg/TexEnv include/osg/TexEnv osg.sw.base +f 0666 root sys usr/include/osg/TexGen include/osg/TexGen osg.sw.base +f 0666 root sys usr/include/osg/TexMat include/osg/TexMat osg.sw.base +f 0666 root sys usr/include/osg/Texture include/osg/Texture osg.sw.base +f 0666 root sys usr/include/osg/Timer include/osg/Timer osg.sw.base +f 0666 root sys usr/include/osg/Transparency include/osg/Transparency osg.sw.base +f 0666 root sys usr/include/osg/Types include/osg/Types osg.sw.base +f 0666 root sys usr/include/osg/Vec2 include/osg/Vec2 osg.sw.base +f 0666 root sys usr/include/osg/Vec3 include/osg/Vec3 osg.sw.base +f 0666 root sys usr/include/osg/Vec4 include/osg/Vec4 osg.sw.base +f 0666 root sys usr/include/osg/Version include/osg/Version osg.sw.base +d 0750 root sys usr/include/osgUtil include/osgUtil osg.sw.base +f 0666 root sys usr/include/osgUtil/CameraManipulator include/osgUtil/CameraManipulator osg.sw.base +f 0666 root sys usr/include/osgUtil/DisplayListVisitor include/osgUtil/DisplayListVisitor osg.sw.base +f 0666 root sys usr/include/osgUtil/DriveManipulator include/osgUtil/DriveManipulator osg.sw.base +f 0666 root sys usr/include/osgUtil/Export include/osgUtil/Export osg.sw.base +f 0666 root sys usr/include/osgUtil/FlightManipulator include/osgUtil/FlightManipulator osg.sw.base +f 0666 root sys usr/include/osgUtil/GUIActionAdapter include/osgUtil/GUIActionAdapter osg.sw.base +f 0666 root sys usr/include/osgUtil/GUIEventAdapter include/osgUtil/GUIEventAdapter osg.sw.base +f 0666 root sys usr/include/osgUtil/IntersectVisitor include/osgUtil/IntersectVisitor osg.sw.base +f 0666 root sys usr/include/osgUtil/RenderVisitor include/osgUtil/RenderVisitor osg.sw.base +f 0666 root sys usr/include/osgUtil/SceneView include/osgUtil/SceneView osg.sw.base +f 0666 root sys usr/include/osgUtil/TrackballManipulator include/osgUtil/TrackballManipulator osg.sw.base +f 0666 root sys usr/include/osgUtil/Version include/osgUtil/Version osg.sw.base +f 0755 root sys usr/lib32/libosg.so lib/libosg.so osg.sw.base +f 0755 root sys usr/lib32/libosgUtil.so lib/libosgUtil.so osg.sw.base +d 0755 root sys usr/lib32/osgPlugins lib/osgPlugins osg.sw.base +f 0755 root sys usr/lib32/osgPlugins/osgdb_flt.so lib/osgPlugins/osgdb_flt.so osg.sw.base +f 0755 root sys usr/lib32/osgPlugins/osgdb_fly.so lib/osgPlugins/osgdb_fly.so osg.sw.base +f 0755 root sys usr/lib32/osgPlugins/osgdb_jpg.so lib/osgPlugins/osgdb_jpg.so osg.sw.base +f 0755 root sys usr/lib32/osgPlugins/osgdb_osgtgz.so lib/osgPlugins/osgdb_osgtgz.so osg.sw.base +f 0755 root sys usr/lib32/osgPlugins/osgdb_pic.so lib/osgPlugins/osgdb_pic.so osg.sw.base +f 0755 root sys usr/lib32/osgPlugins/osgdb_tga.so lib/osgPlugins/osgdb_tga.so osg.sw.base +f 0755 root sys usr/lib32/osgPlugins/osgdb_tif.so lib/osgPlugins/osgdb_tif.so osg.sw.base diff --git a/dist/Irix/osg.spec b/dist/Irix/osg.spec new file mode 100644 index 000000000..aae09e0a4 --- /dev/null +++ b/dist/Irix/osg.spec @@ -0,0 +1,13 @@ +product osg + id "OpenSceneGraph" + image sw + id "Software" + version 1 + order 9999 + subsys base default + id "Base Software" + replaces self + exp osg.sw.base + endsubsys + endimage +endproduct diff --git a/dist/RedHatRPM/Makefile b/dist/RedHatRPM/Makefile new file mode 100644 index 000000000..7f5f07831 --- /dev/null +++ b/dist/RedHatRPM/Makefile @@ -0,0 +1,29 @@ +SHELL = /bin/sh + +BINDIRS = \ + OpenSceneGraph-${OSGVERSION}/bin/\ + OpenSceneGraph-${OSGVERSION}/include/\ + OpenSceneGraph-${OSGVERSION}/lib/\ + +all :: rpm + + +rpm : osg.spec tardist + rpm -bb --clean osg.spec + + +osg.spec : makespec + makespec + +tardist : + @[ -n "${OSGHOME}" ] || (echo Please define OSGHOME; exit 3) + @[ -n "${OSGVERSION}" ] || (echo Please define OSGVERSION; exit 4) + @[ -n "${OSGRELEASE}" ] || (echo Please define OSGRELEASE; exit 5) + @[ "`whoami`" = "root" ] || (echo Must be ROOT; exit 6) + (cd ${OSGHOME}/..; \ + tar cf - ${BINDIRS} | gzip > \ + /usr/src/redhat/SOURCES/osg-${OSGVERSION}-${OSGRELEASE}.tar.gz) + + +clean : + rm -f osg.spec diff --git a/dist/RedHatRPM/makespec b/dist/RedHatRPM/makespec new file mode 100755 index 000000000..a648f3820 --- /dev/null +++ b/dist/RedHatRPM/makespec @@ -0,0 +1,84 @@ +#!/bin/sh + +list_install_files() +{ + for d in \ + ${OSGHOME}/bin\ + ${OSGHOME}/lib\ + ${OSGHOME}/include + do + dd=`basename $d` + for f in `ls -1 $d` + do + echo cp -rf \ + /usr/src/redhat/BUILD/OpenSceneGraph-"$OSGVERSION"/$dd/$f /usr/$dd/$f + done + done +} + +list_attr_files() +{ + for d in \ + ${OSGHOME}/bin\ + ${OSGHOME}/lib + do + dd=`basename $d` + for f in $d/* + do + ff=`basename $f` + echo "%attr(755, root, root) /usr/$dd/$ff" + done + done + + for f in ${OSGHOME}/include/osg/* + do + ff=`basename $f` + echo "%attr(444, root, root) /usr/include/osg/$ff" + done +} + +[ -z "$OSGHOME" ] && (echo Please define OSGHOME; exit 1) +[ -z "$OSGVERSION" ] && (echo Please define OSGVERSION; exit 1) +[ -z "$OSGRELEASE" ] && (echo Please define OSGRELEASE; exit 1) + + + + +cat <<-LEOF > osg.spec + +Summary: Open Scene Graph +Name: OpenSceneGraph +Version: $OSGVERSION +Release: $OSGRELEASE +Copyright: GLPL +Group: Graphics +Source: osg-$OSGVERSION-$OSGRELEASE.tar.gz +URL: http://www.openscenegraph.org +Packager: `awk -f - /etc/passwd <<-EOF +BEGIN { FS=":"} +{ + if( \\$1 == "$LOGNAME" ) + print \\$5 +} +EOF` + +%description + +Open Scene Graph is an open-source scene graph API. + +%prep +%setup +%build +%install + +`list_install_files` + + + +# --------------------- +# FILES Sections +%files + +`list_attr_files` + +LEOF diff --git a/dist/RedHatRPM/osg.spec b/dist/RedHatRPM/osg.spec new file mode 100644 index 000000000..79b8d2bee --- /dev/null +++ b/dist/RedHatRPM/osg.spec @@ -0,0 +1,32 @@ + +Summary: Open Scene Graph +Name: OpenSceneGraph +Version: 0.8 +Release: 2 +Copyright: GLPL +Group: Graphics +Source: osg-0.8-2.tar.gz +URL: http://www.openscenegraph.org +Packager: Robert Osfield + +%description + +Open Scene Graph is an open-source scene graph API. + +%prep +%setup +%build +%install + + + + + +# --------------------- +# FILES Sections +%files + +%attr(755, root, root) /usr/bin/* +%attr(755, root, root) /usr/lib/* +%attr(444, root, root) /usr/include/osg/* + diff --git a/doc/Doxyfile b/doc/Doxyfile new file mode 100644 index 000000000..ae377245c --- /dev/null +++ b/doc/Doxyfile @@ -0,0 +1,708 @@ +# Doxyfile 1.2.2 + +# This file describes the settings to be used by doxygen for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# General configuration options +#--------------------------------------------------------------------------- + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = "OpenSceneGraph & Utility Toolkit" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = 0.8-26 + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = $(OSGHOME)/docs/doxygen + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Dutch, French, Italian, Czech, Swedish, German, Finnish, Japanese, +# Korean, Hungarian, Spanish, Romanian, Russian, Croatian, Polish, and +# Portuguese. + +OUTPUT_LANGUAGE = English + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these class will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = NO + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. It is allowed to use relative paths in the argument list. + +STRIP_FROM_PATH = + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a class diagram (in Html and LaTeX) for classes with base or +# super classes. Setting the tag to NO turns the diagrams off. + +CLASS_DIAGRAMS = YES + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower case letters. If set to YES upper case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# users are adviced to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the JAVADOC_AUTOBRIEF tag is set to YES (the default) then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the Javadoc-style will +# behave just like the Qt-style comments. + +JAVADOC_AUTOBRIEF = YES + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# reimplements. + +INHERIT_DOCS = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# The ENABLE_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. + +WARN_FORMAT = "$file:$line: $text" + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = $(OSGHOME) + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +FILE_PATTERNS = */include/* */src/*/*.cpp + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. + +EXCLUDE_PATTERNS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. + +INPUT_FILTER = + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = NO + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = NO + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimised for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using a WORD or other. +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assigments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = YES + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. Warning: This feature +# is still experimental and very incomplete. + +GENERATE_XML = NO + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_PREDEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +#--------------------------------------------------------------------------- +# Configuration::addtions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES tag can be used to specify one or more tagfiles. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = YES + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the ENABLE_PREPROCESSING, INCLUDE_GRAPH, and HAVE_DOT tags are set to +# YES then doxygen will generate a graph for each documented file showing +# the direct and indirect include dependencies of the file with other +# documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, INCLUDED_BY_GRAPH, and HAVE_DOT tags are set to +# YES then doxygen will generate a graph for each documented header file showing +# the documented files that directly or indirectly include this file + +INCLUDED_BY_GRAPH = YES + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. + +DOT_PATH = + +# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_WIDTH = 1024 + +# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height +# (in pixels) of the graphs generated by dot. If a graph becomes larger than +# this value, doxygen will try to truncate the graph, so that it fits within +# the specified constraint. Beware that most browsers cannot cope with very +# large images. + +MAX_DOT_GRAPH_HEIGHT = 1024 + +#--------------------------------------------------------------------------- +# Configuration::addtions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = NO + +# The CGI_NAME tag should be the name of the CGI script that +# starts the search engine (doxysearch) with the correct parameters. +# A script with this name will be generated by doxygen. + +CGI_NAME = search.cgi + +# The CGI_URL tag should be the absolute URL to the directory where the +# cgi binaries are located. See the documentation of your http daemon for +# details. + +CGI_URL = + +# The DOC_URL tag should be the absolute URL to the directory where the +# documentation is located. If left blank the absolute path to the +# documentation, with file:// prepended to it, will be used. + +DOC_URL = + +# The DOC_ABSPATH tag should be the absolute path to the directory where the +# documentation is located. If left blank the directory on the local machine +# will be used. + +DOC_ABSPATH = + +# The BIN_ABSPATH tag must point to the directory where the doxysearch binary +# is installed. + +BIN_ABSPATH = /usr/local/bin/ + +# The EXT_DOC_PATHS tag can be used to specify one or more paths to +# documentation generated for other projects. This allows doxysearch to search +# the documentation for these projects as well. + +EXT_DOC_PATHS = diff --git a/doc/MindMaps/DesignPatterns.mmp b/doc/MindMaps/DesignPatterns.mmp new file mode 100644 index 000000000..b76f6d4d0 Binary files /dev/null and b/doc/MindMaps/DesignPatterns.mmp differ diff --git a/doc/MindMaps/DesignPatterns/DesignPatterns.gif b/doc/MindMaps/DesignPatterns/DesignPatterns.gif new file mode 100755 index 000000000..9c6171bba Binary files /dev/null and b/doc/MindMaps/DesignPatterns/DesignPatterns.gif differ diff --git a/doc/MindMaps/DesignPatterns/DesignPatterns.html b/doc/MindMaps/DesignPatterns/DesignPatterns.html new file mode 100755 index 000000000..bd61be938 --- /dev/null +++ b/doc/MindMaps/DesignPatterns/DesignPatterns.html @@ -0,0 +1,16 @@ + + + + + +Design Patterns + + + + +
+ + + + + diff --git a/doc/MindMaps/Mission.mmp b/doc/MindMaps/Mission.mmp new file mode 100644 index 000000000..f0c171d59 Binary files /dev/null and b/doc/MindMaps/Mission.mmp differ diff --git a/doc/MindMaps/Mission/Mission.gif b/doc/MindMaps/Mission/Mission.gif new file mode 100755 index 000000000..fba220ba6 Binary files /dev/null and b/doc/MindMaps/Mission/Mission.gif differ diff --git a/doc/MindMaps/Mission/Mission.html b/doc/MindMaps/Mission/Mission.html new file mode 100755 index 000000000..286604f84 --- /dev/null +++ b/doc/MindMaps/Mission/Mission.html @@ -0,0 +1,16 @@ + + + + + +Mission + + + + +
+ + + + + diff --git a/doc/UML/osg.png b/doc/UML/osg.png new file mode 100644 index 000000000..7cd87b08e Binary files /dev/null and b/doc/UML/osg.png differ diff --git a/doc/UML/osgutils.png b/doc/UML/osgutils.png new file mode 100644 index 000000000..c165859f0 Binary files /dev/null and b/doc/UML/osgutils.png differ diff --git a/doc/index.html b/doc/index.html new file mode 100644 index 000000000..e0cea4404 --- /dev/null +++ b/doc/index.html @@ -0,0 +1,35 @@ + + + + + + OSG Documentation + + + +
+

+Open Scene Graph Documentation

+The documentation on the OSG is still in its early stages, and far from +complete. If you can't find your answers in what documentation there currently +is, please feel free to post the question on the OSG mailing list. +

Introduction, distribution contents and contacts +

Reference guides (automatically generated using doc++) +

osg/               +core scene graph reference guide. +
osgUtil/          +scene graph utilities reference guide. +
osgGLUT/     simple +GLUT based viewer base classes reference guide.
+UML Diagrams +
osg                +UML diagram of the osg core library +
osgUtil           +UML diagram of the osg utilities library
+Mind Maps +
Design +Pattern used in the OSG. +
Mission Statement for OSG.
+ + + diff --git a/doc/osg/AlphaFunc.html b/doc/osg/AlphaFunc.html new file mode 100644 index 000000000..3aee26d17 --- /dev/null +++ b/doc/osg/AlphaFunc.html @@ -0,0 +1,245 @@ + + + class SG_EXPORT osg::AlphaFunc + + + + +

class SG_EXPORT osg::AlphaFunc: public Object

+
Encapsulte OpenGL glAlphaFunc
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Classes

+[more]enum ComparisonFunction +
+

+ +

+

Public Methods

+[more] AlphaFunc() +
+
+[more]static AlphaFunc* instance() +
+
+[more]virtual bool isSameKindAs(Object* obj) +
+
+[more]virtual Object* clone() const +
+
+[more]virtual const char* className() const +
+
+[more]void setFunction(ComparisonFunction func, float ref) +
+
+[more]ComparisonFunction getFunction() const +
+
+[more]float getRefrenceValue() const +
+
+[more]static void enable() +
+
+[more]static void disable() +
+
+[more]void apply() +
+

+ +

+

Protected Fields

+[more]ComparisonFunction _comparisonFunc +
+
+[more]float _referenceValue +
+

+ +

+

Protected Methods

+[more]virtual ~AlphaFunc() +
+
+[more]virtual bool readLocalData(Input& fr) +
+
+[more]virtual bool writeLocalData(Output& fw) +
+
+[more]bool matchFuncStr(const char* str, ComparisonFunction& func) +
+
+[more]const char* getFuncStr(ComparisonFunction func) +
+

+ +
+

Inherited from Object:

+
+

+

Public Methods

+ovirtual Object* readClone(Input& fr) +
+ovirtual bool write(Output& fw) +

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+oReferenced& operator = (Referenced&) +
+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _refCount +

+ +
+ + +
+

Documentation

+
Encapsulte OpenGL glAlphaFunc
+
+ + + +
oenum ComparisonFunction +

+ + + +
o NEVER +

+ + +

o LESS +

+ + +

o EQUAL +

+ + +

o LEQUAL +

+ + +

o GREATER +

+ + +

o NOTEQUAL +

+ + +

o GEQUAL +

+ + +

o ALWAYS +

+ + + +
o AlphaFunc() +

+ + +

ostatic AlphaFunc* instance() +

+ + +

ovirtual bool isSameKindAs(Object* obj) +

+ + +

ovirtual Object* clone() const +

+ + +

ovirtual const char* className() const +

+ + +

ovoid setFunction(ComparisonFunction func, float ref) +

+ + +

oComparisonFunction getFunction() const +

+ + +

ofloat getRefrenceValue() const +

+ + +

ostatic void enable() +

+ + +

ostatic void disable() +

+ + +

ovoid apply() +

+ + +

ovirtual ~AlphaFunc() +

+ + +

ovirtual bool readLocalData(Input& fr) +

+ + +

ovirtual bool writeLocalData(Output& fw) +

+ + +

obool matchFuncStr(const char* str, ComparisonFunction& func) +

+ + +

oconst char* getFuncStr(ComparisonFunction func) +

+ + +

oComparisonFunction _comparisonFunc +

+ + +

ofloat _referenceValue +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/Billboard.html b/doc/osg/Billboard.html new file mode 100644 index 000000000..2da81ae9f --- /dev/null +++ b/doc/osg/Billboard.html @@ -0,0 +1,394 @@ + + + class SG_EXPORT osg::Billboard + + + + +

class SG_EXPORT osg::Billboard: public Geode

+
Billboard - a Geode which orientates its child osg::GeoSet's to face the eye point.
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Classes

+[more]enum Mode +
+

+ +

+

Public Methods

+[more] Billboard() +
+
+[more]virtual Object* clone() const +
+
+[more]virtual bool isSameKindAs(Object* obj) +
+
+[more]virtual const char* className() const +
+
+[more]virtual void accept(NodeVisitor& nv) +
+
+[more]void setAxis(const Vec3& axis) +
+
+[more]void getAxis(Vec3& axis) const +
+
+[more]void setMode(Mode mode) +
+
+[more]int getMode() const +
+
+[more]void setPos(int i, const Vec3& pos) +
+
+[more]void getPos(int i, Vec3& pos) const +
+
+[more]virtual bool addGeoSet( GeoSet *gset ) +
Add GeoSet to Billboard with default position(0,0,0); If gset not NULL and is not contained in Billboard then increment its reference count, and dirty the bounding box to cause it to recompute on next getBound() and return true for success. +
+[more]virtual bool addGeoSet(GeoSet *gset, const Vec3& pos) +
Add GeoSet to Geode at position pos. +
+[more]virtual bool removeGeoSet( GeoSet *gset ) +
Remove GeoSet and associated position from Billboard. +
+[more]void calcRotation(const Vec3& eye_local, const Vec3& pos_local, Matrix& mat) +
+
+[more]void calcTransform(const Vec3& eye_local, const Vec3& pos_local, Matrix& mat) +
+

+ +

+

Protected Fields

+[more]Mode _mode +
+
+[more]Vec3 _axis +
+
+[more]PositionList _positionList +
+

+ +

+

Protected Methods

+[more]virtual ~Billboard() +
+
+[more]virtual bool readLocalData(Input& fr) +
+
+[more]virtual bool writeLocalData(Output& fw) +
+
+[more]virtual bool computeBound( void ) +
+

+ +

+

Protected

+[more]typedef std::vector<Vec3> PositionList +
+

+ +
+

Inherited from Geode:

+
+

+

Public Methods

+ovirtual bool replaceGeoSet( GeoSet *origGset, GeoSet *newGset ) +
+oint getNumGeosets( void ) const +
+oGeoSet* getGeoSet( int i ) +
+obool containsGeoSet( GeoSet* gset) +
+oGeoSetList::iterator findGeoSet( GeoSet* gset) +
+ovoid compileGeoSets( void ) +

+ +

+

Public

+otypedef std::vector< ref_ptr<GeoSet> > GeoSetList +

+ +

+

Protected Fields

+oGeoSetList _geosets +

+ +
+

Inherited from Node:

+
+

+

Public Methods

+oNode* cloneNode() const +
+ovirtual void ascend(NodeVisitor& nv) +
+ovirtual void traverse(NodeVisitor& ) +
+ovoid setName( const std::string& name ) +
+ovoid setName( const char* name ) +
+oconst std::string& getName( void ) +
+oconst ParentList& getParents() const +
+oGroup* getParent(int i) const +
+oint getNumParents() const +
+ovoid setUserData(void* data, MemoryAdapter* ma=0L) +
+ovoid* getUserData() const +
+oMemoryAdapter* getMemoryAdapter() const +
+ovoid setNodeMask(NodeMask nm) +
+oNodeMask getNodeMask() +
+oconst DescriptionList& getDescriptions() const +
+oDescriptionList& getDescriptions() +
+oconst std::string& getDescription(int i) const +
+ostd::string& getDescription(int i) +
+oint getNumDescriptions() const +
+ovoid addDescription(const std::string& desc) +
+oconst BoundingSphere& getBound() +
+ovoid dirtyBound() +

+ +

+

Public

+otypedef std::vector<Group*> ParentList +
+otypedef unsigned int NodeMask +
+otypedef std::vector<std::string> DescriptionList +

+ +

+

Protected Fields

+oBoundingSphere _bsphere +
+obool _bsphere_computed +
+ostd::string _name +
+oParentList _parents +
+ofriend Group +
+ovoid* _userData +
+oref_ptr<MemoryAdapter> _memoryAdapter +
+oNodeMask _nodeMask +
+oDescriptionList _descriptions +

+ +
+

Inherited from Object:

+
+

+

Public Methods

+ovirtual Object* readClone(Input& fr) +
+ovirtual bool write(Output& fw) +

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+oReferenced& operator = (Referenced&) +
+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _refCount +

+ +
+ + +
+

Documentation

+
Billboard - a Geode which orientates its child osg::GeoSet's to face +the eye point. +Typical uses are for trees, or particle explosions.
+
+ + + +
oenum Mode +

+ + + +
o AXIAL_ROT +

+ + +

o POINT_ROT_EYE +

+ + +

o POINT_ROT_WORLD +

+ + + +
o Billboard() +

+ + +

ovirtual Object* clone() const +

+ + +

ovirtual bool isSameKindAs(Object* obj) +

+ + +

ovirtual const char* className() const +

+ + +

ovirtual void accept(NodeVisitor& nv) +

+ + +

ovoid setAxis(const Vec3& axis) +

+ + +

ovoid getAxis(Vec3& axis) const +

+ + +

ovoid setMode(Mode mode) +

+ + +

oint getMode() const +

+ + +

ovoid setPos(int i, const Vec3& pos) +

+ + +

ovoid getPos(int i, Vec3& pos) const +

+ + +

ovirtual bool addGeoSet( GeoSet *gset ) +
Add GeoSet to Billboard with default position(0,0,0); +If gset not NULL and is not contained in Billboard then increment its +reference count, and dirty the bounding box to cause it to recompute on +next getBound() and return true for success. Otherwise return false. +

+ + +

ovirtual bool addGeoSet(GeoSet *gset, const Vec3& pos) +
Add GeoSet to Geode at position pos. +If gset not NULL and is not contained in Billboard then increment its +reference count, and dirty the bounding box to cause it to recompute on +next getBound() and return true for success. Otherwise return false. +

+ + +

ovirtual bool removeGeoSet( GeoSet *gset ) +
Remove GeoSet and associated position from Billboard. +If gset is contained in Billboard then remove it from the geoset +list and decrement its reference count, and dirty the +bounding box to cause it to recompute on next getBound() and +return true for success. If gset is not found then return false +and do not the reference count of gset is left unchanged. +

+ + +

ovoid calcRotation(const Vec3& eye_local, const Vec3& pos_local, Matrix& mat) +

+ + +

ovoid calcTransform(const Vec3& eye_local, const Vec3& pos_local, Matrix& mat) +

+ + +

ovirtual ~Billboard() +

+ + +

ovirtual bool readLocalData(Input& fr) +

+ + +

ovirtual bool writeLocalData(Output& fw) +

+ + +

ovirtual bool computeBound( void ) +

+ + +

otypedef std::vector<Vec3> PositionList +

+ + +

oMode _mode +

+ + +

oVec3 _axis +

+ + +

oPositionList _positionList +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/BoundingBox.html b/doc/osg/BoundingBox.html new file mode 100644 index 000000000..6e2e33df5 --- /dev/null +++ b/doc/osg/BoundingBox.html @@ -0,0 +1,234 @@ + + + class SG_EXPORT osg::BoundingBox + + + + +

class SG_EXPORT osg::BoundingBox

+
General purpose axis-aligned bounding box class for enclosing objects/vertices.
+
+ +
+

+

Public Fields

+[more]Vec3 _min +
The corner with the smallest values for each coordinate of the bounding box +
+[more]Vec3 _max +
The corner with the largest values for each coordinate of the bounding box +

+ +

+

Public Methods

+[more] BoundingBox() +
construct to invalid values to represent an unset bounding box +
+[more]void init() +
initialize to invalid values to represent an unset bounding box +
+[more]bool isValid() const +
return true if the bounding box contains valid values, false if the bounding box is effectively unset/empty +
+[more]float& xMin() +
+
+[more]float xMin() const +
+
+[more]float& yMin() +
+
+[more]float yMin() const +
+
+[more]float& zMin() +
+
+[more]float zMin() const +
+
+[more]float& xMax() +
+
+[more]float xMax() const +
+
+[more]float& yMax() +
+
+[more]float yMax() const +
+
+[more]float& zMax() +
+
+[more]float zMax() const +
+
+[more]Vec3 center() const +
Calculate and return the center of the bounding box +
+[more]float radius() const +
Calculate and return the radius of the bounding box +
+[more]float radius2() const +
Calculate and return the radius squared of the bounding box. +
+[more]Vec3 corner(unsigned int pos) const +
return the corner of the bounding box. +
+[more]void expandBy(const Vec3& v) +
If the vertex is outwith the box expand to ecompass vertex. +
+[more]void expandBy(const BoundingBox& bb) +
If incomming box is outwith the box expand to ecompass incomming box. +
+[more]void expandBy(const BoundingSphere& sh) +
If incomming sphere is outwith the box expand to ecompass incomming sphere. +
+[more]bool contains(const Vec3& v) +
return true is vertex v is within the box +

+ +
+ + +
+

Documentation

+
General purpose axis-aligned bounding box class for enclosing objects/vertices. +Used to bounding the leaf objects in the scene, +i.e. osg::GeoSet's to assist in view frustum culling etc.
+
+ + + +
oVec3 _min +
The corner with the smallest values for each coordinate of the +bounding box +

+ + +

oVec3 _max +
The corner with the largest values for each coordinate of the +bounding box +

+ + +

o BoundingBox() +
construct to invalid values to represent an unset bounding box +

+ + +

ovoid init() +
initialize to invalid values to represent an unset bounding box +

+ + +

obool isValid() const +
return true if the bounding box contains valid values, +false if the bounding box is effectively unset/empty +

+ + +

ofloat& xMin() +

+ + +

ofloat xMin() const +

+ + +

ofloat& yMin() +

+ + +

ofloat yMin() const +

+ + +

ofloat& zMin() +

+ + +

ofloat zMin() const +

+ + +

ofloat& xMax() +

+ + +

ofloat xMax() const +

+ + +

ofloat& yMax() +

+ + +

ofloat yMax() const +

+ + +

ofloat& zMax() +

+ + +

ofloat zMax() const +

+ + +

oVec3 center() const +
Calculate and return the center of the bounding box +

+ + +

ofloat radius() const +
Calculate and return the radius of the bounding box +

+ + +

ofloat radius2() const +
Calculate and return the radius squared of the bounding box. +Note, radius2() is faster to calculate than radius(). +

+ + +

oVec3 corner(unsigned int pos) const +
return the corner of the bounding box. +Position (pos) is specfied by a number between 0 and 7, +the first bit toggles between x min and x max, second +bit toggles between y min and y max, third bit toggles +between z min and z max. +

+ + +

ovoid expandBy(const Vec3& v) +
If the vertex is outwith the box expand to ecompass vertex. +If this box is empty then move set this box's min max to vertex. +

+ + +

ovoid expandBy(const BoundingBox& bb) +
If incomming box is outwith the box expand to ecompass incomming box. +If this box is empty then move set this box to incomming box. +

+ + +

ovoid expandBy(const BoundingSphere& sh) +
If incomming sphere is outwith the box expand to ecompass incomming sphere. +If this box is empty then move set this box to encompass the sphere. +

+ + +

obool contains(const Vec3& v) +
return true is vertex v is within the box +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/BoundingSphere.html b/doc/osg/BoundingSphere.html new file mode 100644 index 000000000..d19d64dec --- /dev/null +++ b/doc/osg/BoundingSphere.html @@ -0,0 +1,169 @@ + + + class SG_EXPORT osg::BoundingSphere + + + + +

class SG_EXPORT osg::BoundingSphere

+
General purpose bounding sphere class for enclosing nodes/objects/vertices.
+
+ +
+

+

Public Fields

+[more]Vec3 _center +
+
+[more]float _radius +
+

+ +

+

Public Methods

+[more] BoundingSphere() +
construct to invalid values to represent an unset bounding sphere +
+[more]void init() +
initialize to invalid values to represent an unset bounding sphere +
+[more]bool isValid() const +
return true if the bounding sphere contains valid values, false if the bounding sphere is effectively unset +
+[more]const Vec3& center() const +
return the const center of the bounding sphere +
+[more]Vec3& center() +
return the center of the bounding sphere +
+[more]float radius() const +
return the const radius of the bounding sphere +
+[more]float& radius() +
return the radius of the bounding sphere +
+[more]float radius2() const +
return the radius squared. +
+[more]void expandBy(const Vec3& v) +
If the vertex is outwith the sphere expand to ecompass vertex. +
+[more]void expandRadiusBy(const Vec3& v) +
If the vertex is outwith the sphere expand radius to ecompass vertex. +
+[more]void expandBy(const BoundingSphere& sh) +
If incomming sphere is outwith the sphere expand to ecompass incomming sphere. +
+[more]void expandRadiusBy(const BoundingSphere& sh) +
If incomming sphere is outwith the sphere expand radius to ecompass incomming sphere. +
+[more]bool contains(const Vec3& v) +
return true is vertex v is within the sphere +

+ +
+ + +
+

Documentation

+
General purpose bounding sphere class for enclosing nodes/objects/vertices. +Used to bound internal osg::Node's in the scene, +to assist in view frustrum culling etc. Similar in function to BoundingBox +but is quicker for evaluating culling, but generally encloses a greater volume +than a BoundingBox so will not cull so aggressively.
+
+ + + +
oVec3 _center +

+ + +

ofloat _radius +

+ + +

o BoundingSphere() +
construct to invalid values to represent an unset bounding sphere +

+ + +

ovoid init() +
initialize to invalid values to represent an unset bounding sphere +

+ + +

obool isValid() const +
return true if the bounding sphere contains valid values, +false if the bounding sphere is effectively unset +

+ + +

oconst Vec3& center() const +
return the const center of the bounding sphere +

+ + +

oVec3& center() +
return the center of the bounding sphere +

+ + +

ofloat radius() const +
return the const radius of the bounding sphere +

+ + +

ofloat& radius() +
return the radius of the bounding sphere +

+ + +

ofloat radius2() const +
return the radius squared. +Note, for performance reasons, assumes the calling method has ensured +that the sphere is valid before calling radius2(), i.e. has _radius>=0.0, +as it does not check th validity of sphere and will eroneously return a positive value. +

+ + +

ovoid expandBy(const Vec3& v) +
If the vertex is outwith the sphere expand to ecompass vertex. +Calculates the combination of movement of center and radius which +minimizes the radius increase. If this sphere is empty then +move the centrer to v and set radius to 0. +

+ + +

ovoid expandRadiusBy(const Vec3& v) +
If the vertex is outwith the sphere expand radius to ecompass vertex. +Unlike update, does not move the center, just increasing the radius. +If this sphere is empty then move the centrer to v and set radius to 0 +

+ + +

ovoid expandBy(const BoundingSphere& sh) +
If incomming sphere is outwith the sphere expand to ecompass incomming sphere. +calculates the combination of movement of center and radius which +minimizes the radius increase. If this sphere is empty then +move the centrer to v and set radius to 0. +

+ + +

ovoid expandRadiusBy(const BoundingSphere& sh) +
If incomming sphere is outwith the sphere expand radius to ecompass incomming sphere. +Unlike update, does not move the center, just increasing the radius. +If this sphere is empty then move the centrer to v and set radius to 0. +

+ + +

obool contains(const Vec3& v) +
return true is vertex v is within the sphere +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/Camera.html b/doc/osg/Camera.html new file mode 100644 index 000000000..db0e0da45 --- /dev/null +++ b/doc/osg/Camera.html @@ -0,0 +1,260 @@ + + + class SG_EXPORT osg::Camera + + + + +

class SG_EXPORT osg::Camera: public osg::Referenced

+
Camera class for encapsulating the view position and orientation.
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Methods

+[more] Camera() +
+
+[more]virtual ~Camera() +
+
+[more]void setFieldOfView(double fovy, double aspectRatio) +
Set field of view and window aspect ratio. +
+[more]void setFieldOfViewY(double fovy) +
+
+[more]double getFieldOfViewY() const +
+
+[more]void setAspectRatio(double aspectRatio) +
+
+[more]double getAspectRatio() const +
+
+[more]void home() +
hardwired home view for now, looking straight down the Z axis at the origin, with 'up' being the y axis +
+[more]void setView(Vec3 eyePoint, Vec3 lookPoint, Vec3 upVector) +
Set the View, the up vector should be orthogonal to the look vector +
+[more]const Vec3& getEyePoint() const +
get the eyepoint. +
+[more]const Vec3& getLookPoint() const +
get the lookpoint. +
+[more]const Vec3& getUpVector() const +
which way is up? +
+[more]Vec3 getSideVector() const +
calculate side vector +
+[more]Vec3 getLookVector() const +
calculate look vector +
+[more]float getFocalDistance() const +
calculate focal distance +
+[more]void setNearPlane(double nearPlane) +
set the near plane. +
+[more]double getNearPlane() const +
get the near plane. +
+[more]void setFarPlane(double farPlane) +
set the far plane. +
+[more]double getFarPlane() const +
get the far plane. +
+[more]void draw_PROJECTION() const +
Set up the OpenGL GL_PROJECTION matrix. +
+[more]void draw_MODELVIEW() const +
Set up the OpenGL GL_MODELVIEW matrix. +
+[more]void mult(const Camera& camera, const Matrix& m) +
post multiply a camera by matrix +
+[more]void mult(const Matrix& m, const Camera& camera) +
pre multiply a camera by matrix +
+[more]void ensureOrthogonalUpVector() +
+

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+oReferenced& operator = (Referenced&) +
+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _refCount +

+ +
+ + +
+

Documentation

+
Camera class for encapsulating the view position and orientation. +This is the first implementation of osg::Camera class and +currently is a perspective camera, but in future will be +a base class from which PerpsectivCamera,FrustumCamera and OrthoCamera +will be derived.
+
+ + + +
o Camera() +

+ + +

ovirtual ~Camera() +

+ + +

ovoid setFieldOfView(double fovy, double aspectRatio) +
+Set field of view and window aspect ratio. +The parameters have the same meaning as their counterparts +in gluPerspective(fovy,aspectRatio +

+ + +

ovoid setFieldOfViewY(double fovy) +

+ + +

odouble getFieldOfViewY() const +

+ + +

ovoid setAspectRatio(double aspectRatio) +

+ + +

odouble getAspectRatio() const +

+ + +

ovoid home() +
+hardwired home view for now, looking straight down the +Z axis at the origin, with 'up' being the y axis +

+ + +

ovoid setView(Vec3 eyePoint, Vec3 lookPoint, Vec3 upVector) +
+Set the View, the up vector should be orthogonal to the +look vector +

+ + +

oconst Vec3& getEyePoint() const +
get the eyepoint. +

+ + +

oconst Vec3& getLookPoint() const +
get the lookpoint. +

+ + +

oconst Vec3& getUpVector() const +
which way is up? +

+ + +

oVec3 getSideVector() const +
calculate side vector +

+ + +

oVec3 getLookVector() const +
calculate look vector +

+ + +

ofloat getFocalDistance() const +
calculate focal distance +

+ + +

ovoid setNearPlane(double nearPlane) +
set the near plane. +

+ + +

odouble getNearPlane() const +
get the near plane. +

+ + +

ovoid setFarPlane(double farPlane) +
set the far plane. +

+ + +

odouble getFarPlane() const +
get the far plane. +

+ + +

ovoid draw_PROJECTION() const +
Set up the OpenGL GL_PROJECTION matrix. +Enters the GL_PROJECTION mode, sets up matrix, then +resets model GL_MODELVIEW, which is by OpenGL convention the default. +

+ + +

ovoid draw_MODELVIEW() const +
Set up the OpenGL GL_MODELVIEW matrix. +Enters the GL_MODELVIEW mode, sets matrix to identity +and then sets matrix up according to camera, eye point, center +point and upvector. +

+ + +

ovoid mult(const Camera& camera, const Matrix& m) +
post multiply a camera by matrix +

+ + +

ovoid mult(const Matrix& m, const Camera& camera) +
pre multiply a camera by matrix +

+ + +

ovoid ensureOrthogonalUpVector() +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/ClassGraph.class b/doc/osg/ClassGraph.class new file mode 100644 index 000000000..4f41a1fb2 Binary files /dev/null and b/doc/osg/ClassGraph.class differ diff --git a/doc/osg/ClassGraphPanel.class b/doc/osg/ClassGraphPanel.class new file mode 100644 index 000000000..4f3ea86bb Binary files /dev/null and b/doc/osg/ClassGraphPanel.class differ diff --git a/doc/osg/ClassLayout.class b/doc/osg/ClassLayout.class new file mode 100644 index 000000000..69a6f494e Binary files /dev/null and b/doc/osg/ClassLayout.class differ diff --git a/doc/osg/CullFace.html b/doc/osg/CullFace.html new file mode 100644 index 000000000..787b3e772 --- /dev/null +++ b/doc/osg/CullFace.html @@ -0,0 +1,193 @@ + + + class SG_EXPORT osg::CullFace + + + + +

class SG_EXPORT osg::CullFace: public Object

+
Class to globally enable/disable OpenGL's polygon culling mode (GL_CULL_FACE)
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Classes

+[more]enum Mode +
+

+ +

+

Public Methods

+[more] CullFace() +
+
+[more]static CullFace* instance() +
+
+[more]virtual bool isSameKindAs(Object* obj) +
+
+[more]virtual Object* clone() const +
+
+[more]virtual const char* className() const +
+
+[more]void setMode(Mode mode) +
+
+[more]static void enable() +
Enable the polygon culling mode +
+[more]static void disable() +
Disable the polygon culling mode +
+[more]void apply() +
+

+ +

+

Protected Fields

+[more]Mode _mode +
+

+ +

+

Protected Methods

+[more]virtual ~CullFace() +
+
+[more]virtual bool readLocalData(Input& fr) +
+
+[more]virtual bool writeLocalData(Output& fw) +
+

+ +
+

Inherited from Object:

+
+

+

Public Methods

+ovirtual Object* readClone(Input& fr) +
+ovirtual bool write(Output& fw) +

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+oReferenced& operator = (Referenced&) +
+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _refCount +

+ +
+ + +
+

Documentation

+
Class to globally enable/disable OpenGL's polygon culling mode +(GL_CULL_FACE)
+
+ + + +
oenum Mode +

+ + + +
o FRONT +

+ + +

o BACK +

+ + +

o FRONT_AND_BACK +

+ + + +
o CullFace() +

+ + +

ostatic CullFace* instance() +

+ + +

ovirtual bool isSameKindAs(Object* obj) +

+ + +

ovirtual Object* clone() const +

+ + +

ovirtual const char* className() const +

+ + +

ovoid setMode(Mode mode) +

+ + +

ostatic void enable() +
Enable the polygon culling mode +

+ + +

ostatic void disable() +
Disable the polygon culling mode +

+ + +

ovoid apply() +

+ + +

ovirtual ~CullFace() +

+ + +

ovirtual bool readLocalData(Input& fr) +

+ + +

ovirtual bool writeLocalData(Output& fw) +

+ + +

oMode _mode +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/DCS.html b/doc/osg/DCS.html new file mode 100644 index 000000000..8c26c5acb --- /dev/null +++ b/doc/osg/DCS.html @@ -0,0 +1,293 @@ + + + class SG_EXPORT osg::DCS + + + + +

class SG_EXPORT osg::DCS: public Group

+
DCS - Dynamic Coordinate System a is group which all children are transformed by the the DCS's osg::Matrix.
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Methods

+[more] DCS() +
+
+[more] DCS(const Matrix& matix) +
+
+[more]virtual Object* clone() const +
+
+[more]virtual bool isSameKindAs(Object* obj) +
+
+[more]virtual const char* className() const +
+
+[more]virtual void accept(NodeVisitor& nv) +
+
+[more]void setMatrix(const Matrix& mat ) +
+
+[more]Matrix* getMatrix() +
+
+[more]void preTranslate( float tx, float ty, float tz ) +
+
+[more]void preRotate( float deg, float x, float y, float z ) +
+
+[more]bool computeBound() +
+

+ +

+

Protected Fields

+[more]Matrix* _mat +
+

+ +

+

Protected Methods

+[more]virtual ~DCS() +
+
+[more]virtual bool readLocalData(Input& fr) +
+
+[more]virtual bool writeLocalData(Output& fw) +
+

+ +
+

Inherited from Group:

+
+

+

Public Methods

+ovirtual void traverse(NodeVisitor& nv) +
+ovirtual bool addChild( Node *child ) +
+ovirtual bool removeChild( Node *child ) +
+ovirtual bool replaceChild( Node *origChild, Node* newChild ) +
+oint getNumChildren( void ) +
+oNode* getChild( int i ) +
+obool containsNode( Node* node ) +
+oChildList::iterator findNode( Node* node ) +

+ +

+

Public

+otypedef std::vector<ref_ptr<Node> > ChildList +

+ +

+

Protected Fields

+oChildList _children +

+ +
+

Inherited from Node:

+
+

+

Public Methods

+oNode* cloneNode() const +
+ovirtual void ascend(NodeVisitor& nv) +
+ovoid setName( const std::string& name ) +
+ovoid setName( const char* name ) +
+oconst std::string& getName( void ) +
+oconst ParentList& getParents() const +
+oGroup* getParent(int i) const +
+oint getNumParents() const +
+ovoid setUserData(void* data, MemoryAdapter* ma=0L) +
+ovoid* getUserData() const +
+oMemoryAdapter* getMemoryAdapter() const +
+ovoid setNodeMask(NodeMask nm) +
+oNodeMask getNodeMask() +
+oconst DescriptionList& getDescriptions() const +
+oDescriptionList& getDescriptions() +
+oconst std::string& getDescription(int i) const +
+ostd::string& getDescription(int i) +
+oint getNumDescriptions() const +
+ovoid addDescription(const std::string& desc) +
+oconst BoundingSphere& getBound() +
+ovoid dirtyBound() +

+ +

+

Public

+otypedef std::vector<Group*> ParentList +
+otypedef unsigned int NodeMask +
+otypedef std::vector<std::string> DescriptionList +

+ +

+

Protected Fields

+oBoundingSphere _bsphere +
+obool _bsphere_computed +
+ostd::string _name +
+oParentList _parents +
+ofriend Group +
+ovoid* _userData +
+oref_ptr<MemoryAdapter> _memoryAdapter +
+oNodeMask _nodeMask +
+oDescriptionList _descriptions +

+ +
+

Inherited from Object:

+
+

+

Public Methods

+ovirtual Object* readClone(Input& fr) +
+ovirtual bool write(Output& fw) +

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+oReferenced& operator = (Referenced&) +
+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _refCount +

+ +
+ + +
+

Documentation

+
DCS - Dynamic Coordinate System a is group which all children +are transformed by the the DCS's osg::Matrix. Typical uses +of the DCS is for positioning objects within a scene or +producing trakerball functionality.
+
+ + + +
o DCS() +

+ + +

o DCS(const Matrix& matix) +

+ + +

ovirtual Object* clone() const +

+ + +

ovirtual bool isSameKindAs(Object* obj) +

+ + +

ovirtual const char* className() const +

+ + +

ovirtual void accept(NodeVisitor& nv) +

+ + +

ovoid setMatrix(const Matrix& mat ) +

+ + +

oMatrix* getMatrix() +

+ + +

ovoid preTranslate( float tx, float ty, float tz ) +

+ + +

ovoid preRotate( float deg, float x, float y, float z ) +

+ + +

obool computeBound() +

+ + +

ovirtual ~DCS() +

+ + +

ovirtual bool readLocalData(Input& fr) +

+ + +

ovirtual bool writeLocalData(Output& fw) +

+ + +

oMatrix* _mat +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/DynamicLibrary.html b/doc/osg/DynamicLibrary.html new file mode 100644 index 000000000..32a273166 --- /dev/null +++ b/doc/osg/DynamicLibrary.html @@ -0,0 +1,167 @@ + + + class SG_EXPORT osg::DynamicLibrary + + + + +

class SG_EXPORT osg::DynamicLibrary: public Referenced

+
DynamicLibrary - encapsulates the loading and unloading of dynamic libraries, typically used for loading ReaderWriter plug-ins
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Methods

+[more]static DynamicLibrary* loadLibrary(const std::string& libraryName) +
+
+[more]const std::string& getName() const +
+
+[more]const std::string& getFullName() const +
+
+[more]HANDLE getHandle() const +
+
+[more]PROC_ADDRESS getProcAddress(const std::string& procName) +
+

+ +

+

Public

+[more]typedef void* HANDLE +
+
+[more]typedef void* PROC_ADDRESS +
+
+[more]typedef void* HANDLE +
+
+[more]typedef void* PROC_ADDRESS +
+

+ +

+

Protected Fields

+[more]HANDLE _handle +
+
+[more]std::string _name +
+
+[more]std::string _fullName +
+

+ +

+

Protected Methods

+[more] DynamicLibrary(const std::string& name, HANDLE handle) +
+
+[more] ~DynamicLibrary() +
+

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+oReferenced& operator = (Referenced&) +
+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _refCount +

+ +
+ + +
+

Documentation

+
DynamicLibrary - encapsulates the loading and unloading of dynamic libraries, +typically used for loading ReaderWriter plug-ins
+
+ + + +
otypedef void* HANDLE +

+ + +

otypedef void* PROC_ADDRESS +

+ + +

otypedef void* HANDLE +

+ + +

otypedef void* PROC_ADDRESS +

+ + +

ostatic DynamicLibrary* loadLibrary(const std::string& libraryName) +

+ + +

oconst std::string& getName() const +

+ + +

oconst std::string& getFullName() const +

+ + +

oHANDLE getHandle() const +

+ + +

oPROC_ADDRESS getProcAddress(const std::string& procName) +

+ + +

o DynamicLibrary(const std::string& name, HANDLE handle) +

+ + +

o ~DynamicLibrary() +

+ + +

oHANDLE _handle +

+ + +

ostd::string _name +

+ + +

ostd::string _fullName +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/ExtensionSupported.html b/doc/osg/ExtensionSupported.html new file mode 100644 index 000000000..725684022 --- /dev/null +++ b/doc/osg/ExtensionSupported.html @@ -0,0 +1,22 @@ + + + SG_EXPORT extern bool osg::ExtensionSupported + + + + +

SG_EXPORT extern bool osg::ExtensionSupported(const char *extension)

+
return true if OpenGL "extension" is supported.
+ + +
+

Documentation

+
return true if OpenGL "extension" is supported. +note: Must only called within a valid OpenGL context, +undefined behaviour may occur otherwise.
+
+
+

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/Field.html b/doc/osg/Field.html new file mode 100644 index 000000000..75c9852e6 --- /dev/null +++ b/doc/osg/Field.html @@ -0,0 +1,392 @@ + + + class SG_EXPORT osg::Field + + + + +

class SG_EXPORT osg::Field

+
+ +
+

+

Public Classes

+[more]enum +
+
+[more]enum FieldType +
+

+ +

+

Public Methods

+[more] Field() +
+
+[more] Field(const Field& field) +
+
+[more]virtual ~Field() +
+
+[more]virtual Field& operator = (const Field& ic) +
+
+[more]void reset() +
+
+[more]void addChar(char c) +
+
+[more]int getNoCharacters() const +
+
+[more]void setWithinQuotes(bool withinQuotes=true) +
+
+[more]bool getWithinQuotes() +
+
+[more]void setNoNestedBrackets(int no) +
+
+[more]int getNoNestedBrackets() +
+
+[more]FieldType getFieldType() const +
+
+[more]bool isValid() const +
+
+[more]bool isOpenBracket() const +
+
+[more]bool isCloseBracket() const +
+
+[more]bool isWord() const +
+
+[more]bool matchWord(const char* str) const +
+
+[more]bool matchWord(const char* str, int noCharacters) const +
+
+[more]bool isString() const +
+
+[more]bool matchString(const char* str) const +
+
+[more]bool matchString(const char* str, int noCharacters) const +
+
+[more]bool isQuotedString() const +
+
+[more]const char* getStr() const +
+
+[more]char* takeStr() +
+
+[more]bool isInt() const +
+
+[more]bool matchInt(int i) const +
+
+[more]bool getInt(int& i) const +
+
+[more]bool isFloat() const +
+
+[more]bool matchFloat(float f) const +
+
+[more]bool getFloat(float& f) const +
+
+[more]bool isDouble() const +
+
+[more]bool matchDouble(double f) const +
+
+[more]bool getDouble(double& d) const +
+
+[more]static FieldType calculateFieldType(const char* str, bool withinQuotes=false) +
+

+ +

+

Protected Fields

+[more]int _fieldCacheCapacity +
+
+[more]int _fieldCacheSize +
+
+[more]char* _fieldCache +
+
+[more]mutable FieldType _fieldType +
+
+[more]bool _withinQuotes +
+
+[more]int _noNestedBrackets +
+

+ +

+

Protected Methods

+[more]void _init() +
+
+[more]void _free() +
+
+[more]void _copy(const Field& ic) +
+

+ +
+ + +
+

Documentation

+
+ + + +
oenum +

+ + + +
o MIN_CACHE_SIZE +

+ + + +
o Field() +

+ + +

o Field(const Field& field) +

+ + +

ovirtual ~Field() +

+ + +

ovirtual Field& operator = (const Field& ic) +

+ + +

ovoid reset() +

+ + +

ovoid addChar(char c) +

+ + +

oint getNoCharacters() const +

+ + +

ovoid setWithinQuotes(bool withinQuotes=true) +

+ + +

obool getWithinQuotes() +

+ + +

ovoid setNoNestedBrackets(int no) +

+ + +

oint getNoNestedBrackets() +

+ + +

oenum FieldType +

+ + + +
o OPEN_BRACKET +

+ + +

o CLOSE_BRACKET +

+ + +

o STRING +

+ + +

o WORD +

+ + +

o REAL +

+ + +

o INTEGER +

+ + +

o BLANK +

+ + +

o UNINTIALISED +

+ + + +
oFieldType getFieldType() const +

+ + +

obool isValid() const +

+ + +

obool isOpenBracket() const +

+ + +

obool isCloseBracket() const +

+ + +

obool isWord() const +

+ + +

obool matchWord(const char* str) const +

+ + +

obool matchWord(const char* str, int noCharacters) const +

+ + +

obool isString() const +

+ + +

obool matchString(const char* str) const +

+ + +

obool matchString(const char* str, int noCharacters) const +

+ + +

obool isQuotedString() const +

+ + +

oconst char* getStr() const +

+ + +

ochar* takeStr() +

+ + +

obool isInt() const +

+ + +

obool matchInt(int i) const +

+ + +

obool getInt(int& i) const +

+ + +

obool isFloat() const +

+ + +

obool matchFloat(float f) const +

+ + +

obool getFloat(float& f) const +

+ + +

obool isDouble() const +

+ + +

obool matchDouble(double f) const +

+ + +

obool getDouble(double& d) const +

+ + +

ostatic FieldType calculateFieldType(const char* str, bool withinQuotes=false) +

+ + +

ovoid _init() +

+ + +

ovoid _free() +

+ + +

ovoid _copy(const Field& ic) +

+ + +

oint _fieldCacheCapacity +

+ + +

oint _fieldCacheSize +

+ + +

ochar* _fieldCache +

+ + +

omutable FieldType _fieldType +

+ + +

obool _withinQuotes +

+ + +

oint _noNestedBrackets +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/FieldReader.html b/doc/osg/FieldReader.html new file mode 100644 index 000000000..08c0b32d8 --- /dev/null +++ b/doc/osg/FieldReader.html @@ -0,0 +1,99 @@ + + + class SG_EXPORT osg::FieldReader + + + + +

class SG_EXPORT osg::FieldReader

+
+ +
+

+

Public Methods

+[more] FieldReader() +
+
+[more] FieldReader(const FieldReader& ic) +
+
+[more]virtual ~FieldReader() +
+
+[more]virtual FieldReader& operator = (const FieldReader& ic) +
+
+[more]void attach(istream* input) +
+
+[more]void detach() +
+
+[more]virtual bool eof() const +
+
+[more]bool readField(Field& fieldPtr) +
+
+[more]void ignoreField() +
+
+[more]int getNoNestedBrackets() const +
no of unmatched `{' encounterd so far in file +

+ +
+ + +
+

Documentation

+
+ + + +
o FieldReader() +

+ + +

o FieldReader(const FieldReader& ic) +

+ + +

ovirtual ~FieldReader() +

+ + +

ovirtual FieldReader& operator = (const FieldReader& ic) +

+ + +

ovoid attach(istream* input) +

+ + +

ovoid detach() +

+ + +

ovirtual bool eof() const +

+ + +

obool readField(Field& fieldPtr) +

+ + +

ovoid ignoreField() +

+ + +

oint getNoNestedBrackets() const +
no of unmatched `{' encounterd so far in file +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/FieldReaderIterator.html b/doc/osg/FieldReaderIterator.html new file mode 100644 index 000000000..3a44f9f1c --- /dev/null +++ b/doc/osg/FieldReaderIterator.html @@ -0,0 +1,184 @@ + + + class SG_EXPORT osg::FieldReaderIterator + + + + +

class SG_EXPORT osg::FieldReaderIterator

+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Classes

+[more]enum +
+

+ +

+

Public Methods

+[more] FieldReaderIterator() +
+
+[more] FieldReaderIterator(const FieldReaderIterator& ic) +
+
+[more]virtual ~FieldReaderIterator() +
+
+[more]virtual FieldReaderIterator& operator = (const FieldReaderIterator& ic) +
+
+[more]void attach(istream* input) +
+
+[more]void detach() +
+
+[more]virtual bool eof() const +
+
+[more]FieldReader& getFieldReader() +
+
+[more]void insert(int pos, Field* field) +
+
+[more]void insert(int pos, const char* str) +
+
+[more]Field& operator [] (int pos) +
+
+[more]Field& field(int pos) +
+
+[more]FieldReaderIterator& operator ++ () +
+
+[more]FieldReaderIterator& operator += (int no) +
+
+[more]void advanceOverCurrentFieldOrBlock() +
increments the itetor of the next simple field or whole block if the current field[0] is an open bracket +
+[more]void advanceToEndOfCurrentBlock() +
+
+[more]void advanceToEndOfBlock(int noNestBrackets) +
+
+[more]bool matchSequence(const char* str) +
+

+ +
+ + +
+

Documentation

+
+ + + +
oenum +

+ + + +
o MINIMUM_FIELD_READER_QUEUE_SIZE +

+ + + +
o FieldReaderIterator() +

+ + +

o FieldReaderIterator(const FieldReaderIterator& ic) +

+ + +

ovirtual ~FieldReaderIterator() +

+ + +

ovirtual FieldReaderIterator& operator = (const FieldReaderIterator& ic) +

+ + +

ovoid attach(istream* input) +

+ + +

ovoid detach() +

+ + +

ovirtual bool eof() const +

+ + +

oFieldReader& getFieldReader() +

+ + +

ovoid insert(int pos, Field* field) +

+ + +

ovoid insert(int pos, const char* str) +

+ + +

oField& operator [] (int pos) +

+ + +

oField& field(int pos) +

+ + +

oFieldReaderIterator& operator ++ () +

+ + +

oFieldReaderIterator& operator += (int no) +

+ + +

ovoid advanceOverCurrentFieldOrBlock() +
increments the itetor of the next simple field or +whole block if the current field[0] is an open bracket +

+ + +

ovoid advanceToEndOfCurrentBlock() +

+ + +

ovoid advanceToEndOfBlock(int noNestBrackets) +

+ + +

obool matchSequence(const char* str) +

+
+
Direct child classes: +
Input
+
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/Fog.html b/doc/osg/Fog.html new file mode 100644 index 000000000..0bf7a01f0 --- /dev/null +++ b/doc/osg/Fog.html @@ -0,0 +1,267 @@ + + + class SG_EXPORT osg::Fog + + + + +

class SG_EXPORT osg::Fog: public Object

+
Fog - encapsulates OpenGL fog state.
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Classes

+[more]enum FogMode +
+

+ +

+

Public Methods

+[more] Fog( void ) +
+
+[more]static Fog* instance() +
+
+[more]virtual Object* clone() const +
+
+[more]virtual bool isSameKindAs(Object* obj) +
+
+[more]virtual const char* className() const +
+
+[more]static void enable( void ) +
+
+[more]static void disable( void ) +
+
+[more]void apply( void ) +
+
+[more]void setMode( uint mode ) +
+
+[more]uint getMode( void ) +
+
+[more]void setDensity( float density ) +
+
+[more]float getDensity( void ) +
+
+[more]void setStart( float start ) +
+
+[more]float getStart( void ) +
+
+[more]void setEnd( float end ) +
+
+[more]float getEnd( void ) +
+
+[more]void setColor( Vec4 &color ) +
+

+ +

+

Protected Fields

+[more]uint _mode +
+
+[more]float _density +
+
+[more]float _start +
+
+[more]float _end +
+
+[more]Vec4 _color +
+

+ +

+

Protected Methods

+[more]virtual ~Fog( void ) +
+

+ +
+

Inherited from Object:

+
+

+

Public Methods

+ovirtual Object* readClone(Input& fr) +
+ovirtual bool write(Output& fw) +

+ +

+

Protected Methods

+ovirtual bool readLocalData(Input&) +
+ovirtual bool writeLocalData(Output&) +

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+oReferenced& operator = (Referenced&) +
+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _refCount +

+ +
+ + +
+

Documentation

+
Fog - encapsulates OpenGL fog state.
+
+ + + +
oenum FogMode +

+ + + +
o LINEAR +

+ + +

o EXP +

+ + +

o EXP2 +

+ + + +
o Fog( void ) +

+ + +

ostatic Fog* instance() +

+ + +

ovirtual Object* clone() const +

+ + +

ovirtual bool isSameKindAs(Object* obj) +

+ + +

ovirtual const char* className() const +

+ + +

ostatic void enable( void ) +

+ + +

ostatic void disable( void ) +

+ + +

ovoid apply( void ) +

+ + +

ovoid setMode( uint mode ) +

+ + +

ouint getMode( void ) +

+ + +

ovoid setDensity( float density ) +

+ + +

ofloat getDensity( void ) +

+ + +

ovoid setStart( float start ) +

+ + +

ofloat getStart( void ) +

+ + +

ovoid setEnd( float end ) +

+ + +

ofloat getEnd( void ) +

+ + +

ovoid setColor( Vec4 &color ) +

+ + +

ovirtual ~Fog( void ) +

+ + +

ouint _mode +

+ + +

ofloat _density +

+ + +

ofloat _start +

+ + +

ofloat _end +

+ + +

oVec4 _color +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/General.html b/doc/osg/General.html new file mode 100644 index 000000000..2d202f2d5 --- /dev/null +++ b/doc/osg/General.html @@ -0,0 +1,489 @@ + + + General Bits + + + + +
+
+ +o#define +OSG_ALPHAFUNC
+
+ +o +
+
+ +o#define +OSG_BILLBOARD
+
+ +o +
+
+ +o#define +OSG_BOUNDINGBOX
+
+ +o +
+
+ +o#define +OSG_BOUNDINGSPHERE
+
+ +o +
+
+ +o#define +OSG_CAMERA
+
+ +o#define +OSG_CULLFACE
+
+ +o +
+
+ +o#define +OSG_DCS
+
+ +o +
+
+ +o#define +OSG_DYNAMICLIBRARY
+
+ +o +
+
+ +o#define +OSG_EXPORT
+
+ +o#define +NULL
+
+ +o#define +NULL((void *)
+
+ +o#define +SG_EXPORT(dllexport)
+
+ +o#define +SG_EXPORT(dllimport)
+
+ +o#define +OSG_EXTENSIONSUPPORTED
+
+ +o +
+
+ +o#define +OSG_FIELD
+
+ +o +
+
+ +o#define +OSG_FIELDREADER
+
+ +o +
+
+ +o#define +OSG_FIELDREADERITERATOR
+
+ +o +
+
+ +o#define +OSG_FILENAMEUTILS
+
+ +o +
+
+ +o#define +OSG_FOG
+
+ +o +
+
+ +o#define +OSG_GL
+
+ +o#define +WIN32_LEAN_AND_MEAN
+
+ +o#define +GLUT_APIENTRY_DEFINED
+
+ +o#define +APIENTRY
+
+ +o#define +APIENTRY
+
+ +o#define +CALLBACK
+
+ +o#define +CALLBACK
+
+ +o#define +GLUT_WINGDIAPI_DEFINED
+
+ +o#define +WINGDIAPI(dllimport)
+
+ +otypedef unsigned short +wchar_t
+
+ +o#define +_WCHAR_T_DEFINED
+
+ +o#define +GL_GLEXT_LEGACY
+
+ +o#define +OSG_GEOSET
+
+ +o +
+
+ +o#define +OSG_GEOSTATE
+
+ +o +
+
+ +o#define +OSG_GEODE
+
+ +o +
+
+ +o#define +OSG_GROUP
+
+ +o +
+
+ +o#define +OSG_IMAGE
+
+ +o +
+
+ +o#define +OSG_INPUT
+
+ +o +
+
+ +o#define +OSG_LOD
+
+ +o +
+
+ +o#define +OSG_LIGHT
+
+ +o +
+
+ +o#define +OSG_LIGHTSOURCE
+
+ +o +
+
+ +o#define +OSG_LIGHTING
+
+ +o +
+
+ +o#define +OSG_MATERIAL
+
+ +o +
+
+ +o#define +OSG_MATRIX
+
+ +o +
+
+ +o#define +OSG_NODE
+
+ +o +
+
+ +o#define +OSG_NODEVISITOR
+
+ +o +
+
+ +o#define +OSG_NOTIFY
+
+ +o +
+
+ +o#define +OSG_OSG
+
+ +o +
+
+ +o#define +OSG_OBJECT
+
+ +o +
+
+ +o#define +OSG_OUTPUT
+
+ +o +
+
+ +o#define +OSG_POINT
+
+ +o +
+
+ +o#define +OSG_POLYGONOFFSET
+
+ +o +
+
+ +o#define +OSG_QUAT
+
+ +o +
+
+ +o#define +OSG_REFERENCED
+
+ +o +
+
+ +o#define +OSG_REGISTRY
+
+ +o +
+
+ +o#define +OSG_SCENE
+
+ +o +
+
+ +o#define +OSG_SEG
+
+ +o +
+
+ +o#define +OSG_SEQUENCE
+
+ +o +
+
+ +o#define +OSG_STATE
+
+ +o +
+
+ +o#define +OSG_SWITCH
+
+ +o +
+
+ +o#define +OSG_TEXENV
+
+ +o +
+
+ +o#define +OSG_TEXGEN
+
+ +o +
+
+ +o#define +OSG_TEXMAT
+
+ +o +
+
+ +o#define +OSG_TEXTURE
+
+ +o +
+
+ +o#define +OSG_TIMER
+
+ +o +
+
+ +o#define +OSG_TRANSPARENCY
+
+ +o +
+
+ +o#define +OSG_TYPES
+
+ +o +
+
+ +o#define +OSG_VEC2
+
+ +o#define +OSG_VEC3
+
+ +o#define +OSG_VEC4
+
+ +o#define +OSG_VERSION
+
+ +o +
+
+Alphabetic index Hierarchy of classes


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/GeoSet.html b/doc/osg/GeoSet.html new file mode 100644 index 000000000..f0d720a92 --- /dev/null +++ b/doc/osg/GeoSet.html @@ -0,0 +1,713 @@ + + + class SG_EXPORT osg::GeoSet + + + + +

class SG_EXPORT osg::GeoSet: public Object

+
Encapsulates OpenGL drawing primitives, geometry and optional binding of normal, color and texture coordinates.
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Classes

+[more]enum PrimitiveType +
+
+[more]enum BindingType +
+
+[more]enum InterleaveArrayType +
+

+ +

+

Public Methods

+[more] GeoSet() +
+
+[more]static GeoSet* instance() +
+
+[more]virtual Object* clone() const +
+
+[more]virtual bool isSameKindAs(Object* obj) +
+
+[more]virtual const char* className() const +
+
+[more]void setNumPrims( int n ) +
+
+[more]int getNumPrims( void ) +
+
+[more]void setPrimType( PrimitiveType type ) +
+
+[more]PrimitiveType getPrimType( void ) +
+
+[more]void setPrimLengths( int *lens ) +
+
+[more]int* getPrimLengths( void ) +
+
+[more]void computeNumVerts() +
+
+[more]int getNumCoords() +
get the number of coords required by the defined primitives. +
+[more]Vec3* getCoords() +
get a pointer to Vec3 coord array. +
+[more]int getNumIndices() +
get the number of indices required by the defined primitives. +
+[more]ushort* getCIndex() +
get the coord index array. +
+[more]void setCoords( Vec3 *cp ) +
set the coords (ie the geometry) of the geoset +
+[more]void setCoords( Vec3 *cp, ushort *ci ) +
set the coords (ie the geometry) and indices of the geoset +
+[more]int getNumNormals() +
get the number of normals required by the defined primitives and normals binding +
+[more]Vec3* getNormals() +
get a pointer to Vec3 normal array. +
+[more]int getNumNIndices() +
get the number of normal indices required by the defined primitives and normals binding +
+[more]ushort* getNIndex() +
get the normal index array. +
+[more]void setNormals( Vec3 *np ) +
set the normals of the geoset +
+[more]void setNormals( Vec3 *np, ushort *ni ) +
set the normals and normal indices of the geoset +
+[more]void setNormalBinding( BindingType binding ) +
set the normals binding to the vertices/primitives/overall +
+[more]BindingType getNormalBinding() +
+
+[more]int getNumColors() +
get the number of colors required by the defined primitives and color binding +
+[more]Vec4* getColors() +
get a pointer to Vec4 color array. +
+[more]int getNumCIndices() +
get the number of colors indices required by the defined primitives and color binding +
+[more]ushort* getColIndex() +
get the color index array. +
+[more]void setColors( Vec4 *lp ) +
set the colors of the geoset +
+[more]void setColors( Vec4 *lp, ushort *li ) +
set the colors and color indices of the geoset +
+[more]void setColorBinding( BindingType binding ) +
set the color binding to the vertices/primitives/overall +
+[more]BindingType getColorBinding() +
+
+[more]int getNumTCoords() +
get the number of texture coords required by the defined primitives and textures binding +
+[more]Vec2* getTCoords() +
get a pointer to Vec4 color array. +
+[more]int getNumTIndices() +
get the number of texture coord indices required by the defined primitives and texture binding +
+[more]ushort* getTIndex() +
get the texture index array. +
+[more]void setTextureCoords( Vec2 *tc ) +
set the texture coords of the geoset +
+[more]void setTextureCoords( Vec2 *tc, ushort *ti ) +
set the texture coords and texture coord indices of the geoset +
+[more]void setTextureBinding( BindingType binding ) +
set the texture coord binding to the vertices/primitives/overall +
+[more]BindingType getTextureBinding() +
+
+[more]void setInterleavedArray( InterleaveArrayType format, float *ia ) +
+
+[more]void setInterleavedArray( InterleaveArrayType format, float *ia, ushort *iai ) +
+
+[more]void setGeoState(GeoState *state) +
+
+[more]GeoState* getGeoState() const +
+
+[more]void setUseDisplayList(bool flag) +
When set to true, force the draw method to use OpenGL Display List for rendering. +
+[more]bool getUseDisplayList() +
Return whether OpenGL display lists are being used for rendering +
+[more]void dirtyDisplayList() +
Force a recompile on next draw() of any OpenGL display list associated with this geoset +
+[more]virtual const BoundingBox& getBound() +
get bounding box of geoset. +
+[more]void draw( void ) +
draw geoset. +
+[more]virtual void drawImmediateMode() +
draw geoset directly ignoring an OpenGL display list which could be attached. +
+[more]void compile( void ) +
Immediately compile this geoset into an OpenGL Display List, set _useDisplayList to true +
+[more]bool check() +
+

+ +

+

Protected Methods

+[more] GeoSet(const GeoSet&) +
+
+[more]GeoSet& operator = (const GeoSet&) +
+
+[more]virtual ~GeoSet() +
+
+[more]bool matchBindingTypeStr(const char* str, BindingType& mode) +
+
+[more]const char* getBindingTypeStr(BindingType mode) +
+
+[more]virtual bool readLocalData(Input& fr) +
+
+[more]virtual bool writeLocalData(Output& fw) +
+

+ +
+

Inherited from Object:

+
+

+

Public Methods

+ovirtual Object* readClone(Input& fr) +
+ovirtual bool write(Output& fw) +

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _refCount +

+ +
+ + +
+

Documentation

+
Encapsulates OpenGL drawing primitives, geometry and +optional binding of normal, color and texture coordinates. Used +for representing the visible objects in the scene. State attributes +for a GeoSet are maintained in GeoState which the GeoSet maintains +a referenced counted pointer to. Both GeoSet's and GeoState's can +be shared for optimal memory usage and graphics performance.
+
+ + + +
oenum PrimitiveType +

+ + + +
o NO_TYPE +

+ + +

o POINTS +

+ + +

o LINES +

+ + +

o LINE_STRIP +

+ + +

o FLAT_LINE_STRIP +

+ + +

o LINE_LOOP +

+ + +

o TRIANGLES +

+ + +

o TRIANGLE_STRIP +

+ + +

o FLAT_TRIANGLE_STRIP +

+ + +

o TRIANGLE_FAN +

+ + +

o FLAT_TRIANGLE_FAN +

+ + +

o QUADS +

+ + +

o QUAD_STRIP +

+ + +

o POLYGON +

+ + + +
oenum BindingType +

+ + + +
o BIND_OFF +

+ + +

o BIND_OVERALL +

+ + +

o BIND_PERPRIM +

+ + +

o BIND_PERVERTEX +

+ + +

o BIND_DEFAULT +

+ + + +
oenum InterleaveArrayType +

+ + + +
o IA_OFF +

+ + +

o IA_V2F +

+ + +

o IA_V3F +

+ + +

o IA_C4UB_V2F +

+ + +

o IA_C4UB_V3F +

+ + +

o IA_C3F_V3F +

+ + +

o IA_N3F_V3F +

+ + +

o IA_C4F_N3F_V3F +

+ + +

o IA_T2F_V3F +

+ + +

o IA_T4F_V4F +

+ + +

o IA_T2F_C4UB_V3F +

+ + +

o IA_T2F_C3F_V3F +

+ + +

o IA_T2F_N3F_V3F +

+ + +

o IA_T2F_C4F_N3F_V3F +

+ + +

o IA_T4F_C4F_N3F_V4F +

+ + + +
o GeoSet() +

+ + +

ostatic GeoSet* instance() +

+ + +

ovirtual Object* clone() const +

+ + +

ovirtual bool isSameKindAs(Object* obj) +

+ + +

ovirtual const char* className() const +

+ + +

ovoid setNumPrims( int n ) +

+ + +

oint getNumPrims( void ) +

+ + +

ovoid setPrimType( PrimitiveType type ) +

+ + +

oPrimitiveType getPrimType( void ) +

+ + +

ovoid setPrimLengths( int *lens ) +

+ + +

oint* getPrimLengths( void ) +

+ + +

ovoid computeNumVerts() +

+ + +

oint getNumCoords() +
get the number of coords required by the defined primitives. +

+ + +

oVec3* getCoords() +
get a pointer to Vec3 coord array. +

+ + +

oint getNumIndices() +
get the number of indices required by the defined primitives. +

+ + +

oushort* getCIndex() +
get the coord index array. +

+ + +

ovoid setCoords( Vec3 *cp ) +
set the coords (ie the geometry) of the geoset +

+ + +

ovoid setCoords( Vec3 *cp, ushort *ci ) +
set the coords (ie the geometry) and indices of the geoset +

+ + +

oint getNumNormals() +
get the number of normals required by the defined primitives and normals binding +

+ + +

oVec3* getNormals() +
get a pointer to Vec3 normal array. +

+ + +

oint getNumNIndices() +
get the number of normal indices required by the defined primitives and normals binding +

+ + +

oushort* getNIndex() +
get the normal index array. +

+ + +

ovoid setNormals( Vec3 *np ) +
set the normals of the geoset +

+ + +

ovoid setNormals( Vec3 *np, ushort *ni ) +
set the normals and normal indices of the geoset +

+ + +

ovoid setNormalBinding( BindingType binding ) +
set the normals binding to the vertices/primitives/overall +

+ + +

oBindingType getNormalBinding() +

+ + +

oint getNumColors() +
get the number of colors required by the defined primitives and color binding +

+ + +

oVec4* getColors() +
get a pointer to Vec4 color array. +

+ + +

oint getNumCIndices() +
get the number of colors indices required by the defined primitives and color binding +

+ + +

oushort* getColIndex() +
get the color index array. +

+ + +

ovoid setColors( Vec4 *lp ) +
set the colors of the geoset +

+ + +

ovoid setColors( Vec4 *lp, ushort *li ) +
set the colors and color indices of the geoset +

+ + +

ovoid setColorBinding( BindingType binding ) +
set the color binding to the vertices/primitives/overall +

+ + +

oBindingType getColorBinding() +

+ + +

oint getNumTCoords() +
get the number of texture coords required by the defined primitives and textures binding +

+ + +

oVec2* getTCoords() +
get a pointer to Vec4 color array. +

+ + +

oint getNumTIndices() +
get the number of texture coord indices required by the defined primitives and texture binding +

+ + +

oushort* getTIndex() +
get the texture index array. +

+ + +

ovoid setTextureCoords( Vec2 *tc ) +
set the texture coords of the geoset +

+ + +

ovoid setTextureCoords( Vec2 *tc, ushort *ti ) +
set the texture coords and texture coord indices of the geoset +

+ + +

ovoid setTextureBinding( BindingType binding ) +
set the texture coord binding to the vertices/primitives/overall +

+ + +

oBindingType getTextureBinding() +

+ + +

ovoid setInterleavedArray( InterleaveArrayType format, float *ia ) +

+ + +

ovoid setInterleavedArray( InterleaveArrayType format, float *ia, ushort *iai ) +

+ + +

ovoid setGeoState(GeoState *state) +

+ + +

oGeoState* getGeoState() const +

+ + +

ovoid setUseDisplayList(bool flag) +
When set to true, force the draw method to use OpenGL Display List for rendering. +If false rendering directly. If the display list has not been already +compile the next call to draw will automatically create the display list. +

+ + +

obool getUseDisplayList() +
Return whether OpenGL display lists are being used for rendering +

+ + +

ovoid dirtyDisplayList() +
Force a recompile on next draw() of any OpenGL display list associated with this geoset +

+ + +

ovirtual const BoundingBox& getBound() +
get bounding box of geoset. +Note, now made virtual to make it possible to implement user-drawn +objects albiet so what crudely, to be improved later. +

+ + +

ovoid draw( void ) +
draw geoset. +If the geoset has _useDisplayList set to true then use an OpenGL display +list, automatically compiling one if required. +Otherwise call drawImmediateMode(). +Note, draw method should not be overiden in subclasses as it +manages the optional display list. +

+ + +

ovirtual void drawImmediateMode() +
draw geoset directly ignoring an OpenGL display list which could be attached. +This is the internal draw method which does the drawing itself, +and is the method to override when deriving from GeoSet for user-drawn objects. +

+ + +

ovoid compile( void ) +
Immediately compile this geoset into an OpenGL Display List, set _useDisplayList to true +

+ + +

obool check() +

+ + +

o GeoSet(const GeoSet&) +

+ + +

oGeoSet& operator = (const GeoSet&) +

+ + +

ovirtual ~GeoSet() +

+ + +

obool matchBindingTypeStr(const char* str, BindingType& mode) +

+ + +

oconst char* getBindingTypeStr(BindingType mode) +

+ + +

ovirtual bool readLocalData(Input& fr) +

+ + +

ovirtual bool writeLocalData(Output& fw) +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/GeoState.html b/doc/osg/GeoState.html new file mode 100644 index 000000000..2f3912cfb --- /dev/null +++ b/doc/osg/GeoState.html @@ -0,0 +1,501 @@ + + + class SG_EXPORT osg::GeoState + + + + +

class SG_EXPORT osg::GeoState: public Object

+
Encapsulates OpenGL state modes and attributes.
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Classes

+[more]enum AttributeType +
+
+[more]enum AttributeMode +
+

+ +

+

Public Methods

+[more] GeoState() +
+
+[more]static GeoState* instance() +
+
+[more]virtual Object* clone() const +
+
+[more]virtual bool isSameKindAs(Object* obj) +
+
+[more]const char* className() const +
+
+[more]void setGlobalDefaults() +
set all the modes to on or off so that it defines a complete state, typically used for a default global state +
+[more]void setAllToInherit() +
set all the modes to inherit, typically used to signifiy nodes which inherit all of their modes for the global state +
+[more]void setMode(AttributeType type, AttributeMode mode) +
+
+[more]AttributeMode getMode(AttributeType type) const +
+
+[more]void setAttribute(AttributeType type, Object *attribute) +
+
+[more]Object* getAttribute(AttributeType type) const +
+
+[more]bool isTransparent() +
+
+[more]void apply() +
+
+[more]void apply(GeoState* global, GeoState* prev) +
+
+[more]bool check() +
+
+[more]static AttributeMode combineMode(const AttributeMode g, const AttributeMode p, const AttributeMode c) +
+
+[more]static AttributeMode mergeMode(const AttributeMode lhs, const AttributeMode rhs) +
+

+ +

+

Protected Fields

+[more]AttributeMode _transparencing +
+
+[more]AttributeMode _face_culling +
+
+[more]AttributeMode _lighting +
+
+[more]AttributeMode _texturing +
+
+[more]AttributeMode _fogging +
+
+[more]AttributeMode _texgening +
+
+[more]AttributeMode _antialiasing +
+
+[more]AttributeMode _colortable +
+
+[more]AttributeMode _pointSmoothing +
+
+[more]AttributeMode _polygonOffsetting +
+
+[more]AttributeMode _alphaTesting +
+
+[more]ref_ptr<Texture> _texture +
+
+[more]ref_ptr<TexGen> _texgen +
+
+[more]ref_ptr<Material> _material +
+
+[more]ref_ptr<TexEnv> _texenv +
+
+[more]ref_ptr<Transparency> _transparency +
+
+[more]ref_ptr<TexMat> _texmat +
+
+[more]ref_ptr<Fog> _fog +
+
+[more]ref_ptr<Point> _point +
+
+[more]ref_ptr<PolygonOffset> _polygonOffset +
+
+[more]ref_ptr<CullFace> _cullFace +
+
+[more]ref_ptr<AlphaFunc> _alphaFunc +
+

+ +

+

Protected Methods

+[more]virtual ~GeoState() +
+
+[more] GeoState(const GeoState&) +
+
+[more]GeoState& operator = (const GeoState&) +
+
+[more]virtual bool readLocalData(Input& fr) +
+
+[more]virtual bool writeLocalData(Output& fw) +
+
+[more]bool matchModeStr(const char* str, AttributeMode& mode) +
+
+[more]const char* getModeStr(AttributeMode flag) +
+

+ +
+

Inherited from Object:

+
+

+

Public Methods

+ovirtual Object* readClone(Input& fr) +
+ovirtual bool write(Output& fw) +

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _refCount +

+ +
+ + +
+

Documentation

+
+Encapsulates OpenGL state modes and attributes. +Used to specificy textures etc of osg::GeoSet's which hold references +to a single osg::GeoState. GeoState can be shared between GeoSet's +and is recommend if possible as it minimize expensive state changes +in the graphics pipeline.
+
+ + + +
oenum AttributeType +

+ + + +
o ANTIALIAS +

+ + +

o FACE_CULL +

+ + +

o FOG +

+ + +

o LIGHTING +

+ + +

o MATERIAL +

+ + +

o POINT +

+ + +

o POLYGON_OFFSET +

+ + +

o TEXENV +

+ + +

o TEXGEN +

+ + +

o TEXMAT +

+ + +

o TEXTURE +

+ + +

o TRANSPARENCY +

+ + +

o WIREFRAME +

+ + +

o ALPHAFUNC +

+ + + +
oenum AttributeMode +

+ + + +
o INHERIT +

+ + +

o OFF +

+ + +

o ON +

+ + +

o OVERRIDE_OFF +

+ + +

o OVERRIDE_ON +

+ + + +
o GeoState() +

+ + +

ostatic GeoState* instance() +

+ + +

ovirtual Object* clone() const +

+ + +

ovirtual bool isSameKindAs(Object* obj) +

+ + +

oconst char* className() const +

+ + +

ovoid setGlobalDefaults() +
set all the modes to on or off so that it defines a +complete state, typically used for a default global state +

+ + +

ovoid setAllToInherit() +
set all the modes to inherit, typically used to signifiy +nodes which inherit all of their modes for the global state +

+ + +

ovoid setMode(AttributeType type, AttributeMode mode) +

+ + +

oAttributeMode getMode(AttributeType type) const +

+ + +

ovoid setAttribute(AttributeType type, Object *attribute) +

+ + +

oObject* getAttribute(AttributeType type) const +

+ + +

obool isTransparent() +

+ + +

ovoid apply() +

+ + +

ovoid apply(GeoState* global, GeoState* prev) +

+ + +

obool check() +

+ + +

ostatic AttributeMode combineMode(const AttributeMode g, const AttributeMode p, const AttributeMode c) +

+ + +

ostatic AttributeMode mergeMode(const AttributeMode lhs, const AttributeMode rhs) +

+ + +

ovirtual ~GeoState() +

+ + +

o GeoState(const GeoState&) +

+ + +

oGeoState& operator = (const GeoState&) +

+ + +

ovirtual bool readLocalData(Input& fr) +

+ + +

ovirtual bool writeLocalData(Output& fw) +

+ + +

obool matchModeStr(const char* str, AttributeMode& mode) +

+ + +

oconst char* getModeStr(AttributeMode flag) +

+ + +

oAttributeMode _transparencing +

+ + +

oAttributeMode _face_culling +

+ + +

oAttributeMode _lighting +

+ + +

oAttributeMode _texturing +

+ + +

oAttributeMode _fogging +

+ + +

oAttributeMode _texgening +

+ + +

oAttributeMode _antialiasing +

+ + +

oAttributeMode _colortable +

+ + +

oAttributeMode _pointSmoothing +

+ + +

oAttributeMode _polygonOffsetting +

+ + +

oAttributeMode _alphaTesting +

+ + +

oref_ptr<Texture> _texture +

+ + +

oref_ptr<TexGen> _texgen +

+ + +

oref_ptr<Material> _material +

+ + +

oref_ptr<TexEnv> _texenv +

+ + +

oref_ptr<Transparency> _transparency +

+ + +

oref_ptr<TexMat> _texmat +

+ + +

oref_ptr<Fog> _fog +

+ + +

oref_ptr<Point> _point +

+ + +

oref_ptr<PolygonOffset> _polygonOffset +

+ + +

oref_ptr<CullFace> _cullFace +

+ + +

oref_ptr<AlphaFunc> _alphaFunc +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/Geode.html b/doc/osg/Geode.html new file mode 100644 index 000000000..0a7b3ced9 --- /dev/null +++ b/doc/osg/Geode.html @@ -0,0 +1,317 @@ + + + class SG_EXPORT osg::Geode + + + + +

class SG_EXPORT osg::Geode: public Node

+
Leaf Node for grouping GeoSets
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Methods

+[more] Geode() +
+
+[more]virtual Object* clone() const +
+
+[more]virtual bool isSameKindAs(Object* obj) +
+
+[more]virtual const char* className() const +
+
+[more]virtual void accept(NodeVisitor& nv) +
+
+[more]virtual bool addGeoSet( GeoSet *gset ) +
Add GeoSet to Geode. +
+[more]virtual bool removeGeoSet( GeoSet *gset ) +
Remove GeoSet from Geode. +
+[more]virtual bool replaceGeoSet( GeoSet *origGset, GeoSet *newGset ) +
Replace specified GeoSet with another GeoSet. +
+[more]int getNumGeosets( void ) const +
return the number of geoset's +
+[more]GeoSet* getGeoSet( int i ) +
return geoset at position i +
+[more]bool containsGeoSet( GeoSet* gset) +
return true is geoset is contained within Geode +
+[more]GeoSetList::iterator findGeoSet( GeoSet* gset) +
return the iterator postion for specified GeoSet. +
+[more]void compileGeoSets( void ) +
complile OpenGL Display List for each geoset +

+ +

+

Public

+[more]typedef std::vector< ref_ptr<GeoSet> > GeoSetList +
+

+ +

+

Protected Fields

+[more]GeoSetList _geosets +
+

+ +

+

Protected Methods

+[more]virtual ~Geode() +
+
+[more]virtual bool readLocalData(Input& fr) +
+
+[more]virtual bool writeLocalData(Output& fw) +
+
+[more]virtual bool computeBound( void ) +
+

+ +
+

Inherited from Node:

+
+

+

Public Methods

+oNode* cloneNode() const +
+ovirtual void ascend(NodeVisitor& nv) +
+ovirtual void traverse(NodeVisitor& ) +
+ovoid setName( const std::string& name ) +
+ovoid setName( const char* name ) +
+oconst std::string& getName( void ) +
+oconst ParentList& getParents() const +
+oGroup* getParent(int i) const +
+oint getNumParents() const +
+ovoid setUserData(void* data, MemoryAdapter* ma=0L) +
+ovoid* getUserData() const +
+oMemoryAdapter* getMemoryAdapter() const +
+ovoid setNodeMask(NodeMask nm) +
+oNodeMask getNodeMask() +
+oconst DescriptionList& getDescriptions() const +
+oDescriptionList& getDescriptions() +
+oconst std::string& getDescription(int i) const +
+ostd::string& getDescription(int i) +
+oint getNumDescriptions() const +
+ovoid addDescription(const std::string& desc) +
+oconst BoundingSphere& getBound() +
+ovoid dirtyBound() +

+ +

+

Public

+otypedef std::vector<Group*> ParentList +
+otypedef unsigned int NodeMask +
+otypedef std::vector<std::string> DescriptionList +

+ +

+

Protected Fields

+oBoundingSphere _bsphere +
+obool _bsphere_computed +
+ostd::string _name +
+oParentList _parents +
+ofriend Group +
+ovoid* _userData +
+oref_ptr<MemoryAdapter> _memoryAdapter +
+oNodeMask _nodeMask +
+oDescriptionList _descriptions +

+ +
+

Inherited from Object:

+
+

+

Public Methods

+ovirtual Object* readClone(Input& fr) +
+ovirtual bool write(Output& fw) +

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+oReferenced& operator = (Referenced&) +
+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _refCount +

+ +
+ + +
+

Documentation

+
Leaf Node for grouping GeoSets
+
+ + + +
otypedef std::vector< ref_ptr<GeoSet> > GeoSetList +

+ + +

o Geode() +

+ + +

ovirtual Object* clone() const +

+ + +

ovirtual bool isSameKindAs(Object* obj) +

+ + +

ovirtual const char* className() const +

+ + +

ovirtual void accept(NodeVisitor& nv) +

+ + +

ovirtual bool addGeoSet( GeoSet *gset ) +
Add GeoSet to Geode. +If gset is not NULL and is not contained in Geode then increment its +reference count, add it to the geosets list and dirty the bounding +sphere to force it to recompute on next getBound() and return true for success. +Otherwise return false. +

+ + +

ovirtual bool removeGeoSet( GeoSet *gset ) +
Remove GeoSet from Geode. +If gset is contained in Geode then remove it from the geoset +list and decrement its reference count, and dirty the +bounding sphere to force it to recompute on next getBound() and +return true for success. If gset is not found then return false +and do not change the reference count of gset. +

+ + +

ovirtual bool replaceGeoSet( GeoSet *origGset, GeoSet *newGset ) +
Replace specified GeoSet with another GeoSet. +Decrement the reference count origGSet and increments the +reference count of newGset, and dirty the bounding sphere +to force it to recompute on next getBound() and returns true. +If origGeoSet is not found then return false and do not +add newGset. If newGset is NULL then return false and do +not remove origGset. +

+ + +

oint getNumGeosets( void ) const +
return the number of geoset's +

+ + +

oGeoSet* getGeoSet( int i ) +
return geoset at position i +

+ + +

obool containsGeoSet( GeoSet* gset) +
return true is geoset is contained within Geode +

+ + +

oGeoSetList::iterator findGeoSet( GeoSet* gset) +
return the iterator postion for specified GeoSet. +return _geoset.end() if gset not is contained in Geode. +

+ + +

ovoid compileGeoSets( void ) +
complile OpenGL Display List for each geoset +

+ + +

ovirtual ~Geode() +

+ + +

ovirtual bool readLocalData(Input& fr) +

+ + +

ovirtual bool writeLocalData(Output& fw) +

+ + +

ovirtual bool computeBound( void ) +

+ + +

oGeoSetList _geosets +

+
+
Direct child classes: +
Billboard
+
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/Group.html b/doc/osg/Group.html new file mode 100644 index 000000000..fdf0eb837 --- /dev/null +++ b/doc/osg/Group.html @@ -0,0 +1,318 @@ + + + class SG_EXPORT osg::Group + + + + +

class SG_EXPORT osg::Group: public Node

+
General group node which maintains a list of children.
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Methods

+[more] Group() +
+
+[more]virtual Object* clone() const +
+
+[more]virtual bool isSameKindAs(Object* obj) +
+
+[more]virtual const char* className() const +
+
+[more]virtual void accept(NodeVisitor& nv) +
+
+[more]virtual void traverse(NodeVisitor& nv) +
+
+[more]virtual bool addChild( Node *child ) +
Add Node to Group. +
+[more]virtual bool removeChild( Node *child ) +
Remove Node from Group. +
+[more]virtual bool replaceChild( Node *origChild, Node* newChild ) +
Replace specified Node with another Node. +
+[more]int getNumChildren( void ) +
return the number of chilren nodes +
+[more]Node* getChild( int i ) +
return child node at position i +
+[more]bool containsNode( Node* node ) +
return true is node is contained within Group +
+[more]ChildList::iterator findNode( Node* node ) +
return the iterator postion for specified Node. +

+ +

+

Public

+[more]typedef std::vector<ref_ptr<Node> > ChildList +
+

+ +

+

Protected Fields

+[more]ChildList _children +
+

+ +

+

Protected Methods

+[more]virtual ~Group() +
+
+[more]virtual bool readLocalData(Input& fr) +
+
+[more]virtual bool writeLocalData(Output& fw) +
+
+[more]bool computeBound( void ) +
+

+ +
+

Inherited from Node:

+
+

+

Public Methods

+oNode* cloneNode() const +
+ovirtual void ascend(NodeVisitor& nv) +
+ovoid setName( const std::string& name ) +
+ovoid setName( const char* name ) +
+oconst std::string& getName( void ) +
+oconst ParentList& getParents() const +
+oGroup* getParent(int i) const +
+oint getNumParents() const +
+ovoid setUserData(void* data, MemoryAdapter* ma=0L) +
+ovoid* getUserData() const +
+oMemoryAdapter* getMemoryAdapter() const +
+ovoid setNodeMask(NodeMask nm) +
+oNodeMask getNodeMask() +
+oconst DescriptionList& getDescriptions() const +
+oDescriptionList& getDescriptions() +
+oconst std::string& getDescription(int i) const +
+ostd::string& getDescription(int i) +
+oint getNumDescriptions() const +
+ovoid addDescription(const std::string& desc) +
+oconst BoundingSphere& getBound() +
+ovoid dirtyBound() +

+ +

+

Public

+otypedef std::vector<Group*> ParentList +
+otypedef unsigned int NodeMask +
+otypedef std::vector<std::string> DescriptionList +

+ +

+

Protected Fields

+oBoundingSphere _bsphere +
+obool _bsphere_computed +
+ostd::string _name +
+oParentList _parents +
+ovoid* _userData +
+oref_ptr<MemoryAdapter> _memoryAdapter +
+oNodeMask _nodeMask +
+oDescriptionList _descriptions +

+ +
+

Inherited from Object:

+
+

+

Public Methods

+ovirtual Object* readClone(Input& fr) +
+ovirtual bool write(Output& fw) +

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+oReferenced& operator = (Referenced&) +
+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _refCount +

+ +
+ + +
+

Documentation

+
General group node which maintains a list of children. +Children are reference counted to allow children to be shared +with memory management handled automatically via osg::Referenced.
+
+ + + +
otypedef std::vector<ref_ptr<Node> > ChildList +

+ + +

o Group() +

+ + +

ovirtual Object* clone() const +

+ + +

ovirtual bool isSameKindAs(Object* obj) +

+ + +

ovirtual const char* className() const +

+ + +

ovirtual void accept(NodeVisitor& nv) +

+ + +

ovirtual void traverse(NodeVisitor& nv) +

+ + +

ovirtual bool addChild( Node *child ) +
Add Node to Group. +If node is not NULL and is not contained in Group then increment its +reference count, add it to the child list and dirty the bounding +sphere to force it to recompute on next getBound() and return true for success. +Otherwise return false. +

+ + +

ovirtual bool removeChild( Node *child ) +
Remove Node from Group. +If Node is contained in Group then remove it from the child +list, decrement its reference count, and dirty the +bounding sphere to force it to recompute on next getBound() and +return true for success. If Node is not found then return false +and do not change the reference count of the Node. +

+ + +

ovirtual bool replaceChild( Node *origChild, Node* newChild ) +
Replace specified Node with another Node. +Decrement the reference count origNode and increments the +reference count of newNode, and dirty the bounding sphere +to force it to recompute on next getBound() and returns true. +If origNode is not found then return false and do not +add newNode. If newNode is NULL then return false and do +not remove origNode. +

+ + +

oint getNumChildren( void ) +
return the number of chilren nodes +

+ + +

oNode* getChild( int i ) +
return child node at position i +

+ + +

obool containsNode( Node* node ) +
return true is node is contained within Group +

+ + +

oChildList::iterator findNode( Node* node ) +
return the iterator postion for specified Node. +return _chilren.end() if node is not contained in Group. +

+ + +

ovirtual ~Group() +

+ + +

ovirtual bool readLocalData(Input& fr) +

+ + +

ovirtual bool writeLocalData(Output& fw) +

+ + +

oChildList _children +

+ + +

obool computeBound( void ) +

+
+
Direct child classes: +
Switch
+Sequence
+Scene
+LOD
+DCS
+
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/HIER.html b/doc/osg/HIER.html new file mode 100644 index 000000000..7ae4a42ea --- /dev/null +++ b/doc/osg/HIER.html @@ -0,0 +1,80 @@ + + + Hierarchy of Classes + + + +

Hierarchy of Classes

+ +Alphabetic index


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/HIERjava.html b/doc/osg/HIERjava.html new file mode 100644 index 000000000..4ae7c74ee --- /dev/null +++ b/doc/osg/HIERjava.html @@ -0,0 +1,146 @@ + + + Hierarchy of Classes + + + +

Hierarchy of classes

+
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ alphabetic index


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/Hit.html b/doc/osg/Hit.html new file mode 100644 index 000000000..f48758753 --- /dev/null +++ b/doc/osg/Hit.html @@ -0,0 +1,173 @@ + + + class SG_EXPORT osg::Hit + + + + +

class SG_EXPORT osg::Hit: public Referenced

+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Fields

+[more]float _ratio +
+
+[more]Seg* _originalSeg +
+
+[more]Seg* _localSeg +
+
+[more]NodePath _nodePath +
+
+[more]Geode* _geode +
+
+[more]GeoSet* _geoset +
+
+[more]Matrix* _matrix +
+
+[more]VecIndexList _vecIndexList +
+
+[more]int _primitiveIndex +
+
+[more]Vec3 _intersectPoint +
+

+ +

+

Public Methods

+[more] Hit() +
+
+[more] Hit(const Hit& hit) +
+
+[more] ~Hit() +
+
+[more]Hit& operator = (const Hit& hit) +
+
+[more]bool operator < (const Hit& hit) const +
+

+ +

+

Public

+[more]typedef std::vector<int> VecIndexList +
+

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _reference +

+ +
+ + +
+

Documentation

+
+ + + +
o Hit() +

+ + +

o Hit(const Hit& hit) +

+ + +

o ~Hit() +

+ + +

oHit& operator = (const Hit& hit) +

+ + +

otypedef std::vector<int> VecIndexList +

+ + +

obool operator < (const Hit& hit) const +

+ + +

ofloat _ratio +

+ + +

oSeg* _originalSeg +

+ + +

oSeg* _localSeg +

+ + +

oNodePath _nodePath +

+ + +

oGeode* _geode +

+ + +

oGeoSet* _geoset +

+ + +

oMatrix* _matrix +

+ + +

oVecIndexList _vecIndexList +

+ + +

oint _primitiveIndex +

+ + +

oVec3 _intersectPoint +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/Image.html b/doc/osg/Image.html new file mode 100644 index 000000000..40e185935 --- /dev/null +++ b/doc/osg/Image.html @@ -0,0 +1,272 @@ + + + class SG_EXPORT osg::Image + + + + +

class SG_EXPORT osg::Image: public Object

+
Image class for encapsulating the storage texture image data
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Methods

+[more] Image() +
+
+[more]virtual Object* clone() const +
+
+[more]virtual bool isSameKindAs(Object* obj) +
+
+[more]virtual const char* className() const +
+
+[more]const char* getFileName() +
+
+[more]void setFileName(const char* fileName) +
+
+[more]void setImage(int s, int t, int r, int internalFormat, unsigned int pixelFormat, unsigned int dataType, unsigned char *data) +
+
+[more]int s() +
Width of image +
+[more]int t() +
Height of image +
+[more]int r() +
Depth of image +
+[more]int internalFormat() +
+
+[more]unsigned int pixelFormat() +
+
+[more]unsigned int dataType() +
+
+[more]unsigned char* data() +
raw image data +
+[more]void scaleImage(int s, int t, int r) +
Scale image to specified size. +
+[more]void ensureDimensionsArePowerOfTwo() +
Ensure image dimensions are a power of two. +

+ +

+

Protected Fields

+[more]char* _fileName +
+
+[more]int _s +
+
+[more]int _t +
+
+[more]int _r +
+
+[more]int _internalFormat +
+
+[more]unsigned int _pixelFormat +
+
+[more]unsigned int _dataType +
+
+[more]unsigned char* _data +
+

+ +

+

Protected Methods

+[more]virtual ~Image() +
+
+[more]virtual bool readLocalData(Input& fr) +
+
+[more]virtual bool writeLocalData(Output& fw) +
+

+ +
+

Inherited from Object:

+
+

+

Public Methods

+ovirtual Object* readClone(Input& fr) +
+ovirtual bool write(Output& fw) +

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+oReferenced& operator = (Referenced&) +
+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _refCount +

+ +
+ + +
+

Documentation

+
Image class for encapsulating the storage texture image data
+
+ + + +
o Image() +

+ + +

ovirtual Object* clone() const +

+ + +

ovirtual bool isSameKindAs(Object* obj) +

+ + +

ovirtual const char* className() const +

+ + +

oconst char* getFileName() +

+ + +

ovoid setFileName(const char* fileName) +

+ + +

ovoid setImage(int s, int t, int r, int internalFormat, unsigned int pixelFormat, unsigned int dataType, unsigned char *data) +

+ + +

oint s() +
Width of image +

+ + +

oint t() +
Height of image +

+ + +

oint r() +
Depth of image +

+ + +

oint internalFormat() +

+ + +

ounsigned int pixelFormat() +

+ + +

ounsigned int dataType() +

+ + +

ounsigned char* data() +
raw image data +

+ + +

ovoid scaleImage(int s, int t, int r) +
Scale image to specified size. +

+ + +

ovoid ensureDimensionsArePowerOfTwo() +
Ensure image dimensions are a power of two. +Mip Mapped texture require the image dimensions to be +power of two. +

+ + +

ovirtual ~Image() +

+ + +

ovirtual bool readLocalData(Input& fr) +

+ + +

ovirtual bool writeLocalData(Output& fw) +

+ + +

ochar* _fileName +

+ + +

oint _s +

+ + +

oint _t +

+ + +

oint _r +

+ + +

oint _internalFormat +

+ + +

ounsigned int _pixelFormat +

+ + +

ounsigned int _dataType +

+ + +

ounsigned char* _data +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/Input.html b/doc/osg/Input.html new file mode 100644 index 000000000..09be2674b --- /dev/null +++ b/doc/osg/Input.html @@ -0,0 +1,151 @@ + + + class SG_EXPORT osg::Input + + + + +

class SG_EXPORT osg::Input: public FieldReaderIterator

+
Class for managing the reading of ASCII osg files
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Methods

+[more] Input() +
+
+[more]virtual ~Input() +
+
+[more]virtual Object* readObject() +
+
+[more]virtual Object* readObject(const std::string& fileName) +
+
+[more]virtual Image* readImage() +
+
+[more]virtual Image* readImage(const std::string& fileName) +
+
+[more]virtual Node* readNode() +
+
+[more]virtual Node* readNode(const std::string& fileName) +
+
+[more]virtual Object* getObjectForUniqueID(const std::string& uniqueID) +
+
+[more]virtual void regisiterUniqueIDForObject(const std::string& uniqueID, Object* obj) +
+

+ +
+

Inherited from FieldReaderIterator:

+
+

+

Public Classes

+oenum +

+ +

+

Public Methods

+ovirtual FieldReaderIterator& operator = (const FieldReaderIterator& ic) +
+ovoid attach(istream* input) +
+ovoid detach() +
+ovirtual bool eof() const +
+oFieldReader& getFieldReader() +
+ovoid insert(int pos, Field* field) +
+ovoid insert(int pos, const char* str) +
+oField& operator [] (int pos) +
+oField& field(int pos) +
+oFieldReaderIterator& operator ++ () +
+oFieldReaderIterator& operator += (int no) +
+ovoid advanceOverCurrentFieldOrBlock() +
+ovoid advanceToEndOfCurrentBlock() +
+ovoid advanceToEndOfBlock(int noNestBrackets) +
+obool matchSequence(const char* str) +

+ +
+ + +
+

Documentation

+
Class for managing the reading of ASCII osg files
+
+ + + +
o Input() +

+ + +

ovirtual ~Input() +

+ + +

ovirtual Object* readObject() +

+ + +

ovirtual Object* readObject(const std::string& fileName) +

+ + +

ovirtual Image* readImage() +

+ + +

ovirtual Image* readImage(const std::string& fileName) +

+ + +

ovirtual Node* readNode() +

+ + +

ovirtual Node* readNode(const std::string& fileName) +

+ + +

ovirtual Object* getObjectForUniqueID(const std::string& uniqueID) +

+ + +

ovirtual void regisiterUniqueIDForObject(const std::string& uniqueID, Object* obj) +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/IntersectState.html b/doc/osg/IntersectState.html new file mode 100644 index 000000000..65fbca299 --- /dev/null +++ b/doc/osg/IntersectState.html @@ -0,0 +1,143 @@ + + + class SG_EXPORT osg::IntersectState + + + + +

class SG_EXPORT osg::IntersectState: public Referenced

+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Fields

+[more]Matrix* _matrix +
+
+[more]Matrix* _inverse +
+
+[more]SegList _segList +
+
+[more]SegmentMaskStack _segmentMaskStack +
+

+ +

+

Public Methods

+[more] IntersectState() +
+
+[more]bool isCulled(const BoundingSphere& bs, SegmentMask& segMaskOut) +
+
+[more]bool isCulled(const BoundingBox& bb, SegmentMask& segMaskOut) +
+

+ +

+

Public

+[more]typedef std::vector< std::pair<Seg*,Seg*> > SegList +
+
+[more]typedef unsigned int SegmentMask +
+
+[more]typedef std::vector<SegmentMask> SegmentMaskStack +
+

+ +

+

Protected Methods

+[more] ~IntersectState() +
+

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+oReferenced& operator = (Referenced&) +
+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _reference +

+ +
+ + +
+

Documentation

+
+ + + +
o IntersectState() +

+ + +

oMatrix* _matrix +

+ + +

oMatrix* _inverse +

+ + +

otypedef std::vector< std::pair<Seg*,Seg*> > SegList +

+ + +

oSegList _segList +

+ + +

otypedef unsigned int SegmentMask +

+ + +

otypedef std::vector<SegmentMask> SegmentMaskStack +

+ + +

oSegmentMaskStack _segmentMaskStack +

+ + +

obool isCulled(const BoundingSphere& bs, SegmentMask& segMaskOut) +

+ + +

obool isCulled(const BoundingBox& bb, SegmentMask& segMaskOut) +

+ + +

o ~IntersectState() +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/IntersectVisitor.html b/doc/osg/IntersectVisitor.html new file mode 100644 index 000000000..947fa66ca --- /dev/null +++ b/doc/osg/IntersectVisitor.html @@ -0,0 +1,309 @@ + + + class SG_EXPORT osg::IntersectVisitor + + + + +

class SG_EXPORT osg::IntersectVisitor: public NodeVisitor

+
Basic visitor for ray based collisions of a scene.
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Classes

+[more]enum HitReportingMode +
Modes to control how IntersectVisitor reports hits. +

+ +

+

Public Methods

+[more] IntersectVisitor() +
+
+[more]virtual ~IntersectVisitor() +
+
+[more]void reset() +
+
+[more]void addSeg(Seg* seg) +
Add a line segment to use for intersection testing during scene traversal +
+[more]void setHitReportingMode(HitReportingMode hrm) +
Set the mode of how hits should reported back from a traversal +
+[more]HitReportingMode getHitReportingMode() +
Get the mode of how hits should reported back from a traversal +
+[more]HitList& getHitList(Seg* seg) +
+
+[more]int getNumHits(Seg* seg) +
+
+[more]bool hits() +
+
+[more]virtual void apply(Node&) +
+
+[more]virtual void apply(Geode& node) +
+
+[more]virtual void apply(Billboard& node) +
+
+[more]virtual void apply(Group& node) +
+
+[more]virtual void apply(DCS& node) +
+
+[more]virtual void apply(Switch& node) +
+
+[more]virtual void apply(LOD& node) +
+
+[more]virtual void apply(Scene& node) +
+

+ +

+

Public

+[more]typedef std::multiset<Hit> HitList +
+
+[more]typedef std::map<Seg*,HitList > SegHitListMap +
+

+ +

+

Protected Fields

+[more]IntersectStateStack _intersectStateStack +
+
+[more]NodePath _nodePath +
+
+[more]HitReportingMode _hitReportingMode +
+
+[more]SegHitListMap _segHitList +
+

+ +

+

Protected Methods

+[more]bool intersect(GeoSet& gset) +
+
+[more]void pushMatrix(const Matrix& matrix) +
+
+[more]void popMatrix() +
+
+[more]bool enterNode(Node& node) +
+
+[more]void leaveNode() +
+

+ +

+

Protected

+[more]typedef std::vector<IntersectState*> IntersectStateStack +
+

+ +
+

Inherited from NodeVisitor:

+
+

+

Public Classes

+oenum TraversalMode +

+ +

+

Public Methods

+ovoid setTraverseMode(TraversalMode mode) +
+oTraversalMode getTraverseMode() +
+ovoid setTraverseVisitor(NodeVisitor* nv) +
+oNodeVisitor* getTraverseVisitor() +
+ovoid traverse(Node& node) +

+ +

+

Protected Fields

+oNodeVisitor* _traverseVisitor +
+oTraversalMode _traverseMode +

+ +
+ + +
+

Documentation

+
Basic visitor for ray based collisions of a scene. +Note, still in development, current version has not +pratical functionality!
+
+ + + +
o IntersectVisitor() +

+ + +

ovirtual ~IntersectVisitor() +

+ + +

ovoid reset() +

+ + +

ovoid addSeg(Seg* seg) +
Add a line segment to use for intersection testing during scene traversal +

+ + +

oenum HitReportingMode +
Modes to control how IntersectVisitor reports hits. +

+ + + +
o ONLY_NEAREST_HIT +

+ + +

o ALL_HITS +

+ + + +
ovoid setHitReportingMode(HitReportingMode hrm) +
Set the mode of how hits should reported back from a traversal +

+ + +

oHitReportingMode getHitReportingMode() +
Get the mode of how hits should reported back from a traversal +

+ + +

otypedef std::multiset<Hit> HitList +

+ + +

otypedef std::map<Seg*,HitList > SegHitListMap +

+ + +

oHitList& getHitList(Seg* seg) +

+ + +

oint getNumHits(Seg* seg) +

+ + +

obool hits() +

+ + +

ovirtual void apply(Node&) +

+ + +

ovirtual void apply(Geode& node) +

+ + +

ovirtual void apply(Billboard& node) +

+ + +

ovirtual void apply(Group& node) +

+ + +

ovirtual void apply(DCS& node) +

+ + +

ovirtual void apply(Switch& node) +

+ + +

ovirtual void apply(LOD& node) +

+ + +

ovirtual void apply(Scene& node) +

+ + +

obool intersect(GeoSet& gset) +

+ + +

ovoid pushMatrix(const Matrix& matrix) +

+ + +

ovoid popMatrix() +

+ + +

obool enterNode(Node& node) +

+ + +

ovoid leaveNode() +

+ + +

otypedef std::vector<IntersectState*> IntersectStateStack +

+ + +

oIntersectStateStack _intersectStateStack +

+ + +

oNodePath _nodePath +

+ + +

oHitReportingMode _hitReportingMode +

+ + +

oSegHitListMap _segHitList +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/LOD.html b/doc/osg/LOD.html new file mode 100644 index 000000000..f50075f31 --- /dev/null +++ b/doc/osg/LOD.html @@ -0,0 +1,341 @@ + + + class SG_EXPORT osg::LOD + + + + +

class SG_EXPORT osg::LOD: public Group

+
LOD - Level Of Detail group node which allows switching between children depending on distance from eye point.
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Methods

+[more] LOD() +
+
+[more]virtual Object* clone() const +
+
+[more]virtual bool isSameKindAs(Object* obj) +
+
+[more]virtual const char* className() const +
+
+[more]virtual void accept(NodeVisitor& nv) +
+
+[more]virtual void traverse(NodeVisitor& nv) +
+
+[more]void setRange(unsigned int index, float range) +
Sets the value of range list element index to range which is a floating point distance specified in world coordinates. +
+[more]float getRange(unsigned int index) +
pfLOD::getRange returns the range element index +
+[more]int getNumRanges() +
returns the number of ranges currently set +
+[more]void setCenter(const Vec3 &center) +
Sets the object-space point which defines the center of the osg::LOD. +
+[more]const Vec3& getCenter() +
return the LOD center point. +
+[more]int evaluate(const Vec3& eye_local, float bias=1.0f) +
return the child to traverse. +

+ +

+

Protected Fields

+[more]RangeList _rangeList +
+
+[more]RangeList _rangeList2 +
+
+[more]Vec3 _center +
+

+ +

+

Protected Methods

+[more]virtual ~LOD() +
+
+[more]virtual bool readLocalData(Input& fr) +
+
+[more]virtual bool writeLocalData(Output& fw) +
+

+ +

+

Protected

+[more]typedef std::vector<float> RangeList +
+

+ +
+

Inherited from Group:

+
+

+

Public Methods

+ovirtual bool addChild( Node *child ) +
+ovirtual bool removeChild( Node *child ) +
+ovirtual bool replaceChild( Node *origChild, Node* newChild ) +
+oint getNumChildren( void ) +
+oNode* getChild( int i ) +
+obool containsNode( Node* node ) +
+oChildList::iterator findNode( Node* node ) +

+ +

+

Public

+otypedef std::vector<ref_ptr<Node> > ChildList +

+ +

+

Protected Fields

+oChildList _children +

+ +

+

Protected Methods

+obool computeBound( void ) +

+ +
+

Inherited from Node:

+
+

+

Public Methods

+oNode* cloneNode() const +
+ovirtual void ascend(NodeVisitor& nv) +
+ovoid setName( const std::string& name ) +
+ovoid setName( const char* name ) +
+oconst std::string& getName( void ) +
+oconst ParentList& getParents() const +
+oGroup* getParent(int i) const +
+oint getNumParents() const +
+ovoid setUserData(void* data, MemoryAdapter* ma=0L) +
+ovoid* getUserData() const +
+oMemoryAdapter* getMemoryAdapter() const +
+ovoid setNodeMask(NodeMask nm) +
+oNodeMask getNodeMask() +
+oconst DescriptionList& getDescriptions() const +
+oDescriptionList& getDescriptions() +
+oconst std::string& getDescription(int i) const +
+ostd::string& getDescription(int i) +
+oint getNumDescriptions() const +
+ovoid addDescription(const std::string& desc) +
+oconst BoundingSphere& getBound() +
+ovoid dirtyBound() +

+ +

+

Public

+otypedef std::vector<Group*> ParentList +
+otypedef unsigned int NodeMask +
+otypedef std::vector<std::string> DescriptionList +

+ +

+

Protected Fields

+oBoundingSphere _bsphere +
+obool _bsphere_computed +
+ostd::string _name +
+oParentList _parents +
+ofriend Group +
+ovoid* _userData +
+oref_ptr<MemoryAdapter> _memoryAdapter +
+oNodeMask _nodeMask +
+oDescriptionList _descriptions +

+ +
+

Inherited from Object:

+
+

+

Public Methods

+ovirtual Object* readClone(Input& fr) +
+ovirtual bool write(Output& fw) +

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+oReferenced& operator = (Referenced&) +
+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _refCount +

+ +
+ + +
+

Documentation

+
LOD - Level Of Detail group node which allows switching between children +depending on distance from eye point. +Typical uses are for load balancing - objects further away from +the eye point are rendered at a lower level of detail, and at times +of high stress on the graphics pipeline lower levels of detail can +also be chosen.
+
+ + + +
o LOD() +

+ + +

ovirtual Object* clone() const +

+ + +

ovirtual bool isSameKindAs(Object* obj) +

+ + +

ovirtual const char* className() const +

+ + +

ovirtual void accept(NodeVisitor& nv) +

+ + +

ovirtual void traverse(NodeVisitor& nv) +

+ + +

ovoid setRange(unsigned int index, float range) +
Sets the value of range list element index to range which +is a floating point distance specified in world coordinates. +Range list automatically expands to accomodate values beyond +the current getNumRanges(). +

+ + +

ofloat getRange(unsigned int index) +
pfLOD::getRange returns the range element index +

+ + +

oint getNumRanges() +
returns the number of ranges currently set +

+ + +

ovoid setCenter(const Vec3 &center) +
Sets the object-space point which defines the center of the osg::LOD. +center is affected by any transforms in the hierarchy above the osg::LOD. +

+ + +

oconst Vec3& getCenter() +
return the LOD center point. +

+ + +

oint evaluate(const Vec3& eye_local, float bias=1.0f) +
return the child to traverse. +Selected by the distance between the eye point in local +coordinates and the LOD center, mutliplied by the bias. +

+ + +

ovirtual ~LOD() +

+ + +

ovirtual bool readLocalData(Input& fr) +

+ + +

ovirtual bool writeLocalData(Output& fw) +

+ + +

otypedef std::vector<float> RangeList +

+ + +

oRangeList _rangeList +

+ + +

oRangeList _rangeList2 +

+ + +

oVec3 _center +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/Light.html b/doc/osg/Light.html new file mode 100644 index 000000000..681d42c49 --- /dev/null +++ b/doc/osg/Light.html @@ -0,0 +1,441 @@ + + + class SG_EXPORT osg::Light + + + + +

class SG_EXPORT osg::Light: public Object

+
Light state class which encapsulates OpenGL glLight() functionality
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Methods

+[more] Light() +
+
+[more]static Light* instance() +
return a static instance of an osg::Light, to be used as prototype for loading lights +
+[more]virtual Object* clone() const +
return a shallow copy of a node, with Object* return type +
+[more]virtual bool isSameKindAs(Object* obj) +
+
+[more]virtual const char* className() const +
return the name of the node's class type +
+[more]void on( void ) +
Turn the light on. +
+[more]void off( void ) +
Turn the light off. +
+[more]static void enable( void ) +
Enable OpenGL's Lighting mode. +
+[more]static void disable( void ) +
Disable OpenGL's Lighting mode. +
+[more]void apply( void ) +
Apply the light's state to the OpenGL state machine. +
+[more]void setAmbient( const Vec4& ambient ) +
Set the ambient component of the light. +
+[more]const Vec4& getAmbient() const +
Get the ambient component of the light. +
+[more]void setDiffuse( const Vec4& diffuse ) +
Set the diffuse component of the light. +
+[more]const Vec4& getDiffuse() const +
Get the diffuse component of the light. +
+[more]void setSpecular( const Vec4& specular ) +
Set the specular component of the light. +
+[more]const Vec4& getSpecular() const +
Get the specular component of the light. +
+[more]void setPosition( const Vec4& position ) +
Set the position of the light. +
+[more]const Vec4& getPosition() const +
Get the position of the light. +
+[more]void setDirection( const Vec3& direction ) +
Set the direction of the light. +
+[more]const Vec3& getDirection() const +
Get the direction of the light. +
+[more]void setConstantAttenuation( float constant_attenuation ) +
Set the constant attenuation of the light. +
+[more]float setConstantAttenuation() const +
Get the constant attenuation of the light. +
+[more]void setLinearAttenuation( float linear_attenuation ) +
Set the linear attenuation of the light. +
+[more]float getLinearAttenuation() const +
Get the linear attenuation of the light. +
+[more]void setQuadraticAttenuation( float quadratic_attenuation ) +
Set the quadratic attenuation of the light. +
+[more]float getQuadraticAttenuation() const +
Get the quadratic attenuation of the light. +
+[more]void setSpotExponent( float spot_exponent ) +
Set the spot exponent of the light. +
+[more]float getSpotExponent() const +
Get the spot exponent of the light. +
+[more]void setSpotCutoff( float spot_cutoff ) +
Set the spot cutoff of the light. +
+[more]float getSpotCutoff() +
Get the spot cutoff of the light. +
+[more]void captureLightState() +
Capture the lighting settings of the current OpenGL state and store them in this object +

+ +

+

Protected Fields

+[more]int _lightnum +
+
+[more]bool _on +
+
+[more]Vec4 _ambient +
+
+[more]Vec4 _diffuse +
+
+[more]Vec4 _specular +
+
+[more]Vec4 _position +
+
+[more]Vec3 _direction +
+
+[more]float _constant_attenuation +
+
+[more]float _linear_attenuation +
+
+[more]float _quadratic_attenuation +
+
+[more]float _spot_exponent +
+
+[more]float _spot_cutoff +
+
+[more]static int _currentLightNum +
+

+ +

+

Protected Methods

+[more]virtual ~Light( void ) +
+
+[more]void init( void ) +
Initialize the light's settings with some decent defaults. +

+ +
+

Inherited from Object:

+
+

+

Public Methods

+ovirtual Object* readClone(Input& fr) +
+ovirtual bool write(Output& fw) +

+ +

+

Protected Methods

+ovirtual bool readLocalData(Input&) +
+ovirtual bool writeLocalData(Output&) +

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+oReferenced& operator = (Referenced&) +
+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _refCount +

+ +
+ + +
+

Documentation

+
Light state class which encapsulates OpenGL glLight() functionality
+
+ + + +
o Light() +

+ + +

ostatic Light* instance() +
return a static instance of an osg::Light, to be used as prototype +for loading lights +

+ + +

ovirtual Object* clone() const +
return a shallow copy of a node, with Object* return type +

+ + +

ovirtual bool isSameKindAs(Object* obj) +

+ + +

ovirtual const char* className() const +
return the name of the node's class type +

+ + +

ovoid on( void ) +
+Turn the light on. +Calling this method doesn't directly affect OpenGL's lighting mode. +

+ + +

ovoid off( void ) +
+Turn the light off. +Calling this method doesn't directly affect OpenGL's lighting mode. +

+ + +

ostatic void enable( void ) +
Enable OpenGL's Lighting mode. +

+ + +

ostatic void disable( void ) +
Disable OpenGL's Lighting mode. +

+ + +

ovoid apply( void ) +
Apply the light's state to the OpenGL state machine. +

+ + +

ovoid setAmbient( const Vec4& ambient ) +
Set the ambient component of the light. +

+ + +

oconst Vec4& getAmbient() const +
Get the ambient component of the light. +

+ + +

ovoid setDiffuse( const Vec4& diffuse ) +
Set the diffuse component of the light. +

+ + +

oconst Vec4& getDiffuse() const +
Get the diffuse component of the light. +

+ + +

ovoid setSpecular( const Vec4& specular ) +
Set the specular component of the light. +

+ + +

oconst Vec4& getSpecular() const +
Get the specular component of the light. +

+ + +

ovoid setPosition( const Vec4& position ) +
Set the position of the light. +

+ + +

oconst Vec4& getPosition() const +
Get the position of the light. +

+ + +

ovoid setDirection( const Vec3& direction ) +
Set the direction of the light. +

+ + +

oconst Vec3& getDirection() const +
Get the direction of the light. +

+ + +

ovoid setConstantAttenuation( float constant_attenuation ) +
Set the constant attenuation of the light. +

+ + +

ofloat setConstantAttenuation() const +
Get the constant attenuation of the light. +

+ + +

ovoid setLinearAttenuation( float linear_attenuation ) +
Set the linear attenuation of the light. +

+ + +

ofloat getLinearAttenuation() const +
Get the linear attenuation of the light. +

+ + +

ovoid setQuadraticAttenuation( float quadratic_attenuation ) +
Set the quadratic attenuation of the light. +

+ + +

ofloat getQuadraticAttenuation() const +
Get the quadratic attenuation of the light. +

+ + +

ovoid setSpotExponent( float spot_exponent ) +
Set the spot exponent of the light. +

+ + +

ofloat getSpotExponent() const +
Get the spot exponent of the light. +

+ + +

ovoid setSpotCutoff( float spot_cutoff ) +
Set the spot cutoff of the light. +

+ + +

ofloat getSpotCutoff() +
Get the spot cutoff of the light. +

+ + +

ovoid captureLightState() +
+Capture the lighting settings of the current OpenGL state +and store them in this object +

+ + +

ovirtual ~Light( void ) +

+ + +

ovoid init( void ) +
Initialize the light's settings with some decent defaults. +

+ + +

oint _lightnum +

+ + +

obool _on +

+ + +

oVec4 _ambient +

+ + +

oVec4 _diffuse +

+ + +

oVec4 _specular +

+ + +

oVec4 _position +

+ + +

oVec3 _direction +

+ + +

ofloat _constant_attenuation +

+ + +

ofloat _linear_attenuation +

+ + +

ofloat _quadratic_attenuation +

+ + +

ofloat _spot_exponent +

+ + +

ofloat _spot_cutoff +

+ + +

ostatic int _currentLightNum +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/LightSource.html b/doc/osg/LightSource.html new file mode 100644 index 000000000..1fc59df0e --- /dev/null +++ b/doc/osg/LightSource.html @@ -0,0 +1,241 @@ + + + class SG_EXPORT osg::LightSource + + + + +

class SG_EXPORT osg::LightSource: public Node

+
Leaf Node for defining a light in the scene
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Methods

+[more] LightSource() +
+
+[more]virtual Object* clone() const +
+
+[more]virtual bool isSameKindAs(Object* obj) +
+
+[more]virtual const char* className() const +
+
+[more]virtual void accept(NodeVisitor& nv) +
+
+[more]void setLight(Light* light) +
Set the attached light +
+[more]Light* getLight() +
Get the attached light +

+ +

+

Protected Fields

+[more]ref_ptr<Light> _light +
+

+ +

+

Protected Methods

+[more]virtual ~LightSource() +
+
+[more]virtual bool readLocalData(Input& fr) +
+
+[more]virtual bool writeLocalData(Output& fw) +
+
+[more]virtual bool computeBound( void ) +
+

+ +
+

Inherited from Node:

+
+

+

Public Methods

+oNode* cloneNode() const +
+ovirtual void ascend(NodeVisitor& nv) +
+ovirtual void traverse(NodeVisitor& ) +
+ovoid setName( const std::string& name ) +
+ovoid setName( const char* name ) +
+oconst std::string& getName( void ) +
+oconst ParentList& getParents() const +
+oGroup* getParent(int i) const +
+oint getNumParents() const +
+ovoid setUserData(void* data, MemoryAdapter* ma=0L) +
+ovoid* getUserData() const +
+oMemoryAdapter* getMemoryAdapter() const +
+ovoid setNodeMask(NodeMask nm) +
+oNodeMask getNodeMask() +
+oconst DescriptionList& getDescriptions() const +
+oDescriptionList& getDescriptions() +
+oconst std::string& getDescription(int i) const +
+ostd::string& getDescription(int i) +
+oint getNumDescriptions() const +
+ovoid addDescription(const std::string& desc) +
+oconst BoundingSphere& getBound() +
+ovoid dirtyBound() +

+ +

+

Public

+otypedef std::vector<Group*> ParentList +
+otypedef unsigned int NodeMask +
+otypedef std::vector<std::string> DescriptionList +

+ +

+

Protected Fields

+oBoundingSphere _bsphere +
+obool _bsphere_computed +
+ostd::string _name +
+oParentList _parents +
+ofriend Group +
+ovoid* _userData +
+oref_ptr<MemoryAdapter> _memoryAdapter +
+oNodeMask _nodeMask +
+oDescriptionList _descriptions +

+ +
+

Inherited from Object:

+
+

+

Public Methods

+ovirtual Object* readClone(Input& fr) +
+ovirtual bool write(Output& fw) +

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+oReferenced& operator = (Referenced&) +
+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _refCount +

+ +
+ + +
+

Documentation

+
Leaf Node for defining a light in the scene
+
+ + + +
o LightSource() +

+ + +

ovirtual Object* clone() const +

+ + +

ovirtual bool isSameKindAs(Object* obj) +

+ + +

ovirtual const char* className() const +

+ + +

ovirtual void accept(NodeVisitor& nv) +

+ + +

ovoid setLight(Light* light) +
Set the attached light +

+ + +

oLight* getLight() +
Get the attached light +

+ + +

ovirtual ~LightSource() +

+ + +

ovirtual bool readLocalData(Input& fr) +

+ + +

ovirtual bool writeLocalData(Output& fw) +

+ + +

ovirtual bool computeBound( void ) +

+ + +

oref_ptr<Light> _light +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/Lighting.html b/doc/osg/Lighting.html new file mode 100644 index 000000000..ec730d23b --- /dev/null +++ b/doc/osg/Lighting.html @@ -0,0 +1,46 @@ + + + class SG_EXPORT osg::Lighting + + + + +

class SG_EXPORT osg::Lighting

+
Class to globally control OpenGL's lighting
+
+ +
+

+

Public Methods

+[more]static void enable() +
Enable lighting +
+[more]static void disable() +
Disable lighting +

+ +
+ + +
+

Documentation

+
Class to globally control OpenGL's lighting
+
+ + + +
ostatic void enable() +
Enable lighting +

+ + +

ostatic void disable() +
Disable lighting +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/Material.html b/doc/osg/Material.html new file mode 100644 index 000000000..808f53c88 --- /dev/null +++ b/doc/osg/Material.html @@ -0,0 +1,424 @@ + + + class SG_EXPORT osg::Material + + + + +

class SG_EXPORT osg::Material: public Object

+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Classes

+[more]enum MaterialFace +
+
+[more]enum ColorMode +
+

+ +

+

Public Methods

+[more] Material( void ) +
+
+[more]static Material* instance() +
+
+[more]virtual Object* clone() const +
+
+[more]virtual bool isSameKindAs(Object* obj) +
+
+[more]const char* className() const +
+
+[more]void apply( void ) +
+
+[more]void setColorMode(ColorMode mode) +
+
+[more]void setAmbient( MaterialFace face, const Vec4& ambient ) +
+
+[more]const Vec4& getAmbient(MaterialFace face) const +
+
+[more]bool getAmbientFrontAndBack() +
+
+[more]void setDiffuse( MaterialFace face, const Vec4& diffuse ) +
+
+[more]const Vec4& getDiffuse(MaterialFace face) const +
+
+[more]bool getDiffuseFrontAndBack() +
+
+[more]void setSpecular( MaterialFace face, const Vec4& specular ) +
+
+[more]const Vec4& getSpecular(MaterialFace face) const +
+
+[more]bool getSpecularFrontAndBack() +
+
+[more]void setEmission( MaterialFace face, const Vec4& emission ) +
+
+[more]const Vec4& getEmission(MaterialFace face) const +
+
+[more]bool getEmissionFrontAndBack() +
+
+[more]void setShininess( MaterialFace face, float shininess ) +
+
+[more]float getShininess(MaterialFace face) const +
+
+[more]bool getShininessFrontAndBack() +
+

+ +

+

Protected Fields

+[more]ColorMode _colorMode +
+
+[more]bool _ambientFrontAndBack +
+
+[more]Vec4 _ambientFront +
+
+[more]Vec4 _ambientBack +
+
+[more]bool _diffuseFrontAndBack +
+
+[more]Vec4 _diffuseFront +
+
+[more]Vec4 _diffuseBack +
+
+[more]bool _specularFrontAndBack +
+
+[more]Vec4 _specularFront +
+
+[more]Vec4 _specularBack +
+
+[more]bool _emissionFrontAndBack +
+
+[more]Vec4 _emissionFront +
+
+[more]Vec4 _emissionBack +
+
+[more]bool _shininessFrontAndBack +
+
+[more]float _shininessFront +
+
+[more]float _shininessBack +
+

+ +

+

Protected Methods

+[more]virtual ~Material( void ) +
+
+[more]virtual bool readLocalData(Input& fr) +
+
+[more]virtual bool writeLocalData(Output& fw) +
+
+[more]bool matchFaceAndColor(Input& fr, const char* name, MaterialFace& mf, Vec4& color) +
+

+ +
+

Inherited from Object:

+
+

+

Public Methods

+ovirtual Object* readClone(Input& fr) +
+ovirtual bool write(Output& fw) +

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+oReferenced& operator = (Referenced&) +
+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _refCount +

+ +
+ + +
+

Documentation

+
+ + + +
oenum MaterialFace +

+ + + +
o FACE_FRONT +

+ + +

o FACE_BACK +

+ + +

o FACE_FRONT_AND_BACK +

+ + + +
oenum ColorMode +

+ + + +
o AMBIENT +

+ + +

o DIFFUSE +

+ + +

o SPECULAR +

+ + +

o EMISSION +

+ + +

o AMBIENT_AND_DIFFUSE +

+ + +

o OFF +

+ + + +
o Material( void ) +

+ + +

ostatic Material* instance() +

+ + +

ovirtual Object* clone() const +

+ + +

ovirtual bool isSameKindAs(Object* obj) +

+ + +

oconst char* className() const +

+ + +

ovoid apply( void ) +

+ + +

ovoid setColorMode(ColorMode mode) +

+ + +

ovoid setAmbient( MaterialFace face, const Vec4& ambient ) +

+ + +

oconst Vec4& getAmbient(MaterialFace face) const +

+ + +

obool getAmbientFrontAndBack() +

+ + +

ovoid setDiffuse( MaterialFace face, const Vec4& diffuse ) +

+ + +

oconst Vec4& getDiffuse(MaterialFace face) const +

+ + +

obool getDiffuseFrontAndBack() +

+ + +

ovoid setSpecular( MaterialFace face, const Vec4& specular ) +

+ + +

oconst Vec4& getSpecular(MaterialFace face) const +

+ + +

obool getSpecularFrontAndBack() +

+ + +

ovoid setEmission( MaterialFace face, const Vec4& emission ) +

+ + +

oconst Vec4& getEmission(MaterialFace face) const +

+ + +

obool getEmissionFrontAndBack() +

+ + +

ovoid setShininess( MaterialFace face, float shininess ) +

+ + +

ofloat getShininess(MaterialFace face) const +

+ + +

obool getShininessFrontAndBack() +

+ + +

ovirtual ~Material( void ) +

+ + +

ovirtual bool readLocalData(Input& fr) +

+ + +

ovirtual bool writeLocalData(Output& fw) +

+ + +

obool matchFaceAndColor(Input& fr, const char* name, MaterialFace& mf, Vec4& color) +

+ + +

oColorMode _colorMode +

+ + +

obool _ambientFrontAndBack +

+ + +

oVec4 _ambientFront +

+ + +

oVec4 _ambientBack +

+ + +

obool _diffuseFrontAndBack +

+ + +

oVec4 _diffuseFront +

+ + +

oVec4 _diffuseBack +

+ + +

obool _specularFrontAndBack +

+ + +

oVec4 _specularFront +

+ + +

oVec4 _specularBack +

+ + +

obool _emissionFrontAndBack +

+ + +

oVec4 _emissionFront +

+ + +

oVec4 _emissionBack +

+ + +

obool _shininessFrontAndBack +

+ + +

ofloat _shininessFront +

+ + +

ofloat _shininessBack +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/Matrix.html b/doc/osg/Matrix.html new file mode 100644 index 000000000..3e86a8b2f --- /dev/null +++ b/doc/osg/Matrix.html @@ -0,0 +1,356 @@ + + + class SG_EXPORT osg::Matrix + + + + +

class SG_EXPORT osg::Matrix: public Object

+
4x4 Matrix for storage & manipulation of transformations in scene graph.
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Fields

+[more]float _mat[4][4] +
+

+ +

+

Public Methods

+[more] Matrix() +
+
+[more] Matrix(const Matrix& matrix) +
+
+[more] Matrix( float a00, float a01, float a02, float a03, float a10, float a11, float a12, float a13, float a20, float a21, float a22, float a23, float a30, float a31, float a32, float a33) +
+
+[more]Matrix& operator = (const Matrix& matrix) +
+
+[more]virtual ~Matrix() +
+
+[more]static Matrix* instance() +
+
+[more]virtual Object* clone() const +
+
+[more]virtual bool isSameKindAs(Object* obj) +
+
+[more]virtual const char* className() const +
+
+[more]void makeIdent() +
+
+[more]void set(const float* m) +
+
+[more]void copy(const Matrix& matrix) +
+
+[more]void makeScale(float sx, float sy, float sz) +
+
+[more]void preScale( float sx, float sy, float sz, const Matrix& m ) +
+
+[more]void postScale( const Matrix& m, float sx, float sy, float sz ) +
+
+[more]void preScale( float sx, float sy, float sz ) +
+
+[more]void postScale( float sx, float sy, float sz ) +
+
+[more]void makeTrans( float tx, float ty, float tz ) +
+
+[more]void preTrans( float tx, float ty, float tz, const Matrix& m ) +
+
+[more]void postTrans( const Matrix& m, float tx, float ty, float tz ) +
+
+[more]void preTrans( float tx, float ty, float tz ) +
+
+[more]void postTrans( float tx, float ty, float tz ) +
+
+[more]void makeRot( float deg, float x, float y, float z ) +
+
+[more]void preRot( float deg, float x, float y, float z, const Matrix& m ) +
+
+[more]void postRot( const Matrix& m, float deg, float x, float y, float z ) +
+
+[more]void preRot( float deg, float x, float y, float z ) +
+
+[more]void postRot( float deg, float x, float y, float z ) +
+
+[more]void setTrans( float tx, float ty, float tz ) +
+
+[more]void setTrans( const Vec3& v ) +
+
+[more]Vec3 getTrans() const +
+
+[more]void preMult(const Matrix& m) +
+
+[more]void postMult(const Matrix& m) +
+
+[more]void mult(const Matrix& lhs, const Matrix& rhs) +
+
+[more]Matrix operator * (const Matrix& m) const +
+
+[more]inline Vec3 operator * (const Vec3& v) const +
+
+[more]inline friend Vec3 operator * (const Vec3& v, const Matrix& m) +
+
+[more]bool invert(const Matrix& m) +
+

+ +

+

Protected Methods

+[more]virtual bool readLocalData(Input& fr) +
+
+[more]virtual bool writeLocalData(Output& fw) +
+

+ +
+

Inherited from Object:

+
+

+

Public Methods

+ovirtual Object* readClone(Input& fr) +
+ovirtual bool write(Output& fw) +

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _refCount +

+ +
+ + +
+

Documentation

+
4x4 Matrix for storage & manipulation of transformations in scene graph. +Provides basic maths operations, IO and via osg::Object reference counting.
+
+ + + +
o Matrix() +

+ + +

o Matrix(const Matrix& matrix) +

+ + +

o Matrix( float a00, float a01, float a02, float a03, float a10, float a11, float a12, float a13, float a20, float a21, float a22, float a23, float a30, float a31, float a32, float a33) +

+ + +

oMatrix& operator = (const Matrix& matrix) +

+ + +

ovirtual ~Matrix() +

+ + +

ostatic Matrix* instance() +

+ + +

ovirtual Object* clone() const +

+ + +

ovirtual bool isSameKindAs(Object* obj) +

+ + +

ovirtual const char* className() const +

+ + +

ovoid makeIdent() +

+ + +

ovoid set(const float* m) +

+ + +

ovoid copy(const Matrix& matrix) +

+ + +

ovoid makeScale(float sx, float sy, float sz) +

+ + +

ovoid preScale( float sx, float sy, float sz, const Matrix& m ) +

+ + +

ovoid postScale( const Matrix& m, float sx, float sy, float sz ) +

+ + +

ovoid preScale( float sx, float sy, float sz ) +

+ + +

ovoid postScale( float sx, float sy, float sz ) +

+ + +

ovoid makeTrans( float tx, float ty, float tz ) +

+ + +

ovoid preTrans( float tx, float ty, float tz, const Matrix& m ) +

+ + +

ovoid postTrans( const Matrix& m, float tx, float ty, float tz ) +

+ + +

ovoid preTrans( float tx, float ty, float tz ) +

+ + +

ovoid postTrans( float tx, float ty, float tz ) +

+ + +

ovoid makeRot( float deg, float x, float y, float z ) +

+ + +

ovoid preRot( float deg, float x, float y, float z, const Matrix& m ) +

+ + +

ovoid postRot( const Matrix& m, float deg, float x, float y, float z ) +

+ + +

ovoid preRot( float deg, float x, float y, float z ) +

+ + +

ovoid postRot( float deg, float x, float y, float z ) +

+ + +

ovoid setTrans( float tx, float ty, float tz ) +

+ + +

ovoid setTrans( const Vec3& v ) +

+ + +

oVec3 getTrans() const +

+ + +

ovoid preMult(const Matrix& m) +

+ + +

ovoid postMult(const Matrix& m) +

+ + +

ovoid mult(const Matrix& lhs, const Matrix& rhs) +

+ + +

oMatrix operator * (const Matrix& m) const +

+ + +

oinline Vec3 operator * (const Vec3& v) const +

+ + +

oinline friend Vec3 operator * (const Vec3& v, const Matrix& m) +

+ + +

obool invert(const Matrix& m) +

+ + +

ofloat _mat[4][4] +

+ + +

ovirtual bool readLocalData(Input& fr) +

+ + +

ovirtual bool writeLocalData(Output& fw) +

+
+
Direct child classes: +
TexMat
+
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/MemoryAdapter.html b/doc/osg/MemoryAdapter.html new file mode 100644 index 000000000..1e86a218c --- /dev/null +++ b/doc/osg/MemoryAdapter.html @@ -0,0 +1,122 @@ + + + class SG_EXPORT osg::MemoryAdapter + + + + +

class SG_EXPORT osg::MemoryAdapter: public Referenced

+
Class for adapting the memory management of external data.
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Methods

+[more] MemoryAdapter() +
+
+[more]virtual void incrementReference(void* ) +
Increment the reference count of the userData +
+[more]virtual void decrementReference(void* ) +
Decrement the reference count of the userData. +
+[more]virtual void* clone(void* ) +
not current used, but will be used in future +
+[more]virtual bool write(Output& , void* ) +
not current used, but will be used in future +
+[more]virtual bool read(Input& , void* ) +
not current used, but will be used in future +

+ +

+

Protected Methods

+[more]virtual ~MemoryAdapter() +
+

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+oReferenced& operator = (Referenced&) +
+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _refCount +

+ +
+ + +
+

Documentation

+
Class for adapting the memory management of external data. +Typically used to specify the memory management of user data +which can be attached to osg::Node.
+
+ + + +
o MemoryAdapter() +

+ + +

ovirtual void incrementReference(void* ) +
Increment the reference count of the userData +

+ + +

ovirtual void decrementReference(void* ) +
Decrement the reference count of the userData. +Is usually implemented such that if reference count +is decremented to zero the userData should be +deleted. However, this is entirely up to the +discression of the user who is extending this base class. +

+ + +

ovirtual void* clone(void* ) +
not current used, but will be used in future +

+ + +

ovirtual bool write(Output& , void* ) +
not current used, but will be used in future +

+ + +

ovirtual bool read(Input& , void* ) +
not current used, but will be used in future +

+ + +

ovirtual ~MemoryAdapter() +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/NavigatorButton.class b/doc/osg/NavigatorButton.class new file mode 100644 index 000000000..fad9c3f2d Binary files /dev/null and b/doc/osg/NavigatorButton.class differ diff --git a/doc/osg/Node.html b/doc/osg/Node.html new file mode 100644 index 000000000..7b2d04f10 --- /dev/null +++ b/doc/osg/Node.html @@ -0,0 +1,444 @@ + + + class SG_EXPORT osg::Node + + + + +

class SG_EXPORT osg::Node: public Object

+
Base class for all internal nodes in the scene graph.
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Methods

+[more] Node() +
Construct a node. +
+[more]virtual Object* clone() const +
return a shallow copy of a node, with Object* return type +
+[more]Node* cloneNode() const +
return a shallow copy of a node, with Node* return type +
+[more]virtual bool isSameKindAs(Object* obj) +
return true if this and obj are of the same kind of object +
+[more]virtual const char* className() const +
return the name of the node's class type +
+[more]virtual void accept(NodeVisitor& nv) +
Visitor Pattern : calls the apply method of a NodeVisitor with this node's type +
+[more]virtual void ascend(NodeVisitor& nv) +
Traverse upwards : calls parents' accept method with NodeVisitor +
+[more]virtual void traverse(NodeVisitor& ) +
Traverse downwards : calls children's accept method with NodeVisitor +
+[more]void setName( const std::string& name ) +
Set the name of node using C++ style string +
+[more]void setName( const char* name ) +
Set the name of node using a C style string +
+[more]const std::string& getName( void ) +
Get the name of node +
+[more]const ParentList& getParents() const +
Get the parent list of node. +
+[more]Group* getParent(int i) const +
Get a single parent of node. +
+[more]int getNumParents() const +
Get the number of parents of node. +
+[more]void setUserData(void* data, MemoryAdapter* ma=0L) +
Set user data. +
+[more]void* getUserData() const +
Get user data +
+[more]MemoryAdapter* getMemoryAdapter() const +
Get the memory adapter associated with _userData +
+[more]void setNodeMask(NodeMask nm) +
Set the node mask. +
+[more]NodeMask getNodeMask() +
Get the node Mask. +
+[more]const DescriptionList& getDescriptions() const +
Get the description list of the const node +
+[more]DescriptionList& getDescriptions() +
Get the description list of the const node +
+[more]const std::string& getDescription(int i) const +
Get a single const description of the const node +
+[more]std::string& getDescription(int i) +
Get a single description of the node +
+[more]int getNumDescriptions() const +
Get the number of descriptions of the node +
+[more]void addDescription(const std::string& desc) +
Add a description string to the node +
+[more]const BoundingSphere& getBound() +
get the bounding sphere of node. +
+[more]void dirtyBound() +
Mark this node's bounding sphere dirty. +

+ +

+

Public

+[more]typedef std::vector<Group*> ParentList +
A vector of osg::Group pointers which is used to store the parent(s) of node +
+[more]typedef unsigned int NodeMask +
+
+[more]typedef std::vector<std::string> DescriptionList +
A vector of std::string's which are used to describe the object +

+ +

+

Protected Fields

+[more]BoundingSphere _bsphere +
+
+[more]bool _bsphere_computed +
+
+[more]std::string _name +
+
+[more]ParentList _parents +
+
+[more]friend Group +
+
+[more]void* _userData +
+
+[more]ref_ptr<MemoryAdapter> _memoryAdapter +
+
+[more]NodeMask _nodeMask +
+
+[more]DescriptionList _descriptions +
+

+ +

+

Protected Methods

+[more]virtual ~Node() +
Node destructor. +
+[more]virtual bool readLocalData(Input& fr) +
Template Method Pattern : read local data from osg file. +
+[more]virtual bool writeLocalData(Output& fw) +
Template Method Pattern : read local data from osg file. +
+[more]virtual bool computeBound( void ) +
Compute the bounding sphere around Node's geometry or children. +

+ +
+

Inherited from Object:

+
+

+

Public Methods

+ovirtual Object* readClone(Input& fr) +
+ovirtual bool write(Output& fw) +

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+oReferenced& operator = (Referenced&) +
+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _refCount +

+ +
+ + +
+

Documentation

+
Base class for all internal nodes in the scene graph. +Provides interface for most common node operations (Composite Pattern).
+
+ + + +
o Node() +
Construct a node. +Initialize the parent list to empty, node name to "" and +bounding sphere dirty flag to true. +

+ + +

ovirtual Object* clone() const +
return a shallow copy of a node, with Object* return type +

+ + +

oNode* cloneNode() const +
return a shallow copy of a node, with Node* return type +

+ + +

ovirtual bool isSameKindAs(Object* obj) +
return true if this and obj are of the same kind of object +

+ + +

ovirtual const char* className() const +
return the name of the node's class type +

+ + +

ovirtual void accept(NodeVisitor& nv) +
Visitor Pattern : calls the apply method of a NodeVisitor with this node's type +

+ + +

ovirtual void ascend(NodeVisitor& nv) +
Traverse upwards : calls parents' accept method with NodeVisitor +

+ + +

ovirtual void traverse(NodeVisitor& ) +
Traverse downwards : calls children's accept method with NodeVisitor +

+ + +

ovoid setName( const std::string& name ) +
Set the name of node using C++ style string +

+ + +

ovoid setName( const char* name ) +
Set the name of node using a C style string +

+ + +

oconst std::string& getName( void ) +
Get the name of node +

+ + +

otypedef std::vector<Group*> ParentList +
A vector of osg::Group pointers which is used to store the parent(s) of node +

+ + +

oconst ParentList& getParents() const +
Get the parent list of node. +

+ + +

oGroup* getParent(int i) const +
+Get a single parent of node. + +
Parameters:
i - index of the parent to get. +
Returns:
the parent i.

+ + +

oint getNumParents() const +
+Get the number of parents of node. + +
Returns:
the number of parents of this node.

+ + +

ovoid setUserData(void* data, MemoryAdapter* ma=0L) +
+Set user data. See MemoryAdapter documention for details +of how to specify memory managament of _userData. +

+ + +

ovoid* getUserData() const +
Get user data +

+ + +

oMemoryAdapter* getMemoryAdapter() const +
Get the memory adapter associated with _userData +

+ + +

otypedef unsigned int NodeMask +

+ + +

ovoid setNodeMask(NodeMask nm) +
Set the node mask. Note, node mask is will be replaced by TraversalMask. +

+ + +

oNodeMask getNodeMask() +
Get the node Mask. Note, node mask is will be replaced by TraversalMask. +

+ + +

otypedef std::vector<std::string> DescriptionList +
A vector of std::string's which are used to describe the object +

+ + +

oconst DescriptionList& getDescriptions() const +
Get the description list of the const node +

+ + +

oDescriptionList& getDescriptions() +
Get the description list of the const node +

+ + +

oconst std::string& getDescription(int i) const +
Get a single const description of the const node +

+ + +

ostd::string& getDescription(int i) +
Get a single description of the node +

+ + +

oint getNumDescriptions() const +
Get the number of descriptions of the node +

+ + +

ovoid addDescription(const std::string& desc) +
Add a description string to the node +

+ + +

oconst BoundingSphere& getBound() +
get the bounding sphere of node. +Using lazy evaluation computes the bounding sphere if it is 'dirty'. +

+ + +

ovoid dirtyBound() +
Mark this node's bounding sphere dirty. +Forcing it to be computed on the next call to getBound(). +

+ + +

ovirtual ~Node() +
Node destructor. Note, is protected so that Nodes cannot +be deleted other than by being dereferenced and the reference +count being zero (see osg::Referenced), preventing the deletion +of nodes which are still in use. This also means that +Node's cannot be created on stack i.e Node node will not compile, +forcing all nodes to be created on the heap i.e Node* node += new Node(). +

+ + +

ovirtual bool readLocalData(Input& fr) +
+Template Method Pattern : read local data from osg file. +Note should be implemented in derived classes, which +call their parent class's readLocalData. + +
Returns:
true if the input iterator has been advanced, otherwise false.

+ + +

ovirtual bool writeLocalData(Output& fw) +
+Template Method Pattern : read local data from osg file. +Note should be implemented in derivied classes, which +call their parent class's writeLocalData. + +
Returns:
true if data has been written out, otherwise false.

+ + +

ovirtual bool computeBound( void ) +
Compute the bounding sphere around Node's geometry or children. +This method is automatically called by getBound() when the bounding +sphere has been marked dirty via dirtyBound(). +

+ + +

oBoundingSphere _bsphere +

+ + +

obool _bsphere_computed +

+ + +

ostd::string _name +

+ + +

oParentList _parents +

+ + +

ofriend Group +

+ + +

ovoid* _userData +

+ + +

oref_ptr<MemoryAdapter> _memoryAdapter +

+ + +

oNodeMask _nodeMask +

+ + +

oDescriptionList _descriptions +

+
+
Direct child classes: +
LightSource
+Group
+Geode
+
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/NodeAcceptOp.html b/doc/osg/NodeAcceptOp.html new file mode 100644 index 000000000..bac22fd5a --- /dev/null +++ b/doc/osg/NodeAcceptOp.html @@ -0,0 +1,53 @@ + + + struct osg::NodeAcceptOp + + + + +

struct osg::NodeAcceptOp

+
Convinience functor for assisting visiting of arrays of osg::Node's
+ +
+

+
+[more]NodeVisitor& _nv +
+
+[more] NodeAcceptOp(NodeVisitor& nv) +
+
+[more]void operator () (Node* node) +
+
+[more]void operator () (ref_ptr<Node> node) +
+

+ + + +
+

Documentation

+
Convinience functor for assisting visiting of arrays of osg::Node's
+
+ + + +
oNodeVisitor& _nv +

+ + +

o NodeAcceptOp(NodeVisitor& nv) +

+ + +

ovoid operator () (Node* node) +

+ + +

ovoid operator () (ref_ptr<Node> node) +

+

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/NodePath.html b/doc/osg/NodePath.html new file mode 100644 index 000000000..ab9a5cf68 --- /dev/null +++ b/doc/osg/NodePath.html @@ -0,0 +1,20 @@ + + + typedef std::vector<Node*> osg::NodePath + + + + +

typedef std::vector<Node*> osg::NodePath

+
A vector of Nodes pointers which is used to describe the path from a root node to a descendant
+ + +
+

Documentation

+
A vector of Nodes pointers which is used to describe the path from a root node to a descendant
+
+
+

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/NodeVisitor.html b/doc/osg/NodeVisitor.html new file mode 100644 index 000000000..56ea4fb13 --- /dev/null +++ b/doc/osg/NodeVisitor.html @@ -0,0 +1,241 @@ + + + class SG_EXPORT osg::NodeVisitor + + + + +

class SG_EXPORT osg::NodeVisitor: public Referenced

+
Visitor for type safe operations on osg::Node's.
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Classes

+[more]enum TraversalMode +
+

+ +

+

Public Methods

+[more] NodeVisitor(TraversalMode tm=TRAVERSE_NONE) +
+
+[more]virtual ~NodeVisitor() +
+
+[more]void setTraverseMode(TraversalMode mode) +
Set the traversal mode for Node::traverse() to use when deciding which children of a node to traverse. +
+[more]TraversalMode getTraverseMode() +
Get the traversal mode +
+[more]void setTraverseVisitor(NodeVisitor* nv) +
Set a visitor to handle traversal. +
+[more]NodeVisitor* getTraverseVisitor() +
Get the traverse visitor, returns NULL if none is attached +
+[more]void traverse(Node& node) +
Inline method for passing handling traversal of a nodes. +
+[more]virtual void apply(Node& node) +
+
+[more]virtual void apply(Geode& node) +
+
+[more]virtual void apply(Billboard& node) +
+
+[more]virtual void apply(LightSource& node) +
+
+[more]virtual void apply(Group& node) +
+
+[more]virtual void apply(DCS& node) +
+
+[more]virtual void apply(Switch& node) +
+
+[more]virtual void apply(Sequence& node) +
+
+[more]virtual void apply(LOD& node) +
+
+[more]virtual void apply(Scene& node) +
+

+ +

+

Protected Fields

+[more]NodeVisitor* _traverseVisitor +
+
+[more]TraversalMode _traverseMode +
+

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+oReferenced& operator = (Referenced&) +
+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _refCount +

+ +
+ + +
+

Documentation

+
Visitor for type safe operations on osg::Node's. +Based on GOF's Visitor pattern.
+
+ + + +
oenum TraversalMode +

+ + + +
o TRAVERSE_NONE +

+ + +

o TRAVERSE_PARENTS +

+ + +

o TRAVERSE_ALL_CHILDREN +

+ + +

o TRAVERSE_ACTIVE_CHILDREN +

+ + +

o TRAVERSE_VISITOR +

+ + + +
o NodeVisitor(TraversalMode tm=TRAVERSE_NONE) +

+ + +

ovirtual ~NodeVisitor() +

+ + +

ovoid setTraverseMode(TraversalMode mode) +
Set the traversal mode for Node::traverse() to use when +deciding which children of a node to traverse. If a +NodeVisitor has been attached via setTraverseVisitor() +and the new mode is not TRAVERSE_VISITOR then the attached +visitor is detached. Default mode is TRAVERSE_NONE. +

+ + +

oTraversalMode getTraverseMode() +
Get the traversal mode +

+ + +

ovoid setTraverseVisitor(NodeVisitor* nv) +
Set a visitor to handle traversal. +Overides the traverse mode setting it to TRAVERSE_VISITOR. +

+ + +

oNodeVisitor* getTraverseVisitor() +
Get the traverse visitor, returns NULL if none is attached +

+ + +

ovoid traverse(Node& node) +
Inline method for passing handling traversal of a nodes. +If you intend to use the visitor for actively traversing +the scene graph then make sure the accept() methods call +this method unless they handle traversal directly. +

+ + +

ovirtual void apply(Node& node) +

+ + +

ovirtual void apply(Geode& node) +

+ + +

ovirtual void apply(Billboard& node) +

+ + +

ovirtual void apply(LightSource& node) +

+ + +

ovirtual void apply(Group& node) +

+ + +

ovirtual void apply(DCS& node) +

+ + +

ovirtual void apply(Switch& node) +

+ + +

ovirtual void apply(Sequence& node) +

+ + +

ovirtual void apply(LOD& node) +

+ + +

ovirtual void apply(Scene& node) +

+ + +

oNodeVisitor* _traverseVisitor +

+ + +

oTraversalMode _traverseMode +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/NotifyInit.html b/doc/osg/NotifyInit.html new file mode 100644 index 000000000..a43dd4a74 --- /dev/null +++ b/doc/osg/NotifyInit.html @@ -0,0 +1,42 @@ + + + class SG_EXPORT osg::NotifyInit + + + + +

class SG_EXPORT osg::NotifyInit

+
+ +
+

+

Public Methods

+[more] NotifyInit() +
+
+[more] ~NotifyInit() +
+

+ +
+ + +
+

Documentation

+
+ + + +
o NotifyInit() +

+ + +

o ~NotifyInit() +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/NotifySeverity.html b/doc/osg/NotifySeverity.html new file mode 100644 index 000000000..395e57368 --- /dev/null +++ b/doc/osg/NotifySeverity.html @@ -0,0 +1,72 @@ + + + enum osg::NotifySeverity + + + + +

enum osg::NotifySeverity

+ +
+

+
+[more] ALWAYS +
+
+[more] FATAL +
+
+[more] WARN +
+
+[more] NOTICE +
+
+[more] INFO +
+
+[more] DEBUG +
+
+[more] FP_DEBUG +
+

+ + + +
+

Documentation

+
+ + + +
o ALWAYS +

+ + +

o FATAL +

+ + +

o WARN +

+ + +

o NOTICE +

+ + +

o INFO +

+ + +

o DEBUG +

+ + +

o FP_DEBUG +

+

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/Object.html b/doc/osg/Object.html new file mode 100644 index 000000000..fceba8669 --- /dev/null +++ b/doc/osg/Object.html @@ -0,0 +1,175 @@ + + + class SG_EXPORT osg::Object + + + + +

class SG_EXPORT osg::Object: public Referenced

+
Base class/standard interface for objects which require IO support, cloning and reference counting.
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Methods

+[more] Object() +
Construct an object. +
+[more]virtual Object* clone() const +
return a shallow copy of a node, with Object* return type. +
+[more]virtual bool isSameKindAs(Object*) +
+
+[more]virtual const char* className() const +
return the name of the object's class type. +
+[more]virtual Object* readClone(Input& fr) +
Template Method/Prototype Pattern : create a clone and read Object data from Input. +
+[more]virtual bool write(Output& fw) +
Template Method Pattern : write out Object data to Output. +

+ +

+

Protected Methods

+[more]virtual ~Object() +
Object destructor. +
+[more]virtual bool readLocalData(Input&) +
Template Method Pattern : read local data from osg file. +
+[more]virtual bool writeLocalData(Output&) +
Template Method Pattern : write local data to osg file. +

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+oReferenced& operator = (Referenced&) +
+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _refCount +

+ +
+ + +
+

Documentation

+
Base class/standard interface for objects which require IO support, +cloning and reference counting. +Based on GOF Composite, Prototype and Template Method patterns.
+
+ + + +
o Object() +
Construct an object. Note Object is a pure virtual base class +and therefore cannot be constructed on its own, only derived +classes which overide the clone and className methods are +concrete classes and can be constructed. +

+ + +

ovirtual Object* clone() const +
return a shallow copy of a node, with Object* return type. +Must be defined by derived classes. +

+ + +

ovirtual bool isSameKindAs(Object*) +

+ + +

ovirtual const char* className() const +
return the name of the object's class type. Must be defined +by derived classes. +

+ + +

ovirtual Object* readClone(Input& fr) +
Template Method/Prototype Pattern : create a clone and read +Object data from Input. Reads Input and if it matches this +objects className() then create a clone and match '{' brackets +and repeating calling Object::readLocalData() until the +matching ']' is read. +

+ + +

ovirtual bool write(Output& fw) +
Template Method Pattern : write out Object data to Output. +Sequence of output is className() followed by Open '{' +and then call Object::writeLocalData() and complete with '}'. +

+ + +

ovirtual ~Object() +
Object destructor. Note, is protected so that Objects cannot +be deleted other than by being derefernced and the reference +count being zero (see osg::Referenced), preventing the deletion +of nodes which are still in use. This also means that +Node's cannot be created on stack i.e Node node will not compile, +forcing all nodes to be created on the heap i.e Node* node += new Node(). +

+ + +

ovirtual bool readLocalData(Input&) +
Template Method Pattern : read local data from osg file. +Note should be implemented in derivied classes, which +call their parent class's readLocalData. Returns +true if the input iterator has been advanced, otherwise false. +

+ + +

ovirtual bool writeLocalData(Output&) +
Template Method Pattern : write local data to osg file. +Note should be implemented in derivied classes, which +call their parent class's writeLocalData. Returns +true if data has been written out, otherwise false. +

+
+
Direct child classes: +
Transparency
+Texture
+TexGen
+TexEnv
+PolygonOffset
+Point
+Node
+Matrix
+Material
+Light
+Image
+GeoState
+GeoSet
+Fog
+CullFace
+AlphaFunc
+
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/Output.html b/doc/osg/Output.html new file mode 100644 index 000000000..ba97977fc --- /dev/null +++ b/doc/osg/Output.html @@ -0,0 +1,211 @@ + + + class SG_EXPORT osg::Output + + + + +

class SG_EXPORT osg::Output: public ofstream

+
ofstream wrapper class for adding support for indenting.
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Methods

+[more] Output() +
+
+[more]virtual ~Output() +
+
+[more]Output& indent() +
+
+[more]int getIndentStep() const +
+
+[more]void setIndentStep(int step) +
+
+[more]int getIndent() const +
+
+[more]void setIndent(int indent) +
+
+[more]int getNumIndicesPerLine() const +
+
+[more]void setNumIndicesPerLine(int num) +
+
+[more]void moveIn() +
+
+[more]void moveOut() +
+
+[more]bool getUniqueIDForObject(Object* obj, std::string& uniqueID) +
+
+[more]bool createUniqueIDForObject(Object* obj, std::string& uniqueID) +
+
+[more]bool registerUniqueIDForObject(Object* obj, std::string& uniqueID) +
+

+ +

+

Protected Fields

+[more]int _indent +
+
+[more]int _indentStep +
+
+[more]int _numIndicesPerLine +
+
+[more]UniqueIDToLabelMapping _objectToUniqueIDMap +
+

+ +

+

Protected Methods

+[more] Output(const Output&) +
+
+[more]Output& operator = (const Output&) +
+
+[more]virtual void _init() +
+
+[more]virtual void _free() +
+

+ +

+

Protected

+[more]typedef std::map<Object*,std::string> UniqueIDToLabelMapping +
+

+ +
+ + +
+

Documentation

+
ofstream wrapper class for adding support for indenting. +Used in output of .osg ASCII files to improve their readability.
+
+ + + +
o Output() +

+ + +

ovirtual ~Output() +

+ + +

oOutput& indent() +

+ + +

oint getIndentStep() const +

+ + +

ovoid setIndentStep(int step) +

+ + +

oint getIndent() const +

+ + +

ovoid setIndent(int indent) +

+ + +

oint getNumIndicesPerLine() const +

+ + +

ovoid setNumIndicesPerLine(int num) +

+ + +

ovoid moveIn() +

+ + +

ovoid moveOut() +

+ + +

obool getUniqueIDForObject(Object* obj, std::string& uniqueID) +

+ + +

obool createUniqueIDForObject(Object* obj, std::string& uniqueID) +

+ + +

obool registerUniqueIDForObject(Object* obj, std::string& uniqueID) +

+ + +

o Output(const Output&) +

+ + +

oOutput& operator = (const Output&) +

+ + +

ovirtual void _init() +

+ + +

ovirtual void _free() +

+ + +

oint _indent +

+ + +

oint _indentStep +

+ + +

oint _numIndicesPerLine +

+ + +

otypedef std::map<Object*,std::string> UniqueIDToLabelMapping +

+ + +

oUniqueIDToLabelMapping _objectToUniqueIDMap +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/Point.html b/doc/osg/Point.html new file mode 100644 index 000000000..bae3b7d4d --- /dev/null +++ b/doc/osg/Point.html @@ -0,0 +1,199 @@ + + + class SG_EXPORT osg::Point + + + + +

class SG_EXPORT osg::Point: public Object

+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Methods

+[more] Point() +
+
+[more]static Point* instance() +
+
+[more]virtual Object* clone() const +
+
+[more]virtual bool isSameKindAs(Object* obj) +
+
+[more]virtual const char* className() const +
+
+[more]void setSize(float size) +
+
+[more]void setFadeThresholdSize(float fadeThresholdSize) +
+
+[more]void setDistanceAttenuation(const Vec3& distanceAttenuation) +
+
+[more]static void enableSmooth( void ) +
+
+[more]static void disableSmooth( void ) +
+
+[more]void apply( void ) +
+
+[more]static void init_GL_EXT() +
+

+ +

+

Protected Fields

+[more]float _size +
+
+[more]float _fadeThresholdSize +
+
+[more]Vec3 _distanceAttenuation +
+

+ +

+

Protected Methods

+[more]virtual ~Point() +
+
+[more]virtual bool readLocalData(Input& fr) +
+
+[more]virtual bool writeLocalData(Output& fw) +
+

+ +
+

Inherited from Object:

+
+

+

Public Methods

+ovirtual Object* readClone(Input& fr) +
+ovirtual bool write(Output& fw) +

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+oReferenced& operator = (Referenced&) +
+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _refCount +

+ +
+ + +
+

Documentation

+
+ + + +
o Point() +

+ + +

ostatic Point* instance() +

+ + +

ovirtual Object* clone() const +

+ + +

ovirtual bool isSameKindAs(Object* obj) +

+ + +

ovirtual const char* className() const +

+ + +

ovoid setSize(float size) +

+ + +

ovoid setFadeThresholdSize(float fadeThresholdSize) +

+ + +

ovoid setDistanceAttenuation(const Vec3& distanceAttenuation) +

+ + +

ostatic void enableSmooth( void ) +

+ + +

ostatic void disableSmooth( void ) +

+ + +

ovoid apply( void ) +

+ + +

ostatic void init_GL_EXT() +

+ + +

ovirtual ~Point() +

+ + +

ovirtual bool readLocalData(Input& fr) +

+ + +

ovirtual bool writeLocalData(Output& fw) +

+ + +

ofloat _size +

+ + +

ofloat _fadeThresholdSize +

+ + +

oVec3 _distanceAttenuation +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/PolygonOffset.html b/doc/osg/PolygonOffset.html new file mode 100644 index 000000000..25d5f2745 --- /dev/null +++ b/doc/osg/PolygonOffset.html @@ -0,0 +1,171 @@ + + + class SG_EXPORT osg::PolygonOffset + + + + +

class SG_EXPORT osg::PolygonOffset: public Object

+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Methods

+[more] PolygonOffset() +
+
+[more]static PolygonOffset* instance() +
+
+[more]virtual Object* clone() const +
+
+[more]virtual bool isSameKindAs(Object* obj) +
+
+[more]virtual const char* className() const +
+
+[more]void setOffset(float factor, float units) +
+
+[more]static void enable( void ) +
+
+[more]static void disable( void ) +
+
+[more]void apply( void ) +
+

+ +

+

Protected Fields

+[more]float _factor +
+
+[more]float _units +
+

+ +

+

Protected Methods

+[more]virtual ~PolygonOffset() +
+
+[more]virtual bool readLocalData(Input& fr) +
+
+[more]virtual bool writeLocalData(Output& fw) +
+

+ +
+

Inherited from Object:

+
+

+

Public Methods

+ovirtual Object* readClone(Input& fr) +
+ovirtual bool write(Output& fw) +

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+oReferenced& operator = (Referenced&) +
+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _refCount +

+ +
+ + +
+

Documentation

+
+ + + +
o PolygonOffset() +

+ + +

ostatic PolygonOffset* instance() +

+ + +

ovirtual Object* clone() const +

+ + +

ovirtual bool isSameKindAs(Object* obj) +

+ + +

ovirtual const char* className() const +

+ + +

ovoid setOffset(float factor, float units) +

+ + +

ostatic void enable( void ) +

+ + +

ostatic void disable( void ) +

+ + +

ovoid apply( void ) +

+ + +

ovirtual ~PolygonOffset() +

+ + +

ovirtual bool readLocalData(Input& fr) +

+ + +

ovirtual bool writeLocalData(Output& fw) +

+ + +

ofloat _factor +

+ + +

ofloat _units +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/Quat.html b/doc/osg/Quat.html new file mode 100644 index 000000000..96d906ac0 --- /dev/null +++ b/doc/osg/Quat.html @@ -0,0 +1,286 @@ + + + class SG_EXPORT osg::Quat + + + + +

class SG_EXPORT osg::Quat

+
A quaternion class.
+
+ +
+

+

Public Fields

+[more]Vec4 _fv +
+

+ +

+

Public Methods

+[more] Quat( void ) +
+
+[more] Quat( float x, float y, float z, float w ) +
+
+[more] Quat( const Vec4& vec ) +
+
+[more]inline Vec4 asVec4( void ) const +
+
+[more]inline Vec3 asVec3( void ) const +
+
+[more]inline Quat operator * (const float& rhs) const +
Multiply by scalar +
+[more]inline Quat& operator *= (const float& rhs) +
Unary multiply by scalar +
+[more]inline Quat operator*(const Quat& rhs) const +
Binary multiply +
+[more]inline Quat& operator*=(const Quat& rhs) +
Unary multiply +
+[more]inline Quat operator / (const float& rhs) const +
Divide by scalar +
+[more]inline Quat& operator /= (const float& rhs) +
Unary divide by scalar +
+[more]inline Quat operator/(const Quat& denom) const +
Binary divide +
+[more]inline Quat& operator/=(const Quat& denom) +
Unary divide +
+[more]inline Quat operator + (const Quat& rhs) const +
Binary addition +
+[more]inline Quat& operator += (const Quat& rhs) +
Unary addition +
+[more]inline Quat operator - (const Quat& rhs) const +
Binary subtraction +
+[more]inline Quat& operator -= (const Quat& rhs) +
Unary subtraction +
+[more]inline Quat operator - () const +
Negation operator - returns the negative of the quaternion. +
+[more]float length( void ) const +
Length of the quaternion = sqrt( vec . vec ) +
+[more]float length2( void ) const +
Length of the quaternion = vec . vec +
+[more]inline Quat conj( void ) const +
Conjugate +
+[more]inline Quat inverse( void ) const +
Multiplicative inverse method: q^(-1) = q^*/(q.q^*) +
+[more]void makeRot( const float angle, const float x, const float y, const float z ) +
+
+[more]void makeRot( const float angle, const Vec3& vec ) +
+
+[more]void makeRot( const Vec3& vec1, const Vec3& vec2 ) +
Make a rotation Quat which will rotate vec1 to vec2. +
+[more]void getRot( float& angle, float& x, float& y, float& z ) const +
Return the angle and vector components represented by the quaternion +
+[more]void getRot( float& angle, Vec3& vec ) const +
Return the angle and vector represented by the quaternion +
+[more]void slerp( const float t, const Quat& from, const Quat& to) +
Spherical Linear Interpolation. +
+[more]void set( const osg::Matrix& m ) +
Set quaternion to be equivalent to specified matrix +
+[more]void get( osg::Matrix& m ) const +
Get the equivalent matrix for this quaternion +
+[more]inline friend ostream& operator << (ostream& output, const Quat& vec) +
+

+ +
+ + +
+

Documentation

+
A quaternion class. It can be used to represent an orientation in 3D space.
+
+ + + +
oVec4 _fv +

+ + +

o Quat( void ) +

+ + +

o Quat( float x, float y, float z, float w ) +

+ + +

o Quat( const Vec4& vec ) +

+ + +

oinline Vec4 asVec4( void ) const +

+ + +

oinline Vec3 asVec3( void ) const +

+ + +

oinline Quat operator * (const float& rhs) const +
Multiply by scalar +

+ + +

oinline Quat& operator *= (const float& rhs) +
Unary multiply by scalar +

+ + +

oinline Quat operator*(const Quat& rhs) const +
Binary multiply +

+ + +

oinline Quat& operator*=(const Quat& rhs) +
Unary multiply +

+ + +

oinline Quat operator / (const float& rhs) const +
Divide by scalar +

+ + +

oinline Quat& operator /= (const float& rhs) +
Unary divide by scalar +

+ + +

oinline Quat operator/(const Quat& denom) const +
Binary divide +

+ + +

oinline Quat& operator/=(const Quat& denom) +
Unary divide +

+ + +

oinline Quat operator + (const Quat& rhs) const +
Binary addition +

+ + +

oinline Quat& operator += (const Quat& rhs) +
Unary addition +

+ + +

oinline Quat operator - (const Quat& rhs) const +
Binary subtraction +

+ + +

oinline Quat& operator -= (const Quat& rhs) +
Unary subtraction +

+ + +

oinline Quat operator - () const +
Negation operator - returns the negative of the quaternion. +Basically just calls operator - () on the Vec4 +

+ + +

ofloat length( void ) const +
Length of the quaternion = sqrt( vec . vec ) +

+ + +

ofloat length2( void ) const +
Length of the quaternion = vec . vec +

+ + +

oinline Quat conj( void ) const +
Conjugate +

+ + +

oinline Quat inverse( void ) const +
Multiplicative inverse method: q^(-1) = q^*/(q.q^*) +

+ + +

ovoid makeRot( const float angle, const float x, const float y, const float z ) +

+ + +

ovoid makeRot( const float angle, const Vec3& vec ) +

+ + +

ovoid makeRot( const Vec3& vec1, const Vec3& vec2 ) +
Make a rotation Quat which will rotate vec1 to vec2. +Generally take adot product to get the angle between these +and then use a cross product to get the rotation axis +Watch out for the two special cases of when the vectors +are co-incident or opposite in direction. +

+ + +

ovoid getRot( float& angle, float& x, float& y, float& z ) const +
Return the angle and vector components represented by the quaternion +

+ + +

ovoid getRot( float& angle, Vec3& vec ) const +
Return the angle and vector represented by the quaternion +

+ + +

ovoid slerp( const float t, const Quat& from, const Quat& to) +
Spherical Linear Interpolation. +As t goes from 0 to 1, the Quat object goes from "from" to "to". +

+ + +

ovoid set( const osg::Matrix& m ) +
Set quaternion to be equivalent to specified matrix +

+ + +

ovoid get( osg::Matrix& m ) const +
Get the equivalent matrix for this quaternion +

+ + +

oinline friend ostream& operator << (ostream& output, const Quat& vec) +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/RP.html b/doc/osg/RP.html new file mode 100644 index 000000000..1ffacc5d7 --- /dev/null +++ b/doc/osg/RP.html @@ -0,0 +1,86 @@ + + + template<class T> class osg::RP + + + + +

template<class T> class osg::RP

+
Smart pointer for handling referenced counted objects
+
+ +
+

+

Public Methods

+[more] RP(T* t=0) +
+
+[more] RP(const RP& rp) +
+
+[more] ~RP() +
+
+[more]RP& operator = (const RP& rp) +
+
+[more]T& operator*() const +
+
+[more]T* operator->() const +
+
+[more]bool operator!() const +
+
+[more]T* get() const +
+

+ +
+ + +
+

Documentation

+
Smart pointer for handling referenced counted objects
+
+ + + +
o RP(T* t=0) +

+ + +

o RP(const RP& rp) +

+ + +

o ~RP() +

+ + +

oRP& operator = (const RP& rp) +

+ + +

oT& operator*() const +

+ + +

oT* operator->() const +

+ + +

obool operator!() const +

+ + +

oT* get() const +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/ReaderWriter.html b/doc/osg/ReaderWriter.html new file mode 100644 index 000000000..39733c18e --- /dev/null +++ b/doc/osg/ReaderWriter.html @@ -0,0 +1,122 @@ + + + class SG_EXPORT osg::ReaderWriter + + + + +

class SG_EXPORT osg::ReaderWriter: public Referenced

+
pure virtual base class for reading and writing of non native formats.
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Methods

+[more]virtual ~ReaderWriter() +
+
+[more]virtual const char* className() +
+
+[more]virtual bool acceptsExtension(const std::string& ) +
+
+[more]virtual Object* readObject(const std::string& ) +
+
+[more]virtual Image* readImage(const std::string& ) +
+
+[more]virtual Node* readNode(const std::string& ) +
+
+[more]virtual bool writeObject(Object& , const std::string& ) +
+
+[more]virtual bool writeImage(Image& , const std::string& ) +
+
+[more]virtual bool writeNode(Node& , const std::string& ) +
+

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+oReferenced& operator = (Referenced&) +
+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _refCount +

+ +
+ + +
+

Documentation

+
pure virtual base class for reading and writing of non native formats.
+
+ + + +
ovirtual ~ReaderWriter() +

+ + +

ovirtual const char* className() +

+ + +

ovirtual bool acceptsExtension(const std::string& ) +

+ + +

ovirtual Object* readObject(const std::string& ) +

+ + +

ovirtual Image* readImage(const std::string& ) +

+ + +

ovirtual Node* readNode(const std::string& ) +

+ + +

ovirtual bool writeObject(Object& , const std::string& ) +

+ + +

ovirtual bool writeImage(Image& , const std::string& ) +

+ + +

ovirtual bool writeNode(Node& , const std::string& ) +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/Referenced.html b/doc/osg/Referenced.html new file mode 100644 index 000000000..e8e6f6352 --- /dev/null +++ b/doc/osg/Referenced.html @@ -0,0 +1,117 @@ + + + class osg::Referenced + + + + +

class osg::Referenced

+
Base class from providing referencing counted objects
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Methods

+[more] Referenced() +
+
+[more] Referenced(Referenced&) +
+
+[more]Referenced& operator = (Referenced&) +
+
+[more]void ref() +
increment the reference count by one, indicating that this object has another pointer which is referencing it +
+[more]void unref() +
decrement the reference count by one, indicating that a pointer to this object is referencing it. +
+[more]int referenceCount() +
return the number pointers currently referencing this object. +

+ +

+

Protected Fields

+[more]int _refCount +
+

+ +

+

Protected Methods

+[more]virtual ~Referenced() +
+

+ +
+ + +
+

Documentation

+
Base class from providing referencing counted objects
+
+ + + +
o Referenced() +

+ + +

o Referenced(Referenced&) +

+ + +

oReferenced& operator = (Referenced&) +

+ + +

ovoid ref() +
increment the reference count by one, indicating that +this object has another pointer which is referencing it +

+ + +

ovoid unref() +
decrement the reference count by one, indicating that +a pointer to this object is referencing it. If the +refence count goes to zero, it is assumed that this object +is nolonger referenced and is automatically deleted. +

+ + +

oint referenceCount() +
return the number pointers currently referencing this object. +

+ + +

ovirtual ~Referenced() +

+ + +

oint _refCount +

+
+
Direct child classes: +
Seg
+ReaderWriter
+Object
+NodeVisitor
+MemoryAdapter
+DynamicLibrary
+Camera
+
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/RegisterObjectProxy.html b/doc/osg/RegisterObjectProxy.html new file mode 100644 index 000000000..9ac642db6 --- /dev/null +++ b/doc/osg/RegisterObjectProxy.html @@ -0,0 +1,55 @@ + + + template<class T> class osg::RegisterObjectProxy + + + + +

template<class T> class osg::RegisterObjectProxy

+
Proxy class for automatic registration of reader/writers with the Registry
+
+ +
+

+

Public Methods

+[more] RegisterObjectProxy() +
+
+[more] ~RegisterObjectProxy() +
+

+ +

+

Protected Fields

+[more]T* _obj +
+

+ +
+ + +
+

Documentation

+
Proxy class for automatic registration of reader/writers with the +Registry
+
+ + + +
o RegisterObjectProxy() +

+ + +

o ~RegisterObjectProxy() +

+ + +

oT* _obj +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/RegisterReaderWriterProxy.html b/doc/osg/RegisterReaderWriterProxy.html new file mode 100644 index 000000000..a4920eec8 --- /dev/null +++ b/doc/osg/RegisterReaderWriterProxy.html @@ -0,0 +1,55 @@ + + + template<class T> class osg::RegisterReaderWriterProxy + + + + +

template<class T> class osg::RegisterReaderWriterProxy

+
Proxy class for automatic registration of reader/writers with the Registry
+
+ +
+

+

Public Methods

+[more] RegisterReaderWriterProxy() +
+
+[more] ~RegisterReaderWriterProxy() +
+

+ +

+

Protected Fields

+[more]T* _rw +
+

+ +
+ + +
+

Documentation

+
Proxy class for automatic registration of reader/writers with the +Registry
+
+ + + +
o RegisterReaderWriterProxy() +

+ + +

o ~RegisterReaderWriterProxy() +

+ + +

oT* _rw +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/Registry.html b/doc/osg/Registry.html new file mode 100644 index 000000000..8ac594abd --- /dev/null +++ b/doc/osg/Registry.html @@ -0,0 +1,175 @@ + + + class SG_EXPORT osg::Registry + + + + +

class SG_EXPORT osg::Registry

+
Registry is a singleton factory which stores the Objects types available at runtime for loading, and any Object reader or writers which are linked in at runtime for reading non-native file formats.
+
+ +
+

+

Public Methods

+[more] ~Registry() +
+
+[more]static Registry* instance() +
+
+[more]void addPrototype(Object* obj) +
+
+[more]void removePrototype(Object* obj) +
+
+[more]void addReaderWriter(ReaderWriter* rw) +
+
+[more]void removeReaderWriter(ReaderWriter* rw) +
+
+[more]std::string createLibraryNameForFile(const std::string& fileName) +
create the platform specific library name associated with file +
+[more]std::string createLibraryNameForExt(const std::string& ext) +
create the platform specific library name associated with file extension +
+[more]bool loadLibrary(const std::string& fileName) +
find the library in the SG_LIBRARY_PATH and load it +
+[more]bool closeLibrary(const std::string& fileName) +
close the attached library with specified name +
+[more]Object* readObject(Input& fr) +
+
+[more]Object* readObject(const std::string& fileName) +
+
+[more]bool writeObject(Object& obj, const std::string& fileName) +
+
+[more]Image* readImage(Input& fr) +
+
+[more]Image* readImage(const std::string& fileName) +
+
+[more]bool writeImage(Image& obj, const std::string& fileName) +
+
+[more]Node* readNode(Input& fr) +
+
+[more]Node* readNode(const std::string& fileName) +
+
+[more]bool writeNode(Node& node, const std::string& fileName) +
+

+ +
+ + +
+

Documentation

+
+Registry is a singleton factory which stores +the Objects types available at runtime for loading, +and any Object reader or writers which are linked in +at runtime for reading non-native file formats.

The RegisterObjectProxy defined in Object.h can be +used to automatically register at runtime a Object +with the Registry.

The RegisterReaderWriterProxy defined in ReaderWriter.h can +be used to automatically register at runtime a reader/writer +with the Registry.

+
+ + + +
o ~Registry() +

+ + +

ostatic Registry* instance() +

+ + +

ovoid addPrototype(Object* obj) +

+ + +

ovoid removePrototype(Object* obj) +

+ + +

ovoid addReaderWriter(ReaderWriter* rw) +

+ + +

ovoid removeReaderWriter(ReaderWriter* rw) +

+ + +

ostd::string createLibraryNameForFile(const std::string& fileName) +
create the platform specific library name associated with file +

+ + +

ostd::string createLibraryNameForExt(const std::string& ext) +
create the platform specific library name associated with file extension +

+ + +

obool loadLibrary(const std::string& fileName) +
find the library in the SG_LIBRARY_PATH and load it +

+ + +

obool closeLibrary(const std::string& fileName) +
close the attached library with specified name +

+ + +

oObject* readObject(Input& fr) +

+ + +

oObject* readObject(const std::string& fileName) +

+ + +

obool writeObject(Object& obj, const std::string& fileName) +

+ + +

oImage* readImage(Input& fr) +

+ + +

oImage* readImage(const std::string& fileName) +

+ + +

obool writeImage(Image& obj, const std::string& fileName) +

+ + +

oNode* readNode(Input& fr) +

+ + +

oNode* readNode(const std::string& fileName) +

+ + +

obool writeNode(Node& node, const std::string& fileName) +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/RenderVisitor.html b/doc/osg/RenderVisitor.html new file mode 100644 index 000000000..3ea30c1f8 --- /dev/null +++ b/doc/osg/RenderVisitor.html @@ -0,0 +1,497 @@ + + + class SG_EXPORT osg::RenderVisitor + + + + +

class SG_EXPORT osg::RenderVisitor: public NodeVisitor

+
Basic visitor for rendering a scene.
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Classes

+[more]enum TransparencySortMode +
+
+[more]enum CullingType +
+

+ +

+

Public Methods

+[more] RenderVisitor() +
+
+[more]virtual ~RenderVisitor() +
+
+[more]void reset() +
+
+[more]virtual void apply(Node&) +
+
+[more]virtual void apply(Geode& node) +
+
+[more]virtual void apply(Billboard& node) +
+
+[more]virtual void apply(Group& node) +
+
+[more]virtual void apply(DCS& node) +
+
+[more]virtual void apply(Switch& node) +
+
+[more]virtual void apply(LOD& node) +
+
+[more]virtual void apply(Scene& node) +
+
+[more]void setGlobalState(GeoState* global) +
+
+[more]void setPerspective(float fovy, float aspect, float znear, float zfar) +
+
+[more]void setLookAt(const Vec3& eye, const Vec3& center, const Vec3& upVector) +
+
+[more]void setLookAt(double eyeX, double eyeY, double eyeZ, double centerX, double centerY, double centerZ, double upX, double upY, double upZ) +
+
+[more]void setLODBias(float bias) +
+
+[more]float getLODBias() +
+
+[more]void setTransparencySortMode(TransparencySortMode tsm) +
+
+[more]void setCullingActive(CullingType ct, bool active) +
+
+[more]bool getCullingActive(CullingType ct) +
+
+[more]bool calcNearFar(double& near_plane, double& far_plane) +
+
+[more]void render() +
+

+ +

+

Protected Fields

+[more]bool _viewFrustumCullingActive +
+
+[more]bool _smallFeatureCullingActive +
+
+[more]ViewStateStack _viewStateStack +
+
+[more]ViewState* _tvs +
+
+[more]ViewState* _cvs +
+
+[more]OpaqueList _opaqueGeoSets +
+
+[more]TransparentList _transparentGeoSets +
+
+[more]GeoState* _globalState +
+
+[more]float _LODBias +
+
+[more]float _fovy +
+
+[more]float _aspect +
+
+[more]float _znear +
+
+[more]float _zfar +
+
+[more]Vec3 _frustumTop +
+
+[more]Vec3 _frustumBottom +
+
+[more]Vec3 _frustumLeft +
+
+[more]Vec3 _frustumRight +
+
+[more]TransparencySortMode _tsm +
+

+ +

+

Protected Methods

+[more]void pushMatrix(const Matrix& matrix) +
+
+[more]void popMatrix() +
+
+[more]Matrix* getCurrentMatrix() +
+
+[more]Matrix* getInverseCurrentMatrix() +
+
+[more]const Vec3& getEyeLocal() +
+
+[more]const Vec3& getCenterLocal() +
+
+[more]const Vec3& getLookVectorLocal() +
+
+[more]bool isCulled(const BoundingSphere& sp) +
+
+[more]bool isCulled(const BoundingBox& bb) +
+
+[more]void calculateClippingPlanes() +
+

+ +

+

Protected

+[more]typedef std::pair<Matrix*,GeoSet*> MatrixGeoSet +
+
+[more]typedef std::vector<ViewState*> ViewStateStack +
+
+[more]typedef std::multimap<GeoState*,MatrixGeoSet> OpaqueList +
+
+[more]typedef std::multimap<float,MatrixGeoSet> TransparentList +
+

+ +
+

Inherited from NodeVisitor:

+
+

+

Public Classes

+oenum TraversalMode +

+ +

+

Public Methods

+ovoid setTraverseMode(TraversalMode mode) +
+oTraversalMode getTraverseMode() +
+ovoid setTraverseVisitor(NodeVisitor* nv) +
+oNodeVisitor* getTraverseVisitor() +
+ovoid traverse(Node& node) +

+ +

+

Protected Fields

+oNodeVisitor* _traverseVisitor +
+oTraversalMode _traverseMode +

+ +
+ + +
+

Documentation

+
Basic visitor for rendering a scene. +The visitor traverses the scene graph, collecting transparent +and opaque osg::GeoSet's into a depth sorted transparent bin +and a state sorted opaque bin. The opaque bin is rendered first, +and then the transparent bin in rendered in order from the furthest +osg::GeoSet from the eye to the one nearest the eye.
+
+ + + +
o RenderVisitor() +

+ + +

ovirtual ~RenderVisitor() +

+ + +

ovoid reset() +

+ + +

ovirtual void apply(Node&) +

+ + +

ovirtual void apply(Geode& node) +

+ + +

ovirtual void apply(Billboard& node) +

+ + +

ovirtual void apply(Group& node) +

+ + +

ovirtual void apply(DCS& node) +

+ + +

ovirtual void apply(Switch& node) +

+ + +

ovirtual void apply(LOD& node) +

+ + +

ovirtual void apply(Scene& node) +

+ + +

ovoid setGlobalState(GeoState* global) +

+ + +

ovoid setPerspective(float fovy, float aspect, float znear, float zfar) +

+ + +

ovoid setLookAt(const Vec3& eye, const Vec3& center, const Vec3& upVector) +

+ + +

ovoid setLookAt(double eyeX, double eyeY, double eyeZ, double centerX, double centerY, double centerZ, double upX, double upY, double upZ) +

+ + +

ovoid setLODBias(float bias) +

+ + +

ofloat getLODBias() +

+ + +

oenum TransparencySortMode +

+ + + +
o LOOK_VECTOR_DISTANCE +

+ + +

o OBJECT_EYE_POINT_DISTANCE +

+ + + +
ovoid setTransparencySortMode(TransparencySortMode tsm) +

+ + +

oenum CullingType +

+ + + +
o VIEW_FRUSTUM_CULLING +

+ + +

o SMALL_FEATURE_CULLING +

+ + + +
ovoid setCullingActive(CullingType ct, bool active) +

+ + +

obool getCullingActive(CullingType ct) +

+ + +

obool calcNearFar(double& near_plane, double& far_plane) +

+ + +

ovoid render() +

+ + +

ovoid pushMatrix(const Matrix& matrix) +

+ + +

ovoid popMatrix() +

+ + +

oMatrix* getCurrentMatrix() +

+ + +

oMatrix* getInverseCurrentMatrix() +

+ + +

oconst Vec3& getEyeLocal() +

+ + +

oconst Vec3& getCenterLocal() +

+ + +

oconst Vec3& getLookVectorLocal() +

+ + +

obool _viewFrustumCullingActive +

+ + +

obool _smallFeatureCullingActive +

+ + +

obool isCulled(const BoundingSphere& sp) +

+ + +

obool isCulled(const BoundingBox& bb) +

+ + +

otypedef std::pair<Matrix*,GeoSet*> MatrixGeoSet +

+ + +

otypedef std::vector<ViewState*> ViewStateStack +

+ + +

oViewStateStack _viewStateStack +

+ + +

oViewState* _tvs +

+ + +

oViewState* _cvs +

+ + +

otypedef std::multimap<GeoState*,MatrixGeoSet> OpaqueList +

+ + +

otypedef std::multimap<float,MatrixGeoSet> TransparentList +

+ + +

oOpaqueList _opaqueGeoSets +

+ + +

oTransparentList _transparentGeoSets +

+ + +

oGeoState* _globalState +

+ + +

ofloat _LODBias +

+ + +

ofloat _fovy +

+ + +

ofloat _aspect +

+ + +

ofloat _znear +

+ + +

ofloat _zfar +

+ + +

ovoid calculateClippingPlanes() +

+ + +

oVec3 _frustumTop +

+ + +

oVec3 _frustumBottom +

+ + +

oVec3 _frustumLeft +

+ + +

oVec3 _frustumRight +

+ + +

oTransparencySortMode _tsm +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/Scene.html b/doc/osg/Scene.html new file mode 100644 index 000000000..a9864252f --- /dev/null +++ b/doc/osg/Scene.html @@ -0,0 +1,269 @@ + + + class SG_EXPORT osg::Scene + + + + +

class SG_EXPORT osg::Scene: public Group

+
The top level group node in a scene graph.
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Methods

+[more] Scene() +
+
+[more]virtual Object* clone() const +
+
+[more]virtual bool isSameKindAs(Object* obj) +
+
+[more]virtual const char* className() const +
+
+[more]virtual void accept(NodeVisitor& nv) +
+
+[more]void setGState(osg::GeoState* gstate) +
set the scene's GeoState +
+[more]osg::GeoState* getGState() +
return the scene's GeoState +

+ +

+

Protected Fields

+[more]osg::GeoState* _gstate +
+

+ +

+

Protected Methods

+[more]virtual ~Scene() +
+
+[more]virtual bool readLocalData(Input& fr) +
+
+[more]virtual bool writeLocalData(Output& fw) +
+

+ +
+

Inherited from Group:

+
+

+

Public Methods

+ovirtual void traverse(NodeVisitor& nv) +
+ovirtual bool addChild( Node *child ) +
+ovirtual bool removeChild( Node *child ) +
+ovirtual bool replaceChild( Node *origChild, Node* newChild ) +
+oint getNumChildren( void ) +
+oNode* getChild( int i ) +
+obool containsNode( Node* node ) +
+oChildList::iterator findNode( Node* node ) +

+ +

+

Public

+otypedef std::vector<ref_ptr<Node> > ChildList +

+ +

+

Protected Fields

+oChildList _children +

+ +

+

Protected Methods

+obool computeBound( void ) +

+ +
+

Inherited from Node:

+
+

+

Public Methods

+oNode* cloneNode() const +
+ovirtual void ascend(NodeVisitor& nv) +
+ovoid setName( const std::string& name ) +
+ovoid setName( const char* name ) +
+oconst std::string& getName( void ) +
+oconst ParentList& getParents() const +
+oGroup* getParent(int i) const +
+oint getNumParents() const +
+ovoid setUserData(void* data, MemoryAdapter* ma=0L) +
+ovoid* getUserData() const +
+oMemoryAdapter* getMemoryAdapter() const +
+ovoid setNodeMask(NodeMask nm) +
+oNodeMask getNodeMask() +
+oconst DescriptionList& getDescriptions() const +
+oDescriptionList& getDescriptions() +
+oconst std::string& getDescription(int i) const +
+ostd::string& getDescription(int i) +
+oint getNumDescriptions() const +
+ovoid addDescription(const std::string& desc) +
+oconst BoundingSphere& getBound() +
+ovoid dirtyBound() +

+ +

+

Public

+otypedef std::vector<Group*> ParentList +
+otypedef unsigned int NodeMask +
+otypedef std::vector<std::string> DescriptionList +

+ +

+

Protected Fields

+oBoundingSphere _bsphere +
+obool _bsphere_computed +
+ostd::string _name +
+oParentList _parents +
+ofriend Group +
+ovoid* _userData +
+oref_ptr<MemoryAdapter> _memoryAdapter +
+oNodeMask _nodeMask +
+oDescriptionList _descriptions +

+ +
+

Inherited from Object:

+
+

+

Public Methods

+ovirtual Object* readClone(Input& fr) +
+ovirtual bool write(Output& fw) +

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+oReferenced& operator = (Referenced&) +
+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _refCount +

+ +
+ + +
+

Documentation

+
The top level group node in a scene graph.
+
+ + + +
o Scene() +

+ + +

ovirtual Object* clone() const +

+ + +

ovirtual bool isSameKindAs(Object* obj) +

+ + +

ovirtual const char* className() const +

+ + +

ovirtual void accept(NodeVisitor& nv) +

+ + +

ovoid setGState(osg::GeoState* gstate) +
set the scene's GeoState +

+ + +

oosg::GeoState* getGState() +
return the scene's GeoState +

+ + +

ovirtual ~Scene() +

+ + +

ovirtual bool readLocalData(Input& fr) +

+ + +

ovirtual bool writeLocalData(Output& fw) +

+ + +

oosg::GeoState* _gstate +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/Seg.html b/doc/osg/Seg.html new file mode 100644 index 000000000..987558ac3 --- /dev/null +++ b/doc/osg/Seg.html @@ -0,0 +1,210 @@ + + + class SG_EXPORT osg::Seg + + + + +

class SG_EXPORT osg::Seg: public Referenced

+
Segment class for representing a line segment
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Methods

+[more] Seg() +
+
+[more] Seg(const Seg& seg) +
+
+[more] Seg(const Vec3& s, const Vec3& e) +
+
+[more]virtual ~Seg() +
+
+[more]Seg& operator = (const Seg& seg) +
+
+[more]void set(const Vec3& s, const Vec3& e) +
+
+[more]const Vec3& start() const +
+
+[more]Vec3& start() +
+
+[more]const Vec3& end() const +
+
+[more]Vec3& end() +
+
+[more]bool intersect(const BoundingBox& bb) const +
return true if segment intersects BoundingBox +
+[more]bool intersect(const BoundingBox& bb, float& r1, float& r2) const +
return true if segment intersects BoundingSphere and return the intersection ratio's +
+[more]bool intersect(const BoundingSphere& bs) const +
return true if segment intersects BoundingSphere +
+[more]bool intersect(const BoundingSphere& bs, float& r1, float& r2) const +
return true if segment intersects BoundingSphere and return the intersection ratio's +
+[more]bool intersect(const Vec3& v1, const Vec3& v2, const Vec3& v3, float& r) +
return true if segment intersects triangle and set ratio long segment. +
+[more]void mult(const Seg& seg, const Matrix& m) +
post multiply a segment by matrix +
+[more]void mult(const Matrix& m, const Seg& seg) +
pre multiply a segment by matrix +

+ +

+

Protected Fields

+[more]Vec3 _s +
+
+[more]Vec3 _e +
+

+ +

+

Protected Methods

+[more]static bool intersectAndClip(Vec3& s, Vec3& e, const BoundingBox& bb) +
+

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _refCount +

+ +
+ + +
+

Documentation

+
Segment class for representing a line segment
+
+ + + +
o Seg() +

+ + +

o Seg(const Seg& seg) +

+ + +

o Seg(const Vec3& s, const Vec3& e) +

+ + +

ovirtual ~Seg() +

+ + +

oSeg& operator = (const Seg& seg) +

+ + +

ovoid set(const Vec3& s, const Vec3& e) +

+ + +

oconst Vec3& start() const +

+ + +

oVec3& start() +

+ + +

oconst Vec3& end() const +

+ + +

oVec3& end() +

+ + +

obool intersect(const BoundingBox& bb) const +
return true if segment intersects BoundingBox +

+ + +

obool intersect(const BoundingBox& bb, float& r1, float& r2) const +
return true if segment intersects BoundingSphere and return the intersection ratio's +

+ + +

obool intersect(const BoundingSphere& bs) const +
return true if segment intersects BoundingSphere +

+ + +

obool intersect(const BoundingSphere& bs, float& r1, float& r2) const +
return true if segment intersects BoundingSphere and return the intersection ratio's +

+ + +

obool intersect(const Vec3& v1, const Vec3& v2, const Vec3& v3, float& r) +
return true if segment intersects triangle and set ratio long segment. +

+ + +

ovoid mult(const Seg& seg, const Matrix& m) +
post multiply a segment by matrix +

+ + +

ovoid mult(const Matrix& m, const Seg& seg) +
pre multiply a segment by matrix +

+ + +

ostatic bool intersectAndClip(Vec3& s, Vec3& e, const BoundingBox& bb) +

+ + +

oVec3 _s +

+ + +

oVec3 _e +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/Sequence.html b/doc/osg/Sequence.html new file mode 100644 index 000000000..6981869f2 --- /dev/null +++ b/doc/osg/Sequence.html @@ -0,0 +1,233 @@ + + + class SG_EXPORT osg::Sequence + + + + +

class SG_EXPORT osg::Sequence: public Group

+
Sequence - Switch node which allows iterators between children.
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Methods

+[more] Sequence() +
+
+[more]virtual Object* clone() const +
+
+[more]virtual bool isSameKindAs(Object* obj) +
+
+[more]virtual const char* className() const +
+
+[more]virtual void accept(NodeVisitor& nv) +
+

+ +

+

Protected Methods

+[more]virtual ~Sequence() +
+

+ +
+

Inherited from Group:

+
+

+

Public Methods

+ovirtual void traverse(NodeVisitor& nv) +
+ovirtual bool addChild( Node *child ) +
+ovirtual bool removeChild( Node *child ) +
+ovirtual bool replaceChild( Node *origChild, Node* newChild ) +
+oint getNumChildren( void ) +
+oNode* getChild( int i ) +
+obool containsNode( Node* node ) +
+oChildList::iterator findNode( Node* node ) +

+ +

+

Public

+otypedef std::vector<ref_ptr<Node> > ChildList +

+ +

+

Protected Fields

+oChildList _children +

+ +

+

Protected Methods

+ovirtual bool readLocalData(Input& fr) +
+ovirtual bool writeLocalData(Output& fw) +
+obool computeBound( void ) +

+ +
+

Inherited from Node:

+
+

+

Public Methods

+oNode* cloneNode() const +
+ovirtual void ascend(NodeVisitor& nv) +
+ovoid setName( const std::string& name ) +
+ovoid setName( const char* name ) +
+oconst std::string& getName( void ) +
+oconst ParentList& getParents() const +
+oGroup* getParent(int i) const +
+oint getNumParents() const +
+ovoid setUserData(void* data, MemoryAdapter* ma=0L) +
+ovoid* getUserData() const +
+oMemoryAdapter* getMemoryAdapter() const +
+ovoid setNodeMask(NodeMask nm) +
+oNodeMask getNodeMask() +
+oconst DescriptionList& getDescriptions() const +
+oDescriptionList& getDescriptions() +
+oconst std::string& getDescription(int i) const +
+ostd::string& getDescription(int i) +
+oint getNumDescriptions() const +
+ovoid addDescription(const std::string& desc) +
+oconst BoundingSphere& getBound() +
+ovoid dirtyBound() +

+ +

+

Public

+otypedef std::vector<Group*> ParentList +
+otypedef unsigned int NodeMask +
+otypedef std::vector<std::string> DescriptionList +

+ +

+

Protected Fields

+oBoundingSphere _bsphere +
+obool _bsphere_computed +
+ostd::string _name +
+oParentList _parents +
+ofriend Group +
+ovoid* _userData +
+oref_ptr<MemoryAdapter> _memoryAdapter +
+oNodeMask _nodeMask +
+oDescriptionList _descriptions +

+ +
+

Inherited from Object:

+
+

+

Public Methods

+ovirtual Object* readClone(Input& fr) +
+ovirtual bool write(Output& fw) +

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+oReferenced& operator = (Referenced&) +
+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _refCount +

+ +
+ + +
+

Documentation

+
Sequence - Switch node which allows iterators between children.

Note: has not been implemented yet!

+
+ + + +
o Sequence() +

+ + +

ovirtual Object* clone() const +

+ + +

ovirtual bool isSameKindAs(Object* obj) +

+ + +

ovirtual const char* className() const +

+ + +

ovirtual void accept(NodeVisitor& nv) +

+ + +

ovirtual ~Sequence() +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/State.html b/doc/osg/State.html new file mode 100644 index 000000000..b903a95a4 --- /dev/null +++ b/doc/osg/State.html @@ -0,0 +1,42 @@ + + + class SG_EXPORT osg::State + + + + +

class SG_EXPORT osg::State

+
+ +
+

+

Public Methods

+[more] State( void ) +
+
+[more] ~State( void ) +
+

+ +
+ + +
+

Documentation

+
+ + + +
o State( void ) +

+ + +

o ~State( void ) +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/Switch.html b/doc/osg/Switch.html new file mode 100644 index 000000000..73713b5b2 --- /dev/null +++ b/doc/osg/Switch.html @@ -0,0 +1,295 @@ + + + class SG_EXPORT osg::Switch + + + + +

class SG_EXPORT osg::Switch: public Group

+
Switch - Group node which allows switching between children.
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Classes

+[more]enum SwitchType +
+

+ +

+

Public Methods

+[more] Switch() +
+
+[more]virtual Object* clone() const +
+
+[more]virtual bool isSameKindAs(Object* obj) +
+
+[more]virtual const char* className() const +
+
+[more]virtual void accept(NodeVisitor& nv) +
+
+[more]virtual void traverse(NodeVisitor& nv) +
+
+[more]void setVal(int val) +
+
+[more]int getVal() const +
+

+ +

+

Protected Fields

+[more]int _value +
+

+ +

+

Protected Methods

+[more]virtual ~Switch() +
+
+[more]virtual bool readLocalData(Input& fr) +
+
+[more]virtual bool writeLocalData(Output& fw) +
+

+ +
+

Inherited from Group:

+
+

+

Public Methods

+ovirtual bool addChild( Node *child ) +
+ovirtual bool removeChild( Node *child ) +
+ovirtual bool replaceChild( Node *origChild, Node* newChild ) +
+oint getNumChildren( void ) +
+oNode* getChild( int i ) +
+obool containsNode( Node* node ) +
+oChildList::iterator findNode( Node* node ) +

+ +

+

Public

+otypedef std::vector<ref_ptr<Node> > ChildList +

+ +

+

Protected Fields

+oChildList _children +

+ +

+

Protected Methods

+obool computeBound( void ) +

+ +
+

Inherited from Node:

+
+

+

Public Methods

+oNode* cloneNode() const +
+ovirtual void ascend(NodeVisitor& nv) +
+ovoid setName( const std::string& name ) +
+ovoid setName( const char* name ) +
+oconst std::string& getName( void ) +
+oconst ParentList& getParents() const +
+oGroup* getParent(int i) const +
+oint getNumParents() const +
+ovoid setUserData(void* data, MemoryAdapter* ma=0L) +
+ovoid* getUserData() const +
+oMemoryAdapter* getMemoryAdapter() const +
+ovoid setNodeMask(NodeMask nm) +
+oNodeMask getNodeMask() +
+oconst DescriptionList& getDescriptions() const +
+oDescriptionList& getDescriptions() +
+oconst std::string& getDescription(int i) const +
+ostd::string& getDescription(int i) +
+oint getNumDescriptions() const +
+ovoid addDescription(const std::string& desc) +
+oconst BoundingSphere& getBound() +
+ovoid dirtyBound() +

+ +

+

Public

+otypedef std::vector<Group*> ParentList +
+otypedef unsigned int NodeMask +
+otypedef std::vector<std::string> DescriptionList +

+ +

+

Protected Fields

+oBoundingSphere _bsphere +
+obool _bsphere_computed +
+ostd::string _name +
+oParentList _parents +
+ofriend Group +
+ovoid* _userData +
+oref_ptr<MemoryAdapter> _memoryAdapter +
+oNodeMask _nodeMask +
+oDescriptionList _descriptions +

+ +
+

Inherited from Object:

+
+

+

Public Methods

+ovirtual Object* readClone(Input& fr) +
+ovirtual bool write(Output& fw) +

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+oReferenced& operator = (Referenced&) +
+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _refCount +

+ +
+ + +
+

Documentation

+
Switch - Group node which allows switching between children. +Typical uses would be for objects which might need to be rendered +differently at different times, for instance a switch could be used +to represent the different states of a traffic light.
+
+ + + +
oenum SwitchType +

+ + + +
o ALL_CHILDREN_ON +

+ + +

o ALL_CHILDREN_OFF +

+ + + +
o Switch() +

+ + +

ovirtual Object* clone() const +

+ + +

ovirtual bool isSameKindAs(Object* obj) +

+ + +

ovirtual const char* className() const +

+ + +

ovirtual void accept(NodeVisitor& nv) +

+ + +

ovirtual void traverse(NodeVisitor& nv) +

+ + +

ovoid setVal(int val) +

+ + +

oint getVal() const +

+ + +

ovirtual ~Switch() +

+ + +

ovirtual bool readLocalData(Input& fr) +

+ + +

ovirtual bool writeLocalData(Output& fw) +

+ + +

oint _value +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/TexEnv.html b/doc/osg/TexEnv.html new file mode 100644 index 000000000..735dc9736 --- /dev/null +++ b/doc/osg/TexEnv.html @@ -0,0 +1,188 @@ + + + class SG_EXPORT osg::TexEnv + + + + +

class SG_EXPORT osg::TexEnv: public Object

+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Classes

+[more]enum TexEnvMode +
+

+ +

+

Public Methods

+[more] TexEnv( void ) +
+
+[more]static TexEnv* instance() +
+
+[more]virtual Object* clone() const +
+
+[more]virtual bool isSameKindAs(Object* obj) +
+
+[more]virtual const char* className() const +
+
+[more]void setMode( TexEnvMode mode ) +
+
+[more]void apply( void ) +
+

+ +

+

Protected Fields

+[more]TexEnvMode _mode +
+

+ +

+

Protected Methods

+[more]virtual ~TexEnv( void ) +
+
+[more]virtual bool readLocalData(Input& fr) +
+
+[more]virtual bool writeLocalData(Output& fw) +
+
+[more]bool matchModeStr(const char* str, TexEnvMode& mode) +
+
+[more]const char* getModeStr(TexEnvMode mode) +
+

+ +
+

Inherited from Object:

+
+

+

Public Methods

+ovirtual Object* readClone(Input& fr) +
+ovirtual bool write(Output& fw) +

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+oReferenced& operator = (Referenced&) +
+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _refCount +

+ +
+ + +
+

Documentation

+
+ + + +
oenum TexEnvMode +

+ + + +
o DECAL +

+ + +

o MODULATE +

+ + +

o BLEND +

+ + + +
o TexEnv( void ) +

+ + +

ostatic TexEnv* instance() +

+ + +

ovirtual Object* clone() const +

+ + +

ovirtual bool isSameKindAs(Object* obj) +

+ + +

ovirtual const char* className() const +

+ + +

ovoid setMode( TexEnvMode mode ) +

+ + +

ovoid apply( void ) +

+ + +

ovirtual ~TexEnv( void ) +

+ + +

ovirtual bool readLocalData(Input& fr) +

+ + +

ovirtual bool writeLocalData(Output& fw) +

+ + +

obool matchModeStr(const char* str, TexEnvMode& mode) +

+ + +

oconst char* getModeStr(TexEnvMode mode) +

+ + +

oTexEnvMode _mode +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/TexGen.html b/doc/osg/TexGen.html new file mode 100644 index 000000000..e13040c80 --- /dev/null +++ b/doc/osg/TexGen.html @@ -0,0 +1,202 @@ + + + class SG_EXPORT osg::TexGen + + + + +

class SG_EXPORT osg::TexGen: public Object

+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Classes

+[more]enum TexGenMode +
+

+ +

+

Public Methods

+[more] TexGen( void ) +
+
+[more]static TexGen* instance() +
+
+[more]virtual Object* clone() const +
+
+[more]virtual bool isSameKindAs(Object* obj) +
+
+[more]virtual const char* className() const +
+
+[more]static void enable( void ) +
+
+[more]static void disable( void ) +
+
+[more]void apply( void ) +
+
+[more]void setMode( TexGenMode mode ) +
+

+ +

+

Protected Fields

+[more]TexGenMode _mode +
+

+ +

+

Protected Methods

+[more]virtual ~TexGen( void ) +
+
+[more]virtual bool readLocalData(Input& fr) +
+
+[more]virtual bool writeLocalData(Output& fw) +
+
+[more]bool matchModeStr(const char* str, TexGenMode& mode) +
+
+[more]const char* getModeStr(TexGenMode mode) +
+

+ +
+

Inherited from Object:

+
+

+

Public Methods

+ovirtual Object* readClone(Input& fr) +
+ovirtual bool write(Output& fw) +

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+oReferenced& operator = (Referenced&) +
+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _refCount +

+ +
+ + +
+

Documentation

+
+ + + +
oenum TexGenMode +

+ + + +
o OBJECT_LINEAR +

+ + +

o EYE_LINEAR +

+ + +

o SPHERE_MAP +

+ + + +
o TexGen( void ) +

+ + +

ostatic TexGen* instance() +

+ + +

ovirtual Object* clone() const +

+ + +

ovirtual bool isSameKindAs(Object* obj) +

+ + +

ovirtual const char* className() const +

+ + +

ostatic void enable( void ) +

+ + +

ostatic void disable( void ) +

+ + +

ovoid apply( void ) +

+ + +

ovoid setMode( TexGenMode mode ) +

+ + +

ovirtual ~TexGen( void ) +

+ + +

ovirtual bool readLocalData(Input& fr) +

+ + +

ovirtual bool writeLocalData(Output& fw) +

+ + +

obool matchModeStr(const char* str, TexGenMode& mode) +

+ + +

oconst char* getModeStr(TexGenMode mode) +

+ + +

oTexGenMode _mode +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/TexMat.html b/doc/osg/TexMat.html new file mode 100644 index 000000000..ef56cbd10 --- /dev/null +++ b/doc/osg/TexMat.html @@ -0,0 +1,193 @@ + + + class SG_EXPORT osg::TexMat + + + + +

class SG_EXPORT osg::TexMat: public Matrix

+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Methods

+[more] TexMat( void ) +
+
+[more]static TexMat* instance() +
+
+[more]virtual Object* clone() const +
+
+[more]virtual bool isSameKindAs(Object* obj) +
+
+[more]virtual const char* className() const +
+
+[more]void apply( void ) +
+

+ +

+

Protected Methods

+[more]virtual ~TexMat( void ) +
+

+ +
+

Inherited from Matrix:

+
+

+

Public Fields

+ofloat _mat[4][4] +

+ +

+

Public Methods

+oMatrix& operator = (const Matrix& matrix) +
+ovoid makeIdent() +
+ovoid set(const float* m) +
+ovoid copy(const Matrix& matrix) +
+ovoid makeScale(float sx, float sy, float sz) +
+ovoid preScale( float sx, float sy, float sz, const Matrix& m ) +
+ovoid postScale( const Matrix& m, float sx, float sy, float sz ) +
+ovoid preScale( float sx, float sy, float sz ) +
+ovoid postScale( float sx, float sy, float sz ) +
+ovoid makeTrans( float tx, float ty, float tz ) +
+ovoid preTrans( float tx, float ty, float tz, const Matrix& m ) +
+ovoid postTrans( const Matrix& m, float tx, float ty, float tz ) +
+ovoid preTrans( float tx, float ty, float tz ) +
+ovoid postTrans( float tx, float ty, float tz ) +
+ovoid makeRot( float deg, float x, float y, float z ) +
+ovoid preRot( float deg, float x, float y, float z, const Matrix& m ) +
+ovoid postRot( const Matrix& m, float deg, float x, float y, float z ) +
+ovoid preRot( float deg, float x, float y, float z ) +
+ovoid postRot( float deg, float x, float y, float z ) +
+ovoid setTrans( float tx, float ty, float tz ) +
+ovoid setTrans( const Vec3& v ) +
+oVec3 getTrans() const +
+ovoid preMult(const Matrix& m) +
+ovoid postMult(const Matrix& m) +
+ovoid mult(const Matrix& lhs, const Matrix& rhs) +
+oMatrix operator * (const Matrix& m) const +
+oinline Vec3 operator * (const Vec3& v) const +
+oinline friend Vec3 operator * (const Vec3& v, const Matrix& m) +
+obool invert(const Matrix& m) +

+ +

+

Protected Methods

+ovirtual bool readLocalData(Input& fr) +
+ovirtual bool writeLocalData(Output& fw) +

+ +
+

Inherited from Object:

+
+

+

Public Methods

+ovirtual Object* readClone(Input& fr) +
+ovirtual bool write(Output& fw) +

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _refCount +

+ +
+ + +
+

Documentation

+
+ + + +
o TexMat( void ) +

+ + +

ostatic TexMat* instance() +

+ + +

ovirtual Object* clone() const +

+ + +

ovirtual bool isSameKindAs(Object* obj) +

+ + +

ovirtual const char* className() const +

+ + +

ovoid apply( void ) +

+ + +

ovirtual ~TexMat( void ) +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/Texture.html b/doc/osg/Texture.html new file mode 100644 index 000000000..b311a9036 --- /dev/null +++ b/doc/osg/Texture.html @@ -0,0 +1,372 @@ + + + class SG_EXPORT osg::Texture + + + + +

class SG_EXPORT osg::Texture: public Object

+
Texture state class which encapsulates OpenGl texture functionality
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Classes

+[more]enum WrapParameter +
+
+[more]enum WrapMode +
+
+[more]enum FilterParameter +
+
+[more]enum FilterMode +
+

+ +

+

Public Methods

+[more] Texture() +
+
+[more]static Texture* instance() +
+
+[more]virtual Object* clone() const +
+
+[more]virtual bool isSameKindAs(Object* obj) +
+
+[more]virtual const char* className() const +
+
+[more]void setImage(Image* image) +
Set the texture image. +
+[more]Image* getImage() const +
Get the texture image. +
+[more]void setWrap(WrapParameter which, WrapMode wrap) +
Set the texture wrap mode +
+[more]WrapMode getWrap(WrapParameter which) const +
Get the texture wrap mode +
+[more]void setFilter(FilterParameter which, FilterMode filter) +
Set the texture filter mode +
+[more]FilterMode getFilter(FilterParameter which) const +
Get the texture filter mode +
+[more]static void enable( void ) +
Enable OpenGL texturing +
+[more]static void disable( void ) +
Disable OpenGL texturing +
+[more]void apply( void ) +
On first apply, create the minmapped texture and bind it, subsequent apply will simple bind to texture +

+ +

+

Protected Fields

+[more]uint _handle +
+
+[more]ref_ptr<Image> _image +
+
+[more]WrapMode _wrap_s +
+
+[more]WrapMode _wrap_t +
+
+[more]WrapMode _wrap_r +
+
+[more]FilterMode _min_filter +
+
+[more]FilterMode _mag_filter +
+

+ +

+

Protected Methods

+[more]virtual ~Texture() +
+
+[more]virtual bool readLocalData(Input& fr) +
+
+[more]virtual bool writeLocalData(Output& fw) +
+
+[more]bool matchWrapStr(const char* str, WrapMode& wrap) +
+
+[more]const char* getWrapStr(WrapMode wrap) +
+
+[more]bool matchFilterStr(const char* str, FilterMode& filter) +
+
+[more]const char* getFilterStr(FilterMode filter) +
+

+ +
+

Inherited from Object:

+
+

+

Public Methods

+ovirtual Object* readClone(Input& fr) +
+ovirtual bool write(Output& fw) +

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+oReferenced& operator = (Referenced&) +
+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _refCount +

+ +
+ + +
+

Documentation

+
Texture state class which encapsulates OpenGl texture functionality
+
+ + + +
o Texture() +

+ + +

ostatic Texture* instance() +

+ + +

ovirtual Object* clone() const +

+ + +

ovirtual bool isSameKindAs(Object* obj) +

+ + +

ovirtual const char* className() const +

+ + +

ovoid setImage(Image* image) +
Set the texture image. +

+ + +

oImage* getImage() const +
Get the texture image. +

+ + +

oenum WrapParameter +

+ + + +
o WRAP_S +

+ + +

o WRAP_T +

+ + +

o WRAP_R +

+ + + +
oenum WrapMode +

+ + + +
o CLAMP +

+ + +

o REPEAT +

+ + + +
ovoid setWrap(WrapParameter which, WrapMode wrap) +
Set the texture wrap mode +

+ + +

oWrapMode getWrap(WrapParameter which) const +
Get the texture wrap mode +

+ + +

oenum FilterParameter +

+ + + +
o MIN_FILTER +

+ + +

o MAG_FILTER +

+ + + +
oenum FilterMode +

+ + + +
o LINEAR +

+ + +

o LINEAR_MIPMAP_LINEAR +

+ + +

o LINEAR_MIPMAP_NEAREST +

+ + +

o NEAREST +

+ + +

o NEAREST_MIPMAP_LINEAR +

+ + +

o NEAREST_MIPMAP_NEAREST +

+ + + +
ovoid setFilter(FilterParameter which, FilterMode filter) +
Set the texture filter mode +

+ + +

oFilterMode getFilter(FilterParameter which) const +
Get the texture filter mode +

+ + +

ostatic void enable( void ) +
Enable OpenGL texturing +

+ + +

ostatic void disable( void ) +
Disable OpenGL texturing +

+ + +

ovoid apply( void ) +
On first apply, create the minmapped texture and bind it, +subsequent apply will simple bind to texture +

+ + +

ovirtual ~Texture() +

+ + +

ovirtual bool readLocalData(Input& fr) +

+ + +

ovirtual bool writeLocalData(Output& fw) +

+ + +

ouint _handle +

+ + +

oref_ptr<Image> _image +

+ + +

obool matchWrapStr(const char* str, WrapMode& wrap) +

+ + +

oconst char* getWrapStr(WrapMode wrap) +

+ + +

obool matchFilterStr(const char* str, FilterMode& filter) +

+ + +

oconst char* getFilterStr(FilterMode filter) +

+ + +

oWrapMode _wrap_s +

+ + +

oWrapMode _wrap_t +

+ + +

oWrapMode _wrap_r +

+ + +

oFilterMode _min_filter +

+ + +

oFilterMode _mag_filter +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/Timer.html b/doc/osg/Timer.html new file mode 100644 index 000000000..ef2641252 --- /dev/null +++ b/doc/osg/Timer.html @@ -0,0 +1,91 @@ + + + class SG_EXPORT osg::Timer + + + + +

class SG_EXPORT osg::Timer

+
+ +
+

+

Public Methods

+[more] Timer( void ) +
+
+[more] ~Timer( void ) +
+
+[more]inline Timer_t tick( void ) +
+
+[more]pragmaoptimize("", on)(x) (".byte 0x0f, 0x31" : "=A" (x))( void ) +
+
+[more]ifdefinline __sgi Timer_t tick( void ) +
+
+[more]double delta_s( Timer_t t1, Timer_t t2 ) +
+
+[more]double delta_m( Timer_t t1, Timer_t t2 ) +
+
+[more]Timer_t delta_u( Timer_t t1, Timer_t t2 ) +
+
+[more]Timer_t delta_n( Timer_t t1, Timer_t t2 ) +
+

+ +
+ + +
+

Documentation

+
+ + + +
o Timer( void ) +

+ + +

o ~Timer( void ) +

+ + +

oinline Timer_t tick( void ) +

+ + +

opragmaoptimize("", on)(x) (".byte 0x0f, 0x31" : "=A" (x))( void ) +

+ + +

oifdefinline __sgi Timer_t tick( void ) +

+ + +

odouble delta_s( Timer_t t1, Timer_t t2 ) +

+ + +

odouble delta_m( Timer_t t1, Timer_t t2 ) +

+ + +

oTimer_t delta_u( Timer_t t1, Timer_t t2 ) +

+ + +

oTimer_t delta_n( Timer_t t1, Timer_t t2 ) +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/Transparency.html b/doc/osg/Transparency.html new file mode 100644 index 000000000..76264c51e --- /dev/null +++ b/doc/osg/Transparency.html @@ -0,0 +1,220 @@ + + + class SG_EXPORT osg::Transparency + + + + +

class SG_EXPORT osg::Transparency: public Object

+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Classes

+[more]enum TransparencyMode +
+

+ +

+

Public Methods

+[more] Transparency() +
+
+[more]static Transparency* instance() +
+
+[more]virtual Object* clone() const +
+
+[more]virtual bool isSameKindAs(Object* obj) +
+
+[more]virtual const char* className() const +
+
+[more]void setFunction( int source, int destination ) +
+
+[more]static void enable( void ) +
+
+[more]static void disable( void ) +
+
+[more]void apply( void ) +
+

+ +

+

Protected Fields

+[more]int _source_factor +
+
+[more]int _destination_factor +
+

+ +

+

Protected Methods

+[more]virtual ~Transparency() +
+

+ +
+

Inherited from Object:

+
+

+

Public Methods

+ovirtual Object* readClone(Input& fr) +
+ovirtual bool write(Output& fw) +

+ +

+

Protected Methods

+ovirtual bool readLocalData(Input&) +
+ovirtual bool writeLocalData(Output&) +

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+oReferenced& operator = (Referenced&) +
+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _refCount +

+ +
+ + +
+

Documentation

+
+ + + +
oenum TransparencyMode +

+ + + +
o DST_ALPHA +

+ + +

o DST_COLOR +

+ + +

o ONE +

+ + +

o ONE_MINUS_DST_ALPHA +

+ + +

o ONE_MINUS_DST_COLOR +

+ + +

o ONE_MINUS_SRC_ALPHA +

+ + +

o ONE_MINUS_SRC_COLOR +

+ + +

o SRC_ALPHA +

+ + +

o SRC_ALPHA_SATURATE +

+ + +

o SRC_COLOR +

+ + +

o ZERO +

+ + + +
o Transparency() +

+ + +

ostatic Transparency* instance() +

+ + +

ovirtual Object* clone() const +

+ + +

ovirtual bool isSameKindAs(Object* obj) +

+ + +

ovirtual const char* className() const +

+ + +

ovoid setFunction( int source, int destination ) +

+ + +

ostatic void enable( void ) +

+ + +

ostatic void disable( void ) +

+ + +

ovoid apply( void ) +

+ + +

ovirtual ~Transparency() +

+ + +

oint _source_factor +

+ + +

oint _destination_factor +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/UnrefOp.html b/doc/osg/UnrefOp.html new file mode 100644 index 000000000..45cfb1019 --- /dev/null +++ b/doc/osg/UnrefOp.html @@ -0,0 +1,32 @@ + + + template<class T> struct osg::UnrefOp + + + + +

template<class T> struct osg::UnrefOp

+
Convience functor for unreferencing objects
+ +
+

+
+[more]void operator () (T* node) +
+

+ + + +
+

Documentation

+
Convience functor for unreferencing objects
+
+ + + +
ovoid operator () (T* node) +

+

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/Vec2.html b/doc/osg/Vec2.html new file mode 100644 index 000000000..159d6803c --- /dev/null +++ b/doc/osg/Vec2.html @@ -0,0 +1,241 @@ + + + class osg::Vec2 + + + + +

class osg::Vec2

+
General purpose float pair, uses include representation of texture coordinates.
+
+ +
+

+

Public Fields

+[more]float _v[2] +
+

+ +

+

Public Methods

+[more] Vec2() +
+
+[more] Vec2(float x, float y) +
+
+[more]bool operator == (const Vec2& v) const +
+
+[more]inline float* ptr() +
+
+[more]inline const float* ptr() const +
+
+[more]inline void set( float x, float y ) +
+
+[more]inline float& operator [] (int i) +
+
+[more]inline float operator [] (int i) const +
+
+[more]inline float& x() +
+
+[more]inline float& y() +
+
+[more]inline float x() const +
+
+[more]inline float y() const +
+
+[more]inline float operator * (const Vec2& rhs) const +
dot product +
+[more]inline Vec2 operator * (const float& rhs) const +
multiply by scalar +
+[more]inline Vec2& operator *= (const float& rhs) +
unary multiply by scalar +
+[more]inline Vec2 operator / (const float& rhs) const +
divide by scalar +
+[more]inline Vec2& operator /= (const float& rhs) +
unary divide by scalar +
+[more]inline Vec2 operator + (const Vec2& rhs) const +
binary vector add +
+[more]inline Vec2& operator += (const Vec2& rhs) +
unary vector add. +
+[more]inline Vec2 operator - (const Vec2& rhs) const +
binary vector subract +
+[more]inline Vec2& operator -= (const Vec2& rhs) +
unary vector subract +
+[more]inline Vec2 operator - () const +
negation operator. Returns the negative of the Vec2 +
+[more]inline float length() const +
Length of the vector = sqrt( vec . vec ) +
+[more]inline float length2( void ) const +
Length squared of the vector = vec . vec +
+[more]inline float normalize() +
normalize the vector so that it has length unity returns the previous length of the vector +
+[more]inline friend ostream& operator << (ostream& output, const Vec2& vec) +
+

+ +
+ + +
+

Documentation

+
General purpose float pair, uses include representation of +texture coordinates. +No support yet added for float * Vec2 - is it necessary? +Need to define a non-member non-friend operator* etc. +BTW: Vec2 * float is okay
+
+ + + +
o Vec2() +

+ + +

o Vec2(float x, float y) +

+ + +

ofloat _v[2] +

+ + +

obool operator == (const Vec2& v) const +

+ + +

oinline float* ptr() +

+ + +

oinline const float* ptr() const +

+ + +

oinline void set( float x, float y ) +

+ + +

oinline float& operator [] (int i) +

+ + +

oinline float operator [] (int i) const +

+ + +

oinline float& x() +

+ + +

oinline float& y() +

+ + +

oinline float x() const +

+ + +

oinline float y() const +

+ + +

oinline float operator * (const Vec2& rhs) const +
dot product +

+ + +

oinline Vec2 operator * (const float& rhs) const +
multiply by scalar +

+ + +

oinline Vec2& operator *= (const float& rhs) +
unary multiply by scalar +

+ + +

oinline Vec2 operator / (const float& rhs) const +
divide by scalar +

+ + +

oinline Vec2& operator /= (const float& rhs) +
unary divide by scalar +

+ + +

oinline Vec2 operator + (const Vec2& rhs) const +
binary vector add +

+ + +

oinline Vec2& operator += (const Vec2& rhs) +
unary vector add. Slightly more efficient because no temporary +intermediate object. +

+ + +

oinline Vec2 operator - (const Vec2& rhs) const +
binary vector subract +

+ + +

oinline Vec2& operator -= (const Vec2& rhs) +
unary vector subract +

+ + +

oinline Vec2 operator - () const +
negation operator. Returns the negative of the Vec2 +

+ + +

oinline float length() const +
Length of the vector = sqrt( vec . vec ) +

+ + +

oinline float length2( void ) const +
Length squared of the vector = vec . vec +

+ + +

oinline float normalize() +
normalize the vector so that it has length unity +returns the previous length of the vector +

+ + +

oinline friend ostream& operator << (ostream& output, const Vec2& vec) +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/Vec3.html b/doc/osg/Vec3.html new file mode 100644 index 000000000..f673f7f0d --- /dev/null +++ b/doc/osg/Vec3.html @@ -0,0 +1,263 @@ + + + class osg::Vec3 + + + + +

class osg::Vec3

+
General purpose float triple for use as vertices, vectors and normals.
+
+ +
+

+

Public Fields

+[more]float _v[3] +
+

+ +

+

Public Methods

+[more] Vec3() +
+
+[more] Vec3(float x, float y, float z) +
+
+[more]bool operator == (const Vec3& v) const +
+
+[more]inline float* ptr() +
+
+[more]inline const float* ptr() const +
+
+[more]inline void set( float x, float y, float z) +
+
+[more]inline float& operator [] (int i) +
+
+[more]inline float operator [] (int i) const +
+
+[more]inline float& x() +
+
+[more]inline float& y() +
+
+[more]inline float& z() +
+
+[more]inline float x() const +
+
+[more]inline float y() const +
+
+[more]inline float z() const +
+
+[more]inline float operator * (const Vec3& rhs) const +
dot product +
+[more]inline Vec3 operator ^ (const Vec3& rhs) const +
cross product +
+[more]inline Vec3 operator * (const float& rhs) const +
multiply by scalar +
+[more]inline Vec3& operator *= (const float& rhs) +
unary multiply by scalar +
+[more]inline Vec3 operator / (const float& rhs) const +
divide by scalar +
+[more]inline Vec3& operator /= (const float& rhs) +
unary divide by scalar +
+[more]inline Vec3 operator + (const Vec3& rhs) const +
binary vector add +
+[more]inline Vec3& operator += (const Vec3& rhs) +
unary vector add. +
+[more]inline Vec3 operator - (const Vec3& rhs) const +
binary vector subract +
+[more]inline Vec3& operator -= (const Vec3& rhs) +
unary vector subract +
+[more]inline Vec3 operator - () const +
negation operator. Returns the negative of the Vec3 +
+[more]inline float length( void ) const +
Length of the vector = sqrt( vec . vec ) +
+[more]inline float length2( void ) const +
Length squared of the vector = vec . vec +
+[more]inline float normalize() +
normalize the vector so that it has length unity returns the previous length of the vector +
+[more]inline friend ostream& operator << (ostream& output, const Vec3& vec) +
+

+ +
+ + +
+

Documentation

+
General purpose float triple for use as vertices, vectors and normals. +Provides general maths operations from addition through to cross products. +No support yet added for float * Vec3 - is it necessary? +Need to define a non-member non-friend operator* etc. +Vec3 * float is okay
+
+ + + +
o Vec3() +

+ + +

o Vec3(float x, float y, float z) +

+ + +

ofloat _v[3] +

+ + +

obool operator == (const Vec3& v) const +

+ + +

oinline float* ptr() +

+ + +

oinline const float* ptr() const +

+ + +

oinline void set( float x, float y, float z) +

+ + +

oinline float& operator [] (int i) +

+ + +

oinline float operator [] (int i) const +

+ + +

oinline float& x() +

+ + +

oinline float& y() +

+ + +

oinline float& z() +

+ + +

oinline float x() const +

+ + +

oinline float y() const +

+ + +

oinline float z() const +

+ + +

oinline float operator * (const Vec3& rhs) const +
dot product +

+ + +

oinline Vec3 operator ^ (const Vec3& rhs) const +
cross product +

+ + +

oinline Vec3 operator * (const float& rhs) const +
multiply by scalar +

+ + +

oinline Vec3& operator *= (const float& rhs) +
unary multiply by scalar +

+ + +

oinline Vec3 operator / (const float& rhs) const +
divide by scalar +

+ + +

oinline Vec3& operator /= (const float& rhs) +
unary divide by scalar +

+ + +

oinline Vec3 operator + (const Vec3& rhs) const +
binary vector add +

+ + +

oinline Vec3& operator += (const Vec3& rhs) +
unary vector add. Slightly more efficient because no temporary +intermediate object +

+ + +

oinline Vec3 operator - (const Vec3& rhs) const +
binary vector subract +

+ + +

oinline Vec3& operator -= (const Vec3& rhs) +
unary vector subract +

+ + +

oinline Vec3 operator - () const +
negation operator. Returns the negative of the Vec3 +

+ + +

oinline float length( void ) const +
Length of the vector = sqrt( vec . vec ) +

+ + +

oinline float length2( void ) const +
Length squared of the vector = vec . vec +

+ + +

oinline float normalize() +
normalize the vector so that it has length unity +returns the previous length of the vector +

+ + +

oinline friend ostream& operator << (ostream& output, const Vec3& vec) +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/Vec4.html b/doc/osg/Vec4.html new file mode 100644 index 000000000..f7582f4e6 --- /dev/null +++ b/doc/osg/Vec4.html @@ -0,0 +1,269 @@ + + + class osg::Vec4 + + + + +

class osg::Vec4

+
General purpose float quad, uses include representation of colour coordinates.
+
+ +
+

+

Public Fields

+[more]float _v[4] +
+

+ +

+

Public Methods

+[more] Vec4() +
+
+[more] Vec4(float x, float y, float z, float w) +
+
+[more]bool operator == (const Vec4& v) const +
+
+[more]inline float* ptr() +
+
+[more]inline const float* ptr() const +
+
+[more]inline void set( float x, float y, float z, float w) +
+
+[more]inline float& operator [] (int i) +
+
+[more]inline float operator [] (int i) const +
+
+[more]inline float& x() +
+
+[more]inline float& y() +
+
+[more]inline float& z() +
+
+[more]inline float& w() +
+
+[more]inline float x() const +
+
+[more]inline float y() const +
+
+[more]inline float z() const +
+
+[more]inline float w() const +
+
+[more]inline float operator * (const Vec4& rhs) const +
dot product +
+[more]inline Vec4 operator * (const float& rhs) const +
multiply by scalar +
+[more]inline Vec4& operator *= (const float& rhs) +
unary multiply by scalar +
+[more]inline Vec4 operator / (const float& rhs) const +
divide by scalar +
+[more]inline Vec4& operator /= (const float& rhs) +
unary divide by scalar +
+[more]inline Vec4 operator + (const Vec4& rhs) const +
binary vector add +
+[more]inline Vec4& operator += (const Vec4& rhs) +
unary vector add. +
+[more]inline Vec4 operator - (const Vec4& rhs) const +
binary vector subract +
+[more]inline Vec4& operator -= (const Vec4& rhs) +
unary vector subract +
+[more]inline Vec4 operator - () const +
negation operator. Returns the negative of the Vec4 +
+[more]inline float length( void ) const +
Length of the vector = sqrt( vec . vec ) +
+[more]inline float length2( void ) const +
Length squared of the vector = vec . vec +
+[more]inline float normalize() +
normalize the vector so that it has length unity returns the previous length of the vector +
+[more]inline friend ostream& operator << (ostream& output, const Vec4& vec) +
+

+ +
+ + +
+

Documentation

+
General purpose float quad, uses include representation +of colour coordinates. +No support yet added for float * Vec4 - is it necessary? +Need to define a non-member non-friend operator* etc. +Vec4 * float is okay
+
+ + + +
o Vec4() +

+ + +

o Vec4(float x, float y, float z, float w) +

+ + +

ofloat _v[4] +

+ + +

obool operator == (const Vec4& v) const +

+ + +

oinline float* ptr() +

+ + +

oinline const float* ptr() const +

+ + +

oinline void set( float x, float y, float z, float w) +

+ + +

oinline float& operator [] (int i) +

+ + +

oinline float operator [] (int i) const +

+ + +

oinline float& x() +

+ + +

oinline float& y() +

+ + +

oinline float& z() +

+ + +

oinline float& w() +

+ + +

oinline float x() const +

+ + +

oinline float y() const +

+ + +

oinline float z() const +

+ + +

oinline float w() const +

+ + +

oinline float operator * (const Vec4& rhs) const +
dot product +

+ + +

oinline Vec4 operator * (const float& rhs) const +
multiply by scalar +

+ + +

oinline Vec4& operator *= (const float& rhs) +
unary multiply by scalar +

+ + +

oinline Vec4 operator / (const float& rhs) const +
divide by scalar +

+ + +

oinline Vec4& operator /= (const float& rhs) +
unary divide by scalar +

+ + +

oinline Vec4 operator + (const Vec4& rhs) const +
binary vector add +

+ + +

oinline Vec4& operator += (const Vec4& rhs) +
unary vector add. Slightly more efficient because no temporary +intermediate object +

+ + +

oinline Vec4 operator - (const Vec4& rhs) const +
binary vector subract +

+ + +

oinline Vec4& operator -= (const Vec4& rhs) +
unary vector subract +

+ + +

oinline Vec4 operator - () const +
negation operator. Returns the negative of the Vec4 +

+ + +

oinline float length( void ) const +
Length of the vector = sqrt( vec . vec ) +

+ + +

oinline float length2( void ) const +
Length squared of the vector = vec . vec +

+ + +

oinline float normalize() +
normalize the vector so that it has length unity +returns the previous length of the vector +

+ + +

oinline friend ostream& operator << (ostream& output, const Vec4& vec) +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/ViewState.html b/doc/osg/ViewState.html new file mode 100644 index 000000000..00eff983f --- /dev/null +++ b/doc/osg/ViewState.html @@ -0,0 +1,185 @@ + + + class SG_EXPORT osg::ViewState + + + + +

class SG_EXPORT osg::ViewState: public Referenced

+
Container class for encapsulating the viewing state in local coordinates, during the cull traversal
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Fields

+[more]Matrix* _matrix +
+
+[more]Matrix* _inverse +
+
+[more]Vec3 _eyePoint +
+
+[more]Vec3 _centerPoint +
+
+[more]Vec3 _lookVector +
+
+[more]Vec3 _upVector +
+
+[more]Vec3 _frustumTopNormal +
+
+[more]Vec3 _frustumBottomNormal +
+
+[more]Vec3 _frustumLeftNormal +
+
+[more]Vec3 _frustumRightNormal +
+
+[more]float _ratio +
+
+[more]bool _viewFrustumCullingActive +
+
+[more]bool _smallFeatureCullingActive +
+

+ +

+

Public Methods

+[more] ViewState() +
+
+[more]bool isCulled(const BoundingSphere& sp) +
+
+[more]bool isCulled(const BoundingBox& bb) +
+

+ +

+

Protected Methods

+[more] ~ViewState() +
+

+ +
+

Inherited from Referenced:

+
+

+

Public Methods

+oReferenced& operator = (Referenced&) +
+ovoid ref() +
+ovoid unref() +
+oint referenceCount() +

+ +

+

Protected Fields

+oint _reference +

+ +
+ + +
+

Documentation

+
Container class for encapsulating the viewing state in local +coordinates, during the cull traversal
+
+ + + +
o ViewState() +

+ + +

oMatrix* _matrix +

+ + +

oMatrix* _inverse +

+ + +

oVec3 _eyePoint +

+ + +

oVec3 _centerPoint +

+ + +

oVec3 _lookVector +

+ + +

oVec3 _upVector +

+ + +

oVec3 _frustumTopNormal +

+ + +

oVec3 _frustumBottomNormal +

+ + +

oVec3 _frustumLeftNormal +

+ + +

oVec3 _frustumRightNormal +

+ + +

ofloat _ratio +

+ + +

obool _viewFrustumCullingActive +

+ + +

obool _smallFeatureCullingActive +

+ + +

obool isCulled(const BoundingSphere& sp) +

+ + +

obool isCulled(const BoundingBox& bb) +

+ + +

o ~ViewState() +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/createGeodeForImage.2.html b/doc/osg/createGeodeForImage.2.html new file mode 100644 index 000000000..44cc03f69 --- /dev/null +++ b/doc/osg/createGeodeForImage.2.html @@ -0,0 +1,21 @@ + + + SG_EXPORT extern Geode* osg::createGeodeForImage + + + + +

SG_EXPORT extern Geode* osg::createGeodeForImage(Image* image, float s, float t)

+
Convinience function to be used by images loaders to generate a valid geode to return for readNode().
+ + +
+

Documentation

+
Convinience function to be used by images loaders to generate a valid geode to return for readNode(). +Use the specified s and t values scale the dimensions of the image.
+
+
+

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/createGeodeForImage.html b/doc/osg/createGeodeForImage.html new file mode 100644 index 000000000..72753dc29 --- /dev/null +++ b/doc/osg/createGeodeForImage.html @@ -0,0 +1,21 @@ + + + SG_EXPORT extern Geode* osg::createGeodeForImage + + + + +

SG_EXPORT extern Geode* osg::createGeodeForImage(Image* image)

+
Convinience function to be used by images loaders to generate a valid geode to return for readNode().
+ + +
+

Documentation

+
Convinience function to be used by images loaders to generate a valid geode to return for readNode(). +Use the images s and t values scale the dimensions of the image.
+
+
+

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/for_each_triangle.html b/doc/osg/for_each_triangle.html new file mode 100644 index 000000000..442d78256 --- /dev/null +++ b/doc/osg/for_each_triangle.html @@ -0,0 +1,22 @@ + + + template<class T> void osg::for_each_triangle + + + + +

template<class T> void osg::for_each_triangle(GeoSet& gset, T& op)

+
Template function for iterating through a GeoSet operating on triangles with templated functor.
+ + +
+

Documentation

+
Template function for iterating through a GeoSet operating on triangles +with templated functor. Function automatically decomposes quads and polygons +into sub triangles which are passed onto functor.
+
+
+

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/icon1.gif b/doc/osg/icon1.gif new file mode 100644 index 000000000..f78f30eb9 Binary files /dev/null and b/doc/osg/icon1.gif differ diff --git a/doc/osg/icon2.gif b/doc/osg/icon2.gif new file mode 100644 index 000000000..6cbe01a83 Binary files /dev/null and b/doc/osg/icon2.gif differ diff --git a/doc/osg/index.html b/doc/osg/index.html new file mode 100644 index 000000000..3325ec1d5 --- /dev/null +++ b/doc/osg/index.html @@ -0,0 +1,109 @@ + + + Table of Contents + + + + +

Table of Contents

+

Namespaces

+ +

Functions

+
    +
  • osgGetLibraryName getLibraryName_osg() returns the library name in human friendly form +
  • osgGetVersion getVersion_osg() returns the library version number. +
+

Macros

+ +

Typedefs

+ +Hierarchy of classes


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/osg.html b/doc/osg/osg.html new file mode 100644 index 000000000..679e34a12 --- /dev/null +++ b/doc/osg/osg.html @@ -0,0 +1,453 @@ + + + namespace osg + + + + +

namespace osg

+ +
+

+
class SG_EXPORT AlphaFunc +
Encapsulte OpenGL glAlphaFunc +
class SG_EXPORT Billboard +
Billboard - a Geode which orientates its child osg::GeoSet's to face the eye point. +
class SG_EXPORT BoundingBox +
General purpose axis-aligned bounding box class for enclosing objects/vertices. +
class SG_EXPORT BoundingSphere +
General purpose bounding sphere class for enclosing nodes/objects/vertices. +
class SG_EXPORT Camera +
Camera class for encapsulating the view position and orientation. +
class SG_EXPORT CullFace +
Class to globally enable/disable OpenGL's polygon culling mode (GL_CULL_FACE) +
class SG_EXPORT DCS +
DCS - Dynamic Coordinate System a is group which all children are transformed by the the DCS's osg::Matrix. +
class SG_EXPORT DynamicLibrary +
DynamicLibrary - encapsulates the loading and unloading of dynamic libraries, typically used for loading ReaderWriter plug-ins +
SG_EXPORT extern bool ExtensionSupported +
return true if OpenGL "extension" is supported. +
class SG_EXPORT Field +
+
class SG_EXPORT FieldReader +
+
class SG_EXPORT FieldReaderIterator +
+
+[more]SG_EXPORT extern std::string getFilePath(const std::string& filename) +
+
+[more]SG_EXPORT extern std::string getFileExtension(const std::string& filename) +
+
+[more]SG_EXPORT extern std::string getLowerCaseFileExtension(const std::string& filename) +
+
+[more]SG_EXPORT extern std::string getSimpleFileName(const std::string& fileName) +
+
+[more]SG_EXPORT extern std::string getStrippedName(const std::string& fileName) +
+
class SG_EXPORT Fog +
Fog - encapsulates OpenGL fog state. +
class SG_EXPORT GeoSet +
Encapsulates OpenGL drawing primitives, geometry and optional binding of normal, color and texture coordinates. +
template<class T> void for_each_triangle +
Template function for iterating through a GeoSet operating on triangles with templated functor. +
class SG_EXPORT GeoState +
Encapsulates OpenGL state modes and attributes. +
class SG_EXPORT Geode +
Leaf Node for grouping GeoSets +
class SG_EXPORT Group +
General group node which maintains a list of children. +
class SG_EXPORT Image +
Image class for encapsulating the storage texture image data +
SG_EXPORT extern Geode* createGeodeForImage +
Convinience function to be used by images loaders to generate a valid geode to return for readNode(). +
SG_EXPORT extern Geode* createGeodeForImage +
Convinience function to be used by images loaders to generate a valid geode to return for readNode(). +
class SG_EXPORT Input +
Class for managing the reading of ASCII osg files +
class SG_EXPORT LOD +
LOD - Level Of Detail group node which allows switching between children depending on distance from eye point. +
class SG_EXPORT Light +
Light state class which encapsulates OpenGL glLight() functionality +
class SG_EXPORT LightSource +
Leaf Node for defining a light in the scene +
class SG_EXPORT Lighting +
Class to globally control OpenGL's lighting +
class SG_EXPORT Material +
+
class SG_EXPORT Matrix +
4x4 Matrix for storage & manipulation of transformations in scene graph. +
+[more]inline Vec3 Matrix::operator * (const Vec3& v) const +
+
+[more]inline Vec3 operator * (const Vec3& v, const Matrix& m) +
+
class SG_EXPORT MemoryAdapter +
Class for adapting the memory management of external data. +
class SG_EXPORT Node +
Base class for all internal nodes in the scene graph. +
typedef std::vector<Node*> NodePath +
A vector of Nodes pointers which is used to describe the path from a root node to a descendant +
class SG_EXPORT NodeVisitor +
Visitor for type safe operations on osg::Node's. +
struct NodeAcceptOp +
Convinience functor for assisting visiting of arrays of osg::Node's +
enum NotifySeverity +
+
+[more]extern NotifySeverity g_NotifyLevel +
+
+[more]extern ofstream* g_absorbStreamPtr +
+
+[more]SG_EXPORT extern void setNotifyLevel(NotifySeverity severity) +
+
+[more]SG_EXPORT extern int getNotifyLevel() +
+
+[more]inline ostream& notify(NotifySeverity severity=INFO) +
+
+[more]SG_EXPORT extern ostream& notify(NotifySeverity severity=INFO) +
+
class SG_EXPORT NotifyInit +
+
+[more]static NotifyInit niftyNotifyInit +
+
+[more]SG_EXPORT extern void Init( void ) +
+
+[more]SG_EXPORT extern void SetFilePath( const char *_path ) +
+
+[more]SG_EXPORT extern char* FindFile( const char *file ) +
+
+[more]SG_EXPORT extern char* findDSO( const char *name ) +
+
class SG_EXPORT Object +
Base class/standard interface for objects which require IO support, cloning and reference counting. +
class SG_EXPORT Output +
ofstream wrapper class for adding support for indenting. +
+[more]template<class T> bool writeArrayBlock(Output& fw, T* start, T* finish) +
+
class SG_EXPORT Point +
+
class SG_EXPORT PolygonOffset +
+
class SG_EXPORT Quat +
A quaternion class. +
template<class T> struct UnrefOp +
Convience functor for unreferencing objects +
template<class T> class ref_ptr +
Smart pointer for handling referenced counted objects +
class Referenced +
Base class from providing referencing counted objects +
+[more]SG_EXPORT extern Object* loadObjectFile(const char *name) +
+
+[more]SG_EXPORT extern Image* loadImageFile(const char *name) +
+
+[more]SG_EXPORT extern Node* loadNodeFile(const char *name) +
+
+[more]SG_EXPORT extern bool saveObjectFile(Object& object, const char *name) +
+
+[more]SG_EXPORT extern bool saveImageFile(Image& image, const char *name) +
+
+[more]SG_EXPORT extern bool saveNodeFile(Node& node, const char *name) +
+
class SG_EXPORT ReaderWriter +
pure virtual base class for reading and writing of non native formats. +
class SG_EXPORT Registry +
Registry is a singleton factory which stores the Objects types available at runtime for loading, and any Object reader or writers which are linked in at runtime for reading non-native file formats. +
template<class T> class RegisterObjectProxy +
Proxy class for automatic registration of reader/writers with the Registry +
template<class T> class RegisterReaderWriterProxy +
Proxy class for automatic registration of reader/writers with the Registry +
class SG_EXPORT Scene +
The top level group node in a scene graph. +
class SG_EXPORT Seg +
Segment class for representing a line segment +
class SG_EXPORT Sequence +
Sequence - Switch node which allows iterators between children. +
class SG_EXPORT State +
+
class SG_EXPORT Switch +
Switch - Group node which allows switching between children. +
class SG_EXPORT TexEnv +
+
class SG_EXPORT TexGen +
+
class SG_EXPORT TexMat +
+
class SG_EXPORT Texture +
Texture state class which encapsulates OpenGl texture functionality +
+[more]typedef __int64 Timer_t +
+
+[more]typedef unsigned long long Timer_t +
+
class SG_EXPORT Timer +
+
class SG_EXPORT Transparency +
+
+[more]typedef unsigned int uint +
+
+[more]typedef unsigned short ushort +
+
+[more]typedef unsigned char uchar +
+
+[more]typedef uchar ubyte +
+
+[more]#define M_E +
+
+[more]#define M_LOG2E +
+
+[more]#define M_LOG10E +
+
+[more]#define M_LN2 +
+
+[more]#define M_LN10 +
+
+[more]#define M_PI +
+
+[more]#define M_PI_2 +
+
+[more]#define M_PI_4 +
+
+[more]#define M_1_PI +
+
+[more]#define M_2_PI +
+
+[more]#define M_2_SQRTPI +
+
+[more]#define M_SQRT2 +
+
+[more]#define M_SQRT1_2 +
+
class Vec2 +
General purpose float pair, uses include representation of texture coordinates. +
class Vec3 +
General purpose float triple for use as vertices, vectors and normals. +
class Vec4 +
General purpose float quad, uses include representation of colour coordinates. +

+ + + +
+

Documentation

+
+ + + +
oSG_EXPORT extern std::string getFilePath(const std::string& filename) +

+ + +

oSG_EXPORT extern std::string getFileExtension(const std::string& filename) +

+ + +

oSG_EXPORT extern std::string getLowerCaseFileExtension(const std::string& filename) +

+ + +

oSG_EXPORT extern std::string getSimpleFileName(const std::string& fileName) +

+ + +

oSG_EXPORT extern std::string getStrippedName(const std::string& fileName) +

+ + +

oinline Vec3 Matrix::operator * (const Vec3& v) const +

+ + +

oinline Vec3 operator * (const Vec3& v, const Matrix& m) +

+ + +

oextern NotifySeverity g_NotifyLevel +

+ + +

oextern ofstream* g_absorbStreamPtr +

+ + +

oSG_EXPORT extern void setNotifyLevel(NotifySeverity severity) +

+ + +

oSG_EXPORT extern int getNotifyLevel() +

+ + +

oinline ostream& notify(NotifySeverity severity=INFO) +

+ + +

oSG_EXPORT extern ostream& notify(NotifySeverity severity=INFO) +

+ + +

ostatic NotifyInit niftyNotifyInit +

+ + +

oSG_EXPORT extern void Init( void ) +

+ + +

oSG_EXPORT extern void SetFilePath( const char *_path ) +

+ + +

oSG_EXPORT extern char* FindFile( const char *file ) +

+ + +

oSG_EXPORT extern char* findDSO( const char *name ) +

+ + +

otemplate<class T> bool writeArrayBlock(Output& fw, T* start, T* finish) +

+ + +

oSG_EXPORT extern Object* loadObjectFile(const char *name) +

+ + +

oSG_EXPORT extern Image* loadImageFile(const char *name) +

+ + +

oSG_EXPORT extern Node* loadNodeFile(const char *name) +

+ + +

oSG_EXPORT extern bool saveObjectFile(Object& object, const char *name) +

+ + +

oSG_EXPORT extern bool saveImageFile(Image& image, const char *name) +

+ + +

oSG_EXPORT extern bool saveNodeFile(Node& node, const char *name) +

+ + +

otypedef __int64 Timer_t +

+ + +

otypedef unsigned long long Timer_t +

+ + +

otypedef unsigned int uint +

+ + +

otypedef unsigned short ushort +

+ + +

otypedef unsigned char uchar +

+ + +

otypedef uchar ubyte +

+ + +

o#define M_E +

+ + +

o#define M_LOG2E +

+ + +

o#define M_LOG10E +

+ + +

o#define M_LN2 +

+ + +

o#define M_LN10 +

+ + +

o#define M_PI +

+ + +

o#define M_PI_2 +

+ + +

o#define M_PI_4 +

+ + +

o#define M_1_PI +

+ + +

o#define M_2_PI +

+ + +

o#define M_2_SQRTPI +

+ + +

o#define M_SQRT2 +

+ + +

o#define M_SQRT1_2 +

+

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/osgGetLibraryName.html b/doc/osg/osgGetLibraryName.html new file mode 100644 index 000000000..5711943e5 --- /dev/null +++ b/doc/osg/osgGetLibraryName.html @@ -0,0 +1,21 @@ + + + extern SG_EXPORT const char* osgGetLibraryName + + + + +

extern SG_EXPORT const char* osgGetLibraryName()

+
getLibraryName_osg() returns the library name in human friendly form
+ + +
+

Documentation

+
+getLibraryName_osg() returns the library name in human friendly form
+
+
+

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/osgGetVersion.html b/doc/osg/osgGetVersion.html new file mode 100644 index 000000000..834254472 --- /dev/null +++ b/doc/osg/osgGetVersion.html @@ -0,0 +1,30 @@ + + + extern SG_EXPORT const char* osgGetVersion + + + + +

extern SG_EXPORT const char* osgGetVersion()

+
getVersion_osg() returns the library version number.
+ + +
+

Documentation

+
+getVersion_osg() returns the library version number. +Numbering conventon : osg_src-0.8-31 will return 0.8.31 from getVersion_osg.

This C function can be also used to check for the existance of the OpenSceneGraph +library using autoconf and its m4 macro AC_CHECK_LIB.

Here is the code to add to your configure.in: +\verbatim +# +# Check for the OpenSceneGraph (OSG) library +# +AC_CHECK_LIB(osg, osgGetVersion, , +[AC_MSG_ERROR(OpenSceneGraph library not found. See http://www.openscenegraph.org)],) +\endverbatim

+
+
+

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osg/ref_ptr.html b/doc/osg/ref_ptr.html new file mode 100644 index 000000000..0ff65258b --- /dev/null +++ b/doc/osg/ref_ptr.html @@ -0,0 +1,135 @@ + + + template<class T> class osg::ref_ptr + + + + +

template<class T> class osg::ref_ptr

+
Smart pointer for handling referenced counted objects
+
+ +
+

+

Public Methods

+[more] ref_ptr() +
+
+[more] ref_ptr(T* t) +
+
+[more] ref_ptr(const ref_ptr& rp) +
+
+[more] ~ref_ptr() +
+
+[more]ref_ptr& operator = (const ref_ptr& rp) +
+
+[more]ref_ptr& operator = (T* ptr) +
+
+[more]bool operator == (const ref_ptr& rp) const +
+
+[more]bool operator == (const T* ptr) const +
+
+[more]bool operator != (const ref_ptr& rp) const +
+
+[more]bool operator != (const T* ptr) const +
+
+[more]T& operator*() const +
+
+[more]T* operator->() const +
+
+[more]bool operator!() const +
+
+[more]bool valid() const +
+
+[more]T* get() const +
+

+ +
+ + +
+

Documentation

+
Smart pointer for handling referenced counted objects
+
+ + + +
o ref_ptr() +

+ + +

o ref_ptr(T* t) +

+ + +

o ref_ptr(const ref_ptr& rp) +

+ + +

o ~ref_ptr() +

+ + +

oref_ptr& operator = (const ref_ptr& rp) +

+ + +

oref_ptr& operator = (T* ptr) +

+ + +

obool operator == (const ref_ptr& rp) const +

+ + +

obool operator == (const T* ptr) const +

+ + +

obool operator != (const ref_ptr& rp) const +

+ + +

obool operator != (const T* ptr) const +

+ + +

oT& operator*() const +

+ + +

oT* operator->() const +

+ + +

obool operator!() const +

+ + +

obool valid() const +

+ + +

oT* get() const +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osgGLUT/ClassGraph.class b/doc/osgGLUT/ClassGraph.class new file mode 100644 index 000000000..4f41a1fb2 Binary files /dev/null and b/doc/osgGLUT/ClassGraph.class differ diff --git a/doc/osgGLUT/ClassGraphPanel.class b/doc/osgGLUT/ClassGraphPanel.class new file mode 100644 index 000000000..4f3ea86bb Binary files /dev/null and b/doc/osgGLUT/ClassGraphPanel.class differ diff --git a/doc/osgGLUT/ClassLayout.class b/doc/osgGLUT/ClassLayout.class new file mode 100644 index 000000000..69a6f494e Binary files /dev/null and b/doc/osgGLUT/ClassLayout.class differ diff --git a/doc/osgGLUT/GLUTEventAdapter.html b/doc/osgGLUT/GLUTEventAdapter.html new file mode 100644 index 000000000..87329a088 --- /dev/null +++ b/doc/osgGLUT/GLUTEventAdapter.html @@ -0,0 +1,342 @@ + + + class OSGGLUT_EXPORT osgGLUT::GLUTEventAdapter + + + + +

class OSGGLUT_EXPORT osgGLUT::GLUTEventAdapter: public osgUtil::GUIEventAdapter

+
Class for adapting GLUT events so that they can be used as input to osgUtil::CameraManipulators
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Methods

+[more] GLUTEventAdapter() +
+
+[more]virtual ~GLUTEventAdapter() +
+
+[more]virtual EventType getEventType() const +
Get the EventType of the GUI event +
+[more]virtual int getKey() const +
key pressed, return -1 if inapropriate for this event. +
+[more]virtual int getButton() const +
button pressed/released, return -1 if inappropriate for this event +
+[more]virtual int getXmin() const +
window minimum x. +
+[more]virtual int getXmax() const +
window maximum x. +
+[more]virtual int getYmin() const +
window minimum y. +
+[more]virtual int getYmax() const +
window maximum y. +
+[more]virtual int getX() const +
current mouse x position +
+[more]virtual int getY() const +
current mouse y position +
+[more]virtual unsigned int getButtonMask() const +
current mouse button state +
+[more]virtual float time() const +
time in seconds of event. +
+[more]static void setWindowSize(int Xmin, int Ymin, int Xmax, int Ymax) +
static method for setting window dimensions +
+[more]static void setButtonMask(unsigned int buttonMask) +
static method for setting button state +
+[more]void adaptResize(float t, int Xmin, int Ymin, int Xmax, int Ymax) +
method for adapting resize events. +
+[more]void adaptMouseMotion(float t, int x, int y) +
method for adapting mouse motion events whilst mouse buttons are pressed +
+[more]void adaptMousePassiveMotion(float t, int x, int y) +
method for adapting mouse motion events whilst no mouse button are pressed +
+[more]void adaptMouse(float t, int button, int state, int x, int y) +
method for adapting mouse button pressed/released events +
+[more]void adaptKeyboard(float t, unsigned char key, int x, int y ) +
method for adapting keyboard events +
+[more]void adaptFrame(float t) +
method for adapting frame events, ie. +
+[more]void copyStaticVariables() +
+

+ +

+

Protected Fields

+[more]EventType _eventType +
+
+[more]int _key +
+
+[more]int _button +
+
+[more]int _Xmin +
+
+[more]int _Xmax +
+
+[more]int _Ymin +
+
+[more]int _Ymax +
+
+[more]int _mx +
+
+[more]int _my +
+
+[more]unsigned int _buttonMask +
+
+[more]float _time +
+
+[more]static unsigned int _s_accumulatedButtonMask +
+
+[more]static int _s_Xmin +
+
+[more]static int _s_Xmax +
+
+[more]static int _s_Ymin +
+
+[more]static int _s_Ymax +
+
+[more]static int _s_mx +
+
+[more]static int _s_my +
+

+ +
+ + +
+

Documentation

+
Class for adapting GLUT events so that they can be used as input to osgUtil::CameraManipulators
+
+ + + +
o GLUTEventAdapter() +

+ + +

ovirtual ~GLUTEventAdapter() +

+ + +

ovirtual EventType getEventType() const +
Get the EventType of the GUI event +

+ + +

ovirtual int getKey() const +
key pressed, return -1 if inapropriate for this event. +

+ + +

ovirtual int getButton() const +
button pressed/released, return -1 if inappropriate for this event +

+ + +

ovirtual int getXmin() const +
window minimum x. +

+ + +

ovirtual int getXmax() const +
window maximum x. +

+ + +

ovirtual int getYmin() const +
window minimum y. +

+ + +

ovirtual int getYmax() const +
window maximum y. +

+ + +

ovirtual int getX() const +
current mouse x position +

+ + +

ovirtual int getY() const +
current mouse y position +

+ + +

ovirtual unsigned int getButtonMask() const +
current mouse button state +

+ + +

ovirtual float time() const +
time in seconds of event. +

+ + +

ostatic void setWindowSize(int Xmin, int Ymin, int Xmax, int Ymax) +
static method for setting window dimensions +

+ + +

ostatic void setButtonMask(unsigned int buttonMask) +
static method for setting button state +

+ + +

ovoid adaptResize(float t, int Xmin, int Ymin, int Xmax, int Ymax) +
method for adapting resize events. +

+ + +

ovoid adaptMouseMotion(float t, int x, int y) +
method for adapting mouse motion events whilst mouse buttons are pressed +

+ + +

ovoid adaptMousePassiveMotion(float t, int x, int y) +
method for adapting mouse motion events whilst no mouse button are pressed +

+ + +

ovoid adaptMouse(float t, int button, int state, int x, int y) +
method for adapting mouse button pressed/released events +

+ + +

ovoid adaptKeyboard(float t, unsigned char key, int x, int y ) +
method for adapting keyboard events +

+ + +

ovoid adaptFrame(float t) +
method for adapting frame events, ie. iddle/display callback. +

+ + +

ovoid copyStaticVariables() +

+ + +

oEventType _eventType +

+ + +

oint _key +

+ + +

oint _button +

+ + +

oint _Xmin +

+ + +

oint _Xmax +

+ + +

oint _Ymin +

+ + +

oint _Ymax +

+ + +

oint _mx +

+ + +

oint _my +

+ + +

ounsigned int _buttonMask +

+ + +

ofloat _time +

+ + +

ostatic unsigned int _s_accumulatedButtonMask +

+ + +

ostatic int _s_Xmin +

+ + +

ostatic int _s_Xmax +

+ + +

ostatic int _s_Ymin +

+ + +

ostatic int _s_Ymax +

+ + +

ostatic int _s_mx +

+ + +

ostatic int _s_my +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osgGLUT/General.html b/doc/osgGLUT/General.html new file mode 100644 index 000000000..d39a8497c --- /dev/null +++ b/doc/osgGLUT/General.html @@ -0,0 +1,33 @@ + + + General Bits + + + + +
+
+ +o#define +OSGGLUT_EXPORT_
+
+ +o#define +OSGGLUT_EXPORT(dllexport)
+
+ +o#define +OSGGLUT_EXPORT(dllimport)
+
+ +o#define +OSGGLUT_GLUTEVENTADAPTER
+
+ +o#define +OSGGLUT_VIEWER
+
+Alphabetic index Hierarchy of classes


+
+This page was generated with the help of DOC++. + diff --git a/doc/osgGLUT/HIER.html b/doc/osgGLUT/HIER.html new file mode 100644 index 000000000..37921223b --- /dev/null +++ b/doc/osgGLUT/HIER.html @@ -0,0 +1,15 @@ + + + Hierarchy of Classes + + + +

Hierarchy of Classes

+ +Alphabetic index


+
+This page was generated with the help of DOC++. + diff --git a/doc/osgGLUT/HIERjava.html b/doc/osgGLUT/HIERjava.html new file mode 100644 index 000000000..8208ec829 --- /dev/null +++ b/doc/osgGLUT/HIERjava.html @@ -0,0 +1,27 @@ + + + Hierarchy of Classes + + + +

Hierarchy of classes

+
    + + + + + + + + + + + + + + +
+ alphabetic index


+
+This page was generated with the help of DOC++. + diff --git a/doc/osgGLUT/NavigatorButton.class b/doc/osgGLUT/NavigatorButton.class new file mode 100644 index 000000000..fad9c3f2d Binary files /dev/null and b/doc/osgGLUT/NavigatorButton.class differ diff --git a/doc/osgGLUT/Viewer.html b/doc/osgGLUT/Viewer.html new file mode 100644 index 000000000..08b0c128c --- /dev/null +++ b/doc/osgGLUT/Viewer.html @@ -0,0 +1,508 @@ + + + class OSGGLUT_EXPORT osgGLUT::Viewer + + + + +

class OSGGLUT_EXPORT osgGLUT::Viewer: public osgUtil::GUIActionAdapter

+
A basic viewer base class which provides a window, simple keyboard and mouse interaction.
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Methods

+[more] Viewer() +
+
+[more]virtual ~Viewer() +
+
+[more]virtual bool init( osg::Node* ) +
+
+[more]virtual bool run() +
+
+[more]virtual bool update() +
+
+[more]virtual bool traverse() +
+
+[more]virtual bool draw() +
+
+[more]long initClock() +
+
+[more]float clockSeconds() +
+
+[more]osg::Timer_t updateFrameTick() +
+
+[more]float frameSeconds() +
+
+[more]float frameRate() +
+
+[more]void help(ostream& fout) +
+
+[more]void registerCameraManipulator(osgUtil::CameraManipulator* cm) +
+
+[more]void selectCameraManipulator(unsigned int pos) +
+
+[more]virtual void needRedraw(bool ) +
+
+[more]virtual void needContinuousUpdate(bool ) +
+
+[more]virtual void needWarpPointer(int x, int y) +
+

+ +

+

Protected Fields

+[more]static Viewer* s_theViewer +
+
+[more]osg::ref_ptr<osgUtil::SceneView> _sceneView +
+
+[more]osg::ref_ptr<osgUtil::CameraManipulator> _cameraManipulator +
+
+[more]CameraManipList _cameraManipList +
+
+[more]std::string _saveFileName +
+
+[more]int ww +
+
+[more]int wh +
+
+[more]ifdef SGV_USE_RTFS unsigned int frame_rate +
+
+[more]RTfs* fs +
+
+[more]bool _viewFrustumCullingActive +
+
+[more]bool _smallFeatureCullingActive +
+
+[more]int mx +
+
+[more]int my +
+
+[more]int mbutton +
+
+[more]int polymode +
+
+[more]int texture +
+
+[more]int backface +
+
+[more]int lighting +
+
+[more]int flat_shade +
+
+[more]int _two_sided_lighting +
+
+[more]bool fullscreen +
+
+[more]int _saved_ww +
+
+[more]int _saved_wh +
+
+[more]bool _printStats +
+
+[more]bool _useDisplayLists +
+
+[more]osg::Timer _timer +
+
+[more]osg::Timer_t _tickRatePerSecond +
+
+[more]osg::Timer_t _initialTick +
+
+[more]osg::Timer_t _lastFrameTick +
+
+[more]osg::Timer_t _frameTick +
+

+ +

+

Protected Methods

+[more]static void displayCB() +
+
+[more]static void reshapeCB(GLint w, GLint h) +
+
+[more]static void visibilityCB(int state) +
+
+[more]static void mouseMotionCB(int x, int y) +
+
+[more]static void mousePassiveMotionCB(int x, int y) +
+
+[more]static void mouseCB(int button, int state, int x, int y) +
+
+[more]static void keyboardCB(unsigned char key, int x, int y ) +
+
+[more]virtual void display() +
+
+[more]virtual void reshape(GLint w, GLint h) +
+
+[more]virtual void visibility(int state) +
+
+[more]virtual void mouseMotion(int x, int y) +
+
+[more]virtual void mousePassiveMotion(int x, int y) +
+
+[more]virtual void mouse(int button, int state, int x, int y) +
+
+[more]virtual void keyboard(unsigned char key, int x, int y) +
+
+[more]osg::Timer_t clockTick() +
+
+[more]osg::Timer_t frameTick() +
+

+ +

+

Protected

+[more]typedef std::vector<osg::ref_ptr<osgUtil::CameraManipulator> > CameraManipList +
+

+ +
+ + +
+

Documentation

+
A basic viewer base class which provides a window, simple keyboard and mouse interaction. +Please note, this viewer class has been developed via a rather haphazzard +path and *needs* a total rewrite. It currently surfices for osg demo's +but shouldn't be viewed as the be all or end of osg viewer classes. +Someone please rewrite it :-)
+
+ + + +
o Viewer() +

+ + +

ovirtual ~Viewer() +

+ + +

ovirtual bool init( osg::Node* ) +

+ + +

ovirtual bool run() +

+ + +

ovirtual bool update() +

+ + +

ovirtual bool traverse() +

+ + +

ovirtual bool draw() +

+ + +

olong initClock() +

+ + +

ofloat clockSeconds() +

+ + +

oosg::Timer_t updateFrameTick() +

+ + +

ofloat frameSeconds() +

+ + +

ofloat frameRate() +

+ + +

ovoid help(ostream& fout) +

+ + +

ovoid registerCameraManipulator(osgUtil::CameraManipulator* cm) +

+ + +

ovoid selectCameraManipulator(unsigned int pos) +

+ + +

ovirtual void needRedraw(bool ) +

+ + +

ovirtual void needContinuousUpdate(bool ) +

+ + +

ovirtual void needWarpPointer(int x, int y) +

+ + +

ostatic void displayCB() +

+ + +

ostatic void reshapeCB(GLint w, GLint h) +

+ + +

ostatic void visibilityCB(int state) +

+ + +

ostatic void mouseMotionCB(int x, int y) +

+ + +

ostatic void mousePassiveMotionCB(int x, int y) +

+ + +

ostatic void mouseCB(int button, int state, int x, int y) +

+ + +

ostatic void keyboardCB(unsigned char key, int x, int y ) +

+ + +

ovirtual void display() +

+ + +

ovirtual void reshape(GLint w, GLint h) +

+ + +

ovirtual void visibility(int state) +

+ + +

ovirtual void mouseMotion(int x, int y) +

+ + +

ovirtual void mousePassiveMotion(int x, int y) +

+ + +

ovirtual void mouse(int button, int state, int x, int y) +

+ + +

ovirtual void keyboard(unsigned char key, int x, int y) +

+ + +

ostatic Viewer* s_theViewer +

+ + +

oosg::ref_ptr<osgUtil::SceneView> _sceneView +

+ + +

otypedef std::vector<osg::ref_ptr<osgUtil::CameraManipulator> > CameraManipList +

+ + +

oosg::ref_ptr<osgUtil::CameraManipulator> _cameraManipulator +

+ + +

oCameraManipList _cameraManipList +

+ + +

ostd::string _saveFileName +

+ + +

oint ww +

+ + +

oint wh +

+ + +

oifdef SGV_USE_RTFS unsigned int frame_rate +

+ + +

oRTfs* fs +

+ + +

obool _viewFrustumCullingActive +

+ + +

obool _smallFeatureCullingActive +

+ + +

oint mx +

+ + +

oint my +

+ + +

oint mbutton +

+ + +

oint polymode +

+ + +

oint texture +

+ + +

oint backface +

+ + +

oint lighting +

+ + +

oint flat_shade +

+ + +

oint _two_sided_lighting +

+ + +

obool fullscreen +

+ + +

oint _saved_ww +

+ + +

oint _saved_wh +

+ + +

obool _printStats +

+ + +

obool _useDisplayLists +

+ + +

oosg::Timer _timer +

+ + +

oosg::Timer_t _tickRatePerSecond +

+ + +

oosg::Timer_t _initialTick +

+ + +

oosg::Timer_t _lastFrameTick +

+ + +

oosg::Timer_t _frameTick +

+ + +

oosg::Timer_t clockTick() +

+ + +

oosg::Timer_t frameTick() +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osgGLUT/icon1.gif b/doc/osgGLUT/icon1.gif new file mode 100644 index 000000000..f78f30eb9 Binary files /dev/null and b/doc/osgGLUT/icon1.gif differ diff --git a/doc/osgGLUT/icon2.gif b/doc/osgGLUT/icon2.gif new file mode 100644 index 000000000..6cbe01a83 Binary files /dev/null and b/doc/osgGLUT/icon2.gif differ diff --git a/doc/osgGLUT/index.html b/doc/osgGLUT/index.html new file mode 100644 index 000000000..0f9b8303d --- /dev/null +++ b/doc/osgGLUT/index.html @@ -0,0 +1,27 @@ + + + Table of Contents + + + + +

Table of Contents

+

Namespaces

+ +

Macros

+ +Hierarchy of classes


+
+This page was generated with the help of DOC++. + diff --git a/doc/osgGLUT/osgGLUT.html b/doc/osgGLUT/osgGLUT.html new file mode 100644 index 000000000..4176e6894 --- /dev/null +++ b/doc/osgGLUT/osgGLUT.html @@ -0,0 +1,27 @@ + + + namespace osgGLUT + + + + +

namespace osgGLUT

+ +
+

+
class OSGGLUT_EXPORT GLUTEventAdapter +
Class for adapting GLUT events so that they can be used as input to osgUtil::CameraManipulators +
class OSGGLUT_EXPORT Viewer +
A basic viewer base class which provides a window, simple keyboard and mouse interaction. +

+ + + +
+

Documentation

+
+
+

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osgUtil/Camera.html b/doc/osgUtil/Camera.html new file mode 100644 index 000000000..ab80287f6 --- /dev/null +++ b/doc/osgUtil/Camera.html @@ -0,0 +1,144 @@ + + + class osgUtil::Camera + + + + +

class osgUtil::Camera: public osg::Referenced

+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Methods

+[more] Camera() +
+
+[more] ~Camera() +
+
+[more]void draw() const +
Renders the OpenGL to set the view +
+[more]void setView(osg::Vec3 eyePoint, osg::Vec3 lookPoint, osg::Vec3 upVector) +
Set the View, the up vector should be orthogonal to the look vector +
+[more]const osg::Vec3& getEyePoint() const +
get the eyepoint +
+[more]const osg::Vec3& getLookPoint() const +
get the lookpoint +
+[more]const osg::Vec3& getUpVector() const +
which way is up? +
+[more]void setNearPlane(double nearPlane) +
set the near plane +
+[more]double getNearPlane() const +
get the near plane +
+[more]void setFarPlane(double farPlane) +
set the far plane +
+[more]double getFarPlane() const +
get the far plane +
+[more]void home() +
hardwired home view for now, looking straight down the Z axis at the origin, with 'up' being the y axis +

+ +
+ + +
+

Documentation

+
+ + + +
o Camera() +

+ + +

o ~Camera() +

+ + +

ovoid draw() const +
+Renders the OpenGL to set the view +

+ + +

ovoid setView(osg::Vec3 eyePoint, osg::Vec3 lookPoint, osg::Vec3 upVector) +
+Set the View, the up vector should be orthogonal to the +look vector +

+ + +

oconst osg::Vec3& getEyePoint() const +
+get the eyepoint +

+ + +

oconst osg::Vec3& getLookPoint() const +
+get the lookpoint +

+ + +

oconst osg::Vec3& getUpVector() const +
+which way is up? +

+ + +

ovoid setNearPlane(double nearPlane) +
+set the near plane +

+ + +

odouble getNearPlane() const +
+get the near plane +

+ + +

ovoid setFarPlane(double farPlane) +
+set the far plane +

+ + +

odouble getFarPlane() const +
+get the far plane +

+ + +

ovoid home() +
+hardwired home view for now, looking straight down the +Z axis at the origin, with 'up' being the y axis +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osgUtil/CameraManipulator.html b/doc/osgUtil/CameraManipulator.html new file mode 100644 index 000000000..8387f41f8 --- /dev/null +++ b/doc/osgUtil/CameraManipulator.html @@ -0,0 +1,126 @@ + + + class OSGUTIL_EXPORT osgUtil::CameraManipulator + + + + +

class OSGUTIL_EXPORT osgUtil::CameraManipulator: public osg::Referenced

+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Methods

+[more] CameraManipulator() +
+
+[more]virtual ~CameraManipulator() +
+
+[more]virtual void setCamera(osg::Camera*) +
attach a camera to the manipulator to be used for specifying view +
+[more]virtual osg::Camera* getCamera() const +
get the attached a camera +
+[more]virtual void setNode(osg::Node*) +
Attach a node to the manipulator. +
+[more]virtual osg::Node* getNode() const +
Return node if attached +
+[more]virtual void home(GUIEventAdapter&, GUIActionAdapter&) +
Move the camera to the default position. +
+[more]virtual void init(GUIEventAdapter&, GUIActionAdapter&) +
Start/restart the manipulator +
+[more]virtual bool update(GUIEventAdapter& ea, GUIActionAdapter& us) +
Handle events, return true if handled, false otherwise +

+ +

+

Protected Fields

+[more]osg::ref_ptr<osg::Camera> _camera +
+

+ +
+ + +
+

Documentation

+
+ + + +
o CameraManipulator() +

+ + +

ovirtual ~CameraManipulator() +

+ + +

ovirtual void setCamera(osg::Camera*) +
attach a camera to the manipulator to be used for specifying view +

+ + +

ovirtual osg::Camera* getCamera() const +
get the attached a camera +

+ + +

ovirtual void setNode(osg::Node*) +
Attach a node to the manipulator. +Automatically detaches previously attached node. +setNode(NULL) detaches previously nodes. +Is ignored by manipulators which do not require a reference model. +

+ + +

ovirtual osg::Node* getNode() const +
Return node if attached +

+ + +

ovirtual void home(GUIEventAdapter&, GUIActionAdapter&) +
Move the camera to the default position. +May be ignored by manipulators if home functionality is not appropriate. +

+ + +

ovirtual void init(GUIEventAdapter&, GUIActionAdapter&) +
Start/restart the manipulator +

+ + +

ovirtual bool update(GUIEventAdapter& ea, GUIActionAdapter& us) +
Handle events, return true if handled, false otherwise +

+ + +

oosg::ref_ptr<osg::Camera> _camera +

+
+
Direct child classes: +
TrackballManipulator
+FlightManipulator
+DriveManipulator
+
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osgUtil/CameraTrackballManipulator.html b/doc/osgUtil/CameraTrackballManipulator.html new file mode 100644 index 000000000..32e416d83 --- /dev/null +++ b/doc/osgUtil/CameraTrackballManipulator.html @@ -0,0 +1,125 @@ + + + class OSGUTIL_EXPORT osgUtil::CameraTrackballManipulator + + + + +

class OSGUTIL_EXPORT osgUtil::CameraTrackballManipulator

+
+ +
+

+

Public Classes

+[more]enum MovementType +
+

+ +

+

Public Methods

+[more] CameraTrackballManipulator() +
+
+[more] ~CameraTrackballManipulator() +
+
+[more]void setCamera(osg::Camera *) +
+
+[more]osg::Camera* getCamera() const +
+
+[more]void initialise(int x, int y) +
initialise(int x,int y) will typically be called on a mouse down prior to a number of drag events. +
+[more]bool update(MovementType movementType, int x, int y) +
update(MovementType,int,int) will typically be called on receipt of drag events, with a view to letting the view change the view. +
+[more]void update() +
This will replicate any previous update, and is useful for animation +
+[more]MovementType getLastMovementType() const +
Returns last movementType, and is useful for updating on mouse up +

+ +
+ + +
+

Documentation

+
+ + + +
o CameraTrackballManipulator() +

+ + +

o ~CameraTrackballManipulator() +

+ + +

ovoid setCamera(osg::Camera *) +

+ + +

oosg::Camera* getCamera() const +

+ + +

ovoid initialise(int x, int y) +
+initialise(int x,int y) will typically be called on a +mouse down prior to a number of drag events. The parameters +tell the viewer where the mouse is at the start of the drag. +

+ + +

oenum MovementType +

+ + + +
o NONE +

+ + +

o ORBIT +

+ + +

o ZOOM +

+ + +

o PAN +

+ + + +
obool update(MovementType movementType, int x, int y) +
+update(MovementType,int,int) will typically be called on receipt of drag events, +with a view to letting the view change the view. The return value specifies whether +any change to the view was necessary as a result from the mouse event. Returns true +if any change in viewpoint is made. +

+ + +

ovoid update() +
+This will replicate any previous update, and is useful for animation +

+ + +

oMovementType getLastMovementType() const +
+Returns last movementType, and is useful for updating on mouse up +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osgUtil/CameraZSpindleManipulator.html b/doc/osgUtil/CameraZSpindleManipulator.html new file mode 100644 index 000000000..665b21052 --- /dev/null +++ b/doc/osgUtil/CameraZSpindleManipulator.html @@ -0,0 +1,125 @@ + + + class OSGUTIL_EXPORT osgUtil::CameraZSpindleManipulator + + + + +

class OSGUTIL_EXPORT osgUtil::CameraZSpindleManipulator

+
+ +
+

+

Public Classes

+[more]enum MovementType +
+

+ +

+

Public Methods

+[more] CameraZSpindleManipulator() +
+
+[more] ~CameraZSpindleManipulator() +
+
+[more]void setCamera(osg::Camera *) +
+
+[more]osg::Camera* getCamera() const +
+
+[more]void initialise(int x, int y) +
initialise(int x,int y) will typically be called on a mouse down prior to a number of drag events. +
+[more]bool update(MovementType movementType, int x, int y) +
update(MovementType,int,int) will typically be called on receipt of drag events, with a view to letting the view change the view. +
+[more]void update() +
This will replicate any previous update, and is useful for animation +
+[more]MovementType getLastMovementType() const +
Returns last movementType, and is useful for updating on mouse up +

+ +
+ + +
+

Documentation

+
+ + + +
o CameraZSpindleManipulator() +

+ + +

o ~CameraZSpindleManipulator() +

+ + +

ovoid setCamera(osg::Camera *) +

+ + +

oosg::Camera* getCamera() const +

+ + +

ovoid initialise(int x, int y) +
+initialise(int x,int y) will typically be called on a +mouse down prior to a number of drag events. The parameters +tell the viewer where the mouse is at the start of the drag. +

+ + +

oenum MovementType +

+ + + +
o NONE +

+ + +

o ORBIT +

+ + +

o ZOOM +

+ + +

o PAN +

+ + + +
obool update(MovementType movementType, int x, int y) +
+update(MovementType,int,int) will typically be called on receipt of drag events, +with a view to letting the view change the view. The return value specifies whether +any change to the view was necessary as a result from the mouse event. Returns true +if any change in viewpoint is made. +

+ + +

ovoid update() +
+This will replicate any previous update, and is useful for animation +

+ + +

oMovementType getLastMovementType() const +
+Returns last movementType, and is useful for updating on mouse up +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osgUtil/ClassGraph.class b/doc/osgUtil/ClassGraph.class new file mode 100644 index 000000000..4f41a1fb2 Binary files /dev/null and b/doc/osgUtil/ClassGraph.class differ diff --git a/doc/osgUtil/ClassGraphPanel.class b/doc/osgUtil/ClassGraphPanel.class new file mode 100644 index 000000000..4f3ea86bb Binary files /dev/null and b/doc/osgUtil/ClassGraphPanel.class differ diff --git a/doc/osgUtil/ClassLayout.class b/doc/osgUtil/ClassLayout.class new file mode 100644 index 000000000..69a6f494e Binary files /dev/null and b/doc/osgUtil/ClassLayout.class differ diff --git a/doc/osgUtil/CompileGeoSetsVisitor.html b/doc/osgUtil/CompileGeoSetsVisitor.html new file mode 100644 index 000000000..f5d8e4f83 --- /dev/null +++ b/doc/osgUtil/CompileGeoSetsVisitor.html @@ -0,0 +1,61 @@ + + + class OSGUTIL_EXPORT osgUtil::CompileGeoSetsVisitor + + + + +

class OSGUTIL_EXPORT osgUtil::CompileGeoSetsVisitor: public osg::NodeVisitor

+
Visitor for traversing scene compiling OpenGL Display list from osg::GeoSets
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Methods

+[more] CompileGeoSetsVisitor() +
+
+[more]virtual void apply(osg::Node& node) +
+
+[more]virtual void apply(osg::Geode& node) +
+

+ +
+ + +
+

Documentation

+
Visitor for traversing scene compiling OpenGL Display list from osg::GeoSets
+
+ + + +
o CompileGeoSetsVisitor() +

+ + +

ovirtual void apply(osg::Node& node) +

+ + +

ovirtual void apply(osg::Geode& node) +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osgUtil/DisplayListVisitor.html b/doc/osgUtil/DisplayListVisitor.html new file mode 100644 index 000000000..015caa27f --- /dev/null +++ b/doc/osgUtil/DisplayListVisitor.html @@ -0,0 +1,133 @@ + + + class OSGUTIL_EXPORT osgUtil::DisplayListVisitor + + + + +

class OSGUTIL_EXPORT osgUtil::DisplayListVisitor: public osg::NodeVisitor

+
Visitor for traversing scene set each osg::GeoSet's _useDisplayList flag, or immediately compiling osg::GeoSet's OpenGL Display lists.
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Classes

+[more]enum DisplayListMode +
Operation modes of the DisplayListVisitor +

+ +

+

Public Methods

+[more] DisplayListVisitor(DisplayListMode mode=SWITCH_ON_DISPLAY_LISTS) +
Construct a CompileGeoSetsVisior to traverse all child, with set specfied display list mode. +
+[more]void setDisplayListMode(DisplayListMode mode) +
Set the operational mode of how the visitor should set up osg::GeoSet's +
+[more]DisplayListMode getDisplayListMode() const +
Get the operational mode +
+[more]virtual void apply(osg::Node& node) +
Simply traverse using standard NodeVisitor traverse method +
+[more]virtual void apply(osg::Geode& node) +
For each Geode visited set the display list usage according to the _displayListMode +

+ +

+

Protected Fields

+[more]DisplayListMode _displayListMode +
+

+ +
+ + +
+

Documentation

+
Visitor for traversing scene set each osg::GeoSet's _useDisplayList flag, or +immediately compiling osg::GeoSet's OpenGL Display lists. The mode of operation +of the vistor is controlled by setting the DisplayListMode either on visitor +constructor or via the setDisplayListMode() method. DisplayListMode options are: +_displayListMode == SWITCH_ON_AND_COMPILE_DISPLAY_LISTS cals gset->compile() on +all Geode childern. Note, the visitor must only be used within a valid +OpenGL context as compile uses OpenGL calls. +_displayListMode == SWITCH_ON_DISPLAY_LISTS sets the Geode's children with +gset->setUseDisplayList(true), this method does not directly create display list, +or uses OpenGL calls so if safe to use before a valid OpenGL context has been set up. +On the next redraw of the scene, the gset's draw methods will be called +which then will respond to their _useDisplayList being set by creating display lists +automatically. +_displayListMode == SWITCH_OFF_DISPLAY_LISTS sets the Geode's children with +gset->setUseDisplayList(false), this method does not directly create display list, +or uses OpenGL calls so if safe to use before a valid OpenGL context has been set up.
+
+ + + +
oenum DisplayListMode +
Operation modes of the DisplayListVisitor +

+ + + +
o SWITCH_ON_AND_COMPILE_DISPLAY_LISTS +

+ + +

o SWITCH_ON_DISPLAY_LISTS +

+ + +

o SWITCH_OFF_DISPLAY_LISTS +

+ + + +
o DisplayListVisitor(DisplayListMode mode=SWITCH_ON_DISPLAY_LISTS) +
Construct a CompileGeoSetsVisior to traverse all child, +with set specfied display list mode. Default mode is to +gset->setUseDisplayList(true). +

+ + +

ovoid setDisplayListMode(DisplayListMode mode) +
Set the operational mode of how the visitor should set up osg::GeoSet's +

+ + +

oDisplayListMode getDisplayListMode() const +
Get the operational mode +

+ + +

ovirtual void apply(osg::Node& node) +
Simply traverse using standard NodeVisitor traverse method +

+ + +

ovirtual void apply(osg::Geode& node) +
For each Geode visited set the display list usage according to the +_displayListMode +

+ + +

oDisplayListMode _displayListMode +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osgUtil/DriveManipulator.html b/doc/osgUtil/DriveManipulator.html new file mode 100644 index 000000000..89c100523 --- /dev/null +++ b/doc/osgUtil/DriveManipulator.html @@ -0,0 +1,121 @@ + + + class OSGUTIL_EXPORT osgUtil::DriveManipulator + + + + +

class OSGUTIL_EXPORT osgUtil::DriveManipulator: public CameraManipulator

+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Methods

+[more] DriveManipulator() +
+
+[more]virtual ~DriveManipulator() +
+
+[more]virtual void setNode(osg::Node*) +
Attach a node to the manipulator. +
+[more]virtual osg::Node* getNode() const +
Return node if attached +
+[more]virtual void home(GUIEventAdapter& ea, GUIActionAdapter& us) +
Move the camera to the default position. +
+[more]virtual void init(GUIEventAdapter& ea, GUIActionAdapter& us) +
Start/restart the manipulator +
+[more]virtual bool update(GUIEventAdapter& ea, GUIActionAdapter& us) +
handle events, return true if handled, false otherwise +

+ +
+

Inherited from CameraManipulator:

+
+

+

Public Methods

+ovirtual void setCamera(osg::Camera*) +
+ovirtual osg::Camera* getCamera() const +

+ +

+

Protected Fields

+oosg::ref_ptr<osg::Camera> _camera +

+ +
+ + +
+

Documentation

+
+ + + +
o DriveManipulator() +

+ + +

ovirtual ~DriveManipulator() +

+ + +

ovirtual void setNode(osg::Node*) +
Attach a node to the manipulator. +Automatically detaches previously attached node. +setNode(NULL) detaches previously nodes. +Is ignored by manipulators which do not require a reference model. +

+ + +

ovirtual osg::Node* getNode() const +
Return node if attached +

+ + +

ovirtual void home(GUIEventAdapter& ea, GUIActionAdapter& us) +
Move the camera to the default position. +May be ignored by manipulators if home functionality is not appropriate. +

+ + +

ovirtual void init(GUIEventAdapter& ea, GUIActionAdapter& us) +
Start/restart the manipulator +

+ + +

ovirtual bool update(GUIEventAdapter& ea, GUIActionAdapter& us) +
handle events, return true if handled, false otherwise +

+ + + +
o USE_MOUSE_Y_FOR_SPEED +

+ + +

o USE_MOUSE_BUTTONS_FOR_SPEED +

+
+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osgUtil/FlightManipulator.html b/doc/osgUtil/FlightManipulator.html new file mode 100644 index 000000000..454294db9 --- /dev/null +++ b/doc/osgUtil/FlightManipulator.html @@ -0,0 +1,139 @@ + + + class OSGUTIL_EXPORT osgUtil::FlightManipulator + + + + +

class OSGUTIL_EXPORT osgUtil::FlightManipulator: public CameraManipulator

+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Classes

+[more]enum YawControlMode +
+

+ +

+

Public Methods

+[more] FlightManipulator() +
+
+[more]virtual ~FlightManipulator() +
+
+[more]virtual void setNode(osg::Node*) +
Attach a node to the manipulator. +
+[more]virtual osg::Node* getNode() const +
Return node if attached +
+[more]virtual void home(GUIEventAdapter& ea, GUIActionAdapter& us) +
Move the camera to the default position. +
+[more]virtual void init(GUIEventAdapter& ea, GUIActionAdapter& us) +
Start/restart the manipulator +
+[more]virtual bool update(GUIEventAdapter& ea, GUIActionAdapter& us) +
handle events, return true if handled, false otherwise +
+[more]void setYawControlMode(YawControlMode ycm) +
Set the yaw control between no yaw and yawing when banked +

+ +
+

Inherited from CameraManipulator:

+
+

+

Public Methods

+ovirtual void setCamera(osg::Camera*) +
+ovirtual osg::Camera* getCamera() const +

+ +

+

Protected Fields

+oosg::ref_ptr<osg::Camera> _camera +

+ +
+ + +
+

Documentation

+
+ + + +
o FlightManipulator() +

+ + +

ovirtual ~FlightManipulator() +

+ + +

ovirtual void setNode(osg::Node*) +
Attach a node to the manipulator. +Automatically detaches previously attached node. +setNode(NULL) detaches previously nodes. +Is ignored by manipulators which do not require a reference model. +

+ + +

ovirtual osg::Node* getNode() const +
Return node if attached +

+ + +

ovirtual void home(GUIEventAdapter& ea, GUIActionAdapter& us) +
Move the camera to the default position. +May be ignored by manipulators if home functionality is not appropriate. +

+ + +

ovirtual void init(GUIEventAdapter& ea, GUIActionAdapter& us) +
Start/restart the manipulator +

+ + +

ovirtual bool update(GUIEventAdapter& ea, GUIActionAdapter& us) +
handle events, return true if handled, false otherwise +

+ + +

oenum YawControlMode +

+ + + +
o YAW_AUTOMATICALLY_WHEN_BANKED +

+ + +

o NO_AUTOMATIC_YAW +

+ + + +
ovoid setYawControlMode(YawControlMode ycm) +
Set the yaw control between no yaw and yawing when banked +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osgUtil/GUIActionAdapter.html b/doc/osgUtil/GUIActionAdapter.html new file mode 100644 index 000000000..bce3a2a57 --- /dev/null +++ b/doc/osgUtil/GUIActionAdapter.html @@ -0,0 +1,51 @@ + + + class osgUtil::GUIActionAdapter + + + + +

class osgUtil::GUIActionAdapter

+
Pure virtual base class for adapting the GUI actions for use in CameraManipulators
+
+ +
+

+

Public Methods

+[more]virtual void needRedraw(bool needed=true) +
+
+[more]virtual void needContinuousUpdate(bool needed=true) +
+
+[more]virtual void needWarpPointer(int x, int y) +
+

+ +
+ + +
+

Documentation

+
Pure virtual base class for adapting the GUI actions for use in CameraManipulators
+
+ + + +
ovirtual void needRedraw(bool needed=true) +

+ + +

ovirtual void needContinuousUpdate(bool needed=true) +

+ + +

ovirtual void needWarpPointer(int x, int y) +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osgUtil/GUIEventAdapter.html b/doc/osgUtil/GUIEventAdapter.html new file mode 100644 index 000000000..98bb6cd99 --- /dev/null +++ b/doc/osgUtil/GUIEventAdapter.html @@ -0,0 +1,212 @@ + + + class osgUtil::GUIEventAdapter + + + + +

class osgUtil::GUIEventAdapter: public osg::Referenced

+
Pure virtual base class for adapting platform specfic events into generic keyboard and mouse events.
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Classes

+[more]enum MouseButtonMask +
+
+[more]enum EventType +
+

+ +

+

Public Methods

+[more] GUIEventAdapter() +
+
+[more]virtual EventType getEventType() const +
Get the EventType of the GUI event +
+[more]virtual int getKey() const +
key pressed, return -1 if inapropriate for this event. +
+[more]virtual int getButton() const +
button pressed/released, return -1 if inappropriate for this event +
+[more]virtual int getXmin() const +
window minimum x. +
+[more]virtual int getXmax() const +
window maximum x. +
+[more]virtual int getYmin() const +
window minimum y. +
+[more]virtual int getYmax() const +
window maximum y. +
+[more]virtual int getX() const +
current mouse x position +
+[more]virtual int getY() const +
current mouse y position +
+[more]virtual unsigned int getButtonMask() const +
current mouse button state +
+[more]virtual float time() const +
time in seconds of event. +

+ +

+

Protected Methods

+[more]virtual ~GUIEventAdapter() +
Force users to create on heap, so that mulitple referencing is safe +

+ +
+ + +
+

Documentation

+
Pure virtual base class for adapting platform specfic events into +generic keyboard and mouse events.
+
+ + + +
o GUIEventAdapter() +

+ + +

oenum MouseButtonMask +

+ + + +
o LEFT_BUTTON +

+ + +

o MIDDLE_BUTTON +

+ + +

o RIGHT_BUTTON +

+ + + +
oenum EventType +

+ + + +
o PUSH +

+ + +

o RELEASE +

+ + +

o DRAG +

+ + +

o MOVE +

+ + +

o KEYBOARD +

+ + +

o FRAME +

+ + +

o RESIZE +

+ + +

o NONE +

+ + + +
ovirtual EventType getEventType() const +
Get the EventType of the GUI event +

+ + +

ovirtual int getKey() const +
key pressed, return -1 if inapropriate for this event. +

+ + +

ovirtual int getButton() const +
button pressed/released, return -1 if inappropriate for this event +

+ + +

ovirtual int getXmin() const +
window minimum x. +

+ + +

ovirtual int getXmax() const +
window maximum x. +

+ + +

ovirtual int getYmin() const +
window minimum y. +

+ + +

ovirtual int getYmax() const +
window maximum y. +

+ + +

ovirtual int getX() const +
current mouse x position +

+ + +

ovirtual int getY() const +
current mouse y position +

+ + +

ovirtual unsigned int getButtonMask() const +
current mouse button state +

+ + +

ovirtual float time() const +
time in seconds of event. +

+ + +

ovirtual ~GUIEventAdapter() +
Force users to create on heap, so that mulitple referencing is safe +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osgUtil/GUIEventAdaptor.html b/doc/osgUtil/GUIEventAdaptor.html new file mode 100644 index 000000000..7878e2f19 --- /dev/null +++ b/doc/osgUtil/GUIEventAdaptor.html @@ -0,0 +1,134 @@ + + + class osgUtil::GUIEventAdaptor + + + + +

class osgUtil::GUIEventAdaptor

+
+ +
+

+

Public Classes

+[more]enum MouseButtonMask +
+
+[more]enum EventType +
+

+ +

+

Public Fields

+[more]EventType _eventType +
event type +
+[more]int _key_or_button_pressed +
the key or button pressed in this event. +
+[more]int _x +
current mouse position. +
+[more]int _y +
+
+[more]unsigned int _buttonMask +
current mouse button state. +

+ +

+

Public Methods

+[more] GUIEventAdaptor() +
+

+ +
+ + +
+

Documentation

+
+ + + +
o GUIEventAdaptor() +

+ + +

oenum MouseButtonMask +

+ + + +
o LEFT_BUTTON +

+ + +

o MIDDLE_BUTTON +

+ + +

o RIGHT_BUTTON +

+ + + +
oenum EventType +

+ + + +
o PUSH +

+ + +

o RELEASE +

+ + +

o DRAG +

+ + +

o MOVE +

+ + +

o KEYBOARD +

+ + +

o NONE +

+ + + +
oEventType _eventType +
event type +

+ + +

oint _key_or_button_pressed +
the key or button pressed in this event. +

+ + +

oint _x +
current mouse position. +

+ + +

oint _y +

+ + +

ounsigned int _buttonMask +
current mouse button state. +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osgUtil/GUIUpdateState.html b/doc/osgUtil/GUIUpdateState.html new file mode 100644 index 000000000..0c13784ee --- /dev/null +++ b/doc/osgUtil/GUIUpdateState.html @@ -0,0 +1,45 @@ + + + class osgUtil::GUIUpdateState + + + + +

class osgUtil::GUIUpdateState

+
Class for passing back the update state from a camera maniupulator back to the caller, on the handling of an event.
+
+ +
+

+

Public Methods

+[more]virtual void needRedraw(bool needed=true) +
+
+[more]virtual void needContinuousUpdate(bool needed=true) +
+

+ +
+ + +
+

Documentation

+
Class for passing back the update state from a camera maniupulator +back to the caller, on the handling of an event.
+
+ + + +
ovirtual void needRedraw(bool needed=true) +

+ + +

ovirtual void needContinuousUpdate(bool needed=true) +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osgUtil/General.html b/doc/osgUtil/General.html new file mode 100644 index 000000000..76c298a98 --- /dev/null +++ b/doc/osgUtil/General.html @@ -0,0 +1,89 @@ + + + General Bits + + + + +
+
+ +o#define +OSGUTIL_CAMERAMANIPULATOR
+
+ +o#define +OSGUTIL_COMPILEGEOSETVISITOR
+
+ +o +
+
+ +o#define +OSGUTIL_DRIVEMANIPULATOR
+
+ +o#define +OSGUTIL_EXPORT_
+
+ +o#define +OSGUTIL_EXPORT(dllexport)
+
+ +o#define +OSGUTIL_EXPORT(dllimport)
+
+ +o#define +OSGUTIL_FLIGHTMANIPULATOR
+
+ +o#define +OSGUTIL_GUIACTIONADAPTER
+
+ +o#define +OSGUTIL_GUIEVENTADAPTER
+
+ +o#define +OSGUTIL_INTERSECTVISITOR
+
+ +o +
+
+ +o#define +OSGUTIL_RENDERVISITOR
+
+ +o +
+
+ +o#define +OSGUTIL_SCENEVIEW
+
+ +o +
+
+ +o#define +OSGUTIL_TRACKBALLMANIPULATOR
+
+ +o#define +OSGUTIL_VERSION
+
+ +o +
+
+Alphabetic index Hierarchy of classes


+
+This page was generated with the help of DOC++. + diff --git a/doc/osgUtil/HIER.html b/doc/osgUtil/HIER.html new file mode 100644 index 000000000..e9f6caf3a --- /dev/null +++ b/doc/osgUtil/HIER.html @@ -0,0 +1,28 @@ + + + Hierarchy of Classes + + + +

Hierarchy of Classes

+ +Alphabetic index


+
+This page was generated with the help of DOC++. + diff --git a/doc/osgUtil/HIERjava.html b/doc/osgUtil/HIERjava.html new file mode 100644 index 000000000..6ca65905f --- /dev/null +++ b/doc/osgUtil/HIERjava.html @@ -0,0 +1,83 @@ + + + Hierarchy of Classes + + + +

Hierarchy of classes

+
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ alphabetic index


+
+This page was generated with the help of DOC++. + diff --git a/doc/osgUtil/Hit.html b/doc/osgUtil/Hit.html new file mode 100644 index 000000000..f897c71df --- /dev/null +++ b/doc/osgUtil/Hit.html @@ -0,0 +1,163 @@ + + + class OSGUTIL_EXPORT osgUtil::Hit + + + + +

class OSGUTIL_EXPORT osgUtil::Hit: public osg::Referenced

+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Fields

+[more]float _ratio +
+
+[more]osg::Seg* _originalSeg +
+
+[more]osg::Seg* _localSeg +
+
+[more]osg::NodePath _nodePath +
+
+[more]osg::Geode* _geode +
+
+[more]osg::GeoSet* _geoset +
+
+[more]osg::Matrix* _matrix +
+
+[more]VecIndexList _vecIndexList +
+
+[more]int _primitiveIndex +
+
+[more]osg::Vec3 _intersectPoint +
+
+[more]osg::Vec3 _intersectNormal +
+

+ +

+

Public Methods

+[more] Hit() +
+
+[more] Hit(const Hit& hit) +
+
+[more] ~Hit() +
+
+[more]Hit& operator = (const Hit& hit) +
+
+[more]bool operator < (const Hit& hit) const +
+

+ +

+

Public

+[more]typedef std::vector<int> VecIndexList +
+

+ +
+ + +
+

Documentation

+
+ + + +
o Hit() +

+ + +

o Hit(const Hit& hit) +

+ + +

o ~Hit() +

+ + +

oHit& operator = (const Hit& hit) +

+ + +

otypedef std::vector<int> VecIndexList +

+ + +

obool operator < (const Hit& hit) const +

+ + +

ofloat _ratio +

+ + +

oosg::Seg* _originalSeg +

+ + +

oosg::Seg* _localSeg +

+ + +

oosg::NodePath _nodePath +

+ + +

oosg::Geode* _geode +

+ + +

oosg::GeoSet* _geoset +

+ + +

oosg::Matrix* _matrix +

+ + +

oVecIndexList _vecIndexList +

+ + +

oint _primitiveIndex +

+ + +

oosg::Vec3 _intersectPoint +

+ + +

oosg::Vec3 _intersectNormal +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osgUtil/IntersectState.html b/doc/osgUtil/IntersectState.html new file mode 100644 index 000000000..c0a37a045 --- /dev/null +++ b/doc/osgUtil/IntersectState.html @@ -0,0 +1,124 @@ + + + class OSGUTIL_EXPORT osgUtil::IntersectState + + + + +

class OSGUTIL_EXPORT osgUtil::IntersectState: public osg::Referenced

+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Fields

+[more]osg::Matrix* _matrix +
+
+[more]osg::Matrix* _inverse +
+
+[more]SegList _segList +
+
+[more]SegmentMaskStack _segmentMaskStack +
+

+ +

+

Public Methods

+[more] IntersectState() +
+
+[more]bool isCulled(const osg::BoundingSphere& bs, SegmentMask& segMaskOut) +
+
+[more]bool isCulled(const osg::BoundingBox& bb, SegmentMask& segMaskOut) +
+

+ +

+

Public

+[more]typedef std::vector< std::pair<osg::Seg*,osg::Seg*> > SegList +
+
+[more]typedef unsigned int SegmentMask +
+
+[more]typedef std::vector<SegmentMask> SegmentMaskStack +
+

+ +

+

Protected Methods

+[more] ~IntersectState() +
+

+ +
+ + +
+

Documentation

+
+ + + +
o IntersectState() +

+ + +

oosg::Matrix* _matrix +

+ + +

oosg::Matrix* _inverse +

+ + +

otypedef std::vector< std::pair<osg::Seg*,osg::Seg*> > SegList +

+ + +

oSegList _segList +

+ + +

otypedef unsigned int SegmentMask +

+ + +

otypedef std::vector<SegmentMask> SegmentMaskStack +

+ + +

oSegmentMaskStack _segmentMaskStack +

+ + +

obool isCulled(const osg::BoundingSphere& bs, SegmentMask& segMaskOut) +

+ + +

obool isCulled(const osg::BoundingBox& bb, SegmentMask& segMaskOut) +

+ + +

o ~IntersectState() +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osgUtil/IntersectVisitor.html b/doc/osgUtil/IntersectVisitor.html new file mode 100644 index 000000000..d04caa975 --- /dev/null +++ b/doc/osgUtil/IntersectVisitor.html @@ -0,0 +1,281 @@ + + + class OSGUTIL_EXPORT osgUtil::IntersectVisitor + + + + +

class OSGUTIL_EXPORT osgUtil::IntersectVisitor: public osg::NodeVisitor

+
Basic visitor for ray based collisions of a scene.
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Classes

+[more]enum HitReportingMode +
Modes to control how IntersectVisitor reports hits. +

+ +

+

Public Methods

+[more] IntersectVisitor() +
+
+[more]virtual ~IntersectVisitor() +
+
+[more]void reset() +
+
+[more]void addSeg(osg::Seg* seg) +
Add a line segment to use for intersection testing during scene traversal +
+[more]void setHitReportingMode(HitReportingMode hrm) +
Set the mode of how hits should reported back from a traversal +
+[more]HitReportingMode getHitReportingMode() +
Get the mode of how hits should reported back from a traversal +
+[more]HitList& getHitList(osg::Seg* seg) +
+
+[more]int getNumHits(osg::Seg* seg) +
+
+[more]bool hits() +
+
+[more]virtual void apply(osg::Node&) +
+
+[more]virtual void apply(osg::Geode& node) +
+
+[more]virtual void apply(osg::Billboard& node) +
+
+[more]virtual void apply(osg::Group& node) +
+
+[more]virtual void apply(osg::DCS& node) +
+
+[more]virtual void apply(osg::Switch& node) +
+
+[more]virtual void apply(osg::LOD& node) +
+
+[more]virtual void apply(osg::Scene& node) +
+

+ +

+

Public

+[more]typedef std::vector<Hit> HitList +
+
+[more]typedef std::map<osg::Seg*,HitList > SegHitListMap +
+

+ +

+

Protected Fields

+[more]IntersectStateStack _intersectStateStack +
+
+[more]osg::NodePath _nodePath +
+
+[more]HitReportingMode _hitReportingMode +
+
+[more]SegHitListMap _segHitList +
+

+ +

+

Protected Methods

+[more]bool intersect(osg::GeoSet& gset) +
+
+[more]void pushMatrix(const osg::Matrix& matrix) +
+
+[more]void popMatrix() +
+
+[more]bool enterNode(osg::Node& node) +
+
+[more]void leaveNode() +
+

+ +

+

Protected

+[more]typedef std::vector<IntersectState*> IntersectStateStack +
+

+ +
+ + +
+

Documentation

+
Basic visitor for ray based collisions of a scene. +Note, still in development, current version has not +pratical functionality!
+
+ + + +
o IntersectVisitor() +

+ + +

ovirtual ~IntersectVisitor() +

+ + +

ovoid reset() +

+ + +

ovoid addSeg(osg::Seg* seg) +
Add a line segment to use for intersection testing during scene traversal +

+ + +

oenum HitReportingMode +
Modes to control how IntersectVisitor reports hits. +

+ + + +
o ONLY_NEAREST_HIT +

+ + +

o ALL_HITS +

+ + + +
ovoid setHitReportingMode(HitReportingMode hrm) +
Set the mode of how hits should reported back from a traversal +

+ + +

oHitReportingMode getHitReportingMode() +
Get the mode of how hits should reported back from a traversal +

+ + +

otypedef std::vector<Hit> HitList +

+ + +

otypedef std::map<osg::Seg*,HitList > SegHitListMap +

+ + +

oHitList& getHitList(osg::Seg* seg) +

+ + +

oint getNumHits(osg::Seg* seg) +

+ + +

obool hits() +

+ + +

ovirtual void apply(osg::Node&) +

+ + +

ovirtual void apply(osg::Geode& node) +

+ + +

ovirtual void apply(osg::Billboard& node) +

+ + +

ovirtual void apply(osg::Group& node) +

+ + +

ovirtual void apply(osg::DCS& node) +

+ + +

ovirtual void apply(osg::Switch& node) +

+ + +

ovirtual void apply(osg::LOD& node) +

+ + +

ovirtual void apply(osg::Scene& node) +

+ + +

obool intersect(osg::GeoSet& gset) +

+ + +

ovoid pushMatrix(const osg::Matrix& matrix) +

+ + +

ovoid popMatrix() +

+ + +

obool enterNode(osg::Node& node) +

+ + +

ovoid leaveNode() +

+ + +

otypedef std::vector<IntersectState*> IntersectStateStack +

+ + +

oIntersectStateStack _intersectStateStack +

+ + +

oosg::NodePath _nodePath +

+ + +

oHitReportingMode _hitReportingMode +

+ + +

oSegHitListMap _segHitList +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osgUtil/NavigatorButton.class b/doc/osgUtil/NavigatorButton.class new file mode 100644 index 000000000..fad9c3f2d Binary files /dev/null and b/doc/osgUtil/NavigatorButton.class differ diff --git a/doc/osgUtil/RenderVisitor.html b/doc/osgUtil/RenderVisitor.html new file mode 100644 index 000000000..a2fafb844 --- /dev/null +++ b/doc/osgUtil/RenderVisitor.html @@ -0,0 +1,525 @@ + + + class OSGUTIL_EXPORT osgUtil::RenderVisitor + + + + +

class OSGUTIL_EXPORT osgUtil::RenderVisitor: public osg::NodeVisitor

+
Basic NodeVisitor implementation for rendering a scene.
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Classes

+[more]enum TransparencySortMode +
+
+[more]enum CullingType +
+

+ +

+

Public Methods

+[more] RenderVisitor() +
+
+[more]virtual ~RenderVisitor() +
+
+[more]void reset() +
+
+[more]virtual void apply(osg::Node&) +
+
+[more]virtual void apply(osg::Geode& node) +
+
+[more]virtual void apply(osg::Billboard& node) +
+
+[more]virtual void apply(osg::LightSource& node) +
+
+[more]virtual void apply(osg::Group& node) +
+
+[more]virtual void apply(osg::DCS& node) +
+
+[more]virtual void apply(osg::Switch& node) +
+
+[more]virtual void apply(osg::LOD& node) +
+
+[more]virtual void apply(osg::Scene& node) +
+
+[more]void setGlobalState(osg::GeoState* global) +
+
+[more]void setPerspective(const osg::Camera& camera) +
+
+[more]void setPerspective(float fovy, float aspect, float znear, float zfar) +
+
+[more]void setLookAt(const osg::Camera& camera) +
+
+[more]void setLookAt(const osg::Vec3& eye, const osg::Vec3& center, const osg::Vec3& upVector) +
+
+[more]void setLookAt(double eyeX, double eyeY, double eyeZ, double centerX, double centerY, double centerZ, double upX, double upY, double upZ) +
+
+[more]void setLODBias(float bias) +
+
+[more]float getLODBias() +
+
+[more]void setTransparencySortMode(TransparencySortMode tsm) +
+
+[more]void setCullingActive(CullingType ct, bool active) +
Enables/disables the specified culling type. +
+[more]bool getCullingActive(CullingType ct) +
Returns the state of the specified culling type. +
+[more]bool calcNearFar(double& near_plane, double& far_plane) +
Calculates the near_plane and the far_plane for the current camera view depending on the objects currently stored in the opaque and transparent bins. +
+[more]void render() +
Renders the osg::GeoSets that were collected in the opaque and transparent bins before +

+ +

+

Protected Fields

+[more]bool _viewFrustumCullingActive +
+
+[more]bool _smallFeatureCullingActive +
+
+[more]ViewStateStack _viewStateStack +
+
+[more]ViewState* _tvs +
+
+[more]ViewState* _cvs +
+
+[more]OpaqueList _opaqueGeoSets +
+
+[more]TransparentList _transparentGeoSets +
+
+[more]LightList _lights +
+
+[more]osg::GeoState* _globalState +
+
+[more]float _LODBias +
+
+[more]float _fovy +
+
+[more]float _aspect +
+
+[more]float _znear +
+
+[more]float _zfar +
+
+[more]osg::Vec3 _frustumTop +
+
+[more]osg::Vec3 _frustumBottom +
+
+[more]osg::Vec3 _frustumLeft +
+
+[more]osg::Vec3 _frustumRight +
+
+[more]TransparencySortMode _tsm +
+

+ +

+

Protected Methods

+[more]void pushMatrix(const osg::Matrix& matrix) +
+
+[more]void popMatrix() +
+
+[more]osg::Matrix* getCurrentMatrix() +
+
+[more]osg::Matrix* getInverseCurrentMatrix() +
+
+[more]const osg::Vec3& getEyeLocal() +
+
+[more]const osg::Vec3& getCenterLocal() +
+
+[more]const osg::Vec3& getLookVectorLocal() +
+
+[more]bool isCulled(const osg::BoundingSphere& sp) +
+
+[more]bool isCulled(const osg::BoundingBox& bb) +
+
+[more]void calculateClippingPlanes() +
+

+ +

+

Protected

+[more]typedef std::pair<osg::Matrix*,osg::GeoSet*> MatrixGeoSet +
+
+[more]typedef std::vector<ViewState*> ViewStateStack +
+
+[more]typedef std::multimap<osg::GeoState*,MatrixGeoSet> OpaqueList +
+
+[more]typedef std::multimap<float,MatrixGeoSet> TransparentList +
+
+[more]typedef std::map<osg::Matrix*,osg::Light*> LightList +
+

+ +
+ + +
+

Documentation

+
+Basic NodeVisitor implementation for rendering a scene. +This visitor traverses the scene graph, collecting transparent and +opaque osg::GeoSets into a depth sorted transparent bin and a state +sorted opaque bin. The opaque bin is rendered first, and then the +transparent bin in rendered in order from the furthest osg::GeoSet +from the eye to the one nearest the eye.
+
+ + + +
o RenderVisitor() +

+ + +

ovirtual ~RenderVisitor() +

+ + +

ovoid reset() +

+ + +

ovirtual void apply(osg::Node&) +

+ + +

ovirtual void apply(osg::Geode& node) +

+ + +

ovirtual void apply(osg::Billboard& node) +

+ + +

ovirtual void apply(osg::LightSource& node) +

+ + +

ovirtual void apply(osg::Group& node) +

+ + +

ovirtual void apply(osg::DCS& node) +

+ + +

ovirtual void apply(osg::Switch& node) +

+ + +

ovirtual void apply(osg::LOD& node) +

+ + +

ovirtual void apply(osg::Scene& node) +

+ + +

ovoid setGlobalState(osg::GeoState* global) +

+ + +

ovoid setPerspective(const osg::Camera& camera) +

+ + +

ovoid setPerspective(float fovy, float aspect, float znear, float zfar) +

+ + +

ovoid setLookAt(const osg::Camera& camera) +

+ + +

ovoid setLookAt(const osg::Vec3& eye, const osg::Vec3& center, const osg::Vec3& upVector) +

+ + +

ovoid setLookAt(double eyeX, double eyeY, double eyeZ, double centerX, double centerY, double centerZ, double upX, double upY, double upZ) +

+ + +

ovoid setLODBias(float bias) +

+ + +

ofloat getLODBias() +

+ + +

oenum TransparencySortMode +

+ + + +
o LOOK_VECTOR_DISTANCE +

+ + +

o OBJECT_EYE_POINT_DISTANCE +

+ + + +
ovoid setTransparencySortMode(TransparencySortMode tsm) +

+ + +

oenum CullingType +

+ + + +
o VIEW_FRUSTUM_CULLING +

+ + +

o SMALL_FEATURE_CULLING +

+ + + +
ovoid setCullingActive(CullingType ct, bool active) +
+Enables/disables the specified culling type. + +
Parameters:
ct - The culling type to enable/disable. +
active - true enables the culling type, false disables.

+ + +

obool getCullingActive(CullingType ct) +
+Returns the state of the specified culling type. +@result true, if culling type is enabled, false otherwise. +

+ + +

obool calcNearFar(double& near_plane, double& far_plane) +
+Calculates the near_plane and the far_plane for the current +camera view depending on the objects currently stored in the +opaque and transparent bins. + +
Parameters:
near_plane - reference to a variable that can store the +near plane result. +
far_plane - reference to a variable that can store the +far plane result. +@result true, if near_plane and far_plane contain valid values, +false otherwise.

+ + +

ovoid render() +
+Renders the osg::GeoSets that were collected in the opaque and +transparent bins before +

+ + +

ovoid pushMatrix(const osg::Matrix& matrix) +

+ + +

ovoid popMatrix() +

+ + +

oosg::Matrix* getCurrentMatrix() +

+ + +

oosg::Matrix* getInverseCurrentMatrix() +

+ + +

oconst osg::Vec3& getEyeLocal() +

+ + +

oconst osg::Vec3& getCenterLocal() +

+ + +

oconst osg::Vec3& getLookVectorLocal() +

+ + +

obool _viewFrustumCullingActive +

+ + +

obool _smallFeatureCullingActive +

+ + +

obool isCulled(const osg::BoundingSphere& sp) +

+ + +

obool isCulled(const osg::BoundingBox& bb) +

+ + +

otypedef std::pair<osg::Matrix*,osg::GeoSet*> MatrixGeoSet +

+ + +

otypedef std::vector<ViewState*> ViewStateStack +

+ + +

oViewStateStack _viewStateStack +

+ + +

oViewState* _tvs +

+ + +

oViewState* _cvs +

+ + +

otypedef std::multimap<osg::GeoState*,MatrixGeoSet> OpaqueList +

+ + +

otypedef std::multimap<float,MatrixGeoSet> TransparentList +

+ + +

otypedef std::map<osg::Matrix*,osg::Light*> LightList +

+ + +

oOpaqueList _opaqueGeoSets +

+ + +

oTransparentList _transparentGeoSets +

+ + +

oLightList _lights +

+ + +

oosg::GeoState* _globalState +

+ + +

ofloat _LODBias +

+ + +

ofloat _fovy +

+ + +

ofloat _aspect +

+ + +

ofloat _znear +

+ + +

ofloat _zfar +

+ + +

ovoid calculateClippingPlanes() +

+ + +

oosg::Vec3 _frustumTop +

+ + +

oosg::Vec3 _frustumBottom +

+ + +

oosg::Vec3 _frustumLeft +

+ + +

oosg::Vec3 _frustumRight +

+ + +

oTransparencySortMode _tsm +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osgUtil/SceneView.html b/doc/osgUtil/SceneView.html new file mode 100644 index 000000000..696524743 --- /dev/null +++ b/doc/osgUtil/SceneView.html @@ -0,0 +1,409 @@ + + + class OSGUTIL_EXPORT osgUtil::SceneView + + + + +

class OSGUTIL_EXPORT osgUtil::SceneView: public osg::Referenced

+
SceneView is literaly a view of a scene, encapsulating the camera, global state, lights and the scene itself.
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Classes

+[more]enum LightingMode +
+

+ +

+

Public Methods

+[more] SceneView() +
Constrcut a default scene view +
+[more]void setSceneData(osg::Node* node) +
Set the data which to view. +
+[more]osg::Node* getSceneData() +
Get the scene data which to view. +
+[more]void setViewport(int x, int y, int width, int height) +
Set the viewport of the scene view. +
+[more]void getViewport(int& x, int& y, int& width, int& height) +
Get the viewport of the scene view. +
+[more]void setDefaults() +
Set scene view to use default global state, light, camera and render visitor +
+[more]void setBackgroundColor(const osg::Vec4& color) +
Set the background color used in glClearColor(). +
+[more]const osg::Vec4& getBackgroundColor() const +
Get the background color +
+[more]void setGlobalState(osg::GeoState* state) +
+
+[more]osg::GeoState* getGlobalState() const +
+
+[more]void setLightingMode(LightingMode mode) +
+
+[more]LightingMode getLightingMode() const +
+
+[more]void setLight(osg::Light* light) +
+
+[more]osg::Light* getLight() const +
+
+[more]void setCamera(osg::Camera* camera) +
+
+[more]osg::Camera* getCamera() const +
+
+[more]void setRenderVisitor(osgUtil::RenderVisitor* rv) +
+
+[more]osgUtil::RenderVisitor* getRenderVisitor() const +
+
+[more]void setLODBias(float bias) +
+
+[more]float getLODBias() const +
+
+[more]void setCalcNearFar(bool calc) +
Set to true if you want SceneView to automatically calculate values for the near/far clipping planes, each frame, set false to use camera's internal near and far planes. +
+[more]bool getCalcNearFar() +
return true if SceneView automatically caclculates near and far clipping planes for each frame +
+[more]bool projectWindowIntoObject(const osg::Vec3& window, osg::Vec3& object) const +
Calculate, via glUnProject, the object coordinates of a window point. +
+[more]bool projectWindowXYIntoObject(int x, int y, osg::Vec3& near_point, osg::Vec3& far_point) const +
Calculate, via glUnProject, the object coordinates of a window x,y when projected onto the near and far planes. +
+[more]bool projectObjectIntoWindow(const osg::Vec3& object, osg::Vec3& window) const +
Calculate, via glProject, the object coordinates of a window. +
+[more]virtual void cull() +
+
+[more]virtual void draw() +
+

+ +

+

Protected Fields

+[more]osg::ref_ptr<osg::Node> _sceneData +
+
+[more]osg::ref_ptr<osg::GeoState> _globalState +
+
+[more]osg::ref_ptr<osg::Light> _light +
+
+[more]osg::ref_ptr<osg::Camera> _camera +
+
+[more]osg::ref_ptr<osgUtil::RenderVisitor> _renderVisitor +
+
+[more]bool _need_compile +
+
+[more]bool _calc_nearfar +
+
+[more]osg::Vec4 _backgroundColor +
+
+[more]double _near_plane +
+
+[more]double _far_plane +
+
+[more]float _lodBias +
+
+[more]GLint _view[4] +
+
+[more]GLdouble _model[16] +
+
+[more]GLdouble _proj[16] +
+
+[more]LightingMode _lightingMode +
+

+ +

+

Protected Methods

+[more]virtual ~SceneView() +
+

+ +
+ + +
+

Documentation

+
+SceneView is literaly a view of a scene, encapsulating the +camera, global state, lights and the scene itself. Provides +methods for setting up the view and rendering it.
+
+ + + +
o SceneView() +
Constrcut a default scene view +

+ + +

ovoid setSceneData(osg::Node* node) +
Set the data which to view. The data will typically be +an osg::Scene but can be any osg::Node type. +

+ + +

oosg::Node* getSceneData() +
Get the scene data which to view. The data will typically be +an osg::Scene but can be any osg::Node type. +

+ + +

ovoid setViewport(int x, int y, int width, int height) +
Set the viewport of the scene view. +

+ + +

ovoid getViewport(int& x, int& y, int& width, int& height) +
Get the viewport of the scene view. +

+ + +

ovoid setDefaults() +
Set scene view to use default global state, light, camera +and render visitor +

+ + +

ovoid setBackgroundColor(const osg::Vec4& color) +
Set the background color used in glClearColor(). +Defaults to an off blue color. +

+ + +

oconst osg::Vec4& getBackgroundColor() const +
Get the background color +

+ + +

ovoid setGlobalState(osg::GeoState* state) +

+ + +

oosg::GeoState* getGlobalState() const +

+ + +

oenum LightingMode +

+ + + +
o HEADLIGHT +

+ + +

o SKY_LIGHT +

+ + +

o NO_SCENEVIEW_LIGHT +

+ + + +
ovoid setLightingMode(LightingMode mode) +

+ + +

oLightingMode getLightingMode() const +

+ + +

ovoid setLight(osg::Light* light) +

+ + +

oosg::Light* getLight() const +

+ + +

ovoid setCamera(osg::Camera* camera) +

+ + +

oosg::Camera* getCamera() const +

+ + +

ovoid setRenderVisitor(osgUtil::RenderVisitor* rv) +

+ + +

oosgUtil::RenderVisitor* getRenderVisitor() const +

+ + +

ovoid setLODBias(float bias) +

+ + +

ofloat getLODBias() const +

+ + +

ovoid setCalcNearFar(bool calc) +
Set to true if you want SceneView to automatically calculate values +for the near/far clipping planes, each frame, set false to use camera's +internal near and far planes. Default value is true. +

+ + +

obool getCalcNearFar() +
return true if SceneView automatically caclculates near and +far clipping planes for each frame +

+ + +

obool projectWindowIntoObject(const osg::Vec3& window, osg::Vec3& object) const +
Calculate, via glUnProject, the object coordinates of a window point. +Note, current implementation requires that SceneView::draw() has been previously called +for projectWindowIntoObject to produce valid values. Consistent with OpenGL +windows coordinates are calculated relative to the bottom left of the window. +Returns true on successful projection. +

+ + +

obool projectWindowXYIntoObject(int x, int y, osg::Vec3& near_point, osg::Vec3& far_point) const +
Calculate, via glUnProject, the object coordinates of a window x,y +when projected onto the near and far planes. +Note, current implementation requires that SceneView::draw() has been previously called +for projectWindowIntoObject to produce valid values. Consistent with OpenGL +windows coordinates are calculated relative to the bottom left of the window. +Returns true on successful projection. +

+ + +

obool projectObjectIntoWindow(const osg::Vec3& object, osg::Vec3& window) const +
Calculate, via glProject, the object coordinates of a window. +Note, current implementation requires that SceneView::draw() has been previously called +for projectWindowIntoObject to produce valid values. Consistent with OpenGL +windows coordinates are calculated relative to the bottom left of the window, +whereas as window API's normally have the top left as the origin, +so you may need to pass in (mouseX,window_height-mouseY,...). +Returns true on successful projection. +

+ + +

ovirtual void cull() +

+ + +

ovirtual void draw() +

+ + +

ovirtual ~SceneView() +

+ + +

oosg::ref_ptr<osg::Node> _sceneData +

+ + +

oosg::ref_ptr<osg::GeoState> _globalState +

+ + +

oosg::ref_ptr<osg::Light> _light +

+ + +

oosg::ref_ptr<osg::Camera> _camera +

+ + +

oosg::ref_ptr<osgUtil::RenderVisitor> _renderVisitor +

+ + +

obool _need_compile +

+ + +

obool _calc_nearfar +

+ + +

oosg::Vec4 _backgroundColor +

+ + +

odouble _near_plane +

+ + +

odouble _far_plane +

+ + +

ofloat _lodBias +

+ + +

oGLint _view[4] +

+ + +

oGLdouble _model[16] +

+ + +

oGLdouble _proj[16] +

+ + +

oLightingMode _lightingMode +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osgUtil/TrackballManipulator.html b/doc/osgUtil/TrackballManipulator.html new file mode 100644 index 000000000..4ca982d0b --- /dev/null +++ b/doc/osgUtil/TrackballManipulator.html @@ -0,0 +1,111 @@ + + + class OSGUTIL_EXPORT osgUtil::TrackballManipulator + + + + +

class OSGUTIL_EXPORT osgUtil::TrackballManipulator: public CameraManipulator

+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Methods

+[more] TrackballManipulator() +
+
+[more]virtual ~TrackballManipulator() +
+
+[more]virtual void setNode(osg::Node*) +
Attach a node to the manipulator. +
+[more]virtual osg::Node* getNode() const +
Return node if attached +
+[more]virtual void home(GUIEventAdapter& ea, GUIActionAdapter& us) +
Move the camera to the default position. +
+[more]virtual void init(GUIEventAdapter& ea, GUIActionAdapter& us) +
Start/restart the manipulator +
+[more]virtual bool update(GUIEventAdapter& ea, GUIActionAdapter& us) +
handle events, return true if handled, false otherwise +

+ +
+

Inherited from CameraManipulator:

+
+

+

Public Methods

+ovirtual void setCamera(osg::Camera*) +
+ovirtual osg::Camera* getCamera() const +

+ +

+

Protected Fields

+oosg::ref_ptr<osg::Camera> _camera +

+ +
+ + +
+

Documentation

+
+ + + +
o TrackballManipulator() +

+ + +

ovirtual ~TrackballManipulator() +

+ + +

ovirtual void setNode(osg::Node*) +
Attach a node to the manipulator. +Automatically detaches previously attached node. +setNode(NULL) detaches previously nodes. +Is ignored by manipulators which do not require a reference model. +

+ + +

ovirtual osg::Node* getNode() const +
Return node if attached +

+ + +

ovirtual void home(GUIEventAdapter& ea, GUIActionAdapter& us) +
Move the camera to the default position. +May be ignored by manipulators if home functionality is not appropriate. +

+ + +

ovirtual void init(GUIEventAdapter& ea, GUIActionAdapter& us) +
Start/restart the manipulator +

+ + +

ovirtual bool update(GUIEventAdapter& ea, GUIActionAdapter& us) +
handle events, return true if handled, false otherwise +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osgUtil/ViewState.html b/doc/osgUtil/ViewState.html new file mode 100644 index 000000000..9509e1d68 --- /dev/null +++ b/doc/osgUtil/ViewState.html @@ -0,0 +1,166 @@ + + + class OSGUTIL_EXPORT osgUtil::ViewState + + + + +

class OSGUTIL_EXPORT osgUtil::ViewState: public osg::Referenced

+
Container class for encapsulating the viewing state in local coordinates, during the cull traversal
+
+ +

Inheritance:

+ + + + + + + +
+ +
+

+

Public Fields

+[more]osg::Matrix* _matrix +
+
+[more]osg::Matrix* _inverse +
+
+[more]osg::Vec3 _eyePoint +
+
+[more]osg::Vec3 _centerPoint +
+
+[more]osg::Vec3 _lookVector +
+
+[more]osg::Vec3 _upVector +
+
+[more]osg::Vec3 _frustumTopNormal +
+
+[more]osg::Vec3 _frustumBottomNormal +
+
+[more]osg::Vec3 _frustumLeftNormal +
+
+[more]osg::Vec3 _frustumRightNormal +
+
+[more]float _ratio +
+
+[more]bool _viewFrustumCullingActive +
+
+[more]bool _smallFeatureCullingActive +
+

+ +

+

Public Methods

+[more] ViewState() +
+
+[more]bool isCulled(const osg::BoundingSphere& sp) +
+
+[more]bool isCulled(const osg::BoundingBox& bb) +
+

+ +

+

Protected Methods

+[more] ~ViewState() +
+

+ +
+ + +
+

Documentation

+
Container class for encapsulating the viewing state in local +coordinates, during the cull traversal
+
+ + + +
o ViewState() +

+ + +

oosg::Matrix* _matrix +

+ + +

oosg::Matrix* _inverse +

+ + +

oosg::Vec3 _eyePoint +

+ + +

oosg::Vec3 _centerPoint +

+ + +

oosg::Vec3 _lookVector +

+ + +

oosg::Vec3 _upVector +

+ + +

oosg::Vec3 _frustumTopNormal +

+ + +

oosg::Vec3 _frustumBottomNormal +

+ + +

oosg::Vec3 _frustumLeftNormal +

+ + +

oosg::Vec3 _frustumRightNormal +

+ + +

ofloat _ratio +

+ + +

obool _viewFrustumCullingActive +

+ + +

obool _smallFeatureCullingActive +

+ + +

obool isCulled(const osg::BoundingSphere& sp) +

+ + +

obool isCulled(const osg::BoundingBox& bb) +

+ + +

o ~ViewState() +

+ +
This class has no child classes.
+ +

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osgUtil/icon1.gif b/doc/osgUtil/icon1.gif new file mode 100644 index 000000000..f78f30eb9 Binary files /dev/null and b/doc/osgUtil/icon1.gif differ diff --git a/doc/osgUtil/icon2.gif b/doc/osgUtil/icon2.gif new file mode 100644 index 000000000..6cbe01a83 Binary files /dev/null and b/doc/osgUtil/icon2.gif differ diff --git a/doc/osgUtil/index.html b/doc/osgUtil/index.html new file mode 100644 index 000000000..7f2e5c7ac --- /dev/null +++ b/doc/osgUtil/index.html @@ -0,0 +1,41 @@ + + + Table of Contents + + + + +

Table of Contents

+

Namespaces

+ +

Functions

+ +

Macros

+ +Hierarchy of classes


+
+This page was generated with the help of DOC++. + diff --git a/doc/osgUtil/osgUtil.html b/doc/osgUtil/osgUtil.html new file mode 100644 index 000000000..de6419fc4 --- /dev/null +++ b/doc/osgUtil/osgUtil.html @@ -0,0 +1,49 @@ + + + namespace osgUtil + + + + +

namespace osgUtil

+ +
+

+
class OSGUTIL_EXPORT CameraManipulator +
+
class OSGUTIL_EXPORT DisplayListVisitor +
Visitor for traversing scene set each osg::GeoSet's _useDisplayList flag, or immediately compiling osg::GeoSet's OpenGL Display lists. +
class OSGUTIL_EXPORT DriveManipulator +
+
class OSGUTIL_EXPORT FlightManipulator +
+
class GUIActionAdapter +
Pure virtual base class for adapting the GUI actions for use in CameraManipulators +
class GUIEventAdapter +
Pure virtual base class for adapting platform specfic events into generic keyboard and mouse events. +
class OSGUTIL_EXPORT IntersectState +
+
class OSGUTIL_EXPORT Hit +
+
class OSGUTIL_EXPORT IntersectVisitor +
Basic visitor for ray based collisions of a scene. +
class OSGUTIL_EXPORT ViewState +
Container class for encapsulating the viewing state in local coordinates, during the cull traversal +
class OSGUTIL_EXPORT RenderVisitor +
Basic NodeVisitor implementation for rendering a scene. +
class OSGUTIL_EXPORT SceneView +
SceneView is literaly a view of a scene, encapsulating the camera, global state, lights and the scene itself. +
class OSGUTIL_EXPORT TrackballManipulator +
+

+ + + +
+

Documentation

+
+
+

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osgUtil/osgUtilGetLibraryName.html b/doc/osgUtil/osgUtilGetLibraryName.html new file mode 100644 index 000000000..3cb0b3476 --- /dev/null +++ b/doc/osgUtil/osgUtilGetLibraryName.html @@ -0,0 +1,21 @@ + + + extern OSGUTIL_EXPORT const char* osgUtilGetLibraryName + + + + +

extern OSGUTIL_EXPORT const char* osgUtilGetLibraryName()

+
getLibraryName_osgUtil() returns the library name in human friendly form
+ + +
+

Documentation

+
+getLibraryName_osgUtil() returns the library name in human friendly form
+
+
+

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/doc/osgUtil/osgUtilGetVersion.html b/doc/osgUtil/osgUtilGetVersion.html new file mode 100644 index 000000000..29800df81 --- /dev/null +++ b/doc/osgUtil/osgUtilGetVersion.html @@ -0,0 +1,30 @@ + + + extern OSGUTIL_EXPORT const char* osgUtilGetVersion + + + + +

extern OSGUTIL_EXPORT const char* osgUtilGetVersion()

+
getVersion_osgUtil() returns the library version number.
+ + +
+

Documentation

+
+getVersion_osgUtil() returns the library version number. +Numbering conventon : osg_src-0.8-31 will return 0.8.31 from getVersion_osgUtil.

This C function can be also used to check for the existance of the OpenSceneGraph +library using autoconf and its m4 macro AC_CHECK_LIB.

Here is the code to add to your configure.in: +\verbatim +# +# Check for the OpenSceneGraph (OSG) utility library +# +AC_CHECK_LIB(osg, osgUtilGetVersion, , +[AC_MSG_ERROR(OpenSceneGraph utility library not found. See http://www.openscenegraph.org)],) +\endverbatim

+
+
+

Alphabetic index HTML hierarchy of classes or Java


+
+This page was generated with the help of DOC++. + diff --git a/include/osg/AlphaFunc b/include/osg/AlphaFunc new file mode 100644 index 000000000..40ec57b4d --- /dev/null +++ b/include/osg/AlphaFunc @@ -0,0 +1,65 @@ +#ifndef OSG_ALPHAFUNC +#define OSG_ALPHAFUNC 1 + +#include +#include +#include + +namespace osg { + +/** Encapsulte OpenGL glAlphaFunc. +*/ +class SG_EXPORT AlphaFunc : public Object +{ + public : + + enum ComparisonFunction { + NEVER = GL_NEVER, + LESS = GL_LESS, + EQUAL = GL_EQUAL, + LEQUAL = GL_LEQUAL, + GREATER = GL_GREATER, + NOTEQUAL = GL_NOTEQUAL, + GEQUAL = GL_GEQUAL, + ALWAYS = GL_ALWAYS + }; + + AlphaFunc(); + static AlphaFunc* instance(); + virtual bool isSameKindAs(Object* obj) { return dynamic_cast(obj)!=NULL; } + virtual Object* clone() const { return new AlphaFunc(); } + virtual const char* className() const { return "AlphaFunc"; } + + void setFunction(ComparisonFunction func,float ref) + { + _comparisonFunc = func; + _referenceValue = ref; + } + + ComparisonFunction getFunction() const { return _comparisonFunc; } + + float getRefrenceValue() const { return _referenceValue; } + + static void enable(); + static void disable(); + + void apply(); + + protected: + + virtual ~AlphaFunc(); + + virtual bool readLocalData(Input& fr); + virtual bool writeLocalData(Output& fw); + + bool matchFuncStr(const char* str,ComparisonFunction& func); + const char* getFuncStr(ComparisonFunction func); + + ComparisonFunction _comparisonFunc; + float _referenceValue; + +}; + +}; + +#endif diff --git a/include/osg/Billboard b/include/osg/Billboard new file mode 100644 index 000000000..64bc3009e --- /dev/null +++ b/include/osg/Billboard @@ -0,0 +1,84 @@ +#ifndef OSG_BILLBOARD +#define OSG_BILLBOARD 1 + +#include + +namespace osg { + +/** Billboard - a Geode which orientates its child osg::GeoSet's to face + the eye point. + Typical uses are for trees, or particle explosions. +*/ +class SG_EXPORT Billboard : public Geode +{ + public: + + enum Mode { + AXIAL_ROT, + POINT_ROT_EYE, + POINT_ROT_WORLD + }; + + Billboard(); + + virtual Object* clone() const { return new Billboard(); } + virtual bool isSameKindAs(Object* obj) { return dynamic_cast(obj)!=NULL; } + virtual const char* className() const { return "Billboard"; } + virtual void accept(NodeVisitor& nv) { nv.apply(*this); } + + + void setAxis(const Vec3& axis) { _axis = axis; } + void getAxis(Vec3& axis) const { axis = _axis; } + + void setMode(Mode mode) { _mode = mode; } + int getMode() const { return _mode; } + + void setPos(int i,const Vec3& pos) { _positionList[i] = pos; } + void getPos(int i,Vec3& pos) const { pos = _positionList[i]; } + + /** Add GeoSet to Billboard with default position(0,0,0); + * If gset not NULL and is not contained in Billboard then increment its + * reference count, and dirty the bounding box to cause it to recompute on + * next getBound() and return true for success. Otherwise return false. + */ + virtual bool addGeoSet( GeoSet *gset ); + + /** Add GeoSet to Geode at position pos. + * If gset not NULL and is not contained in Billboard then increment its + * reference count, and dirty the bounding box to cause it to recompute on + * next getBound() and return true for success. Otherwise return false. + */ + virtual bool addGeoSet(GeoSet *gset,const Vec3& pos); + + /** Remove GeoSet and associated position from Billboard. + * If gset is contained in Billboard then remove it from the geoset + * list and decrement its reference count, and dirty the + * bounding box to cause it to recompute on next getBound() and + * return true for success. If gset is not found then return false + * and do not the reference count of gset is left unchanged. + */ + virtual bool removeGeoSet( GeoSet *gset ); + + void calcRotation(const Vec3& eye_local, const Vec3& pos_local,Matrix& mat); + void calcTransform(const Vec3& eye_local, const Vec3& pos_local,Matrix& mat); + + protected: + + virtual ~Billboard(); + + virtual bool readLocalData(Input& fr); + virtual bool writeLocalData(Output& fw); + + virtual bool computeBound( void ); + + typedef std::vector PositionList; + + Mode _mode; + Vec3 _axis; + PositionList _positionList; + +}; + +}; + +#endif diff --git a/include/osg/BoundingBox b/include/osg/BoundingBox new file mode 100644 index 000000000..12b24953b --- /dev/null +++ b/include/osg/BoundingBox @@ -0,0 +1,116 @@ +#ifndef OSG_BOUNDINGBOX +#define OSG_BOUNDINGBOX 1 + +#include +#include +#include + +namespace osg { + +class BoundingSphere; + +/** General purpose axis-aligned bounding box class for enclosing objects/vertices. + Used to bounding the leaf objects in the scene, + i.e. osg::GeoSet's to assist in view frustum culling etc. +*/ +class SG_EXPORT BoundingBox +{ + public: + + /** The corner with the smallest values for each coordinate of the + bounding box.*/ + Vec3 _min; + /** The corner with the largest values for each coordinate of the + bounding box.*/ + Vec3 _max; + + /** construct to invalid values to represent an unset bounding box.*/ + BoundingBox() : _min(FLT_MAX,FLT_MAX,FLT_MAX), + _max(-FLT_MAX,-FLT_MAX,-FLT_MAX) {} + + /** initialize to invalid values to represent an unset bounding box.*/ + void init() + { + _min.set(FLT_MAX,FLT_MAX,FLT_MAX); + _max.set(-FLT_MAX,-FLT_MAX,-FLT_MAX); + } + + /** return true if the bounding box contains valid values, + false if the bounding box is effectively unset/empty.*/ + bool isValid() const + { + return _max.x()>=_min.x(); + } + + float& xMin() { return _min.x(); } + float xMin() const { return _min.x(); } + + float& yMin() { return _min.y(); } + float yMin() const { return _min.y(); } + + float& zMin() { return _min.z(); } + float zMin() const { return _min.z(); } + + float& xMax() { return _max.x(); } + float xMax() const { return _max.x(); } + + float& yMax() { return _max.y(); } + float yMax() const { return _max.y(); } + + float& zMax() { return _max.z(); } + float zMax() const { return _max.z(); } + + /** Calculate and return the center of the bounding box.*/ + Vec3 center() const + { + return (_min+_max)*0.5f; + } + + /** Calculate and return the radius of the bounding box.*/ + float radius() const + { + return sqrtf(radius2()); + } + + /** Calculate and return the radius squared of the bounding box. + Note, radius2() is faster to calculate than radius().*/ + float radius2() const + { + return 0.25f*((_max-_min).length2()); + } + + /** return the corner of the bounding box. + Position (pos) is specfied by a number between 0 and 7, + the first bit toggles between x min and x max, second + bit toggles between y min and y max, third bit toggles + between z min and z max.*/ + Vec3 corner(unsigned int pos) const + { + return Vec3(pos&1?_max.x():_min.x(),pos&2?_max.y():_min.y(),pos&4?_max.z():_min.z()); + } + + /** If the vertex is outwith the box expand to ecompass vertex. + If this box is empty then move set this box's min max to vertex. */ + void expandBy(const Vec3& v); + + /** If incomming box is outwith the box expand to ecompass incomming box. + If this box is empty then move set this box to incomming box. */ + void expandBy(const BoundingBox& bb); + + /** If incomming sphere is outwith the box expand to ecompass incomming sphere. + If this box is empty then move set this box to encompass the sphere. */ + void expandBy(const BoundingSphere& sh); + + /** return true is vertex v is within the box.*/ + bool contains(const Vec3& v) + { + return isValid() && + (v.x()>=_min.x() && v.x()<=_max.x()) && + (v.y()>=_min.y() && v.y()<=_max.y()) && + (v.z()>=_min.z() && v.z()<=_max.z()); + } +}; + +}; + +#endif diff --git a/include/osg/BoundingSphere b/include/osg/BoundingSphere new file mode 100644 index 000000000..a144b7ae7 --- /dev/null +++ b/include/osg/BoundingSphere @@ -0,0 +1,85 @@ +#ifndef OSG_BOUNDINGSPHERE +#define OSG_BOUNDINGSPHERE 1 + +#include +#include + +namespace osg { + +/** General purpose bounding sphere class for enclosing nodes/objects/vertices. + Used to bound internal osg::Node's in the scene, + to assist in view frustrum culling etc. Similar in function to BoundingBox + but is quicker for evaluating culling, but generally encloses a greater volume + than a BoundingBox so will not cull so aggressively. +*/ +class SG_EXPORT BoundingSphere +{ + public: + + Vec3 _center; + float _radius; + + /** construct to invalid values to represent an unset bounding sphere.*/ + BoundingSphere() : _center(0.0f,0.0f,0.0f),_radius(-1.0f) {} + + /** initialize to invalid values to represent an unset bounding sphere.*/ + void init() + { + _center.set(0.0f,0.0f,0.0f); + _radius = -1.0f; + } + + /** return true if the bounding sphere contains valid values, + false if the bounding sphere is effectively unset.*/ + bool isValid() const { return _radius>=0.0f; } + + + /** return the const center of the bounding sphere.*/ + const Vec3& center() const { return _center; } + /** return the center of the bounding sphere.*/ + Vec3& center() { return _center; } + + /** return the const radius of the bounding sphere.*/ + float radius() const { return _radius; } + /** return the radius of the bounding sphere.*/ + float& radius() { return _radius; } + + /** return the radius squared. + Note, for performance reasons, assumes the calling method has ensured + that the sphere is valid before calling radius2(), i.e. has _radius>=0.0, + as it does not check th validity of sphere and will eroneously return a positive value.*/ + float radius2() const { return _radius*_radius; } + + /** If the vertex is outwith the sphere expand to ecompass vertex. + Calculates the combination of movement of center and radius which + minimizes the radius increase. If this sphere is empty then + move the centrer to v and set radius to 0.*/ + void expandBy(const Vec3& v); + + /** If the vertex is outwith the sphere expand radius to ecompass vertex. + Unlike update, does not move the center, just increasing the radius. + If this sphere is empty then move the centrer to v and set radius to 0 */ + void expandRadiusBy(const Vec3& v); + + /** If incomming sphere is outwith the sphere expand to ecompass incomming sphere. + calculates the combination of movement of center and radius which + minimizes the radius increase. If this sphere is empty then + move the centrer to v and set radius to 0.*/ + void expandBy(const BoundingSphere& sh); + + /** If incomming sphere is outwith the sphere expand radius to ecompass incomming sphere. + Unlike update, does not move the center, just increasing the radius. + If this sphere is empty then move the centrer to v and set radius to 0. */ + void expandRadiusBy(const BoundingSphere& sh); + + /** return true is vertex v is within the sphere.*/ + bool contains(const Vec3& v) + { + return isValid() && ((v-_center).length2()<=radius2()); + } + +}; + +}; + +#endif diff --git a/include/osg/Camera b/include/osg/Camera new file mode 100644 index 000000000..a6836af55 --- /dev/null +++ b/include/osg/Camera @@ -0,0 +1,140 @@ +#ifndef OSG_CAMERA +#define OSG_CAMERA 1 + +#include +#include + +namespace osg { + +/** Camera class for encapsulating the view position and orientation. + * This is the first implementation of osg::Camera class and + * currently is a perspective camera, but in future will be + * a base class from which PerpsectivCamera,FrustumCamera and OrthoCamera + * will be derived. + */ +class SG_EXPORT Camera: public osg::Referenced +{ + + public: + + Camera(); + virtual ~Camera(); + + + /** + * Set field of view and window aspect ratio. + * The parameters have the same meaning as their counterparts + * in gluPerspective(fovy,aspectRatio + */ + void setFieldOfView(double fovy,double aspectRatio); + + void setFieldOfViewY(double fovy) { _fovy = fovy; } + double getFieldOfViewY() const { return _fovy; } + + void setAspectRatio(double aspectRatio) { _aspectRatio = aspectRatio; } + double getAspectRatio() const { return _aspectRatio; } + + /** + * hardwired home view for now, looking straight down the + * Z axis at the origin, with 'up' being the y axis. + */ + void home(); + + /** + * Set the View, the up vector should be orthogonal to the + * look vector. + */ + void setView(Vec3 eyePoint, + Vec3 lookPoint, + Vec3 upVector); + + /** get the eyepoint. */ + const Vec3& getEyePoint() const {return _eyePoint;} + + /** get the lookpoint. */ + const Vec3& getLookPoint() const {return _lookPoint;} + + /** which way is up? */ + const Vec3& getUpVector() const {return _upVector;} + + /** calculate side vector.*/ + Vec3 getSideVector() const + { + Vec3 sv = (_lookPoint-_eyePoint)^_upVector; + sv.normalize(); + return sv; + } + + /** calculate look vector.*/ + Vec3 getLookVector() const + { + Vec3 lv = (_lookPoint-_eyePoint); + lv.normalize(); + return lv; + } + + /** calculate focal distance.*/ + float getFocalDistance() const + { + return (_lookPoint-_eyePoint).length(); + } + + /** set the near plane. */ + void setNearPlane(double nearPlane) {_nearPlane=nearPlane;} + + /**get the near plane. */ + double getNearPlane() const {return _nearPlane;} + + /** set the far plane. */ + void setFarPlane(double farPlane) {_farPlane=farPlane;} + + /** get the far plane. */ + double getFarPlane() const {return _farPlane;} + + + + /** Set up the OpenGL GL_PROJECTION matrix. + Enters the GL_PROJECTION mode, sets up matrix, then + resets model GL_MODELVIEW, which is by OpenGL convention the default.*/ + void draw_PROJECTION() const; + + /** Set up the OpenGL GL_MODELVIEW matrix. + * Enters the GL_MODELVIEW mode, sets matrix to identity + * and then sets matrix up according to camera, eye point, center + * point and upvector. + */ + void draw_MODELVIEW() const; + + + + /** post multiply a camera by matrix.*/ + void mult(const Camera& camera,const Matrix& m); + + /** pre multiply a camera by matrix.*/ + void mult(const Matrix& m,const Camera& camera); + + void ensureOrthogonalUpVector(); + + + private: + + // Disallow copy construction & assignment (for now) + Camera(const Camera&); + Camera& operator=(const Camera&); + + Vec3 _eyePoint; + Vec3 _lookPoint; + Vec3 _upVector; + + double _fovy; + double _aspectRatio; + + double _nearPlane; // No Dougal, these are small... but those... + double _farPlane; // are far away + + +}; + +} + +# endif diff --git a/include/osg/CullFace b/include/osg/CullFace new file mode 100644 index 000000000..391a07b92 --- /dev/null +++ b/include/osg/CullFace @@ -0,0 +1,51 @@ +#ifndef OSG_CULLFACE +#define OSG_CULLFACE 1 + +#include +#include +#include + +namespace osg { + +/** Class to globally enable/disable OpenGL's polygon culling mode + (GL_CULL_FACE). +*/ +class SG_EXPORT CullFace : public Object +{ + public : + + enum Mode { + FRONT = GL_FRONT, + BACK = GL_BACK, + FRONT_AND_BACK = GL_FRONT_AND_BACK + }; + + CullFace(); + static CullFace* instance(); + virtual bool isSameKindAs(Object* obj) { return dynamic_cast(obj)!=NULL; } + virtual Object* clone() const { return new CullFace(); } + virtual const char* className() const { return "CullFace"; } + + void setMode(Mode mode) { _mode = mode; } + + /** Enable the polygon culling mode.*/ + static void enable(); + /** Disable the polygon culling mode.*/ + static void disable(); + + void apply(); + + protected: + + virtual ~CullFace(); + + virtual bool readLocalData(Input& fr); + virtual bool writeLocalData(Output& fw); + + Mode _mode; + +}; + +}; + +#endif diff --git a/include/osg/DCS b/include/osg/DCS new file mode 100644 index 000000000..c947b4ef0 --- /dev/null +++ b/include/osg/DCS @@ -0,0 +1,45 @@ +#ifndef OSG_DCS +#define OSG_DCS 1 + +#include +#include + +namespace osg { + +/** DCS - Dynamic Coordinate System a is group which all children + are transformed by the the DCS's osg::Matrix. Typical uses + of the DCS is for positioning objects within a scene or + producing trakerball functionality. +*/ +class SG_EXPORT DCS : public Group +{ + public : + DCS(); + DCS(const Matrix& matix); + + virtual Object* clone() const { return new DCS(); } + virtual bool isSameKindAs(Object* obj) { return dynamic_cast(obj)!=NULL; } + virtual const char* className() const { return "DCS"; } + virtual void accept(NodeVisitor& nv) { nv.apply(*this); } + + void setMatrix(const Matrix& mat ); + Matrix* getMatrix() { return _mat; } + + void preTranslate( float tx, float ty, float tz ); + void preRotate( float deg, float x, float y, float z ); + + bool computeBound(); + + protected : + + virtual ~DCS(); + + virtual bool readLocalData(Input& fr); + virtual bool writeLocalData(Output& fw); + + Matrix *_mat; +}; + +}; + +#endif diff --git a/include/osg/DynamicLibrary b/include/osg/DynamicLibrary new file mode 100644 index 000000000..6b5f9c49f --- /dev/null +++ b/include/osg/DynamicLibrary @@ -0,0 +1,51 @@ +#ifndef OSG_DYNAMICLIBRARY +#define OSG_DYNAMICLIBRARY 1 + +#include +#include + +#ifdef WIN32 +//#include +#endif + +namespace osg { + +/** DynamicLibrary - encapsulates the loading and unloading of dynamic libraries, + typically used for loading ReaderWriter plug-ins. +*/ +class SG_EXPORT DynamicLibrary : public Referenced +{ + public: + + #ifdef WIN32 + // from Snados.h + typedef void* HANDLE; + // from Delayimp.h + typedef void* PROC_ADDRESS; + #else + typedef void* HANDLE; + typedef void* PROC_ADDRESS; + #endif + + static DynamicLibrary* loadLibrary(const std::string& libraryName); + + const std::string& getName() const { return _name; } + const std::string& getFullName() const { return _fullName; } + HANDLE getHandle() const { return _handle; } + + PROC_ADDRESS getProcAddress(const std::string& procName); + + protected: + + DynamicLibrary(const std::string& name,HANDLE handle); + ~DynamicLibrary(); + + HANDLE _handle; + std::string _name; + std::string _fullName; + +}; + +}; + +#endif // __DYNAMIC_LIBRARY_H diff --git a/include/osg/Export b/include/osg/Export new file mode 100644 index 000000000..44f9b0ee7 --- /dev/null +++ b/include/osg/Export @@ -0,0 +1,32 @@ +#ifndef OSG_EXPORT +#define OSG_EXPORT 1 + +#ifdef WIN32 + #pragma warning( disable : 4251 ) + #pragma warning( disable : 4275 ) + #pragma warning( disable : 4786 ) + +/* Define NULL pointer value */ + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + + +#endif + +#if defined(_MSC_VER) + # ifdef SG_LIBRARY + # define SG_EXPORT __declspec(dllexport) + # else + # define SG_EXPORT __declspec(dllimport) + # endif /* SG_LIBRARY */ +#else + # define SG_EXPORT +#endif + +#endif diff --git a/include/osg/ExtensionSupported b/include/osg/ExtensionSupported new file mode 100644 index 000000000..f1dabc999 --- /dev/null +++ b/include/osg/ExtensionSupported @@ -0,0 +1,15 @@ +#ifndef OSG_EXTENSIONSUPPORTED +#define OSG_EXTENSIONSUPPORTED 1 + +#include + +namespace osg { + +/** return true if OpenGL "extension" is supported. + note: Must only called within a valid OpenGL context, + undefined behaviour may occur otherwise.*/ +SG_EXPORT extern bool ExtensionSupported(const char *extension); + +}; + +#endif diff --git a/include/osg/Field b/include/osg/Field new file mode 100644 index 000000000..6e9f81e3d --- /dev/null +++ b/include/osg/Field @@ -0,0 +1,100 @@ +#ifndef OSG_FIELD +#define OSG_FIELD 1 + +#include +#include +#include + +namespace osg { + + +class SG_EXPORT Field +{ + public: + + enum { + MIN_CACHE_SIZE = 256 + }; + + Field(); + Field(const Field& field); + virtual ~Field(); + + virtual Field& operator = (const Field& ic); + + void reset(); + void addChar(char c); + int getNoCharacters() const { return _fieldCacheSize; } + + void setWithinQuotes(bool withinQuotes=true); + bool getWithinQuotes(); + + void setNoNestedBrackets(int no); + int getNoNestedBrackets(); + + enum FieldType + { + OPEN_BRACKET, + CLOSE_BRACKET, + STRING, + WORD, + REAL, + INTEGER, + BLANK, + UNINTIALISED + }; + + FieldType getFieldType() const; + + bool isValid() const; + + bool isOpenBracket() const; + bool isCloseBracket() const; + + bool isWord() const; + bool matchWord(const char* str) const; + bool matchWord(const char* str,int noCharacters) const; + + bool isString() const; + bool matchString(const char* str) const; + bool matchString(const char* str,int noCharacters) const; + bool isQuotedString() const; + + const char* getStr() const; + char* takeStr(); + + bool isInt() const; + bool matchInt(int i) const; + bool getInt(int& i) const; + + bool isFloat() const; + bool matchFloat(float f) const; + bool getFloat(float& f) const; + + bool isDouble() const; + bool matchDouble(double f) const; + bool getDouble(double& d) const; + + static FieldType calculateFieldType(const char* str,bool withinQuotes=false); + + protected: + + void _init(); + void _free(); + void _copy(const Field& ic); + + int _fieldCacheCapacity; + int _fieldCacheSize; + char* _fieldCache; + + mutable FieldType _fieldType; + + bool _withinQuotes; + + int _noNestedBrackets; + +}; + +}; + +#endif // __SG_FIELD_H diff --git a/include/osg/FieldReader b/include/osg/FieldReader new file mode 100644 index 000000000..e2941897e --- /dev/null +++ b/include/osg/FieldReader @@ -0,0 +1,62 @@ +#ifndef OSG_FIELDREADER +#define OSG_FIELDREADER 1 + +#include +#include +#include + +#ifdef OSG_USE_IO_DOT_H +#include +#else +#include +using namespace std; +#endif + +namespace osg { + +class Field; + +class SG_EXPORT FieldReader +{ + public: + + FieldReader(); + FieldReader(const FieldReader& ic); + virtual ~FieldReader(); + + virtual FieldReader& operator = (const FieldReader& ic); + + void attach(istream* input); + void detach(); + + virtual bool eof() const; + + bool readField(Field& fieldPtr); + void ignoreField(); + + /** no of unmatched `{' encounterd so far in file*/ + int getNoNestedBrackets() const; + + private: + + bool _readField(Field* fieldPtr); + + void _init(); + void _free(); + void _copy(const FieldReader& ic); + + istream* _fin; + bool _eof; + + bool findStartOfNextField(); + + int _noNestedBrackets; + + bool _delimatorEatLookUp[256]; + bool _delimatorKeepLookUp[256]; + +}; + +}; + +#endif // __SG_FIELD_READER_H diff --git a/include/osg/FieldReaderIterator b/include/osg/FieldReaderIterator new file mode 100644 index 000000000..2d91dc5dd --- /dev/null +++ b/include/osg/FieldReaderIterator @@ -0,0 +1,68 @@ +#ifndef OSG_FIELDREADERITERATOR +#define OSG_FIELDREADERITERATOR 1 + +#include +#include + +namespace osg { + + +class SG_EXPORT FieldReaderIterator +{ + public: + + enum { + MINIMUM_FIELD_READER_QUEUE_SIZE = 10 + }; + + FieldReaderIterator(); + FieldReaderIterator(const FieldReaderIterator& ic); + virtual ~FieldReaderIterator(); + + virtual FieldReaderIterator& operator = (const FieldReaderIterator& ic); + + void attach(istream* input); + void detach(); + + virtual bool eof() const; + + FieldReader& getFieldReader() { return _reader; } + + void insert(int pos,Field* field); + void insert(int pos,const char* str); + + Field& operator [] (int pos); + Field& field (int pos); + + FieldReaderIterator& operator ++ (); + FieldReaderIterator& operator += (int no); + +/** increments the itetor of the next simple field or + whole block if the current field[0] is an open bracket */ + void advanceOverCurrentFieldOrBlock(); + void advanceToEndOfCurrentBlock(); + void advanceToEndOfBlock(int noNestBrackets); + + bool matchSequence(const char* str); + + private: + + void _init(); + void _free(); + void _copy(const FieldReaderIterator& ic); + + FieldReader _reader; + + Field _blank; + + Field* _previousField; + + Field** _fieldQueue; + int _fieldQueueSize; + int _fieldQueueCapacity; + +}; + +}; + +#endif // __OSG_FIELD_READER_QUEUE_H diff --git a/include/osg/FileNameUtils b/include/osg/FileNameUtils new file mode 100644 index 000000000..e61face84 --- /dev/null +++ b/include/osg/FileNameUtils @@ -0,0 +1,18 @@ +#ifndef OSG_FILENAMEUTILS +#define OSG_FILENAMEUTILS 1 + +#include + +#include + +namespace osg { + +SG_EXPORT extern std::string getFilePath(const std::string& filename); +SG_EXPORT extern std::string getFileExtension(const std::string& filename); +SG_EXPORT extern std::string getLowerCaseFileExtension(const std::string& filename); +SG_EXPORT extern std::string getSimpleFileName(const std::string& fileName); +SG_EXPORT extern std::string getStrippedName(const std::string& fileName); + +}; + +#endif diff --git a/include/osg/Fog b/include/osg/Fog new file mode 100644 index 000000000..2f96a2ad6 --- /dev/null +++ b/include/osg/Fog @@ -0,0 +1,66 @@ +#ifndef OSG_FOG +#define OSG_FOG 1 + +#include +#include +#include +#include + +namespace osg { + + +/** Fog - encapsulates OpenGL fog state. */ +class SG_EXPORT Fog : public Object +{ + public : + + enum FogMode { + LINEAR = GL_LINEAR, + EXP = GL_EXP, + EXP2 = GL_EXP2 + }; + + Fog( void ); + static Fog* instance(); + virtual Object* clone() const { return new Fog(); } + virtual bool isSameKindAs(Object* obj) { return dynamic_cast(obj)!=NULL; } + virtual const char* className() const { return "Fog"; } + + static void enable( void ); + static void disable( void ); + void apply( void ); + + void setMode( uint mode ) { _mode = mode; } + uint getMode( void ) { return _mode; } + + void setDensity( float density ) { _density = density; } + float getDensity( void ) { return _density; } + + void setStart( float start ) { _start = start; } + float getStart( void ) { return _start; } + + void setEnd( float end ) { _end = end; } + float getEnd( void ) { return _end; } + + void setColor( Vec4 &color ) + { + _color[0] = color[0]; + _color[1] = color[1]; + _color[2] = color[2]; + _color[3] = color[3]; + } + + protected : + + virtual ~Fog( void ); + + uint _mode; + float _density; + float _start; + float _end; + Vec4 _color; +}; + +}; + +#endif diff --git a/include/osg/GL b/include/osg/GL new file mode 100644 index 000000000..e2f6c71a3 --- /dev/null +++ b/include/osg/GL @@ -0,0 +1,71 @@ +#ifndef OSG_GL +#define OSG_GL 1 + +#ifdef WIN32 + + // this works with no problems +// #ifndef _WINDOWS_ +// #define WIN32_LEAN_AND_MEAN +// #include +// #endif + +// follows lifted from glut.h, to avoid including + +//#if defined(_WIN32) + +// GLUT 3.7 now tries to avoid including +// to avoid name space pollution, but Win32's +// needs APIENTRY and WINGDIAPI defined properly. +# if 0 +# define WIN32_LEAN_AND_MEAN +# include +# else + // XXX This is from Win32's +# ifndef APIENTRY +# define GLUT_APIENTRY_DEFINED +# if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) +# define APIENTRY __stdcall +# else +# define APIENTRY +# endif +# endif + // XXX This is from Win32's +# ifndef CALLBACK +# if (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS) +# define CALLBACK __stdcall +# else +# define CALLBACK +# endif +# endif + // XXX This is from Win32's and +# ifndef WINGDIAPI +# define GLUT_WINGDIAPI_DEFINED +# define WINGDIAPI __declspec(dllimport) +# endif + // XXX This is from Win32's +# ifndef _WCHAR_T_DEFINED +typedef unsigned short wchar_t; +# define _WCHAR_T_DEFINED +# endif +# endif + + + + #ifndef __gl_h_ + #include + #endif + #ifndef __glu_h__ + #include + #endif + +#else + + // GL_GLEXT_LEGACY required by some Linux OpenGL implementations + // to allow compilation of glPointParameterfEXT. + #define GL_GLEXT_LEGACY 1 + #include + #include + #include +#endif + +#endif // __osgGL_h diff --git a/include/osg/GeoSet b/include/osg/GeoSet new file mode 100644 index 000000000..ac040a004 --- /dev/null +++ b/include/osg/GeoSet @@ -0,0 +1,468 @@ +#ifndef OSG_GEOSET +#define OSG_GEOSET 1 + +#include +#include +#include +#include +#include + +namespace osg { + + +class Input; +class Output; + +/** Encapsulates OpenGL drawing primitives, geometry and + optional binding of normal, color and texture coordinates. Used + for representing the visible objects in the scene. State attributes + for a GeoSet are maintained in GeoState which the GeoSet maintains + a referenced counted pointer to. Both GeoSet's and GeoState's can + be shared for optimal memory usage and graphics performance. +*/ +class SG_EXPORT GeoSet : public Object +{ + public: + + enum PrimitiveType { + NO_TYPE, + POINTS, + LINES, + LINE_STRIP, + FLAT_LINE_STRIP, + LINE_LOOP, + TRIANGLES, + TRIANGLE_STRIP, + FLAT_TRIANGLE_STRIP, + TRIANGLE_FAN, + FLAT_TRIANGLE_FAN, + QUADS, + QUAD_STRIP, + POLYGON + }; + + enum BindingType { + BIND_OFF, + BIND_OVERALL, + BIND_PERPRIM, + BIND_PERVERTEX, + BIND_DEFAULT + }; + + enum InterleaveArrayType { + IA_OFF, + IA_V2F, + IA_V3F, + IA_C4UB_V2F, + IA_C4UB_V3F, + IA_C3F_V3F, + IA_N3F_V3F, + IA_C4F_N3F_V3F, + IA_T2F_V3F, + IA_T4F_V4F, + IA_T2F_C4UB_V3F, + IA_T2F_C3F_V3F, + IA_T2F_N3F_V3F, + IA_T2F_C4F_N3F_V3F, + IA_T4F_C4F_N3F_V4F + }; + + GeoSet(); + static GeoSet* instance(); + virtual Object* clone() const { return new GeoSet(); } + virtual bool isSameKindAs(Object* obj) { return dynamic_cast(obj)!=NULL; } + virtual const char* className() const { return "Geoset"; } + + + // data access methods. + void setNumPrims( int n ) { _numprims = n; } + int getNumPrims( void ) { return _numprims; } + + void setPrimType( PrimitiveType type ); + PrimitiveType getPrimType( void ) { return _primtype; } + + void setPrimLengths( int *lens ) { _primLengths = lens; } + int *getPrimLengths( void ) { return _primLengths; } + + void computeNumVerts(); + + /** get the number of coords required by the defined primitives. */ + int getNumCoords() { return _numcoords; } + /** get a pointer to Vec3 coord array. */ + Vec3* getCoords() { return _coords; } + /** get the number of indices required by the defined primitives. */ + int getNumIndices() { return _numindices; } + /** get the coord index array. */ + ushort* getCIndex() { return _cindex; } + /** set the coords (i.e the geometry) of the geoset.*/ + void setCoords( Vec3 *cp ); + /** set the coords (i.e the geometry) and indices of the geoset.*/ + void setCoords( Vec3 *cp, ushort *ci ); + + /** get the number of normals required by the defined primitives and normals binding.*/ + int getNumNormals() { return _numnormals; } + /** get a pointer to Vec3 normal array. */ + Vec3* getNormals() { return _normals; } + /** get the number of normal indices required by the defined primitives and normals binding.*/ + int getNumNIndices() { return _numnindices; } + /** get the normal index array. */ + ushort* getNIndex() { return _nindex; } + /** set the normals of the geoset.*/ + void setNormals( Vec3 *np ); + /** set the normals and normal indices of the geoset.*/ + void setNormals( Vec3 *np, ushort *ni ); + /** set the normals binding to the vertices/primitives/overall.*/ + void setNormalBinding( BindingType binding ); + BindingType getNormalBinding() { return _normal_binding; } + + /** get the number of colors required by the defined primitives and color binding.*/ + int getNumColors() { return _numcolors; } + /** get a pointer to Vec4 color array. */ + Vec4* getColors() { return _colors; } + /** get the number of colors indices required by the defined primitives and color binding.*/ + int getNumCIndices() { return _numcindices; } + /** get the color index array. */ + ushort* getColIndex() { return _colindex; } + /** set the colors of the geoset.*/ + void setColors( Vec4 *lp ); + /** set the colors and color indices of the geoset.*/ + void setColors( Vec4 *lp, ushort *li ); + /** set the color binding to the vertices/primitives/overall.*/ + void setColorBinding( BindingType binding ); + BindingType getColorBinding() { return _color_binding; } + + /** get the number of texture coords required by the defined primitives and textures binding.*/ + int getNumTCoords() { return _numtcoords; } + /** get a pointer to Vec4 color array. */ + Vec2* getTCoords() { return _tcoords; } + /** get the number of texture coord indices required by the defined primitives and texture binding.*/ + int getNumTIndices() { return _numtindices; } + /** get the texture index array. */ + ushort* getTIndex() { return _tindex; } + /** set the texture coords of the geoset.*/ + void setTextureCoords( Vec2 *tc ); + /** set the texture coords and texture coord indices of the geoset.*/ + void setTextureCoords( Vec2 *tc, ushort *ti ); + /** set the texture coord binding to the vertices/primitives/overall.*/ + void setTextureBinding( BindingType binding ); + BindingType getTextureBinding() { return _texture_binding; } + + void setInterleavedArray( InterleaveArrayType format, float *ia ); + void setInterleavedArray( InterleaveArrayType format, float *ia, ushort *iai ); + + void setGeoState(GeoState *state) { _state = state; } + GeoState* getGeoState() const { return _state.get();} + + + /** When set to true, force the draw method to use OpenGL Display List for rendering. + If false rendering directly. If the display list has not been already + compile the next call to draw will automatically create the display list.*/ + void setUseDisplayList(bool flag); + + /** Return whether OpenGL display lists are being used for rendering.*/ + bool getUseDisplayList() { return _useDisplayList; } + + /** Force a recompile on next draw() of any OpenGL display list associated with this geoset.*/ + void dirtyDisplayList(); + + /** get bounding box of geoset. + * Note, now made virtual to make it possible to implement user-drawn + * objects albiet so what crudely, to be improved later. + */ + virtual const BoundingBox& getBound() ; + + /** draw geoset. + * If the geoset has _useDisplayList set to true then use an OpenGL display + * list, automatically compiling one if required. + * Otherwise call drawImmediateMode(). + * Note, draw method should not be overiden in subclasses as it + * manages the optional display list. + */ + void draw( void ); + + + /** draw geoset directly ignoring an OpenGL display list which could be attached. + * This is the internal draw method which does the drawing itself, + * and is the method to override when deriving from GeoSet for user-drawn objects. + */ + virtual void drawImmediateMode(); + + /** Immediately compile this geoset into an OpenGL Display List, set _useDisplayList to true.*/ + void compile( void ); + + bool check(); + + protected: + + GeoSet(const GeoSet&):Object() {} + GeoSet& operator = (const GeoSet&) { return *this;} + + virtual ~GeoSet(); + + bool matchBindingTypeStr(const char* str,BindingType& mode); + const char* getBindingTypeStr(BindingType mode); + + virtual bool readLocalData(Input& fr); + virtual bool writeLocalData(Output& fw); + + private : + + int _numprims; + PrimitiveType _primtype; + int _needprimlen; + unsigned int _oglprimtype; + int *_primLengths; + int _numverts; + unsigned char _primlength; + unsigned char _flat_shaded_skip; + + int _numcoords; + int _numindices; + Vec3 *_coords; + ushort *_cindex; + + int _numnormals; + int _numnindices; + Vec3 *_normals; + ushort *_nindex; + BindingType _normal_binding; + + int _numcolors; + int _numcindices; + Vec4 *_colors; + ushort *_colindex; + BindingType _color_binding; + + int _numtcoords; + int _numtindices; + Vec2 *_tcoords; + ushort *_tindex; + BindingType _texture_binding; + + void *_iarray; + ushort *_iaindex; + InterleaveArrayType _iaformat; + unsigned int _ogliaformat; + + + /** return the bbbbffff composition required for an interleaved array row.*/ + const char* getInterleavedRowComposition(InterleaveArrayType at) const; + /** return the number of bytes required for an interleaved array row.*/ + int getInterleavedRowLength(InterleaveArrayType at) const; + + + int _fast_path; + + ref_ptr _state; + + bool _useDisplayList; + uint _globj; + + BoundingBox _bbox; + int _bbox_computed; + + void computeBound( void ); + void set_fast_path( void ); + void draw_fast_path( void ); + void draw_alternate_path( void ); + +}; + +/** Template function for iterating through a GeoSet operating on triangles + with templated functor. Function automatically decomposes quads and polygons + into sub triangles which are passed onto functor.*/ +template +void for_each_triangle(GeoSet& gset,T& op) +{ + switch(gset.getPrimType()) + { + case(GeoSet::TRIANGLE_STRIP): + case(GeoSet::FLAT_TRIANGLE_STRIP): + { + if (gset.getCIndex()) + { + ushort* iptr = gset.getCIndex(); + Vec3* vptr = gset.getCoords(); + const int numPrim = gset.getNumPrims(); + for(int i=0; i0) + { + const Vec3& start = vptr[*(iptr)]; + ushort* iend = iptr+primLength; + ++iptr; + for(int j = 2; j < primLength; ++j ) + { + op(start,vptr[*(iptr)],vptr[*(iptr+1)]); + ++iptr; + } + iptr=iend; + } + } + } + else + { + Vec3* vptr = gset.getCoords(); + const int numPrim = gset.getNumPrims(); + for(int i=0; i0) + { + const Vec3& start = *vptr; + Vec3* vend = vptr+primLength; + ++vptr; + for(int j = 2; j < primLength; ++j) + { + op(start,*(vptr),*(vptr+1)); + ++vptr; + } + vptr = vend; + } + } + } + } + break; + default: + break; + } + +}; + + +}; + +#endif diff --git a/include/osg/GeoState b/include/osg/GeoState new file mode 100644 index 000000000..a634190a9 --- /dev/null +++ b/include/osg/GeoState @@ -0,0 +1,150 @@ +#ifndef OSG_GEOSTATE +#define OSG_GEOSTATE 1 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace osg { + +class Input; +class Output; + +/** +Encapsulates OpenGL state modes and attributes. +Used to specificy textures etc of osg::GeoSet's which hold references +to a single osg::GeoState. GeoState can be shared between GeoSet's +and is recommend if possible as it minimize expensive state changes +in the graphics pipeline. +*/ +class SG_EXPORT GeoState : public Object +{ + public : + + enum AttributeType + { + ANTIALIAS, + FACE_CULL, + FOG, + LIGHTING, + MATERIAL, + POINT, + POLYGON_OFFSET, + TEXENV, + TEXGEN, + TEXMAT, + TEXTURE, + TRANSPARENCY, + WIREFRAME, + ALPHAFUNC + }; + + enum AttributeMode + { + INHERIT, + OFF, + ON, + OVERRIDE_OFF, + OVERRIDE_ON, + }; + + GeoState(); + static GeoState* instance(); + virtual Object* clone() const { return new GeoState(); } + virtual bool isSameKindAs(Object* obj) { return dynamic_cast(obj)!=NULL; } + const char* className() const { return "GeoState"; } + + /** set all the modes to on or off so that it defines a + complete state, typically used for a default global state.*/ + void setGlobalDefaults(); + + /** set all the modes to inherit, typically used to signifiy + nodes which inherit all of their modes for the global state.*/ + void setAllToInherit(); + + void setMode(AttributeType type, AttributeMode mode); + AttributeMode getMode(AttributeType type) const; + + void setAttribute(AttributeType type, Object *attribute); + Object* getAttribute(AttributeType type) const; + + bool isTransparent() { return _transparencing==ON; } + + void apply(); + void apply(GeoState* global,GeoState* prev); + + bool check(); + + static AttributeMode combineMode(const AttributeMode g,const AttributeMode p,const AttributeMode c) + { + AttributeMode gp = mergeMode(g,p); + AttributeMode gc = mergeMode(g,c); + if (gc==gp) return INHERIT; + else return gc; + } + + static AttributeMode mergeMode(const AttributeMode lhs,const AttributeMode rhs) + { + AttributeMode mode; + if (rhs==INHERIT || lhs==OVERRIDE_OFF || lhs==OVERRIDE_ON) mode = lhs; + else mode = rhs; + if (mode==OVERRIDE_OFF) return OFF; + else if (mode==OVERRIDE_OFF) return ON; + return mode; + } + + protected : + + + virtual ~GeoState(); + + GeoState(const GeoState&):Object() {} + GeoState& operator = (const GeoState&) { return *this; } + + virtual bool readLocalData(Input& fr); + virtual bool writeLocalData(Output& fw); + + bool matchModeStr(const char* str, AttributeMode& mode); + const char* getModeStr(AttributeMode flag); + + // Modes + AttributeMode _transparencing; + AttributeMode _face_culling; + AttributeMode _lighting; + AttributeMode _texturing; + AttributeMode _fogging; + AttributeMode _texgening; + AttributeMode _antialiasing; + AttributeMode _colortable; + AttributeMode _pointSmoothing; + AttributeMode _polygonOffsetting; + AttributeMode _alphaTesting; + + // Attributes + ref_ptr _texture; + ref_ptr _texgen; + ref_ptr _material; + ref_ptr _texenv; + ref_ptr _transparency; + ref_ptr _texmat; + ref_ptr _fog; + ref_ptr _point; + ref_ptr _polygonOffset; + ref_ptr _cullFace; + ref_ptr _alphaFunc; +}; + +}; + +#endif diff --git a/include/osg/Geode b/include/osg/Geode new file mode 100644 index 000000000..24e268c65 --- /dev/null +++ b/include/osg/Geode @@ -0,0 +1,108 @@ +#ifndef OSG_GEODE +#define OSG_GEODE 1 + +#include + +#include +#include +#include + +#include + +namespace osg { + +/** Leaf Node for grouping GeoSets.*/ +class SG_EXPORT Geode : public Node +{ + public: + + typedef std::vector< ref_ptr > GeoSetList; + + Geode(); + + virtual Object* clone() const { return new Geode(); } + virtual bool isSameKindAs(Object* obj) { return dynamic_cast(obj)!=NULL; } + virtual const char* className() const { return "Geode"; } + virtual void accept(NodeVisitor& nv) { nv.apply(*this); } + + /** Add GeoSet to Geode. + * If gset is not NULL and is not contained in Geode then increment its + * reference count, add it to the geosets list and dirty the bounding + * sphere to force it to recompute on next getBound() and return true for success. + * Otherwise return false. + */ + virtual bool addGeoSet( GeoSet *gset ); + + /** Remove GeoSet from Geode. + * If gset is contained in Geode then remove it from the geoset + * list and decrement its reference count, and dirty the + * bounding sphere to force it to recompute on next getBound() and + * return true for success. If gset is not found then return false + * and do not change the reference count of gset. + */ + virtual bool removeGeoSet( GeoSet *gset ); + + /** Replace specified GeoSet with another GeoSet. + * Decrement the reference count origGSet and increments the + * reference count of newGset, and dirty the bounding sphere + * to force it to recompute on next getBound() and returns true. + * If origGeoSet is not found then return false and do not + * add newGset. If newGset is NULL then return false and do + * not remove origGset. + */ + virtual bool replaceGeoSet( GeoSet *origGset, GeoSet *newGset ); + + + /** return the number of geoset's.*/ + int getNumGeosets( void ) const { return _geosets.size(); } + + /** return geoset at position i.*/ + GeoSet* getGeoSet( int i ) { return _geosets[i].get(); } + + /** return true is geoset is contained within Geode.*/ + bool containsGeoSet( GeoSet* gset) + { + + for (GeoSetList::iterator itr=_geosets.begin(); + itr!=_geosets.end(); + ++itr) + { + if (itr->get()==gset) return true; + } + return false; + } + + /** return the iterator postion for specified GeoSet. + * return _geoset.end() if gset not is contained in Geode. + */ + GeoSetList::iterator findGeoSet( GeoSet* gset) + { + + for (GeoSetList::iterator itr=_geosets.begin(); + itr!=_geosets.end(); + ++itr) + { + if (itr->get()==gset) return itr; + } + return _geosets.end(); + } + + /** complile OpenGL Display List for each geoset.*/ + void compileGeoSets( void ); + + protected: + + virtual ~Geode(); + + virtual bool readLocalData(Input& fr); + virtual bool writeLocalData(Output& fw); + + virtual bool computeBound( void ); + + GeoSetList _geosets; + +}; + +}; + +#endif diff --git a/include/osg/Group b/include/osg/Group new file mode 100644 index 000000000..5fa9abf6b --- /dev/null +++ b/include/osg/Group @@ -0,0 +1,106 @@ +#ifndef OSG_GROUP +#define OSG_GROUP 1 + +#include +#include + +#include + +namespace osg { + +/** General group node which maintains a list of children. + Children are reference counted to allow children to be shared + with memory management handled automatically via osg::Referenced. +*/ +class SG_EXPORT Group : public Node +{ + public : + + typedef std::vector > ChildList; + + Group(); + + virtual Object* clone() const { return new Group(); } + virtual bool isSameKindAs(Object* obj) { return dynamic_cast(obj)!=NULL; } + virtual const char* className() const { return "Group"; } + virtual void accept(NodeVisitor& nv) { nv.apply(*this); } + + virtual void traverse(NodeVisitor& nv); + + /** Add Node to Group. + * If node is not NULL and is not contained in Group then increment its + * reference count, add it to the child list and dirty the bounding + * sphere to force it to recompute on next getBound() and return true for success. + * Otherwise return false. + */ + virtual bool addChild( Node *child ); + + /** Remove Node from Group. + * If Node is contained in Group then remove it from the child + * list, decrement its reference count, and dirty the + * bounding sphere to force it to recompute on next getBound() and + * return true for success. If Node is not found then return false + * and do not change the reference count of the Node. + */ + virtual bool removeChild( Node *child ); + + /** Replace specified Node with another Node. + * Decrement the reference count origNode and increments the + * reference count of newNode, and dirty the bounding sphere + * to force it to recompute on next getBound() and returns true. + * If origNode is not found then return false and do not + * add newNode. If newNode is NULL then return false and do + * not remove origNode. + */ + virtual bool replaceChild( Node *origChild, Node* newChild ); + + /** return the number of chilren nodes.*/ + int getNumChildren( void ) { return _children.size(); } + + /** return child node at position i.*/ + Node *getChild( int i ) { return _children[i].get(); } + + /** return true is node is contained within Group.*/ + bool containsNode( Node* node ) + { + + for (ChildList::iterator itr=_children.begin(); + itr!=_children.end(); + ++itr) + { + if (itr->get()==node) return true; + } + return false; + } + + /** return the iterator postion for specified Node. + * return _chilren.end() if node is not contained in Group. + */ + ChildList::iterator findNode( Node* node ) + { + + for (ChildList::iterator itr=_children.begin(); + itr!=_children.end(); + ++itr) + { + if (itr->get()==node) return itr; + } + return _children.end(); + } + + protected: + + virtual ~Group(); + + virtual bool readLocalData(Input& fr); + virtual bool writeLocalData(Output& fw); + + ChildList _children; + + bool computeBound( void ); + +}; + +}; + +#endif diff --git a/include/osg/Image b/include/osg/Image new file mode 100644 index 000000000..e395de8a3 --- /dev/null +++ b/include/osg/Image @@ -0,0 +1,98 @@ +#ifndef OSG_IMAGE +#define OSG_IMAGE 1 + +#include +#include + +namespace osg { + +class Output; +class Input; + +/** Image class for encapsulating the storage texture image data.*/ +class SG_EXPORT Image : public Object +{ + + public : + + Image(); + + virtual Object* clone() const { return new Image(); } + virtual bool isSameKindAs(Object* obj) { return dynamic_cast(obj)!=NULL; } + virtual const char* className() const { return "Image"; } + + + const char* getFileName() { return _fileName; } + void setFileName(const char* fileName); + + /** set the image data and format. + * note, when no packing value is negative (the default is -1) this method assumes + * a _packing width of 1 if the width is not a multiple of 4, + * otherwise automatically sets to _packing to 4. If a postive + * value of packing is supplied than _packing is simply set to that value. + */ + void setImage(int s,int t,int r, + int internalFormat, + unsigned int pixelFormat, + unsigned int dataType, + unsigned char *data, + int packing=-1); + + /** Width of image.*/ + int s() { return _s; } + /** Height of image.*/ + int t() { return _t; } + /** Depth of image.*/ + int r() { return _r; } + + int internalFormat() { return _internalFormat; } + unsigned int pixelFormat() { return _pixelFormat; } + unsigned int dataType() { return _dataType; } + unsigned int packing() { return _packing; } + + /** raw image data.*/ + unsigned char *data() { return _data; } + + /** Scale image to specified size. */ + void scaleImage(int s,int t,int r); + + /** Ensure image dimensions are a power of two. + * Mip Mapped texture require the image dimensions to be + * power of two. + */ + void ensureDimensionsArePowerOfTwo(); + + protected : + + virtual ~Image(); + +// Image(const Image&) {} +// Image& operator = (const Image& image) {} + + virtual bool readLocalData(Input& fr); + virtual bool writeLocalData(Output& fw); + + char* _fileName; + int _s, _t, _r; + int _internalFormat; + unsigned int _pixelFormat; + unsigned int _dataType; + unsigned int _packing; + unsigned char *_data; + +}; + +class Geode; + +/** Convinience function to be used by images loaders to generate a valid geode to return for readNode(). + * Use the images s and t values scale the dimensions of the image. + */ +SG_EXPORT extern Geode* createGeodeForImage(Image* image); +/** Convinience function to be used by images loaders to generate a valid geode to return for readNode(). + * Use the specified s and t values scale the dimensions of the image. + */ +SG_EXPORT extern Geode* createGeodeForImage(Image* image,float s,float t); + +}; + +#endif // __SG_IMAGE_H diff --git a/include/osg/Input b/include/osg/Input new file mode 100644 index 000000000..bb763af4f --- /dev/null +++ b/include/osg/Input @@ -0,0 +1,49 @@ +#ifndef OSG_INPUT +#define OSG_INPUT 1 + +#include + +#include +#include + +namespace osg { + +class Object; +class Image; +class Node; + +/** Class for managing the reading of ASCII .osg files.*/ +class SG_EXPORT Input : public FieldReaderIterator +{ + public: + +// Will extend to handle #DEF and use +// functionality similar to Inventor, +// and add the ability to handle #include +// from within the OSG file format. + + Input(); + virtual ~Input(); + + virtual Object* readObject(); + virtual Object* readObject(const std::string& fileName); + + virtual Image* readImage(); + virtual Image* readImage(const std::string& fileName); + + virtual Node* readNode(); + virtual Node* readNode(const std::string& fileName); + + virtual Object* getObjectForUniqueID(const std::string& uniqueID); + virtual void regisiterUniqueIDForObject(const std::string& uniqueID,Object* obj); + + private: + + typedef std::map UniqueIDToObjectMapping; + UniqueIDToObjectMapping _uniqueIDToObjectMap; + +}; + +}; + +#endif // __SG_INPUT_H diff --git a/include/osg/LOD b/include/osg/LOD new file mode 100644 index 000000000..d6c6fb8e1 --- /dev/null +++ b/include/osg/LOD @@ -0,0 +1,67 @@ +#ifndef OSG_LOD +#define OSG_LOD 1 + +#include + +#include + +namespace osg { + +/** LOD - Level Of Detail group node which allows switching between children + depending on distance from eye point. + Typical uses are for load balancing - objects further away from + the eye point are rendered at a lower level of detail, and at times + of high stress on the graphics pipeline lower levels of detail can + also be chosen. +*/ +class SG_EXPORT LOD : public Group +{ + public : + LOD() {} + + virtual Object* clone() const { return new LOD(); } + virtual bool isSameKindAs(Object* obj) { return dynamic_cast(obj)!=NULL; } + virtual const char* className() const { return "LOD"; } + virtual void accept(NodeVisitor& nv) { nv.apply(*this); } + virtual void traverse(NodeVisitor& nv); + + /** Sets the value of range list element index to range which + is a floating point distance specified in world coordinates. + Range list automatically expands to accomodate values beyond + the current getNumRanges().*/ + void setRange(unsigned int index, float range); + /** pfLOD::getRange returns the range element index.*/ + float getRange(unsigned int index) { return _rangeList[index]; } + /** returns the number of ranges currently set.*/ + int getNumRanges() { return _rangeList.size(); } + + /** Sets the object-space point which defines the center of the osg::LOD. + center is affected by any transforms in the hierarchy above the osg::LOD.*/ + void setCenter(const Vec3 ¢er) { _center = center; } + /** return the LOD center point. */ + const Vec3& getCenter() { return _center; } + + + /** return the child to traverse. + Selected by the distance between the eye point in local + coordinates and the LOD center, mutliplied by the bias.*/ + int evaluate(const Vec3& eye_local,float bias=1.0f); + + + protected : + virtual ~LOD() {} + + virtual bool readLocalData(Input& fr); + virtual bool writeLocalData(Output& fw); + + typedef std::vector RangeList; + RangeList _rangeList; + RangeList _rangeList2; + + Vec3 _center; + +}; + +}; + +#endif diff --git a/include/osg/Light b/include/osg/Light new file mode 100644 index 000000000..f8d4c0243 --- /dev/null +++ b/include/osg/Light @@ -0,0 +1,143 @@ +#ifndef OSG_LIGHT +#define OSG_LIGHT 1 + +#include +#include +#include + +namespace osg { + +/** Light state class which encapsulates OpenGL glLight() functionality.*/ +class SG_EXPORT Light : public Object +{ + public : + + Light(); + + /** return a static instance of an osg::Light, to be used as prototype + for loading lights.*/ + static Light* instance(); + + /** return a shallow copy of a node, with Object* return type.*/ + virtual Object* clone() const { return new Light(); } + + virtual bool isSameKindAs(Object* obj) { return dynamic_cast(obj)!=NULL; } + + /** return the name of the node's class type.*/ + virtual const char* className() const { return "Light"; } + + + + /** + * Turn the light on. + * Calling this method doesn't directly affect OpenGL's lighting mode. + */ + void on( void ) { _on = true; } + + /** + * Turn the light off. + * Calling this method doesn't directly affect OpenGL's lighting mode. + */ + void off( void ) { _on = false; } + + /** Enable OpenGL's Lighting mode. */ + static void enable( void ); + + /** Disable OpenGL's Lighting mode. */ + static void disable( void ); + + /** Apply the light's state to the OpenGL state machine. */ + void apply( void ); + + /** Set the ambient component of the light. */ + void setAmbient( const Vec4& ambient ) { _ambient = ambient; } + + /** Get the ambient component of the light. */ + const Vec4& getAmbient() const { return _ambient; } + + /** Set the diffuse component of the light. */ + void setDiffuse( const Vec4& diffuse ) { _diffuse = diffuse; } + + /** Get the diffuse component of the light. */ + const Vec4& getDiffuse() const { return _diffuse; } + + /** Set the specular component of the light. */ + void setSpecular( const Vec4& specular ) { _specular = specular; } + + /** Get the specular component of the light. */ + const Vec4& getSpecular() const { return _specular; } + + /** Set the position of the light. */ + void setPosition( const Vec4& position ) { _position = position; } + + /** Get the position of the light. */ + const Vec4& getPosition() const { return _position; } + + /** Set the direction of the light. */ + void setDirection( const Vec3& direction ) { _direction = direction; } + + /** Get the direction of the light. */ + const Vec3& getDirection() const { return _direction; } + + /** Set the constant attenuation of the light. */ + void setConstantAttenuation( float constant_attenuation ) { _constant_attenuation = constant_attenuation; } + + /** Get the constant attenuation of the light. */ + float setConstantAttenuation() const { return _constant_attenuation; } + + /** Set the linear attenuation of the light. */ + void setLinearAttenuation ( float linear_attenuation ) { _linear_attenuation = linear_attenuation; } + + /** Get the linear attenuation of the light. */ + float getLinearAttenuation () const { return _linear_attenuation; } + + /** Set the quadratic attenuation of the light. */ + void setQuadraticAttenuation ( float quadratic_attenuation ) { _quadratic_attenuation = quadratic_attenuation; } + + /** Get the quadratic attenuation of the light. */ + float getQuadraticAttenuation() const { return _quadratic_attenuation; } + + /** Set the spot exponent of the light. */ + void setSpotExponent( float spot_exponent ) { _spot_exponent = spot_exponent; } + + /** Get the spot exponent of the light. */ + float getSpotExponent() const { return _spot_exponent; } + + /** Set the spot cutoff of the light. */ + void setSpotCutoff( float spot_cutoff ) { _spot_cutoff = spot_cutoff; } + + /** Get the spot cutoff of the light. */ + float getSpotCutoff() { return _spot_cutoff; } + + /** + * Capture the lighting settings of the current OpenGL state + * and store them in this object. + */ + void captureLightState(); + + protected : + + virtual ~Light( void ); + + /** Initialize the light's settings with some decent defaults. */ + void init( void ); + + int _lightnum; // OpenGL light number + bool _on; // on/off state + Vec4 _ambient; // r, g, b, w + Vec4 _diffuse; // r, g, b, w + Vec4 _specular; // r, g, b, w + Vec4 _position; // x, y, z, w + Vec3 _direction; // x, y, z + float _constant_attenuation; // constant + float _linear_attenuation; // linear + float _quadratic_attenuation; // quadratic + float _spot_exponent; // exponent + float _spot_cutoff; // spread + + static int _currentLightNum; // current max. OpenGL light number +}; + +}; + +#endif diff --git a/include/osg/LightSource b/include/osg/LightSource new file mode 100644 index 000000000..fa41cd358 --- /dev/null +++ b/include/osg/LightSource @@ -0,0 +1,42 @@ +#ifndef OSG_LIGHTSOURCE +#define OSG_LIGHTSOURCE 1 + +#include +#include +#include + +namespace osg { + +/** Leaf Node for defining a light in the scene.*/ +class SG_EXPORT LightSource : public Node +{ + public: + + LightSource(); + + virtual Object* clone() const { return new LightSource(); } + virtual bool isSameKindAs(Object* obj) { return dynamic_cast(obj)!=NULL; } + virtual const char* className() const { return "LightSource"; } + virtual void accept(NodeVisitor& nv) { nv.apply(*this); } + + /** Set the attached light.*/ + void setLight(Light* light) { _light = light; } + + /** Get the attached light.*/ + Light* getLight() { return _light.get(); } + + protected: + + virtual ~LightSource(); + + virtual bool readLocalData(Input& fr); + virtual bool writeLocalData(Output& fw); + + virtual bool computeBound( void ); + + ref_ptr _light; +}; + +}; + +#endif diff --git a/include/osg/Lighting b/include/osg/Lighting new file mode 100644 index 000000000..776ecd9c3 --- /dev/null +++ b/include/osg/Lighting @@ -0,0 +1,21 @@ +#ifndef OSG_LIGHTING +#define OSG_LIGHTING 1 + +#include + +namespace osg { + +/** Class to globally control OpenGL's lighting.*/ + +class SG_EXPORT Lighting +{ + public : + /** Enable lighting.*/ + static void enable(); + /** Disable lighting.*/ + static void disable(); +}; + +}; + +#endif diff --git a/include/osg/Material b/include/osg/Material new file mode 100644 index 000000000..a0aec7488 --- /dev/null +++ b/include/osg/Material @@ -0,0 +1,100 @@ +#ifndef OSG_MATERIAL +#define OSG_MATERIAL 1 + +#include +#include +#include +#include + +namespace osg { + + +class Input; +class Output; + +class SG_EXPORT Material : public Object +{ + + public : + + enum MaterialFace { + FACE_FRONT = GL_FRONT, + FACE_BACK = GL_BACK, + FACE_FRONT_AND_BACK = GL_FRONT_AND_BACK + }; + + enum ColorMode { + AMBIENT = GL_AMBIENT, + DIFFUSE = GL_DIFFUSE, + SPECULAR = GL_SPECULAR, + EMISSION = GL_EMISSION, + AMBIENT_AND_DIFFUSE = GL_AMBIENT_AND_DIFFUSE, + OFF + }; + + Material( void ); + static Material* instance(); + virtual Object* clone() const { return new Material(); } + virtual bool isSameKindAs(Object* obj) { return dynamic_cast(obj)!=NULL; } + const char* className() const { return "Material"; } + + void apply( void ); + + void setColorMode(ColorMode mode) { _colorMode = mode; } + + void setAmbient( MaterialFace face, const Vec4& ambient ); + const Vec4& getAmbient(MaterialFace face) const; + bool getAmbientFrontAndBack() { return _ambientFrontAndBack; } + + void setDiffuse( MaterialFace face, const Vec4& diffuse ); + const Vec4& getDiffuse(MaterialFace face) const; + bool getDiffuseFrontAndBack() { return _diffuseFrontAndBack; } + + void setSpecular( MaterialFace face, const Vec4& specular ); + const Vec4& getSpecular(MaterialFace face) const; + bool getSpecularFrontAndBack() { return _specularFrontAndBack; } + + void setEmission( MaterialFace face, const Vec4& emission ); + const Vec4& getEmission(MaterialFace face) const; + bool getEmissionFrontAndBack() { return _emissionFrontAndBack; } + + void setShininess( MaterialFace face, float shininess ); + float getShininess(MaterialFace face) const; + bool getShininessFrontAndBack() { return _shininessFrontAndBack; } + + protected : + + virtual ~Material( void ); + + virtual bool readLocalData(Input& fr); + virtual bool writeLocalData(Output& fw); + + bool matchFaceAndColor(Input& fr,const char* name,MaterialFace& mf,Vec4& color); + + ColorMode _colorMode; + + bool _ambientFrontAndBack; + Vec4 _ambientFront; // r, g, b, w + Vec4 _ambientBack; // r, g, b, w + + bool _diffuseFrontAndBack; + Vec4 _diffuseFront; // r, g, b, w + Vec4 _diffuseBack; // r, g, b, w + + bool _specularFrontAndBack; + Vec4 _specularFront; // r, g, b, w + Vec4 _specularBack; // r, g, b, w + + bool _emissionFrontAndBack; + Vec4 _emissionFront; // r, g, b, w + Vec4 _emissionBack; // r, g, b, w + + bool _shininessFrontAndBack; + float _shininessFront; // values 0 - 1.0 + float _shininessBack; // values 0 - 1.0 + +}; + +}; + +#endif diff --git a/include/osg/Matrix b/include/osg/Matrix new file mode 100644 index 000000000..5fe633c0d --- /dev/null +++ b/include/osg/Matrix @@ -0,0 +1,107 @@ +#ifndef OSG_MATRIX +#define OSG_MATRIX 1 + +#include +#include + +namespace osg { + +class Input; +class Output; + +/** 4x4 Matrix for storage & manipulation of transformations in scene graph. + Provides basic maths operations, IO and via osg::Object reference counting. +*/ +class SG_EXPORT Matrix : public Object +{ + public: + Matrix(); + Matrix(const Matrix& matrix); + Matrix( float a00, float a01, float a02, float a03, + float a10, float a11, float a12, float a13, + float a20, float a21, float a22, float a23, + float a30, float a31, float a32, float a33); + + Matrix& operator = (const Matrix& matrix); + + virtual ~Matrix(); + + static Matrix* instance(); + virtual Object* clone() const { return new Matrix(); } + virtual bool isSameKindAs(Object* obj) { return dynamic_cast(obj)!=NULL; } + virtual const char* className() const { return "Matrix"; } + + void makeIdent(); + + void set(const float* m); + void copy(const Matrix& matrix); + + void makeScale(float sx, float sy, float sz); + void preScale( float sx, float sy, float sz, const Matrix& m ); + void postScale( const Matrix& m, float sx, float sy, float sz ); + + void preScale( float sx, float sy, float sz ); + void postScale( float sx, float sy, float sz ); + + + void makeTrans( float tx, float ty, float tz ); + void preTrans( float tx, float ty, float tz, const Matrix& m ); + void postTrans( const Matrix& m, float tx, float ty, float tz ); + + void preTrans( float tx, float ty, float tz ); + void postTrans( float tx, float ty, float tz ); + + + void makeRot( float deg, float x, float y, float z ); + void preRot( float deg, float x, float y, float z, const Matrix& m ); + void postRot( const Matrix& m, float deg, float x, float y, float z ); + + void preRot( float deg, float x, float y, float z ); + void postRot( float deg, float x, float y, float z ); + + void setTrans( float tx, float ty, float tz ); + void setTrans( const Vec3& v ); + Vec3 getTrans() const { return Vec3(_mat[3][0],_mat[3][1],_mat[3][2]); } + + void preMult(const Matrix& m); + void postMult(const Matrix& m); + void mult(const Matrix& lhs,const Matrix& rhs); + + Matrix operator * (const Matrix& m) const; + + inline Vec3 operator * (const Vec3& v) const; + inline friend Vec3 operator * (const Vec3& v,const Matrix& m); + + bool invert(const Matrix& m); + + public : + float _mat[4][4]; + + protected: + + virtual bool readLocalData(Input& fr); + virtual bool writeLocalData(Output& fw); +}; + +// post multiple v. ie. (m*v) +inline Vec3 Matrix::operator * (const Vec3& v) const +{ + float d = 1.0f/(_mat[3][0]*v.x()+_mat[3][1]*v.y()+_mat[3][2]*v.z()+_mat[3][3]) ; + return Vec3( (_mat[0][0]*v.x() + _mat[0][1]*v.y() + _mat[0][2]*v.z() + _mat[0][3])*d, + (_mat[1][0]*v.x() + _mat[1][1]*v.y() + _mat[1][2]*v.z() + _mat[1][3])*d, + (_mat[2][0]*v.x() + _mat[2][1]*v.y() + _mat[2][2]*v.z() + _mat[2][3])*d) ; +} + + +// pre multiple v. ie. (v*m) +inline Vec3 operator * (const Vec3& v,const Matrix& m) +{ + float d = 1.0f/(m._mat[0][3]*v.x()+m._mat[1][3]*v.y()+m._mat[2][3]*v.z()+m._mat[3][3]) ; + return Vec3( (m._mat[0][0]*v.x() + m._mat[1][0]*v.y() + m._mat[2][0]*v.z() + m._mat[3][0])*d, + (m._mat[0][1]*v.x() + m._mat[1][1]*v.y() + m._mat[2][1]*v.z() + m._mat[3][1])*d, + (m._mat[0][2]*v.x() + m._mat[1][2]*v.y() + m._mat[2][2]*v.z() + m._mat[3][2])*d); +} + +}; + +#endif diff --git a/include/osg/Node b/include/osg/Node new file mode 100644 index 000000000..1f39e92ea --- /dev/null +++ b/include/osg/Node @@ -0,0 +1,211 @@ +#ifndef OSG_NODE +#define OSG_NODE 1 + +#include +#include +#include + +#include +#include + +namespace osg { + +class NodeVisitor; +class Group; + +/** Class for adapting the memory management of external data. + * Typically used to specify the memory management of user data + * which can be attached to osg::Node. + */ +class SG_EXPORT MemoryAdapter : public Referenced +{ + public: + MemoryAdapter() {} + + /** Increment the reference count of the userData.*/ + virtual void incrementReference(void* /*userData*/) = 0; + + /** Decrement the reference count of the userData. + Is usually implemented such that if reference count + is decremented to zero the userData should be + deleted. However, this is entirely up to the + discression of the user who is extending this base class.*/ + virtual void decrementReference(void* /*userData*/) = 0; + + /** not current used, but will be used in future.*/ + virtual void* clone(void* /*userData*/) { return 0L; } + + /** not current used, but will be used in future.*/ + virtual bool write(Output& /*fw*/,void* /*userData*/) { return false; } + + /** not current used, but will be used in future.*/ + virtual bool read(Input& /*fr*/,void* /*userData*/) { return false; } + + protected: + + virtual ~MemoryAdapter() {} +}; + +/** Base class for all internal nodes in the scene graph. + Provides interface for most common node operations (Composite Pattern). +*/ +class SG_EXPORT Node : public Object +{ + public: + + /** Construct a node. + Initialize the parent list to empty, node name to "" and + bounding sphere dirty flag to true.*/ + Node(); + + /** return a shallow copy of a node, with Object* return type.*/ + virtual Object* clone() const { return new Node(); } + /** return a shallow copy of a node, with Node* return type.*/ + Node* cloneNode() const { return (Node*)clone(); } + + /** return true if this and obj are of the same kind of object.*/ + virtual bool isSameKindAs(Object* obj) { return dynamic_cast(obj)!=NULL; } + + /** return the name of the node's class type.*/ + virtual const char* className() const { return "Node"; } + + /** Visitor Pattern : calls the apply method of a NodeVisitor with this node's type.*/ + virtual void accept(NodeVisitor& nv); + /** Traverse upwards : calls parents' accept method with NodeVisitor.*/ + virtual void ascend(NodeVisitor& nv); + /** Traverse downwards : calls children's accept method with NodeVisitor.*/ + virtual void traverse(NodeVisitor& /*nv*/) {} + + + /** Set the name of node using C++ style string.*/ + void setName( const std::string& name ) { _name = name; } + /** Set the name of node using a C style string.*/ + void setName( const char* name ) { _name = name; } + /** Get the name of node.*/ + const std::string& getName( void ) { return _name; } + + + /** A vector of osg::Group pointers which is used to store the parent(s) of node.*/ + typedef std::vector ParentList; + + /** Get the parent list of node. */ + const ParentList& getParents() const { return _parents; } + /** + * Get a single parent of node. + * @param i index of the parent to get. + * @return the parent i. + */ + Group* getParent(int i) const { return _parents[i]; } + /** + * Get the number of parents of node. + * @return the number of parents of this node. + */ + int getNumParents() const { return _parents.size(); } + + + /** + * Set user data. See MemoryAdapter documention for details + * of how to specify memory managament of _userData. + */ + void setUserData(void* data,MemoryAdapter* ma=0L) + { + if (_userData && _memoryAdapter.valid()) _memoryAdapter->decrementReference(_userData); + _userData = data; + _memoryAdapter = ma; + if (_userData && _memoryAdapter.valid()) _memoryAdapter->incrementReference(_userData); + } + /** Get user data.*/ + void* getUserData() const { return _userData; } + + /** Get the memory adapter associated with _userData.*/ + MemoryAdapter* getMemoryAdapter() const { return _memoryAdapter.get(); } + + + typedef unsigned int NodeMask; + /** Set the node mask. Note, node mask is will be replaced by TraversalMask.*/ + void setNodeMask(NodeMask nm) { _nodeMask = nm; } + /** Get the node Mask. Note, node mask is will be replaced by TraversalMask.*/ + NodeMask getNodeMask() { return _nodeMask; } + + + + /** A vector of std::string's which are used to describe the object.*/ + typedef std::vector DescriptionList; + + /** Get the description list of the const node.*/ + const DescriptionList& getDescriptions() const { return _descriptions; } + /** Get the description list of the const node.*/ + DescriptionList& getDescriptions() { return _descriptions; } + /** Get a single const description of the const node.*/ + const std::string& getDescription(int i) const { return _descriptions[i]; } + /** Get a single description of the node.*/ + std::string& getDescription(int i) { return _descriptions[i]; } + /** Get the number of descriptions of the node.*/ + int getNumDescriptions() const { return _descriptions.size(); } + /** Add a description string to the node.*/ + void addDescription(const std::string& desc) { _descriptions.push_back(desc); } + + /** get the bounding sphere of node. + Using lazy evaluation computes the bounding sphere if it is 'dirty'.*/ + const BoundingSphere& getBound(); + + /** Mark this node's bounding sphere dirty. + Forcing it to be computed on the next call to getBound().*/ + void dirtyBound(); + + + protected: + + /** Node destructor. Note, is protected so that Nodes cannot + be deleted other than by being dereferenced and the reference + count being zero (see osg::Referenced), preventing the deletion + of nodes which are still in use. This also means that + Node's cannot be created on stack i.e Node node will not compile, + forcing all nodes to be created on the heap i.e Node* node + = new Node().*/ + virtual ~Node(); + + /** + * Template Method Pattern : read local data from .osg file. + * Note should be implemented in derived classes, which + * call their parent class's readLocalData. + * @return true if the input iterator has been advanced, otherwise false. + */ + virtual bool readLocalData(Input& fr); + + /** + * Template Method Pattern : read local data from .osg file. + * Note should be implemented in derivied classes, which + * call their parent class's writeLocalData. + * @return true if data has been written out, otherwise false. + */ + virtual bool writeLocalData(Output& fw); + + /** Compute the bounding sphere around Node's geometry or children. + This method is automatically called by getBound() when the bounding + sphere has been marked dirty via dirtyBound().*/ + virtual bool computeBound( void ) ; + + BoundingSphere _bsphere; + bool _bsphere_computed; + + std::string _name; + + ParentList _parents; + friend Group; + + void* _userData; + ref_ptr _memoryAdapter; + + NodeMask _nodeMask; + + DescriptionList _descriptions; + +}; + +/** A vector of Nodes pointers which is used to describe the path from a root node to a descendant.*/ +typedef std::vector NodePath; + +}; + +#endif diff --git a/include/osg/NodeVisitor b/include/osg/NodeVisitor new file mode 100644 index 000000000..86011f43a --- /dev/null +++ b/include/osg/NodeVisitor @@ -0,0 +1,94 @@ +#ifndef OSG_NODEVISITOR +#define OSG_NODEVISITOR 1 + +#include + +namespace osg { + +class Geode; +class Billboard; +class LightSource; +class Group; +class DCS; +class LOD; +class Sequence; +class Scene; +class Switch; + +/** Visitor for type safe operations on osg::Node's. + Based on GOF's Visitor pattern.*/ +class SG_EXPORT NodeVisitor : public Referenced +{ + public: + + enum TraversalMode { + TRAVERSE_NONE, + TRAVERSE_PARENTS, + TRAVERSE_ALL_CHILDREN, + TRAVERSE_ACTIVE_CHILDREN, + TRAVERSE_VISITOR + }; + + NodeVisitor(TraversalMode tm=TRAVERSE_NONE); + virtual ~NodeVisitor(); + + + /** Set the traversal mode for Node::traverse() to use when + deciding which children of a node to traverse. If a + NodeVisitor has been attached via setTraverseVisitor() + and the new mode is not TRAVERSE_VISITOR then the attached + visitor is detached. Default mode is TRAVERSE_NONE.*/ + void setTraverseMode(TraversalMode mode); + /** Get the traversal mode.*/ + TraversalMode getTraverseMode() { return _traverseMode; } + /** Set a visitor to handle traversal. + Overides the traverse mode setting it to TRAVERSE_VISITOR.*/ + + void setTraverseVisitor(NodeVisitor* nv); + /** Get the traverse visitor, returns NULL if none is attached.*/ + NodeVisitor* getTraverseVisitor() { return _traverseVisitor; } + + /** Inline method for passing handling traversal of a nodes. + If you intend to use the visitor for actively traversing + the scene graph then make sure the accept() methods call + this method unless they handle traversal directly.*/ + void traverse(Node& node) + { + if (_traverseVisitor) node.accept(*_traverseVisitor); + else if (_traverseMode==TRAVERSE_PARENTS) node.ascend(*this); + else if (_traverseMode!=TRAVERSE_NONE) node.traverse(*this); + } + + virtual void apply(Node& node) { traverse(node);} + + virtual void apply(Geode& node) { apply((Node&)node); } + virtual void apply(Billboard& node){ apply((Geode&)node); } + virtual void apply(LightSource& node){ apply((Node&)node); } + + virtual void apply(Group& node) { apply((Node&)node); } + virtual void apply(DCS& node) { apply((Group&)node); } + virtual void apply(Switch& node) { apply((Group&)node); } + virtual void apply(Sequence& node) { apply((Group&)node); } + virtual void apply(LOD& node) { apply((Group&)node); } + virtual void apply(Scene& node) { apply((Group&)node); } + + protected: + + NodeVisitor* _traverseVisitor; + TraversalMode _traverseMode; + +}; + + +/** Convinience functor for assisting visiting of arrays of osg::Node's.*/ +struct NodeAcceptOp +{ + NodeVisitor& _nv; + NodeAcceptOp(NodeVisitor& nv):_nv(nv) {} + void operator () (Node* node) { node->accept(_nv); } + void operator () (ref_ptr node) { node->accept(_nv); } +}; + +}; + +#endif diff --git a/include/osg/Notify b/include/osg/Notify new file mode 100644 index 000000000..23fbd9b5a --- /dev/null +++ b/include/osg/Notify @@ -0,0 +1,64 @@ +#ifndef OSG_NOTIFY +#define OSG_NOTIFY 1 + +#include + +#ifdef OSG_USE_IO_DOT_H +#include +#include +//#include +#else +#include +#include +//#include +using namespace std; +#endif + + +namespace osg { + +enum NotifySeverity { + ALWAYS=0, + FATAL=1, + WARN=2, + NOTICE=3, + INFO=4, + DEBUG=5, + FP_DEBUG=6 +}; + +extern NotifySeverity g_NotifyLevel; +extern ofstream *g_absorbStreamPtr; + +SG_EXPORT extern void setNotifyLevel(NotifySeverity severity); +SG_EXPORT extern int getNotifyLevel(); + +#ifdef WIN32 +inline ostream& notify(NotifySeverity severity=INFO) +{ + if (severity<=osg::WARN) return cerr; + else return cout; +} + +#else +SG_EXPORT extern ostream& notify(NotifySeverity severity=INFO); +#endif + +// A nifty_counter to ensure that the notify things are initialised before +// they're used. Initialises g_NotifyLevel and g_absorbStreamPointer +class SG_EXPORT NotifyInit +{ + public: + + NotifyInit(); + ~NotifyInit(); + + private: + static int count_; +}; + +static NotifyInit niftyNotifyInit; + +}; + +#endif diff --git a/include/osg/OSG b/include/osg/OSG new file mode 100644 index 000000000..7ee651ef6 --- /dev/null +++ b/include/osg/OSG @@ -0,0 +1,15 @@ +#ifndef OSG_OSG +#define OSG_OSG 1 + +#include + +namespace osg { + +SG_EXPORT extern void Init( void ); +SG_EXPORT extern void SetFilePath( const char *_path ); +SG_EXPORT extern char *FindFile( const char *file ); +SG_EXPORT extern char *findDSO( const char *name ); + +}; + +#endif diff --git a/include/osg/Object b/include/osg/Object new file mode 100644 index 000000000..f95399c17 --- /dev/null +++ b/include/osg/Object @@ -0,0 +1,76 @@ +#ifndef OSG_OBJECT +#define OSG_OBJECT 1 + +#include + +namespace osg { + +class Input; +class Output; + +/** Base class/standard interface for objects which require IO support, + cloning and reference counting. + Based on GOF Composite, Prototype and Template Method patterns. +*/ +class SG_EXPORT Object : public Referenced +{ + public: + /** Construct an object. Note Object is a pure virtual base class + and therefore cannot be constructed on its own, only derived + classes which overide the clone and className methods are + concrete classes and can be constructed.*/ + Object() {} + + /** return a shallow copy of a node, with Object* return type. + Must be defined by derived classes.*/ + virtual Object* clone() const = 0; + + virtual bool isSameKindAs(Object*) { return true; } + + /** return the name of the object's class type. Must be defined + by derived classes.*/ + virtual const char* className() const = 0; + + /** Template Method/Prototype Pattern : create a clone and read + Object data from Input. Reads Input and if it matches this + objects className() then create a clone and match '{' brackets + and repeating calling Object::readLocalData() until the + matching ']' is read.*/ + virtual Object* readClone(Input& fr); + /** Template Method Pattern : write out Object data to Output. + Sequence of output is className() followed by Open '{' + and then call Object::writeLocalData() and complete with '}'.*/ + virtual bool write(Output& fw); + + protected: + + /** Object destructor. Note, is protected so that Objects cannot + be deleted other than by being derefernced and the reference + count being zero (see osg::Referenced), preventing the deletion + of nodes which are still in use. This also means that + Node's cannot be created on stack i.e Node node will not compile, + forcing all nodes to be created on the heap i.e Node* node + = new Node().*/ + virtual ~Object() {} + + /** Template Method Pattern : read local data from .osg file. + Note should be implemented in derivied classes, which + call their parent class's readLocalData. Returns + true if the input iterator has been advanced, otherwise false.*/ + virtual bool readLocalData(Input&) { return false; } + /** Template Method Pattern : write local data to .osg file. + Note should be implemented in derivied classes, which + call their parent class's writeLocalData. Returns + true if data has been written out, otherwise false.*/ + virtual bool writeLocalData(Output&) { return false; } + + private: + + /** disallow any form of deep copy.*/ + Object(Object&): Referenced() {} + Object& operator = (const Object&) { return *this; } +}; + +}; + +#endif diff --git a/include/osg/Output b/include/osg/Output new file mode 100644 index 000000000..a10350c95 --- /dev/null +++ b/include/osg/Output @@ -0,0 +1,98 @@ +#ifndef OSG_OUTPUT +#define OSG_OUTPUT 1 + +#include + +#include +#include + +#ifdef OSG_USE_IO_DOT_H +#include +#else +#include +using namespace std; +#endif + +namespace osg { + +class Object; + +/** ofstream wrapper class for adding support for indenting. + Used in output of .osg ASCII files to improve their readability.*/ +class SG_EXPORT Output : public ofstream +{ + public: + + Output(); + virtual ~Output(); + + Output& indent(); + + int getIndentStep() const { return _indentStep; } + void setIndentStep(int step) { _indentStep = step; } + + int getIndent() const { return _indent; } + void setIndent(int indent) { _indent = indent; } + + int getNumIndicesPerLine() const { return _numIndicesPerLine; } + void setNumIndicesPerLine(int num) { _numIndicesPerLine = num; } + + void moveIn(); + void moveOut(); + + bool getUniqueIDForObject(Object* obj,std::string& uniqueID); + bool createUniqueIDForObject(Object* obj,std::string& uniqueID); + bool registerUniqueIDForObject(Object* obj,std::string& uniqueID); + + + protected: + + // prevent copy construction and assignment. + Output(const Output&) : ofstream() {} + Output& operator = (const Output&) { return *this; } + + virtual void _init(); + virtual void _free(); + + int _indent; + int _indentStep; + + int _numIndicesPerLine; + + typedef std::map UniqueIDToLabelMapping; + UniqueIDToLabelMapping _objectToUniqueIDMap; + +}; + +template +bool writeArrayBlock(Output& fw,T* start,T* finish) +{ + fw.indent() << "{" << endl; + fw.moveIn(); + int numIndicesThisLine = 0; + for(T* itr=start;itr!=finish;++itr) + { + if (numIndicesThisLine>=fw.getNumIndicesPerLine()) + { + fw << endl; + numIndicesThisLine = 0; + } + + if (numIndicesThisLine==0) fw.indent(); + else fw << " "; + + fw << *itr; + + ++numIndicesThisLine; + + } + fw << endl; + fw.moveOut(); + fw.indent() << "}" << endl; + return true; +} + + +}; + +#endif // __SG_OUTPUT_H diff --git a/include/osg/Point b/include/osg/Point new file mode 100644 index 000000000..d426c51cd --- /dev/null +++ b/include/osg/Point @@ -0,0 +1,49 @@ +#ifndef OSG_POINT +#define OSG_POINT 1 + +#include +#include +#include + +namespace osg { + +class Input; +class Output; + +class SG_EXPORT Point : public Object +{ + public : + + Point(); + static Point* instance(); + virtual Object* clone() const { return new Point(); } + virtual bool isSameKindAs(Object* obj) { return dynamic_cast(obj)!=NULL; } + virtual const char* className() const { return "Point"; } + + void setSize(float size); + void setFadeThresholdSize(float fadeThresholdSize); + void setDistanceAttenuation(const Vec3& distanceAttenuation); + + static void enableSmooth( void ); + static void disableSmooth( void ); + + void apply( void ); + + static void init_GL_EXT(); + + protected : + + virtual ~Point(); + + virtual bool readLocalData(Input& fr); + virtual bool writeLocalData(Output& fw); + + float _size; + float _fadeThresholdSize; + Vec3 _distanceAttenuation; + +}; + +}; + +#endif diff --git a/include/osg/PolygonOffset b/include/osg/PolygonOffset new file mode 100644 index 000000000..f156fffd5 --- /dev/null +++ b/include/osg/PolygonOffset @@ -0,0 +1,44 @@ +#ifndef OSG_POLYGONOFFSET +#define OSG_POLYGONOFFSET 1 + +#include +#include +#include + +namespace osg { + +class Input; +class Output; + +class SG_EXPORT PolygonOffset : public Object +{ + public : + + PolygonOffset(); + static PolygonOffset* instance(); + virtual Object* clone() const { return new PolygonOffset(); } + virtual bool isSameKindAs(Object* obj) { return dynamic_cast(obj)!=NULL; } + virtual const char* className() const { return "PolygonOffset"; } + + void setOffset(float factor,float units); + + static void enable( void ); + static void disable( void ); + + void apply( void ); + + protected : + + virtual ~PolygonOffset(); + + virtual bool readLocalData(Input& fr); + virtual bool writeLocalData(Output& fw); + + float _factor; + float _units; + +}; + +}; + +#endif diff --git a/include/osg/Quat b/include/osg/Quat new file mode 100644 index 000000000..aa3190cd9 --- /dev/null +++ b/include/osg/Quat @@ -0,0 +1,231 @@ +#ifndef OSG_QUAT +#define OSG_QUAT 1 + +#include +#include + +#include +#include +#include + +namespace osg { + +/** A quaternion class. It can be used to represent an orientation in 3D space.*/ +class SG_EXPORT Quat +{ + + public: + + /* ---------------------------------------------------------- + DATA MEMBERS + The only data member is a + Vec4 which holds the elements + + In other words, osg:Quat is composed of an osg::Vec4 + The osg::Quat aggregates an osg::Vec4 + + These seem to be different jargons for the same thing :-) + ---------------------------------------------------------- */ + Vec4 _fv; // a four-vector + + /* ---------------------------------- + CONSTRUCTORS + Default constructor + One to accept four floats + One to accept a Vec4 + These are implemented in Quat.cpp + ---------------------------------- */ + Quat( void ); + Quat( float x, float y, float z, float w ); + Quat( const Vec4& vec ); + + /* ---------------------------------- + Methods to access data members + ---------------------------------- */ + inline Vec4 asVec4( void ) const + { + return _fv; + } + + inline Vec3 asVec3( void ) const + { + return Vec3(_fv[0], _fv[1], _fv[2]); + } + + /* ------------------------------------------------------------- + BASIC ARITHMETIC METHODS + Implemented in terms of Vec4s. Some Vec4 operators, e.g. + operator* are not appropriate for quaternions (as + mathematical objects) so they are implemented differently. + Also define methods for conjugate and the multiplicative inverse. + ------------------------------------------------------------- */ + /// Multiply by scalar + inline Quat operator * (const float& rhs) const + { + return Quat(_fv*rhs); + } + + /// Unary multiply by scalar + inline Quat& operator *= (const float& rhs) + { + _fv*=rhs; + return *this; // enable nesting + } + + /// Binary multiply + inline Quat operator*(const Quat& rhs) const + { + return Quat( _fv[3]*rhs._fv[0] + _fv[0]*rhs._fv[3] + _fv[1]*rhs._fv[2] - _fv[2]*rhs._fv[1], + _fv[3]*rhs._fv[1] - _fv[0]*rhs._fv[2] + _fv[1]*rhs._fv[3] + _fv[2]*rhs._fv[0], + _fv[3]*rhs._fv[2] + _fv[0]*rhs._fv[1] - _fv[1]*rhs._fv[0] + _fv[2]*rhs._fv[3], + _fv[3]*rhs._fv[3] - _fv[0]*rhs._fv[0] - _fv[1]*rhs._fv[1] - _fv[2]*rhs._fv[2] ); + } + + /// Unary multiply + inline Quat& operator*=(const Quat& rhs) + { + float x = _fv[3]*rhs._fv[0] + _fv[0]*rhs._fv[3] + _fv[1]*rhs._fv[2] - _fv[2]*rhs._fv[1]; + float y = _fv[3]*rhs._fv[1] - _fv[0]*rhs._fv[2] + _fv[1]*rhs._fv[3] + _fv[2]*rhs._fv[0]; + float z = _fv[3]*rhs._fv[2] + _fv[0]*rhs._fv[1] - _fv[1]*rhs._fv[0] + _fv[2]*rhs._fv[3]; + _fv[3] = _fv[3]*rhs._fv[3] - _fv[0]*rhs._fv[0] - _fv[1]*rhs._fv[1] - _fv[2]*rhs._fv[2]; + + _fv[2] = z; + _fv[1] = y; + _fv[0] = x; + + return (*this); // enable nesting + } + + /// Divide by scalar + inline Quat operator / (const float& rhs) const + { + return Quat(_fv/rhs); + } + + /// Unary divide by scalar + inline Quat& operator /= (const float& rhs) + { + _fv/=rhs; + return *this; + } + + /// Binary divide + inline Quat operator/(const Quat& denom) const + { + return ( (*this) * denom.inverse() ); + } + + /// Unary divide + inline Quat& operator/=(const Quat& denom) + { + (*this) = (*this) * denom.inverse(); + return (*this); // enable nesting + } + + /// Binary addition + inline Quat operator + (const Quat& rhs) const + { + return Quat( _fv + rhs._fv ); + } + + /// Unary addition + inline Quat& operator += (const Quat& rhs) + { + _fv += rhs._fv; + return *this; // enable nesting + } + + /// Binary subtraction + inline Quat operator - (const Quat& rhs) const + { + return Quat( _fv - rhs._fv ); + } + + /// Unary subtraction + inline Quat& operator -= (const Quat& rhs) + { + _fv-=rhs._fv; + return *this; // enable nesting + } + + /** Negation operator - returns the negative of the quaternion. + Basically just calls operator - () on the Vec4 */ + inline Quat operator - () const + { + return Quat ( -_fv ); + } + + /// Length of the quaternion = sqrt( vec . vec ) + float length( void ) const + { + return _fv.length(); + } + + /// Length of the quaternion = vec . vec + float length2( void ) const + { + return _fv.length2(); + } + + /// Conjugate + inline Quat conj ( void ) const + { + return Quat( -_fv[0], -_fv[1], -_fv[2], _fv[3] ); + } + + /// Multiplicative inverse method: q^(-1) = q^*/(q.q^*) + inline Quat inverse ( void ) const + { + return conj() / length2(); + } + + /* -------------------------------------------------------- + METHODS RELATED TO ROTATIONS + Set a quaternion which will perform a rotation of an + angle around the axis given by the vector (x,y,z). + Should be written to also accept an angle and a Vec3? + + Define Spherical Linear intERPolation method also + + Not inlined - see the Quat.cpp file for implementation + -------------------------------------------------------- */ + void makeRot ( const float angle, + const float x, const float y, const float z ); + void makeRot ( const float angle, const Vec3& vec ); + + /** Make a rotation Quat which will rotate vec1 to vec2. + Generally take adot product to get the angle between these + and then use a cross product to get the rotation axis + Watch out for the two special cases of when the vectors + are co-incident or opposite in direction.*/ + void makeRot( const Vec3& vec1, const Vec3& vec2 ); + + /** Return the angle and vector components represented by the quaternion.*/ + void getRot ( float& angle, float& x, float& y, float& z ) const; + /** Return the angle and vector represented by the quaternion.*/ + void getRot ( float& angle, Vec3& vec ) const; + + /** Spherical Linear Interpolation. + As t goes from 0 to 1, the Quat object goes from "from" to "to". */ + void slerp ( const float t, const Quat& from, const Quat& to); + + /** Set quaternion to be equivalent to specified matrix.*/ + void set( const osg::Matrix& m ); + + /** Get the equivalent matrix for this quaternion.*/ + void get( osg::Matrix& m ) const; + + friend inline ostream& operator << (ostream& output, const Quat& vec) + { + output << vec._fv[0] << " " + << vec._fv[1] << " " + << vec._fv[2] << " " + << vec._fv[3]; + return output; // to enable cascading + } + + +}; // end of class prototype + +}; // end of namespace +#endif diff --git a/include/osg/Referenced b/include/osg/Referenced new file mode 100644 index 000000000..bbd4b3a4e --- /dev/null +++ b/include/osg/Referenced @@ -0,0 +1,103 @@ +#ifndef OSG_REFERENCED +#define OSG_REFERENCED 1 + +#include + +namespace osg { + +/** Convience functor for unreferencing objects.*/ +template +struct UnrefOp +{ + void operator () (T* node) { node->unref(); } +}; + +/** Smart pointer for handling referenced counted objects.*/ +template +class ref_ptr +{ + + public: + ref_ptr() :_ptr(0L) {} + ref_ptr(T* t):_ptr(t) { if (_ptr) _ptr->ref(); } + ref_ptr(const ref_ptr& rp):_ptr(rp._ptr) { if (_ptr) _ptr->ref(); } + ~ref_ptr() { if (_ptr) _ptr->unref(); } + + ref_ptr& operator = (const ref_ptr& rp) + { + if (_ptr==rp._ptr) return *this; + if (_ptr) _ptr->unref(); + _ptr = rp._ptr; + if (_ptr) _ptr->ref(); + return *this; + } + + ref_ptr& operator = (T* ptr) + { + if (_ptr==ptr) return *this; + if (_ptr) _ptr->unref(); + _ptr = ptr; + if (_ptr) _ptr->ref(); + return *this; + } + + bool operator == (const ref_ptr& rp) const + { + return (_ptr==rp._ptr); + } + + bool operator == (const T* ptr) const + { + return (_ptr==ptr); + } + + bool operator != (const ref_ptr& rp) const + { + return (_ptr!=rp._ptr); + } + + bool operator != (const T* ptr) const + { + return (_ptr!=ptr); + } + + T& operator*() const { return *_ptr; } + T* operator->() const { return _ptr; } + bool operator!() const { return _ptr==0L; } + bool valid() const { return _ptr!=0L; } + + T* get() const { return _ptr; } + + private: + T* _ptr; +}; + +/** Base class from providing referencing counted objects.*/ +class Referenced +{ + + public: + Referenced() { _refCount=0; } + Referenced(Referenced&) { _refCount=0; } + + Referenced& operator = (Referenced&) { return *this; } + + /** increment the reference count by one, indicating that + this object has another pointer which is referencing it.*/ + void ref() { ++_refCount; } + /** decrement the reference count by one, indicating that + a pointer to this object is referencing it. If the + refence count goes to zero, it is assumed that this object + is nolonger referenced and is automatically deleted.*/ + void unref() { --_refCount; if (_refCount<=0) delete this; } + /** return the number pointers currently referencing this object. */ + int referenceCount() { return _refCount; } + + protected: + virtual ~Referenced() {}; + int _refCount; +}; + +}; + +#endif diff --git a/include/osg/Registry b/include/osg/Registry new file mode 100644 index 000000000..81f915155 --- /dev/null +++ b/include/osg/Registry @@ -0,0 +1,168 @@ +#ifndef OSG_REGISTRY +#define OSG_REGISTRY 1 + +#include +#include + +#include +#include + +namespace osg { + +// forward declare referenced classes to help avoid mutiple includes +class Object; +class Image; +class Node; +class Input; + +SG_EXPORT extern Object* loadObjectFile(const char *name); +SG_EXPORT extern Image* loadImageFile(const char *name); +SG_EXPORT extern Node* loadNodeFile(const char *name); + +SG_EXPORT extern bool saveObjectFile(Object& object, const char *name); +SG_EXPORT extern bool saveImageFile(Image& image, const char *name); +SG_EXPORT extern bool saveNodeFile(Node& node, const char *name); + +/** pure virtual base class for reading and writing of non native formats. */ +class SG_EXPORT ReaderWriter : public Referenced +{ + public: + virtual ~ReaderWriter() {} + virtual const char* className() = 0; + virtual bool acceptsExtension(const std::string& /*extension*/) { return false; } + + virtual Object* readObject(const std::string& /*fileName*/) { return NULL; } + virtual Image* readImage(const std::string& /*fileName*/) { return NULL; } + virtual Node* readNode(const std::string& /*fileName*/) { return NULL; } + + virtual bool writeObject(Object& /*obj*/,const std::string& /*fileName*/) {return false; } + virtual bool writeImage(Image& /*image*/,const std::string& /*fileName*/) {return false; } + virtual bool writeNode(Node& /*node*/,const std::string& /*fileName*/) { return false; } +}; + +/** + Registry is a singleton factory which stores + the Objects types available at runtime for loading, + and any Object reader or writers which are linked in + at runtime for reading non-native file formats. + + The RegisterObjectProxy defined in Object.h can be + used to automatically register at runtime a Object + with the Registry. + + The RegisterReaderWriterProxy defined in ReaderWriter.h can + be used to automatically register at runtime a reader/writer + with the Registry. +*/ +class SG_EXPORT Registry +{ + public: + + ~Registry(); + + static Registry* instance(); + + void addPrototype(Object* obj); + void removePrototype(Object* obj); + + void addReaderWriter(ReaderWriter* rw); + void removeReaderWriter(ReaderWriter* rw); + + /** create the platform specific library name associated with file.*/ + std::string createLibraryNameForFile(const std::string& fileName); + + /** create the platform specific library name associated with file extension.*/ + std::string createLibraryNameForExt(const std::string& ext); + + /** find the library in the SG_LIBRARY_PATH and load it.*/ + bool loadLibrary(const std::string& fileName); + /** close the attached library with specified name.*/ + bool closeLibrary(const std::string& fileName); + + Object* readObject(Input& fr); + Object* readObject(const std::string& fileName); + bool writeObject(Object& obj, const std::string& fileName); + + Image* readImage(Input& fr); + Image* readImage(const std::string& fileName); + bool writeImage(Image& obj, const std::string& fileName); + + Node* readNode(Input& fr); + Node* readNode(const std::string& fileName); + bool writeNode(Node& node, const std::string& fileName); + + + private: + + typedef std::vector > PrototypeList; + typedef std::vector > ReaderWriterList; + typedef std::vector > DynamicLibraryList; + + /** constructor is private, as its a singleton, preventing + construction other than via the instance() method and + therefore ensuring only one copy is ever constructed*/ + Registry(); + + /** get the attached library with specified name.*/ + DynamicLibraryList::iterator getLibraryItr(const std::string& fileName); + DynamicLibrary* getLibrary(const std::string& fileName); + + PrototypeList _protoList; + ReaderWriterList _rwList; + DynamicLibraryList _dlList; + + std::vector _nodeProtoList; + std::vector _imageProtoList; + + bool _openingLibrary; + +}; + +/** Proxy class for automatic registration of reader/writers with the + Registry.*/ +template +class RegisterObjectProxy +{ + public: + RegisterObjectProxy() + { + _obj = new T; + _obj->ref(); + Registry::instance()->addPrototype(_obj); + } + ~RegisterObjectProxy() + { + Registry::instance()->removePrototype(_obj); + _obj->unref(); + } + + protected: + T* _obj; +}; + +/** Proxy class for automatic registration of reader/writers with the + Registry.*/ +template +class RegisterReaderWriterProxy +{ + public: + RegisterReaderWriterProxy() + { + _rw = new T; + _rw->ref(); + Registry::instance()->addReaderWriter(_rw); + } + + ~RegisterReaderWriterProxy() + { + Registry::instance()->removeReaderWriter(_rw); + _rw->unref(); + } + + protected: + T* _rw; +}; + +}; + +#endif // __SG_OBJECT_FACTORY_H diff --git a/include/osg/Scene b/include/osg/Scene new file mode 100644 index 000000000..45811deb7 --- /dev/null +++ b/include/osg/Scene @@ -0,0 +1,39 @@ +#ifndef OSG_SCENE +#define OSG_SCENE 1 + +#include +#include + +namespace osg { + +/** The top level group node in a scene graph. */ +class SG_EXPORT Scene : public Group +{ + public : + Scene(); + + virtual Object* clone() const { return new Scene(); } + virtual bool isSameKindAs(Object* obj) { return dynamic_cast(obj)!=NULL; } + virtual const char* className() const { return "Scene"; } + virtual void accept(NodeVisitor& nv) { nv.apply(*this); } + + /** set the scene's GeoState.*/ + void setGState(osg::GeoState* gstate); + + /** return the scene's GeoState.*/ + osg::GeoState* getGState() { return _gstate; } + + protected : + + virtual ~Scene(); + + virtual bool readLocalData(Input& fr); + virtual bool writeLocalData(Output& fw); + + osg::GeoState* _gstate; + +}; + +}; + +#endif diff --git a/include/osg/Seg b/include/osg/Seg new file mode 100644 index 000000000..50a999a24 --- /dev/null +++ b/include/osg/Seg @@ -0,0 +1,63 @@ +#ifndef OSG_SEG +#define OSG_SEG 1 + +#include +#include +#include +#include +#include +#include + +namespace osg { + +/** Segment class for representing a line segment.*/ +class SG_EXPORT Seg : public Referenced +{ + public: + + Seg() {}; + Seg(const Seg& seg) : Referenced(),_s(seg._s),_e(seg._e) {} + Seg(const Vec3& s,const Vec3& e) : _s(s),_e(e) {} + virtual ~Seg() {} + + Seg& operator = (const Seg& seg) { _s = seg._s; _e = seg._e; return *this; } + + void set(const Vec3& s,const Vec3& e) { _s=s; _e=e; } + + const Vec3& start() const { return _s; } + Vec3& start() { return _s; } + + const Vec3& end() const { return _e; } + Vec3& end() { return _e; } + + /** return true if segment intersects BoundingBox.*/ + bool intersect(const BoundingBox& bb) const; + + /** return true if segment intersects BoundingSphere and return the intersection ratio's.*/ + bool intersect(const BoundingBox& bb,float& r1,float& r2) const; + + /** return true if segment intersects BoundingSphere.*/ + bool intersect(const BoundingSphere& bs) const; + + /** return true if segment intersects BoundingSphere and return the intersection ratio's.*/ + bool intersect(const BoundingSphere& bs,float& r1,float& r2) const; + + /** return true if segment intersects triangle and set ratio long segment. */ + bool intersect(const Vec3& v1,const Vec3& v2,const Vec3& v3,float& r); + + /** post multiply a segment by matrix.*/ + void mult(const Seg& seg,const Matrix& m) { _s = seg._s*m; _e = seg._e*m; } + /** pre multiply a segment by matrix.*/ + void mult(const Matrix& m,const Seg& seg) { _s = m*seg._s; _e = m*seg._e; } + + protected: + + static bool intersectAndClip(Vec3& s,Vec3& e,const BoundingBox& bb); + + Vec3 _s; + Vec3 _e; +}; + +}; + +#endif diff --git a/include/osg/Sequence b/include/osg/Sequence new file mode 100644 index 000000000..f23aad78d --- /dev/null +++ b/include/osg/Sequence @@ -0,0 +1,28 @@ +#ifndef OSG_SEQUENCE +#define OSG_SEQUENCE 1 + +#include + +namespace osg { + +/** Sequence - Switch node which allows iterators between children. + + Note: has not been implemented yet! +*/ +class SG_EXPORT Sequence : public Group +{ + public : + Sequence() {} + + virtual Object* clone() const { return new Sequence(); } + virtual bool isSameKindAs(Object* obj) { return dynamic_cast(obj)!=NULL; } + virtual const char* className() const { return "Sequence"; } + virtual void accept(NodeVisitor& nv) { nv.apply(*this); } + + protected : + virtual ~Sequence() {} +}; + +}; + +#endif diff --git a/include/osg/State b/include/osg/State new file mode 100644 index 000000000..55d58b38f --- /dev/null +++ b/include/osg/State @@ -0,0 +1,22 @@ +#ifndef OSG_STATE +#define OSG_STATE 1 + +#include + +namespace osg { + +class SG_EXPORT State +{ + public : + State( void ); + ~State( void ); + + private : + GeoState *initial; + GeoState *req; + GeoState *current; +}; + +}; + +#endif diff --git a/include/osg/Switch b/include/osg/Switch new file mode 100644 index 000000000..f2a1d2ae0 --- /dev/null +++ b/include/osg/Switch @@ -0,0 +1,45 @@ +#ifndef OSG_SWITCH +#define OSG_SWITCH 1 + +#include + +namespace osg { + +/** Switch - Group node which allows switching between children. + Typical uses would be for objects which might need to be rendered + differently at different times, for instance a switch could be used + to represent the different states of a traffic light. +*/ +class SG_EXPORT Switch : public Group +{ + public : + + enum SwitchType { + ALL_CHILDREN_ON=-1, + ALL_CHILDREN_OFF=-2 + }; + + Switch(); + + virtual Object* clone() const { return new Switch(); } + virtual bool isSameKindAs(Object* obj) { return dynamic_cast(obj)!=NULL; } + virtual const char* className() const { return "Switch"; } + virtual void accept(NodeVisitor& nv) { nv.apply(*this); } + virtual void traverse(NodeVisitor& nv); + + void setVal(int val) { _value = val; } + int getVal() const { return _value; } + + protected : + + virtual ~Switch() {} + + virtual bool readLocalData(Input& fr); + virtual bool writeLocalData(Output& fw); + + int _value; +}; + +}; + +#endif diff --git a/include/osg/TexEnv b/include/osg/TexEnv new file mode 100644 index 000000000..5bd4c64cf --- /dev/null +++ b/include/osg/TexEnv @@ -0,0 +1,45 @@ +#ifndef OSG_TEXENV +#define OSG_TEXENV 1 + +#include +#include +#include + +namespace osg { + + +class SG_EXPORT TexEnv : public Object +{ + public : + + enum TexEnvMode { + DECAL = GL_DECAL, + MODULATE = GL_MODULATE, + BLEND = GL_BLEND + }; + + TexEnv( void ); + static TexEnv* instance(); + virtual Object* clone() const { return new TexEnv(); } + virtual bool isSameKindAs(Object* obj) { return dynamic_cast(obj)!=NULL; } + virtual const char* className() const { return "TexEnv"; } + + + void setMode( TexEnvMode mode ); + void apply( void ); + + protected : + + virtual ~TexEnv( void ); + virtual bool readLocalData(Input& fr); + virtual bool writeLocalData(Output& fw); + + bool matchModeStr(const char* str,TexEnvMode& mode); + const char* getModeStr(TexEnvMode mode); + + TexEnvMode _mode; +}; + +}; + +#endif diff --git a/include/osg/TexGen b/include/osg/TexGen new file mode 100644 index 000000000..e85f55884 --- /dev/null +++ b/include/osg/TexGen @@ -0,0 +1,54 @@ +#ifndef OSG_TEXGEN +#define OSG_TEXGEN 1 + +#include +#include +#include +#include + +namespace osg { + + +class Input; +class Output; + +class SG_EXPORT TexGen : public Object +{ + public : + + enum TexGenMode { + OBJECT_LINEAR = GL_OBJECT_LINEAR, + EYE_LINEAR = GL_EYE_LINEAR, + SPHERE_MAP = GL_SPHERE_MAP + }; + + TexGen( void ); + static TexGen* instance(); + virtual Object* clone() const { return new TexGen(); } + virtual bool isSameKindAs(Object* obj) { return dynamic_cast(obj)!=NULL; } + virtual const char* className() const { return "TexGen"; } + + static void enable( void ); + static void disable( void ); + + void apply( void ); + + void setMode( TexGenMode mode ) { _mode = mode; } + + protected : + + virtual ~TexGen( void ); + + virtual bool readLocalData(Input& fr); + virtual bool writeLocalData(Output& fw); + + bool matchModeStr(const char* str,TexGenMode& mode); + const char* getModeStr(TexGenMode mode); + + TexGenMode _mode; + +}; + +}; + +#endif diff --git a/include/osg/TexMat b/include/osg/TexMat new file mode 100644 index 000000000..fce835d9d --- /dev/null +++ b/include/osg/TexMat @@ -0,0 +1,29 @@ +#ifndef OSG_TEXMAT +#define OSG_TEXMAT 1 + +#include +#include + +namespace osg { + +class SG_EXPORT TexMat : public Matrix +{ + public : + TexMat( void ); + static TexMat* instance(); + virtual Object* clone() const { return new TexMat(); } + virtual bool isSameKindAs(Object* obj) { return dynamic_cast(obj)!=NULL; } + virtual const char* className() const { return "TexMat"; } + + void apply( void ); + + protected: + + virtual ~TexMat( void ); + +}; + +}; + + +#endif diff --git a/include/osg/Texture b/include/osg/Texture new file mode 100644 index 000000000..da48e659d --- /dev/null +++ b/include/osg/Texture @@ -0,0 +1,104 @@ +#ifndef OSG_TEXTURE +#define OSG_TEXTURE 1 + +#include +#include +#include +#include + +namespace osg { + + +class Input; +class Output; + +/** Texture state class which encapsulates OpenGl texture functionality.*/ +class SG_EXPORT Texture : public Object +{ + + public : + + Texture(); + static Texture* instance(); + virtual Object* clone() const { return new Texture(); } + virtual bool isSameKindAs(Object* obj) { return dynamic_cast(obj)!=NULL; } + virtual const char* className() const { return "Texture"; } + + /** Set the texture image. */ + void setImage(Image* image); + /** Get the texture image. */ + Image* getImage() const { return _image.get(); } + + enum WrapParameter { + WRAP_S, + WRAP_T, + WRAP_R + }; + + enum WrapMode { + CLAMP = GL_CLAMP, + REPEAT = GL_REPEAT + }; + + /** Set the texture wrap mode.*/ + void setWrap(WrapParameter which, WrapMode wrap); + /** Get the texture wrap mode.*/ + WrapMode getWrap(WrapParameter which) const; + + + enum FilterParameter { + MIN_FILTER, + MAG_FILTER + }; + + enum FilterMode { + LINEAR = GL_LINEAR, + LINEAR_MIPMAP_LINEAR = GL_LINEAR_MIPMAP_LINEAR, + LINEAR_MIPMAP_NEAREST = GL_LINEAR_MIPMAP_NEAREST, + NEAREST = GL_NEAREST, + NEAREST_MIPMAP_LINEAR = GL_NEAREST_MIPMAP_LINEAR, + NEAREST_MIPMAP_NEAREST = GL_NEAREST_MIPMAP_NEAREST + }; + + /** Set the texture filter mode.*/ + void setFilter(FilterParameter which, FilterMode filter); + /** Get the texture filter mode.*/ + FilterMode getFilter(FilterParameter which) const; + + + /** Enable OpenGL texturing.*/ + static void enable( void ); + /** Disable OpenGL texturing.*/ + static void disable( void ); + + /** On first apply, create the minmapped texture and bind it, + subsequent apply will simple bind to texture.*/ + void apply( void ); + + protected : + + virtual ~Texture(); + + virtual bool readLocalData(Input& fr); + virtual bool writeLocalData(Output& fw); + + uint _handle; + + ref_ptr _image; + + bool matchWrapStr(const char* str,WrapMode& wrap); + const char* getWrapStr(WrapMode wrap); + + bool matchFilterStr(const char* str,FilterMode& filter); + const char* getFilterStr(FilterMode filter); + + WrapMode _wrap_s; + WrapMode _wrap_t; + WrapMode _wrap_r; + FilterMode _min_filter; + FilterMode _mag_filter; +}; + +}; + +#endif diff --git a/include/osg/Timer b/include/osg/Timer new file mode 100644 index 000000000..f5f385ff5 --- /dev/null +++ b/include/osg/Timer @@ -0,0 +1,77 @@ +#ifndef OSG_TIMER +#define OSG_TIMER 1 + +#include + +namespace osg { + +#ifdef WIN32 + typedef __int64 Timer_t; +#else + typedef unsigned long long Timer_t; +#endif + +class SG_EXPORT Timer { + + public: + + Timer( void ); + ~Timer( void ); + + +#ifdef WIN32 + #pragma optimize("",off) + inline Timer_t tick( void ) + { + volatile Timer_t ts; + volatile unsigned int HighPart; + volatile unsigned int LowPart; + _asm + { + xor eax, eax // Used when QueryPerformanceCounter() + xor edx, edx // not supported or minimal overhead + _emit 0x0f // desired + _emit 0x31 // + mov HighPart,edx + mov LowPart,eax + } + //ts = LowPart | HighPart >> 32; + *((unsigned int*)&ts) = LowPart; + *((unsigned int*)&ts+1) = HighPart; + return ts; + } + #pragma optimize("",on) +#endif +#ifdef __linux + #define CLK(x) __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x)) + inline Timer_t tick( void ) {Timer_t x;CLK(x);return x;} +#endif +#ifdef __sgi + inline Timer_t tick( void ) { return *clk; } +#endif + double delta_s( Timer_t t1, Timer_t t2 ); + double delta_m( Timer_t t1, Timer_t t2 ); + + Timer_t delta_u( Timer_t t1, Timer_t t2 ); + Timer_t delta_n( Timer_t t1, Timer_t t2 ); + + + private : + + double microseconds_per_click; + double nanoseconds_per_click; + unsigned long *clk; + int cycleCntrSize; + static unsigned long dummy; + + static int inited; + static double cpu_mhz; + void init( void ); + + + +}; + + +}; +#endif diff --git a/include/osg/Transparency b/include/osg/Transparency new file mode 100644 index 000000000..e06d5f6ba --- /dev/null +++ b/include/osg/Transparency @@ -0,0 +1,50 @@ +#ifndef OSG_TRANSPARENCY +#define OSG_TRANSPARENCY 1 + +#include +#include +#include + +namespace osg { + + +class SG_EXPORT Transparency : public Object +{ + public : + + enum TransparencyMode { + DST_ALPHA = GL_DST_ALPHA, + DST_COLOR = GL_DST_COLOR, + ONE = GL_ONE, + ONE_MINUS_DST_ALPHA = GL_ONE_MINUS_DST_ALPHA, + ONE_MINUS_DST_COLOR = GL_ONE_MINUS_DST_COLOR, + ONE_MINUS_SRC_ALPHA = GL_ONE_MINUS_SRC_ALPHA, + ONE_MINUS_SRC_COLOR = GL_ONE_MINUS_SRC_COLOR, + SRC_ALPHA = GL_SRC_ALPHA, + SRC_ALPHA_SATURATE = GL_SRC_ALPHA_SATURATE, + SRC_COLOR = GL_SRC_COLOR, + ZERO = GL_ZERO + }; + + Transparency(); + static Transparency * instance(); + virtual Object* clone() const { return new Transparency(); } + virtual bool isSameKindAs(Object* obj) { return dynamic_cast(obj)!=NULL; } + virtual const char* className() const { return "Transparency"; } + + void setFunction( int source, int destination ); + static void enable( void ); + static void disable( void ); + void apply( void ); + + protected : + + virtual ~Transparency(); + + int _source_factor; + int _destination_factor; +}; + +}; + +#endif diff --git a/include/osg/Types b/include/osg/Types new file mode 100644 index 000000000..dbfff7976 --- /dev/null +++ b/include/osg/Types @@ -0,0 +1,32 @@ +#ifndef OSG_TYPES +#define OSG_TYPES 1 + +#include +#include + +namespace osg { + +typedef unsigned int uint; +typedef unsigned short ushort; +typedef unsigned char uchar; +typedef uchar ubyte; + +#ifdef WIN32 +#define M_E 2.7182818284590452354 +#define M_LOG2E 1.4426950408889634074 +#define M_LOG10E 0.43429448190325182765 +#define M_LN2 0.69314718055994530942 +#define M_LN10 2.30258509299404568402 +#define M_PI 3.14159265358979323846 +#define M_PI_2 1.57079632679489661923 +#define M_PI_4 0.78539816339744830962 +#define M_1_PI 0.31830988618379067154 +#define M_2_PI 0.63661977236758134308 +#define M_2_SQRTPI 1.12837916709551257390 +#define M_SQRT2 1.41421356237309504880 +#define M_SQRT1_2 0.70710678118654752440 +#endif + +}; + +#endif diff --git a/include/osg/Vec2 b/include/osg/Vec2 new file mode 100644 index 000000000..80112a60f --- /dev/null +++ b/include/osg/Vec2 @@ -0,0 +1,149 @@ +#ifndef OSG_VEC2 +#define OSG_VEC2 1 + +#include +#include + +#ifdef OSG_USE_IO_DOT_H +#include +#else +#include +using namespace std; +#endif + +namespace osg { + +/** General purpose float pair, uses include representation of + texture coordinates. + No support yet added for float * Vec2 - is it necessary? + Need to define a non-member non-friend operator* etc. + BTW: Vec2 * float is okay +*/ + +class Vec2 +{ + public: + + Vec2() {} // no operations done to maintain speed + Vec2(float x,float y) { _v[0]=x; _v[1]=y; } + + float _v[2]; + + bool operator == (const Vec2& v) const { return _v[0]==v._v[0] && _v[1]==v._v[1]; } + + inline float* ptr() { return _v; } + inline const float* ptr() const { return _v; } + + inline void set( float x, float y ) { _v[0]=x; _v[1]=y; } + + inline float& operator [] (int i) { return _v[i]; } + inline float operator [] (int i) const { return _v[i]; } + + inline float& x() { return _v[0]; } + inline float& y() { return _v[1]; } + + inline float x() const { return _v[0]; } + inline float y() const { return _v[1]; } + + /// dot product + inline float operator * (const Vec2& rhs) const + { + return _v[0]*rhs._v[0]+_v[1]*rhs._v[1]; + } + + /// multiply by scalar + inline Vec2 operator * (const float& rhs) const + { + return Vec2(_v[0]*rhs, _v[1]*rhs); + } + + /// unary multiply by scalar + inline Vec2& operator *= (const float& rhs) + { + _v[0]*=rhs; + _v[1]*=rhs; + return *this; + } + + /// divide by scalar + inline Vec2 operator / (const float& rhs) const + { + return Vec2(_v[0]/rhs, _v[1]/rhs); + } + + /// unary divide by scalar + inline Vec2& operator /= (const float& rhs) + { + _v[0]/=rhs; + _v[1]/=rhs; + return *this; + } + + /// binary vector add + inline Vec2 operator + (const Vec2& rhs) const + { + return Vec2(_v[0]+rhs._v[0], _v[1]+rhs._v[1]); + } + + /** unary vector add. Slightly more efficient because no temporary + intermediate object.*/ + inline Vec2& operator += (const Vec2& rhs) + { + _v[0] += rhs._v[0]; + _v[1] += rhs._v[1]; + return *this; + } + + /// binary vector subract + inline Vec2 operator - (const Vec2& rhs) const + { + return Vec2(_v[0]-rhs._v[0], _v[1]-rhs._v[1]); + } + + /// unary vector subract + inline Vec2& operator -= (const Vec2& rhs) + { + _v[0]-=rhs._v[0]; + _v[1]-=rhs._v[1]; + return *this; + } + + /// negation operator. Returns the negative of the Vec2 + inline Vec2 operator - () const + { + return Vec2 (-_v[0], -_v[1]); + } + + /// Length of the vector = sqrt( vec . vec ) + inline float length() const + { + return sqrtf( _v[0]*_v[0] + _v[1]*_v[1] ); + } + + /// Length squared of the vector = vec . vec + inline float length2( void ) const + { + return _v[0]*_v[0] + _v[1]*_v[1]; + } + + /** normalize the vector so that it has length unity + returns the previous length of the vector*/ + inline float normalize() + { + float norm = Vec2::length(); + _v[0] /= norm; + _v[1] /= norm; + return( norm ); + } + + friend inline ostream& operator << (ostream& output, const Vec2& vec) + { + output << vec._v[0] << " " + << vec._v[1]; + return output; // to enable cascading + } + +}; // end of class Vec2 + +} // end of namespace osg +#endif diff --git a/include/osg/Vec3 b/include/osg/Vec3 new file mode 100644 index 000000000..58cf4ce09 --- /dev/null +++ b/include/osg/Vec3 @@ -0,0 +1,168 @@ +#ifndef OSG_VEC3 +#define OSG_VEC3 1 + +#include +#include + +#ifdef OSG_USE_IO_DOT_H +#include +#else +#include +using namespace std; +#endif + +namespace osg { + +/** General purpose float triple for use as vertices, vectors and normals. + Provides general maths operations from addition through to cross products. + No support yet added for float * Vec3 - is it necessary? + Need to define a non-member non-friend operator* etc. + Vec3 * float is okay +*/ +class Vec3 +{ + public: + + Vec3() {} // no operations done to maintain speed + Vec3(float x,float y,float z) { _v[0]=x; _v[1]=y; _v[2]=z; } + + float _v[3]; + + bool operator == (const Vec3& v) const { return _v[0]==v._v[0] && _v[1]==v._v[1] && _v[2]==v._v[2]; } + + inline float* ptr() { return _v; } + inline const float* ptr() const { return _v; } + + inline void set( float x, float y, float z) + { + _v[0]=x; _v[1]=y; _v[2]=z; + } + + inline float& operator [] (int i) { return _v[i]; } + inline float operator [] (int i) const { return _v[i]; } + + inline float& x() { return _v[0]; } + inline float& y() { return _v[1]; } + inline float& z() { return _v[2]; } + + inline float x() const { return _v[0]; } + inline float y() const { return _v[1]; } + inline float z() const { return _v[2]; } + + /// dot product + inline float operator * (const Vec3& rhs) const + { + return _v[0]*rhs._v[0]+_v[1]*rhs._v[1]+_v[2]*rhs._v[2]; + } + + /// cross product + inline Vec3 operator ^ (const Vec3& rhs) const + { + return Vec3(_v[1]*rhs._v[2]-_v[2]*rhs._v[1], + _v[2]*rhs._v[0]-_v[0]*rhs._v[2] , + _v[0]*rhs._v[1]-_v[1]*rhs._v[0]); + } + + /// multiply by scalar + inline Vec3 operator * (const float& rhs) const + { + return Vec3(_v[0]*rhs, _v[1]*rhs, _v[2]*rhs); + } + + /// unary multiply by scalar + inline Vec3& operator *= (const float& rhs) + { + _v[0]*=rhs; + _v[1]*=rhs; + _v[2]*=rhs; + return *this; + } + + /// divide by scalar + inline Vec3 operator / (const float& rhs) const + { + return Vec3(_v[0]/rhs, _v[1]/rhs, _v[2]/rhs); + } + + /// unary divide by scalar + inline Vec3& operator /= (const float& rhs) + { + _v[0]/=rhs; + _v[1]/=rhs; + _v[2]/=rhs; + return *this; + } + + /// binary vector add + inline Vec3 operator + (const Vec3& rhs) const + { + return Vec3(_v[0]+rhs._v[0], _v[1]+rhs._v[1], _v[2]+rhs._v[2]); + } + + /** unary vector add. Slightly more efficient because no temporary + intermediate object*/ + inline Vec3& operator += (const Vec3& rhs) + { + _v[0] += rhs._v[0]; + _v[1] += rhs._v[1]; + _v[2] += rhs._v[2]; + return *this; + } + + /// binary vector subract + inline Vec3 operator - (const Vec3& rhs) const + { + return Vec3(_v[0]-rhs._v[0], _v[1]-rhs._v[1], _v[2]-rhs._v[2]); + } + + /// unary vector subract + inline Vec3& operator -= (const Vec3& rhs) + { + _v[0]-=rhs._v[0]; + _v[1]-=rhs._v[1]; + _v[2]-=rhs._v[2]; + return *this; + } + + /// negation operator. Returns the negative of the Vec3 + inline Vec3 operator - () const + { + return Vec3 (-_v[0], -_v[1], -_v[2]); + } + + /// Length of the vector = sqrt( vec . vec ) + inline float length( void ) const + { + return sqrtf( _v[0]*_v[0] + _v[1]*_v[1] + _v[2]*_v[2] ); + } + + /// Length squared of the vector = vec . vec + inline float length2( void ) const + { + return _v[0]*_v[0] + _v[1]*_v[1] + _v[2]*_v[2]; + } + + /** normalize the vector so that it has length unity + returns the previous length of the vector*/ + inline float normalize() + { + float norm = Vec3::length(); + _v[0] /= norm; + _v[1] /= norm; + _v[2] /= norm; + return( norm ); + } + + friend inline ostream& operator << (ostream& output, const Vec3& vec) + { + output << vec._v[0] << " " + << vec._v[1] << " " + << vec._v[2]; + return output; // to enable cascading + } + +}; // end of class Vec3 + +} // end of namespace osg + +#endif diff --git a/include/osg/Vec4 b/include/osg/Vec4 new file mode 100644 index 000000000..4dce580c9 --- /dev/null +++ b/include/osg/Vec4 @@ -0,0 +1,178 @@ +#ifndef OSG_VEC4 +#define OSG_VEC4 1 + +#include +#include + +#ifdef OSG_USE_IO_DOT_H +#include +#else +#include +using namespace std; +#endif + +namespace osg { + +/** General purpose float quad, uses include representation + of colour coordinates. + No support yet added for float * Vec4 - is it necessary? + Need to define a non-member non-friend operator* etc. + Vec4 * float is okay +*/ +class Vec4 +{ + public: + + // Methods are defined here so that they are implicitly inlined + + Vec4() {} // no operations done to maintain speed + Vec4(float x, float y, float z, float w) + { + _v[0]=x; _v[1]=y; _v[2]=z; _v[3]=w; + } + + float _v[4]; + + bool operator == (const Vec4& v) const { return _v[0]==v._v[0] && _v[1]==v._v[1] && _v[2]==v._v[2] && _v[3]==v._v[3]; } + + inline float* ptr() { return _v; } + inline const float* ptr() const { return _v; } + + inline void set( float x, float y, float z, float w) + { + _v[0]=x; _v[1]=y; _v[2]=z; _v[3]=w; + } + + inline float& operator [] (int i) { return _v[i]; } + inline float operator [] (int i) const { return _v[i]; } + + inline float& x() { return _v[0]; } + inline float& y() { return _v[1]; } + inline float& z() { return _v[2]; } + inline float& w() { return _v[3]; } + + inline float x() const { return _v[0]; } + inline float y() const { return _v[1]; } + inline float z() const { return _v[2]; } + inline float w() const { return _v[3]; } + + /// dot product + inline float operator * (const Vec4& rhs) const + { + return _v[0]*rhs._v[0]+ + _v[1]*rhs._v[1]+ + _v[2]*rhs._v[2]+ + _v[3]*rhs._v[3] ; + } + + /// multiply by scalar + inline Vec4 operator * (const float& rhs) const + { + return Vec4(_v[0]*rhs, _v[1]*rhs, _v[2]*rhs, _v[3]*rhs); + } + + /// unary multiply by scalar + inline Vec4& operator *= (const float& rhs) + { + _v[0]*=rhs; + _v[1]*=rhs; + _v[2]*=rhs; + _v[3]*=rhs; + return *this; + } + + /// divide by scalar + inline Vec4 operator / (const float& rhs) const + { + return Vec4(_v[0]/rhs, _v[1]/rhs, _v[2]/rhs, _v[3]/rhs); + } + + /// unary divide by scalar + inline Vec4& operator /= (const float& rhs) + { + _v[0]/=rhs; + _v[1]/=rhs; + _v[2]/=rhs; + _v[3]/=rhs; + return *this; + } + + /// binary vector add + inline Vec4 operator + (const Vec4& rhs) const + { + return Vec4(_v[0]+rhs._v[0], _v[1]+rhs._v[1], + _v[2]+rhs._v[2], _v[3]+rhs._v[3]); + } + + /** unary vector add. Slightly more efficient because no temporary + intermediate object*/ + inline Vec4& operator += (const Vec4& rhs) + { + _v[0] += rhs._v[0]; + _v[1] += rhs._v[1]; + _v[2] += rhs._v[2]; + _v[3] += rhs._v[3]; + return *this; + } + + /// binary vector subract + inline Vec4 operator - (const Vec4& rhs) const + { + return Vec4(_v[0]-rhs._v[0], _v[1]-rhs._v[1], + _v[2]-rhs._v[2], _v[3]-rhs._v[3] ); + } + + /// unary vector subract + inline Vec4& operator -= (const Vec4& rhs) + { + _v[0]-=rhs._v[0]; + _v[1]-=rhs._v[1]; + _v[2]-=rhs._v[2]; + _v[3]-=rhs._v[3]; + return *this; + } + + /// negation operator. Returns the negative of the Vec4 + inline Vec4 operator - () const + { + return Vec4 (-_v[0], -_v[1], -_v[2], -_v[3]); + } + + /// Length of the vector = sqrt( vec . vec ) + inline float length( void ) const + { + return sqrtf( _v[0]*_v[0] + _v[1]*_v[1] + _v[2]*_v[2] + _v[3]*_v[3]); + } + + /// Length squared of the vector = vec . vec + inline float length2( void ) const + { + return _v[0]*_v[0] + _v[1]*_v[1] + _v[2]*_v[2] + _v[3]*_v[3]; + } + + /** normalize the vector so that it has length unity + returns the previous length of the vector*/ + inline float normalize() + { + float norm = Vec4::length(); + _v[0] /= norm; + _v[1] /= norm; + _v[2] /= norm; + _v[3] /= norm; + return( norm ); + } + + friend inline ostream& operator << (ostream& output, const Vec4& vec) + { + output << vec._v[0] << " " + << vec._v[1] << " " + << vec._v[2] << " " + << vec._v[3]; + return output; // to enable cascading + } + +}; // end of class Vec4 + +} // end of namespace osg + +#endif diff --git a/include/osg/Version b/include/osg/Version new file mode 100644 index 000000000..dfa11026a --- /dev/null +++ b/include/osg/Version @@ -0,0 +1,33 @@ +#ifndef OSG_VERSION +#define OSG_VERSION 1 + +#include + +extern "C" { + +/** + * getVersion_osg() returns the library version number. + * Numbering conventon : osg_src-0.8-31 will return 0.8.31 from getVersion_osg. + * + * This C function can be also used to check for the existance of the OpenSceneGraph + * library using autoconf and its m4 macro AC_CHECK_LIB. + * + * Here is the code to add to your configure.in: + \verbatim + # + # Check for the OpenSceneGraph (OSG) library + # + AC_CHECK_LIB(osg, osgGetVersion, , + [AC_MSG_ERROR(OpenSceneGraph library not found. See http://www.openscenegraph.org)],) + \endverbatim +*/ +extern SG_EXPORT const char* osgGetVersion(); + +/** + * getLibraryName_osg() returns the library name in human friendly form. +*/ +extern SG_EXPORT const char* osgGetLibraryName(); + +}; + +#endif diff --git a/include/osgGLUT/Export b/include/osgGLUT/Export new file mode 100644 index 000000000..d7a3751ab --- /dev/null +++ b/include/osgGLUT/Export @@ -0,0 +1,22 @@ +// The following symbole has a underscore suffix for compatibility. +#ifndef OSGGLUT_EXPORT_ +#define OSGGLUT_EXPORT_ 1 + +#ifdef WIN32 + #pragma warning( disable : 4251 ) + #pragma warning( disable : 4275 ) + #pragma warning( disable : 4786 ) +#endif + +#if defined(_MSC_VER) + # ifdef OSGGLUT_LIBRARY + # define OSGGLUT_EXPORT __declspec(dllexport) + # else + # define OSGGLUT_EXPORT __declspec(dllimport) + #endif /* OSGGLUT_LIBRARY */ +#else + #define OSGGLUT_EXPORT +#endif + +#endif + diff --git a/include/osgGLUT/GLUTEventAdapter b/include/osgGLUT/GLUTEventAdapter new file mode 100644 index 000000000..712fc6403 --- /dev/null +++ b/include/osgGLUT/GLUTEventAdapter @@ -0,0 +1,108 @@ +#ifndef OSGGLUT_GLUTEVENTADAPTER +#define OSGGLUT_GLUTEVENTADAPTER 1 + +#include + +#include + +namespace osgGLUT{ + +/** Class for adapting GLUT events so that they can be used as input to osgUtil::CameraManipulators.*/ +class OSGGLUT_EXPORT GLUTEventAdapter : public osgUtil::GUIEventAdapter +{ + + public: + GLUTEventAdapter(); + virtual ~GLUTEventAdapter() {} + + /** Get the EventType of the GUI event.*/ + virtual EventType getEventType() const { return _eventType; } + + /** key pressed, return -1 if inapropriate for this event. */ + virtual int getKey() const { return _key; } + + /** button pressed/released, return -1 if inappropriate for this event.*/ + virtual int getButton() const { return _button; } + + /** window minimum x. */ + virtual int getXmin() const { return _Xmin; } + + /** window maximum x. */ + virtual int getXmax() const { return _Xmax; } + + /** window minimum y. */ + virtual int getYmin() const { return _Ymin; } + + /** window maximum y. */ + virtual int getYmax() const { return _Ymax; } + + /** current mouse x position.*/ + virtual int getX() const { return _mx; } + + /** current mouse y position.*/ + virtual int getY() const { return _my; } + + /** current mouse button state */ + virtual unsigned int getButtonMask() const { return _buttonMask; } + + /** time in seconds of event. */ + virtual float time() const { return _time; } + + + /** static method for setting window dimensions.*/ + static void setWindowSize(int Xmin, int Ymin, int Xmax, int Ymax); + + /** static method for setting button state.*/ + static void setButtonMask(unsigned int buttonMask); + + /** method for adapting resize events. */ + void adaptResize(float t, int Xmin, int Ymin, int Xmax, int Ymax); + + /** method for adapting mouse motion events whilst mouse buttons are pressed.*/ + void adaptMouseMotion(float t, int x, int y); + + /** method for adapting mouse motion events whilst no mouse button are pressed.*/ + void adaptMousePassiveMotion(float t,int x, int y); + + /** method for adapting mouse button pressed/released events.*/ + void adaptMouse(float t,int button, int state, int x, int y); + + /** method for adapting keyboard events.*/ + void adaptKeyboard(float t,unsigned char key, int x, int y ); + + /** method for adapting frame events, i.e. iddle/display callback.*/ + void adaptFrame(float t); + + void copyStaticVariables(); + + protected: + + EventType _eventType; + int _key; + int _button; + int _Xmin,_Xmax; + int _Ymin,_Ymax; + int _mx; + int _my; + unsigned int _buttonMask; + float _time; + + // used to accumulate the button mask state, it represents + // the current button mask state, which is modified by the + // adaptMouse() method which then copies it to value _buttonMask + // which required the mouse buttons state at the time of the event. + static unsigned int _s_accumulatedButtonMask; + + // used to store window min and max values. + static int _s_Xmin; + static int _s_Xmax; + static int _s_Ymin; + static int _s_Ymax; + static int _s_mx; + static int _s_my; + +}; + +} + +#endif diff --git a/include/osgGLUT/Version b/include/osgGLUT/Version new file mode 100755 index 000000000..105416b13 --- /dev/null +++ b/include/osgGLUT/Version @@ -0,0 +1,35 @@ +#ifndef OSGGLUT_VERSION +#define OSGGLUT_VERSION 1 + +#include + + +extern "C" { + +/** + * getVersion_osgGLUT() returns the library version number. + * Numbering conventon : osg_src-0.8-31 will return 0.8.31 from getVersion_osgGLUT. + * + * This C function can be also used to check for the existance of the OpenSceneGraph + * library using autoconf and its m4 macro AC_CHECK_LIB. + * + * Here is the code to add to your configure.in: + \verbatim + # + # Check for the OpenSceneGraph (OSG) GLUT library + # + AC_CHECK_LIB(osg, osgGLUTGetVersion, , + [AC_MSG_ERROR(OpenSceneGraph GLUT library not found. See http://www.openscenegraph.org)],) + \endverbatim +*/ +extern OSGGLUT_EXPORT const char* osgGLUTGetVersion(); + +/** + * getLibraryName_osgGLUT() returns the library name in human friendly form. +*/ +extern OSGGLUT_EXPORT const char* osgGLUTGetLibraryName(); + +}; + +#endif + diff --git a/include/osgGLUT/Viewer b/include/osgGLUT/Viewer new file mode 100644 index 000000000..1871f9226 --- /dev/null +++ b/include/osgGLUT/Viewer @@ -0,0 +1,147 @@ +#ifndef OSGGLUT_VIEWER +#define OSGGLUT_VIEWER 1 + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#ifdef SGV_USE_RTFS +#include +#endif + +#include + +#ifdef OSG_USE_IO_DOT_H +#include +#else +#include +using namespace std; +#endif + +namespace osgGLUT{ + +/** A basic viewer base class which provides a window, simple keyboard and mouse interaction. + * Please note, this viewer class has been developed via a rather haphazzard + * path and *needs* a total rewrite. It currently surfices for osg demo's + * but shouldn't be viewed as the be all or end of osg viewer classes. + * Someone please rewrite it :-) + */ +class OSGGLUT_EXPORT Viewer : public osgUtil::GUIActionAdapter +{ + public: + + Viewer(); + virtual ~Viewer(); + + virtual bool init( osg::Node* ); + + virtual bool run(); + + // called on each frame redraw.. + virtual bool update(); + virtual bool traverse(); + virtual bool draw(); + + // initialize the clock. + long initClock(); + // time since initClock() in seconds. + float clockSeconds() { return _timer.delta_s(_initialTick,clockTick()); } + + // update the number of ticks since the last frame update. + osg::Timer_t updateFrameTick(); + + // time from the current frame update and the previous one in seconds. + float frameSeconds() { return _timer.delta_s(_lastFrameTick,_frameTick); } + float frameRate() { return 1.0f/frameSeconds(); } + + void help(ostream& fout); + + // hande multiple camera. + void registerCameraManipulator(osgUtil::CameraManipulator* cm); + void selectCameraManipulator(unsigned int pos); + + // derived from osgUtil::GUIActionAdapter + virtual void needRedraw(bool /*needed*/) {} // redraw always done. + virtual void needContinuousUpdate(bool /*needed*/) {} // continous update always + virtual void needWarpPointer(int x,int y); + + protected: + + static void displayCB(); + static void reshapeCB(GLint w, GLint h); + static void visibilityCB(int state); + static void mouseMotionCB(int x, int y); + static void mousePassiveMotionCB(int x, int y); + static void mouseCB(int button, int state, int x, int y); + static void keyboardCB(unsigned char key, int x, int y ); + + virtual void display(); + virtual void reshape(GLint w, GLint h); + virtual void visibility(int state); + virtual void mouseMotion(int x, int y); + virtual void mousePassiveMotion(int x, int y); + virtual void mouse(int button, int state, int x, int y); + virtual void keyboard(unsigned char key, int x, int y); + + + static Viewer* s_theViewer; + + osg::ref_ptr _sceneView; + + typedef std::vector > CameraManipList; + + osg::ref_ptr _cameraManipulator; + CameraManipList _cameraManipList; + + std::string _saveFileName; + + int ww, wh; + + #ifdef SGV_USE_RTFS + unsigned int frame_rate; + RTfs *fs; + #endif + + bool _viewFrustumCullingActive; + bool _smallFeatureCullingActive; + + int mx, my, mbutton; + int polymode; + int texture; + int backface; + int lighting; + int flat_shade; + int _two_sided_lighting; + bool fullscreen; + int _saved_ww,_saved_wh; + bool _printStats; + bool _useDisplayLists; + + osg::Timer _timer; + osg::Timer_t _tickRatePerSecond; + osg::Timer_t _initialTick; + osg::Timer_t _lastFrameTick; + osg::Timer_t _frameTick; + + // system tick. + osg::Timer_t clockTick(); + osg::Timer_t frameTick(); + + +}; + +} + +#endif // SG_VIEWIER_H diff --git a/include/osgUtil/CameraManipulator b/include/osgUtil/CameraManipulator new file mode 100644 index 000000000..c4ffe8c30 --- /dev/null +++ b/include/osgUtil/CameraManipulator @@ -0,0 +1,55 @@ +#ifndef OSGUTIL_CAMERAMANIPULATOR +#define OSGUTIL_CAMERAMANIPULATOR 1 + +#include +#include +#include +#include +#include + +namespace osgUtil{ + +class OSGUTIL_EXPORT CameraManipulator : public osg::Referenced +{ + public: + + CameraManipulator(); + virtual ~CameraManipulator(); + + /** attach a camera to the manipulator to be used for specifying view.*/ + virtual void setCamera(osg::Camera*); + + /** get the attached a camera.*/ + virtual osg::Camera * getCamera() const; + + /** Attach a node to the manipulator. + Automatically detaches previously attached node. + setNode(NULL) detaches previously nodes. + Is ignored by manipulators which do not require a reference model.*/ + virtual void setNode(osg::Node*) {} + + /** Return node if attached.*/ + virtual osg::Node* getNode() const { return NULL; } + + /** Move the camera to the default position. + May be ignored by manipulators if home functionality is not appropriate.*/ + virtual void home(GUIEventAdapter& ,GUIActionAdapter&) {} + + /** Start/restart the manipulator.*/ + virtual void init(GUIEventAdapter& ,GUIActionAdapter&) {} + + /** Handle events, return true if handled, false otherwise.*/ + virtual bool update(GUIEventAdapter& ea,GUIActionAdapter& us); + + + protected: + + // Reference pointer to a camera + osg::ref_ptr _camera; + +}; + +} + +#endif + diff --git a/include/osgUtil/DisplayListVisitor b/include/osgUtil/DisplayListVisitor new file mode 100644 index 000000000..e38874ba6 --- /dev/null +++ b/include/osgUtil/DisplayListVisitor @@ -0,0 +1,72 @@ +#ifndef OSGUTIL_COMPILEGEOSETVISITOR +#define OSGUTIL_COMPILEGEOSETVISITOR 1 + +#include +#include + +#include + +namespace osgUtil { + +/** Visitor for traversing scene set each osg::GeoSet's _useDisplayList flag, or + * immediately compiling osg::GeoSet's OpenGL Display lists. The mode of operation + * of the vistor is controlled by setting the DisplayListMode either on visitor + * constructor or via the setDisplayListMode() method. DisplayListMode options are: + * _displayListMode == SWITCH_ON_AND_COMPILE_DISPLAY_LISTS cals gset->compile() on + * all Geode childern. Note, the visitor must only be used within a valid + * OpenGL context as compile uses OpenGL calls. + * _displayListMode == SWITCH_ON_DISPLAY_LISTS sets the Geode's children with + * gset->setUseDisplayList(true), this method does not directly create display list, + * or uses OpenGL calls so if safe to use before a valid OpenGL context has been set up. + * On the next redraw of the scene, the gset's draw methods will be called + * which then will respond to their _useDisplayList being set by creating display lists + * automatically. + * _displayListMode == SWITCH_OFF_DISPLAY_LISTS sets the Geode's children with + * gset->setUseDisplayList(false), this method does not directly create display list, + * or uses OpenGL calls so if safe to use before a valid OpenGL context has been set up. + */ +class OSGUTIL_EXPORT DisplayListVisitor : public osg::NodeVisitor +{ + public: + + /** Operation modes of the DisplayListVisitor.*/ + enum DisplayListMode + { + SWITCH_ON_AND_COMPILE_DISPLAY_LISTS, + SWITCH_ON_DISPLAY_LISTS, + SWITCH_OFF_DISPLAY_LISTS + }; + + /** Construct a CompileGeoSetsVisior to traverse all child, + * with set specfied display list mode. Default mode is to + * gset->setUseDisplayList(true). + */ + DisplayListVisitor(DisplayListMode mode=SWITCH_ON_DISPLAY_LISTS); + + /** Set the operational mode of how the visitor should set up osg::GeoSet's.*/ + void setDisplayListMode(DisplayListMode mode) { _displayListMode = mode; } + + /** Get the operational mode.*/ + DisplayListMode getDisplayListMode() const { return _displayListMode; } + + /** Simply traverse using standard NodeVisitor traverse method.*/ + virtual void apply(osg::Node& node) + { + traverse(node); + } + + /** For each Geode visited set the display list usage according to the + * _displayListMode. + */ + virtual void apply(osg::Geode& node); + + protected: + + DisplayListMode _displayListMode; + +}; + +}; + +#endif + diff --git a/include/osgUtil/DriveManipulator b/include/osgUtil/DriveManipulator new file mode 100644 index 000000000..6996b3971 --- /dev/null +++ b/include/osgUtil/DriveManipulator @@ -0,0 +1,68 @@ +#ifndef OSGUTIL_DRIVEMANIPULATOR +#define OSGUTIL_DRIVEMANIPULATOR 1 + +#include + +namespace osgUtil{ + +class OSGUTIL_EXPORT DriveManipulator : public CameraManipulator +{ + public: + + DriveManipulator(); + virtual ~DriveManipulator(); + + /** Attach a node to the manipulator. + Automatically detaches previously attached node. + setNode(NULL) detaches previously nodes. + Is ignored by manipulators which do not require a reference model.*/ + virtual void setNode(osg::Node*); + + /** Return node if attached.*/ + virtual osg::Node* getNode() const; + + /** Move the camera to the default position. + May be ignored by manipulators if home functionality is not appropriate.*/ + virtual void home(GUIEventAdapter& ea,GUIActionAdapter& us); + + /** Start/restart the manipulator.*/ + virtual void init(GUIEventAdapter& ea,GUIActionAdapter& us); + + /** handle events, return true if handled, false otherwise.*/ + virtual bool update(GUIEventAdapter& ea,GUIActionAdapter& us); + + private: + + /** Reset the internal GUIEvent stack.*/ + void flushMouseEventStack(); + /** Add the current mouse GUIEvent to internal stack.*/ + void addMouseEvent(GUIEventAdapter& ea); + + /** For the give mouse movement calculate the movement of the camera. + Return true is camera has moved and a redraw is required.*/ + bool calcMovement(); + + // Internal event stack comprising last three mouse events. + osg::ref_ptr _ga_t1; + osg::ref_ptr _ga_t0; + + osg::ref_ptr _node; + + float _modelScale; + float _velocity; + float _height; + float _buffer; + + enum SpeedControlMode { + USE_MOUSE_Y_FOR_SPEED, + USE_MOUSE_BUTTONS_FOR_SPEED + }; + + SpeedControlMode _speedMode; + +}; + +} + +#endif + diff --git a/include/osgUtil/Export b/include/osgUtil/Export new file mode 100644 index 000000000..5220152d9 --- /dev/null +++ b/include/osgUtil/Export @@ -0,0 +1,22 @@ +// The following symbole has a underscore suffix for compatibility. +#ifndef OSGUTIL_EXPORT_ +#define OSGUTIL_EXPORT_ 1 + +#ifdef WIN32 + #pragma warning( disable : 4251 ) + #pragma warning( disable : 4275 ) + #pragma warning( disable : 4786 ) +#endif + +#if defined(_MSC_VER) + # ifdef OSGUTIL_LIBRARY + # define OSGUTIL_EXPORT __declspec(dllexport) + # else + # define OSGUTIL_EXPORT __declspec(dllimport) + #endif /* OSGUTIL_LIBRARY */ +#else + #define OSGUTIL_EXPORT +#endif + +#endif + diff --git a/include/osgUtil/FlightManipulator b/include/osgUtil/FlightManipulator new file mode 100644 index 000000000..9872e4c33 --- /dev/null +++ b/include/osgUtil/FlightManipulator @@ -0,0 +1,69 @@ +#ifndef OSGUTIL_FLIGHTMANIPULATOR +#define OSGUTIL_FLIGHTMANIPULATOR 1 + +#include + +namespace osgUtil{ + +class OSGUTIL_EXPORT FlightManipulator : public CameraManipulator +{ + public: + + FlightManipulator(); + virtual ~FlightManipulator(); + + /** Attach a node to the manipulator. + Automatically detaches previously attached node. + setNode(NULL) detaches previously nodes. + Is ignored by manipulators which do not require a reference model.*/ + virtual void setNode(osg::Node*); + + /** Return node if attached.*/ + virtual osg::Node* getNode() const; + + /** Move the camera to the default position. + May be ignored by manipulators if home functionality is not appropriate.*/ + virtual void home(GUIEventAdapter& ea,GUIActionAdapter& us); + + /** Start/restart the manipulator.*/ + virtual void init(GUIEventAdapter& ea,GUIActionAdapter& us); + + /** handle events, return true if handled, false otherwise.*/ + virtual bool update(GUIEventAdapter& ea,GUIActionAdapter& us); + + enum YawControlMode { + YAW_AUTOMATICALLY_WHEN_BANKED, + NO_AUTOMATIC_YAW + }; + + /** Set the yaw control between no yaw and yawing when banked.*/ + void setYawControlMode(YawControlMode ycm) { _yawMode = ycm; } + + private: + + /** Reset the internal GUIEvent stack.*/ + void flushMouseEventStack(); + /** Add the current mouse GUIEvent to internal stack.*/ + void addMouseEvent(GUIEventAdapter& ea); + + /** For the give mouse movement calculate the movement of the camera. + Return true is camera has moved and a redraw is required.*/ + bool calcMovement(); + + // Internal event stack comprising last three mouse events. + osg::ref_ptr _ga_t1; + osg::ref_ptr _ga_t0; + + osg::ref_ptr _node; + + float _modelScale; + float _velocity; + + YawControlMode _yawMode; + +}; + +} + +#endif + diff --git a/include/osgUtil/GUIActionAdapter b/include/osgUtil/GUIActionAdapter new file mode 100644 index 000000000..ce9db5a10 --- /dev/null +++ b/include/osgUtil/GUIActionAdapter @@ -0,0 +1,23 @@ +#ifndef OSGUTIL_GUIACTIONADAPTER +#define OSGUTIL_GUIACTIONADAPTER 1 + +#include + +namespace osgUtil{ + + +/** Pure virtual base class for adapting the GUI actions for use in CameraManipulators.*/ +class GUIActionAdapter +{ + public: + + virtual void needRedraw(bool needed=true) = 0; + virtual void needContinuousUpdate(bool needed=true) = 0; + virtual void needWarpPointer(int x,int y) = 0; + +}; + +} + +#endif + diff --git a/include/osgUtil/GUIEventAdapter b/include/osgUtil/GUIEventAdapter new file mode 100644 index 000000000..78929367a --- /dev/null +++ b/include/osgUtil/GUIEventAdapter @@ -0,0 +1,80 @@ +#ifndef OSGUTIL_GUIEVENTADAPTER +#define OSGUTIL_GUIEVENTADAPTER 1 + +#include +#include + +namespace osgUtil{ + + +/** Pure virtual base class for adapting platform specfic events into + generic keyboard and mouse events. */ +class GUIEventAdapter : public osg::Referenced +{ + public: + + GUIEventAdapter() {} + + + enum MouseButtonMask { + LEFT_BUTTON=1, + MIDDLE_BUTTON=2, + RIGHT_BUTTON=4 + }; + + enum EventType { + PUSH, + RELEASE, + DRAG, + MOVE, + KEYBOARD, + FRAME, + RESIZE, + NONE + }; + + /** Get the EventType of the GUI event.*/ + virtual EventType getEventType() const = 0; + + /** key pressed, return -1 if inapropriate for this event. */ + virtual int getKey() const = 0; + + /** button pressed/released, return -1 if inappropriate for this event.*/ + virtual int getButton() const = 0; + + /** window minimum x. */ + virtual int getXmin() const = 0; + + /** window maximum x. */ + virtual int getXmax() const = 0; + + /** window minimum y. */ + virtual int getYmin() const = 0; + + /** window maximum y. */ + virtual int getYmax() const = 0; + + /** current mouse x position.*/ + virtual int getX() const = 0; + + /** current mouse y position.*/ + virtual int getY() const = 0; + + /** current mouse button state */ + virtual unsigned int getButtonMask() const = 0; + + /** time in seconds of event. */ + virtual float time() const = 0; + + + protected: + + /** Force users to create on heap, so that mulitple referencing is safe.*/ + virtual ~GUIEventAdapter() {} + +}; + +} + +#endif + diff --git a/include/osgUtil/IntersectVisitor b/include/osgUtil/IntersectVisitor new file mode 100644 index 000000000..2ae17a1ac --- /dev/null +++ b/include/osgUtil/IntersectVisitor @@ -0,0 +1,142 @@ +#ifndef OSGUTIL_INTERSECTVISITOR +#define OSGUTIL_INTERSECTVISITOR 1 + +#include +#include +#include +#include + +#include + +#include +#include +#include + +namespace osgUtil { + +class OSGUTIL_EXPORT IntersectState : public osg::Referenced +{ + public: + + IntersectState(); + + osg::Matrix* _matrix; + osg::Matrix* _inverse; + + typedef std::vector< std::pair > SegList; + SegList _segList; + + typedef unsigned int SegmentMask; + typedef std::vector SegmentMaskStack; + SegmentMaskStack _segmentMaskStack; + + bool isCulled(const osg::BoundingSphere& bs,SegmentMask& segMaskOut); + bool isCulled(const osg::BoundingBox& bb,SegmentMask& segMaskOut); + + protected: + + ~IntersectState(); + +}; + +class OSGUTIL_EXPORT Hit : public osg::Referenced +{ + public: + Hit(); + Hit(const Hit& hit); + ~Hit(); + + Hit& operator = (const Hit& hit); + + typedef std::vector VecIndexList; + + bool operator < (const Hit& hit) const + { + if (_originalSeghit._originalSeg) return false; + return _ratio HitList; + typedef std::vector HitList; + typedef std::map SegHitListMap; + HitList& getHitList(osg::Seg* seg) { return _segHitList[seg]; } + int getNumHits(osg::Seg* seg) { return _segHitList[seg].size(); } + + bool hits(); + + virtual void apply(osg::Node&); + virtual void apply(osg::Geode& node); + virtual void apply(osg::Billboard& node); + + virtual void apply(osg::Group& node); + virtual void apply(osg::DCS& node); + virtual void apply(osg::Switch& node); + virtual void apply(osg::LOD& node); + virtual void apply(osg::Scene& node); + + protected: + + + bool intersect(osg::GeoSet& gset); + + void pushMatrix(const osg::Matrix& matrix); + void popMatrix(); + + bool enterNode(osg::Node& node); + void leaveNode(); + + typedef std::vector IntersectStateStack; + IntersectStateStack _intersectStateStack; + + osg::NodePath _nodePath; + + HitReportingMode _hitReportingMode; + SegHitListMap _segHitList; +}; + +}; + +#endif + diff --git a/include/osgUtil/RenderVisitor b/include/osgUtil/RenderVisitor new file mode 100644 index 000000000..8246da666 --- /dev/null +++ b/include/osgUtil/RenderVisitor @@ -0,0 +1,196 @@ +#ifndef OSGUTIL_RENDERVISITOR +#define OSGUTIL_RENDERVISITOR 1 + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +namespace osgUtil { + +/** Container class for encapsulating the viewing state in local + coordinates, during the cull traversal. +*/ +class OSGUTIL_EXPORT ViewState : public osg::Referenced +{ + public: + + ViewState(); + + osg::Matrix* _matrix; + osg::Matrix* _inverse; + osg::Vec3 _eyePoint; + osg::Vec3 _centerPoint; + osg::Vec3 _lookVector; + osg::Vec3 _upVector; + osg::Vec3 _frustumTopNormal; + osg::Vec3 _frustumBottomNormal; + osg::Vec3 _frustumLeftNormal; + osg::Vec3 _frustumRightNormal; + float _ratio; + + bool _viewFrustumCullingActive; + bool _smallFeatureCullingActive; + + bool isCulled(const osg::BoundingSphere& sp); + bool isCulled(const osg::BoundingBox& bb); + + protected: + + ~ViewState(); + +}; + + +/** + * Basic NodeVisitor implementation for rendering a scene. + * This visitor traverses the scene graph, collecting transparent and + * opaque osg::GeoSets into a depth sorted transparent bin and a state + * sorted opaque bin. The opaque bin is rendered first, and then the + * transparent bin in rendered in order from the furthest osg::GeoSet + * from the eye to the one nearest the eye. + */ +class OSGUTIL_EXPORT RenderVisitor : public osg::NodeVisitor +{ + public: + + RenderVisitor(); + virtual ~RenderVisitor(); + + void reset(); + + virtual void apply(osg::Node&); + virtual void apply(osg::Geode& node); + virtual void apply(osg::Billboard& node); + virtual void apply(osg::LightSource& node); + + virtual void apply(osg::Group& node); + virtual void apply(osg::DCS& node); + virtual void apply(osg::Switch& node); + virtual void apply(osg::LOD& node); + virtual void apply(osg::Scene& node); + + void setGlobalState(osg::GeoState* global); + + void setPerspective(const osg::Camera& camera); + void setPerspective(float fovy,float aspect,float znear,float zfar); + + void setLookAt(const osg::Camera& camera); + void setLookAt(const osg::Vec3& eye,const osg::Vec3& center,const osg::Vec3& upVector); + void setLookAt(double eyeX,double eyeY,double eyeZ, + double centerX,double centerY,double centerZ, + double upX,double upY,double upZ); + + + void setLODBias(float bias) { _LODBias = bias; } + float getLODBias() { return _LODBias; } + + enum TransparencySortMode { + LOOK_VECTOR_DISTANCE, + OBJECT_EYE_POINT_DISTANCE + }; + + void setTransparencySortMode(TransparencySortMode tsm) { _tsm = tsm; } + + enum CullingType { + VIEW_FRUSTUM_CULLING, + SMALL_FEATURE_CULLING + }; + + /** + * Enables/disables the specified culling type. + * @param ct The culling type to enable/disable. + * @param active true enables the culling type, false disables. + */ + void setCullingActive(CullingType ct, bool active); + + /** + * Returns the state of the specified culling type. + * @result true, if culling type is enabled, false otherwise. + */ + bool getCullingActive(CullingType ct); + + /** + * Calculates the near_plane and the far_plane for the current + * camera view depending on the objects currently stored in the + * opaque and transparent bins. + * @param near_plane reference to a variable that can store the + * near plane result. + * @param far_plane reference to a variable that can store the + * far plane result. + * @result true, if near_plane and far_plane contain valid values, + * false otherwise. + */ + bool calcNearFar(double& near_plane, double& far_plane); + + /** + * Renders the osg::GeoSets that were collected in the opaque and + * transparent bins before. + */ + void render(); + + protected: + + void pushMatrix(const osg::Matrix& matrix); + void popMatrix(); + + osg::Matrix* getCurrentMatrix(); + osg::Matrix* getInverseCurrentMatrix(); + const osg::Vec3& getEyeLocal(); + const osg::Vec3& getCenterLocal(); + const osg::Vec3& getLookVectorLocal(); + + + bool _viewFrustumCullingActive; + bool _smallFeatureCullingActive; + + bool isCulled(const osg::BoundingSphere& sp); + bool isCulled(const osg::BoundingBox& bb); + + typedef std::pair MatrixGeoSet; + + typedef std::vector ViewStateStack; + ViewStateStack _viewStateStack; + ViewState* _tvs; + ViewState* _cvs; + + + typedef std::multimap OpaqueList; + typedef std::multimap TransparentList; + typedef std::map LightList; + + OpaqueList _opaqueGeoSets; + TransparentList _transparentGeoSets; + LightList _lights; + + osg::GeoState* _globalState; + float _LODBias; + + float _fovy; + float _aspect; + float _znear; + float _zfar; + + void calculateClippingPlanes(); + + // frustum clipping normals. + osg::Vec3 _frustumTop; + osg::Vec3 _frustumBottom; + osg::Vec3 _frustumLeft; + osg::Vec3 _frustumRight; + + TransparencySortMode _tsm; +}; + +}; + +#endif + diff --git a/include/osgUtil/SceneView b/include/osgUtil/SceneView new file mode 100644 index 000000000..8749ebcec --- /dev/null +++ b/include/osgUtil/SceneView @@ -0,0 +1,165 @@ +#ifndef OSGUTIL_SCENEVIEW +#define OSGUTIL_SCENEVIEW 1 + +#include +#include +#include +#include + +#include + +#include + +namespace osgUtil { + +/** + * SceneView is literaly a view of a scene, encapsulating the + * camera, global state, lights and the scene itself. Provides + * methods for setting up the view and rendering it. +*/ +class OSGUTIL_EXPORT SceneView : public osg::Referenced +{ + public: + + /** Constrcut a default scene view.*/ + SceneView(); + + /** Set the data which to view. The data will typically be + * an osg::Scene but can be any osg::Node type. + */ + void setSceneData(osg::Node* node) { _sceneData = node; _need_compile = true;} + /** Get the scene data which to view. The data will typically be + * an osg::Scene but can be any osg::Node type. + */ + osg::Node* getSceneData() { return _sceneData.get(); } + + /** Set the viewport of the scene view. */ + void setViewport(int x,int y,int width,int height) + { + _view[0] = x; + _view[1] = y; + _view[2] = width; + _view[3] = height; + } + + /** Get the viewport of the scene view. */ + void getViewport(int& x,int& y,int& width,int& height) + { + x = _view[0]; + y = _view[1]; + width = _view[2]; + height = _view[3]; + } + + /** Set scene view to use default global state, light, camera + * and render visitor. + */ + void setDefaults(); + + /** Set the background color used in glClearColor(). + Defaults to an off blue color.*/ + void setBackgroundColor(const osg::Vec4& color) { _backgroundColor=color; } + /** Get the background color.*/ + const osg::Vec4& getBackgroundColor() const { return _backgroundColor; } + + void setGlobalState(osg::GeoState* state) { _globalState = state; } + osg::GeoState* getGlobalState() const { return _globalState.get(); } + + enum LightingMode { + HEADLIGHT, // default + SKY_LIGHT, + NO_SCENEVIEW_LIGHT + }; + + void setLightingMode(LightingMode mode) { _lightingMode=mode; } + LightingMode getLightingMode() const { return _lightingMode; } + + void setLight(osg::Light* light) { _light = light; } + osg::Light* getLight() const { return _light.get(); } + + void setCamera(osg::Camera* camera) { _camera = camera; } + osg::Camera* getCamera() const { return _camera.get(); } + + void setRenderVisitor(osgUtil::RenderVisitor* rv) { _renderVisitor = rv; } + osgUtil::RenderVisitor* getRenderVisitor() const { return _renderVisitor.get(); } + + void setLODBias(float bias) { _lodBias = bias; } + float getLODBias() const { return _lodBias; } + + /** Set to true if you want SceneView to automatically calculate values + for the near/far clipping planes, each frame, set false to use camera's + internal near and far planes. Default value is true. + */ + void setCalcNearFar(bool calc) { _calc_nearfar = calc; } + /** return true if SceneView automatically caclculates near and + far clipping planes for each frame. + */ + bool getCalcNearFar() { return _calc_nearfar; } + + /** Calculate, via glUnProject, the object coordinates of a window point. + Note, current implementation requires that SceneView::draw() has been previously called + for projectWindowIntoObject to produce valid values. Consistent with OpenGL + windows coordinates are calculated relative to the bottom left of the window. + Returns true on successful projection. + */ + bool projectWindowIntoObject(const osg::Vec3& window,osg::Vec3& object) const; + + /** Calculate, via glUnProject, the object coordinates of a window x,y + when projected onto the near and far planes. + Note, current implementation requires that SceneView::draw() has been previously called + for projectWindowIntoObject to produce valid values. Consistent with OpenGL + windows coordinates are calculated relative to the bottom left of the window. + Returns true on successful projection. + */ + bool projectWindowXYIntoObject(int x,int y,osg::Vec3& near_point,osg::Vec3& far_point) const; + + /** Calculate, via glProject, the object coordinates of a window. + Note, current implementation requires that SceneView::draw() has been previously called + for projectWindowIntoObject to produce valid values. Consistent with OpenGL + windows coordinates are calculated relative to the bottom left of the window, + whereas as window API's normally have the top left as the origin, + so you may need to pass in (mouseX,window_height-mouseY,...). + Returns true on successful projection. + */ + bool projectObjectIntoWindow(const osg::Vec3& object,osg::Vec3& window) const; + + + virtual void cull(); + virtual void draw(); + + protected: + + virtual ~SceneView(); + + osg::ref_ptr _sceneData; + osg::ref_ptr _globalState; + osg::ref_ptr _light; + osg::ref_ptr _camera; + osg::ref_ptr _renderVisitor; + + bool _need_compile; + bool _calc_nearfar; + + osg::Vec4 _backgroundColor; + + double _near_plane; + double _far_plane; + + float _lodBias; + + // viewport x,y,width,height respectiveyly. + GLint _view[4]; + + // model and project matices, used by glUnproject to get + // to generate rays form the eyepoint through the mouse x,y. + GLdouble _model[16]; + GLdouble _proj[16]; + + LightingMode _lightingMode; + +}; + +}; + +#endif + diff --git a/include/osgUtil/TrackballManipulator b/include/osgUtil/TrackballManipulator new file mode 100644 index 000000000..47aad565b --- /dev/null +++ b/include/osgUtil/TrackballManipulator @@ -0,0 +1,70 @@ +#ifndef OSGUTIL_TRACKBALLMANIPULATOR +#define OSGUTIL_TRACKBALLMANIPULATOR 1 + +#include + +namespace osgUtil{ + +class OSGUTIL_EXPORT TrackballManipulator : public CameraManipulator +{ + public: + + TrackballManipulator(); + virtual ~TrackballManipulator(); + + /** Attach a node to the manipulator. + Automatically detaches previously attached node. + setNode(NULL) detaches previously nodes. + Is ignored by manipulators which do not require a reference model.*/ + virtual void setNode(osg::Node*); + + /** Return node if attached.*/ + virtual osg::Node* getNode() const; + + /** Move the camera to the default position. + May be ignored by manipulators if home functionality is not appropriate.*/ + virtual void home(GUIEventAdapter& ea,GUIActionAdapter& us); + + /** Start/restart the manipulator.*/ + virtual void init(GUIEventAdapter& ea,GUIActionAdapter& us); + + + /** handle events, return true if handled, false otherwise.*/ + virtual bool update(GUIEventAdapter& ea,GUIActionAdapter& us); + + private: + + /** Reset the internal GUIEvent stack.*/ + void flushMouseEventStack(); + /** Add the current mouse GUIEvent to internal stack.*/ + void addMouseEvent(GUIEventAdapter& ea); + + /** For the give mouse movement calculate the movement of the camera. + Return true is camera has moved and a redraw is required.*/ + bool calcMovement(); + + void trackball(osg::Vec3& axis,float& angle, float p1x, float p1y, float p2x, float p2y); + float tb_project_to_sphere(float r, float x, float y); + + + /** Check the speed at which the mouse is moving. + If speed is below a threshold then return false, otherwise return true.*/ + bool isMouseMoving(); + + // Internal event stack comprising last three mouse events. + osg::ref_ptr _ga_t1; + osg::ref_ptr _ga_t0; + + osg::ref_ptr _node; + + float _modelScale; + float _minimumZoomScale; + + bool _thrown; + +}; + +} + +#endif + diff --git a/include/osgUtil/Version b/include/osgUtil/Version new file mode 100644 index 000000000..0b9c084ec --- /dev/null +++ b/include/osgUtil/Version @@ -0,0 +1,35 @@ +#ifndef OSGUTIL_VERSION +#define OSGUTIL_VERSION 1 + +#include + + +extern "C" { + +/** + * getVersion_osgUtil() returns the library version number. + * Numbering conventon : osg_src-0.8-31 will return 0.8.31 from getVersion_osgUtil. + * + * This C function can be also used to check for the existance of the OpenSceneGraph + * library using autoconf and its m4 macro AC_CHECK_LIB. + * + * Here is the code to add to your configure.in: + \verbatim + # + # Check for the OpenSceneGraph (OSG) utility library + # + AC_CHECK_LIB(osg, osgUtilGetVersion, , + [AC_MSG_ERROR(OpenSceneGraph utility library not found. See http://www.openscenegraph.org)],) + \endverbatim +*/ +extern OSGUTIL_EXPORT const char* osgUtilGetVersion(); + +/** + * getLibraryName_osgUtil() returns the library name in human friendly form. +*/ +extern OSGUTIL_EXPORT const char* osgUtilGetLibraryName(); + +}; + +#endif + diff --git a/index.html b/index.html new file mode 100644 index 000000000..391db30c9 --- /dev/null +++ b/index.html @@ -0,0 +1,161 @@ + + + + + + OSG Distribution + + + +
+

+Open Scene Graph

+The Open Scene Graph (OSG) is an Open Source (LGPL), Stanadard C++, OpenGL +based scene graph for cross-platform 3D real-time visualisation..  +The OSG is simply a scene graph and by design does not attempt to encompass +application frame works and user interface, the design is kept focused +on the issues of representing a 3D scene and rendering it in real-time. +

There are also support libraries such as osgGLUT for bringing up a basic +UI, however this is not the focus of the OSG.  For more sophisticated +user interfaces it is recommended to intergrate the OSG graphics with a +fully fledge UI toolkit, this has already been done by users for FLTK, +WxWindows and X, with the potential for many more. +

This release is a ALPHA version, and is subject to continuous development +with the API of features subject to change. +

For instructions of how to compile, install the osg libraries and to +run the demos please read the README file. +

Regards, +

Robert Osfield. +
January 2001. +

+


+

Contacts +

The OSG's website is http://www.openscenegraph.org +

The OSG's mailing list and mirror of downloads can be accessed at +
source forge -  http://sourceforge.net/projects/openscenegraph +

Bugs, patches, querries can be sent to the info@openscenegraph.org +or to the mailing list. +

+


+

Contents of distribution +

./        Root directory. +

README       +text file containing guide of how to get the OSG compiling, and running +the demos. +
COPYING    text  file containing +the details of the Open Source LGPL license which the OSG is released under +
AUTHORS    text file containing +names of contributors to the osg. +
NEWS           +text file listing coarsed grained changes between releases. +
ChangeLog     text file +listing fine grained changes between releases. +
TODO           +text file listing  left to implement/extend/rewrite. +
FAQ              +text file listing Fequently asked quesions. +
Makefile         +Unix makefile. +
index.html       This file!
+ +


doc/   Documentation directory +

index.html      +Documentation index. +
osg/               +core scene graph reference guide. +
osgUtil/          +scene graph utilities reference guide. +
osgGLUT/     +simple GLUT based viewer base classes reference guide.
+ +


include/     External +includes (i.e. files which would be installed in /usr/include) +

include/osg/             +The OSG library header files. +
include/osgUtil/        +The OSG Utility library header files. +
include/osgGLUT/   The OSG +GLUT library header files.
+ +


src/    source files (including +internal includes) +

src/osg           +The OSG library source files. +
                      +Contians all core osg classes, including +
                      +reader/writer support for the .osg ascii format, +
                      +and sgi's rgb image format. +

src/osgUtil      +The OSG utility library source files. +
                      +Contains useful utility classes such as for setting +
                       +up and rendering/draw. +

src/osgGLUT  The OSG GLUT library source +files. +
                       +Contains basic GLUT viewer base classes used by +
                       +demo prgrams to bring up window and provide keyboard +
                       +and mouse interaction. +

src/osgPlugins/  Import/Export/Node +kit plug-ins to the OSG. +
                        +flt/      Open +Flight reader plugin. +
                        +fly/      Hang +gliding flying site reader plugin. +
                        +pfb/      Performer +reader and writer plugin. +
                        +png/      PNG +image file format reader plugin. +
                        +gif/      GIF +image file format reader plugin. +
                        +jpeg/     JPEG image +file format reader plugin. +
                        +pic/      PIC +image file format reader plugin. +
                        +tga/      TGA +image file format reader plugin. +
                        +tiff/     TIFF image +file format reader plugin. +

src/Demos/      sgv/      +A basic scene graph viewer for the OSG which is able to load .osg file +and above formats. +
                       +cube/    A basic animation +of an oscillating cube.

+ +


lib/                         +The local repository for the OSG library and plugins (files to be installed +in /usr/lib/ or /usr/local/lib) +
lib/osgPlugins/        +The local repository for the OSG plugins (files to be installed in /usr/lib/osgPlugins +or +
                             +/usr/local/lib/osgPlugins) +

bin/                        +The local repository for the OSG binary files (files to be installed in +/usr/bin or /usr/local/bin) +

Make/                    +Unix platform specific make rules and dependancies. +

VisualStudio/          +MS VisualC++ 6.0 Make/Workspace files. +

dist/                        +Distribution make files for RedHat Linux. +

NSPlugin/               +Netscape plugin viewer for Linux. +
  + + diff --git a/src/Demos/Makefile b/src/Demos/Makefile new file mode 100644 index 000000000..09e0afd30 --- /dev/null +++ b/src/Demos/Makefile @@ -0,0 +1,29 @@ +#!smake +SHELL=/bin/sh + +DIRS = sgv cube + +all : + for f in $(DIRS) ; do cd $$f; make ; cd ..; done + +clean : + for f in $(DIRS) ; do cd $$f; make clean; cd ..; done + +clobber : + for f in $(DIRS) ; do cd $$f; make clobber; cd ..; done + +depend : + for f in $(DIRS) ; do cd $$f; make depend; cd ..; done + +to_unix : + for f in $(DIRS) ; do cd $$f; to_unix Makefile Makefile; cd ..; done + for f in $(DIRS) ; do cd $$f; make to_unix; cd ..; done + +install : + for f in $(DIRS) ; do cd $$f; make install; cd ..; done + +instlinks : + for f in $(DIRS) ; do cd $$f; make instlinks; cd ..; done + +instclean : + for f in $(DIRS) ; do cd $$f; make instclean; cd ..; done diff --git a/src/Demos/cube/Makedepend b/src/Demos/cube/Makedepend new file mode 100644 index 000000000..e69de29bb diff --git a/src/Demos/cube/Makefile b/src/Demos/cube/Makefile new file mode 100644 index 000000000..a6257228a --- /dev/null +++ b/src/Demos/cube/Makefile @@ -0,0 +1,15 @@ +#!smake +include ../../../Make/makedefs + +C++FILES = \ + cube.cpp + +TARGET = ../../../bin/cube + +TARGET_BIN_FILES = cube + +LIBS = -losgGLUT -losgUtil -losg -lglut -lGLU -lGL -lm -lXmu -lX11 -lXi +C++FLAGS += -I../../../include +LDFLAGS += -L../../../lib -L/usr/X11R6/lib + +include ../../../Make/makerules diff --git a/src/Demos/cube/cube.cpp b/src/Demos/cube/cube.cpp new file mode 100644 index 000000000..8522e2530 --- /dev/null +++ b/src/Demos/cube/cube.cpp @@ -0,0 +1,135 @@ +#include "osgGLUT/Viewer" + +#include "osg/Geode" +#include "osg/GeoSet" +#include "osg/GeoState" +#include "osg/Material" +#include "osg/Vec3" +#include "osg/DCS" + +#include +#include + +// ---------------------------------------------------------------------- +// Global variables - this is basically the stuff which will be animated +// ---------------------------------------------------------------------- +osg::DCS* myDCS; +osg::GeoSet* cube; + +int mytime=0; // in milliseconds +unsigned int dt=50; // in milliseconds +double omega=0.002; // in inverse milliseconds + +// ---------------------------------------------------------------- +// This is the callback function registered with GLUT to be called +// at a future time in the GLUT loop +// ---------------------------------------------------------------- +void timedCB( int delta_t ) +{ + + static float lastdx = 0; + static float lastdy = 0; + static float lastdz = 0; + + mytime+=dt; + + // --------------------------------------------------------- + // Update the DCS so that the cube will appear to oscillate + // --------------------------------------------------------- + double dx = 0.5 * cos( (double) omega * (double) mytime ); + double dy = 0.5 * sin( (double) omega * (double) mytime ); + double dz = 0.0; + myDCS->preTranslate( -lastdx, -lastdy, -lastdz ); + myDCS->preTranslate( (float) dx, (float) dy, dz ); + lastdx=dx; lastdy=dy; lastdz=dz; + + // Graeme, commeted out this call as the cube itself remains static. + // cube->dirtyDisplayList(); + + // ------------------------------------------- + // If required, reschedule the timed callback + // ------------------------------------------- + if ( delta_t != 0 ) { + glutTimerFunc( (unsigned int) delta_t, timedCB, delta_t ); + } +} + + +int main( int argc, char **argv ) +{ + + osg::Geode* geode = new osg::Geode(); + + // ------------------------------------------- + // Set up a new GeoSet which will be our cube + // ------------------------------------------- + cube = new osg::GeoSet(); + + cube->setPrimType( osg::GeoSet::POLYGON ); + cube->setNumPrims( 6 ); // the six square faces + + int cubeLengthList[6] = { 4, 4, 4, 4, 4, 4 }; // each has 4 vertices + cube->setPrimLengths( cubeLengthList ); + + osg::Vec3 cubeCoords[24]; + cubeCoords[0].set( -1.0000f, 1.0000f, -1.000f ); + cubeCoords[1].set( 1.0000f, 1.0000f, -1.0000f ); + cubeCoords[2].set( 1.0000f, -1.0000f, -1.0000f ); + cubeCoords[3].set( -1.0000f, -1.0000f, -1.000 ); + cubeCoords[4].set( 1.0000f, 1.0000f, -1.0000f ); + cubeCoords[5].set( 1.0000f, 1.0000f, 1.0000f ); + cubeCoords[6].set( 1.0000f, -1.0000f, 1.0000f ); + cubeCoords[7].set( 1.0000f, -1.0000f, -1.0000f ); + cubeCoords[8].set( 1.0000f, 1.0000f, 1.0000f ); + cubeCoords[9].set( -1.0000f, 1.0000f, 1.000f ); + cubeCoords[10].set( -1.0000f, -1.0000f, 1.000f ); + cubeCoords[11].set( 1.0000f, -1.0000f, 1.0000f ); + cubeCoords[12].set( -1.0000f, 1.0000f, 1.000 ); + cubeCoords[13].set( -1.0000f, 1.0000f, -1.000 ); + cubeCoords[14].set( -1.0000f, -1.0000f, -1.000 ); + cubeCoords[15].set( -1.0000f, -1.0000f, 1.000 ); + cubeCoords[16].set( -1.0000f, 1.0000f, 1.000 ); + cubeCoords[17].set( 1.0000f, 1.0000f, 1.0000f ); + cubeCoords[18].set( 1.0000f, 1.0000f, -1.0000f ); + cubeCoords[19].set( -1.0000f, 1.0000f, -1.000f ); + cubeCoords[20].set( -1.0000f, -1.0000f, 1.000f ); + cubeCoords[21].set( -1.0000f, -1.0000f, -1.000f ); + cubeCoords[22].set( 1.0000f, -1.0000f, -1.0000f ); + cubeCoords[23].set( 1.0000f, -1.0000f, 1.0000f ); + cube->setCoords( cubeCoords ); + + // --------------------------------------- + // Set up a GeoState to make the cube red + // --------------------------------------- + osg::GeoState* cubeState = new osg::GeoState(); + osg::Material* redMaterial = new osg::Material(); + osg::Vec4 red( 1.0f, 0.0f, 0.0f, 0.0f ); + redMaterial->setEmission( osg::Material::FACE_FRONT_AND_BACK, red ); + redMaterial->setAmbient( osg::Material::FACE_FRONT_AND_BACK, red ); + redMaterial->setDiffuse( osg::Material::FACE_FRONT_AND_BACK, red ); + redMaterial->setSpecular( osg::Material::FACE_FRONT_AND_BACK, red ); + cubeState->setAttribute( osg::GeoState::MATERIAL, redMaterial ); + + cube->setGeoState( cubeState ); + + geode->addGeoSet( cube ); + + myDCS = new osg::DCS(); + myDCS->addChild( geode ); + + glutInit( &argc, argv ); + + // --------------------------------------------------------------------- + // Register a timer callback with GLUT, in the first instance as a test + // This will call the function "timedCB(value)" after dt ms + // I have decided to use value as the time for the next scheduling + // If the last parameter=0 then don't reschedule the timer. + // --------------------------------------------------------------------- + glutTimerFunc( dt, timedCB, dt ); + + osgGLUT::Viewer viewer; + viewer.init( myDCS ); + viewer.run(); + + return 0; +} diff --git a/src/Demos/sgv/Makedepend b/src/Demos/sgv/Makedepend new file mode 100644 index 000000000..e69de29bb diff --git a/src/Demos/sgv/Makefile b/src/Demos/sgv/Makefile new file mode 100644 index 000000000..3c209e2f3 --- /dev/null +++ b/src/Demos/sgv/Makefile @@ -0,0 +1,19 @@ +#!smake +include ../../../Make/makedefs + +C++FILES = \ + sgv.cpp + +TARGET = ../../../bin/sgv + +TARGET_BIN_FILES = sgv + +# LIBS = -losg -lglut -lGLU -lGL -lm -lXmu -lX11 -lXi +# C++FLAGS += -I../../include +# LDFLAGS += -L../../lib -L/usr/X11R6/lib + +LIBS = -losgGLUT -losgUtil -losg -lglut -lGLU -lGL -lm -lXmu -lX11 -lXi +C++FLAGS += -I../../../include +LDFLAGS += -L../../../lib -L/usr/X11R6/lib + +include ../../../Make/makerules diff --git a/src/Demos/sgv/sgv.cpp b/src/Demos/sgv/sgv.cpp new file mode 100644 index 000000000..7b1d7fe5a --- /dev/null +++ b/src/Demos/sgv/sgv.cpp @@ -0,0 +1,118 @@ +#include "osg/OSG" +#include "osg/Node" +#include "osg/Registry" +#include "osg/Notify" + +#include +#include "osgGLUT/Viewer" + +/* + * Function to read several files (typically one) as specified on the command + * line, and return them in an osg::Node + */ +osg::Node* getNodeFromFiles(int argc,char **argv) +{ + osg::Node *rootnode = new osg::Node; + + int i; + + typedef std::vector NodeList; + NodeList nodeList; + for( i = 1; i < argc; i++ ) + { + + if (argv[i][0]=='-') + { + switch(argv[i][1]) + { + case('l'): + ++i; + if (iloadLibrary(argv[i]); + } + break; + case('e'): + ++i; + if (icreateLibraryNameForExt(argv[i]); + osg::Registry::instance()->loadLibrary(libName); + } + break; + } + } else + { + osg::Node *node = osg::loadNodeFile( argv[i] ); + + if( node != (osg::Node *)0L ) + { + if (node->getName().empty()) node->setName( argv[i] ); + nodeList.push_back(node); + } + } + + } + + if (nodeList.size()==0) + { + osg::notify(osg::WARN) << "No data loaded."<1 + { + osg::Group* group = new osg::Group(); + for(NodeList::iterator itr=nodeList.begin(); + itr!=nodeList.end(); + ++itr) + { + group->addChild(*itr); + } + + rootnode = group; + } + + return rootnode; +} + + +int main( int argc, char **argv ) +{ + + if (argc<2) + { + osg::notify(osg::NOTICE)<<"usage:"< s_AlphaFunc(new AlphaFunc); + return s_AlphaFunc.get(); +} + +void AlphaFunc::enable() +{ + glEnable(GL_ALPHA_TEST); +} + +void AlphaFunc::disable() +{ + glDisable(GL_ALPHA_TEST); +} + +void AlphaFunc::apply() +{ + glAlphaFunc((GLenum)_comparisonFunc,_referenceValue); +} + + +bool AlphaFunc::readLocalData(Input& fr) +{ + bool iteratorAdvanced = false; + + ComparisonFunction func; + if (fr[0].matchWord("comparisonFunc") && matchFuncStr(fr[1].getStr(),func)) + { + _comparisonFunc = func; + fr+=2; + iteratorAdvanced = true; + } + + float ref; + if (fr[0].matchWord("referenceValue") && fr[1].getFloat(ref)) + { + _referenceValue = ref; + fr+=2; + iteratorAdvanced = true; + } + + return iteratorAdvanced; +} + + +bool AlphaFunc::writeLocalData(Output& fw) +{ + fw.indent() << "comparisonFunc " << getFuncStr(_comparisonFunc) << endl; + fw.indent() << "referenceValue " << _referenceValue << endl; + return true; +} + +bool AlphaFunc::matchFuncStr(const char* str,ComparisonFunction& func) +{ + if (strcmp(str,"NEVER")==0) func = NEVER; + else if (strcmp(str,"LESS")==0) func = LESS; + else if (strcmp(str,"EQUAL")==0) func = EQUAL; + else if (strcmp(str,"LEQUAL")==0) func = LEQUAL; + else if (strcmp(str,"GREATER")==0) func = GREATER; + else if (strcmp(str,"NOTEQUAL")==0) func = NOTEQUAL; + else if (strcmp(str,"GEQUAL")==0) func = GEQUAL; + else if (strcmp(str,"ALWAYS")==0) func = ALWAYS; + else return false; + return true; +} + + +const char* AlphaFunc::getFuncStr(ComparisonFunction func) +{ + switch(func) + { + case(NEVER): return "NEVER"; + case(LESS): return "LESS"; + case(EQUAL): return "EQUAL"; + case(LEQUAL): return "LEQUAL"; + case(GREATER): return "GREATER"; + case(NOTEQUAL): return "NOTEQUAL"; + case(GEQUAL): return "GEQUAL"; + case(ALWAYS): return "ALWAYS"; + } + return ""; +} diff --git a/src/osg/Billboard.cpp b/src/osg/Billboard.cpp new file mode 100644 index 000000000..fc8ce9061 --- /dev/null +++ b/src/osg/Billboard.cpp @@ -0,0 +1,272 @@ +#include +#include +#include "osg/Billboard" +#include "osg/Input" +#include "osg/Output" +#include "osg/Registry" + +using namespace osg; + +RegisterObjectProxy g_BillboardProxy; + +#define square(x) ((x)*(x)) + +Billboard::Billboard() +{ + _mode = AXIAL_ROT; +// _mode = POINT_ROT_WORLD; + _axis.set(0.0f,0.0f,1.0f); +} + + +Billboard::~Billboard() +{ +} + +bool Billboard::addGeoSet(GeoSet *gset) +{ + if (Geode::addGeoSet(gset)) + { + Vec3 pos(0.0f,0.0f,0.0f); + while (_positionList.size()<_geosets.size()) + { + _positionList.push_back(pos); + } + return true; + } + return false; +} + +bool Billboard::addGeoSet(GeoSet *gset,const Vec3& pos) +{ + if (Geode::addGeoSet(gset)) + { + while (_positionList.size()<_geosets.size()) + { + _positionList.push_back(pos); + } + return true; + } + return false; +} + +bool Billboard::removeGeoSet( GeoSet *gset ) +{ + PositionList::iterator pitr = _positionList.begin(); + for (GeoSetList::iterator itr=_geosets.begin(); + itr!=_geosets.end(); + ++itr,++pitr) + { + if (itr->get()==gset) + { + // note ref_ptr<> automatically handles decrementing gset's reference count. + _geosets.erase(itr); + _positionList.erase(pitr); + _bsphere_computed = false; + return true; + } + } + return false; +} + + +void Billboard::calcRotation(const Vec3& eye_local, const Vec3& pos_local,Matrix& mat) +{ + switch(_mode) + { + case(AXIAL_ROT): + { + Vec3 ev = pos_local-eye_local; + ev.z() = 0.0f; + float ev_length = ev.length(); + if (ev_length>0.0f) { + //float rotation_zrotation_z = atan2f(ev.x(),ev.y()); + //mat.makeRot(rotation_z*180.0f/M_PI,0.0f,0.0f,1.0f); + float inv = 1.0f/ev_length; + float c = ev.y()*inv; + float s = ev.x()*inv; + mat._mat[0][0] = c; + mat._mat[0][1] = -s; + mat._mat[1][0] = s; + mat._mat[1][1] = c; + } + break; + } + case(POINT_ROT_WORLD): + case(POINT_ROT_EYE): + { + Vec3 ev = pos_local-eye_local; + ev.normalize(); + + float ev_len = ev.length(); + if (ev_len != 0.0f) + { + ev /= ev_len; + + Vec3 cp = ev^Vec3(0.0f,1.0f,0.0f); + float dot = ev*Vec3(0.0f,1.0f,0.0f); + + float cp_len = cp.length(); + if (cp_len != 0.0f) + { + cp /= cp_len; + + float rotation_cp = acosf(dot); + mat.makeRot(rotation_cp*180.0f/M_PI,cp[0],cp[1],cp[2]); + } + } + break; + } + } +} + +void Billboard::calcTransform(const Vec3& eye_local, const Vec3& pos_local,Matrix& mat) +{ +// mat.makeTrans(pos_local[0],pos_local[1],pos_local[2]); +// mat.makeIdent(); + calcRotation(eye_local,pos_local,mat); + +// mat.postTrans(pos_local[0],pos_local[1],pos_local[2]); + mat._mat[3][0] += pos_local[0]; + mat._mat[3][1] += pos_local[1]; + mat._mat[3][2] += pos_local[2]; + +} + +bool Billboard::readLocalData(Input& fr) +{ + // note, free done by Node::read(Input& fr) + + bool iteratorAdvanced = false; + + if (fr[0].matchWord("Mode")) + { + if (fr[1].matchWord("AXIAL_ROT")) + { + _mode = AXIAL_ROT; + fr+=2; + iteratorAdvanced = true; + } + else if (fr[1].matchWord("POINT_ROT_EYE")) + { + _mode = POINT_ROT_EYE; + fr+=2; + iteratorAdvanced = true; + } + else if (fr[1].matchWord("POINT_ROT_WORLD")) + { + _mode = POINT_ROT_WORLD; + fr+=2; + iteratorAdvanced = true; + } + } + + // read the position data. + bool matchFirst = false; + if ((matchFirst=fr.matchSequence("Positions {")) || fr.matchSequence("Positions %i {")) + { + + // set up coordinates. + int entry = fr[0].getNoNestedBrackets(); + + if (matchFirst) + { + fr += 2; + } + else + { + //_positionList.(capacity); + fr += 3; + } + + Vec3 pos; + while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) + { + if (fr[0].getFloat(pos[0]) && fr[1].getFloat(pos[1]) && fr[2].getFloat(pos[2])) + { + fr += 3; + _positionList.push_back(pos); + } + else + { + ++fr; + } + } + + iteratorAdvanced = true; + ++fr; + + } + + if (Geode::readLocalData(fr)) iteratorAdvanced = true; + + return iteratorAdvanced; +} + +bool Billboard::writeLocalData(Output& fw) +{ + + switch(_mode) + { + case(AXIAL_ROT): fw.indent() << "Mode AXIAL_ROT"<getBound(); + + _bsphere._center += bbox.center(); + _bsphere._center += _positionList[i]; + } + + _bsphere._center /= (float)(ngsets); + + float maxd = 0.0; + for( i = 0; i < ngsets; ++i ) + { + GeoSet *gset = _geosets[i].get(); + const BoundingBox& bbox = gset->getBound(); + Vec3 local_center = _bsphere._center-_positionList[i]; + for(unsigned int c=0;c<8;++c) + { + float d = (bbox.corner(c)-local_center).length2(); + if( d > maxd ) maxd = d; + } + } + _bsphere._radius = sqrtf(maxd); + + _bsphere_computed=true; + + return true; +} diff --git a/src/osg/BoundingBox.cpp b/src/osg/BoundingBox.cpp new file mode 100644 index 000000000..ac3e60e1b --- /dev/null +++ b/src/osg/BoundingBox.cpp @@ -0,0 +1,44 @@ +#include "osg/BoundingBox" +#include "osg/BoundingSphere" + +using namespace osg; + +void BoundingBox::expandBy(const Vec3& v) +{ + if(v.x()<_min.x()) _min.x() = v.x(); + if(v.x()>_max.x()) _max.x() = v.x(); + + if(v.y()<_min.y()) _min.y() = v.y(); + if(v.y()>_max.y()) _max.y() = v.y(); + + if(v.z()<_min.z()) _min.z() = v.z(); + if(v.z()>_max.z()) _max.z() = v.z(); +} + +void BoundingBox::expandBy(const BoundingBox& bb) +{ + if (!bb.isValid()) return; + + if(bb._min.x()<_min.x()) _min.x() = bb._min.x(); + if(bb._max.x()>_max.x()) _max.x() = bb._max.x(); + + if(bb._min.y()<_min.y()) _min.y() = bb._min.y(); + if(bb._max.y()>_max.y()) _max.y() = bb._max.y(); + + if(bb._min.z()<_min.z()) _min.z() = bb._min.z(); + if(bb._max.z()>_max.z()) _max.z() = bb._max.z(); +} + +void BoundingBox::expandBy(const BoundingSphere& sh) +{ + if (!sh.isValid()) return; + + if(sh._center.x()-sh._radius<_min.x()) _min.x() = sh._center.x()-sh._radius; + if(sh._center.x()+sh._radius>_max.x()) _max.x() = sh._center.x()+sh._radius; + + if(sh._center.y()-sh._radius<_min.y()) _min.y() = sh._center.y()-sh._radius; + if(sh._center.y()+sh._radius>_max.y()) _max.y() = sh._center.y()+sh._radius; + + if(sh._center.z()-sh._radius<_min.z()) _min.z() = sh._center.z()-sh._radius; + if(sh._center.z()+sh._radius>_max.z()) _max.z() = sh._center.z()+sh._radius; +} diff --git a/src/osg/BoundingSphere.cpp b/src/osg/BoundingSphere.cpp new file mode 100644 index 000000000..9aae7d804 --- /dev/null +++ b/src/osg/BoundingSphere.cpp @@ -0,0 +1,81 @@ +#include "osg/BoundingSphere" + +using namespace osg; + +void BoundingSphere::expandBy(const Vec3& v) +{ + if (isValid()) + { + Vec3 dv = v-_center; + float r = dv.length(); + if (r>_radius) + { + float dr = (r-_radius)*0.5f; + _center += dv*(dr/r); + _radius += dr; + } // else do nothing as vertex is within sphere. + } + else + { + _center = v; + _radius = 0.0f; + } +} + +void BoundingSphere::expandRadiusBy(const Vec3& v) +{ + if (isValid()) + { + float r = (v-_center).length(); + if (r>_radius) _radius = r; + // else do nothing as vertex is within sphere. + } + else + { + _center = v; + _radius = 0.0f; + } +} + +void BoundingSphere::expandBy(const BoundingSphere& sh) +{ + if (sh.isValid()) + { + if (isValid()) + { + Vec3 dv = sh._center-_center; + float dv_len = dv.length(); + if (dv_len+sh._radius>_radius) + { + + Vec3 e1 = _center-(dv*(_radius/dv_len)); + Vec3 e2 = sh._center+(dv*(sh._radius/dv_len)); + _center = (e1+e2)*0.5f; + _radius = (e2-_center).length(); + + } // else do nothing as vertex is within sphere. + } + else + { + _center = sh._center; + _radius = sh._radius; + } + } +} +void BoundingSphere::expandRadiusBy(const BoundingSphere& sh) +{ + if (sh.isValid()) + { + if (isValid()) + { + float r = (sh._center-_center).length()+sh._radius; + if (r>_radius) _radius = r; + // else do nothing as vertex is within sphere. + } + else + { + _center = sh._center; + _radius = sh._radius; + } + } +} diff --git a/src/osg/Camera.cpp b/src/osg/Camera.cpp new file mode 100644 index 000000000..8663493c3 --- /dev/null +++ b/src/osg/Camera.cpp @@ -0,0 +1,85 @@ +#include "osg/GL" +#include + +using namespace osg; + +Camera::Camera() +{ + _fovy = 60.0; + _aspectRatio = 1.0; + home(); +} + +Camera::~Camera() +{ +} + +void Camera::home() +{ + _eyePoint.set(0.0f,0.0f,0.0f); + _lookPoint.set(0.0f,0.0f,-1.0f); + _upVector.set(0.0f,1.0f,0.0f); + _nearPlane = 1.0; + _farPlane = 1000.0; +} + +void Camera::setView(osg::Vec3 eyePoint, osg::Vec3 lookPoint, osg::Vec3 upVector) +{ + // Should do some checking here! + _eyePoint = eyePoint; + _lookPoint = lookPoint; + _upVector = upVector; +} + +void Camera::draw_PROJECTION() const +{ + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + gluPerspective(_fovy, _aspectRatio, static_cast(_nearPlane), static_cast(_farPlane)); + + glMatrixMode( GL_MODELVIEW ); +} + +void Camera::draw_MODELVIEW() const +{ + glMatrixMode( GL_MODELVIEW ); + gluLookAt( _eyePoint.x(), _eyePoint.y(), _eyePoint.z(), + _lookPoint.x(), _lookPoint.y(), _lookPoint.z(), + _upVector.x(), _upVector.y(), _upVector.z()); + +} + +void Camera::ensureOrthogonalUpVector() +{ + Vec3 lv = _lookPoint-_eyePoint; + Vec3 sv = lv^_upVector; + _upVector = sv^lv; + _upVector.normalize(); +} + +void Camera::mult(const Camera& camera,const Matrix& m) +{ + // transform camera. + _upVector = (camera._lookPoint+camera._upVector)*m; + _eyePoint = camera._eyePoint*m; + _lookPoint = camera._lookPoint*m; + _upVector -= _lookPoint; + + // now reset up vector so it remains at 90 degrees to look vector, + // as it may drift during transformation. + ensureOrthogonalUpVector(); +} + +void Camera::mult(const Matrix& m,const Camera& camera) +{ + // transform camera. + _upVector = m*(camera._lookPoint+camera._upVector); + _eyePoint = m*camera._eyePoint; + _lookPoint = m*camera._lookPoint; + _upVector -= _lookPoint; + + // now reset up vector so it remains at 90 degrees to look vector, + // as it may drift during transformation. + ensureOrthogonalUpVector(); +} + diff --git a/src/osg/CullFace.cpp b/src/osg/CullFace.cpp new file mode 100644 index 000000000..2a8747374 --- /dev/null +++ b/src/osg/CullFace.cpp @@ -0,0 +1,80 @@ +#include "osg/GL" +#include "osg/CullFace" +#include "osg/Output" +#include "osg/Input" + + +using namespace osg; + +CullFace::CullFace() +{ + _mode = BACK; +} + +CullFace::~CullFace() +{ +} + +CullFace* CullFace::instance() +{ + static ref_ptr s_CullFace(new CullFace); + return s_CullFace.get(); +} + +void CullFace::enable( void ) +{ + glEnable( GL_CULL_FACE ); +} + + +void CullFace::disable( void ) +{ + glDisable( GL_CULL_FACE ); +} + +void CullFace::apply() +{ + glCullFace((GLenum)_mode); +} + + +bool CullFace::readLocalData(Input& fr) +{ + bool iteratorAdvanced = false; + + if (fr[0].matchWord("mode")) + { + if (fr[1].matchWord("FRONT")) + { + _mode = FRONT; + fr+=2; + iteratorAdvanced = true; + } + else if (fr[1].matchWord("BACK")) + { + _mode = BACK; + fr+=2; + iteratorAdvanced = true; + } + else if (fr[1].matchWord("FRONT_AND_BACK")) + { + _mode = FRONT_AND_BACK; + fr+=2; + iteratorAdvanced = true; + } + } + + return iteratorAdvanced; +} + + +bool CullFace::writeLocalData(Output& fw) +{ + switch(_mode) + { + case(FRONT): fw.indent() << "mode FRONT" << endl; break; + case(BACK): fw.indent() << "mode BACK" << endl; break; + case(FRONT_AND_BACK): fw.indent() << "mode FRONT_AND_BACK" << endl; break; + } + return true; +} diff --git a/src/osg/DCS.cpp b/src/osg/DCS.cpp new file mode 100644 index 000000000..8d61f4180 --- /dev/null +++ b/src/osg/DCS.cpp @@ -0,0 +1,112 @@ +#include "osg/DCS" +#include "osg/Registry" +#include "osg/Input" +#include "osg/Output" + +using namespace osg; + +RegisterObjectProxy g_DCSProxy; + +DCS::DCS() +{ + _mat = new Matrix( + 1.0, 0.0, 0.0, 0.0, + 0.0, 1.0, 0.0, 0.0, + 0.0, 0.0, 1.0, 0.0, + 0.0, 0.0, 0.0, 1.0 ); + + _mat->ref(); +} + + +DCS::DCS(const Matrix& mat ) +{ + _mat = new Matrix(mat); + _mat->ref(); +} + + +DCS::~DCS() +{ + _mat->unref(); +} + +void DCS::setMatrix(const Matrix& mat ) +{ + *_mat = mat; + dirtyBound(); +} + +void DCS::preTranslate( float tx, float ty, float tz ) +{ + _mat->preTrans( tx, ty, tz ); + dirtyBound(); +} + +void DCS::preRotate( float deg, float x, float y, float z ) +{ + _mat->preRot( deg, x, y, z ); + dirtyBound(); +} + +bool DCS::readLocalData(Input& fr) +{ + bool iteratorAdvanced = false; + + if (Matrix* tmpMatrix = static_cast(Matrix::instance()->readClone(fr))) + { + + if (_mat) _mat->unref(); + _mat = tmpMatrix; + _mat->ref(); + + iteratorAdvanced = true; + } + + if (Group::readLocalData(fr)) iteratorAdvanced = true; + + return iteratorAdvanced; +} + + +bool DCS::writeLocalData(Output& fw) +{ + if (_mat) _mat->write(fw); + + + return Group::writeLocalData(fw); +} + +bool DCS::computeBound( void ) +{ + if (!Group::computeBound()) return false; + + Vec3 xdash = _bsphere._center; + xdash.x() += _bsphere._radius; + xdash = xdash*(*_mat); + + Vec3 ydash = _bsphere._center; + ydash.y() += _bsphere._radius; + ydash = ydash*(*_mat); + + Vec3 zdash = _bsphere._center; + zdash.y() += _bsphere._radius; + zdash = zdash*(*_mat); + + _bsphere._center = _bsphere._center*(*_mat); + + xdash -= _bsphere._center; + float len_xdash = xdash.length(); + + ydash -= _bsphere._center; + float len_ydash = ydash.length(); + + zdash -= _bsphere._center; + float len_zdash = zdash.length(); + + _bsphere._radius = len_xdash; + if (_bsphere._radius +#include +#include +#else +#include +#include +#endif + +#ifndef OSG_USE_IO_DOT_H +#include +using namespace std; +#endif + +#include "osg/DynamicLibrary" +#include "osg/OSG" +#include "osg/Notify" + +using namespace osg; + +DynamicLibrary::DynamicLibrary(const std::string& name,HANDLE handle) +{ + _name = name; + _handle = handle; +} + +DynamicLibrary::~DynamicLibrary() +{ + if (_handle) + { +#ifdef WIN32 + FreeLibrary((HMODULE)_handle); +#else + dlclose(_handle); +#endif + } +} + +DynamicLibrary* DynamicLibrary::loadLibrary(const std::string& libraryName) +{ + + char* fullLibraryName = osg::findDSO( libraryName.c_str() ); + if (fullLibraryName==NULL) return NULL; + +#ifdef WIN32 + HANDLE handle = LoadLibrary( fullLibraryName ); + if (handle) return new DynamicLibrary(libraryName,handle); + notify(WARN) << "DynamicLibrary::failed loading "< +#include + +// copied form glut_ext.c +// to be rewritten... Robert Osfield, November 2000. +bool osg::ExtensionSupported(const char *extension) +{ + static const GLubyte *extensions = NULL; + const GLubyte *start; + GLubyte *where, *terminator; + + /* Extension names should not have spaces. */ + where = (GLubyte *) strchr(extension, ' '); + if (where || *extension == '\0') + return 0; + + if (!extensions) { + extensions = glGetString(GL_EXTENSIONS); + } + /* It takes a bit of care to be fool-proof about parsing the + OpenGL extensions string. Don't be fooled by sub-strings, + etc. */ + start = extensions; + for (;;) { + /* If your application crashes in the strstr routine below, + you are probably calling glutExtensionSupported without + having a current window. Calling glGetString without + a current OpenGL context has unpredictable results. + Please fix your program. */ + where = (GLubyte *) strstr((const char *) start, extension); + if (!where) + break; + terminator = where + strlen(extension); + if (where == start || *(where - 1) == ' ') { + if (*terminator == ' ' || *terminator == '\0') { + return true; + } + } + start = terminator; + } + return false; +} diff --git a/src/osg/Field.cpp b/src/osg/Field.cpp new file mode 100644 index 000000000..03fa7c61a --- /dev/null +++ b/src/osg/Field.cpp @@ -0,0 +1,422 @@ +#include "osg/Field" + +using namespace osg; + +Field::Field() +{ + _init(); +} + + +Field::Field(const Field& ic) +{ + _copy(ic); +} + + +Field::~Field() +{ + _free(); +} + + +Field& Field::operator = (const Field& ic) +{ + if (this==&ic) return *this; + _free(); + _copy(ic); + return *this; +} + + +void Field::_free() +{ +// free all data + if (_fieldCache) delete [] _fieldCache; + + _init(); + +} + + +void Field::_init() +{ + + _fieldCacheCapacity = 256; + _fieldCacheSize = 0; + _fieldCache = NULL; + + _fieldType = UNINTIALISED; + + _withinQuotes = false; + + _noNestedBrackets = 0; + +} + + +void Field::_copy(const Field& ic) +{ + +// copy string cache. + if (ic._fieldCache) + { + _fieldCacheCapacity = ic._fieldCacheCapacity; + _fieldCacheSize = ic._fieldCacheSize; + _fieldCache = new char [_fieldCacheCapacity]; + strncpy(_fieldCache,ic._fieldCache,_fieldCacheCapacity); + } + else + { + _fieldCacheCapacity = 0; + _fieldCacheSize = 0; + _fieldCache = NULL; + } + + _fieldType = ic._fieldType; + + _withinQuotes = ic._withinQuotes; + + _noNestedBrackets = ic._noNestedBrackets; +} + + +void Field::setWithinQuotes(bool withinQuotes) +{ + _withinQuotes=withinQuotes; + _fieldType = UNINTIALISED; +} + + +bool Field::getWithinQuotes() +{ + return _withinQuotes; +} + + +void Field::setNoNestedBrackets(int no) +{ + _noNestedBrackets=no; +} + + +int Field::getNoNestedBrackets() +{ + return _noNestedBrackets; +} + + +const char* Field::getStr() const +{ + if (_fieldCacheSize!=0) return _fieldCache; + else return NULL; +} + + +char* Field::takeStr() +{ + char* field = _fieldCache; + + _fieldCache = NULL; + _fieldCacheSize = 0; + + _fieldType = UNINTIALISED; + _withinQuotes = false; + + return field; +} + + +void Field::reset() +{ + _fieldCacheSize = 0; + if (_fieldCache) + { + _fieldCache[_fieldCacheSize] = 0; + } + + _withinQuotes = false; + _noNestedBrackets = 0; +} + + +void Field::addChar(char c) +{ + if (_fieldCache==NULL) + { + if (_fieldCacheCapacity=_fieldCacheCapacity-1) + { + if (_fieldCacheCapacity=_fieldCacheCapacity-1) _fieldCacheCapacity *= 2; + char* tmp_str = _fieldCache; + _fieldCache = new char[_fieldCacheCapacity]; + strncpy(_fieldCache,tmp_str,_fieldCacheSize); + delete [] tmp_str; + + } + _fieldCache[_fieldCacheSize++] = c; + _fieldCache[_fieldCacheSize] = 0; + _fieldType = UNINTIALISED; +} + + +Field::FieldType Field::getFieldType() const +{ + if (_fieldType==UNINTIALISED && _fieldCache) + { + _fieldType = calculateFieldType(_fieldCache,_withinQuotes); + } + return _fieldType; +} + + +bool Field::isValid() const +{ + if (_fieldCacheSize>0 && !_withinQuotes) return true; + else return false; +} + + +bool Field::isOpenBracket() const +{ + if (_fieldCacheSize==1) return _fieldCache[0]=='{'; + else return false; +} + + +bool Field::isCloseBracket() const +{ + if (_fieldCacheSize==1) return _fieldCache[0]=='}'; + else return false; +} + + +bool Field::isWord() const +{ + getFieldType(); + return (_fieldType==WORD); +} + + +bool Field::matchWord(const char* str) const +{ + getFieldType(); + return _fieldType==WORD && strcmp(_fieldCache,str)==0; +} + + +bool Field::matchWord(const char* str,int noCharacters) const +{ + getFieldType(); + return _fieldType==WORD && strncmp(_fieldCache,str,noCharacters)==0; +} + + +bool Field::isString() const +{ + return getNoCharacters()!=0; +} + + +bool Field::matchString(const char* str) const +{ + return strcmp(_fieldCache,str)==0; +} + + +bool Field::matchString(const char* str,int noCharacters) const +{ + return strncmp(_fieldCache,str,noCharacters)==0; +} + + +bool Field::isQuotedString() const +{ + return _withinQuotes; +} + + +bool Field::isInt() const +{ + getFieldType(); + return _fieldType==INTEGER; +} + + +bool Field::matchInt(int i) const +{ + getFieldType(); + if (_fieldType==INTEGER) + { + return atoi(_fieldCache)==i; + } + else + { + return false; + } +} + + +bool Field::getInt(int& i) const +{ + getFieldType(); + if (_fieldType==INTEGER) + { + i = atoi(_fieldCache); + return true; + } + else + { + return false; + } +} + + +bool Field::isFloat() const +{ + getFieldType(); + return _fieldType==REAL || _fieldType==INTEGER; +} + + +bool Field::matchFloat(float f) const +{ + getFieldType(); + if (_fieldType==REAL || _fieldType==INTEGER) + { + return (float)atof(_fieldCache)==f; + } + else + { + return false; + } +} + + +bool Field::getFloat(float& f) const +{ + getFieldType(); + if (_fieldType==REAL || _fieldType==INTEGER) + { + f = (float)atof(_fieldCache); + return true; + } + else + { + return false; + } +} + + +bool Field::isDouble() const +{ + getFieldType(); + return _fieldType==REAL || _fieldType==INTEGER; +} + + +bool Field::matchDouble(double d) const +{ + getFieldType(); + if (_fieldType==REAL || _fieldType==INTEGER) + { + return atof(_fieldCache)==d; + } + else + { + return false; + } +} + + +bool Field::getDouble(double& d) const +{ + getFieldType(); + if (_fieldType==REAL || _fieldType==INTEGER) + { + d = atof(_fieldCache); + return true; + } + else + { + return false; + } +} + + +Field::FieldType Field::calculateFieldType(const char* str,bool withinQuotes) +{ + if (str==NULL) return BLANK; + if (*str==0) return BLANK; + + if (withinQuotes) return STRING; + + bool hadPlusMinus = false; + bool hadDecimalPlace = false; + bool hadExponent = false; + bool couldBeInt = true; + bool couldBeFloat = true; + int noZeroToNine = 0; + + const char* ptr = str; + while (*ptr!=0 && couldBeFloat) + { + if (*ptr=='+' || *ptr=='-') + { + if (hadPlusMinus) + { + couldBeInt = false; + couldBeFloat = false; + } else hadPlusMinus = true; + } + else if (*ptr>='0' && *ptr<='9') + { + noZeroToNine++; + } + else if (*ptr=='.') + { + if (hadDecimalPlace) + { + couldBeInt = false; + couldBeFloat = false; + } + else + { + hadDecimalPlace = true; + couldBeInt = false; + } + } + else if (*ptr=='e' || *ptr=='E') + { + if (hadExponent || noZeroToNine==0) + { + couldBeInt = false; + couldBeFloat = false; + } + else + { + hadExponent = true; + couldBeInt = false; + hadDecimalPlace = false; + hadPlusMinus = false; + noZeroToNine=0; + } + } + else + { + couldBeInt = false; + couldBeFloat = false; + } + ++ptr; + } + + if (couldBeInt && noZeroToNine>0) return INTEGER; + if (couldBeFloat && noZeroToNine>0) return REAL; + if (str[0]=='{') return OPEN_BRACKET; + if (str[0]=='}') return CLOSE_BRACKET; + return WORD; +} diff --git a/src/osg/FieldReader.cpp b/src/osg/FieldReader.cpp new file mode 100644 index 000000000..9423962ff --- /dev/null +++ b/src/osg/FieldReader.cpp @@ -0,0 +1,269 @@ +#include "osg/FieldReader" +#include "osg/Field" + +using namespace osg; + +FieldReader::FieldReader() +{ + _init(); +} + + +FieldReader::FieldReader(const FieldReader& ic) +{ + _copy(ic); +} + + +FieldReader::~FieldReader() +{ + _free(); +} + + +FieldReader& FieldReader::operator = (const FieldReader& ic) +{ + if (this==&ic) return *this; + _free(); + _copy(ic); + return *this; +} + + +void FieldReader::_free() +{ +// free all data + + _init(); + +} + + +void FieldReader::_init() +{ + _fin = NULL; + _eof = true; + + _noNestedBrackets = 0; + + int i; + for(i=0;i<256;++i) _delimatorEatLookUp[i]=false; + _delimatorEatLookUp[' '] = true; + _delimatorEatLookUp['\t'] = true; + _delimatorEatLookUp['\n'] = true; + _delimatorEatLookUp['\r'] = true; + + for(i=0;i<256;++i) _delimatorKeepLookUp[i]=false; + _delimatorKeepLookUp['{'] = true; + _delimatorKeepLookUp['}'] = true; + _delimatorKeepLookUp['"'] = true; + _delimatorKeepLookUp['\''] = true; + +} + + +void FieldReader::_copy(const FieldReader& ic) +{ + + _fin = ic._fin; + _eof = ic._eof; + + _noNestedBrackets = ic._noNestedBrackets; + + int i; + for(i=0;i<256;++i) _delimatorEatLookUp[i]=ic._delimatorEatLookUp[i]; + for(i=0;i<256;++i) _delimatorKeepLookUp[i]=ic._delimatorKeepLookUp[i]; +} + + +void FieldReader::attach(istream* input) +{ + _fin = input; + + if (_fin) + { + _eof = _fin->eof()!=0; + } + else + { + _eof = true; + } +} + + +void FieldReader::detach() +{ + _fin = NULL; + _eof = true; +} + + +bool FieldReader::eof() const +{ + return _eof; +} + + +bool FieldReader::findStartOfNextField() +{ + int ch = 0; + while (true) + { + ch = _fin->peek(); + if (ch==EOF) + { + _eof = true; + return false; + } + else if (_delimatorEatLookUp[ch]) + { + _fin->ignore(1); + } + else + { + return true; + } + } +} + + +bool FieldReader::readField(Field& fieldPtr) +{ + return _readField(&fieldPtr); +} + + +void FieldReader::ignoreField() +{ + _readField(NULL); +} + + +bool FieldReader::_readField(Field* fieldPtr) +{ + if (fieldPtr) fieldPtr->reset(); + + if (!eof() && findStartOfNextField()) + { + + int ch = _fin->peek(); + if (ch==EOF) + { + _eof = true; + if (fieldPtr) fieldPtr->setNoNestedBrackets(getNoNestedBrackets()); + return fieldPtr && fieldPtr->getNoCharacters()!=0; + } + else if (ch=='"') + { + if (fieldPtr) + { + fieldPtr->setWithinQuotes(true); + fieldPtr->setNoNestedBrackets(getNoNestedBrackets()); + } + _fin->ignore(1); + char c; + while (true) + { + ch = _fin->peek(); + if (ch==EOF) + { + _eof = true; + return fieldPtr && fieldPtr->getNoCharacters()!=0; + } + c = ch; + if (ch=='"') + { + _fin->ignore(1); + //return fieldPtr && fieldPtr->getNoCharacters()!=0; + return fieldPtr!=NULL; + } + else + { + _fin->get(c); + if (fieldPtr) fieldPtr->addChar(c); + } + } + } + else if (ch=='\'') + { + if (fieldPtr) + { + fieldPtr->setWithinQuotes(true); + fieldPtr->setNoNestedBrackets(getNoNestedBrackets()); + } + _fin->ignore(1); + char c; + while (true) + { + ch = _fin->peek(); + if (ch==EOF) + { + _eof = true; + return fieldPtr && fieldPtr->getNoCharacters()!=0; + } + c = ch; + if (ch=='\'') + { + _fin->ignore(1); + //return fieldPtr && fieldPtr->getNoCharacters()!=0; + return fieldPtr!=NULL; + } + else + { + _fin->get(c); + if (fieldPtr) fieldPtr->addChar(c); + } + } + } + else if (_delimatorKeepLookUp[ch]) + { + char c; + _fin->get(c); + if (fieldPtr) fieldPtr->addChar(c); + if (c=='{') ++_noNestedBrackets; + else if (c=='}') --_noNestedBrackets; + if (fieldPtr) fieldPtr->setNoNestedBrackets(getNoNestedBrackets()); + return fieldPtr && fieldPtr->getNoCharacters()!=0; + } + else + { + if (fieldPtr) fieldPtr->setNoNestedBrackets(getNoNestedBrackets()); + char c; + while (true) + { + ch = _fin->peek(); + if (ch==EOF) + { + _eof = true; + return fieldPtr && fieldPtr->getNoCharacters()!=0; + } + c = ch; + if (_delimatorEatLookUp[c]) + { + _fin->ignore(1); + return fieldPtr && fieldPtr->getNoCharacters()!=0; + } + if (_delimatorKeepLookUp[c]) + { + return fieldPtr && fieldPtr->getNoCharacters()!=0; + } + else + { + _fin->get(c); + if (fieldPtr) fieldPtr->addChar(c); + } + } + } + + } + else + { + return false; + } +} + + +int FieldReader::getNoNestedBrackets() const +{ + return _noNestedBrackets; +} diff --git a/src/osg/FieldReaderIterator.cpp b/src/osg/FieldReaderIterator.cpp new file mode 100644 index 000000000..5491548ec --- /dev/null +++ b/src/osg/FieldReaderIterator.cpp @@ -0,0 +1,361 @@ +#include "osg/FieldReaderIterator" + +using namespace osg; + +FieldReaderIterator::FieldReaderIterator() +{ + _init(); +} + + +FieldReaderIterator::FieldReaderIterator(const FieldReaderIterator& ic) +{ + _copy(ic); +} + + +FieldReaderIterator::~FieldReaderIterator() +{ + _free(); +} + + +FieldReaderIterator& FieldReaderIterator::operator = (const FieldReaderIterator& ic) +{ + if (this==&ic) return *this; + _free(); + _copy(ic); + return *this; +} + + +void FieldReaderIterator::_free() +{ +// free all data + if (_previousField) + { + delete _previousField; + } + if (_fieldQueue) + { + for(int i=0;i<_fieldQueueCapacity;++i) + { + if (_fieldQueue[i]) delete _fieldQueue[i]; + _fieldQueue[i] = NULL; + } + delete [] _fieldQueue; + } + _init(); + +} + + +void FieldReaderIterator::_init() +{ + _previousField = NULL; + _fieldQueue = NULL; + _fieldQueueSize = 0; + _fieldQueueCapacity = 0; + +} + + +void FieldReaderIterator::_copy(const FieldReaderIterator& ic) +{ + _reader = ic._reader; + + if (ic._previousField) + { + _previousField = new Field(*ic._previousField); + } + + if (ic._fieldQueue && ic._fieldQueueCapacity>0) + { + _fieldQueue = new Field* [ic._fieldQueueCapacity]; + for(int i=0;i_fieldQueueSize) pos=_fieldQueueSize; + + int i; + if (_fieldQueueSize>=_fieldQueueCapacity) // need to reallocate the stack + { + int newCapacity = _fieldQueueCapacity*2; + if (newCapacity=newCapacity) newCapacity*=2; + Field** newFieldStack = new Field* [newCapacity]; + for(i=0;i<_fieldQueueCapacity;++i) + { + newFieldStack[i] = _fieldQueue[i]; + } + for(;i=pos;++i) + { + _fieldQueue[i+1]=_fieldQueue[i]; + } + _fieldQueue[pos] = field; + ++_fieldQueueSize; +} + + +void FieldReaderIterator::insert(int pos,const char* str) +{ + if (str) + { + Field* field = new Field; + while(*str!=0) + { + field->addChar(*str); + ++str; + } + insert(pos,field); + } +} + + +Field& FieldReaderIterator::operator [] (int pos) +{ + return field(pos); +} + + +Field& FieldReaderIterator::field (int pos) +{ + if (pos<0) + { + _blank.setNoNestedBrackets(_reader.getNoNestedBrackets()); + return _blank; + } // can directly access field + else if (pos<_fieldQueueSize) + { + return *_fieldQueue[pos]; + } // need to read the new fields. + else + { + if (pos>=_fieldQueueCapacity) // need to reallocate the stack + { + int newCapacity = _fieldQueueCapacity*2; + if (newCapacity=newCapacity) newCapacity*=2; + Field** newFieldStack = new Field* [newCapacity]; + int i; + for(i=0;i<_fieldQueueCapacity;++i) + { + newFieldStack[i] = _fieldQueue[i]; + } + for(;i=_fieldQueueSize) + { + if (_fieldQueue[_fieldQueueSize]==NULL) _fieldQueue[_fieldQueueSize] = new Field; + if (_reader.readField(*_fieldQueue[_fieldQueueSize])) + { + ++_fieldQueueSize; + } + } + if (pos<_fieldQueueSize) + { + return *_fieldQueue[pos]; + } + else + { + _blank.setNoNestedBrackets(_reader.getNoNestedBrackets()); + return _blank; + } + } +} + + +FieldReaderIterator& FieldReaderIterator::operator ++ () +{ + return (*this)+=1; +} + + +FieldReaderIterator& FieldReaderIterator::operator += (int no) +{ + if (no>_fieldQueueSize) + { + while (!_reader.eof() && no>_fieldQueueSize) + { + _reader.ignoreField(); + --no; + } + _fieldQueueSize=0; + } + else if (no>0) + { + Field** tmpFields = new Field* [no]; + int i; + for(i=0;i=entry) + { + ++(*this); + } +} + + +void FieldReaderIterator::advanceToEndOfBlock(int noNestedBrackets) +{ + while(!eof() && field(0).getNoNestedBrackets()>=noNestedBrackets) + { + ++(*this); + } +} + + +bool FieldReaderIterator::matchSequence(const char* str) +{ + if (str==NULL) return false; + if (*str==0) return false; + int fieldCount = 0; + const char* end = str; + while((*end)!=0 && (*end)==' ') ++end; + const char* start = end; + while((*start)!=0) + { + if (*end!=' ' && *end!=0) + { + ++end; + } + else + { + if (start!=end) + { + if (end-start>1 && *start=='%') + { + const char type = *(start+1); + switch(type) + { + case('i') : // expecting an integer + { + if (!field(fieldCount).isInt()) return false; + break; + } + case('f') : // expecting an floating point number + { + if (!field(fieldCount).isFloat()) return false; + break; + } + case('s') : // expecting an quoted string + { + if (!field(fieldCount).isQuotedString()) return false; + break; + } + default : // expecting an word + { + if (!field(fieldCount).isWord()) return false; + break; + } + } + + } + else + { + if (*start=='{') + { + if (!field(fieldCount).isOpenBracket()) return false; + } + else if (*start=='}') + { + if (!field(fieldCount).isCloseBracket()) return false; + } + else + { + if (!field(fieldCount).matchWord(start,end-start)) return false; + } + } + fieldCount++; + } + while((*end)==' ') ++end; + start = end; + } + } + return true; +} diff --git a/src/osg/FileNameUtils.cpp b/src/osg/FileNameUtils.cpp new file mode 100644 index 000000000..63aa9dbb9 --- /dev/null +++ b/src/osg/FileNameUtils.cpp @@ -0,0 +1,50 @@ +#include "osg/FileNameUtils" + +std::string osg::getFilePath(const std::string& fileName) +{ + std::string::size_type slash = fileName.find_last_of('/'); + if (slash==std::string::npos) return std::string(""); + return std::string(fileName.begin(),fileName.begin()+slash+1); +} + +std::string osg::getSimpleFileName(const std::string& fileName) +{ + std::string::size_type slash = fileName.find_last_of('/'); + if (slash==std::string::npos) return fileName; + return std::string(fileName.begin()+slash+1,fileName.end()); +} + +std::string osg::getFileExtension(const std::string& fileName) +{ + std::string::size_type dot = fileName.find_last_of('.'); + if (dot==std::string::npos) return std::string(""); + return std::string(fileName.begin()+dot+1,fileName.end()); +} + +std::string osg::getLowerCaseFileExtension(const std::string& filename) +{ + std::string ext = osg::getFileExtension(filename); + for(std::string::iterator itr=ext.begin(); + itr!=ext.end(); + ++itr) + { + *itr = (char)tolower(*itr); + } + return ext; +} + +std::string osg::getStrippedName(const std::string& fileName) +{ + std::string::size_type slash = fileName.find_last_of('/'); + std::string::size_type dot = fileName.find_last_of('.'); + if (slash==std::string::npos) { + if (dot==std::string::npos) return fileName; + else return std::string(fileName.begin(),fileName.begin()+dot); + } + else + { + if (dot==std::string::npos) return std::string(fileName.begin()+slash+1,fileName.end()); + else return std::string(fileName.begin()+slash+1,fileName.begin()+dot); + } +} + diff --git a/src/osg/Fog.cpp b/src/osg/Fog.cpp new file mode 100644 index 000000000..4a9dc816c --- /dev/null +++ b/src/osg/Fog.cpp @@ -0,0 +1,47 @@ +#include "osg/GL" +#include "osg/Fog" + +using namespace osg; + +Fog::Fog( void ) +{ + _mode = EXP; + _density = 1.0f; + _start = 0.0f; + _end = 1.0f; + _color.set( 0.0f, 0.0f, 0.0f, 0.0f); +} + + +Fog::~Fog( void ) +{ +} + + +Fog* Fog::instance() +{ + static ref_ptr s_fog(new Fog); + return s_fog.get(); +} + + +void Fog::enable( void ) +{ + glEnable( GL_FOG ); +} + + +void Fog::disable( void ) +{ + glDisable( GL_FOG ); +} + + +void Fog::apply( void ) +{ + glFogi( GL_FOG_MODE, _mode ); + glFogf( GL_FOG_DENSITY, _density ); + glFogf( GL_FOG_START, _start ); + glFogf( GL_FOG_END, _end ); + glFogfv( GL_FOG_COLOR, (GLfloat*)_color.ptr() ); +} diff --git a/src/osg/GeoSet.cpp b/src/osg/GeoSet.cpp new file mode 100644 index 000000000..b6149c1fc --- /dev/null +++ b/src/osg/GeoSet.cpp @@ -0,0 +1,1778 @@ +#include +#include +#include + +#include "osg/GeoSet" +#include "osg/Input" +#include "osg/Output" +#include "osg/Notify" + +using namespace osg; + +GeoSet::GeoSet() +{ + _coords = (Vec3 *)0; + _cindex = (ushort *)0; + + _normals = (Vec3 *)0; + _nindex = (ushort *)0; + + _colors = (Vec4 *)0; + _colindex = (ushort *)0; + + _tcoords = (Vec2 *)0; + _tindex = (ushort *)0; + + _iarray = (float *)0L; + _iaindex = (ushort *)0; + _iaformat = IA_OFF; + _ogliaformat = 0; + + _bbox_computed = 0; + + _numprims = 0; + _primtype = NO_TYPE; + _oglprimtype = 0xFFFF; + _needprimlen = 0; + _primLengths = (int *)0; + + _useDisplayList = true; + _globj = 0; + + _numcoords = 0; + + _normal_binding = BIND_OFF; + _color_binding = BIND_OFF; + _texture_binding = BIND_OFF; + + _fast_path = 1; +} + + +GeoSet::~GeoSet() +{ + if( _globj != 0 ) + { + glDeleteLists( _globj, 1 ); + } + // note all coordinates, colors, texture coordinates and normals + // are not currently deleted, ahh!!!! This issue needs to be + // addressed. However, since the data is simple passed in it + // is unclear whether the data is shared, allocated with malloc, + // or new [] so its difficult right now to now how to delete it + // appropriatly. Should data be copied rather than simply copying + // pointers?? Using vector<> could simplify this issue. But then + // would you want to share coords etc? + // Robert Osfield, Decemeber 2000. +} + +GeoSet* GeoSet::instance() +{ + static ref_ptr s_geoset(new GeoSet); + return s_geoset.get(); +} + +bool GeoSet::readLocalData(Input& fr) +{ + bool iteratorAdvanced = false; + + if (fr[0].matchWord("Use")) + { + if (fr[1].isString()) { + GeoState* geostate = dynamic_cast(fr.getObjectForUniqueID(fr[1].getStr())); + if (geostate) { + fr+=2; + setGeoState(geostate); + iteratorAdvanced = true; + } + } + } + + if (GeoState* readState = static_cast(GeoState::instance()->readClone(fr))) + { + setGeoState(readState); + iteratorAdvanced = true; + } + + Vec3* coordList = NULL; + ushort* coordIndexList = NULL; + Vec3* normalList = NULL; + ushort* normalIndexList = NULL; + Vec4* colorList = NULL; + ushort* colorIndexList = NULL; + Vec2* textureList = NULL; + ushort* textureIndexList = NULL; + float* interleavedArray = NULL; + ushort* interleavedIndexArray = NULL; + + BindingType bind=BIND_OFF; + BindingType normal_bind=BIND_OFF; + BindingType color_bind=BIND_OFF; + BindingType texture_bind=BIND_OFF; + InterleaveArrayType iaType = IA_OFF; + + int start_indent = fr[0].getNoNestedBrackets(); + while (!fr.eof() && fr[0].getNoNestedBrackets()>=start_indent) + { + + bool fieldAdvanced = false; + + bool readPrimitiveLengths = false; + if (fr.matchSequence("tstrips %i {")) + { + readPrimitiveLengths = true; + setPrimType(TRIANGLE_STRIP); + } + else if (fr.matchSequence("flat_tstrips %i {")) + { + readPrimitiveLengths = true; + setPrimType(FLAT_TRIANGLE_STRIP); + } + else if (fr.matchSequence("polys %i {")) + { + readPrimitiveLengths = true; + setPrimType(POLYGON); + } + else if (fr.matchSequence("quadstrip %i {")) + { + readPrimitiveLengths = true; + setPrimType(QUAD_STRIP); + } + else if (fr.matchSequence("lineloops %i {")) + { + readPrimitiveLengths = true; + setPrimType(LINE_LOOP); + } + else if (fr.matchSequence("linestrip %i {")) + { + readPrimitiveLengths = true; + setPrimType(LINE_STRIP); + } + else if (fr.matchSequence("flat_linestrip %i {")) + { + readPrimitiveLengths = true; + setPrimType(LINE_STRIP); + } + else if (fr.matchSequence("tfans %i {")) + { + readPrimitiveLengths = true; + setPrimType(TRIANGLE_FAN); + } + else if (fr.matchSequence("flat_tfans %i {")) + { + readPrimitiveLengths = true; + setPrimType(FLAT_TRIANGLE_FAN); + } + + if (readPrimitiveLengths) + { + + int entry = fr[1].getNoNestedBrackets(); + fr += 3; + + int capacity; + if (!fr[1].getInt(capacity)) capacity=100; + int size = 0; + int* list = new int [capacity]; + + while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) + { + int primLength; + if (fr[0].getInt(primLength)) + { + + if (size>=capacity) + { + int oldCapacity = capacity; + while(capacity<=size) capacity *= 2; + int* oldList = list; + list = new int[capacity]; + for(int i=0;ientry) + { + float x,y,z; + if (fr[0].getFloat(x) && fr[1].getFloat(y) && fr[2].getFloat(z)) + { + fr += 3; + + if (size>=capacity) + { + int oldCapacity = capacity; + while(capacity<=size) capacity *= 2; + Vec3* oldList = coordList; + coordList = new Vec3[capacity]; + for(int i=0;ientry) + { + int index; + if (fr[0].getInt(index)) + { + + if (size>=capacity) + { + int oldCapacity = capacity; + while(capacity<=size) capacity *= 2; + ushort* oldList = coordIndexList; + coordIndexList = new ushort[capacity]; + for(int i=0;ientry) + { + float x,y,z; + if (fr[0].getFloat(x) && fr[1].getFloat(y) && fr[2].getFloat(z)) + { + fr += 3; + + if (size>=capacity) + { + int oldCapacity = capacity; + while(capacity<=size) capacity *= 2; + Vec3* oldList = normalList; + normalList = new Vec3[capacity]; + for(int i=0;ientry) + { + int index; + if (fr[0].getInt(index)) + { + + if (size>=capacity) + { + int oldCapacity = capacity; + while(capacity<=size) capacity *= 2; + ushort* oldList = normalIndexList; + normalIndexList = new ushort[capacity]; + for(int i=0;ientry) + { + float r,g,b,a; + if (fr[0].getFloat(r) && fr[1].getFloat(g) && fr[2].getFloat(b) && fr[3].getFloat(a)) + { + + fr += 4; + + if (size>=capacity) + { + int oldCapacity = capacity; + while(capacity<=size) capacity *= 2; + Vec4* oldList = colorList; + colorList = new Vec4[capacity]; + for(int i=0;ientry) + { + int index; + if (fr[0].getInt(index)) + { + + if (size>=capacity) + { + int oldCapacity = capacity; + while(capacity<=size) capacity *= 2; + ushort* oldList = colorIndexList; + colorIndexList = new ushort[capacity]; + for(int i=0;ientry) + { + float r,s; + if (fr[0].getFloat(r) && fr[1].getFloat(s)) + { + fr += 2; + if (size>=capacity) + { + int oldCapacity = capacity; + while(capacity<=size) capacity *= 2; + Vec2* oldList = textureList; + textureList = new Vec2[capacity]; + for(int i=0;ientry) + { + int index; + if (fr[0].getInt(index)) + { + + if (size>=capacity) + { + int oldCapacity = capacity; + while(capacity<=size) capacity *= 2; + ushort* oldList = textureIndexList; + textureIndexList = new ushort[capacity]; + for(int i=0;ientry) ++fr; + } + else + { + // now read the data rows between the {}. + const char* rowComp = getInterleavedRowComposition(iaType); + int rowLength = getInterleavedRowLength(iaType); + + int size = 0; + unsigned char* dataList = new unsigned char[capacity*rowLength]; + + unsigned char* rowData = new unsigned char [rowLength]; + + float floatData; + int intData; + while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) + { + + unsigned char* itrRowData = rowData; + const char* itrRowComp = rowComp; + int rn = 0; + while (*itrRowComp!=0) + { + if (*itrRowComp=='f') + { + + if (!fr[rn].getFloat(floatData)) break; + *(float*)itrRowData = floatData; + itrRowData += 4; + } + else + { + if (!fr[rn].getInt(intData)) break; + *itrRowData = (unsigned char)intData; + itrRowData += 1; + } + ++rn; + } + if (*itrRowComp==0) + { + fr += rn; + if (size>=capacity) + { + int oldCapacity = capacity; + while(capacity<=size) capacity *= 2; + unsigned char* oldList = dataList; + dataList = new unsigned char[capacity*rowLength]; + memcpy(dataList,oldList,oldCapacity*rowLength); + delete [] oldList; + } + memcpy(dataList+size*rowLength,rowData,rowLength); + ++size; + + } + else + { + ++fr; + } + } + + interleavedArray = (float*)dataList; + } + + fieldAdvanced = true; + ++fr; + + } + + if ((matchFirst=fr.matchSequence("InterleavedArrayIndex {")) || fr.matchSequence("InterleavedArrayIndex %i {")) + { + + int entry = fr[0].getNoNestedBrackets(); + + int capacity = 100; + if (matchFirst) + { + fr += 2; + } + else + { + fr[1].getInt(capacity); + fr += 3; + } + + int size = 0; + + interleavedIndexArray = new ushort[capacity]; + + while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) + { + int index; + if (fr[0].getInt(index)) + { + + if (size>=capacity) + { + int oldCapacity = capacity; + while(capacity<=size) capacity *= 2; + ushort* oldList = interleavedIndexArray; + interleavedIndexArray = new ushort[capacity]; + for(int i=0;istart_indent) fr.advanceToEndOfBlock(start_indent+1); + else ++fr; + } + iteratorAdvanced = true; + + + } + + +// set up the coord lists. + if (coordList) + { + if (coordIndexList) + { + setCoords(coordList,coordIndexList); + } + else + { + setCoords(coordList); + } + } + +// set up the normal lists. + if (normalList) + { + setNormalBinding(normal_bind); + if (normalIndexList) + { + setNormals(normalList,normalIndexList); + } + else + { + setNormals(normalList); + } + } else setNormalBinding(BIND_OFF); + +// set up the color lists. + if (colorList) + { + setColorBinding(color_bind); + if (colorIndexList) + { + setColors(colorList,colorIndexList); + } + else + { + setColors(colorList); + } + } else setColorBinding(BIND_OFF); + + if (textureList) + { + setTextureBinding(texture_bind); + if (textureIndexList) + { + setTextureCoords(textureList,textureIndexList); + } + else + { + setTextureCoords(textureList); + } + } else setTextureBinding(BIND_OFF); + + if (interleavedArray) + { + if (interleavedIndexArray) + { + setInterleavedArray(iaType,interleavedArray,interleavedIndexArray); + } + else + { + setInterleavedArray(iaType,interleavedArray); + } + } else _iaformat = IA_OFF; + + return iteratorAdvanced; +} + + +bool GeoSet::writeLocalData(Output& fw) +{ + int i; + + if (_state.valid()) + { + _state->write(fw); + } + + // write out primitives. + bool writeOutPrimitiveLengths = false; + switch(getPrimType()) + { + case (TRIANGLE_STRIP): + fw.indent()<<"tstrips "<< getNumPrims() << endl; + writeOutPrimitiveLengths = true; + break; + case (FLAT_TRIANGLE_STRIP): + fw.indent()<<"flat_tstrips "<< getNumPrims() << endl; + writeOutPrimitiveLengths = true; + break; + case (POLYGON): + fw.indent()<<"polys "<< getNumPrims() << endl; + writeOutPrimitiveLengths = true; + break; + case (QUAD_STRIP): + fw.indent()<<"quadstrip "<< getNumPrims() << endl; + writeOutPrimitiveLengths = true; + break; + case (LINE_LOOP): + fw.indent()<<"lineloops "<< getNumPrims() << endl; + writeOutPrimitiveLengths = true; + break; + case (LINE_STRIP): + fw.indent()<<"linestrip "<< getNumPrims() << endl; + writeOutPrimitiveLengths = false; + break; + case (FLAT_LINE_STRIP): + fw.indent()<<"flat_linestrip "<< getNumPrims() << endl; + writeOutPrimitiveLengths = false; + break; + case (TRIANGLE_FAN): + fw.indent()<<"tfans "<< getNumPrims() << endl; + writeOutPrimitiveLengths = true; + case (FLAT_TRIANGLE_FAN): + fw.indent()<<"flat_tfans "<< getNumPrims() << endl; + writeOutPrimitiveLengths = true; + break; + case (LINES): + fw.indent()<<"lines "<< getNumPrims() << endl; + writeOutPrimitiveLengths = false; + break; + case (TRIANGLES): + fw.indent()<<"triangles "<< getNumPrims() << endl; + writeOutPrimitiveLengths = false; + break; + case (QUADS): + fw.indent()<<"quads "<< getNumPrims() << endl; + writeOutPrimitiveLengths = false; + break; + case (POINTS) : + fw.indent()<<"points "<< getNumPrims() << endl; + break; + default: + notify(WARN) << "GeoSet::writeLocalData() - unhandled primitive type = "<<(int)getPrimType()<apply(); + + _globj = glGenLists( 1 ); + glNewList( _globj, GL_COMPILE ); + drawImmediateMode(); + glEndList(); + +} + +void GeoSet::computeNumVerts() +{ + int i; + int numverts=0; + + int flat_shaded_offset=0; + if (_primtype == FLAT_LINE_STRIP) flat_shaded_offset=_numprims; + else if (_primtype == FLAT_TRIANGLE_STRIP) flat_shaded_offset=2*_numprims; + else if (_primtype == FLAT_TRIANGLE_FAN) flat_shaded_offset=2*_numprims; + + switch( _primtype ) + { + case POINTS : + _primlength = 1; + numverts = _numprims * _primlength; + break; + + case LINES : + _primlength = 2; + numverts = _numprims * _primlength; + break; + + case TRIANGLES : + _primlength = 3; + numverts = _numprims * _primlength; + break; + + case QUADS : + _primlength = 4; + numverts = _numprims * _primlength; + break; + + case QUAD_STRIP : + case FLAT_TRIANGLE_FAN : + case TRIANGLE_FAN : + case LINE_LOOP : + case LINE_STRIP : + case FLAT_LINE_STRIP : + case TRIANGLE_STRIP : + case FLAT_TRIANGLE_STRIP : + case POLYGON : + _primlength = 0; + numverts = 0; + for( i = 0; i < _numprims; i++ ) + numverts += _primLengths[i]; + break; + default: + notify(WARN) << "Not supported primitive "<<(int)_primtype< max ) max = _cindex[i]; + + _numcoords = max + 1; + } + else + { + _numcoords = numverts; + _numcindices = 0; + } + + + + + if (_normals) + { + + int nn; + switch(_normal_binding) + { + case (BIND_OFF) : nn = 0; break; + case (BIND_OVERALL) : nn = 1; break; + case (BIND_PERPRIM) : nn = getNumPrims(); break; + case (BIND_PERVERTEX) : nn = numverts-flat_shaded_offset; break; + default : nn = 0; break; + } + + // calc the maximum num of vertex from the index list. + int cc; + if (_nindex) + { + _numnindices = nn; + cc = 0; + for( i = 0; i < nn; i++ ) + if( _nindex[i] > cc ) cc = _nindex[i]; + cc++; + } + else + { + cc = nn; + _numnindices = 0; + } + + _numnormals = cc; + } + else + { + _numnormals = 0; + _numnindices = 0; + } + + if (_colors) + { + + int nn; + switch(_color_binding) + { + case (BIND_OFF) : nn = 0; break; + case (BIND_OVERALL) : nn = 1; break; + case (BIND_PERPRIM) : nn = getNumPrims(); break; + case (BIND_PERVERTEX) : nn = numverts-flat_shaded_offset; break; + default : nn = 0; break; + } + + // calc the maximum num of vertex from the index list. + int cc; + if (_colindex) + { + _numcindices = nn; + cc = 0; + for( i = 0; i < nn; i++ ) + if( _colindex[i] > cc ) cc = _colindex[i]; + cc++; + } + else + { + cc = nn; + _numcindices = 0; + } + + _numcolors = cc; + } + else + { + _numcolors = 0; + _numcindices = 0; + } + + + if (_tcoords) + { + + int nn; + switch(_texture_binding) + { + case (BIND_OFF) : nn = 0; break; + case (BIND_OVERALL) : nn = 1; break; + case (BIND_PERPRIM) : nn = getNumPrims(); break; + case (BIND_PERVERTEX) : nn = numverts; break; + default : nn = 0; break; + } + + // calc the maximum num of vertex from the index list. + int cc; + if (_tindex) + { + _numtindices = nn; + cc = 0; + for( i = 0; i < nn; i++ ) + if( _tindex[i] > cc ) cc = _tindex[i]; + cc++; + } + else + { + cc = nn; + _numtindices = 0; + } + + _numtcoords = cc; + } + else + { + _numtcoords = 0; + _numtindices = 0; + } + +} + + +void GeoSet::computeBound( void ) +{ + int i; + + Vec3 center; + + if( _coords == (Vec3 *)0 ) return; + + if( _numcoords == 0 ) + computeNumVerts(); + + if( _numcoords == 0 ) + return; + + center.set(0.0f,0.0f,0.0f); + + for( i = 0; i < _numcoords; i++ ) + { + center += _coords[i]; + } + + center /= (float)_numcoords; + + _bbox.init(); + + for( i = 0; i < _numcoords; i++ ) + { + _bbox.expandBy(_coords[i]); + } + + _bbox_computed++; +} + +const BoundingBox& GeoSet::getBound() +{ + if( _bbox_computed == 0 ) + computeBound(); + + return _bbox; +} + +bool GeoSet::check() +{ + if( _coords == (Vec3 *)0 ) return false; + + if( _cindex != (ushort *)0 || + _nindex != (ushort *)0 || + _colindex != (ushort *)0 || + _tindex != (ushort *)0 ) + { + + if( (_coords && _cindex == (ushort *)0) || + (_normals && _nindex == (ushort *)0) || + (_colors && _colindex == (ushort *)0) || + (_tcoords && _tindex == (ushort *)0) ) + { + + notify(WARN) << "GeoState::check() : " + "Cannot mix indexed and non-indexed attributes.\n"; + return false; + } + } + return true; +} + +void GeoSet::setPrimType( PrimitiveType type ) +{ + switch( type ) + { + case NO_TYPE: break; + + case POINTS: _oglprimtype = GL_POINTS; _needprimlen = 0; break; + case LINES: _oglprimtype = GL_LINES; _needprimlen = 0; break; + case FLAT_LINE_STRIP: _oglprimtype = GL_LINE_STRIP; _needprimlen=1; break; + case LINE_STRIP: _oglprimtype = GL_LINE_STRIP; _needprimlen=1; break; + case LINE_LOOP: _oglprimtype = GL_LINE_LOOP; _needprimlen=1; break; + case TRIANGLES: _oglprimtype = GL_TRIANGLES; _needprimlen=0; break; + case FLAT_TRIANGLE_STRIP: _oglprimtype = GL_TRIANGLE_STRIP; _needprimlen=1; break; + case TRIANGLE_STRIP: _oglprimtype = GL_TRIANGLE_STRIP; _needprimlen=1; break; + case TRIANGLE_FAN: _oglprimtype = GL_TRIANGLE_FAN; _needprimlen=1; break; + case FLAT_TRIANGLE_FAN: _oglprimtype = GL_TRIANGLE_FAN; _needprimlen=1; break; + case QUADS: _oglprimtype = GL_QUADS; _needprimlen=0; break; + case QUAD_STRIP: _oglprimtype = GL_QUAD_STRIP; _needprimlen=1; break; + case POLYGON : _oglprimtype = GL_POLYGON; _needprimlen=1; break; + } + + + _primtype = type; + + if( _primtype == FLAT_LINE_STRIP ) _flat_shaded_skip = 1; + else if( _primtype == FLAT_TRIANGLE_STRIP ) _flat_shaded_skip = 2; + else if( _primtype == FLAT_TRIANGLE_FAN ) _flat_shaded_skip = 2; + else _flat_shaded_skip = 0; +} + + +void GeoSet::setCoords( Vec3 *cp ) +{ + _coords = cp; + _cindex = 0L; + set_fast_path(); +} +void GeoSet::setCoords( Vec3 *cp, ushort *ci ) +{ + _coords = cp; + _cindex = ci; + set_fast_path(); +} + +void GeoSet::setNormals( Vec3 *np ) +{ + _normals = np; + _nindex = 0L; + if( _normal_binding == BIND_OFF ) + setNormalBinding( BIND_DEFAULT ); + else + set_fast_path(); +} + +void GeoSet::setNormals( Vec3 *np, ushort *ni ) +{ + _normals = np; + _nindex = ni; + if( _normal_binding == BIND_OFF ) + setNormalBinding( BIND_DEFAULT ); + else + set_fast_path(); +} + + +void GeoSet::setColors( Vec4 *lp ) +{ + _colors = lp; + _colindex = 0L; + if( _color_binding == BIND_OFF ) + setColorBinding( BIND_DEFAULT ); + else + set_fast_path(); +} + +void GeoSet::setColors( Vec4 *lp, ushort *li ) +{ + _colors = lp; + _colindex = li; + if( _color_binding == BIND_OFF ) + setColorBinding( BIND_DEFAULT ); + else + set_fast_path(); +} + +void GeoSet::setTextureCoords( Vec2 *tc ) +{ + _tcoords = tc; + _tindex = 0L; + if( _texture_binding == BIND_OFF ) + setTextureBinding( BIND_DEFAULT ); + else + set_fast_path(); +} + +void GeoSet::setTextureCoords( Vec2 *tc, ushort *ti ) +{ + _tcoords = tc; + _tindex = ti; + if( _texture_binding == BIND_OFF ) + setTextureBinding( BIND_DEFAULT ); + else + set_fast_path(); + +} + +void GeoSet::setInterleavedArray( InterleaveArrayType format, float *pointer ) +{ + _iaformat = format; + + _ogliaformat = + (_iaformat == IA_OFF ) ? 0 : + (_iaformat == IA_V2F ) ? GL_V2F: + (_iaformat == IA_V3F ) ? GL_V3F: + (_iaformat == IA_C4UB_V2F) ? GL_C4UB_V2F: + (_iaformat == IA_C4UB_V3F) ? GL_C4UB_V3F: + (_iaformat == IA_C3F_V3F) ? GL_C3F_V3F: + (_iaformat == IA_N3F_V3F) ? GL_N3F_V3F: + (_iaformat == IA_C4F_N3F_V3F) ? GL_C4F_N3F_V3F: + (_iaformat == IA_T2F_V3F) ? GL_T2F_V3F: + (_iaformat == IA_T4F_V4F) ? GL_T4F_V4F: + (_iaformat == IA_T2F_C4UB_V3F) ? GL_T2F_C4UB_V3F: + (_iaformat == IA_T2F_C3F_V3F) ? GL_T2F_C3F_V3F: + (_iaformat == IA_T2F_N3F_V3F) ? GL_T2F_N3F_V3F: + (_iaformat == IA_T2F_C4F_N3F_V3F) ? GL_T2F_C4F_N3F_V3F: + (_iaformat == IA_T4F_C4F_N3F_V4F) ? GL_T4F_C4F_N3F_V4F: 0; + + _iarray = pointer; + + set_fast_path(); +} + +void GeoSet::setInterleavedArray( InterleaveArrayType format, float *ia, ushort *iai ) +{ + _iaformat = format; + + _ogliaformat = + (_iaformat == IA_OFF ) ? 0 : + (_iaformat == IA_V2F ) ? GL_V2F: + (_iaformat == IA_V3F ) ? GL_V3F: + (_iaformat == IA_C4UB_V2F) ? GL_C4UB_V2F: + (_iaformat == IA_C4UB_V3F) ? GL_C4UB_V3F: + (_iaformat == IA_C3F_V3F) ? GL_C3F_V3F: + (_iaformat == IA_N3F_V3F) ? GL_N3F_V3F: + (_iaformat == IA_C4F_N3F_V3F) ? GL_C4F_N3F_V3F: + (_iaformat == IA_T2F_V3F) ? GL_T2F_V3F: + (_iaformat == IA_T4F_V4F) ? GL_T4F_V4F: + (_iaformat == IA_T2F_C4UB_V3F) ? GL_T2F_C4UB_V3F: + (_iaformat == IA_T2F_C3F_V3F) ? GL_T2F_C3F_V3F: + (_iaformat == IA_T2F_N3F_V3F) ? GL_T2F_N3F_V3F: + (_iaformat == IA_T2F_C4F_N3F_V3F) ? GL_T2F_C4F_N3F_V3F: + (_iaformat == IA_T4F_C4F_N3F_V4F) ? GL_T4F_C4F_N3F_V4F: 0; + + _iarray = ia; + _iaindex = iai; + set_fast_path(); +} + +void GeoSet::setUseDisplayList(bool flag) +{ + // if value unchanged simply return. + if (_useDisplayList==flag) return; + + // if was previously set to true, remove display list. + if (_useDisplayList) + { + if( _globj != 0 ) + { + glDeleteLists( _globj, 1 ); + _globj = 0; + } + } + // set with new value. + _useDisplayList = flag; +} + +void GeoSet::dirtyDisplayList() +{ + if( _globj != 0 ) + { + glDeleteLists( _globj, 1 ); + _globj = 0; + } +} diff --git a/src/osg/GeoSet_ogl.cpp b/src/osg/GeoSet_ogl.cpp new file mode 100644 index 000000000..363e5ffae --- /dev/null +++ b/src/osg/GeoSet_ogl.cpp @@ -0,0 +1,427 @@ +#include +#include "osg/GL" +#include "osg/GeoSet" +#include "osg/Notify" + +using namespace osg; + +#define DO_SHADING 1 + +#define I_ON (1<<4) +#define C_ON (1<<3) +#define N_ON (1<<2) +#define T_ON (1<<1) +#define V_ON (1<<0) + +void GeoSet::set_fast_path( void ) +{ + if( _iaformat != IA_OFF ) + { + _fast_path = I_ON; + } + else + { + if( ( _normal_binding != BIND_PERPRIM) && + ( _nindex == 0L ) && + ( _color_binding != BIND_PERPRIM) && + ( _colindex == 0L ) && + ( _primtype != FLAT_LINE_STRIP ) && + ( _primtype != FLAT_TRIANGLE_STRIP ) && + ( _primtype != FLAT_TRIANGLE_FAN ) + ) + _fast_path = V_ON; + else + { + _fast_path = 0; + + #ifdef DEBUG + + if( _normal_binding == BIND_PERPRIM ) + notify( DEBUG ) << "Geoset - Failed fast path because NORMALS are bound PER_PRIM\n"; + + if( _nindex != 0L ) + notify( DEBUG ) << "Geoset - Failed fast path because NORMAL indeces are specified\n"; + + if( _color_binding == BIND_PERPRIM ) + notify( DEBUG ) << "Geoset - Failed fast path because COLORS are bound PER_PRIM\n"; + + if( _cindex != 0L ) + notify( DEBUG ) << "Geoset - Failed fast path because COLOR indeces are specified\n"; + + if( _primtype == FLAT_LINE_STRIP ) + notify( DEBUG ) << "Geoset - Failed fast path because primitive is FLAT_LINE_STRIP\n"; + + if ( _primtype == FLAT_TRIANGLE_STRIP ) + notify( DEBUG ) << "Geoset - Failed fast path because primitive is FLAT_TRIANGLE_STRIP\n"; + + if ( _primtype == FLAT_TRIANGLE_FAN ) + notify( DEBUG ) << "Geoset - Failed fast path because primitive is FLAT_TRIANGLE_FAN\n"; + + #endif + } + + if( _fast_path ) + { + if( _color_binding == BIND_PERVERTEX ) + _fast_path |= C_ON; + if( _normal_binding == BIND_PERVERTEX ) + _fast_path |= N_ON; + if( _texture_binding == BIND_PERVERTEX ) + _fast_path |= T_ON; + } + } + + #ifdef DEBUG + notify(INFO) << "GeoSet - fast path = " << _fast_path << "\n"; + #endif +} + +void GeoSet::draw_fast_path( void ) +{ + ushort *ocindex = _cindex; + + switch( _fast_path ) + { + case (I_ON) : + _cindex = _iaindex; + glInterleavedArrays( (GLenum)_ogliaformat, 0, _iarray ); + break; + + case (V_ON) : + glDisableClientState( GL_COLOR_ARRAY ); + glDisableClientState( GL_NORMAL_ARRAY ); + glDisableClientState( GL_TEXTURE_COORD_ARRAY ); + glEnableClientState( GL_VERTEX_ARRAY ); + glVertexPointer( 3, GL_FLOAT, 0, (GLfloat *)_coords ); + break; + + case (T_ON|V_ON) : + glDisableClientState( GL_COLOR_ARRAY ); + glDisableClientState( GL_NORMAL_ARRAY ); + glEnableClientState( GL_TEXTURE_COORD_ARRAY ); + glTexCoordPointer( 2, GL_FLOAT, 0, (GLfloat *)_tcoords ); + glEnableClientState( GL_VERTEX_ARRAY ); + glVertexPointer( 3, GL_FLOAT, 0, (GLfloat *)_coords ); + break; + + case (N_ON|V_ON) : + glDisableClientState( GL_COLOR_ARRAY ); + glEnableClientState( GL_NORMAL_ARRAY ); + glNormalPointer( GL_FLOAT, 0, (GLfloat *)_normals ); + glDisableClientState( GL_TEXTURE_COORD_ARRAY ); + glEnableClientState( GL_VERTEX_ARRAY ); + glVertexPointer( 3, GL_FLOAT, 0, (GLfloat *)_coords ); + break; + + case (N_ON|T_ON|V_ON) : + glDisableClientState( GL_COLOR_ARRAY ); + glEnableClientState( GL_NORMAL_ARRAY ); + glNormalPointer( GL_FLOAT, 0, (GLfloat *)_normals ); + glEnableClientState( GL_TEXTURE_COORD_ARRAY ); + glTexCoordPointer( 2, GL_FLOAT, 0, (GLfloat *)_tcoords ); + glEnableClientState( GL_VERTEX_ARRAY ); + glVertexPointer( 3, GL_FLOAT, 0, (GLfloat *)_coords ); + break; + + case (C_ON|V_ON) : + glEnableClientState( GL_COLOR_ARRAY ); + glColorPointer( 4, GL_FLOAT, 0, (GLfloat *)_colors ); + glDisableClientState( GL_NORMAL_ARRAY ); + glDisableClientState( GL_TEXTURE_COORD_ARRAY ); + glEnableClientState( GL_VERTEX_ARRAY ); + glVertexPointer( 3, GL_FLOAT, 0, (GLfloat *)_coords ); + break; + + + case (C_ON|T_ON|V_ON) : + glEnableClientState( GL_COLOR_ARRAY ); + glColorPointer( 4, GL_FLOAT, 0, (GLfloat *)_colors ); + glDisableClientState( GL_NORMAL_ARRAY ); + glEnableClientState( GL_TEXTURE_COORD_ARRAY ); + glTexCoordPointer( 2, GL_FLOAT, 0, (GLfloat *)_tcoords ); + glEnableClientState( GL_VERTEX_ARRAY ); + glVertexPointer( 3, GL_FLOAT, 0, (GLfloat *)_coords ); + break; + + case (C_ON|N_ON|V_ON) : + glEnableClientState( GL_COLOR_ARRAY ); + glColorPointer( 4, GL_FLOAT, 0, (GLfloat *)_colors ); + glEnableClientState( GL_NORMAL_ARRAY ); + glNormalPointer( GL_FLOAT, 0, (GLfloat *)_normals ); + glDisableClientState( GL_TEXTURE_COORD_ARRAY ); + glEnableClientState( GL_VERTEX_ARRAY ); + glVertexPointer( 3, GL_FLOAT, 0, (GLfloat *)_coords ); + break; + + case (C_ON|N_ON|T_ON|V_ON) : + glEnableClientState( GL_COLOR_ARRAY ); + glColorPointer( 4, GL_FLOAT, 0, (GLfloat *)_colors ); + glEnableClientState( GL_NORMAL_ARRAY ); + glNormalPointer( GL_FLOAT, 0, (GLfloat *)_normals ); + glEnableClientState( GL_TEXTURE_COORD_ARRAY ); + glTexCoordPointer( 2, GL_FLOAT, 0, (GLfloat *)_tcoords ); + glEnableClientState( GL_VERTEX_ARRAY ); + glVertexPointer( 3, GL_FLOAT, 0, (GLfloat *)_coords ); + break; + } + + if( _color_binding == BIND_OVERALL ) + { + if( _colindex != 0L ) + glColor4fv( (GLfloat * )&_colors[_colindex[0]] ); + else + glColor4fv( (GLfloat * )&_colors[0] ); + } + + if( _normal_binding == BIND_OVERALL ) + { + if( _nindex != 0L ) + glNormal3fv( (GLfloat * )&_normals[_nindex[0]] ); + else + glNormal3fv( (GLfloat * )&_normals[0] ); + } + + if( _needprimlen ) // LINE_STRIP, LINE_LOOP, TRIANGLE_STRIP, + // TRIANGLE_FAN, QUAD_STRIP, POLYGONS + { + int index = 0; + if( _primLengths == (int *)0 ) + { + notify(WARN) << "GeoSet->draw() : " "Primitive lengths required\n"; + return; + } + + for( int i = 0; i < _numprims; i++ ) + { + if( _cindex != (ushort *)0L ) + glDrawElements( (GLenum)_oglprimtype, _primLengths[i], GL_UNSIGNED_SHORT, &_cindex[index] ); + else + glDrawArrays( (GLenum)_oglprimtype, index, _primLengths[i] ); + index += _primLengths[i]; + } + } + else // POINTS, LINES, TRIANGLES, QUADS + { + if( _cindex != (ushort *)0L ) + glDrawElements( (GLenum)_oglprimtype, _numindices, GL_UNSIGNED_SHORT, _cindex ); + else + glDrawArrays( (GLenum)_oglprimtype, 0, _numcoords ); + } + + _cindex = ocindex; +} + +void GeoSet::draw_alternate_path( void ) +{ + if( (_color_binding == BIND_PERVERTEX) && (_cindex == 0L) && (_flat_shaded_skip == 0) ) + { + glEnableClientState( GL_COLOR_ARRAY ); + glColorPointer( 4, GL_FLOAT, 0, (GLfloat *)_colors ); + } + else + { + glDisableClientState( GL_COLOR_ARRAY ); + if( _color_binding == BIND_OVERALL ) + { + if( _colindex ) + glColor4fv( (GLfloat *)&_colors[_colindex[0]] ); + else + glColor4fv( (GLfloat *)&_colors[0] ); + } + } + + if( (_normal_binding == BIND_PERVERTEX) && (_nindex == 0L) && (_flat_shaded_skip == 0) ) + { + glEnableClientState( GL_NORMAL_ARRAY ); + glNormalPointer( GL_FLOAT, 0, (GLfloat *)_normals ); + } + else + { + glDisableClientState( GL_NORMAL_ARRAY ); + if( _normal_binding == BIND_OVERALL ) + { + if( _nindex ) + glNormal3fv( (GLfloat *)&_normals[_nindex[0]] ); + else + glNormal3fv( (GLfloat *)&_normals[0] ); + } + } + + if( (_texture_binding == BIND_PERVERTEX) && (_tindex == 0L) ) + { + glEnableClientState( GL_TEXTURE_COORD_ARRAY ); + glTexCoordPointer( 2, GL_FLOAT, 0, _tcoords ); + } + else + glDisableClientState( GL_TEXTURE_COORD_ARRAY ); + + glEnableClientState( GL_VERTEX_ARRAY ); + glVertexPointer( 3, GL_FLOAT, 0, (GLfloat *)_coords ); + + if( _needprimlen ) // LINE_STRIP, LINE_LOOP, TRIANGLE_STRIP, + // TRIANGLE_FAN, QUAD_STRIP, POLYGONS + // FLAT_LINE_STRIP, FLAT_TRIANGLE_STRIP, FLAT_TRIANGLE_FAN + { + int i, j; + int index = 0; + int ai = 0; + int ci = 0; + int ni = 0; + int ti = 0; + + if( _primLengths == (int *)0 ) + { + notify(WARN) << "GeoSet->draw() : " "Primitive lengths required\n"; + return; + } + + for( i = 0; i < _numprims; i++ ) + { + if( _color_binding == BIND_PERPRIM ) + { + if( _colindex ) + glColor4fv( (GLfloat *)&_colors[_colindex[ci++]] ); + else + glColor4fv( (GLfloat *)&_colors[ci++] ); + } + if( _normal_binding == BIND_PERPRIM ) + { + if( _nindex ) + glNormal3fv( (GLfloat *)&_normals[_nindex[ni++]] ); + else + glNormal3fv( (GLfloat *)&_normals[ni++] ); + } + + if( _flat_shaded_skip ) + { +#ifdef DO_SHADING +glShadeModel( GL_FLAT ); +#endif + glBegin( (GLenum)_oglprimtype ); + for( j = 0; j < _primLengths[i]; j++ ) + { + if( j >= _flat_shaded_skip ) + { + if( _color_binding == BIND_PERVERTEX ) + { + if( (_colindex != 0L) ) + glColor4fv( (GLfloat *)&_colors[_colindex[ci++]] ); + else + glColor4fv( (GLfloat *)&_colors[ci++] ); + } + + if( _normal_binding == BIND_PERVERTEX ) + { + if(_nindex != 0L) + glNormal3fv( (GLfloat *)&_normals[_nindex[ni++]] ); + else + glNormal3fv( (GLfloat *)&_normals[ni++] ); + } + } + + if( _texture_binding == BIND_PERVERTEX ) + { + if( _tindex != 0L ) + glTexCoord2fv( (GLfloat *)&_tcoords[_tindex[ti++]] ); + else + glTexCoord2fv( (GLfloat *)&_tcoords[ti++] ); + } + + if( _cindex ) + glArrayElement( _cindex[ai++] ); + else + glArrayElement( ai++ ); + } + glEnd(); + +#ifdef DO_SHADING +glShadeModel( GL_SMOOTH ); +#endif + } + + else + if( ((_color_binding == BIND_PERVERTEX ) && (_colindex != 0L) ) || + ((_normal_binding == BIND_PERVERTEX ) && (_nindex != 0L) ) || + ((_texture_binding == BIND_PERVERTEX ) && (_tindex != 0L) ) ) + { + glBegin( (GLenum)_oglprimtype ); + for( j = 0; j < _primLengths[i]; j++ ) + { + if( (_color_binding == BIND_PERVERTEX) && (_colindex != 0L) ) + glColor4fv( (GLfloat *)&_colors[_colindex[ci++]] ); + + if( (_normal_binding == BIND_PERVERTEX) && (_nindex != 0L) ) + glNormal3fv( (GLfloat *)&_normals[_nindex[ci++]] ); + + if( (_texture_binding == BIND_PERVERTEX) && (_tindex != 0L) ) + glTexCoord2fv( (GLfloat *)&_tcoords[_tindex[ti++]] ); + + if( _cindex ) + glArrayElement( _cindex[ai++] ); + else + glArrayElement( ai++ ); + } + glEnd(); + } + else + { + if( _cindex != (ushort *)0L ) + glDrawElements( (GLenum)_oglprimtype, _primLengths[i], GL_UNSIGNED_SHORT, &_cindex[index] ); + else + glDrawArrays( (GLenum)_oglprimtype, index, _primLengths[i] ); + } + index += _primLengths[i]; + } + } + else // POINTS, LINES, TRIANGLES, QUADS + { + int i, j; + if( _normal_binding == BIND_PERPRIM || _color_binding == BIND_PERPRIM || + ((_color_binding == BIND_PERVERTEX ) && (_colindex != 0L) ) || + ((_normal_binding == BIND_PERVERTEX ) && (_nindex != 0L) ) || + ((_texture_binding == BIND_PERVERTEX ) && (_tindex != 0L) ) ) + { + glBegin( (GLenum)_oglprimtype ); + for( i = 0; i < _numprims; i++ ) + { + if( _color_binding == BIND_PERPRIM ) + { + if( _colindex ) + glColor4fv( (GLfloat *)&_colors[_colindex[i]] ); + else + glColor4fv( (GLfloat *)&_colors[i] ); + } + if( _normal_binding == BIND_PERPRIM ) + { + if( _nindex ) + glNormal3fv( (GLfloat *)&_normals[_nindex[i]] ); + else + glNormal3fv( (GLfloat *)&_normals[i] ); + } + + for( j = 0; j < _primlength; j++ ) + { + if( (_color_binding == BIND_PERVERTEX) && (_colindex != 0L ) ) + glColor4fv( (GLfloat *)&_colors[_colindex[i*_primlength+j]] ); + + if( (_normal_binding == BIND_PERVERTEX) && (_nindex != 0L ) ) + glNormal3fv( (GLfloat *)&_normals[_nindex[i*_primlength+j]] ); + + if( (_texture_binding == BIND_PERVERTEX) && (_tindex != 0L ) ) + glTexCoord2fv( (GLfloat *)&_tcoords[_tindex[i*_primlength+j]] ); + + glArrayElement( i*_primlength+j ); + } + } + glEnd(); + } + else + { + if( _cindex != (ushort *)0L ) + glDrawElements( (GLenum)_oglprimtype, _numindices, GL_UNSIGNED_SHORT, _cindex ); + else + glDrawArrays( (GLenum)_oglprimtype, 0, _numcoords ); + } + } +} + diff --git a/src/osg/GeoState.cpp b/src/osg/GeoState.cpp new file mode 100644 index 000000000..a7dcc04d9 --- /dev/null +++ b/src/osg/GeoState.cpp @@ -0,0 +1,850 @@ +#include + +#include "osg/GeoState" +#include "osg/Input" +#include "osg/Output" +#include "osg/Notify" + +using namespace osg; + +GeoState::GeoState() +{ + + _transparencing = INHERIT; + _face_culling = INHERIT; + _lighting = INHERIT; + _texturing = INHERIT; + _fogging = INHERIT; + _texgening = INHERIT; + _antialiasing = INHERIT; + _colortable = INHERIT; + _pointSmoothing = INHERIT; + _polygonOffsetting = INHERIT; + _alphaTesting = INHERIT; + + _transparency = 0L; + _cullFace = 0L; + _texture = 0L; + _fog = 0L; + _texgen = 0L; + _material = 0L; + _texenv = 0L; + _texmat = 0L; + _point = 0L; + _polygonOffset = 0L; + _alphaFunc = 0L; +} + + +GeoState::~GeoState() +{ + // note, all attached state attributes will be automatically + // unreferenced by ref_ptr<> and therefore there is now need to + // delete the memory manually. +} + + +GeoState* GeoState::instance() +{ + static ref_ptr s_geostate(new GeoState); + return s_geostate.get(); +} + +void GeoState::setGlobalDefaults() +{ + _transparencing = OFF; + _face_culling = ON; + _lighting = OFF; + _texturing = OFF; + _fogging = OFF; + _texgening = OFF; + _antialiasing = OFF; + _colortable = OFF; + _pointSmoothing = OFF; + _polygonOffsetting = OFF; + _alphaTesting = OFF; + + _transparency = new Transparency; + _cullFace = new CullFace; + _texture = 0L; + _fog = 0L; + _texgen = 0L; + _material = new Material; + _material->setColorMode(Material::AMBIENT_AND_DIFFUSE); + _texenv = 0L; + _texmat = 0L; + _point = 0L; + _polygonOffset = 0L; + _alphaFunc = new AlphaFunc; + +} + +void GeoState::setAllToInherit() +{ + _transparencing = INHERIT; + _face_culling = INHERIT; + _lighting = INHERIT; + _texturing = INHERIT; + _fogging = INHERIT; + _texgening = INHERIT; + _antialiasing = INHERIT; + _colortable = INHERIT; + _pointSmoothing = INHERIT; + _polygonOffsetting = INHERIT; + _alphaTesting = INHERIT; + + _transparency = 0L; + _cullFace = 0L; + _texture = 0L; + _fog = 0L; + _texgen = 0L; + _material = 0L; + _texenv = 0L; + _texmat = 0L; + _point = 0L; + _polygonOffset = 0L; + _alphaFunc = 0L; +} + +bool GeoState::readLocalData(Input& fr) +{ + bool iteratorAdvanced = false; + + AttributeMode mode; + if (fr[0].matchWord("transparency") && matchModeStr(fr[1].getStr(),mode)) + { + _transparencing = mode; + fr+=2; + iteratorAdvanced = true; + } + if (Transparency* transTmp = static_cast(Transparency::instance()->readClone(fr))) + { + _transparency = transTmp; + iteratorAdvanced = true; + } + + if (fr[0].matchWord("antialiasing") && matchModeStr(fr[1].getStr(),mode)) + { + _antialiasing = mode; + fr+=2; + iteratorAdvanced = true; + } + + if (fr[0].matchWord("face_culling") && matchModeStr(fr[1].getStr(),mode)) + { + _face_culling = mode; + fr+=2; + iteratorAdvanced = true; + } + if (CullFace* cullTmp = static_cast(CullFace::instance()->readClone(fr))) + { + _cullFace = cullTmp; + iteratorAdvanced = true; + } + + if (fr[0].matchWord("lighting") && matchModeStr(fr[1].getStr(),mode)) + { + _lighting = mode; + fr+=2; + iteratorAdvanced = true; + } + + if (fr[0].matchWord("texturing") && matchModeStr(fr[1].getStr(),mode)) + { + _texturing = mode; + fr+=2; + iteratorAdvanced = true; + } + if (Texture* textTmp = static_cast(Texture::instance()->readClone(fr))) + { + _texture = textTmp; + iteratorAdvanced = true; + } + + if (fr[0].matchWord("fogging") && matchModeStr(fr[1].getStr(),mode)) + { + _fogging = mode; + fr+=2; + iteratorAdvanced = true; + } + if (Fog* fogTmp = static_cast(Fog::instance()->readClone(fr))) + { + _fog = fogTmp; + iteratorAdvanced = true; + } + + if (fr[0].matchWord("colortable") && matchModeStr(fr[1].getStr(),mode)) + { + _colortable = mode; + fr+=2; + iteratorAdvanced = true; + } + + if (fr[0].matchWord("texgening") && matchModeStr(fr[1].getStr(),mode)) + { + _texgening = mode; + fr+=2; + iteratorAdvanced = true; + } + if (TexGen* tmpTexgen = static_cast(TexGen::instance()->readClone(fr))) + { + _texgen = tmpTexgen; + iteratorAdvanced = true; + } + + if (fr[0].matchWord("point_smoothing") && matchModeStr(fr[1].getStr(),mode)) + { + _pointSmoothing = mode; + fr+=2; + iteratorAdvanced = true; + } + + if (Point* tmpPoint = static_cast(Point::instance()->readClone(fr))) + { + _point = tmpPoint; + iteratorAdvanced = true; + } + + if (fr[0].matchWord("polygon_offset") && matchModeStr(fr[1].getStr(),mode)) + { + _polygonOffsetting = mode; + fr+=2; + iteratorAdvanced = true; + } + + if (PolygonOffset* tmpPolygonOffset = static_cast(PolygonOffset::instance()->readClone(fr))) + { + _polygonOffset = tmpPolygonOffset; + iteratorAdvanced = true; + } + + + if (fr[0].matchWord("alpha_test") && matchModeStr(fr[1].getStr(),mode)) + { + _alphaTesting = mode; + fr+=2; + iteratorAdvanced = true; + } + if (AlphaFunc* tmpAlphaFunc = static_cast(AlphaFunc::instance()->readClone(fr))) + { + _alphaFunc = tmpAlphaFunc; + iteratorAdvanced = true; + } + + + if (Material* tmpMaterial = static_cast(Material::instance()->readClone(fr))) + { + _material = tmpMaterial; + iteratorAdvanced = true; + } + + +/* + * Decided that texmatting does not make sense. If a Texture matrix + * is present, just apply it. No need for a mode. Don. + * + if (fr[0].matchWord("texmating") && matchModeStr(fr[1].getStr(),mode)) { + _texmating = mode; + fr+=2; + iteratorAdvanced = true; + } +*/ + + return iteratorAdvanced; +} + + +bool GeoState::writeLocalData(Output& fw) +{ + fw.indent() << "transparency " << getModeStr(_transparencing) << endl; + if (_transparency.valid()) _transparency->write(fw); + + fw.indent() << "antialiasing " << getModeStr(_antialiasing) << endl; + + fw.indent() << "face_culling " << getModeStr(_face_culling) << endl; + if (_cullFace.valid()) _cullFace->write(fw); + + fw.indent() << "lighting " << getModeStr(_lighting) << endl; + + fw.indent() << "texturing " << getModeStr(_texturing) << endl; + if (_texture.valid()) _texture->write(fw); + + fw.indent() << "fogging " << getModeStr(_fogging) << endl; + if (_fog.valid()) _fog->write(fw); + + fw.indent() << "colortable " << getModeStr(_colortable) << endl; + + fw.indent() << "texgening " << getModeStr(_texgening) << endl; + if (_texgen.valid()) _texgen->write(fw); + + if (_texenv.valid()) _texenv->write(fw); + + fw.indent() << "point_smoothing " << getModeStr(_pointSmoothing) << endl; + if (_point.valid()) _point->write(fw); + + fw.indent() << "polygon_offset " << getModeStr(_polygonOffsetting) << endl; + if (_polygonOffset.valid()) _polygonOffset->write(fw); + + fw.indent() << "alpha_test " << getModeStr(_alphaTesting) << endl; + if (_alphaFunc.valid()) _alphaFunc->write(fw); + + if (_material.valid()) _material->write(fw); + +/* + fw.indent() << "texmating " << getModeStr(_texmating) << endl; +*/ + + return true; +} + +bool GeoState::matchModeStr(const char* str,AttributeMode& mode) +{ + if (strcmp(str,"INHERIT")==0) mode = INHERIT; + else if (strcmp(str,"ON")==0) mode = ON; + else if (strcmp(str,"OFF")==0) mode = OFF; + else if (strcmp(str,"OVERRIDE_ON")==0) mode = OVERRIDE_ON; + else if (strcmp(str,"OVERRIDE_OFF")==0) mode = OVERRIDE_OFF; + else return false; + return true; +} + + +const char* GeoState::getModeStr(AttributeMode mode) +{ + switch(mode) + { + case(INHERIT): return "INHERIT"; + case(ON): return "ON"; + case(OFF): return "OFF"; + case(OVERRIDE_ON): return "OVERRIDE_ON"; + case(OVERRIDE_OFF): return "OVERRIDE_OFF"; + } + return ""; +} + + +void GeoState::setMode( AttributeType type, AttributeMode mode ) +{ + switch( type ) + { + case ANTIALIAS : _antialiasing = mode; break; + case FACE_CULL: _face_culling = mode; break; + case FOG : _fogging = mode; break; + case LIGHTING: _lighting = mode; break; + case POINT : _pointSmoothing = mode; break; + case POLYGON_OFFSET : _polygonOffsetting = mode; break; + case TEXGEN : _texgening = mode; break; + case TEXTURE : _texturing = mode; break; + case TRANSPARENCY: _transparencing = mode; break; + case ALPHAFUNC: _alphaTesting = mode; break; + default : notify(WARN) << "GeoState::setMode("<<(int)type<<","<<(int)mode<<") not handled."<(attribute); break; + case FOG : _fog = dynamic_cast(attribute); break; + case LIGHTING: break; /*_light = (Light *)attribute;*/ + case MATERIAL: _material = dynamic_cast(attribute); break; + case POINT : _point = dynamic_cast(attribute); break; + case POLYGON_OFFSET: _polygonOffset = dynamic_cast(attribute); break; + case TEXENV : _texenv = dynamic_cast(attribute); break; + case TEXGEN : _texgen = dynamic_cast(attribute); break; + case TEXMAT : _texmat = dynamic_cast(attribute); break; + case TEXTURE : _texture = dynamic_cast(attribute); break; + case TRANSPARENCY: _transparency = dynamic_cast(attribute); break; + case ALPHAFUNC: _alphaFunc = dynamic_cast(attribute); break; + default : notify(WARN) << "GeoState::setAttribute("<<(int)type<<","<apply(); + + if( _cullFace.valid()) + _cullFace->apply(); + + if( _texenv.valid()) + _texenv->apply(); + + if( _texgen.valid()) + _texgen->apply(); + + if( _texture.valid()) + _texture->apply(); + + if( _material.valid()) + _material->apply(); + + if( _fog.valid()) + _fog->apply(); + + if( _texmat.valid()) + _texmat->apply(); + + if( _point.valid()) + _point->apply(); + + if( _polygonOffset.valid()) + _polygonOffset->apply(); + + if( _alphaFunc.valid()) + _alphaFunc->apply(); +} + + + +void GeoState::apply(GeoState* global,GeoState* prev) +{ + if (global==NULL || prev==NULL) + { + apply(); + return; + } + + switch(GeoState::combineMode(global->_transparencing,prev->_transparencing,_transparencing)) + { + case(ON): + case(OVERRIDE_ON): + Transparency::enable(); + break; + case(OFF): + case(OVERRIDE_OFF): + Transparency::disable(); + break; + case(INHERIT): + break; + } + + + switch(GeoState::combineMode(global->_face_culling,prev->_face_culling,_face_culling)) + { + case(ON): + case(OVERRIDE_ON): + CullFace::enable(); + break; + case(OFF): + case(OVERRIDE_OFF): + CullFace::disable(); + break; + case(INHERIT): + break; + } + + switch(GeoState::combineMode(global->_lighting,prev->_lighting,_lighting)) + { + case(ON): + case(OVERRIDE_ON): + Lighting::enable(); + break; + case(OFF): + case(OVERRIDE_OFF): + Lighting::disable(); + break; + case(INHERIT): + break; + } + + switch(GeoState::combineMode(global->_texturing,prev->_texturing,_texturing)) + { + case(ON): + case(OVERRIDE_ON): + Texture::enable(); + break; + case(OFF): + case(OVERRIDE_OFF): + Texture::disable(); + break; + case(INHERIT): + break; + } + + switch(GeoState::combineMode(global->_texgening,prev->_texgening,_texgening)) + { + case(ON): + case(OVERRIDE_ON): + TexGen::enable(); + break; + case(OFF): + case(OVERRIDE_OFF): + TexGen::disable(); + break; + case(INHERIT): + break; + } + + switch(GeoState::combineMode(global->_fogging,prev->_fogging,_fogging)) + { + case(ON): + case(OVERRIDE_ON): + Fog::enable(); + break; + case(OFF): + case(OVERRIDE_OFF): + Fog::disable(); + break; + case(INHERIT): + break; + } + + switch(GeoState::combineMode(global->_pointSmoothing,prev->_pointSmoothing,_pointSmoothing)) + { + case(ON): + case(OVERRIDE_ON): + Point::enableSmooth(); + break; + case(OFF): + case(OVERRIDE_OFF): + Point::disableSmooth(); + break; + case(INHERIT): + break; + } + + switch(GeoState::combineMode(global->_polygonOffsetting,prev->_polygonOffsetting,_polygonOffsetting)) + { + case(ON): + case(OVERRIDE_ON): + PolygonOffset::enable(); + break; + case(OFF): + case(OVERRIDE_OFF): + PolygonOffset::disable(); + break; + case(INHERIT): + break; + } + + switch(GeoState::combineMode(global->_alphaTesting,prev->_alphaTesting,_alphaTesting)) + { + case(ON): + case(OVERRIDE_ON): + AlphaFunc::enable(); + break; + case(OFF): + case(OVERRIDE_OFF): + AlphaFunc::disable(); + break; + case(INHERIT): + break; + } + + if (prev->_transparency!=_transparency) + { + osg::Transparency* new_transparency; + if (_transparency.valid()) new_transparency = _transparency.get(); + else new_transparency = global->_transparency.get(); + if (new_transparency) new_transparency->apply(); + } + + if (prev->_cullFace!=_cullFace) + { + osg::CullFace* new_cullFace; + if (_cullFace.valid()) new_cullFace = _cullFace.get(); + else new_cullFace = global->_cullFace.get(); + if (new_cullFace) new_cullFace->apply(); + } + + if (prev->_texenv!=_texenv) + { + osg::TexEnv* new_texenv; + if (_texenv.valid()) new_texenv = _texenv.get(); + else new_texenv = global->_texenv.get(); + if (new_texenv) new_texenv->apply(); + } + + if (prev->_texgen!=_texgen) + { + osg::TexGen* new_texgen; + if (_texgen.valid()) new_texgen = _texgen.get(); + else new_texgen = global->_texgen.get(); + if (new_texgen) new_texgen->apply(); + } + + if (prev->_texture!=_texture) + { + osg::Texture* new_texture; + if (_texture.valid()) new_texture = _texture.get(); + else new_texture = global->_texture.get(); + if (new_texture) new_texture->apply(); + } + + if (prev->_material!=_material) + { + osg::Material* new_material; + if (_material.valid()) new_material = _material.get(); + else new_material = global->_material.get(); + if (new_material) new_material->apply(); + } + + if (prev->_fog!=_fog) + { + osg::Fog* new_fog; + if (_fog.valid()) new_fog = _fog.get(); + else new_fog = global->_fog.get(); + if (new_fog) new_fog->apply(); + } + + if (prev->_texmat!=_texmat) + { + osg::TexMat* new_texmat; + if (_texmat.valid()) new_texmat = _texmat.get(); + else new_texmat = global->_texmat.get(); + if (new_texmat) new_texmat->apply(); + } + + if (prev->_point!=_point) + { + osg::Point* new_point; + if (_point.valid()) new_point = _point.get(); + else new_point = global->_point.get(); + if (new_point) new_point->apply(); + } + + if (prev->_polygonOffset!=_polygonOffset) + { + osg::PolygonOffset* new_polygonOffset; + if (_polygonOffset.valid()) new_polygonOffset = _polygonOffset.get(); + else new_polygonOffset = global->_polygonOffset.get(); + if (new_polygonOffset) new_polygonOffset->apply(); + } + + if (prev->_alphaFunc!=_alphaFunc) + { + osg::AlphaFunc* new_AlphaFunc; + if (_alphaFunc.valid()) new_AlphaFunc = _alphaFunc.get(); + else new_AlphaFunc = global->_alphaFunc.get(); + if (new_AlphaFunc) new_AlphaFunc->apply(); + } +} + +bool GeoState::check() +{ + return true; +} + + +/* +#if 0 // [ NOTES on how apply should work + +Each Scene must have a global initial GeoState, current GeoState, and current request state. The current definition of GeoState +should really become an GeoState. The global initial State can have modes set to + + SG_ON, + SG_OFF, + +and may be or'ed with + +SG_OVERRIDE. + +All attributes are set to the default. Defaults can be set at start up by querying hardware +and determining best parameters (for example, do we have hardware texture mapping?, if so enable texture and create a texture environment). + +The current GeoState and the request GeoState begin as a copy of the initial state. The request state is subsequently changed by each GeoState, +during traversal. It is the current state that will actually issue the GL commands at apply time. + +Attributes for the GeoStates may be + +SG_ON -explicitely +SG_OFF -explicitely +SG_INHERIT + +and may be or'ed with + +SG_PERSIST + +During traversal, each GeoState's attribute set to INHERIT does nothing. Each attribute set to ON or OFF sets the subsequent request state +to the same before drawing and unsets it after. If the attribute is or'ed with SG_PERSIST, then the mode is not unset after drawing. +Just before drawing the request state is compared to the current state. If an attribute or mode has changed, it is changed in the current +state then applied. Only at this application will the actual GL calls be issued. + +For exammple, if two subsequent geosets have lighting on the sequence will be as follows + +geostate 1 sets lighting on in request state +at draw: +if current state has lighting off it is changed to on and applied. +geostate1 unsets lighting in request state. + +geosate2 resets lighting to on in request state +at draw: +current state has lighting set to on from previous draw therefore nothing changes + +geostate2 + +Addendum 10/22 - Use this method for traversal. Currently we shall do dumb apply(). +Upon implementation of a CULL traversal, which creates a DRAW display list, then we +shall implement the "smart" state change described above. + +#endif // ] +*/ diff --git a/src/osg/Geode.cpp b/src/osg/Geode.cpp new file mode 100644 index 000000000..1b30bfb1c --- /dev/null +++ b/src/osg/Geode.cpp @@ -0,0 +1,161 @@ +#include +#include +#include "osg/Geode" +#include "osg/Input" +#include "osg/Output" + +#include + +#ifdef __sgi +using std::find; +using std::for_each; +#endif + +#define square(x) ((x)*(x)) + +#include "osg/Registry" + +using namespace osg; + +RegisterObjectProxy g_GeodeProxy; + +Geode::Geode() +{ + _bsphere_computed = false; +} + + +Geode::~Geode() +{ + // ref_ptr<> automactially decrements the reference count of all geosets. +} + + +bool Geode::readLocalData(Input& fr) +{ + + bool iteratorAdvanced = false; + + if (Node::readLocalData(fr)) iteratorAdvanced = true; + + int num_geosets; + if (fr[0].matchWord("num_geosets") && + fr[1].getInt(num_geosets)) + { + // could allocate space for children here... + fr+=2; + iteratorAdvanced = true; + } + + GeoSet* gset_read = NULL; + do + { + if ((gset_read=static_cast(GeoSet::instance()->readClone(fr)))) + { + addGeoSet(gset_read); + iteratorAdvanced = true; + } + + } while(gset_read != NULL); + + return iteratorAdvanced; +} + + +bool Geode::writeLocalData(Output& fw) +{ + Node::writeLocalData(fw); + + fw.indent() << "num_geosets " << getNumGeosets() << endl; + for(GeoSetList::iterator itr = _geosets.begin(); + itr!=_geosets.end(); + ++itr) + { + (*itr)->write(fw); + } + return true; +} + + +bool Geode::addGeoSet( GeoSet *gset ) +{ + if (gset && !containsGeoSet(gset)) + { + // note ref_ptr<> automatically handles incrementing gset's reference count. + _geosets.push_back(gset); + dirtyBound(); + return true; + } + else return false; +} + +bool Geode::removeGeoSet( GeoSet *gset ) +{ + GeoSetList::iterator itr = findGeoSet(gset); + if (itr!=_geosets.end()) + { + // note ref_ptr<> automatically handles decrementing gset's reference count. + _geosets.erase(itr); + dirtyBound(); + return true; + } + else return false; +} + +bool Geode::replaceGeoSet( GeoSet *origGset, GeoSet *newGset ) +{ + if (newGset==NULL || origGset==newGset) return false; + + GeoSetList::iterator itr = findGeoSet(origGset); + if (itr!=_geosets.end()) + { + // note ref_ptr<> automatically handles decrementing origGset's reference count, + // and inccrementing newGset's reference count. + *itr = newGset; + dirtyBound(); + return true; + } + else return false; + +} + + +bool Geode::computeBound( void ) +{ + BoundingBox bb; + GeoSetList::iterator itr; + for(itr=_geosets.begin(); + itr!=_geosets.end(); + ++itr) + { + bb.expandBy((*itr)->getBound()); + } + + _bsphere._center = bb.center(); + _bsphere._radius = 0.0f; + + for(itr=_geosets.begin(); + itr!=_geosets.end(); + ++itr) + { + const BoundingBox& bbox = (*itr)->getBound(); + for(unsigned int c=0;c<8;++c) + { + _bsphere.expandRadiusBy(bbox.corner(c)); + } + } + + _bsphere_computed=true; + return true; +} + + +void Geode::compileGeoSets( void ) +{ + for(GeoSetList::iterator itr = _geosets.begin(); + itr!=_geosets.end(); + ++itr) + { + (*itr)->compile(); + } +} diff --git a/src/osg/Group.cpp b/src/osg/Group.cpp new file mode 100644 index 000000000..0fa876d97 --- /dev/null +++ b/src/osg/Group.cpp @@ -0,0 +1,180 @@ +#include +#include +#include "osg/Group" +#include "osg/Input" +#include "osg/Output" +#include "osg/Registry" +#include "osg/BoundingBox" + +#include + +// #ifdef __sgi +// using std::find; +// using std::for_each; +// using std::string; +// #endif + +#define square(x) ((x)*(x)) + +using namespace osg; + +RegisterObjectProxy g_GroupProxy; + +Group::Group() +{ +} + + +Group::~Group() +{ + + for(ChildList::iterator itr=_children.begin(); + itr!=_children.end(); + ++itr) + { + Node* child = itr->get(); + ParentList::iterator pitr = std::find(child->_parents.begin(),child->_parents.end(),this); + if (pitr!=child->_parents.end()) child->_parents.erase(pitr); + } + +} + + +void Group::traverse(NodeVisitor& nv) +{ + for(ChildList::iterator itr=_children.begin(); + itr!=_children.end(); + ++itr) + { + (*itr)->accept(nv); + } +} + + +bool Group::addChild( Node *child ) +{ + if (child && !containsNode(child)) + { + // note ref_ptr<> automatically handles incrementing child's reference count. + _children.push_back(child); + + // register as parent of child. + child->_parents.push_back(this); + + dirtyBound(); + + return true; + } + else return false; +} + +bool Group::removeChild( Node *child ) +{ + ChildList::iterator itr = findNode(child); + if (itr!=_children.end()) + { + // note ref_ptr<> automatically handles decrementing child's reference count. + _children.erase(itr); + dirtyBound(); + + ParentList::iterator pitr = std::find(child->_parents.begin(),child->_parents.end(),child); + if (pitr!=child->_parents.end()) child->_parents.erase(pitr); + + return true; + } + else return false; +} + +bool Group::replaceChild( Node *origNode, Node *newNode ) +{ + if (newNode==NULL || origNode==newNode) return false; + + ChildList::iterator itr = findNode(origNode); + if (itr!=_children.end()) + { + ParentList::iterator pitr = std::find(origNode->_parents.begin(),origNode->_parents.end(),origNode); + if (pitr!=origNode->_parents.end()) origNode->_parents.erase(pitr); + + // note ref_ptr<> automatically handles decrementing origNode's reference count, + // and inccrementing newNode's reference count. + *itr = newNode; + + // register as parent of child. + newNode->_parents.push_back(this); + + dirtyBound(); + return true; + } + else return false; + +} + +bool Group::readLocalData(Input& fr) +{ + bool iteratorAdvanced = false; + if (Node::readLocalData(fr)) iteratorAdvanced = true; + + int num_children; + if (fr[0].matchWord("num_children") && + fr[1].getInt(num_children)) + { + // could allocate space for children here... + fr+=2; + iteratorAdvanced = true; + } + + Node* node = NULL; + while((node=fr.readNode())!=NULL) + { + addChild(node); + iteratorAdvanced = true; + } + + return iteratorAdvanced; +} + + +bool Group::writeLocalData(Output& fw) +{ + Node::writeLocalData(fw); + + fw.indent() << "num_children " << getNumChildren() << endl; + for(int i=0;iwrite(fw); + } + return true; +} + + +bool Group::computeBound() +{ + + _bsphere_computed = true; + + _bsphere.init(); + if (_children.empty()) return false; + + BoundingBox bb; + bb.init(); + ChildList::iterator itr; + for(itr=_children.begin(); + itr!=_children.end(); + ++itr) + { + bb.expandBy((*itr)->getBound()); + } + + if (!bb.isValid()) return false; + + _bsphere._center = bb.center(); + _bsphere._radius = 0.0f; + for(itr=_children.begin(); + itr!=_children.end(); + ++itr) + { + _bsphere.expandRadiusBy((*itr)->getBound()); + } + + return true; +} diff --git a/src/osg/Image.cpp b/src/osg/Image.cpp new file mode 100644 index 000000000..7884cca10 --- /dev/null +++ b/src/osg/Image.cpp @@ -0,0 +1,224 @@ +#include "osg/Image" +#include "osg/Input" +#include "osg/Output" +#include "osg/GL" +#include "osg/Notify" + +#include +#include +#include +#include + +using namespace osg; + +Image::Image() +{ + _fileName = NULL; + _s = _t = _r = 0; + _internalFormat = 0; + _pixelFormat = (unsigned int)0; + _dataType = (unsigned int)0; + _packing = 4; + + _data = (unsigned char *)0L; +} + + +Image::~Image() +{ + if (_fileName) ::free(_fileName); + if (_data) ::free(_data); +} + + +void Image::setFileName(const char* fileName) +{ + if (_fileName) ::free(_fileName); + + if (fileName) _fileName = strdup(fileName); + else _fileName = NULL; +} + + +void Image::setImage(int s,int t,int r, + int internalFormat, + unsigned int pixelFormat, + unsigned int dataType, + unsigned char *data, + int packing) +{ + if (_data) ::free(_data); + + _s = s; + _t = t; + _r = r; + + _internalFormat = internalFormat; + _pixelFormat = pixelFormat; + _dataType = dataType; + + _data = data; + + + if (packing<0) + { + if (_s%4==0) + _packing = 4; + else + _packing = 1; + } + else + _packing = packing; + +// scaleImageTo(16,16,_r); + +} + + +bool Image::readLocalData(Input& fr) +{ + bool iteratorAdvanced = false; + if (fr[0].matchWord("file") && fr[1].isString()) + { +//loadFile(fr[1].getStr()); + fr += 2; + iteratorAdvanced = true; + } + + return iteratorAdvanced; +} + + +bool Image::writeLocalData(Output& fw) +{ + if (_fileName) + { + fw.indent() << "file \""<<_fileName<<"\""<s(),image->t()); +} + +Geode* osg::createGeodeForImage(osg::Image* image,float s,float t) +{ + if (image) + { + if (s>0 && t>0) + { + + float y = 1.0; + float x = y*(s/t); + + // set up the texture. + osg::Texture* texture = new osg::Texture; + texture->setImage(image); + + // set up the geostate. + osg::GeoState* gstate = new osg::GeoState; + gstate->setMode(osg::GeoState::FACE_CULL,osg::GeoState::OFF); + gstate->setMode(osg::GeoState::LIGHTING,osg::GeoState::OFF); + gstate->setMode(osg::GeoState::TEXTURE,osg::GeoState::ON); + gstate->setAttribute(osg::GeoState::TEXTURE,texture); + + // set up the geoset. + osg::GeoSet* gset = new osg::GeoSet; + gset->setGeoState(gstate); + + osg::Vec3* coords = new Vec3 [4]; + coords[0].set(-x,0.0f,y); + coords[1].set(-x,0.0f,-y); + coords[2].set(x,0.0f,-y); + coords[3].set(x,0.0f,y); + gset->setCoords(coords); + + osg::Vec2* tcoords = new Vec2 [4]; + tcoords[0].set(0.0f,1.0f); + tcoords[1].set(0.0f,0.0f); + tcoords[2].set(1.0f,0.0f); + tcoords[3].set(1.0f,1.0f); + gset->setTextureCoords(tcoords); + gset->setTextureBinding(osg::GeoSet::BIND_PERVERTEX); + + osg::Vec4* colours = new Vec4; + colours->set(1.0f,1.0f,1.0,0.0f); + gset->setColors(colours); + gset->setColorBinding(osg::GeoSet::BIND_OVERALL); + + gset->setNumPrims(1); + gset->setPrimType(osg::GeoSet::QUADS); + + // set up the geode. + osg::Geode* geode = new osg::Geode; + geode->addGeoSet(gset); + + return geode; + + } + else + { + return NULL; + } + } + else + { + return NULL; + } +} diff --git a/src/osg/Input.cpp b/src/osg/Input.cpp new file mode 100644 index 000000000..4789d14cf --- /dev/null +++ b/src/osg/Input.cpp @@ -0,0 +1,69 @@ +#include "osg/Input" +#include "osg/Registry" +#include "osg/Object" + +#ifdef __sgi +using std::string; +#endif + +using namespace osg; + +// Will extend to handle #DEF and use +// functionality similar to Inventor, +// and add the ability to handle #include +// from within the OSG file format. +Input::Input() +{ +} + + +Input::~Input() +{ +} + +Object* Input::getObjectForUniqueID(const std::string& uniqueID) +{ + UniqueIDToObjectMapping::iterator fitr = _uniqueIDToObjectMap.find(uniqueID); + if (fitr != _uniqueIDToObjectMap.end()) return (*fitr).second; + else return NULL; +} + +void Input::regisiterUniqueIDForObject(const std::string& uniqueID,Object* obj) +{ + _uniqueIDToObjectMap[uniqueID] = obj; +} + +Object* Input::readObject() +{ + return Registry::instance()->readObject(*this); +} + + +Object* Input::readObject(const string& fileName) +{ + return Registry::instance()->readObject(fileName); +} + + +Image* Input::readImage() +{ + return Registry::instance()->readImage(*this); +} + + +Image* Input::readImage(const string& fileName) +{ + return Registry::instance()->readImage(fileName); +} + + +Node* Input::readNode() +{ + return Registry::instance()->readNode(*this); +} + + +Node* Input::readNode(const string& fileName) +{ + return Registry::instance()->readNode(fileName); +} diff --git a/src/osg/LOD.cpp b/src/osg/LOD.cpp new file mode 100644 index 000000000..69c0cee35 --- /dev/null +++ b/src/osg/LOD.cpp @@ -0,0 +1,130 @@ +#include "osg/LOD" +#include "osg/Input" +#include "osg/Output" +#include "osg/Registry" + +#include + +using namespace osg; + +RegisterObjectProxy g_LODProxy; + +void LOD::traverse(NodeVisitor& nv) +{ + switch(nv.getTraverseMode()) + { + case(NodeVisitor::TRAVERSE_ALL_CHILDREN): + std::for_each(_children.begin(),_children.end(),NodeAcceptOp(nv)); + break; + case(NodeVisitor::TRAVERSE_ACTIVE_CHILDREN): + if (_children.size()!=0) _children.front()->accept(nv); + break; + default: + break; + } +} + +void LOD::setRange(unsigned int index, float range) +{ + if (index<_rangeList.size()) _rangeList[index] = range; + else while (index>=_rangeList.size()) _rangeList.push_back(range); + + if (index<_rangeList2.size()) _rangeList2[index] = range*range; + else while (index>=_rangeList2.size()) _rangeList2.push_back(range*range); +} + +int LOD::evaluate(const Vec3& eye_local, float bias) +{ + // For cache coherency, use _rangeList2 exclusively + if (_rangeList2.size()==0) return -1; + + // Test distance-squared against the stored array of squared ranges + float LODRange = (eye_local-_center).length2()*bias; + if (LODRange<_rangeList2[0]) return -1; + + for(unsigned int i=0;i<_rangeList2.size()-1;++i) + { + if (_rangeList2[i]<=LODRange && LODRange<_rangeList2[i+1]) { + return i; + } + } + return -1; +} + +bool LOD::readLocalData(Input& fr) +{ + bool iteratorAdvanced = false; + + if (fr.matchSequence("Center %f %f %f")) + { + + fr[1].getFloat(_center[0]); + fr[2].getFloat(_center[1]); + fr[3].getFloat(_center[2]); + + iteratorAdvanced = true; + fr+=3; + } + + bool matchFirst = false; + if ((matchFirst=fr.matchSequence("Ranges {")) || fr.matchSequence("Ranges %i {")) + { + + // set up coordinates. + int entry = fr[0].getNoNestedBrackets(); + + if (matchFirst) + { + fr += 2; + } + else + { + //_rangeList.(capacity); + fr += 3; + } + + float range; + while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) + { + if (fr[0].getFloat(range)) + { + ++fr; + _rangeList.push_back(range); + _rangeList2.push_back(range*range); + } + else + { + ++fr; + } + } + + iteratorAdvanced = true; + ++fr; + + } + + if (Group::readLocalData(fr)) iteratorAdvanced = true; + + return iteratorAdvanced; +} + + +bool LOD::writeLocalData(Output& fw) +{ + fw.indent() << "Center "<<_center[0] << " "<<_center[1] << " "<<_center[2] < s_Light(new Light); + return s_Light.get(); +} + +void Light::init( void ) +{ + _ambient.set(0.05f,0.05f,0.05f,1.0f); + _diffuse.set(0.8f,0.8f,0.8f,1.0f); + _specular.set(0.05f,0.05f,0.05f,1.0f); + _position.set(0.0f,0.0f,1.0f,0.0f); + _direction.set(0.0f,0.0f,-1.0f); + _spot_exponent = 0.0f; + _spot_cutoff = 180.0f; + _constant_attenuation = 1.0f; + _linear_attenuation = 0.0f; + _quadratic_attenuation = 0.0f; +} + +void Light::captureLightState() +{ + glGetLightfv( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_AMBIENT, _ambient.ptr() ); + glGetLightfv( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_DIFFUSE, _diffuse.ptr() ); + glGetLightfv( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_SPECULAR, _specular.ptr() ); + glGetLightfv( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_POSITION, _position.ptr() ); + glGetLightfv( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_SPOT_DIRECTION, _direction.ptr() ); + glGetLightfv( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_SPOT_EXPONENT, &_spot_exponent ); + glGetLightfv( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_SPOT_CUTOFF, &_spot_cutoff ); + glGetLightfv( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_CONSTANT_ATTENUATION, &_constant_attenuation ); + glGetLightfv( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_LINEAR_ATTENUATION, &_linear_attenuation ); + glGetLightfv( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_QUADRATIC_ATTENUATION, &_quadratic_attenuation ); +} + + +void Light::enable( void ) +{ + glEnable( GL_LIGHTING ); +} + + +void Light::disable( void ) +{ + glDisable( GL_LIGHTING ); +} + + +void Light::apply( void ) +{ + if( _on ) + { + glEnable ( (GLenum)((int)GL_LIGHT0 + _lightnum) ); + glLightfv( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_AMBIENT, _ambient.ptr() ); + glLightfv( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_DIFFUSE, _diffuse.ptr() ); + glLightfv( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_SPECULAR, _specular.ptr() ); + glLightfv( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_POSITION, _position.ptr() ); + glLightfv( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_SPOT_DIRECTION, _direction.ptr() ); + glLightf ( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_SPOT_EXPONENT, _spot_exponent ); + glLightf ( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_SPOT_CUTOFF, _spot_cutoff ); + glLightf ( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_CONSTANT_ATTENUATION, _constant_attenuation ); + glLightf ( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_LINEAR_ATTENUATION, _linear_attenuation ); + glLightf ( (GLenum)((int)GL_LIGHT0 + _lightnum), GL_QUADRATIC_ATTENUATION, _quadratic_attenuation ); + } + else + glDisable( (GLenum)((int)GL_LIGHT0 + _lightnum) ); +} diff --git a/src/osg/LightSource.cpp b/src/osg/LightSource.cpp new file mode 100644 index 000000000..f750bcc56 --- /dev/null +++ b/src/osg/LightSource.cpp @@ -0,0 +1,59 @@ +#include "osg/LightSource" +#include "osg/Input" +#include "osg/Output" + +#include "osg/Registry" + +using namespace osg; + +RegisterObjectProxy g_LightSourceProxy; + +LightSource::LightSource() +{ + _bsphere_computed = false; +} + + +LightSource::~LightSource() +{ + // ref_ptr<> automactially decrements the reference count of attached lights. +} + + +bool LightSource::readLocalData(Input& fr) +{ + + bool iteratorAdvanced = false; + + if (Node::readLocalData(fr)) iteratorAdvanced = true; + + Light* light = static_cast(Light::instance()->readClone(fr)); + if (light) + { + _light = light; + iteratorAdvanced = true; + } + + return iteratorAdvanced; +} + + +bool LightSource::writeLocalData(Output& fw) +{ + Node::writeLocalData(fw); + + if (_light.valid()) _light->write(fw); + + return true; +} + +bool LightSource::computeBound( void ) +{ + // note, don't do anything right now as the light itself is not + // visualised, just having an effect on the lighting of geodes. + _bsphere.init(); + + _bsphere_computed = true; + + return true; +} diff --git a/src/osg/Lighting.cpp b/src/osg/Lighting.cpp new file mode 100644 index 000000000..88409a820 --- /dev/null +++ b/src/osg/Lighting.cpp @@ -0,0 +1,15 @@ +#include "osg/GL" +#include "osg/Lighting" + +using namespace osg; + +void Lighting::enable( void ) +{ + glEnable( GL_LIGHTING ); +} + + +void Lighting::disable( void ) +{ + glDisable( GL_LIGHTING ); +} diff --git a/src/osg/Makedepend b/src/osg/Makedepend new file mode 100644 index 000000000..e69de29bb diff --git a/src/osg/Makefile b/src/osg/Makefile new file mode 100644 index 000000000..2362a670f --- /dev/null +++ b/src/osg/Makefile @@ -0,0 +1,148 @@ +#!smake +include ../../Make/makedefs + +C++FILES = \ + Registry.cpp\ + OSG.cpp\ + AlphaFunc.cpp\ + Group.cpp\ + Field.cpp\ + FieldReader.cpp\ + FieldReaderIterator.cpp\ + GeoSet.cpp\ + GeoSet_ogl.cpp\ + GeoState.cpp\ + Geode.cpp\ + Input.cpp\ + FileNameUtils.cpp\ + Light.cpp\ + LightSource.cpp\ + Lighting.cpp\ + Material.cpp\ + Matrix.cpp\ + Quat.cpp\ + Seg.cpp\ + Node.cpp\ + NodeVisitor.cpp\ + Object.cpp\ + Output.cpp\ + DynamicLibrary.cpp\ + TexEnv.cpp\ + TexGen.cpp\ + Image.cpp\ + Texture.cpp\ + DCS.cpp\ + Scene.cpp\ + Switch.cpp\ + Sequence.cpp\ + LOD.cpp\ + Billboard.cpp\ + BoundingSphere.cpp\ + BoundingBox.cpp\ + Transparency.cpp\ + CullFace.cpp\ + TexMat.cpp\ + Timer.cpp\ + Fog.cpp\ + ReaderWriterOSG.cpp\ + ReaderWriterRGB.cpp\ + Camera.cpp\ + Notify.cpp\ + ExtensionSupported.cpp\ + Point.cpp\ + PolygonOffset.cpp\ + Version.cpp\ + + +TARGET_BASENAME = osg + +TARGET_LIB_FILES = lib$(TARGET_BASENAME).so + +TARGET_INCLUDE_FILES = \ + osg/AlphaFunc\ + osg/Billboard\ + osg/BoundingBox\ + osg/BoundingSphere\ + osg/Camera\ + osg/CullFace\ + osg/DCS\ + osg/DynamicLibrary\ + osg/Export\ + osg/Field\ + osg/FieldReader\ + osg/FieldReaderIterator\ + osg/FileNameUtils\ + osg/Fog\ + osg/GeoSet\ + osg/GeoState\ + osg/Geode\ + osg/Group\ + osg/GL\ + osg/Image\ + osg/Input\ + osg/LOD\ + osg/Light\ + osg/LightSource\ + osg/Lighting\ + osg/Material\ + osg/Matrix\ + osg/Node\ + osg/Notify\ + osg/NodeVisitor\ + osg/OSG\ + osg/Object\ + osg/Output\ + osg/Point\ + osg/PolygonOffset\ + osg/Quat\ + osg/Referenced\ + osg/Registry\ + osg/Scene\ + osg/Seg\ + osg/Sequence\ + osg/State\ + osg/Switch\ + osg/TexEnv\ + osg/TexGen\ + osg/TexMat\ + osg/Texture\ + osg/Transparency\ + osg/Timer\ + osg/Types\ + osg/Vec2\ + osg/Vec3\ + osg/Vec4\ + osg/Version\ + + +TARGET_DATA_FILES = \ + cessna.osg\ + cow.osg\ + dumptruck.osg\ + e-s-bike.osg\ + flight_park.fly\ + glider.osg\ + ncc1701d.osg\ + paraglider.osg\ + torus.osg\ + turtle.osg\ + Test/CullFace.osg\ + Test/Point.osg\ + Test/PolygonOffset.osg\ + Images/lz.rgb\ + Images/reflect.rgb\ + Images/tank.rgb\ + Images/tree0.rgba\ + Images/water.rgb\ + Images/white.rgb\ + + +LIBS = -ldl + +LIB = ../../lib/lib$(TARGET_BASENAME).so +#LIB = ../../lib/lib$(TARGET_BASENAME).a + +C++FLAGS += -I ../../include + +include ../../Make/makerules + diff --git a/src/osg/Material.cpp b/src/osg/Material.cpp new file mode 100644 index 000000000..b95199298 --- /dev/null +++ b/src/osg/Material.cpp @@ -0,0 +1,560 @@ +#include "osg/Material" +#include "osg/Input" +#include "osg/Output" +#include "osg/Notify" + +using namespace osg; + +Material::Material( void ) +{ + _colorMode = OFF; + + _ambientFrontAndBack = true; + _ambientFront.set(0.2f, 0.2f, 0.2f, 1.0f); + _ambientBack.set(0.2f, 0.2f, 0.2f, 1.0f); + + _diffuseFrontAndBack = true; + _diffuseFront.set(0.8f, 0.8f, 0.8f, 1.0f); + _diffuseBack.set(0.8f, 0.8f, 0.8f, 1.0f); + + _specularFrontAndBack = true; + _specularFront.set(0.0f, 0.0f, 0.0f, 1.0f); + _specularBack.set(0.0f, 0.0f, 0.0f, 1.0f); + + _emissionFrontAndBack = true; + _emissionFront.set(0.0f, 0.0f, 0.0f, 1.0f); + _emissionBack.set(0.0f, 0.0f, 0.0f, 1.0f); + + _shininessFrontAndBack = true; + _shininessFront = 0.0f; + _shininessBack = 0.0f; +} + + +Material::~Material( void ) +{ +} + + +Material* Material::instance() +{ + static ref_ptr s_Material(new Material); + return s_Material.get(); +} + +void Material::setAmbient( MaterialFace face, const Vec4& ambient ) +{ + switch(face) { + case(FACE_FRONT): + _ambientFrontAndBack = false; + _ambientFront = ambient; + break; + case(FACE_BACK): + _ambientFrontAndBack = false; + _ambientBack = ambient; + break; + case(FACE_FRONT_AND_BACK): + _ambientFrontAndBack = true; + _ambientFront = ambient; + _ambientBack = ambient; + break; + default: + notify(NOTICE)<<"Notice: invalid MaterialFace passed to Material::setAmbient()."< +#include "osg/Matrix" +#include "osg/Input" +#include "osg/Output" +#include "osg/Notify" + +#define square(x) ((x)*(x)) +#define DEG2RAD(x) ((x)*M_PI/180.0) + +using namespace osg; + +typedef struct quaternion_ +{ + double x ; + double y ; + double z ; + double w ; +} quaternion ; + +/* C = a(row).b(row) */ + +#define matrix_inner_product( a, b, row, col, C ) \ + { \ + (C)[row][col] = (a)[row][0] * (b)[0][col] + \ + (a)[row][1] * (b)[1][col] + \ + (a)[row][2] * (b)[2][col] + \ + (a)[row][3] * (b)[3][col]; \ + } + +/* C = a.b */ + +#define matrix_mult( a, b, C ) \ + { \ + matrix_inner_product( a, b, 0, 0, C ); \ + matrix_inner_product( a, b, 0, 1, C ); \ + matrix_inner_product( a, b, 0, 2, C ); \ + matrix_inner_product( a, b, 0, 3, C ); \ + matrix_inner_product( a, b, 1, 0, C ); \ + matrix_inner_product( a, b, 1, 1, C ); \ + matrix_inner_product( a, b, 1, 2, C ); \ + matrix_inner_product( a, b, 1, 3, C ); \ + matrix_inner_product( a, b, 2, 0, C ); \ + matrix_inner_product( a, b, 2, 1, C ); \ + matrix_inner_product( a, b, 2, 2, C ); \ + matrix_inner_product( a, b, 2, 3, C ); \ + matrix_inner_product( a, b, 3, 0, C ); \ + matrix_inner_product( a, b, 3, 1, C ); \ + matrix_inner_product( a, b, 3, 2, C ); \ + matrix_inner_product( a, b, 3, 3, C ); \ + } + +static void quaternion_matrix( quaternion *q, double mat[4][4] ) +{ +/* copied from Shoemake/ACM SIGGRAPH 89 */ + double xs, ys, zs, wx, wy, wz, xx, xy, xz, yy, yz, zz ; + + xs = q->x + q->x; + ys = q->y + q->y; + zs = q->z + q->z; + + wx = q->w * xs ; wy = q->w * ys ; wz = q->w * zs ; + xx = q->x * xs ; xy = q->x * ys ; xz = q->x * zs ; + yy = q->y * ys ; yz = q->y * zs ; zz = q->z * zs ; + + mat[0][0] = 1.0 - ( yy + zz ) ; + mat[0][1] = xy - wz ; + mat[0][2] = xz + wy ; + mat[1][0] = xy + wz ; + mat[1][1] = 1.0 - ( xx + zz ) ; + mat[1][2] = yz - wx ; + mat[2][0] = xz - wy ; + mat[2][1] = yz + wx ; + mat[2][2] = 1.0 - ( xx + yy ) ; + + mat[0][3] = 0.0; + mat[1][3] = 0.0; + mat[2][3] = 0.0; + + mat[3][0] = 0.0; + mat[3][1] = 0.0; + mat[3][2] = 0.0; + mat[3][3] = 1.0; +} + + +Matrix::Matrix() +{ + makeIdent(); +} + + +Matrix::Matrix(const Matrix& matrix) : Object() +{ + memcpy(_mat,matrix._mat,sizeof(_mat)); +} + + +Matrix& Matrix::operator = (const Matrix& matrix) +{ + if (&matrix==this) return *this; + memcpy(_mat,matrix._mat,sizeof(_mat)); + return *this; +} + + +Matrix::Matrix( +float a00, float a01, float a02, float a03, +float a10, float a11, float a12, float a13, +float a20, float a21, float a22, float a23, +float a30, float a31, float a32, float a33) +{ + _mat[0][0] = a00; + _mat[0][1] = a01; + _mat[0][2] = a02; + _mat[0][3] = a03; + + _mat[1][0] = a10; + _mat[1][1] = a11; + _mat[1][2] = a12; + _mat[1][3] = a13; + + _mat[2][0] = a20; + _mat[2][1] = a21; + _mat[2][2] = a22; + _mat[2][3] = a23; + + _mat[3][0] = a30; + _mat[3][1] = a31; + _mat[3][2] = a32; + _mat[3][3] = a33; +} + + +Matrix::~Matrix() +{ +} + + +Matrix* Matrix::instance() +{ + static ref_ptr s_matrix(new Matrix()); + return s_matrix.get(); +} + + +bool Matrix::readLocalData(Input& fr) +{ + bool iteratorAdvanced = false; + bool matched = true; + for(int k=0;k<16 && matched;++k) + { + matched = fr[k].isFloat(); + } + if (matched) + { + int k=0; + for(int i=0;i<4;++i) + { + for(int j=0;j<4;++j) + { + fr[k].getFloat(_mat[i][j]); + k++; + } + } + fr += 16; + iteratorAdvanced = true; + } + + return iteratorAdvanced; +} + + +bool Matrix::writeLocalData(Output& fw) +{ + fw.indent() << _mat[0][0] << " " << _mat[0][1] << " " << _mat[0][2] << " " << _mat[0][3] << endl; + fw.indent() << _mat[1][0] << " " << _mat[1][1] << " " << _mat[1][2] << " " << _mat[1][3] << endl; + fw.indent() << _mat[2][0] << " " << _mat[2][1] << " " << _mat[2][2] << " " << _mat[2][3] << endl; + fw.indent() << _mat[3][0] << " " << _mat[3][1] << " " << _mat[3][2] << " " << _mat[3][3] << endl; + return true; +} + + +void Matrix::makeIdent() +{ + _mat[0][0] = 1.0f; + _mat[0][1] = 0.0f; + _mat[0][2] = 0.0f; + _mat[0][3] = 0.0f; + + _mat[1][0] = 0.0f; + _mat[1][1] = 1.0f; + _mat[1][2] = 0.0f; + _mat[1][3] = 0.0f; + + _mat[2][0] = 0.0f; + _mat[2][1] = 0.0f; + _mat[2][2] = 1.0f; + _mat[2][3] = 0.0f; + + _mat[3][0] = 0.0f; + _mat[3][1] = 0.0f; + _mat[3][2] = 0.0f; + _mat[3][3] = 1.0f; +} + +void Matrix::copy(const Matrix& matrix) +{ + memcpy(_mat,matrix._mat,sizeof(_mat)); +} + +void Matrix::makeScale(float sx, float sy, float sz) +{ + makeIdent(); + _mat[0][0] = sx; + _mat[1][1] = sy; + _mat[2][2] = sz; +} + + +void Matrix::preScale( float sx, float sy, float sz, const Matrix& m ) +{ + Matrix transMat; + transMat.makeScale(sx, sy, sz); + mult(transMat,m); +} + +void Matrix::postScale( const Matrix& m, float sx, float sy, float sz ) +{ + Matrix transMat; + transMat.makeScale(sx, sy, sz); + mult(m,transMat); +} + +void Matrix::preScale( float sx, float sy, float sz ) +{ + Matrix transMat; + transMat.makeScale(sx, sy, sz); + preMult(transMat); +} + +void Matrix::postScale( float sx, float sy, float sz ) +{ + Matrix transMat; + transMat.makeScale(sx, sy, sz); + postMult(transMat); +} + + + + +void Matrix::makeTrans( float tx, float ty, float tz ) +{ + makeIdent(); + _mat[3][0] = tx; + _mat[3][1] = ty; + _mat[3][2] = tz; +} + +void Matrix::preTrans( float tx, float ty, float tz, const Matrix& m ) +{ + Matrix transMat; + transMat.makeTrans(tx, ty, tz); + mult(transMat,m); +} + +void Matrix::postTrans( const Matrix& m, float tx, float ty, float tz ) +{ + Matrix transMat; + transMat.makeTrans(tx, ty, tz); + mult(m,transMat); +} + +void Matrix::preTrans( float tx, float ty, float tz ) +{ + _mat[3][0] = (tx * _mat[0][0]) + (ty * _mat[1][0]) + (tz * _mat[2][0]) + _mat[3][0]; + _mat[3][1] = (tx * _mat[0][1]) + (ty * _mat[1][1]) + (tz * _mat[2][1]) + _mat[3][1]; + _mat[3][2] = (tx * _mat[0][2]) + (ty * _mat[1][2]) + (tz * _mat[2][2]) + _mat[3][2]; + _mat[3][3] = (tx * _mat[0][3]) + (ty * _mat[1][3]) + (tz * _mat[2][3]) + _mat[3][3]; +} + +void Matrix::postTrans( float tx, float ty, float tz ) +{ + Matrix transMat; + transMat.makeTrans(tx, ty, tz); + postMult(transMat); +} + +void Matrix::makeRot( float deg, float x, float y, float z ) +{ + double __mat[4][4]; + quaternion q; + float d = sqrtf( square(x) + square(y) + square(z) ); + + if( d == 0 ) + return; + + float sin_HalfAngle = sinf( DEG2RAD(deg/2) ); + float cos_HalfAngle = cosf( DEG2RAD(deg/2) ); + + q.x = sin_HalfAngle * (x/d); + q.y = sin_HalfAngle * (y/d); + q.z = sin_HalfAngle * (z/d); + q.w = cos_HalfAngle; + + quaternion_matrix( &q, __mat ); + + for(int i=0;i<4;++i) + { + for(int j=0;j<4;++j) + { + _mat[i][j]=__mat[i][j]; + } + } +} + +void Matrix::preRot( float deg, float x, float y, float z, const Matrix& m ) +{ + Matrix rotMat; + rotMat.makeRot( deg, x, y, z ); + mult(rotMat,m); +} + +void Matrix::postRot( const Matrix& m, float deg, float x, float y, float z ) +{ + Matrix rotMat; + rotMat.makeRot( deg, x, y, z ); + mult(m,rotMat); +} + +void Matrix::preRot( float deg, float x, float y, float z ) +{ + quaternion q; + double __mat[4][4]; + float res_mat[4][4]; + + float d = sqrtf( square(x) + square(y) + square(z) ); + + if( d == 0 ) + return; + + float sin_HalfAngle = sinf( DEG2RAD(deg/2) ); + float cos_HalfAngle = cosf( DEG2RAD(deg/2) ); + + q.x = sin_HalfAngle * (x/d); + q.y = sin_HalfAngle * (y/d); + q.z = sin_HalfAngle * (z/d); + q.w = cos_HalfAngle; + + quaternion_matrix( &q, __mat ); + matrix_mult( __mat, _mat, res_mat ); + memcpy( _mat, res_mat, sizeof( _mat ) ); +} + +void Matrix::postRot( float deg, float x, float y, float z ) +{ + quaternion q; + double __mat[4][4]; + float res_mat[4][4]; + + float d = sqrtf( square(x) + square(y) + square(z) ); + + if( d == 0 ) + return; + + float sin_HalfAngle = sinf( DEG2RAD(deg/2) ); + float cos_HalfAngle = cosf( DEG2RAD(deg/2) ); + + q.x = sin_HalfAngle * (x/d); + q.y = sin_HalfAngle * (y/d); + q.z = sin_HalfAngle * (z/d); + q.w = cos_HalfAngle; + + quaternion_matrix( &q, __mat ); + matrix_mult( _mat, __mat , res_mat ); + memcpy( _mat, res_mat, sizeof( _mat ) ); +} + +void Matrix::setTrans( float tx, float ty, float tz ) +{ + _mat[3][0] = tx; + _mat[3][1] = ty; + _mat[3][2] = tz; +} +void Matrix::setTrans( const Vec3& v ) +{ + _mat[3][0] = v[0]; + _mat[3][1] = v[1]; + _mat[3][2] = v[2]; +} + +void Matrix::preMult(const Matrix& m) +{ + Matrix tm; + matrix_mult( m._mat, _mat, tm._mat ); + *this = tm; +} + +void Matrix::postMult(const Matrix& m) +{ + Matrix tm; + matrix_mult( _mat, m._mat, tm._mat ); + *this = tm; +} + +void Matrix::mult(const Matrix& lhs,const Matrix& rhs) +{ + matrix_mult( lhs._mat, rhs._mat, _mat ); +} + +Matrix Matrix::operator * (const Matrix& m) const +{ + Matrix nm; + matrix_mult( _mat,m._mat, nm._mat ); + return nm; +} + + +bool Matrix::invert(const Matrix& _m) +{ + // code lifted from VR Juggler. + // not cleanly added, but seems to work. RO. + + const float* a = reinterpret_cast(_m._mat); + float* b = reinterpret_cast(_mat); + + int n = 4; + int i, j, k; + int r[ 4], c[ 4], row[ 4], col[ 4]; + float m[ 4][ 4*2], pivot, max_m, tmp_m, fac; + +/* Initialization */ + for ( i = 0; i < n; i ++ ) + { + r[ i] = c[ i] = 0; + row[ i] = col[ i] = 0; + } + +/* Set working matrix */ + for ( i = 0; i < n; i++ ) + { + for ( j = 0; j < n; j++ ) + { + m[ i][ j] = a[ i * n + j]; + m[ i][ j + n] = ( i == j ) ? 1.0 : 0.0 ; + } + } + +/* Begin of loop */ + for ( k = 0; k < n; k++ ) + { +/* Choosing the pivot */ + for ( i = 0, max_m = 0; i < n; i++ ) + { + if ( row[ i] ) continue; + for ( j = 0; j < n; j++ ) + { + if ( col[ j] ) continue; + tmp_m = fabs( m[ i][j]); + if ( tmp_m > max_m) + { + max_m = tmp_m; + r[ k] = i; + c[ k] = j; + } + } + } + row[ r[k] ] = col[ c[k] ] = 1; + pivot = m[ r[ k] ][ c[ k] ]; + + if ( fabs( pivot) <= 1e-20) + { + notify(WARN) << "*** pivot = %f in mat_inv. ***\n"; +//exit( 0); + return false; + } + +/* Normalization */ + for ( j = 0; j < 2*n; j++ ) + { + if ( j == c[ k] ) + m[ r[ k]][ j] = 1.0; + else + m[ r[ k]][ j] /=pivot; + } + +/* Reduction */ + for ( i = 0; i < n; i++ ) + { + if ( i == r[ k] ) + continue; + + for ( j=0, fac = m[ i][ c[k]];j < 2*n; j++ ) + { + if ( j == c[ k] ) + m[ i][ j] =0.0; + else + m[ i][ j] -=fac * m[ r[k]][ j]; + } + } + } + +/* Assign invers to a matrix */ + for ( i = 0; i < n; i++ ) + for ( j = 0; j < n; j++ ) + row[ i] = ( c[ j] == i ) ? r[j] : row[ i]; + + for ( i = 0; i < n; i++ ) + for ( j = 0; j < n; j++ ) + b[ i * n + j] = m[ row[ i]][j + n]; + + return true; // It worked +} diff --git a/src/osg/Node.cpp b/src/osg/Node.cpp new file mode 100644 index 000000000..d6a069cc1 --- /dev/null +++ b/src/osg/Node.cpp @@ -0,0 +1,168 @@ +#include "osg/Node" +#include "osg/Group" +#include "osg/NodeVisitor" + +#include "osg/Input" +#include "osg/Output" + +#include "osg/Registry" +#include "osg/Notify" + +#include + +using namespace osg; + +RegisterObjectProxy g_NodeProxy; + +Node::Node() +{ + _bsphere_computed = false; + _userData = NULL; + _nodeMask = 0xffffffff; +} + + +Node::~Node() +{ + if (_userData && _memoryAdapter.valid()) _memoryAdapter->decrementReference(_userData); +} + + +void Node::accept(NodeVisitor& nv) +{ + nv.apply(*this); +} + +void Node::ascend(NodeVisitor& nv) +{ + std::for_each(_parents.begin(),_parents.end(),NodeAcceptOp(nv)); +} + +bool Node::readLocalData(Input& fr) +{ + bool iteratorAdvanced = false; + + if (Object::readLocalData(fr)) iteratorAdvanced = true; + + if (fr.matchSequence("name %s")) + { + _name = fr[1].takeStr(); + fr+=2; + iteratorAdvanced = true; + } + +// if (fr.matchSequence("user_data {")) +// { +// notify(DEBUG) << "Matched user_data {"<entry) +// { +// Object* object = fr.readObject(); +// if (object) setUserData(object); +// notify(DEBUG) << "read "<entry) + { + _descriptions.push_back(fr[0].getStr()); + notify(DEBUG) << "read "<<_descriptions.back()<(_userData); +// if (object) +// { +// fw.indent() << "user_data {"<write(fw); +// fw.moveOut(); +// fw.indent() << "}"<dirtyBound(); + } + + } +} diff --git a/src/osg/NodeVisitor.cpp b/src/osg/NodeVisitor.cpp new file mode 100644 index 000000000..664d3de22 --- /dev/null +++ b/src/osg/NodeVisitor.cpp @@ -0,0 +1,40 @@ +#include "osg/NodeVisitor" +#include + +using namespace osg; + +NodeVisitor::NodeVisitor(TraversalMode tm) +{ + _traverseVisitor = NULL; + _traverseMode = tm; +} + +NodeVisitor::~NodeVisitor() +{ + // if (_traverseVisitor) detach from _traverseVisitor; +} + +void NodeVisitor::setTraverseMode(TraversalMode mode) +{ + if (_traverseMode==mode) return; + if (mode==TRAVERSE_VISITOR) + { + if (_traverseVisitor==NULL) _traverseMode = TRAVERSE_NONE; + else _traverseMode = TRAVERSE_VISITOR; + } + else + { + if (_traverseVisitor) _traverseVisitor=NULL; + _traverseMode = mode; + } +} + +void NodeVisitor::setTraverseVisitor(NodeVisitor* nv) +{ + if (_traverseVisitor==nv) return; + // if (_traverseVisitor) detach from _traverseVisitor; + _traverseVisitor = nv; + if (_traverseVisitor) _traverseMode = TRAVERSE_VISITOR; + else _traverseMode = TRAVERSE_NONE; + // attach to _traverseVisitor; +} diff --git a/src/osg/Notify.cpp b/src/osg/Notify.cpp new file mode 100644 index 000000000..d30ddad4e --- /dev/null +++ b/src/osg/Notify.cpp @@ -0,0 +1,87 @@ +#include "osg/Notify" +#include + +using namespace osg; + +int osg::NotifyInit::count_ = 0; +NotifySeverity osg::g_NotifyLevel = osg::NOTICE; +ofstream *osg::g_absorbStreamPtr = NULL; + +void osg::setNotifyLevel(NotifySeverity severity) +{ + g_NotifyLevel = severity; +} + +int osg::getNotifyLevel() +{ + return g_NotifyLevel; +} + +#ifndef WIN32 +ostream& osg::notify(NotifySeverity severity) +{ + if (severity<=g_NotifyLevel || g_absorbStreamPtr==NULL) + { + if (severity<=osg::WARN) return cerr; + else return cout; + } + return *g_absorbStreamPtr; +} +#endif + +NotifyInit::NotifyInit() +{ + if (count_++ == 0) { + + // g_NotifyLevel + // ============= + + g_NotifyLevel = osg::NOTICE; // Default value + + char *OSGNOTIFYLEVEL=getenv("OSGNOTIFYLEVEL"); + if(OSGNOTIFYLEVEL){ + + std::string stringOSGNOTIFYLEVEL(OSGNOTIFYLEVEL); + + // Convert to upper case + for(std::string::iterator i=stringOSGNOTIFYLEVEL.begin(); + i!=stringOSGNOTIFYLEVEL.end(); + ++i) *i=toupper(*i); + + if(stringOSGNOTIFYLEVEL.find("ALWAYS")!=std::string::npos) g_NotifyLevel=osg::ALWAYS; + else if(stringOSGNOTIFYLEVEL.find("FATAL")!=std::string::npos) g_NotifyLevel=osg::FATAL; + else if(stringOSGNOTIFYLEVEL.find("WARN")!=std::string::npos) g_NotifyLevel=osg::WARN; + else if(stringOSGNOTIFYLEVEL.find("NOTICE")!=std::string::npos) g_NotifyLevel=osg::NOTICE; + else if(stringOSGNOTIFYLEVEL.find("INFO")!=std::string::npos) g_NotifyLevel=osg::INFO; + else if(stringOSGNOTIFYLEVEL.find("DEBUG")!=std::string::npos) g_NotifyLevel=osg::DEBUG; + else if(stringOSGNOTIFYLEVEL.find("FP_DEBUG")!=std::string::npos) g_NotifyLevel=osg::FP_DEBUG; + + } + + // g_absorbStreamPtr + // ================= + + char *OSGNOTIFYABSORBFILE=getenv("OSGNOTIFYABSORBFILE"); + if (OSGNOTIFYABSORBFILE) + { + g_absorbStreamPtr=new ofstream(OSGNOTIFYABSORBFILE); + } + else + { +#ifdef WIN32 + // What's the Windows equivalent of /dev/null? + g_absorbStreamPtr=new ofstream("C:/Windows/Tmp/osg.log"); +#else + g_absorbStreamPtr=new ofstream("/dev/null"); +#endif + } + } +} + +NotifyInit::~NotifyInit() +{ + if(--count_ == 0) { + delete g_absorbStreamPtr; + g_absorbStreamPtr=NULL; + } +} diff --git a/src/osg/OSG.cpp b/src/osg/OSG.cpp new file mode 100644 index 000000000..37e398270 --- /dev/null +++ b/src/osg/OSG.cpp @@ -0,0 +1,254 @@ +#ifndef WIN32 +#include +#include +#else +#include +#include +#include +#endif + +#include +#include + +#include "osg/Notify" +#include "osg/OSG" +#include "osg/Node" +#include "osg/Geode" +#include "osg/Group" +#include "osg/Input" +#include "osg/Output" +#include "osg/Registry" + +using namespace osg; + +#ifdef WIN32 +char *PathDelimitor = ";"; +static const char *s_default_file_path = ".;D:/OpenSceneGraph/Data;D:/OpenSceneGraph/Data/Images;D:/OpenSceneGraph/lib"; +//static char *s_filePath = (char *)s_default_file_path; +static char *s_filePath = ".;"; +#else +char *PathDelimitor = ":"; +static const char *s_default_file_path = ".:"; +#ifdef __sgi +static const char *s_default_dso_path = "/usr/lib32/osgPlugins/"; +#else +static const char *s_default_dso_path = "/usr/lib/osgPlugins/"; +#endif +static char *s_filePath = ".:"; +//static char *s_filePath = s_default_file_path; +#endif + + +#include +#include + +using std::vector; +using std::find_if; + +void osg::Init( void ) +{ + char *ptr; + if( (ptr = getenv( "OSGFILEPATH" )) ) + { + notify(DEBUG) << "osg::Init("<entry) + { + bool iteratorAdvanced = false; + if (fr[0].matchWord("UniqueID") && fr[1].isString()) { + fr.regisiterUniqueIDForObject(fr[1].getStr(),obj); + fr += 2; + } + if (obj->readLocalData(fr)) iteratorAdvanced = true; + if (!iteratorAdvanced) ++fr; + } + ++fr; // step over trailing '}' + + return obj; +} + + +bool Object::write(Output& fw) +{ + if (_refCount>1) { + std::string uniqueID; + if (fw.getUniqueIDForObject(this,uniqueID)) { + fw.indent() << "Use " << uniqueID << endl; + return true; + } + } + + fw.indent() << className() << " {"<1) { + std::string uniqueID; + fw.createUniqueIDForObject(this,uniqueID); + fw.registerUniqueIDForObject(this,uniqueID); + fw.indent() << "UniqueID " << uniqueID << endl; + } + + writeLocalData(fw); + + fw.moveOut(); + + fw.indent() << "}"< + +#include "osg/Output" +#include "osg/Object" + +using namespace osg; + +Output::Output() +{ + _init(); +} + + +Output::~Output() +{ + _free(); +} + +void Output::_init() +{ + _indent = 0; + _indentStep = 2; + _numIndicesPerLine = 10; +} + + +void Output::_free() +{ +// should I be calling ofstream's free as well??? +} + + +Output& Output::indent() +{ + for(int i=0;i<_indent;++i) *this<<' '; + return *this; +} + +void Output::moveIn() +{ + _indent += _indentStep; +} + + +void Output::moveOut() +{ + _indent -= _indentStep; + if (_indent<0) _indent=0; +} + +bool Output::getUniqueIDForObject(Object* obj,std::string& uniqueID) +{ + UniqueIDToLabelMapping::iterator fitr = _objectToUniqueIDMap.find(obj); + if (fitr != _objectToUniqueIDMap.end()) + { + uniqueID = (*fitr).second; + return true; + } + else return false; +} + +bool Output::createUniqueIDForObject(Object* obj,std::string& uniqueID) +{ + char str[256]; + sprintf(str,"%s_%i",obj->className(),_objectToUniqueIDMap.size()); + uniqueID = str; + return true; +} + +bool Output::registerUniqueIDForObject(Object* obj,std::string& uniqueID) +{ + _objectToUniqueIDMap[obj] = uniqueID; + return true; +} + diff --git a/src/osg/Point.cpp b/src/osg/Point.cpp new file mode 100644 index 000000000..e95f85104 --- /dev/null +++ b/src/osg/Point.cpp @@ -0,0 +1,178 @@ +// Ideas and code borrowed from GLUT pointburst demo +// written by Mark J. Kilgard + +#ifdef WIN32 +#include +#endif + +#include "osg/GL" +#include "osg/Point" +#include "osg/ExtensionSupported" +#include "osg/Input" +#include "osg/Output" + + +using namespace osg; + +#if defined(GL_SGIS_point_parameters) && !defined(GL_EXT_point_parameters) +/* Use the EXT point parameters interface for the SGIS implementation. */ +# define GL_POINT_SIZE_MIN_EXT GL_POINT_SIZE_MIN_SGIS +# define GL_POINT_SIZE_MAX_EXT GL_POINT_SIZE_MAX_SGIS +# define GL_POINT_FADE_THRESHOLD_SIZE_EXT GL_POINT_FADE_THRESHOLD_SIZE_SGIS +# define GL_DISTANCE_ATTENUATION_EXT GL_DISTANCE_ATTENUATION_SGIS +# define glPointParameterfEXT glPointParameterfSGIS +# define glPointParameterfvEXT glPointParameterfvSGIS +# define GL_EXT_point_parameters 1 +#endif + +#if !defined(GL_EXT_point_parameters) +# define GL_POINT_SIZE_MIN_EXT 0x8126 +# define GL_POINT_SIZE_MAX_EXT 0x8127 +# define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128 +# define GL_DISTANCE_ATTENUATION_EXT 0x8129 +# ifdef _WIN32 + // Curse Microsoft for the insanity of wglGetProcAddress. + typedef void (APIENTRY * PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param); + typedef void (APIENTRY * PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat *params); +# define GL_EXT_point_parameters 1 +# endif +#endif + +#ifdef _WIN32 + PFNGLPOINTPARAMETERFEXTPROC glPointParameterfEXT; + PFNGLPOINTPARAMETERFVEXTPROC glPointParameterfvEXT; +#endif + +static int s_hasPointParameters; + + +Point::Point( void ) +{ + _size = 1.0f; // TODO find proper default + _fadeThresholdSize = 1.0f; // TODO find proper default + _distanceAttenuation = Vec3(0.0f, 1.0f/5.f, 0.0f); // TODO find proper default +} + + +Point::~Point( void ) +{ +} + + +Point* Point::instance() +{ + static ref_ptr s_point(new Point); + return s_point.get(); +} + + +void Point::init_GL_EXT() +{ + s_hasPointParameters = + ExtensionSupported("GL_SGIS_point_parameters") || + ExtensionSupported("GL_EXT_point_parameters"); +#ifdef _WIN32 + if (s_hasPointParameters) + { + glPointParameterfEXT = (PFNGLPOINTPARAMETERFEXTPROC) + wglGetProcAddress("glPointParameterfEXT"); + glPointParameterfvEXT = (PFNGLPOINTPARAMETERFVEXTPROC) + wglGetProcAddress("glPointParameterfvEXT"); + } +#endif +} + + +void Point::enableSmooth( void ) +{ + glEnable( GL_POINT_SMOOTH ); +} + + +void Point::disableSmooth( void ) +{ + glDisable( GL_POINT_SMOOTH ); +} + + +void Point::setSize( float size ) +{ + _size = size; +} + +void Point::setFadeThresholdSize(float fadeThresholdSize) +{ + _fadeThresholdSize = fadeThresholdSize; +} + +void Point::setDistanceAttenuation(const Vec3& distanceAttenuation) +{ + _distanceAttenuation = distanceAttenuation; +} + +void Point::apply( void ) +{ + glPointSize(_size); + +#if GL_EXT_point_parameters + static bool s_gl_ext_init=false; + + if (!s_gl_ext_init) + { + s_gl_ext_init = true; + init_GL_EXT(); + } + + if (s_hasPointParameters) + { + glPointParameterfvEXT(GL_DISTANCE_ATTENUATION_EXT, (const GLfloat*)&_distanceAttenuation); + glPointParameterfEXT(GL_POINT_FADE_THRESHOLD_SIZE_EXT, _fadeThresholdSize); + } +#endif +} + + +bool Point::readLocalData(Input& fr) +{ + bool iteratorAdvanced = false; + + float data; + if (fr[0].matchWord("size") && fr[1].getFloat(data)) + { + + _size = data; + fr+=2; + iteratorAdvanced = true; + } + + if (fr[0].matchWord("fade_threshold_size") && fr[1].getFloat(data)) + { + + _fadeThresholdSize = data; + fr+=2; + iteratorAdvanced = true; + } + + Vec3 distAtten; + if (fr[0].matchWord("distance_attenuation") && + fr[1].getFloat(distAtten[0]) && fr[2].getFloat(distAtten[1]) && fr[3].getFloat(distAtten[2])) + { + + _distanceAttenuation = distAtten; + fr+=4; + iteratorAdvanced = true; + } + + return iteratorAdvanced; +} + + +bool Point::writeLocalData(Output& fw) +{ + fw.indent() << "size " << _size << endl; + fw.indent() << "fade_threshold_size " << _fadeThresholdSize << endl; + fw.indent() << "distance_attenuation " << _distanceAttenuation << endl; + return true; +} + + diff --git a/src/osg/PolygonOffset.cpp b/src/osg/PolygonOffset.cpp new file mode 100644 index 000000000..01a19b0fc --- /dev/null +++ b/src/osg/PolygonOffset.cpp @@ -0,0 +1,85 @@ +#include "osg/GL" +#include "osg/PolygonOffset" +#include "osg/Input" +#include "osg/Output" + +using namespace osg; + + +PolygonOffset::PolygonOffset( void ) +{ + _factor = 0.0f; // are these sensible defaut values? + _units = 0.0f; +} + + +PolygonOffset::~PolygonOffset( void ) +{ +} + + +PolygonOffset* PolygonOffset::instance() +{ + static ref_ptr s_PolygonOffset(new PolygonOffset); + return s_PolygonOffset.get(); +} + +void PolygonOffset::setOffset(float factor,float units) +{ + _factor = factor; + _units = units; +} + +void PolygonOffset::enable( void ) +{ + glEnable( GL_POLYGON_OFFSET_FILL); + glEnable( GL_POLYGON_OFFSET_LINE); + glEnable( GL_POLYGON_OFFSET_POINT); +} + + +void PolygonOffset::disable( void ) +{ + glDisable( GL_POLYGON_OFFSET_FILL); + glDisable( GL_POLYGON_OFFSET_LINE); + glDisable( GL_POLYGON_OFFSET_POINT); +} + +void PolygonOffset::apply( void ) +{ + glPolygonOffset(_factor,_units); +} + +bool PolygonOffset::readLocalData(Input& fr) +{ + bool iteratorAdvanced = false; + + float data; + if (fr[0].matchWord("factor") && fr[1].getFloat(data)) + { + + _factor = data; + fr+=2; + iteratorAdvanced = true; + } + + if (fr[0].matchWord("units") && fr[1].getFloat(data)) + { + + _units = data; + fr+=2; + iteratorAdvanced = true; + } + + return iteratorAdvanced; +} + + +bool PolygonOffset::writeLocalData(Output& fw) +{ + fw.indent() << "factor " << _factor << endl; + fw.indent() << "units " << _units << endl; + return true; +} + + diff --git a/src/osg/Quat.cpp b/src/osg/Quat.cpp new file mode 100644 index 000000000..395f57392 --- /dev/null +++ b/src/osg/Quat.cpp @@ -0,0 +1,272 @@ +#include "osg/Quat" +#include "osg/Vec4" +#include "osg/Vec3" +#include "osg/Types" + +#include + +/// Good introductions to Quaternions at: +/// http://www.gamasutra.com/features/programming/19980703/quaternions_01.htm +/// http://mathworld.wolfram.com/Quaternion.html + +using namespace osg; + +/// Default constructor is empty +Quat::Quat( void ) +{ +} + +/// Constructor with four floats - just call the constructor for the Vec4 +Quat::Quat( const float x, const float y, const float z, const float w ) +{ + _fv = Vec4( x, y, z, w ); +} + +/// Constructor with a Vec4 +Quat::Quat( const Vec4& vec ) +{ + _fv = vec; +} + +/// Set the elements of the Quat to represent a rotation of angle +/// (radians) around the axis (x,y,z) +void Quat::makeRot( const float angle, + const float x, + const float y, + const float z ) +{ + float inversenorm = 1.0/sqrt( x*x + y*y + z*z ); + float coshalfangle = cos( 0.5*angle ); + float sinhalfangle = sin( 0.5*angle ); + + _fv[0] = x * sinhalfangle * inversenorm; + _fv[1] = y * sinhalfangle * inversenorm; + _fv[2] = z * sinhalfangle * inversenorm; + _fv[3] = coshalfangle; +} + +void Quat::makeRot( const float angle, const Vec3& vec ) +{ + makeRot( angle, vec[0], vec[1], vec[2] ); +} + +// Make a rotation Quat which will rotate vec1 to vec2 +// Generally take adot product to get the angle between these +// and then use a cross product to get the rotation axis +// Watch out for the two special cases of when the vectors +// are co-incident or opposite in direction. +void Quat::makeRot( const Vec3& vec1, const Vec3& vec2 ) +{ + const float epsilon = 0.00001f; + + float length1 = vec1.length(); + float length2 = vec2.length(); + float cosangle = vec1*vec2/(2*length1*length2); // dot product vec1*vec2 + + if ( fabs(cosangle - 1) < epsilon ) + { + // cosangle is close to 1, so the vectors are close to being coincident + // Need to generate an angle of zero with any vector we like + // We'll choose (1,0,0) + makeRot( 0.0, 1.0, 0.0, 0.0 ); + } + else + if ( fabs(cosangle + 1) < epsilon ) + { + // cosangle is close to -1, so the vectors are close to being opposite + // The angle of rotation is going to be Pi, but around which axis? + // Basically, any one perpendicular to vec1 = (x,y,z) is going to work. + // Choose a vector to cross product vec1 with. Find the biggest + // in magnitude of x, y and z and then put a zero in that position. + float biggest = fabs(vec1[0]); int bigposn = 0; + if ( fabs(vec1[1]) > biggest ) { biggest=fabs(vec1[1]); bigposn = 1; } + if ( fabs(vec1[2]) > biggest ) { biggest=fabs(vec1[2]); bigposn = 2; } + Vec3 temp = Vec3( 1.0, 1.0, 1.0 ); + temp[bigposn] = 0.0; + Vec3 axis = vec1^temp; // this is a cross-product to generate the + // axis around which to rotate + makeRot( (float)M_PI, axis ); + } + else + { + // This is the usual situation - take a cross-product of vec1 and vec2 + // and that is the axis around which to rotate. + Vec3 axis = vec1^vec2; + float angle = acos( cosangle ); + makeRot( angle, axis ); + } +} + + +// Get the angle of rotation and axis of this Quat object. +// Won't give very meaningful results if the Quat is not associated +// with a rotation! +void Quat::getRot( float& angle, Vec3& vec ) const +{ + float sinhalfangle = sqrt( _fv[0]*_fv[0] + _fv[1]*_fv[1] + _fv[2]*_fv[2] ); + /// float coshalfangle = _fv[3]; + + /// These are not checked for performance reasons ? (cop out!) + /// Point for discussion - how do one handle errors in the osg? + /// if ( abs(sinhalfangle) > 1.0 ) { error }; + /// if ( abs(coshalfangle) > 1.0 ) { error }; + + // *angle = atan2( sinhalfangle, coshalfangle ); // see man atan2 + angle = 2 * atan2( sinhalfangle, _fv[3] ); // -pi < angle < pi + vec = Vec3(_fv[0], _fv[1], _fv[2]) / sinhalfangle; +} + +void Quat::getRot( float& angle, float& x, float& y, float& z ) const +{ + float sinhalfangle = sqrt( _fv[0]*_fv[0] + _fv[1]*_fv[1] + _fv[2]*_fv[2] ); + + angle = 2 * atan2( sinhalfangle, _fv[3] ); + x = _fv[0] / sinhalfangle; + y = _fv[1] / sinhalfangle; + z = _fv[2] / sinhalfangle; +} + + +/// Spherical Linear Interpolation +/// As t goes from 0 to 1, the Quat object goes from "from" to "to" +/// Reference: Shoemake at SIGGRAPH 89 +/// See also +/// http://www.gamasutra.com/features/programming/19980703/quaternions_01.htm +void Quat::slerp( const float t, const Quat& from, const Quat& to ) +{ + const double epsilon = 0.00001; + double omega, cosomega, sinomega, scale_from, scale_to ; + + cosomega = from.asVec4() * to.asVec4() ; // this is a dot product + + if( (1.0 - cosomega) > epsilon ) + { + omega= acos(cosomega) ; // 0 <= omega <= Pi (see man acos) + sinomega = sin(omega) ; // this sinomega should always be +ve so + // could try sinomega=sqrt(1-cosomega*cosomega) to avoid a sin()? + scale_from = sin((1.0-t)*omega)/sinomega ; + scale_to = sin(t*omega)/sinomega ; + } + else + { + /* -------------------------------------------------- + The ends of the vectors are very close + we can use simple linear interpolation - no need + to worry about the "spherical" interpolation + -------------------------------------------------- */ + scale_from = 1.0 - t ; + scale_to = t ; + } + + _fv = (from._fv*scale_from) + (to._fv*scale_to); // use Vec4 arithmetic + // so that we get a Vec4 +} + + + + +#define QX _fv[0] +#define QY _fv[1] +#define QZ _fv[2] +#define QW _fv[3] + +void Quat::set( const Matrix& m ) +{ + // Source: Gamasutra, Rotating Objects Using Quaternions + // + //http://www.gamasutra.com/features/programming/19980703/quaternions_01.htm + + float tr, s; + float tq[4]; + int i, j, k; + + int nxt[3] = {1, 2, 0}; + + tr = m._mat[0][0] + m._mat[1][1] + m._mat[2][2]; + + // check the diagonal + if (tr > 0.0) + { + s = (float)sqrt (tr + 1.0); + QW = s / 2.0f; + s = 0.5f / s; + QX = (m._mat[1][2] - m._mat[2][1]) * s; + QY = (m._mat[2][0] - m._mat[0][2]) * s; + QZ = (m._mat[0][1] - m._mat[1][0]) * s; + } + else + { + // diagonal is negative + i = 0; + if (m._mat[1][1] > m._mat[0][0]) + i = 1; + if (m._mat[2][2] > m._mat[i][i]) + i = 2; + j = nxt[i]; + k = nxt[j]; + + s = (float)sqrt ((m._mat[i][i] - (m._mat[j][j] + m._mat[k][k])) + 1.0); + + tq[i] = s * 0.5f; + + if (s != 0.0f) + s = 0.5f / s; + + tq[3] = (m._mat[j][k] - m._mat[k][j]) * s; + tq[j] = (m._mat[i][j] + m._mat[j][i]) * s; + tq[k] = (m._mat[i][k] + m._mat[k][i]) * s; + + QX = tq[0]; + QY = tq[1]; + QZ = tq[2]; + QW = tq[3]; + } +} + + + +void Quat::get( Matrix& m ) const +{ + // Source: Gamasutra, Rotating Objects Using Quaternions + // + //http://www.gamasutra.com/features/programming/19980703/quaternions_01.htm + + float wx, wy, wz, xx, yy, yz, xy, xz, zz, x2, y2, z2; + + // calculate coefficients + x2 = QX + QX; + y2 = QY + QY; + z2 = QZ + QZ; + + xx = QX * x2; + xy = QX * y2; + xz = QX * z2; + + yy = QY * y2; + yz = QY * z2; + zz = QZ * z2; + + wx = QW * x2; + wy = QW * y2; + wz = QW * z2; + + m._mat[0][0] = 1.0f - (yy + zz); + m._mat[0][1] = xy - wz; + m._mat[0][2] = xz + wy; + m._mat[0][3] = 0.0f; + + m._mat[1][0] = xy + wz; + m._mat[1][1] = 1.0f - (xx + zz); + m._mat[1][2] = yz - wx; + m._mat[1][3] = 0.0f; + + m._mat[2][0] = xz - wy; + m._mat[2][1] = yz + wx; + m._mat[2][2] = 1.0f - (xx + yy); + m._mat[2][3] = 0.0f; + + m._mat[3][0] = 0; + m._mat[3][1] = 0; + m._mat[3][2] = 0; + m._mat[3][3] = 1; +} diff --git a/src/osg/ReaderWriterOSG.cpp b/src/osg/ReaderWriterOSG.cpp new file mode 100644 index 000000000..328230e10 --- /dev/null +++ b/src/osg/ReaderWriterOSG.cpp @@ -0,0 +1,101 @@ +#include "osg/Registry" + +#include "osg/Object" +#include "osg/Image" +#include "osg/Node" +#include "osg/Group" + +#include "osg/Input" +#include "osg/Output" + +#ifdef __sgi +using std::string; +#endif + +using namespace osg; + +class DefaultReaderWriter : public ReaderWriter +{ + public: + virtual const char* className() { return "Default OSG Reader/Writer"; } + virtual bool acceptsExtension(const string& extension) { return extension=="osg" || extension=="OSG"; } + + virtual Object* readObject(const string& fileName) { return readNode(fileName); } + virtual Node* readNode(const string& fileName) + { + ifstream fin(fileName.c_str()); + if (fin) + { + Input fr; + fr.attach(&fin); + + Group* group = new Group; + group->setName("import group"); + +// load all nodes in file, placing them in a group. + while(!fr.eof()) + { + Node *node = fr.readNode(); + if (node) group->addChild(node); + else fr.advanceOverCurrentFieldOrBlock(); + } + + if (group->getNumChildren()>1) + { + return group; + } + else if (group->getNumChildren()==1) + { +// only one node loaded so just return that one node, +// and delete the redundent group. Note, the +// child must be referenced before defrencing +// the group so to avoid delete its children. + Node* node = group->getChild(0); + node->ref(); + group->unref(); + return node; + } // group->getNumChildren()==0 + else + { + return 0L; + } + + } + else + { + return 0L; + } + } + + virtual bool writeObject(Object& obj,const string& fileName) + { + Output fout; + fout.open(fileName.c_str()); + if (fout) + { + obj.write(fout); + fout.close(); + return true; + } + return false; + } + + virtual bool writeNode(Node& node,const string& fileName) + { + Output fout; + fout.open(fileName.c_str()); + if (fout) + { + + node.write(fout); + fout.close(); + return true; + } + return false; + } + +}; + +// now register with Registry to instantiate the above +// reader/writer. +RegisterReaderWriterProxy g_defaultReaderWriterProxy; diff --git a/src/osg/ReaderWriterRGB.cpp b/src/osg/ReaderWriterRGB.cpp new file mode 100644 index 000000000..efdad25b6 --- /dev/null +++ b/src/osg/ReaderWriterRGB.cpp @@ -0,0 +1,380 @@ +#include "osg/Image" +#include "osg/Input" +#include "osg/Output" +#include "osg/Notify" +#include "osg/FileNameUtils" + +#include "osg/Registry" + +#include +#include +#include +#include + +#include "osg/GL" +#include +#include +#include + +#ifndef SEEK_SET +# define SEEK_SET 0 +#endif + +using namespace osg; + +typedef struct _rawImageRec +{ + unsigned short imagic; + unsigned short type; + unsigned short dim; + unsigned short sizeX, sizeY, sizeZ; + unsigned long min, max; + unsigned long wasteBytes; + char name[80]; + unsigned long colorMap; + FILE *file; + unsigned char *tmp, *tmpR, *tmpG, *tmpB, *tmpA; + unsigned long rleEnd; + GLuint *rowStart; + GLint *rowSize; +} rawImageRec; + +static void ConvertShort(unsigned short *array, long length) +{ + unsigned long b1, b2; + unsigned char *ptr; + + ptr = (unsigned char *)array; + while (length--) + { + b1 = *ptr++; + b2 = *ptr++; + *array++ = (unsigned short) ((b1 << 8) | (b2)); + } +} + + +static void ConvertLong(GLuint *array, long length) +{ + unsigned long b1, b2, b3, b4; + unsigned char *ptr; + + ptr = (unsigned char *)array; + while (length--) + { + b1 = *ptr++; + b2 = *ptr++; + b3 = *ptr++; + b4 = *ptr++; + *array++ = (b1 << 24) | (b2 << 16) | (b3 << 8) | (b4); + } +} + + +static rawImageRec *RawImageOpen(const char *fileName) +{ + union + { + int testWord; + char testByte[4]; + } endianTest; + rawImageRec *raw; + GLenum swapFlag; + int x; + + endianTest.testWord = 1; + if (endianTest.testByte[0] == 1) + { + swapFlag = GL_TRUE; + } + else + { + swapFlag = GL_FALSE; + } + + raw = (rawImageRec *)malloc(sizeof(rawImageRec)); + if (raw == NULL) + { + notify(WARN)<< "Out of memory!"<file = fopen(fileName, "rb")) == NULL) + { + perror(fileName); + return NULL; + } + + fread(raw, 1, 12, raw->file); + + if (swapFlag) + { + ConvertShort(&raw->imagic, 6); + } + + raw->tmp = raw->tmpR = raw->tmpG = raw->tmpB = raw->tmpA = 0L; + + raw->tmp = (unsigned char *)malloc(raw->sizeX*256); + if (raw->tmp == NULL ) + { + notify(FATAL)<< "Out of memory!"<sizeZ >= 1 ) + { + if( (raw->tmpR = (unsigned char *)malloc(raw->sizeX)) == NULL ) + { + notify(FATAL)<< "Out of memory!"<tmp ); + return NULL; + } + } + if( raw->sizeZ >= 2 ) + { + if( (raw->tmpG = (unsigned char *)malloc(raw->sizeX)) == NULL ) + { + notify(FATAL)<< "Out of memory!"<tmp ); + free( raw->tmpR ); + return NULL; + } + } + if( raw->sizeZ >= 3 ) + { + if( (raw->tmpB = (unsigned char *)malloc(raw->sizeX)) == NULL ) + { + notify(FATAL)<< "Out of memory!"<tmp ); + free( raw->tmpR ); + free( raw->tmpG ); + return NULL; + } + } + if (raw->sizeZ >= 4) + { + if( (raw->tmpA = (unsigned char *)malloc(raw->sizeX)) == NULL ) + { + notify(FATAL)<< "Out of memory!"<tmp ); + free( raw->tmpR ); + free( raw->tmpG ); + free( raw->tmpB ); + return NULL; + } + } + + if ((raw->type & 0xFF00) == 0x0100) + { + x = raw->sizeY * raw->sizeZ * sizeof(GLuint); + raw->rowStart = (GLuint *)malloc(x); + raw->rowSize = (GLint *)malloc(x); + if (raw->rowStart == NULL || raw->rowSize == NULL) + { + notify(FATAL)<< "Out of memory!"<rleEnd = 512 + (2 * x); + fseek(raw->file, 512, SEEK_SET); + fread(raw->rowStart, 1, x, raw->file); + fread(raw->rowSize, 1, x, raw->file); + if (swapFlag) + { + ConvertLong(raw->rowStart, (long) (x/sizeof(GLuint))); + ConvertLong((GLuint *)raw->rowSize, (long) (x/sizeof(GLint))); + } + } + return raw; +} + + +static void RawImageClose(rawImageRec *raw) +{ + fclose(raw->file); + free(raw->tmp); + if( raw->tmpR ) + free(raw->tmpR); + if( raw->tmpG ) + free(raw->tmpG); + if( raw->tmpB ) + free(raw->tmpB); + if( raw->tmpA ) + free(raw->tmpA); + + free(raw); +} + + +static void RawImageGetRow(rawImageRec *raw, unsigned char *buf, int y, int z) +{ + unsigned char *iPtr, *oPtr, pixel; + int count, done = 0; + + if ((raw->type & 0xFF00) == 0x0100) + { + fseek(raw->file, (long) raw->rowStart[y+z*raw->sizeY], SEEK_SET); + fread(raw->tmp, 1, (unsigned int)raw->rowSize[y+z*raw->sizeY], + raw->file); + + iPtr = raw->tmp; + oPtr = buf; + while (!done) + { + pixel = *iPtr++; + count = (int)(pixel & 0x7F); + if (!count) + { + done = 1; + return; + } + if (pixel & 0x80) + { + while (count--) + { + *oPtr++ = *iPtr++; + } + } + else + { + pixel = *iPtr++; + while (count--) + { + *oPtr++ = pixel; + } + } + } + } + else + { + fseek(raw->file, 512+(y*raw->sizeX)+(z*raw->sizeX*raw->sizeY), + SEEK_SET); + fread(buf, 1, raw->sizeX, raw->file); + } +} + + +static void RawImageGetData(rawImageRec *raw, unsigned char **data ) +{ + unsigned char *ptr; + int i, j; + +// // round the width to a factor 4 +// int width = (int)(floorf((float)raw->sizeX/4.0f)*4.0f); +// if (width!=raw->sizeX) width += 4; + + *data = (unsigned char *)malloc(2 * (raw->sizeX+1)*(raw->sizeY+1)*4); +// *data = (unsigned char *)malloc(2 * (width+1)*(raw->sizeY+1)*4); + + ptr = *data; + for (i = 0; i < (int)(raw->sizeY); i++) + { + if( raw->sizeZ >= 1 ) + RawImageGetRow(raw, raw->tmpR, i, 0); + if( raw->sizeZ >= 2 ) + RawImageGetRow(raw, raw->tmpG, i, 1); + if( raw->sizeZ >= 3 ) + RawImageGetRow(raw, raw->tmpB, i, 2); + if( raw->sizeZ >= 4 ) + RawImageGetRow(raw, raw->tmpA, i, 3); + for (j = 0; j < (int)(raw->sizeX); j++) + { + if( raw->sizeZ >= 1 ) + *ptr++ = *(raw->tmpR + j); + if( raw->sizeZ >= 2 ) + *ptr++ = *(raw->tmpG + j); + if( raw->sizeZ >= 3 ) + *ptr++ = *(raw->tmpB + j); + if( raw->sizeZ >= 4 ) + *ptr++ = *(raw->tmpA + j); + } +// // pad the image width with blanks to bring it up to the rounded width. +// for(;junref(); + return geode; + } + else + { + return NULL; + } + } + + + virtual Image* readImage(const std::string& fileName) + { + std::string ext = getLowerCaseFileExtension(fileName); + if (!acceptsExtension(ext)) return NULL; + + rawImageRec *raw; + + if( (raw = RawImageOpen(fileName.c_str())) == NULL ) + { + notify(FATAL)<< "Unable to open \""<sizeX; + int t = raw->sizeY; + int r = 1; + +#if 0 + int internalFormat = raw->sizeZ == 3 ? GL_RGB5 : + raw->sizeZ == 4 ? GL_RGB5_A1 : GL_RGB; +#else + int internalFormat = raw->sizeZ; +#endif + unsigned int pixelFormat = + raw->sizeZ == 1 ? GL_LUMINANCE : + raw->sizeZ == 2 ? GL_LUMINANCE_ALPHA : + raw->sizeZ == 3 ? GL_RGB : + raw->sizeZ == 4 ? GL_RGBA : (GLenum)-1; + + unsigned int dataType = GL_UNSIGNED_BYTE; + + unsigned char *data; + RawImageGetData(raw, &data); + RawImageClose(raw); + + Image* image = new Image(); + image->setFileName(fileName.c_str()); + image->setImage(s,t,r, + internalFormat, + pixelFormat, + dataType, + data); + + notify(INFO) << "image read ok "< g_readerWriter_RGB_Proxy; diff --git a/src/osg/Registry.cpp b/src/osg/Registry.cpp new file mode 100644 index 000000000..cb0c1a6b6 --- /dev/null +++ b/src/osg/Registry.cpp @@ -0,0 +1,543 @@ +#include "osg/Registry" + +#include "osg/Notify" +#include "osg/Object" +#include "osg/Image" +#include "osg/Node" +#include "osg/Group" + +#include "osg/Input" +#include "osg/Output" +#include "osg/FileNameUtils" + +#include + +#include +#include + +using namespace osg; + +Object* osg::loadObjectFile(const char *name) +{ + return Registry::instance()->readObject(name); +} +Image* osg::loadImageFile(const char *name) +{ + return Registry::instance()->readImage(name); +} + +Node* osg::loadNodeFile(const char *name) +{ + return Registry::instance()->readNode(name); +} + +bool osg::saveObjectFile(Object& object,const char *name) +{ + return Registry::instance()->writeObject(object,name); +} + +bool osg::saveImageFile(Image& image,const char *name) +{ + return Registry::instance()->writeImage(image,name); +} + +bool osg::saveNodeFile(Node& node,const char *name) +{ + return Registry::instance()->writeNode(node,name); +} + +// definition of the Registry +Registry::Registry() +{ + notify(INFO) << "Constructing osg::Registry"<className()<<")"<(obj)) + { + _nodeProtoList.push_back(newPos); + } + if (dynamic_cast(obj)) + { + _imageProtoList.push_back(newPos); + } +} + +void Registry::removePrototype(Object* obj) +{ + if (obj==0L) return; + + notify(INFO) << "osg::Registry::removePrototype()"<className()<<")"<ref(); + _dlList.push_back(dl); + return true; + } + return false; +} + +bool Registry::closeLibrary(const std::string& fileName) +{ + DynamicLibraryList::iterator ditr = getLibraryItr(fileName); + if (ditr!=_dlList.end()) + { + (*ditr)->unref(); + _dlList.erase(ditr); + return true; + } + return false; +} + +Registry::DynamicLibraryList::iterator Registry::getLibraryItr(const std::string& fileName) +{ + DynamicLibraryList::iterator ditr = _dlList.begin(); + for(;ditr!=_dlList.end();++ditr) + { + if ((*ditr)->getName()==fileName) return ditr; + } + return _dlList.end(); +} + +DynamicLibrary* Registry::getLibrary(const std::string& fileName) +{ + DynamicLibraryList::iterator ditr = getLibraryItr(fileName); + if (ditr!=_dlList.end()) return ditr->get(); + else return NULL; +} + + +Object* Registry::readObject(Input& fr) +{ + + if (fr[0].matchWord("Use")) + { + if (fr[1].isString()) { + Object* obj = fr.getObjectForUniqueID(fr[1].getStr()); + if (obj) fr+=2; + return obj; + } + else return NULL; + + } + + for(unsigned int i=0;i<_protoList.size();++i) + { + Object* obj = _protoList[i]->readClone(fr); + if (obj) return obj; + } + return 0L; +} + + +Object* Registry::readObject(const std::string& fileName) +{ + char *file = FindFile( fileName.c_str() ); + if (file==NULL) return NULL; + + // record the existing reader writer. + std::set rwOriginal; + + // first attempt to load the file from existing ReaderWriter's + for(ReaderWriterList::iterator itr=_rwList.begin(); + itr!=_rwList.end(); + ++itr) + { + rwOriginal.insert(itr->get()); + Object* obj = (*itr)->readObject(file); + if (obj) return obj; + } + + // now look for a plug-in to load the file. + std::string libraryName = createLibraryNameForFile(fileName); + if (Registry::instance()->loadLibrary(libraryName)) + { + for(ReaderWriterList::iterator itr=_rwList.begin(); + itr!=_rwList.end(); + ++itr) + { + if (rwOriginal.find(itr->get())==rwOriginal.end()) + { + Object* obj = (*itr)->readObject(file); + if (obj) return obj; + } + } + } + else + { + notify(NOTICE)<<"Warning: Could not find plugin to read file with extension ." + < rwOriginal; + + // first attempt to load the file from existing ReaderWriter's + for(ReaderWriterList::iterator itr=_rwList.begin(); + itr!=_rwList.end(); + ++itr) + { + rwOriginal.insert(itr->get()); + if ((*itr)->writeObject(obj,fileName)) return true; + } + + // now look for a plug-in to save the file. + std::string libraryName = createLibraryNameForFile(fileName); + if (loadLibrary(libraryName)) + { + for(ReaderWriterList::iterator itr=_rwList.begin(); + itr!=_rwList.end(); + ++itr) + { + if (rwOriginal.find(itr->get())==rwOriginal.end()) + { + if ((*itr)->writeObject(obj,fileName)) return true; + } + } + } + else + { + notify(NOTICE)<<"Warning: Could not find plugin to write file with extension ." + <(fr.getObjectForUniqueID(fr[1].getStr())); + if (image) fr+=2; + return image; + } + else return NULL; + + } + + for(std::vector::iterator itr=_imageProtoList.begin(); + itr!=_imageProtoList.end(); + ++itr) + { + int i=*itr; + Object* obj = _protoList[i]->readClone(fr); + if (obj) + { + Image* image = static_cast(obj); + return image; + } + } + return 0L; +} + + +Image* Registry::readImage(const std::string& fileName) +{ + char *file = FindFile( fileName.c_str() ); + if (file==NULL) return NULL; + + // record the existing reader writer. + std::set rwOriginal; + + // first attempt to load the file from existing ReaderWriter's + for(ReaderWriterList::iterator itr=_rwList.begin(); + itr!=_rwList.end(); + ++itr) + { + rwOriginal.insert(itr->get()); + Image* image = (*itr)->readImage(file); + if (image) return image; + } + + // now look for a plug-in to load the file. + std::string libraryName = createLibraryNameForFile(fileName); + if (loadLibrary(libraryName)) + { + for(ReaderWriterList::iterator itr=_rwList.begin(); + itr!=_rwList.end(); + ++itr) + { + if (rwOriginal.find(itr->get())==rwOriginal.end()) + { + Image* image = (*itr)->readImage(file); + if (image) return image; + } + } + } + else + { + notify(NOTICE)<<"Warning: Could not find plugin to read file with extension ." + < rwOriginal; + + // first attempt to load the file from existing ReaderWriter's + for(ReaderWriterList::iterator itr=_rwList.begin(); + itr!=_rwList.end(); + ++itr) + { + rwOriginal.insert(itr->get()); + if ((*itr)->writeImage(image,fileName)) return true; + } + + // now look for a plug-in to save the file. + std::string libraryName = createLibraryNameForFile(fileName); + if (loadLibrary(libraryName)) + { + for(ReaderWriterList::iterator itr=_rwList.begin(); + itr!=_rwList.end(); + ++itr) + { + if (rwOriginal.find(itr->get())==rwOriginal.end()) + { + if ((*itr)->writeImage(image,fileName)) return true; + } + } + } + else + { + notify(NOTICE)<<"Warning: Could not find plugin to write file with extension ." + <(fr.getObjectForUniqueID(fr[1].getStr())); + if (node) fr+=2; + return node; + } + else return NULL; + + } + + std::vector::iterator itr=_nodeProtoList.begin(); + for(;itr!=_nodeProtoList.end();++itr) + { + int i=*itr; + Object* obj = _protoList[i]->readClone(fr); + if (obj) + { + Node* node = static_cast(obj); + return node; + } + } + return 0L; +} + + +Node* Registry::readNode(const std::string& fileName) +{ + + char *file = FindFile( fileName.c_str() ); + if (file==NULL) return NULL; + + // record the existing reader writer. + std::set rwOriginal; + + // first attempt to load the file from existing ReaderWriter's + for(ReaderWriterList::iterator itr=_rwList.begin(); + itr!=_rwList.end(); + ++itr) + { + rwOriginal.insert(itr->get()); + Node* node = (*itr)->readNode(file); + if (node) return node; + } + + // now look for a plug-in to load the file. + std::string libraryName = createLibraryNameForFile(fileName); + notify(INFO) << "Now checking for plug-in "<get())==rwOriginal.end()) + { + Node* node = (*itr)->readNode(file); + if (node) return node; + } + } + } + else + { + notify(NOTICE)<<"Warning: Could not find plugin to read file with extension ." + < rwOriginal; + + // first attempt to load the file from existing ReaderWriter's + for(ReaderWriterList::iterator itr=_rwList.begin(); + itr!=_rwList.end(); + ++itr) + { + rwOriginal.insert(itr->get()); + if ((*itr)->writeNode(node,fileName)) return true; + } + + // now look for a plug-in to save the file. + std::string libraryName = createLibraryNameForFile(fileName); + if (Registry::instance()->loadLibrary(libraryName)) + { + for(ReaderWriterList::iterator itr=_rwList.begin(); + itr!=_rwList.end(); + ++itr) + { + if (rwOriginal.find(itr->get())==rwOriginal.end()) + { + if ((*itr)->writeNode(node,fileName)) return true; + } + } + } + else + { + notify(NOTICE)<<"Warning: Could not find plugin to write file with extension ." + < g_SceneProxy; + +Scene::Scene() +{ + _gstate = NULL; +} + +Scene::~Scene() +{ + if (_gstate) _gstate->unref(); +} + +void Scene::setGState(osg::GeoState* gstate) +{ + if (gstate==_gstate) return; + + if (_gstate) _gstate->unref(); + + _gstate = gstate; + if (_gstate) _gstate->ref(); +} + +bool Scene::readLocalData(Input& fr) +{ + bool iteratorAdvanced = false; + + if (fr[0].matchWord("Use")) + { + if (fr[1].isString()) { + GeoState* geostate = dynamic_cast(fr.getObjectForUniqueID(fr[1].getStr())); + if (geostate) { + fr+=2; + _gstate = geostate; + _gstate->ref(); + iteratorAdvanced = true; + } + } + } + + if (GeoState* readState = static_cast(GeoState::instance()->readClone(fr))) + { + _gstate = readState; + _gstate->ref(); + iteratorAdvanced = true; + } + + if (Group::readLocalData(fr)) iteratorAdvanced = true; + + return iteratorAdvanced; +} + +bool Scene::writeLocalData(Output& fw) +{ + if (_gstate) + { + _gstate->write(fw); + } + + Group::writeLocalData(fw); + + return true; +} diff --git a/src/osg/Seg.cpp b/src/osg/Seg.cpp new file mode 100644 index 000000000..337575580 --- /dev/null +++ b/src/osg/Seg.cpp @@ -0,0 +1,270 @@ +#include "osg/Seg" + +using namespace osg; + +bool Seg::intersectAndClip(Vec3& s,Vec3& e,const BoundingBox& bb) +{ + // compate s and e against the xMin to xMax range of bb. + if (s.x()<=e.x()) + { + + // trivial reject of segment wholely outside. + if (e.x()bb.xMax()) return false; + + if (s.x()bb.xMax()) + { + // clip e to xMax. + e = s+(e-s)*(bb.xMax()-s.x())/(e.x()-s.x()); + } + } + else + { + if (s.x()bb.xMax()) return false; + + if (e.x()bb.xMax()) + { + // clip e to xMax. + s = s+(e-s)*(bb.xMax()-s.x())/(e.x()-s.x()); + } + } + + // compate s and e against the yMin to yMax range of bb. + if (s.y()<=e.y()) + { + + // trivial reject of segment wholely outside. + if (e.y()bb.yMax()) return false; + + if (s.y()bb.yMax()) + { + // clip e to yMax. + e = s+(e-s)*(bb.yMax()-s.y())/(e.y()-s.y()); + } + } + else + { + if (s.y()bb.yMax()) return false; + + if (e.y()bb.yMax()) + { + // clip e to yMax. + s = s+(e-s)*(bb.yMax()-s.y())/(e.y()-s.y()); + } + } + + // compate s and e against the zMin to zMax range of bb. + if (s.z()<=e.z()) + { + + // trivial reject of segment wholely outside. + if (e.z()bb.zMax()) return false; + + if (s.z()bb.zMax()) + { + // clip e to zMax. + e = s+(e-s)*(bb.zMax()-s.z())/(e.z()-s.z()); + } + } + else + { + if (s.z()bb.zMax()) return false; + + if (e.z()bb.zMax()) + { + // clip e to zMax. + s = s+(e-s)*(bb.zMax()-s.z())/(e.z()-s.z()); + } + } + + return true; +} + +bool Seg::intersect(const BoundingBox& bb) const +{ + if (!bb.isValid()) return false; + + Vec3 s=_s,e=_e; + return intersectAndClip(s,e,bb); +} + +bool Seg::intersect(const BoundingBox& bb,float& r1,float& r2) const +{ + if (!bb.isValid()) return false; + + Vec3 s=_s,e=_e; + return intersectAndClip(s,e,bb); +} + +bool Seg::intersect(const BoundingSphere& bs,float& r1,float& r2) const +{ + Vec3 sm = _s-bs._center; + float c = sm.length2()-bs._radius*bs._radius; + + Vec3 se = _e-_s; + float a = se.length2(); + + float b = sm*se*2.0f; + + float d = b*b-4.0f*a*c; + + if (d<0.0f) return false; + + d = sqrtf(d); + + float div = 1.0f/(2.0f*a); + + r1 = (-b-d)*div; + r2 = (-b+d)*div; + + if (r1<=0.0f && r2<=0.0f) return false; + + if (r1>=1.0f && r2>=1.0f) return false; + + return true; +} + +bool Seg::intersect(const BoundingSphere& bs) const +{ + Vec3 sm = _s-bs._center; + float c = sm.length2()-bs._radius*bs._radius; + if (c<0.0f) return true; + + Vec3 se = _e-_s; + float a = se.length2(); + + float b = (sm*se)*2.0f; + + float d = b*b-4.0f*a*c; + + if (d<0.0f) return false; + + d = sqrtf(d); + + float div = 1.0f/(2.0f*a); + + float r1 = (-b-d)*div; + float r2 = (-b+d)*div; + + if (r1<=0.0f && r2<=0.0f) return false; + + if (r1>=1.0f && r2>=1.0f) return false; + + return true; +} + +bool Seg::intersect(const Vec3& v1,const Vec3& v2,const Vec3& v3,float& r) +{ + if (v1==v2 || v2==v3 || v1==v3) return false; + + Vec3 vse = _e-_s; + + Vec3 v12 = v2-v1; + Vec3 n12 = v12^vse; + float ds12 = (_s-v1)*n12; + float d312 = (v3-v1)*n12; + if (d312>=0.0f) + { + if (ds12<0.0f) return false; + if (ds12>d312) return false; + } + else // d312 < 0 + { + if (ds12>0.0f) return false; + if (ds12=0.0f) + { + if (ds23<0.0f) return false; + if (ds23>d123) return false; + } + else // d123 < 0 + { + if (ds23>0.0f) return false; + if (ds23=0.0f) + { + if (ds31<0.0f) return false; + if (ds31>d231) return false; + } + else // d231 < 0 + { + if (ds31>0.0f) return false; + if (ds31length) return false; + + r = d/length; + + return true; +} diff --git a/src/osg/Sequence.cpp b/src/osg/Sequence.cpp new file mode 100644 index 000000000..5e1d48e6b --- /dev/null +++ b/src/osg/Sequence.cpp @@ -0,0 +1,8 @@ +#include "osg/Sequence" +#include "osg/Registry" + +using namespace osg; + +RegisterObjectProxy g_SequenceProxy; + +// to be written :-) diff --git a/src/osg/Switch.cpp b/src/osg/Switch.cpp new file mode 100644 index 000000000..367dc6f43 --- /dev/null +++ b/src/osg/Switch.cpp @@ -0,0 +1,87 @@ +#include "osg/Switch" +#include "osg/Registry" +#include "osg/Input" +#include "osg/Output" + +#include + +using namespace osg; + +RegisterObjectProxy g_SwitchProxy; + +Switch::Switch() +{ + _value = ALL_CHILDREN_OFF; +} + +void Switch::traverse(NodeVisitor& nv) +{ + switch(nv.getTraverseMode()) + { + case(NodeVisitor::TRAVERSE_ALL_CHILDREN): + std::for_each(_children.begin(),_children.end(),NodeAcceptOp(nv)); + break; + case(NodeVisitor::TRAVERSE_ACTIVE_CHILDREN): + switch(_value) + { + case(ALL_CHILDREN_ON): + std::for_each(_children.begin(),_children.end(),NodeAcceptOp(nv)); + break; + case(ALL_CHILDREN_OFF): + return; + default: + if (_value>=0 && (unsigned int)_value<_children.size()) _children[_value]->accept(nv); + break; + } + break; + default: + break; + } +} + +bool Switch::readLocalData(Input& fr) +{ + bool iteratorAdvanced = false; + + if (fr.matchSequence("value")) + { + if (fr[1].matchWord("ALL_CHILDREN_ON")) + { + _value = ALL_CHILDREN_ON; + iteratorAdvanced = true; + fr+=2; + } + else if (fr[1].matchWord("ALL_CHILDREN_ON")) + { + _value = ALL_CHILDREN_OFF; + iteratorAdvanced = true; + fr+=2; + } + else if (fr[1].isInt()) + { + fr[1].getInt(_value); + iteratorAdvanced = true; + fr+=2; + } + } + + if (Group::readLocalData(fr)) iteratorAdvanced = true; + + return iteratorAdvanced; +} + +bool Switch::writeLocalData(Output& fw) +{ + fw.indent() << "value "; + switch(_value) + { + case(ALL_CHILDREN_ON): fw<<"ALL_CHILDREN_ON"< s_TexEnv(new TexEnv); + return s_TexEnv.get(); +} + + +void TexEnv::setMode( TexEnvMode mode ) +{ + _mode = (mode == DECAL || + mode == MODULATE || + mode == BLEND ) ? + mode : MODULATE; +} + +void TexEnv::apply( void ) +{ + glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, _mode); +} + +bool TexEnv::readLocalData(Input& fr) +{ + bool iteratorAdvanced = false; + TexEnvMode mode; + if (fr[0].matchWord("mode") && matchModeStr(fr[1].getStr(),mode)) + { + _mode = mode; + fr+=2; + iteratorAdvanced = true; + } + + return iteratorAdvanced; +} + + +bool TexEnv::matchModeStr(const char* str,TexEnvMode& mode) +{ + if (strcmp(str,"DECAL")==0) mode = DECAL; + else if (strcmp(str,"MODULATE")==0) mode = MODULATE; + else if (strcmp(str,"BLEND")==0) mode = BLEND; + else return false; + return true; +} + + +const char* TexEnv::getModeStr(TexEnvMode mode) +{ + switch(mode) + { + case(DECAL): return "DECAL"; + case(MODULATE): return "MODULATE"; + case(BLEND): return "BLEND"; + } + return ""; +} + + +bool TexEnv::writeLocalData(Output& fw) +{ + fw.indent() << "mode " << getModeStr(_mode) << endl; + + return true; +} diff --git a/src/osg/TexGen.cpp b/src/osg/TexGen.cpp new file mode 100644 index 000000000..921f270d8 --- /dev/null +++ b/src/osg/TexGen.cpp @@ -0,0 +1,89 @@ + +#include "osg/TexGen" +#include "osg/Input" +#include "osg/Output" + +using namespace osg; + +TexGen::TexGen( void ) +{ + _mode = OBJECT_LINEAR; +} + + +TexGen::~TexGen( void ) +{ +} + + +TexGen* TexGen::instance() +{ + static ref_ptr s_texgen(new TexGen); + return s_texgen.get(); +} + + +bool TexGen::readLocalData(Input& fr) +{ + bool iteratorAdvanced = false; + TexGenMode mode; + if (fr[0].matchWord("mode") && matchModeStr(fr[1].getStr(),mode)) + { + _mode = mode; + fr+=2; + iteratorAdvanced = true; + } + + return iteratorAdvanced; +} + + +bool TexGen::matchModeStr(const char* str,TexGenMode& mode) +{ + if (strcmp(str,"EYE_LINEAR")==0) mode = EYE_LINEAR; + else if (strcmp(str,"OBJECT_LINEAR")==0) mode = OBJECT_LINEAR; + else if (strcmp(str,"SPHERE_MAP")==0) mode = SPHERE_MAP; + else return false; + return true; +} + + +const char* TexGen::getModeStr(TexGenMode mode) +{ + switch(mode) + { + case(EYE_LINEAR): return "EYE_LINEAR"; + case(OBJECT_LINEAR): return "OBJECT_LINEAR"; + case(SPHERE_MAP): return "SPHERE_MAP"; + } + return ""; +} + + +bool TexGen::writeLocalData(Output& fw) +{ + fw.indent() << "mode " << getModeStr(_mode) << endl; + + return true; +} + + +void TexGen::enable( void ) +{ + glEnable( GL_TEXTURE_GEN_S ); + glEnable( GL_TEXTURE_GEN_T ); +} + + +void TexGen::disable( void ) +{ + glDisable( GL_TEXTURE_GEN_S ); + glDisable( GL_TEXTURE_GEN_T ); +} + + +void TexGen::apply( void ) +{ + glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, _mode ); + glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, _mode ); +} diff --git a/src/osg/TexMat.cpp b/src/osg/TexMat.cpp new file mode 100644 index 000000000..78f8588c9 --- /dev/null +++ b/src/osg/TexMat.cpp @@ -0,0 +1,25 @@ +#include "osg/GL" +#include "osg/TexMat" + +using namespace osg; + +TexMat::TexMat( void ) +{ +} + + +TexMat::~TexMat( void ) +{ +} + +TexMat* TexMat::instance() +{ + static ref_ptr s_texmat(new TexMat); + return s_texmat.get(); +} + +void TexMat::apply( void ) +{ + glMatrixMode( GL_TEXTURE ); + glLoadMatrixf( (GLfloat *)_mat ); +} diff --git a/src/osg/Texture.cpp b/src/osg/Texture.cpp new file mode 100644 index 000000000..579b9595c --- /dev/null +++ b/src/osg/Texture.cpp @@ -0,0 +1,257 @@ +#include "osg/Texture" +#include "osg/Input" +#include "osg/Output" +#include "osg/Registry" +#include "osg/Image" +#include "osg/Referenced" +#include "osg/Notify" + +using namespace osg; + +Texture::Texture() +{ + _handle = 0; + + _wrap_s = CLAMP; + _wrap_t = CLAMP; + _wrap_r = CLAMP; + _min_filter = NEAREST_MIPMAP_LINEAR; + _mag_filter = LINEAR; +} + + +Texture::~Texture() +{ + if (_handle!=0) glDeleteTextures( 1, &_handle ); +} + + +Texture* Texture::instance() +{ + static ref_ptr s_texture(new Texture); + return s_texture.get(); +} + + +bool Texture::readLocalData(Input& fr) +{ + bool iteratorAdvanced = false; + if (fr[0].matchWord("file") && fr[1].isString()) + { + _image = fr.readImage(fr[1].getStr()); + fr += 2; + iteratorAdvanced = true; + } + WrapMode wrap; + if (fr[0].matchWord("wrap_s") && matchWrapStr(fr[1].getStr(),wrap)) + { + _wrap_s = wrap; + fr+=2; + iteratorAdvanced = true; + } + + if (fr[0].matchWord("wrap_t") && matchWrapStr(fr[1].getStr(),wrap)) + { + _wrap_t = wrap; + fr+=2; + iteratorAdvanced = true; + } + + if (fr[0].matchWord("wrap_r") && matchWrapStr(fr[1].getStr(),wrap)) + { + _wrap_r = wrap; + fr+=2; + iteratorAdvanced = true; + } + + FilterMode filter; + if (fr[0].matchWord("min_filter") && matchFilterStr(fr[1].getStr(),filter)) + { + _min_filter = filter; + fr+=2; + iteratorAdvanced = true; + } + + if (fr[0].matchWord("mag_filter") && matchFilterStr(fr[1].getStr(),filter)) + { + _mag_filter = filter; + fr+=2; + iteratorAdvanced = true; + } + + return iteratorAdvanced; +} + + +bool Texture::writeLocalData(Output& fw) +{ + if (_image.valid()) + { + fw.indent() << "file \""<<_image->getFileName()<<"\""<ensureDimensionsArePowerOfTwo(); + + glPixelStorei(GL_UNPACK_ALIGNMENT,_image->packing()); + + + glGenTextures( 1, &_handle ); + glBindTexture( GL_TEXTURE_2D, _handle ); + + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, _wrap_s ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, _wrap_t ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, _min_filter); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, _mag_filter); + if( _min_filter == LINEAR || _min_filter == NEAREST ) + { + + + glTexImage2D( GL_TEXTURE_2D, 0, _image->internalFormat(), + _image->s(), _image->t(), 0, + (GLenum)_image->pixelFormat(), + (GLenum)_image->dataType(), + _image->data() ); + } + else + { + + gluBuild2DMipmaps( GL_TEXTURE_2D, _image->internalFormat(), + _image->s(),_image->t(), + (GLenum)_image->pixelFormat(), (GLenum)_image->dataType(), + _image->data() ); + } + + glBindTexture( GL_TEXTURE_2D, _handle ); + + } +} diff --git a/src/osg/Timer.cpp b/src/osg/Timer.cpp new file mode 100644 index 000000000..e856e4a5a --- /dev/null +++ b/src/osg/Timer.cpp @@ -0,0 +1,205 @@ +#include +#include +#include +#include +#include + +#include + + +using namespace osg; + +#ifdef WIN32 // [ + +#include +#include + +int Timer::inited = 0; +double Timer::cpu_mhz = 0.0; + +void Timer::init( void ) +{ + Timer_t start_time = tick(); + Sleep (1000); + Timer_t end_time = tick(); + cpu_mhz = (double)(end_time-start_time)*1e-6; + inited = 1; +} + +Timer::Timer( void ) +{ + if( !inited ) init(); +} + +Timer::~Timer( void ) +{ +} + +double Timer::delta_s( Timer_t t1, Timer_t t2 ) +{ + Timer_t delta = t2 - t1; + return (((double)delta/cpu_mhz)*1e-6); +} + +double Timer::delta_m( Timer_t t1, Timer_t t2 ) +{ + Timer_t delta = t2 - t1; + return (((double)delta/cpu_mhz)*1e-3); +} + +Timer_t Timer::delta_u( Timer_t t0, Timer_t t1 ) +{ + return (Timer_t)((double)(t1 - t0)/cpu_mhz); +} + +Timer_t Timer::delta_n( Timer_t t0, Timer_t t1 ) +{ + return (Timer_t)((double)(t1 - t0) * 1e3/cpu_mhz); +} + +#endif // ] + +#ifdef __linux // [ +#include +#include + +int Timer::inited = 0; +double Timer::cpu_mhz = 0.0; + +void Timer::init( void ) +{ + char buff[128]; + FILE *fp = fopen( "/proc/cpuinfo", "r" ); + + while( fgets( buff, sizeof( buff ), fp ) > 0 ) + { + if( !strncmp( buff, "cpu MHz", strlen( "cpu MHz" ))) + { + char *ptr = buff; + + while( ptr && *ptr != ':' ) ptr++; + if( ptr ) + { + ptr++; + sscanf( ptr, "%lf", &cpu_mhz ); + } + break; + } + } + fclose( fp ); + inited = 1; +} + +Timer::Timer( void ) +{ + if( !inited ) init(); +} + +Timer::~Timer( void ) +{ +} + +double Timer::delta_s( Timer_t t1, Timer_t t2 ) +{ + Timer_t delta = t2 - t1; + return ((double)delta/cpu_mhz*1e-6); +} + +double Timer::delta_m( Timer_t t1, Timer_t t2 ) +{ + Timer_t delta = t2 - t1; + return ((double)delta/cpu_mhz*1e-3); +} + +Timer_t Timer::delta_u( Timer_t t0, Timer_t t1 ) +{ + return (Timer_t)((double)(t1 - t0)/cpu_mhz); +} + +Timer_t Timer::delta_n( Timer_t t0, Timer_t t1 ) +{ + return (Timer_t)((double)(t1 - t0) * 1e3/cpu_mhz); +} + +#endif // ] +#ifdef __sgi // [ + + +#include +#include +#include +#include + +unsigned long Timer::dummy = 0; + + +Timer::Timer( void ) +{ + __psunsigned_t phys_addr, raddr; + unsigned int cycleval; + volatile unsigned long counter_value, *iotimer_addr; + int fd, poffmask; + + poffmask = getpagesize() - 1; + phys_addr = syssgi( SGI_QUERY_CYCLECNTR, &cycleval ); + microseconds_per_click = (double)cycleval/1e6; + nanoseconds_per_click = (double)cycleval/1e3; + raddr = phys_addr & ~poffmask; + + clk = &dummy; + + if( (fd = open( "/dev/mmem", O_RDONLY )) < 0 ) + { + perror( "/dev/mmem" ); + return; + } + + + iotimer_addr = (volatile unsigned long *)mmap( + (void *)0L, + (size_t)poffmask, + (int)PROT_READ, + (int)MAP_PRIVATE, fd, (off_t)raddr); + + iotimer_addr = (unsigned long *)( + (__psunsigned_t)iotimer_addr + (phys_addr & poffmask) + ); + + + cycleCntrSize = syssgi( SGI_CYCLECNTR_SIZE ); + + if( cycleCntrSize > 32 ) + ++iotimer_addr; + + clk = (unsigned long *)iotimer_addr; +} + +Timer::~Timer( void ) +{ +} + +double Timer::delta_s( Timer_t t1, Timer_t t2 ) +{ + Timer_t delta = t2 - t1; + return ((double)delta * microseconds_per_click*1e-6); +} + +double Timer::delta_m( Timer_t t1, Timer_t t2 ) +{ + Timer_t delta = t2 - t1; + return ((double)delta * microseconds_per_click*1e-3); +} + +Timer_t Timer::delta_u( Timer_t t1, Timer_t t2 ) +{ + Timer_t delta = t2 - t1; + return (Timer_t)((double)delta * microseconds_per_click); +} + +Timer_t Timer::delta_n( Timer_t t1, Timer_t t2 ) +{ + unsigned long delta = t2 - t1; + return (Timer_t )((double)delta * nanoseconds_per_click); +} + +#endif // ] diff --git a/src/osg/Transparency.cpp b/src/osg/Transparency.cpp new file mode 100644 index 000000000..882474fcf --- /dev/null +++ b/src/osg/Transparency.cpp @@ -0,0 +1,46 @@ +#include "osg/OSG" +#include "osg/Transparency" + +using namespace osg; + +Transparency::Transparency( void ) +{ + _source_factor = SRC_ALPHA; + _destination_factor = ONE_MINUS_SRC_ALPHA; +} + + +Transparency::~Transparency( void ) +{ +} + + +Transparency* Transparency::instance() +{ + static ref_ptr s_transparency(new Transparency); + return s_transparency.get(); +} + +void Transparency::enable( void ) +{ + glEnable( GL_BLEND ); +} + + +void Transparency::disable( void ) +{ + glDisable( GL_BLEND ); +} + + +void Transparency::apply( void ) +{ + glBlendFunc( (GLenum)_source_factor, (GLenum)_destination_factor ); +} + + +void Transparency::setFunction( int source, int destination ) +{ + _source_factor = source; + _destination_factor = destination; +} diff --git a/src/osg/Version.cpp b/src/osg/Version.cpp new file mode 100644 index 000000000..cab061079 --- /dev/null +++ b/src/osg/Version.cpp @@ -0,0 +1,11 @@ +#include "osg/Version" + +const char* osgGetVersion() +{ + return "0.8.34"; +} + +const char* osgGetLibraryName() +{ + return "Open Scene Graph Library"; +} diff --git a/src/osgGLUT/GLUTEventAdapter.cpp b/src/osgGLUT/GLUTEventAdapter.cpp new file mode 100644 index 000000000..d718f5ae4 --- /dev/null +++ b/src/osgGLUT/GLUTEventAdapter.cpp @@ -0,0 +1,144 @@ +#include "osgGLUT/GLUTEventAdapter" +#include "GL/glut.h" + +using namespace osgGLUT; + +// default to no mouse buttons being pressed. +unsigned int GLUTEventAdapter::_s_accumulatedButtonMask = 0; + +int GLUTEventAdapter::_s_Xmin = 0; +int GLUTEventAdapter::_s_Xmax = 1280; +int GLUTEventAdapter::_s_Ymin = 0; +int GLUTEventAdapter::_s_Ymax = 1024; +int GLUTEventAdapter::_s_mx = 0; +int GLUTEventAdapter::_s_my = 0; + +GLUTEventAdapter::GLUTEventAdapter() +{ + _eventType = NONE; // adaptor does not encapsulate any events. + _key = -1; // set to 'invalid' key value. + _button = -1; // set to 'invalid' button value. + _mx = -1; // set to 'invalid' position value. + _my = -1; // set to 'invalid' position value. + _buttonMask = 0; // default to no mouse buttons being pressed. + _time = 0.0f; // default to no time has been set. + + copyStaticVariables(); + +} + +void GLUTEventAdapter::copyStaticVariables() +{ + _buttonMask = _s_accumulatedButtonMask; + _Xmin = _s_Xmin; + _Xmax = _s_Xmax; + _Ymin = _s_Ymin; + _Ymax = _s_Ymax; + _mx = _s_mx; + _my = _s_my; +} + +void GLUTEventAdapter::setWindowSize(int Xmin, int Ymin, int Xmax, int Ymax) +{ + _s_Xmin = Xmin; + _s_Xmax = Xmax; + _s_Ymin = Ymin; + _s_Ymax = Ymax; +} + +void GLUTEventAdapter::setButtonMask(unsigned int buttonMask) +{ + _s_accumulatedButtonMask = buttonMask; +} + + +void GLUTEventAdapter::adaptResize(float time, int Xmin, int Ymin, int Xmax, int Ymax) +{ + setWindowSize(Xmin,Ymin,Xmax,Ymax); + _eventType = RESIZE; + _time = time; + copyStaticVariables(); +} + +/** method for adapting mouse motion events whilst mouse buttons are pressed.*/ +void GLUTEventAdapter::adaptMouseMotion(float time, int x, int y) +{ + _eventType = DRAG; + _time = time; + _s_mx = x; + _s_my = y; + copyStaticVariables(); +} + +/** method for adapting mouse motion events whilst no mouse button are pressed.*/ +void GLUTEventAdapter::adaptMousePassiveMotion(float time, int x, int y) +{ + _eventType = MOVE; + _time = time; + _s_mx = x; + _s_my = y; + copyStaticVariables(); +} + +/** method for adapting mouse button pressed/released events.*/ +void GLUTEventAdapter::adaptMouse(float time, int button, int state, int x, int y) +{ + _time = time; + + + if( state == GLUT_DOWN ) + { + + _eventType = PUSH; + _button = button; + + switch(button) + { + case(GLUT_LEFT_BUTTON): _s_accumulatedButtonMask = _s_accumulatedButtonMask | LEFT_BUTTON; break; + case(GLUT_MIDDLE_BUTTON): _s_accumulatedButtonMask = _s_accumulatedButtonMask | MIDDLE_BUTTON; break; + case(GLUT_RIGHT_BUTTON): _s_accumulatedButtonMask = _s_accumulatedButtonMask | RIGHT_BUTTON; break; + } + + } + else if( state == GLUT_UP ) + { + + _eventType = RELEASE; + _button = button; + + switch(button) + { + case(GLUT_LEFT_BUTTON): _s_accumulatedButtonMask = _s_accumulatedButtonMask & ~LEFT_BUTTON; break; + case(GLUT_MIDDLE_BUTTON): _s_accumulatedButtonMask = _s_accumulatedButtonMask & ~MIDDLE_BUTTON; break; + case(GLUT_RIGHT_BUTTON): _s_accumulatedButtonMask = _s_accumulatedButtonMask & ~RIGHT_BUTTON; break; + } + + } + + _s_mx = x; + _s_my = y; + + copyStaticVariables(); +} + +/** method for adapting keyboard events.*/ +void GLUTEventAdapter::adaptKeyboard(float time, unsigned char key, int x, int y ) +{ + _eventType = KEYBOARD; + _time = time; + _key = key; + _s_mx = x; + _s_my = y; + + copyStaticVariables(); +} + +/** method for adapting frame events, i.e. iddle/display callback.*/ +void GLUTEventAdapter::adaptFrame(float time) +{ + _eventType = FRAME; + _time = time; + + copyStaticVariables(); +} + diff --git a/src/osgGLUT/Makedepend b/src/osgGLUT/Makedepend new file mode 100644 index 000000000..e69de29bb diff --git a/src/osgGLUT/Makefile b/src/osgGLUT/Makefile new file mode 100644 index 000000000..7e2936e7e --- /dev/null +++ b/src/osgGLUT/Makefile @@ -0,0 +1,26 @@ +#!smake +include ../../Make/makedefs + +C++FILES = \ + GLUTEventAdapter.cpp\ + Version.cpp\ + Viewer.cpp\ + +TARGET_BASENAME = osgGLUT + + +LIBS = -ldl + +LIB = ../../lib/lib$(TARGET_BASENAME).so +#LIB = ../../lib/lib$(TARGET_BASENAME).a + +TARGET_LIB_FILES = lib$(TARGET_BASENAME).so +TARGET_INCLUDE_FILES = \ + osgGLUT/Export\ + osgGLUT/Viewer\ + osgGLUT/GLUTEventAdapter\ + +C++FLAGS += -I ../../include + +include ../../Make/makerules + diff --git a/src/osgGLUT/Version.cpp b/src/osgGLUT/Version.cpp new file mode 100755 index 000000000..311dae185 --- /dev/null +++ b/src/osgGLUT/Version.cpp @@ -0,0 +1,12 @@ +#include "osgGLUT/Version" + + +const char* osgGLUTGetVersion() +{ + return "0.8.34"; +} + +const char* osgGLUTGetLibraryName() +{ + return "Open Scene Graph GLUT Library"; +} diff --git a/src/osgGLUT/Viewer.cpp b/src/osgGLUT/Viewer.cpp new file mode 100644 index 000000000..b14d31ef4 --- /dev/null +++ b/src/osgGLUT/Viewer.cpp @@ -0,0 +1,741 @@ +#include +#ifndef WIN32 +#include +#include +#endif +#include +#include + +#include "osgGLUT/Viewer" +#include "osgGLUT/GLUTEventAdapter" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include + + +#ifdef WIN32 +#define USE_FLTK +#define USE_GLUT +#endif + +#include + +#ifdef WIN32 +#include +#else +#endif + +#include +osg::Timer g_timer; +osg::Timer_t g_initTime; + +static GLenum polymodes [] = { GL_FILL, GL_LINE, GL_POINT }; + +using namespace osgGLUT; + +Viewer* Viewer::s_theViewer = 0; + +Viewer::Viewer() +{ + s_theViewer = this; + + + fullscreen = false; + _saved_ww = ww = 1024, + _saved_wh = wh = 768; + + mx = ww/2, + my = wh/2; + mbutton = 0; + + + polymode = 0; + texture = 1; + backface = 1; + lighting = 1; + flat_shade = 0; + + _printStats = false; + + #ifdef SGV_USE_RTFS + fs = new RTfs( RTFS_MODE_RTC_SPIN ); + frame_rate = 16; + fs->setUpdateRate( frame_rate ); + #endif + + _viewFrustumCullingActive = true; + _smallFeatureCullingActive = true; + + _two_sided_lighting=0; + + _useDisplayLists = true; + + _saveFileName = "saved_model.osg"; + + + _sceneView = new osgUtil::SceneView; + _sceneView->setDefaults(); + + registerCameraManipulator(new osgUtil::TrackballManipulator); + registerCameraManipulator(new osgUtil::FlightManipulator); + registerCameraManipulator(new osgUtil::DriveManipulator); + + osg::notify(osg::INFO)<<"Scene Graph Viewer (sgv)"<setViewport(0,0,ww,wh); + + glutInitWindowSize( ww, wh ); + //glutInit( &argc, argv ); // I moved this into main to avoid passing + // argc and argv to the Viewer + glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_MULTISAMPLE); + glutCreateWindow( "OSG Viewer" ); + + glutReshapeFunc( reshapeCB ); + glutVisibilityFunc( visibilityCB ); + glutDisplayFunc( displayCB ); + glutKeyboardFunc( keyboardCB ); + + glutMouseFunc( mouseCB ); + glutMotionFunc( mouseMotionCB ); + glutPassiveMotionFunc( mousePassiveMotionCB ); + + #ifdef USE_FLTK + // required to specify the idle function when using FLTK. + // GLUT and FLTK GLUT differ in that GLUT implicitly calls visibilityFunc + // on window creation, while FLTK calls it when the windows is iconised + // or deiconsied but not on window creation. + visibilityCB(GLUT_VISIBLE); + #endif + + if (_useDisplayLists) + { + // traverse the scene graph setting up all osg::GeoSet's so they will use + // OpenGL display lists. + osgUtil::DisplayListVisitor dlv(osgUtil::DisplayListVisitor::SWITCH_ON_DISPLAY_LISTS); + rootnode->accept(dlv); + } + + _sceneView->setSceneData(rootnode); + + if (saveModel) + { + osg::saveNodeFile(*rootnode, _saveFileName.c_str()); + } + + selectCameraManipulator(0); + + osg::ref_ptr ea = new GLUTEventAdapter; + _cameraManipulator->home(*ea,*this); + + + // std::string name = Registry::instance()->createLibraryNameForExt("osg"); + // Registry::instance()->loadLibrary(name); + // Registry::instance()->closeLibrary(name); + + return true; + +} + +void Viewer::registerCameraManipulator(osgUtil::CameraManipulator* cm) +{ + _cameraManipList.push_back(cm); +} + +void Viewer::selectCameraManipulator(unsigned int pos) +{ + if (pos>=_cameraManipList.size()) return; + + _cameraManipulator = _cameraManipList[pos]; + _cameraManipulator->setCamera(_sceneView->getCamera()); + _cameraManipulator->setNode(_sceneView->getSceneData()); + + + osg::ref_ptr ea = new GLUTEventAdapter; + _cameraManipulator->init(*ea,*this); +} + +void Viewer::needWarpPointer(int x,int y) +{ + glutWarpPointer(x,y); +} + +bool Viewer::update() +{ + osg::ref_ptr ea = new GLUTEventAdapter; + ea->adaptFrame(clockSeconds()); + + if (_cameraManipulator->update(*ea,*this)) + { +// osg::notify(osg::INFO) << "Handled update frame"<cull(); + + float timeTraversal = _timer.delta_m(beforeTraversal,_timer.tick()); + if (_printStats) osg::notify(osg::NOTICE) << "Time of Cull Traversal "<draw(); + + float timeDraw = _timer.delta_m(beforeDraw,_timer.tick()); + if (_printStats) osg::notify(osg::NOTICE) << "Time of Draw "<display(); +} + + +void Viewer::reshapeCB(GLint w, GLint h) +{ + s_theViewer->reshape(w, h); +} + + +void Viewer::visibilityCB( int state ) +{ + s_theViewer->visibility(state); +} + + +void Viewer::mouseCB(int button, int state, int x, int y) +{ + s_theViewer->mouse(button, state, x, y); +} + + +void Viewer::mouseMotionCB(int x, int y) +{ + s_theViewer->mouseMotion(x,y); +} + + +void Viewer::mousePassiveMotionCB(int x, int y) +{ + s_theViewer->mousePassiveMotion(x,y); +} + + +void Viewer::keyboardCB(unsigned char key, int x, int y) +{ + s_theViewer->keyboard(key,x,y); +} + + +void Viewer::display() +{ + // application traverasal. + update(); + + draw(); + + glutSwapBuffers(); + +// cout << "Time elapsed "<<_timer.delta_s(_initialTick,_timer.tick())<frame(); + #endif +} + + +void Viewer::reshape(GLint w, GLint h) +{ + ww = w; + wh = h; + + _sceneView->setViewport(0,0,ww,wh); + + osg::ref_ptr ea = new GLUTEventAdapter; + ea->adaptResize(clockSeconds(),0,0,ww,wh); + + if (_cameraManipulator->update(*ea,*this)) + { +// osg::notify(osg::INFO) << "Handled reshape "< ea = new GLUTEventAdapter; + ea->adaptMouseMotion(clockSeconds(),x,y); + + if (_cameraManipulator->update(*ea,*this)) + { +// osg::notify(osg::INFO) << "Handled mouseMotion "<_buttonMask<<" x="<_mx<<" y="<_my< ea = new GLUTEventAdapter; + ea->adaptMousePassiveMotion(clockSeconds(),x,y); + + if (_cameraManipulator->update(*ea,*this)) + { +// osg::notify(osg::INFO) << "Handled mousePassiveMotion "<_buttonMask<<" x="<_mx<<" y="<_my< ea = new GLUTEventAdapter; + ea->adaptMouse(clockSeconds(),button,state,x,y); + + if (_cameraManipulator->update(*ea,*this)) + { +// osg::notify(osg::INFO) << "Handled mouse "<_buttonMask<<" x="<_mx<<" y="<_my< ea = new GLUTEventAdapter; + ea->adaptKeyboard(clockSeconds(),key,x,y); + + if (_cameraManipulator->update(*ea,*this)) return; + + if (key>='1' && key<='3') + { + int pos = key-'1'; + selectCameraManipulator(pos); + } + + switch( key ) + { + + case '/' : + if (_sceneView->getLODBias()>0.5) _sceneView->setLODBias(_sceneView->getLODBias()/1.5f); + break; + + case '*' : + if (_sceneView->getLODBias()<30) _sceneView->setLODBias(_sceneView->getLODBias()*1.5f); + break; + + case '+' : + #ifdef SGV_USE_RTFS + frame_rate <<= 1; + fs->stop(); + fs->setUpdateRate( frame_rate ); + fs->start(); + #endif + break; + + case '-' : + #ifdef SGV_USE_RTFS + frame_rate >>= 1; + if( frame_rate < 1 ) frame_rate = 1; + fs->stop(); + fs->setUpdateRate( frame_rate ); + fs->start(); + #endif + break; + + case 'd' : + _useDisplayLists = !_useDisplayLists; + if (_useDisplayLists) + { + // traverse the scene graph setting up all osg::GeoSet's so they will use + // OpenGL display lists. + osgUtil::DisplayListVisitor dlv(osgUtil::DisplayListVisitor::SWITCH_ON_DISPLAY_LISTS); + _sceneView->getSceneData()->accept(dlv); + osg::notify(osg::NOTICE) << "Switched on use of OpenGL Display Lists."<getSceneData()->accept(dlv); + osg::notify(osg::NOTICE) << "Switched off use of OpenGL Display Lists."<getGlobalState()->setMode(osg::GeoState::FACE_CULL,osg::GeoState::ON); + else + _sceneView->getGlobalState()->setMode(osg::GeoState::FACE_CULL,osg::GeoState::OVERRIDE_OFF); + + break; + + + case 'l' : + lighting = 1 - lighting ; + if( lighting ) + _sceneView->getGlobalState()->setMode(osg::GeoState::LIGHTING,osg::GeoState::ON); + else + _sceneView->getGlobalState()->setMode(osg::GeoState::LIGHTING,osg::GeoState::OVERRIDE_OFF); + break; + + case 'L' : + { + osgUtil::SceneView::LightingMode lm= _sceneView->getLightingMode(); + switch(lm) + { + case(osgUtil::SceneView::HEADLIGHT) : lm = osgUtil::SceneView::SKY_LIGHT; break; + case(osgUtil::SceneView::SKY_LIGHT) : lm = osgUtil::SceneView::NO_SCENEVIEW_LIGHT; break; + case(osgUtil::SceneView::NO_SCENEVIEW_LIGHT) : lm = osgUtil::SceneView::HEADLIGHT; break; + } + _sceneView->setLightingMode(lm); + break; + } + case 't' : + texture = 1 - texture; + if (texture) + _sceneView->getGlobalState()->setMode(osg::GeoState::TEXTURE,osg::GeoState::INHERIT); + else + _sceneView->getGlobalState()->setMode(osg::GeoState::TEXTURE,osg::GeoState::OVERRIDE_OFF); + break; + + case 'T' : + _two_sided_lighting = 1 - _two_sided_lighting; + break; + + case 'w' : + polymode = (polymode+1)%3; + glPolygonMode( GL_FRONT_AND_BACK, polymodes[polymode] ); + break; + + case 'f' : + fullscreen = !fullscreen; + if (fullscreen) + { + _saved_ww = ww; + _saved_wh = wh; + glutFullScreen(); + } else + { + //glutPositionWindow(wx,wy); + glutReshapeWindow(_saved_ww,_saved_wh); + } + break; + + case 'o' : + if (_sceneView->getSceneData() && osg::Registry::instance()->writeNode(*_sceneView->getSceneData(),_saveFileName)) + { + osg::notify(osg::NOTICE) << "Saved scene to '"<<_saveFileName<<"'"<getRenderVisitor()->setCullingActive(osgUtil::RenderVisitor::SMALL_FEATURE_CULLING,_smallFeatureCullingActive); + break; + + case 'C' : + _viewFrustumCullingActive = !_viewFrustumCullingActive; + _sceneView->getRenderVisitor()->setCullingActive(osgUtil::RenderVisitor::VIEW_FRUSTUM_CULLING,_viewFrustumCullingActive); + if (_viewFrustumCullingActive) + { + osg::notify(osg::NOTICE) << "View frustum culling switched on "<projectWindowXYIntoObject(x,wh-y,near_point,far_point)) + { + osg::notify(osg::NOTICE) << "Failed to calculate intersection ray."< seg = new osg::Seg; + seg->set(near_point,far_point); + osg::notify(osg::NOTICE) << "start("<start()<<") end("<end()<<")"<getSceneData()->accept(iv); + + float endTime = clockSeconds(); + + osg::notify(osg::NOTICE) << "Time for interesection = "<<(endTime-startTime)*1000<<"ms"<_intersectPoint; + osg::Vec3 in = hitr->_intersectNormal; + osg::Geode* geode = hitr->_geode; + osg::notify(osg::NOTICE) << " Itersection Point ("<_matrix) + { + osg::Vec3 ipEye = ip*(*(hitr->_matrix)); + osg::Vec3 inEye = (in+ip)*(*(hitr->_matrix))-ipEye; + inEye.normalize(); + if (geode) osg::notify(osg::NOTICE) << "Geode '"<getName()<_geoset; + osg::notify(osg::NOTICE) << " geoset ("<removeGeoSet(gset)<<")"<start(); + #endif + glutMainLoop(); + return true; +} diff --git a/src/osgPlugins/Makefile b/src/osgPlugins/Makefile new file mode 100644 index 000000000..49ebf7613 --- /dev/null +++ b/src/osgPlugins/Makefile @@ -0,0 +1,32 @@ +#!smake +SHELL=/bin/sh + + +#DIRS = fly flt png +#DIRS = fly flt pic png jpeg tga tiff gif png +DIRS = fly osgtgz tgz zip flt pfb pic png jpeg tga tiff gif png + +all : + for f in $(DIRS) ; do cd $$f; make ; cd ..; done + +clean : + for f in $(DIRS) ; do cd $$f; make clean; cd ..; done + +clobber : + for f in $(DIRS) ; do cd $$f; make clobber; cd ..; done + +depend : + for f in $(DIRS) ; do cd $$f; make depend; cd ..; done + +to_unix : + for f in $(DIRS) ; do cd $$f; to_unix Makefile Makefile; cd ..; done + for f in $(DIRS) ; do cd $$f; make to_unix; cd ..; done + +install : + for f in $(DIRS) ; do cd $$f; make install; cd ..; done + +instlinks : + for f in $(DIRS) ; do cd $$f; make instlinks; cd ..; done + +instclean : + for f in $(DIRS) ; do cd $$f; make instclean; cd ..; done diff --git a/src/osgPlugins/flt/BoundingVolumeRecords.cpp b/src/osgPlugins/flt/BoundingVolumeRecords.cpp new file mode 100644 index 000000000..418b8434a --- /dev/null +++ b/src/osgPlugins/flt/BoundingVolumeRecords.cpp @@ -0,0 +1,136 @@ +// BoundingVolumeRecords.cpp + +#include "flt.h" +#include "Registry.h" +#include "BoundingVolumeRecords.h" + +using namespace flt; + + +//////////////////////////////////////////////////////////////////// +// +// BoundingBoxRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_BoundingBoxProxy; + + +BoundingBoxRecord::BoundingBoxRecord() +{ +} + + +// virtual +BoundingBoxRecord::~BoundingBoxRecord() +{ +} + + +void BoundingBoxRecord::endian() +{ +} + + + +//////////////////////////////////////////////////////////////////// +// +// BoundingSphereRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_BoundingSphereProxy; + + +BoundingSphereRecord::BoundingSphereRecord() +{ +} + + +// virtual +BoundingSphereRecord::~BoundingSphereRecord() +{ +} + + +void BoundingSphereRecord::endian() +{ +} + + + +//////////////////////////////////////////////////////////////////// +// +// BoundingCylinderRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_BoundingCylinderProxy; + + +BoundingCylinderRecord::BoundingCylinderRecord() +{ +} + + +// virtual +BoundingCylinderRecord::~BoundingCylinderRecord() +{ +} + + +void BoundingCylinderRecord::endian() +{ +} + + +//////////////////////////////////////////////////////////////////// +// +// BoundingVolumeCenterRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_BoundingVolumeCenterProxy; + + +BoundingVolumeCenterRecord::BoundingVolumeCenterRecord() +{ +} + + +// virtual +BoundingVolumeCenterRecord::~BoundingVolumeCenterRecord() +{ +} + + +void BoundingVolumeCenterRecord::endian() +{ +} + + +//////////////////////////////////////////////////////////////////// +// +// BoundingVolumeOrientationRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_BoundingVolumeOrientationProxy; + + +BoundingVolumeOrientationRecord::BoundingVolumeOrientationRecord() +{ +} + + +// virtual +BoundingVolumeOrientationRecord::~BoundingVolumeOrientationRecord() +{ +} + + +void BoundingVolumeOrientationRecord::endian() +{ +} + + diff --git a/src/osgPlugins/flt/BoundingVolumeRecords.h b/src/osgPlugins/flt/BoundingVolumeRecords.h new file mode 100644 index 000000000..5ba1af8c8 --- /dev/null +++ b/src/osgPlugins/flt/BoundingVolumeRecords.h @@ -0,0 +1,225 @@ +// BoundingVolumeRecords.h + +#ifndef __FLT_BOUNDING_VOLUME_RECORDS_H +#define __FLT_BOUNDING_VOLUME_RECORDS_H + + +#include "opcodes.h" +#include "Record.h" +#include "RecordVisitor.h" + + +namespace flt { + + +//////////////////////////////////////////////////////////////////// +// +// BoundingBoxRecord +// +//////////////////////////////////////////////////////////////////// + + +typedef struct BoundingBoxTag +{ + SRecHeader RecHeader; +#if 0 +Int 4 Reserved +Double 8 x coordinate of lowest corner +Double 8 y coordinate of lowest corner +Double 8 z coordinate of lowest corner +Double 8 x coordinate of highest corner +Double 8 y coordinate of highest corner +Double 8 z coordinate of highest corner +#endif +} SBoundingBox; + + + +class BoundingBoxRecord : public AncillaryRecord +{ + public: + + BoundingBoxRecord(); + + virtual Record* clone() const { return new BoundingBoxRecord(); } + virtual const char* className() const { return "BoundingBoxRecord"; } + virtual int classOpcode() const { return BOUNDING_BOX_OP; } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + protected: + + virtual ~BoundingBoxRecord(); + + virtual void endian(); +}; + + + +//////////////////////////////////////////////////////////////////// +// +// BoundingSphereRecord +// +//////////////////////////////////////////////////////////////////// + + +typedef struct BoundingSphereTag +{ + SRecHeader RecHeader; +#if 0 +Unsigned Int 2 Length of the record +Int 4 Reserved +Double 8 Radius of the sphere +#endif +} SBoundingSphere; + + + +class BoundingSphereRecord : public AncillaryRecord +{ + public: + + BoundingSphereRecord(); + + virtual Record* clone() const { return new BoundingSphereRecord(); } + virtual const char* className() const { return "BoundingSphereRecord"; } + virtual int classOpcode() const { return BOUNDING_SPHERE_OP; } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + protected: + + virtual ~BoundingSphereRecord(); + + virtual void endian(); +}; + + + +//////////////////////////////////////////////////////////////////// +// +// BoundingCylinderRecord +// +//////////////////////////////////////////////////////////////////// + + +typedef struct BoundingCylinderTag +{ + SRecHeader RecHeader; +#if 0 +Int 4 Reserved +Double 8 Radius of the cylinder base +Double 8 Height of the cylinder +#endif +} SBoundingCylinder; + + + +class BoundingCylinderRecord : public AncillaryRecord +{ + public: + + BoundingCylinderRecord(); + + virtual Record* clone() const { return new BoundingCylinderRecord(); } + virtual const char* className() const { return "BoundingCylinderRecord"; } + virtual int classOpcode() const { return BOUNDING_CYLINDER_OP; } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + protected: + + virtual ~BoundingCylinderRecord(); + + virtual void endian(); +}; + + +//////////////////////////////////////////////////////////////////// +// +// BoundingVolumeCenterRecord +// +//////////////////////////////////////////////////////////////////// + + +typedef struct BoundingVolumeCenterTag +{ + SRecHeader RecHeader; +#if 0 +Int 4 Reserved +Double 8 x coordinate of center +Double 8 y coordinate of center +Double 8 z coordinate of center +#endif +} SBoundingVolumeCenter; + + + +class BoundingVolumeCenterRecord : public AncillaryRecord +{ + public: + + BoundingVolumeCenterRecord(); + + virtual Record* clone() const { return new BoundingVolumeCenterRecord(); } + virtual const char* className() const { return "BoundingVolumeCenterRecord"; } + virtual int classOpcode() const { return BOUNDING_VOLUME_CENTER_OP; } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + protected: + + virtual ~BoundingVolumeCenterRecord(); + + virtual void endian(); +}; + + +//////////////////////////////////////////////////////////////////// +// +// BoundingVolumeOrientationRecord +// +//////////////////////////////////////////////////////////////////// + + +typedef struct BoundingVolumeOrientationTag +{ + SRecHeader RecHeader; +#if 0 +Int 2 Bounding Volume Orientation Opcode 109 +Unsigned Int 2 Length of the record +Int 4 Reserved +Double 8 Yaw angle +Double 8 Pitch angle +Double 8 Roll angle +#endif +} SBoundingVolumeOrientation; + + + +class BoundingVolumeOrientationRecord : public AncillaryRecord +{ + public: + + BoundingVolumeOrientationRecord(); + + virtual Record* clone() const { return new BoundingVolumeOrientationRecord(); } + virtual const char* className() const { return "BoundingVolumeOrientationRecord"; } + virtual int classOpcode() const { return BOUNDING_VOLUME_ORIENTATION_OP; } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + protected: + + virtual ~BoundingVolumeOrientationRecord(); + + virtual void endian(); +}; + + +}; // end namespace flt + +#endif + + + diff --git a/src/osgPlugins/flt/ColorPaletteRecord.cpp b/src/osgPlugins/flt/ColorPaletteRecord.cpp new file mode 100644 index 000000000..533d2dadf --- /dev/null +++ b/src/osgPlugins/flt/ColorPaletteRecord.cpp @@ -0,0 +1,55 @@ +// ColorPaletteRecord.cpp + +#include "flt.h" +#include "Input.h" +#include "Registry.h" +#include "ColorPaletteRecord.h" + +using namespace flt; + + +//////////////////////////////////////////////////////////////////// +// +// MaterialPaletteRecord +// +//////////////////////////////////////////////////////////////////// + + +RegisterRecordProxy g_ColorPaletteRecordProxy; + + +ColorPaletteRecord::ColorPaletteRecord() +{ +} + + +// virtual +ColorPaletteRecord::~ColorPaletteRecord() +{ +} + + +// virtual +void ColorPaletteRecord::endian() +{ + SColorPalette* pSColor = (SColorPalette*)getData(); + int nOffset = sizeof(SColorPalette); + + if (nOffset < getSize()) + { + int n = 0; + ENDIAN( pSColor->nNames ); + + while ((n++ < pSColor->nNames) && (nOffset < getSize())) + { + SColorName* pName = (SColorName*)((char*)getData())+nOffset; + ENDIAN( pName->swSize ); + ENDIAN( pName->nIndex ); + nOffset += pName->swSize; + }; + } +} + + + + diff --git a/src/osgPlugins/flt/ColorPaletteRecord.h b/src/osgPlugins/flt/ColorPaletteRecord.h new file mode 100644 index 000000000..579427d99 --- /dev/null +++ b/src/osgPlugins/flt/ColorPaletteRecord.h @@ -0,0 +1,62 @@ +// ColorPaletteRecord.h + +#ifndef __FLT_COLOR_PALETTE_RECORD_H +#define __FLT_COLOR_PALETTE_RECORD_H + + +#include "opcodes.h" +#include "Record.h" +#include "RecordVisitor.h" + + +namespace flt { + +//////////////////////////////////////////////////////////////////// +// +// ColorPaletteRecord +// +//////////////////////////////////////////////////////////////////// + + +struct SColorName +{ + uint16 swSize; // Length of color name entry + int16 Reserved1; + int16 nIndex; // Color entry index + int16 Reserved2; + char szName[1]; // Color name string (variable length, up to 80 bytes) +}; + + +struct SColorPalette +{ + SRecHeader RecHeader; + char szReserved[128]; // Reserved + color32 Colors[1024]; // Color 0 - 1023 + int32 nNames; +// Followed by SColorName. SColorName is of valiable length! +}; + + +class ColorPaletteRecord : public AncillaryRecord +{ + public: + ColorPaletteRecord(); + + virtual Record* clone() const { return new ColorPaletteRecord(); } + virtual const char* className() const { return "ColorPaletteRecord"; } + virtual int classOpcode() const { return COLOR_PALETTE_OP; } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + SColorPalette* getData() const { return (SColorPalette*)_pData; } + + protected: + virtual ~ColorPaletteRecord(); + + virtual void endian(); +}; + +}; // end namespace flt + +#endif // __FLT_COLOR_PALETTE_RECORD_H diff --git a/src/osgPlugins/flt/CommentRecord.cpp b/src/osgPlugins/flt/CommentRecord.cpp new file mode 100644 index 000000000..f87a23154 --- /dev/null +++ b/src/osgPlugins/flt/CommentRecord.cpp @@ -0,0 +1,37 @@ +// CommentRecord.cpp + +#include "flt.h" +#include "Registry.h" +#include "CommentRecord.h" + + +using namespace flt; + +//////////////////////////////////////////////////////////////////// +// +// CommentRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_CommentRecordProxy; + + +CommentRecord::CommentRecord() +{ +} + + +// virtual +CommentRecord::~CommentRecord() +{ +} + + +// virtual +void CommentRecord::endian() +{ +} + + + + diff --git a/src/osgPlugins/flt/CommentRecord.h b/src/osgPlugins/flt/CommentRecord.h new file mode 100644 index 000000000..07d3b543c --- /dev/null +++ b/src/osgPlugins/flt/CommentRecord.h @@ -0,0 +1,53 @@ +// CommentRecord.h + +#ifndef __FLT_COMMENT_RECORD_H +#define __FLT_COMMENT_RECORD_H + + +#include "opcodes.h" +#include "Record.h" +#include "RecordVisitor.h" + + +namespace flt { + + +//////////////////////////////////////////////////////////////////// +// +// CommentRecord +// +//////////////////////////////////////////////////////////////////// + +typedef struct CommentTag +{ + SRecHeader RecHeader; + // TODO +} SComment; + + + +class CommentRecord : public AncillaryRecord +{ + public: + + CommentRecord(); + + virtual Record* clone() const { return new CommentRecord(); } + virtual const char* className() const { return "CommentRecord"; } + virtual int classOpcode() const { return COMMENT_OP; } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + protected: + + virtual ~CommentRecord(); + + virtual void endian(); + +}; + + +}; // end namespace flt + +#endif + diff --git a/src/osgPlugins/flt/ControlRecord.cpp b/src/osgPlugins/flt/ControlRecord.cpp new file mode 100644 index 000000000..9da7b2e1d --- /dev/null +++ b/src/osgPlugins/flt/ControlRecord.cpp @@ -0,0 +1,21 @@ +// ControlRecord.cpp + + + +#include "Registry.h" +#include "ControlRecord.h" + + +using namespace flt; + + + +RegisterRecordProxy g_PushLevelProxy; +RegisterRecordProxy g_PopLevelProxy; + +RegisterRecordProxy g_PushSubfaceProxy; +RegisterRecordProxy g_PopSubfaceProxy; + +RegisterRecordProxy g_PushExtensionProxy; +RegisterRecordProxy g_PopExtensionProxy; + diff --git a/src/osgPlugins/flt/ControlRecord.h b/src/osgPlugins/flt/ControlRecord.h new file mode 100644 index 000000000..b56146d76 --- /dev/null +++ b/src/osgPlugins/flt/ControlRecord.h @@ -0,0 +1,125 @@ +// ControlRecord.h + +#ifndef __FLT_CONTROL_RECORD_H +#define __FLT_CONTROL_RECORD_H + +#include "opcodes.h" +#include "Record.h" +#include "RecordVisitor.h" + + +namespace flt { + +//////////////////////////////////////////////////////////////////// +// +// PushLevelRecord +// +//////////////////////////////////////////////////////////////////// + + +class PushLevelRecord : public ControlRecord +{ + public: + PushLevelRecord() {} + + virtual Record* clone() const { return new PushLevelRecord(); } + virtual const char* className() const { return "PushLevelRecord"; } + virtual int classOpcode() const { return PUSH_LEVEL_OP; } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + protected: + virtual ~PushLevelRecord() {} + +}; + + +class PopLevelRecord : public ControlRecord +{ + public: + PopLevelRecord() {} + + virtual Record* clone() const { return new PopLevelRecord(); } + virtual const char* className() const { return "PopLevelRecord"; } + virtual int classOpcode() const { return POP_LEVEL_OP; } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + protected: + virtual ~PopLevelRecord() {} + +}; + + +class PushSubfaceRecord : public ControlRecord +{ + public: + PushSubfaceRecord() {} + + virtual Record* clone() const { return new PushSubfaceRecord(); } + virtual const char* className() const { return "PushSubfaceRecord"; } + virtual int classOpcode() const { return PUSH_SUBFACE_OP; } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + protected: + virtual ~PushSubfaceRecord() {} + +}; + + +class PopSubfaceRecord : public ControlRecord +{ + public: + PopSubfaceRecord() {} + + virtual Record* clone() const { return new PopSubfaceRecord(); } + virtual const char* className() const { return "PopSubfaceRecord"; } + virtual int classOpcode() const { return POP_SUBFACE_OP; } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + protected: + virtual ~PopSubfaceRecord() {} + +}; + + +class PushExtensionRecord : public ControlRecord +{ + public: + PushExtensionRecord() {} + + virtual Record* clone() const { return new PushExtensionRecord(); } + virtual const char* className() const { return "PushExtensionRecord"; } + virtual int classOpcode() const { return PUSH_EXTENSION_OP; } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + protected: + virtual ~PushExtensionRecord() {} + +}; + + +class PopExtensionRecord : public ControlRecord +{ + public: + PopExtensionRecord() {} + + virtual Record* clone() const { return new PopExtensionRecord(); } + virtual const char* className() const { return "PopExtensionRecord"; } + virtual int classOpcode() const { return POP_EXTENSION_OP; } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + protected: + virtual ~PopExtensionRecord() {} + +}; + + +}; // end namespace flt + +#endif // __FLT_CONTROL_RECORD_H + diff --git a/src/osgPlugins/flt/DofRecord.cpp b/src/osgPlugins/flt/DofRecord.cpp new file mode 100644 index 000000000..c5c957011 --- /dev/null +++ b/src/osgPlugins/flt/DofRecord.cpp @@ -0,0 +1,52 @@ +// DofRecord.cpp + +#include "flt.h" +#include "Registry.h" +#include "DofRecord.h" + +using namespace flt; + + +//////////////////////////////////////////////////////////////////// +// +// DofRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_DofProxy; + + +DofRecord::DofRecord() +{ +} + + +// virtual +DofRecord::~DofRecord() +{ +} + + +void DofRecord::endian() +{ + SDegreeOfFreedom *pSDof = (SDegreeOfFreedom*)getData(); + + ENDIAN( pSDof->diReserved ); + pSDof->OriginLocalDOF.endian(); + pSDof->PointOnXaxis.endian(); + pSDof->PointInXYplane.endian(); + pSDof->dfZ.endian(); + pSDof->dfY.endian(); + pSDof->dfX.endian(); + pSDof->dfPitch.endian(); + pSDof->dfRoll.endian(); + pSDof->dfYaw.endian(); + pSDof->dfZscale.endian(); + pSDof->dfYscale.endian(); + pSDof->dfXscale.endian(); + ENDIAN( pSDof->dwFlags ); +} + + + + diff --git a/src/osgPlugins/flt/DofRecord.h b/src/osgPlugins/flt/DofRecord.h new file mode 100644 index 000000000..83cda932d --- /dev/null +++ b/src/osgPlugins/flt/DofRecord.h @@ -0,0 +1,87 @@ +// DofRecord.h + + + +#ifndef __FLT_DOF_RECORD_H +#define __FLT_DOF_RECORD_H + + +#include "opcodes.h" +#include "Record.h" +#include "RecordVisitor.h" + + +namespace flt { + +struct SRange +{ + float64 _dfMin; // Minimum value with respect to the local coord system + float64 _dfMax; // Maximum value with respect to the local coordsystem + float64 _dfCurrent; // Current value with respect to the local coord system + float64 _dfIncrement; // Increment + + inline float64 minRange() { return _dfMin; } + inline float64 maxRange() { return _dfMax; } + inline float64 current() { return _dfCurrent; } + inline float64 increment() { return _dfIncrement; } + void endian() { + ENDIAN( _dfMin ); + ENDIAN( _dfMax ); + ENDIAN( _dfCurrent ); + ENDIAN( _dfIncrement ); + } +}; + + +typedef struct DegreeOfFreedomTag +{ + SRecHeader RecHeader; + char szIdent[8]; // 7 char ASCII ID; 0 terminates + int32 diReserved; // Reserved + float64x3 OriginLocalDOF; // Origin (x,y,z) of the DOF's local coordinate system + float64x3 PointOnXaxis; // Point (x,y,z) on the x-axis of the DOF's local coord system + float64x3 PointInXYplane; // Point (x,y,z) in xy plane of the DOF's local coord system + SRange dfZ; // Legal z values with respect to the local coord system + SRange dfY; // Legal y values with respect to the local coord system + SRange dfX; // Legal x values with respect to the local coord system + SRange dfPitch; // Legal pitch values (rotation about the x-axis) + SRange dfRoll; // Legal roll values( rotation about the y-axis) + SRange dfYaw; // Legal yaw values (rotation about the z-axis) + SRange dfZscale; // Legal z scale values (about local origin) + SRange dfYscale; // Legal y scale values about local origin) + SRange dfXscale; // Legal x scale values (about local origin) + uint32 dwFlags; // Flags, bits from left to right (see OF doc) +} SDegreeOfFreedom; + + + +class DofRecord : public PrimNodeRecord +{ + public: + DofRecord(); + + virtual Record* clone() const { return new DofRecord(); } + virtual const char* className() const { return "DofRecord"; } + virtual int classOpcode() const { return DOF_OP; } + virtual int sizeofData() const { return sizeof(SDegreeOfFreedom); } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + SDegreeOfFreedom* getData() const { return (SDegreeOfFreedom*)_pData; } + virtual const std::string getName( void ) const { return std::string(getData()->szIdent); } + + protected: + virtual ~DofRecord(); + + virtual void endian(); + +// virtual bool readLocalData(Input& fr); +// virtual bool writeLocalData(Output& fw); + +}; + + +}; // end namespace flt + +#endif + diff --git a/src/osgPlugins/flt/ExtensionRecord.cpp b/src/osgPlugins/flt/ExtensionRecord.cpp new file mode 100644 index 000000000..dab5ca885 --- /dev/null +++ b/src/osgPlugins/flt/ExtensionRecord.cpp @@ -0,0 +1,39 @@ +// ExtensionRecord.cpp + +#include "flt.h" +#include "Registry.h" +#include "ExtensionRecord.h" + +using namespace flt; + + +//////////////////////////////////////////////////////////////////// +// +// ExtensionRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_ExtensionProxy; + + +ExtensionRecord::ExtensionRecord() +{ +} + + +// virtual +ExtensionRecord::~ExtensionRecord() +{ +} + + +void ExtensionRecord::endian() +{ + SExtension *pExtension = (SExtension*)getData(); + +// VALID_RECORD(SHeader, pRecHdr) + ENDIAN( pExtension->code ); +} + + + diff --git a/src/osgPlugins/flt/ExtensionRecord.h b/src/osgPlugins/flt/ExtensionRecord.h new file mode 100644 index 000000000..985c86fe8 --- /dev/null +++ b/src/osgPlugins/flt/ExtensionRecord.h @@ -0,0 +1,59 @@ +// ExtensionRecord.h + +#ifndef __FLT_EXTENSION_RECORD_H +#define __FLT_EXTENSION_RECORD_H + + +#include "opcodes.h" +#include "Record.h" +#include "RecordVisitor.h" + +namespace flt { +class Input; +}; + + +namespace flt { + + +//////////////////////////////////////////////////////////////////// +// +// ExtensionRecord +// +//////////////////////////////////////////////////////////////////// + +typedef struct ExtensionTag +{ + SRecHeader RecHeader; + + char szIdent[8]; // 7 char ASCII ID; 0 terminates + char site[8]; // Site ID - Unique site name + char reserved; // Reserved + char revision; // Revision - site specific + uint16 code; // Record code - site specific +// char n/a; // Extended data - site specific +}SExtension; + + +class ExtensionRecord : public PrimNodeRecord +{ + public: + ExtensionRecord(); + + virtual Record* clone() const { return new ExtensionRecord(); } + virtual const char* className() const { return "ExtensionRecord"; } + virtual int classOpcode() const { return EXTENSION_OP; } + virtual int sizeofData() const { return sizeof(SExtension); } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + protected: + virtual ~ExtensionRecord(); + + virtual void endian(); +}; + + +}; // end namespace flt + +#endif diff --git a/src/osgPlugins/flt/ExternalRecord.cpp b/src/osgPlugins/flt/ExternalRecord.cpp new file mode 100644 index 000000000..3c1f3e3e2 --- /dev/null +++ b/src/osgPlugins/flt/ExternalRecord.cpp @@ -0,0 +1,52 @@ +// ExternalRecord.cpp + + +#include "flt.h" +#include "Registry.h" +#include "FltFile.h" +#include "ExternalRecord.h" + +using namespace flt; + +//////////////////////////////////////////////////////////////////// +// +// ExternalRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_ExternalProxy; + + +ExternalRecord::ExternalRecord() +{ + _pExternal = NULL; +} + + +// virtual +ExternalRecord::~ExternalRecord() +{ + if (_pExternal) + _pExternal->unref(); +} + + +void ExternalRecord::setExternal(FltFile* pExternal) +{ + if (_pExternal) + _pExternal->unref(); + + _pExternal = pExternal; + _pExternal->ref(); +} + + +void ExternalRecord::endian() +{ + SExternalReference *pSExternal = (SExternalReference*)getData(); + + ENDIAN( pSExternal->diFlags ); +} + + + diff --git a/src/osgPlugins/flt/ExternalRecord.h b/src/osgPlugins/flt/ExternalRecord.h new file mode 100644 index 000000000..172de0fa1 --- /dev/null +++ b/src/osgPlugins/flt/ExternalRecord.h @@ -0,0 +1,63 @@ +// ExternalRecord.h + +#ifndef __FLT_EXTERNAL_RECORD_H +#define __FLT_EXTERNAL_RECORD_H + + +#include "opcodes.h" +#include "Record.h" +#include "RecordVisitor.h" + + +namespace flt { + +struct SExternalReference +{ + SRecHeader RecHeader; + char szPath[200]; // 199 char ASCII Path; 0 terminates + uint8 swReserved[4]; // Reserved + int32 diFlags; // Flags (bits from left to right) + // 0 = Color Palette Override + // 1 = Material Palette Override + // 2 = Texture Palette Override + // 3 = Line Palette Override + // 4 = Sound Palette Override + // 5 = Light source Palette Override + // 6-31 Spare + int16 iReserved; // Reserved +}; + + +class ExternalRecord : public PrimNodeRecord +{ + public: + ExternalRecord(); + + virtual Record* clone() const { return new ExternalRecord(); } + virtual const char* className() const { return "ExternalRecord"; } + virtual int classOpcode() const { return EXTERNAL_REFERENCE_OP; } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + SExternalReference* getData() const { return (SExternalReference*)_pData; } + + void setExternal(FltFile* pExternal); + FltFile* getExternal() { return _pExternal; } + const std::string getFilename( void ) const { return std::string(getData()->szPath); } + + protected: + virtual ~ExternalRecord(); + +// virtual bool readLocalData(Input& fr); +// virtual bool writeLocalData(Output& fw); + + virtual void endian(); + + FltFile* _pExternal; +}; + + +}; // end namespace flt + +#endif + diff --git a/src/osgPlugins/flt/FaceRecord.cpp b/src/osgPlugins/flt/FaceRecord.cpp new file mode 100644 index 000000000..87e341d22 --- /dev/null +++ b/src/osgPlugins/flt/FaceRecord.cpp @@ -0,0 +1,292 @@ +// FaceRecord.cpp + +#include "flt.h" +#include "Registry.h" +#include "FaceRecord.h" +#include "Input.h" + + +using namespace flt; + +//////////////////////////////////////////////////////////////////// +// +// FaceRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_FaceProxy; + + +FaceRecord::FaceRecord() +{ +} + + +// virtual +FaceRecord::~FaceRecord() +{ +} + + +int FaceRecord::numberOfVertices() +{ + for (int n=0; n < getNumChildren(); n++) + { + VertexListRecord* pSVertexList = (VertexListRecord*)getChild(n); + if (pSVertexList && pSVertexList->isOfType(VERTEX_LIST_OP)) + return pSVertexList->numberOfVertices(); + } + + return 0; +} + + +int FaceRecord::getVertexPoolOffset(int index) +{ + for (int n=0; n < getNumChildren(); n++) + { + VertexListRecord* pSVertexList = (VertexListRecord*)getChild(n); + if (pSVertexList && pSVertexList->isOfType(VERTEX_LIST_OP)) + return pSVertexList->getVertexPoolOffset(index); + } + + return 0; +} + + +void FaceRecord::endian() +{ + SFace *pSFace = (SFace*)getData(); + + ENDIAN( pSFace->diIRColor ); + ENDIAN( pSFace->iObjectRelPriority ); + ENDIAN( pSFace->wPrimaryNameIndex ); + ENDIAN( pSFace->wSecondaryNameIndex ); + ENDIAN( pSFace->iDetailTexturePattern ); + ENDIAN( pSFace->iTexturePattern ); + ENDIAN( pSFace->iMaterial ); + ENDIAN( pSFace->iSurfaceMaterial ); + ENDIAN( pSFace->iFeature ); + ENDIAN( pSFace->diIRMaterial ); + ENDIAN( pSFace->wTransparency ); + ENDIAN( pSFace->diFlags ); +// ENDIAN( pSFace->PrimaryPackedColor ); +// ENDIAN( pSFace->SecondaryPackedColor ); + ENDIAN( pSFace->iTextureMapIndex ); + ENDIAN( pSFace->dwPrimaryColorIndex ); + ENDIAN( pSFace->dwAlternateColorIndex ); +} + + + + +// virtual +bool FaceRecord::readLocalData(Input& fr) +{ + if (!PrimNodeRecord::readLocalData(fr)) + return false; + + // + // Check for subfaces + // + + Record* pRec; + + if (!(pRec=fr.readCreateRecord())) return false; + + if (pRec->getOpcode() != PUSH_SUBFACE_OP) + return fr.rewindLast(); + + while ((pRec=fr.readCreateRecord())) + { + if (pRec->getOpcode()==POP_SUBFACE_OP) return true; + + if (pRec->isPrimaryNode()) + { + addChild(pRec); + + if (!((PrimNodeRecord*)pRec)->readLocalData(fr)) + return false; + } + } + + return (pRec != NULL); +} + + + +//////////////////////////////////////////////////////////////////// +// +// VertexListRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_VertexListProxy; + + +VertexListRecord::VertexListRecord() +{ +} + + +// virtual +VertexListRecord::~VertexListRecord() +{ +} + + +int VertexListRecord::numberOfVertices() +{ + return getBodyLength()/4; +} + + +int VertexListRecord::getVertexPoolOffset(int index) +{ + SSingleVertexList *pSVertexList = (SSingleVertexList*)getData(); + + if ((index >= 0) && (index < numberOfVertices())) + return pSVertexList->diSOffset[index]; + + return 0; +} + + +void VertexListRecord::endian() +{ + SSingleVertexList *pSVertexList = (SSingleVertexList*)getData(); + int nNumberOfVertices = numberOfVertices(); + + for(int i=0; i < nNumberOfVertices; i++) + { + ENDIAN( pSVertexList->diSOffset[i] ); + } +} + + + + + +// virtual +bool VertexListRecord::readLocalData(Input& fr) +{ + // A vertex node is a leaf node in the database and + // therefore cannot have any children. + return true; +} + + + +//////////////////////////////////////////////////////////////////// +// +// MorphVertexListRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_MorphVertexListRecordProxy; + + +MorphVertexListRecord::MorphVertexListRecord() +{ +} + + +// virtual +MorphVertexListRecord::~MorphVertexListRecord() +{ +} + + +int MorphVertexListRecord::numberOfVertices() +{ + return getBodyLength()/8; +} + + +void MorphVertexListRecord::endian() +{ +// SMorphVertexList *pSMorpVertexList = (SMorphVertexList*)getData(); +} + + + + + +// virtual +bool MorphVertexListRecord::readLocalData(Input& fr) +{ + // A vertex node is a leaf node in the database and + // therefore cannot have any children. + return true; +} + + +//////////////////////////////////////////////////////////////////// +// +// UnknownListRecord +// +//////////////////////////////////////////////////////////////////// + +//RegisterRecordProxy g_UnknownListProxy; + + +UnknownListRecord::UnknownListRecord() +{ +} + + +// virtual +UnknownListRecord::~UnknownListRecord() +{ +} + + +void UnknownListRecord::endian() +{ +} + + + + + +// virtual +bool UnknownListRecord::readLocalData(Input& fr) +{ + // A vertex node is a leaf node in the database and + // therefore cannot have any children. + return true; +} + + + + + +//////////////////////////////////////////////////////////////////// +// +// VectorRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_VectorProxy; + + +VectorRecord::VectorRecord() +{ +} + + +// virtual +VectorRecord::~VectorRecord() +{ +} + + +void VectorRecord::endian() +{ + SVector *pSVector = (SVector*)getData(); + + pSVector->Vec.endian(); +} + + + diff --git a/src/osgPlugins/flt/FaceRecord.h b/src/osgPlugins/flt/FaceRecord.h new file mode 100644 index 000000000..5be918d91 --- /dev/null +++ b/src/osgPlugins/flt/FaceRecord.h @@ -0,0 +1,288 @@ +// FaceRecord.h + +#ifndef __FLT_FACE_RECORD_H +#define __FLT_FACE_RECORD_H + + +#include "opcodes.h" +#include "Record.h" +#include "RecordVisitor.h" + + +namespace flt { + + + +//////////////////////////////////////////////////////////////////// +// +// FaceRecord +// +//////////////////////////////////////////////////////////////////// + + +struct SFace +{ + SRecHeader RecHeader; + char szIdent[8]; // 7 char ASCII ID; 0 terminates + int32 diIRColor; // IR Color Code + int16 iObjectRelPriority; // Polygon relative priority + uint8 swDrawFlag; // How to draw the polygon + // = 0 Draw solid backfaced + // = 1 Draw solid no backface + // = 2 Draw wireframe and not closed + // = 3 Draw closed wireframe + // = 4 Surround with wireframe in alternate color + // = 8 Omni-directional light + // = 9 Unidirectional light + // = 10 Bidirectional light + uint8 swTexWhite; // if TRUE, draw textured polygon white (see note 1 below) + uint16 wPrimaryNameIndex; // Color name index + uint16 wSecondaryNameIndex; // Alternate color name index + uint8 swNotUsed; // Not used + uint8 swTemplateTrans; // Set template transparency + // = 0 None + // = 1 Fixed + // = 2 Axis type rotate + // = 4 Point rotate + int16 iDetailTexturePattern; // Detail texture pattern no. -1 if none + int16 iTexturePattern; // Texture pattern no. -1 if none + int16 iMaterial; // Material code [0-63]. -1 if none + int16 iSurfaceMaterial; // Surface material code (for DFAD) + int16 iFeature; // Feature ID (for DFAD) + int32 diIRMaterial; // IR Material codes + uint16 wTransparency; // Transparency + // = 0 opaque + // = 65535 for totally clear + uint8 swInfluenceLODGen; // LOD Generation Control + uint8 swLinestyle; // Linestyle Index + int32 diFlags; // Flags (bits from to right) + // 0 = Terrain + // 1 = No Color + // 2 = No Alt Color + // 3 = Packed color + // 4 = Terrain culture cutout (footprint) + // 5 = Hidden (not drawn) + // 6-31 Spare + uint8 swLightMode; // Lightmode + // = 0 use face color, not illuminated + // = 1 use vertex color, not illuminated + // = 2 use face color and vertex normal + // = 3 use vertex color and vertex normal + + uint8 swReserved1[7]; // Reserved + color32 PrimaryPackedColor; // Packed Color Primary (A, B, G, R) + color32 SecondaryPackedColor; // Packed Color Secondary (A, B, G, R) + int16 iTextureMapIndex; // Texture mapping index + int16 iReserved2; + uint32 dwPrimaryColorIndex; + uint32 dwAlternateColorIndex; + int16 iReserved3[2]; +}; + + +class FaceRecord : public PrimNodeRecord +{ + public: + + enum DrawFlag { + SOLID_BACKFACED = 0, + SOLID_NO_BACKFACE = 1, + WIREFRAME_NOT_CLOSED = 2, + WIREFRAME_CLOSED = 3, + SURROUND_ALTERNATE_COLOR = 4, + OMNIDIRECTIONAL_LIGHT = 8, + UNIDIRECTIONAL_LIGHT = 9, + BIDIRECTIONAL_LIGHT = 10 + }; + + enum LightMode { + FACE_COLOR = 0, + VERTEX_COLOR = 1, + FACE_COLOR_LIGHTING = 2, + VERTEX_COLOR_LIGHTING = 3, + }; + + FaceRecord(); + + virtual Record* clone() const { return new FaceRecord(); } + virtual const char* className() const { return "FaceRecord"; } + virtual int classOpcode() const { return FACE_OP; } + virtual int sizeofData() const { return sizeof(SFace); } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + virtual SFace* getData() const { return (SFace*)_pData; } + virtual const std::string getName( void ) const { return std::string(getData()->szIdent); } + + int numberOfVertices(); + int getVertexPoolOffset(int index); + + protected: + + virtual ~FaceRecord(); + + virtual void endian(); + + virtual bool readLocalData(Input& fr); +// virtual bool writeLocalData(Output& fw); +}; + + + +//////////////////////////////////////////////////////////////////// +// +// VertexListRecord +// +//////////////////////////////////////////////////////////////////// + +typedef struct SingleVertexListTag +{ + SRecHeader RecHeader; + int32 diSOffset[1]; // Byte offset to this vertex record in vertex table, + // the actual vertex of the face +} SSingleVertexList; + + + +class VertexListRecord : public PrimNodeRecord +{ + public: + VertexListRecord(); + + virtual Record* clone() const { return new VertexListRecord(); } + virtual const char* className() const { return "VertexListRecord"; } + virtual int classOpcode() const { return VERTEX_LIST_OP; } + virtual int sizeofData() const { return sizeof(SSingleVertexList); } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + virtual SSingleVertexList* getData() const { return (SSingleVertexList*)_pData; } + + int numberOfVertices(); + int getVertexPoolOffset(int index); + + protected: + virtual ~VertexListRecord(); + + virtual bool readLocalData(Input& fr); +// virtual bool writeLocalData(Output& fw); + + virtual void endian(); +}; + + +//////////////////////////////////////////////////////////////////// +// +// MorphVertexListRecord +// +//////////////////////////////////////////////////////////////////// + +typedef struct MorphVertexListTag +{ + SRecHeader RecHeader; + uint32 dwOffset0; // Byte offset into vertex palette of the 0% vertex + uint32 dwOffset100; // Byte offset into vertex palette of the 100% vertex +} SMorphVertexList; + + + +class MorphVertexListRecord : public PrimNodeRecord +{ + public: + MorphVertexListRecord(); + + virtual Record* clone() const { return new MorphVertexListRecord(); } + virtual const char* className() const { return "MorphVertexListRecord"; } + virtual int classOpcode() const { return MORPH_VERTEX_LIST_OP; } + virtual int sizeofData() const { return sizeof(SMorphVertexList); } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + virtual SMorphVertexList* getData() const { return (SMorphVertexList*)_pData; } + + int numberOfVertices(); + + protected: + virtual ~MorphVertexListRecord(); + + virtual bool readLocalData(Input& fr); +// virtual bool writeLocalData(Output& fw); + + virtual void endian(); +}; + + + +//////////////////////////////////////////////////////////////////// +// +// UnknownListRecord +// +//////////////////////////////////////////////////////////////////// + + + +class UnknownListRecord : public PrimNodeRecord +{ + public: + UnknownListRecord(); + + virtual Record* clone() const { return new UnknownListRecord(); } + virtual const char* className() const { return "UnknownListRecord"; } + virtual int classOpcode() const { return 53; } +// virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + protected: + virtual ~UnknownListRecord(); + + virtual bool readLocalData(Input& fr); +// virtual bool writeLocalData(Output& fw); + + virtual void endian(); +}; + + + +//////////////////////////////////////////////////////////////////// +// +// VectorRecord +// +//////////////////////////////////////////////////////////////////// + +// A vector record is an ancillary record of the (pre V15.4) face node. +// Its only use is to provide the direction vector for old-style +// unidirectional and bidirectional light point faces. + +typedef struct VectorTag +{ + SRecHeader RecHeader; + float32x3 Vec; +} SVector; + + + +class VectorRecord : public AncillaryRecord +{ + public: + VectorRecord(); + + virtual Record* clone() const { return new VectorRecord(); } + virtual const char* className() const { return "VectorRecord"; } + virtual int classOpcode() const { return VECTOR_OP; } + virtual int sizeofData() const { return sizeof(SVector); } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + virtual SVector* getData() const { return (SVector*)_pData; } + + protected: + virtual ~VectorRecord(); + + virtual void endian(); +}; + + + +}; // end namespace flt + +#endif diff --git a/src/osgPlugins/flt/FltFile.cpp b/src/osgPlugins/flt/FltFile.cpp new file mode 100644 index 000000000..043eb908c --- /dev/null +++ b/src/osgPlugins/flt/FltFile.cpp @@ -0,0 +1,166 @@ +// FltFile.cpp + +#include +#include +#include +#include + +#include "FltFile.h" +#include "Record.h" +#include "RecordVisitor.h" +#include "ExternalRecord.h" +#include "flt2osg.h" // ConvertFromFLT +#include "Input.h" + +using namespace flt; + + +FltFile::FltFile( + ColorPool* pColorPool, + TexturePool* pTexturePool, + MaterialPool* pMaterialPool) + +{ + if (pColorPool) + _pColorPool = pColorPool; + else + _pColorPool = &_colorPool; + + if (pTexturePool) + _pTexturePool = pTexturePool; + else + _pTexturePool = &_texturePool; + + if (pMaterialPool) + _pMaterialPool = pMaterialPool; + else + _pMaterialPool = &_materialPool; + + _pHeaderRecord = NULL; +} + + +FltFile::~FltFile() +{ +} + + +osg::Object* FltFile::readObject(const std::string& fileName) +{ + return readNode(fileName); +} + + +osg::Node* FltFile::readNode(const std::string& fileName) +{ + osg::Node* node = NULL; + Record* pRootRec = readModel(fileName); + + if (pRootRec == NULL) + return NULL; + + // Convert record tree to osg scene graph + node = convert(); + + pRootRec->unref(); // delete record tree + + return node; +} + + +osg::Node* FltFile::convert() +{ + ConvertFromFLT visit(this); + return visit.convert(getHeaderRecord()); +} + + +// Read flight model (include externals) +Record* FltFile::readModel(const std::string& fileName) +{ + Record* pRec = readFile(fileName); + if (pRec == NULL) return NULL; + + readExternals(pRec); + return pRec; +} + + +Record* FltFile::readFile(const std::string& fileName) +{ + FileInput fin; + + if (!fin.open(fileName)) return NULL; + + osg::notify(osg::INFO) << "Loading " << fileName << " ... " << endl; + + Record* pRec = fin.readCreateRecord(); + _pHeaderRecord = pRec; + if (pRec == NULL) + { + osg::notify(osg::WARN) << "File not found " << fileName << endl; + return NULL; + } + + if (pRec->isPrimaryNode()) // Header + pRec->readLocalData(fin); // Read rest of file + + fin.close(); + + + return pRec; +} + + +class ReadExternal : public RecordVisitor +{ +public: + ReadExternal(FltFile* fltFile) + { + _fltFile = fltFile; + setTraverseMode(RecordVisitor::TRAVERSE_ALL_CHILDREN); + } + + virtual void apply(ExternalRecord& rec) + { + SExternalReference* pSExternal = (SExternalReference*)rec.getData(); + + osg::notify(osg::INFO) << "External=" << pSExternal->szPath << endl; + + ColorPool* pColorPool = NULL; + TexturePool* pTexturePool = NULL; + MaterialPool* pMaterialPool = NULL; + + if (pSExternal->diFlags & BIT0) + pColorPool = _fltFile->getColorPool(); + + if (pSExternal->diFlags & BIT2) + pTexturePool = _fltFile->getTexturePool(); + + if (pSExternal->diFlags & BIT1) + pMaterialPool = _fltFile->getMaterialPool(); + + FltFile* flt = new FltFile(pColorPool, pTexturePool, pMaterialPool); + if (flt) + { + flt->readModel(pSExternal->szPath); + rec.setExternal(flt); + } + } + +public: + FltFile* _fltFile; +}; + +void FltFile::readExternals(Record* pRec) +{ + + if (pRec) + { + ReadExternal visitor(this); + pRec->accept(visitor); + } +} + + + diff --git a/src/osgPlugins/flt/FltFile.h b/src/osgPlugins/flt/FltFile.h new file mode 100644 index 000000000..3b8b354db --- /dev/null +++ b/src/osgPlugins/flt/FltFile.h @@ -0,0 +1,60 @@ +// FltFile.h + +#ifndef __FLT_FILE_H +#define __FLT_FILE_H + + +#include +#include + +#include + +#include "Pool.h" + +namespace flt { + +class Record; + + +class FltFile : public osg::Referenced +{ + +public: + FltFile( + ColorPool* pColorPool = NULL, + TexturePool* pTexturePool = NULL, + MaterialPool* pMaterialPool = NULL); + virtual ~FltFile(); + + virtual osg::Object* readObject(const std::string& fileName); + virtual osg::Node* readNode(const std::string& fileName); + osg::Node* convert(); + Record* getHeaderRecord() { return _pHeaderRecord; } + Record* readModel(const std::string& fileName); + + ColorPool* getColorPool() { return _pColorPool; } + TexturePool* getTexturePool() { return _pTexturePool; } + MaterialPool* getMaterialPool() { return _pMaterialPool; } + +protected: + + Record* readFile(const std::string& fileName); + void readExternals(Record* pRec); + +private: + + Record* _pHeaderRecord; + + ColorPool _colorPool; + TexturePool _texturePool; + MaterialPool _materialPool; + + ColorPool* _pColorPool; + TexturePool* _pTexturePool; + MaterialPool* _pMaterialPool; +}; + + +}; // end namespace flt + +#endif diff --git a/src/osgPlugins/flt/FltRecords.h b/src/osgPlugins/flt/FltRecords.h new file mode 100644 index 000000000..f2663aec2 --- /dev/null +++ b/src/osgPlugins/flt/FltRecords.h @@ -0,0 +1,95 @@ +// FltRecords.h + + +#ifndef __FLT_RECORDS_H +#define __FLT_RECORDS_H + +#include "flt.h" + +namespace flt { + +/////////////////////////////////////////////////////////////// + + + + +typedef struct MorphingVertexListTag +{ + SRecHeader RecHeader; + int32 diAOffset; // Byte offset to the actual vertex record in the vertex table. + int32 diMOffset; // Byte offset to the morph vertex record in the vertex table. +} SMorphingVertexList; // see OF doc + + + + +typedef struct ReplicateTag +{ + SRecHeader RecHeader; + int16 iNumber; // Number of replications + int16 iSpare; // Spare for fullword alignment +} SReplicate; + +/* +typedef struct ReferenceTag // OBSOLETE +{ + SRecHeader RecHeader; + int16 iSpare; // Spare + int16 iNumber; // Instance definition number +} SReference; + + +typedef struct DefinitionTag // OBSOLETE +{ + SRecHeader RecHeader; + int16 iSpare; // Spare + int16 iNumber; // Instance definition number +} SDefinition; +*/ + + + + +/* +typedef struct ColorTableTag +{ + SRecHeader RecHeader; + char szReserved[128];// Reserved + color32 Colors[1024]; // Array of brightest RGB of color 0 - 1024 +} SColorTable; + +// this record is sometimes immediately followed by a: int32 numberOfColorNames +// and then the specified number of ColorNames as described in the structure below +// to check if such a list exist: compare RecHeaderBuff.wLength with sizeof(SColorTable) + +typedef struct ColorNameListTag +{ + uint16 wEntryLength; + int16 iReserved_1; + int16 iEntryIndex; + int16 iReserved_2; + char *szName; // calc length of string from wEntryLength +} SColorNameList; +*/ + +/* +typedef struct ComponentTag +{ + float32 sfRed; // red component of material + float32 sfGreen; // green component of material + float32 sfBlue; // blue component of material +} SComponent; +*/ + + + + + + + + + +}; // end namespace flt + +#endif // __FLT_RECORDS_H + diff --git a/src/osgPlugins/flt/GeoSetBuilder.cpp b/src/osgPlugins/flt/GeoSetBuilder.cpp new file mode 100644 index 000000000..86304d73e --- /dev/null +++ b/src/osgPlugins/flt/GeoSetBuilder.cpp @@ -0,0 +1,574 @@ +// GeoSetBuilder.cpp + +#include "flt.h" +#include "FltFile.h" +#include "Pool.h" +#include "opcodes.h" +#include "VertexPoolRecords.h" +#include "OldVertexRecords.h" +#include "MaterialPaletteRecord.h" +#include "GeoSetBuilder.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +using namespace flt; + + +//////////////////////////////////////////////////////////////////// +// +// GeoSetBuilder +// +//////////////////////////////////////////////////////////////////// + +// OpenFlight don't save data in GeoSets. This class tries to find +// existing GeoSets with matching state before creating a new GeoSet. + +GeoSetBuilder::GeoSetBuilder(FltFile* pFltFile) +{ + _pFltFile = pFltFile; + initPrimData(); +} + + +// virtual +GeoSetBuilder::~GeoSetBuilder() +{ + for(GeoSetList::iterator itr=_aGeoSet.begin(); + itr!=_aGeoSet.end(); + ++itr) + { + delete *itr; + } +} + + +void GeoSetBuilder::initPrimData() +{ + _appearance.init(); + _aVertex.erase(_aVertex.begin(), _aVertex.end()); +} + + +// Convert flt::TmpGeoSet's to osg::GeoSet's and add to osg::Geode. +// If geode parameter is NULL create new. +// If geode created inside this function and no osg::GeoSet's +// added free geode. +osg::Geode* GeoSetBuilder::createOsgGeoSets(osg::Geode* geode) +{ + bool bInternalGeodeAllocation = false; + + if (geode == NULL) + { + geode = new osg::Geode; + bInternalGeodeAllocation = true; + } + + for(GeoSetList::iterator itr=_aGeoSet.begin(); + itr!=_aGeoSet.end(); + ++itr) + { + osg::GeoSet* gset = (*itr)->createOsgGeoSet(); + if (gset) + geode->addGeoSet(gset); + } + + if (bInternalGeodeAllocation && (geode->getNumGeosets() == 0)) + { + geode->unref(); + return NULL; + } + + return geode; +} + + +void GeoSetBuilder::addVertex(Record* vertex) +{ + _aVertex.push_back(vertex); + _appearance.setVertexOp(vertex->getOpcode()); +} + + +bool GeoSetBuilder::addPrimitive() +{ + int nVertices = _aVertex.size(); + + if (nVertices == 0) return false; + + if (_appearance.getPrimType() == osg::GeoSet::NO_TYPE) + _appearance.setPrimType(findPrimType(nVertices)); + + TmpGeoSet* gset = findMatchingGeoSet(); + if (gset) + { + addTo(gset); + if (_appearance.getMaterial()) + { + _appearance.getMaterial()->unref(); + _appearance.setMaterial(NULL); + } + } + else + addToNew(); + + initPrimData(); + + return true; +} + + +//////////////////////// protected ///////////////////////////////// + + +TmpGeoSet* GeoSetBuilder::findMatchingGeoSet() +{ + + for(std::vector::iterator itr=_aGeoSet.begin(); + itr!=_aGeoSet.end(); + ++itr) + { + if (_appearance == (*itr)->_appearance) + return *itr; + } + + return NULL; +} + + +void GeoSetBuilder::addTo(TmpGeoSet* gset) +{ + int nVertices = _aVertex.size(); + gset->addPrimLen(nVertices); + + for(std::vector::iterator itr=_aVertex.begin(); + itr!=_aVertex.end(); + ++itr) + { + gset->addVertex(*itr); + } +} + + +void GeoSetBuilder::addToNew() +{ + TmpGeoSet* gset = new TmpGeoSet(_pFltFile); + if (gset == NULL) return; + + // Transfer data to TmpGeoSet + gset->_appearance = _appearance; + addTo(gset); + + _aGeoSet.push_back(gset); +} + + +PrimitiveType GeoSetBuilder::findPrimType( int nVertices) +{ + PrimitiveType primtype = osg::GeoSet::NO_TYPE; + + switch (nVertices) + { + case 1: + primtype = osg::GeoSet::POINTS; + break; + case 2: + primtype = osg::GeoSet::LINES; + break; + case 3: + primtype = osg::GeoSet::TRIANGLES; + break; + case 4: + primtype = osg::GeoSet::QUADS; + break; + default: + if (nVertices >= 5) primtype = osg::GeoSet::POLYGON; + break; + } + + return primtype; +} + + +//////////////////////////////////////////////////////////////////// +// +// TmpGeoSet +// +//////////////////////////////////////////////////////////////////// + +// GeoSet with dynamic size. Used by GeoSetBuilder as a temp. buffer. + + +TmpGeoSet::TmpGeoSet(FltFile* pFltFile) +{ + _pFltFile = pFltFile; +} + + +TmpGeoSet::~TmpGeoSet() +{ +} + + +void TmpGeoSet::addVertex(Record* vertex) +{ + _appearance.setVertexOp(vertex->getOpcode()); + _aVertex.push_back(vertex); +} + + +void TmpGeoSet::addPrimLen(int len) +{ + _aPrimLen.push_back(len); +} + + +osg::GeoSet* TmpGeoSet::createOsgGeoSet() +{ + int prims = _aPrimLen.size(); + int indices = _aVertex.size(); + + if (prims==0 || indices==0) + return NULL; + + osg::GeoSet* gset = new osg::GeoSet; + + gset->setNumPrims(prims); + gset->setPrimType(_appearance.getPrimType()); + + osg::GeoState* gstate = new osg::GeoState; + gset->setGeoState(gstate); + + // Material + osg::Material* osgMaterial = _appearance.getMaterial(); + if (osgMaterial) + { + gstate->setAttribute(osg::GeoState::MATERIAL, osgMaterial); + } + + // Color BIND_OVERALL + if (_appearance.getColorBinding() == osg::GeoSet::BIND_OVERALL) + { + osg::Vec4* color = new osg::Vec4[1]; + *color = _appearance.getColor(); + gset->setColorBinding(_appearance.getColorBinding()); + gset->setColors(color); + } + + // Color BIND_PERVERTEX + if (_appearance.getColorBinding() == osg::GeoSet::BIND_PERVERTEX) + { + gset->setColorBinding(_appearance.getColorBinding()); + gset->setColors(new osg::Vec4[indices]); + } + + // Transparency + if (_appearance.getTransparency()) + { + gstate->setMode(osg::GeoState::TRANSPARENCY, osg::GeoState::ON); + gstate->setAttribute(osg::GeoState::TRANSPARENCY, new osg::Transparency); + } + + // Cull face + if (_appearance.getCullface()) + { + osg::CullFace* cullface = new osg::CullFace; + if (cullface) + { + gstate->setMode(osg::GeoState::FACE_CULL, osg::GeoState::ON); + cullface->setMode(osg::CullFace::BACK); + gstate->setAttribute(osg::GeoState::FACE_CULL, cullface); + } + } + else + { + gstate->setMode(osg::GeoState::FACE_CULL, osg::GeoState::OFF); + } + + // Texture + if (_appearance.getTexture()) + { + gstate->setMode( osg::GeoState::TEXTURE, osg::GeoState::ON ); + gstate->setAttribute( osg::GeoState::TEXTURE, _appearance.getTexture() ); + gstate->setAttribute( osg::GeoState::TEXENV, new osg::TexEnv ); + } + + // Lighting + if (_appearance.getLighting()) + gstate->setMode( osg::GeoState::LIGHTING, osg::GeoState::ON ); + else + gstate->setMode( osg::GeoState::LIGHTING, osg::GeoState::OFF ); + + // Subface + if (_appearance.getSubface() > 0) + { + osg::PolygonOffset* polyoffset = new osg::PolygonOffset; + if (polyoffset) + { + int level = _appearance.getSubface(); + gstate->setMode(osg::GeoState::POLYGON_OFFSET,osg::GeoState::ON); + polyoffset->setOffset(-1*level, -20*level); + gstate->setAttribute(osg::GeoState::POLYGON_OFFSET, polyoffset); + } + } + + // Point + if (_appearance.getPrimType() == osg::GeoSet::POINTS) + { + osg::Point* point = new osg::Point; + if (point) + { + gstate->setMode(osg::GeoState::POINT,osg::GeoState::ON); + point->setSize(8); + point->enableSmooth(); + gstate->setAttribute(osg::GeoState::POINT, point); + } + } + + // PrimLengths + + int nPrimLenSize = 1; + if (_appearance.getPrimType() == osg::GeoSet::POLYGON) + nPrimLenSize = prims; + int *lens = new int[nPrimLenSize]; + gset->setPrimLengths( lens ); + for (int n=0; n < nPrimLenSize; n++) + lens[n] = _aPrimLen[n]; + + // Vertices + switch(_appearance.getVertexOp()) + { + case VERTEX_C_OP: + gset->setCoords(new osg::Vec3[indices]); + break; + case VERTEX_CN_OP: + gset->setNormalBinding(osg::GeoSet::BIND_PERVERTEX); + gset->setCoords(new osg::Vec3[indices]); + gset->setNormals(new osg::Vec3[indices]); + break; + case VERTEX_CT_OP: + gset->setTextureBinding(osg::GeoSet::BIND_PERVERTEX); + gset->setCoords(new osg::Vec3[indices]); + gset->setTextureCoords(new osg::Vec2[indices]); + break; + case VERTEX_CNT_OP: + gset->setNormalBinding(osg::GeoSet::BIND_PERVERTEX); + gset->setTextureBinding(osg::GeoSet::BIND_PERVERTEX); + gset->setCoords(new osg::Vec3[indices]); + gset->setNormals(new osg::Vec3[indices]); + gset->setTextureCoords(new osg::Vec2[indices]); + break; + case OLD_VERTEX_OP: + gset->setCoords(new osg::Vec3[indices]); + break; + case OLD_VERTEX_COLOR_OP: + gset->setCoords(new osg::Vec3[indices]); + break; + case OLD_VERTEX_COLOR_NORMAL_OP: + gset->setCoords(new osg::Vec3[indices]); +// gset->setNormals(new osg::Vec3[indices]); + break; + + } + + // Copy vertices + { + int index; + std::vector::iterator itr; + for(index=0, itr=_aVertex.begin(); + itr!=_aVertex.end(); + ++index, ++itr) + { + setVertex(gset, index, *itr); + } + } + + return gset; +} + + +///////////////////////// private ////////////////////////////////// + + +void TmpGeoSet::setVertex(osg::GeoSet* gset, int index, Record* vertex) +{ + bool bColorBindPerVertex = _appearance.getColorBinding() == osg::GeoSet::BIND_PERVERTEX; + + switch(_appearance.getVertexOp()) + { + case VERTEX_C_OP: + { + SVertex* pVert = (SVertex*)vertex->getData(); + osg::Vec3* coords = gset->getCoords(); + + coords[index].set( + (float)pVert->Coord.x(), + (float)pVert->Coord.y(), + (float)pVert->Coord.z()); + if (bColorBindPerVertex) + { + osg::Vec4* colors = gset->getColors(); + + if (pVert->swFlags & BIT3) + colors[index] = pVert->PackedColor.get(); + else + { + ColorPool* pColorPool = _pFltFile->getColorPool(); + if (pColorPool) + colors[index] = pColorPool->getColor(pVert->dwVertexColorIndex); + } + } + } + break; + + case VERTEX_CN_OP: + { + SNormalVertex* pVert = (SNormalVertex*)vertex->getData(); + osg::Vec3* coords = gset->getCoords(); + osg::Vec3* normals = gset->getNormals(); + + coords[index].set( + (float)pVert->Coord.x(), + (float)pVert->Coord.y(), + (float)pVert->Coord.z()); + normals[index].set( + (float)pVert->Normal.x(), + (float)pVert->Normal.y(), + (float)pVert->Normal.z()); + if (bColorBindPerVertex) + { + osg::Vec4* colors = gset->getColors(); + + if (pVert->swFlags & BIT3) + colors[index] = pVert->PackedColor.get(); + else + { + ColorPool* pColorPool = _pFltFile->getColorPool(); + if (pColorPool) + colors[index] = pColorPool->getColor(pVert->dwVertexColorIndex); + } + } + } + break; + + case VERTEX_CNT_OP: + { + SNormalTextureVertex* pVert = (SNormalTextureVertex*)vertex->getData(); + osg::Vec3* coords = gset->getCoords(); + osg::Vec3* normals = gset->getNormals(); + osg::Vec2* texuv = gset->getTCoords(); + + coords[index].set( + (float)pVert->Coord.x(), + (float)pVert->Coord.y(), + (float)pVert->Coord.z()); + normals[index].set( + (float)pVert->Normal.x(), + (float)pVert->Normal.y(), + (float)pVert->Normal.z()); + texuv[index].set( + (float)pVert->Texture.x(), + (float)pVert->Texture.y()); + if (bColorBindPerVertex) + { + osg::Vec4* colors = gset->getColors(); + + if (pVert->swFlags & BIT3) + colors[index] = pVert->PackedColor.get(); + else + { + ColorPool* pColorPool = _pFltFile->getColorPool(); + if (pColorPool) + colors[index] = pColorPool->getColor(pVert->dwVertexColorIndex); + } + } + } + break; + + case VERTEX_CT_OP: + { + STextureVertex* pVert = (STextureVertex*)vertex->getData(); + osg::Vec3* coords = gset->getCoords(); + osg::Vec2* texuv = gset->getTCoords(); + + coords[index].set( + (float)pVert->Coord.x(), + (float)pVert->Coord.y(), + (float)pVert->Coord.z()); + texuv[index].set( + (float)pVert->Texture.x(), + (float)pVert->Texture.y()); + if (bColorBindPerVertex) + { + osg::Vec4* colors = gset->getColors(); + + if (pVert->swFlags & BIT3) + colors[index] = pVert->PackedColor.get(); + else + { + ColorPool* pColorPool = _pFltFile->getColorPool(); + if (pColorPool) + colors[index] = pColorPool->getColor(pVert->dwVertexColorIndex); + } + } + } + break; + + case OLD_VERTEX_OP: + { + SOldVertex* pVert = (SOldVertex*)vertex->getData(); + osg::Vec3* coords = gset->getCoords(); + + coords[index].set( + (float)pVert->v[0], + (float)pVert->v[1], + (float)pVert->v[2]); + } + break; + + case OLD_VERTEX_COLOR_OP: + { + SOldVertexColor* pVert = (SOldVertexColor*)vertex->getData(); + osg::Vec3* coords = gset->getCoords(); + + coords[index].set( + (float)pVert->v[0], + (float)pVert->v[1], + (float)pVert->v[2]); + } + break; + + case OLD_VERTEX_COLOR_NORMAL_OP: + { + SOldVertexColorNormal* pVert = (SOldVertexColorNormal*)vertex->getData(); + osg::Vec3* coords = gset->getCoords(); +// osg::Vec3* normals = gset->getNormals(); + + coords[index].set( + (float)pVert->Coord[0], + (float)pVert->Coord[1], + (float)pVert->Coord[2]); +/* + normals[index].set( + (float)pVert->Normal[0], + (float)pVert->Normal[1], + (float)pVert->Normal[2]); +*/ + } + break; + } +} + + diff --git a/src/osgPlugins/flt/GeoSetBuilder.h b/src/osgPlugins/flt/GeoSetBuilder.h new file mode 100644 index 000000000..3b74f4daa --- /dev/null +++ b/src/osgPlugins/flt/GeoSetBuilder.h @@ -0,0 +1,234 @@ +// GeoSetBuilder.h + +#ifndef __FLT_GEOSETS_H +#define __FLT_GEOSETS_H + +#include +#include + +#include +#include +#include +#include + + +namespace osg { +class Node; +class LOD; +class GeoSet; +class Geode; +class GeoState; +class Material; +class Texture; +} + + +namespace flt { + +class Record; +class TmpGeoSet; + +typedef osg::GeoSet::PrimitiveType PrimitiveType; +typedef std::vector CoordList; +typedef std::vector NormalList; +typedef std::vector TexUVList; +typedef std::vector ColorList; +typedef std::vector VertexList; +typedef std::vector PrimLenList; + + + +class Appearance +{ +public: + + typedef osg::GeoSet::BindingType BindingType; + + Appearance() { init(); } + + void init() + { + _nVertexOp = 0; + _primtype = osg::GeoSet::NO_TYPE; + _material = NULL; + _texture = NULL; + _color = osg::Vec4(1,1,1,1); + _color_binding = osg::GeoSet::BIND_OFF; + _cullface = false; + _transparency = false; + _lighting = false; + _subface = 0; + } + + void setVertexOp(int op) { _nVertexOp = op; } + int getVertexOp() { return _nVertexOp; } + + void setPrimType(PrimitiveType pt) { _primtype = pt; } + PrimitiveType getPrimType() { return _primtype; } + + void setColor(osg::Vec4 color) { _color = color; } + osg::Vec4& getColor() { return _color; } + + void setColorBinding( BindingType binding ) { _color_binding = binding; } + BindingType getColorBinding() { return _color_binding; } + + void setMaterial(osg::Material *material) { _material = material; } + osg::Material* getMaterial() { return _material; } + + void setTexture(osg::Texture *texture) { _texture = texture; } + osg::Texture* getTexture() { return _texture; } + + void setCullface(bool cullface) { _cullface = cullface; } + bool getCullface() { return _cullface; } + + void setTransparency(bool transp) { _transparency = transp; } + bool getTransparency() { return _transparency; } + + void setLighting(bool light) { _lighting = light; } + bool getLighting() { return _lighting; } + + void setSubface(int level) { _subface = level; } + int getSubface() { return _subface; } + + bool mat_equal(const void *m) const + { + if (_material && m) + return !memcmp(_material, m, sizeof(osg::Material)); + return (!_material && !m); + } + + bool col_equal(const BindingType b, const osg::Vec4 c) const + { + if (_color_binding != b) + return false; + if (_color_binding == osg::GeoSet::BIND_OVERALL) + return (_color == c); + return true; + } + + /*inline*/ bool operator == (const Appearance& a) const + { + return ((_nVertexOp == a._nVertexOp) + && (_primtype == a._primtype) + && mat_equal(a._material) + && col_equal(a._color_binding, a._color) + && (_texture == a._texture) + && (_cullface == a._cullface) + && (_transparency == a._transparency) + && (_lighting == a._lighting) + && (_subface == a._subface)); + } + +private: + + int _nVertexOp; + PrimitiveType _primtype; + osg::Material* _material; + osg::Texture* _texture; + osg::Vec4 _color; // BIND_OVERALL + BindingType _color_binding; + bool _cullface; + bool _transparency; + bool _lighting; + int _subface; +}; + + + +//////////////////////////////////////////////////////////////////// +// +// GeoSetBuilder +// +//////////////////////////////////////////////////////////////////// + +class GeoSetBuilder +{ +public: + + typedef osg::GeoSet::BindingType BindingType; + + GeoSetBuilder(FltFile* pFltFile); + virtual ~GeoSetBuilder(); + + void addVertex(Record* vertex); + void setPrimType(PrimitiveType pt) { _appearance.setPrimType(pt); } + void setColor(osg::Vec4 color) { _appearance.setColor(color); } + void setColorBinding(BindingType binding ) { _appearance.setColorBinding(binding); } + void setMaterial(osg::Material *material) { _appearance.setMaterial(material); } + void setTexture(osg::Texture *texture) { _appearance.setTexture(texture); } + void setCullface(bool cullface) { _appearance.setCullface(cullface); } + void setTransparency(bool transp) { _appearance.setTransparency(transp); } + void setLighting(bool light) { _appearance.setLighting(light); } + void setSubface(int level) { _appearance.setSubface(level); } + + PrimitiveType getPrimType() { return _appearance.getPrimType(); } + osg::Vec4& getColor() { return _appearance.getColor(); } + BindingType getColorBinding() { return _appearance.getColorBinding(); } + osg::Material* getMaterial() { return _appearance.getMaterial(); } + osg::Texture* getTexture() { return _appearance.getTexture(); } + bool getCullface() { return _appearance.getCullface(); } + bool getTransparency() { return _appearance.getTransparency(); } + bool getLighting() { return _appearance.getLighting(); } + int getSubface() { return _appearance.getSubface(); } + + bool addPrimitive(); + osg::Geode* createOsgGeoSets(osg::Geode* geode=NULL); + +protected: + + void initPrimData(); + TmpGeoSet* findMatchingGeoSet(); + void addTo(TmpGeoSet* gset); + void addToNew(); + PrimitiveType findPrimType( int nVertices); + +private: + + VertexList _aVertex; + Appearance _appearance; + + typedef std::vector GeoSetList; + GeoSetList _aGeoSet; + + FltFile* _pFltFile; +}; + + +//////////////////////////////////////////////////////////////////// +// +// TmpGeoSet +// +//////////////////////////////////////////////////////////////////// + + +class TmpGeoSet +{ +public: + + TmpGeoSet(FltFile* pFltFile); + virtual ~TmpGeoSet(); + + void addVertex(Record* vertex); + void addPrimLen(int len); + osg::GeoSet* createOsgGeoSet(); + + Appearance _appearance; + +private: + + void setVertex(osg::GeoSet* gset, int index, Record* vertex); + + PrimLenList _aPrimLen; + VertexList _aVertex; + + FltFile* _pFltFile; +}; + + + +} // end of namespace flt + + + +#endif // __FLT_GEOSETS_H + diff --git a/src/osgPlugins/flt/GroupRecord.cpp b/src/osgPlugins/flt/GroupRecord.cpp new file mode 100644 index 000000000..0e758715a --- /dev/null +++ b/src/osgPlugins/flt/GroupRecord.cpp @@ -0,0 +1,44 @@ +// GroupRecord.cpp + + +#include "flt.h" +#include "Registry.h" +#include "GroupRecord.h" + +using namespace flt; + +//////////////////////////////////////////////////////////////////// +// +// GroupRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_GroupProxy; + + +GroupRecord::GroupRecord() +{ +} + + +// virtual +GroupRecord::~GroupRecord() +{ +} + + +void GroupRecord::endian() +{ + SGroup *pSGroup = (SGroup*)getData(); + + ENDIAN( pSGroup->iGroupRelPriority ); + ENDIAN( pSGroup->dwFlags ); + ENDIAN( pSGroup->iSpecialId_1 ); + ENDIAN( pSGroup->iSpecialId_2 ); + ENDIAN( pSGroup->iSignificance ); +} + + + + + diff --git a/src/osgPlugins/flt/GroupRecord.h b/src/osgPlugins/flt/GroupRecord.h new file mode 100644 index 000000000..eb558b14c --- /dev/null +++ b/src/osgPlugins/flt/GroupRecord.h @@ -0,0 +1,64 @@ +// GroupRecord.h + +#ifndef __FLT_GROUP_RECORD_H +#define __FLT_GROUP_RECORD_H + + +#include "opcodes.h" +#include "Record.h" +#include "RecordVisitor.h" + + +namespace flt { + +struct SGroup +{ + SRecHeader RecHeader; + char szIdent[8]; // 7 char ASCII ID; 0 terminates + int16 iGroupRelPriority; // Group relative priority + int16 iSpare; // Spare for fullword alignment + uint32 dwFlags; // Flags (bits, from left to right) + // 0 = Reserved + // 1 = Forward animation + // 2 = Cycling animation + // 3 = Bounding box follows + // 4 = Freeze bounding box + // 5 = Default parent + // 6-31 Spare + int16 iSpecialId_1; // Special effects ID 1 - defined by real time + int16 iSpecialId_2; // Special effects ID 2 - defined by real time + int16 iSignificance; // Significance Flags + uint8 swLayer; // Layer Number + uint8 swReserved[5]; // Reserved +}; + + +class GroupRecord : public PrimNodeRecord +{ + public: + GroupRecord(); + + virtual Record* clone() const { return new GroupRecord(); } + virtual const char* className() const { return "GroupRecord"; } + virtual int classOpcode() const { return GROUP_OP; } + virtual int sizeofData() const { return sizeof(SGroup); } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + SGroup* getData() const { return (SGroup*)_pData; } + virtual const std::string getName( void ) const { return std::string(getData()->szIdent); } + + int childLODs(); + + protected: + virtual ~GroupRecord(); + + virtual void endian(); +}; + + + +}; // end namespace flt + +#endif + diff --git a/src/osgPlugins/flt/HeaderRecord.cpp b/src/osgPlugins/flt/HeaderRecord.cpp new file mode 100644 index 000000000..a75da0448 --- /dev/null +++ b/src/osgPlugins/flt/HeaderRecord.cpp @@ -0,0 +1,197 @@ +// HeaderRecord.cpp + +#include "osg/Group" + +#include "flt.h" +#include "Registry.h" +#include "HeaderRecord.h" +#include "Input.h" + +using namespace flt; + + +//////////////////////////////////////////////////////////////////// +// +// HeaderRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_HeaderProxy; + + +HeaderRecord::HeaderRecord() +{ +// _pNode = NULL; +} + + +// virtual +HeaderRecord::~HeaderRecord() +{ +} + + +void HeaderRecord::endian() +{ + SHeader *pHeader = (SHeader*)getData(); + +// VALID_RECORD(SHeader, pRecHdr) + ENDIAN( pHeader->diFormatRevLev ); + ENDIAN( pHeader->diDatabaseRevLev ); + ENDIAN( pHeader->iNextGroup ); + ENDIAN( pHeader->iNextLOD ); + ENDIAN( pHeader->iNextObject ); + ENDIAN( pHeader->iNextPolygon ); + ENDIAN( pHeader->iMultDivUnit ); + ENDIAN( pHeader->diFlags ); + ENDIAN( pHeader->diProjection ); + ENDIAN( pHeader->iNextDegOfFreedom ); + ENDIAN( pHeader->iVertexStorage ); + ENDIAN( pHeader->diDatabaseSource ); + ENDIAN( pHeader->dfSWDatabaseCoordX ); + ENDIAN( pHeader->dfSWDatabaseCoordY ); + ENDIAN( pHeader->dfDatabaseOffsetX ); + ENDIAN( pHeader->dfDatabaseOffsetY ); + ENDIAN( pHeader->iNextSound ); + ENDIAN( pHeader->iNextPath ); + ENDIAN( pHeader->iNextClippingRegion ); + ENDIAN( pHeader->iNextText ); + ENDIAN( pHeader->iNextBSP ); + ENDIAN( pHeader->iNextSwitch ); + pHeader->SWCorner.endian(); + pHeader->NECorner.endian(); + pHeader->Origin.endian(); + ENDIAN( pHeader->dfLambertUpperLat ); + ENDIAN( pHeader->dfLambertLowerLat ); + ENDIAN( pHeader->iNextLightSource ); +} + + +// virtual +void HeaderRecord::decode() +{ +// SHeader *pHeader = (SHeader*)getData(); + + // Add node to scene graph +// _pNode = new osg::Node; +// _pNode->setName(pHeader->szIdent); +} + + +// virtual +bool HeaderRecord::readLocalData(Input& fr) +{ + return PrimNodeRecord::readLocalData(fr); +} + + +// virtual +int HeaderRecord::decodeAncillary(int op) +{ +/* + switch (op) + { + case COLOUR_TABLE_OP: + G_TRACE0( "\tCOLOUR_TABLE_R\n" ); + break; + + case MATERIAL_PALETTE_OP: + { + fltMaterialPalette rec( _pFltFile ); + rec.readRecordBody(); + rec.decodeRecord(); + } + break; + + case LIGHT_SOURCE_PALETTE_R: + G_TRACE0( "\tLIGHT_SOURCE_PALETTE_R\n" ); + break; + + case VERTEX_PALETTE_R: + { + fltVertexPalette rec( _pFltFile ); + rec.readRecordBody(); + rec.decodeRecord(); + } + break; + + case VERTEX_COORD_R: + { + fltVertex rec( _pFltFile ); + rec.readRecordBody(); + rec.decodeRecord(); + } + break; + + case VERTEX_NORMAL_COORD_R: + { + fltNormalVertex rec( _pFltFile ); + rec.readRecordBody(); + rec.decodeRecord(); + } + break; + + case VERTEX_NORMAL_UV_COORD_R: + { + fltNormalTextureVertex rec( _pFltFile ); + rec.readRecordBody(); + rec.decodeRecord(); + } + break; + + case VERTEX_UV_COORD_R: + { + fltTextureVertex rec( _pFltFile ); + rec.readRecordBody(); + rec.decodeRecord(); + } + break; + + default: + return FALSE; + } // end-switch +*/ + return true; +} + + +// virtual +int HeaderRecord::decodeLevel( int op ) +{ +/* + switch (op) + { + case GROUP_OP: + { + fltGroup rec( _pFltFile, (csGroup*)_pContainer ); + rec.readRecordBody(); + rec.decodeRecord(); + } + break; + default: + return FALSE; + } +*/ + return true; +} + +/* +void HeaderRecord::write() +{ + SHeader *pHeader = (SHeader*)getData(); + + G_TRACE0("Header\n"); + G_TRACE1("\tFormatRevisionLevel %ld\n", pHeader->diFormatRevLev); + G_TRACE1("\tDatabaseRevisionLevel %ld\n", pHeader->diDatabaseRevLev); + G_TRACE1("\tDateAndTimeOfLastRev. %s\n", pHeader->szDaTimLastRev); + G_TRACE1("\tProjection %ld\n", pHeader->diProjection); + G_TRACE1("\tDatabase Source %ld\n", pHeader->diDatabaseSource); + G_TRACE1("\tSWCorner,Lat %lf\n", pHeader->SWCorner.dfLat); + G_TRACE1("\tSWCorner,Lon %lf\n", pHeader->SWCorner.dfLon); + G_TRACE1("\tNECorner,Lat %lf\n", pHeader->NECorner.dfLat); + G_TRACE1("\tNECorner,Lon %lf\n", pHeader->NECorner.dfLon); + G_TRACE1("\tOrigin,Lat %lf\n", pHeader->Origin.dfLat); + G_TRACE1("\tOrigin,Lon %lf\n", pHeader->Origin.dfLon); +} +*/ + diff --git a/src/osgPlugins/flt/HeaderRecord.h b/src/osgPlugins/flt/HeaderRecord.h new file mode 100644 index 000000000..5149730bb --- /dev/null +++ b/src/osgPlugins/flt/HeaderRecord.h @@ -0,0 +1,126 @@ +// HeaderRecord.h + +#ifndef __FLT_HEADER_RECORD_H +#define __FLT_HEADER_RECORD_H + + +#include "opcodes.h" +#include "Record.h" +#include "RecordVisitor.h" + +//namespace flt { +//class Node; +//}; + + +namespace flt { + +struct SHeader +{ + SRecHeader RecHeader; + char szIdent[8]; // ID field (Not curr used) + int32 diFormatRevLev; // Format revision level + int32 diDatabaseRevLev; // Edit rev. level + char szDaTimLastRev[32]; // Date and time last rev. + int16 iNextGroup; // Next group ID number + int16 iNextLOD; // Next LOD ID number + int16 iNextObject; // Next object ID number + int16 iNextPolygon; // Next polygon ID number + int16 iMultDivUnit; // Unit multiplier/divisor, always = 1 + uint8 swVertexCoordUnit; // Vertex coordinate units + // 0 = Meters + // 1 = Kilometers + // 4 = Feet + // 5 = Inches + // 8 = Nautical miles + uint8 swTexWhite; // if TRUE set texwhite on new polygons + int32 diFlags; // Flags (bits, from left to right) + // 0 = Save vertex normals + // 1-31 Spare + int32 diNotUsed_1[6]; // Not Used + int32 diProjection; // Projection Type + // 0 = Flat Earth + // 1 = Trapezoidal + // 2 = Round Earth + // 3 = Lambert + // 4 = UTM + // 5 = Geodetic + // 6 = Geocentric + int32 diNotUsed_2[7]; // Not Used + int16 iNextDegOfFreedom; // Next degree of freedom ID number + int16 iVertexStorage; // Vertex Storage Type + // 1 = Double Precision Float + int32 diDatabaseSource; // Database Source + // 100 = OpenFlight + // 200 = DIG I/DIG II + // 300 = Evans and Sutherland CT5A/CT6 + // 400 = PSP DIG + // 600 = General Electric CIV/CV / PT2000 + // 700 = Evans and Sutherland GDF + float64 dfSWDatabaseCoordX; // Southwest Database Coordinate (x,y) + float64 dfSWDatabaseCoordY; + float64 dfDatabaseOffsetX; // Delta (x,y) to Place Database + float64 dfDatabaseOffsetY; + int16 iNextSound; // Next Sound Bead Id + int16 iNextPath; // Next Path Bead ID + int32 diReserved_1[2]; // Reserved for MultiGen + int16 iNextClippingRegion;// Next Clipping Region Bead ID + int16 iNextText; // Next Text Bead ID + int16 iNextBSP; // Next BSP ID + int16 iNextSwitch; // Next Switch Bead ID + int32 diReserved_2; // Reserved + float64x2 SWCorner; // South West Corner Lat/Lon (NB: dec. degrees) + float64x2 NECorner; // North East Corner Lat/Lon (NB: dec. degrees) + float64x2 Origin; // Origin Lat/Lon (NB: dec. degrees, not radians) + float64 dfLambertUpperLat; // Lambert Upper Latitude + float64 dfLambertLowerLat; // Lambert Lower Latitude + int16 iNextLightSource; // Next Light Source ID Number + int16 iReserved_3; // Reserved + int16 iNextRoad; // Next road bead ID number + int16 iNextCat; // Next CAT bead ID number + int16 iReserved_4[4]; // Reserved + int32 diEllipsoid; // Earth ellipsoid model + // 0 - WGS 1984 + // 1 - WGS 1972 + // 2 - Bessel + // 3 - Clarke 1866 + // 4 - NAD 1927 +}; + + +class HeaderRecord : public PrimNodeRecord +{ + public: + HeaderRecord(); + + virtual Record* clone() const { return new HeaderRecord(); } + virtual const char* className() const { return "HeaderRecord"; } + virtual int classOpcode() const { return HEADER_OP; } + virtual int sizeofData() const { return sizeof(SHeader); } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + SHeader* getData() const { return (SHeader*)_pData; } + virtual const std::string getName( void ) const { return std::string(getData()->szIdent); } + + protected: + virtual ~HeaderRecord(); + + virtual void endian(); + virtual void decode(); + + virtual bool readLocalData(Input& fr); +// virtual bool writeLocalData(Output& fw); + + virtual int decodeAncillary(int op); + virtual int decodeLevel(int op); + + private: + // vertex pool +// osg::Node* _pNode; + +}; + +}; // end namespace flt + +#endif diff --git a/src/osgPlugins/flt/Input.cpp b/src/osgPlugins/flt/Input.cpp new file mode 100644 index 000000000..4cf9aeb68 --- /dev/null +++ b/src/osgPlugins/flt/Input.cpp @@ -0,0 +1,202 @@ +// Input.cpp + +#include +#include + +#include + +#include "Input.h" +#include "Record.h" +#include "Registry.h" + +#ifdef __sgi +using std::string; +#endif + +#ifdef OSG_USE_IO_DOT_H +#include +#else +#include +using namespace std; +#endif + +using namespace flt; + + + + +FileInput::FileInput() +{ + _init(); +} + + +FileInput::~FileInput() +{ + close(); +} + + +void FileInput::_init() +{ + _lRecOffset = 0L; + _file = NULL; + _eof = true; +} + + +size_t FileInput::_read(void *buffer, size_t size) +{ + if (_eof) return 0; + + size_t nItemsRead = ::fread(buffer, size, 1, _file); + if (nItemsRead != 1) + _eof = true; + + return nItemsRead; +} + + +bool FileInput::eof() +{ + return _eof; +} + + + +bool FileInput::open(const std::string& fileName) +{ + _file=::fopen( fileName.c_str(), "rb"); + if (_file == NULL) return false; + _eof = false; + return true; +} + + +void FileInput::close() +{ + if (_file) ::fclose(_file); + _init(); +} + + +bool FileInput::rewindLast() +{ + if (_file == NULL) return false; + return (fseek(_file, _lRecOffset, SEEK_SET) == 0); +} + + +long FileInput::offset() +{ + return _lRecOffset; +} + + +// read opcode and size + +bool FileInput::_readHeader(SRecHeader* pHdr) +{ + int nItemsRead; + + _lRecOffset = ::ftell( _file ); // Save file position for rewind operation + + // Read record header (4 bytes) + nItemsRead = _read(pHdr, sizeof(SRecHeader)); + if (nItemsRead != 1) + return false; + + if (isLittleEndianMachine()) + pHdr->endian(); + + if ((unsigned)pHdr->length() < sizeof(SRecHeader)) + return false; + + return true; +} + + +bool FileInput::_readBody(SRecHeader* pData) +{ + // Read record body + int nBodySize = pData->length() - sizeof(SRecHeader); + if (nBodySize > 0) + { + int nItemsRead = _read(pData+1, nBodySize); + if (nItemsRead != 1) + return false; + } + + return true; +} + + +SRecHeader* FileInput::readRecord() +{ + SRecHeader hdr; + SRecHeader* pData; + + if (!_readHeader(&hdr)) + return NULL; + + // Allocate buffer for record (including header) + pData = (SRecHeader*)::malloc(hdr.length()); + if (pData == NULL) + return NULL; + + *pData = hdr; + + // Some records contains only the header + if (hdr.length() == sizeof(SRecHeader)) + return pData; + + if (!_readBody(pData)) + return NULL; + + return pData; +} + + +Record* Input::readCreateRecord() +{ + SRecHeader* pData = readRecord(); + + if (pData == NULL) return NULL; + + // find matching record prototype class + Record* pProto = Registry::instance()->getRecordProto(pData->opcode()); + + if (pProto == NULL) + pProto = Registry::instance()->getRecordProto(0); + + if (pProto == NULL) + { + // Should not be possible to end up here! + osg::notify(osg::INFO) << "UnknownRecord not in registry!" << endl; + ::free(pData); + return NULL; + } + + // clone protoype + Record* pRec = pProto->cloneRecord(pData); + if (pRec == NULL) + { + osg::notify(osg::INFO) << "Can't clone record!" << endl; + ::free(pData); + return NULL; + } + +#if 0 + osg::notify(osg::INFO) << "class=" << pRec->className(); + osg::notify(osg::INFO) << " op=" << pRec->getOpcode(); + osg::notify(osg::INFO) << " name=" << pRec->getName(); + osg::notify(osg::INFO) << " offset=" << offset() << endl; +#endif + + if (isLittleEndianMachine()) // From Intel with love :-( + pRec->endian(); + + return pRec; +} + + diff --git a/src/osgPlugins/flt/Input.h b/src/osgPlugins/flt/Input.h new file mode 100644 index 000000000..e044bb4f9 --- /dev/null +++ b/src/osgPlugins/flt/Input.h @@ -0,0 +1,108 @@ +#ifndef __FLT_INPUT_H +#define __FLT_INPUT_H + +#include "Record.h" + +#include +#include +#include + +#include "stdio.h" + +namespace osg { +class Object; +class Image; +class Node; +}; + + +namespace flt { + + +class Record; + + +class Input +{ + public: + + Input() {} + + virtual SRecHeader* readRecord() = 0; + virtual bool eof() = 0; + virtual bool rewindLast() = 0; + virtual long offset() = 0; + + Record* readCreateRecord(); + + protected: + + /** disallow creation of Objects on the stack.*/ + virtual ~Input() {} + + private: + + virtual bool _readHeader(SRecHeader* pHdr) = 0; + virtual bool _readBody(SRecHeader* pData) = 0; +}; + + +/** Class for managing the reading of binary .flt files.*/ +class FileInput : public Input +{ + public: + + FileInput(); + virtual ~FileInput(); + + bool open(const std::string& fileName); + void close(); + virtual bool eof(); + virtual bool rewindLast(); + virtual long offset(); + + virtual SRecHeader* readRecord(); + + private: + virtual bool _readHeader(SRecHeader* pHdr); + virtual bool _readBody(SRecHeader* pData); + void _init(); + size_t _read(void *buffer, size_t size); + + FILE* _file; + bool _eof; + long _lRecOffset; +}; + + + +class MemInput : public Input +{ + public: + + MemInput(); + virtual ~MemInput(); + + bool open(SRecHeader* pHdr); + void close(); + virtual bool eof(); + virtual bool rewindLast(); + virtual long offset(); + + virtual SRecHeader* readRecord(); + + private: + virtual bool _readHeader(SRecHeader* pHdr); + virtual bool _readBody(SRecHeader* pData); + void _init(); + size_t _read(void *buffer, size_t size); + + bool _eof; + long _lRecOffset; +}; + + + +}; // end namespace flt + +#endif // __FLT_INPUT_H diff --git a/src/osgPlugins/flt/InstanceRecords.cpp b/src/osgPlugins/flt/InstanceRecords.cpp new file mode 100644 index 000000000..7b2b6f121 --- /dev/null +++ b/src/osgPlugins/flt/InstanceRecords.cpp @@ -0,0 +1,62 @@ +// InstanceRecords.cpp + + +#include "flt.h" +#include "Registry.h" +#include "InstanceRecords.h" + +using namespace flt; + +//////////////////////////////////////////////////////////////////// +// +// InstanceDefinitionRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_InstanceDefinitionProxy; + + +InstanceDefinitionRecord::InstanceDefinitionRecord() +{ +} + + +// virtual +InstanceDefinitionRecord::~InstanceDefinitionRecord() +{ +} + + +void InstanceDefinitionRecord::endian() +{ +} + + + + +//////////////////////////////////////////////////////////////////// +// +// InstanceReferenceRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_InstanceReferenceProxy; + + +InstanceReferenceRecord::InstanceReferenceRecord() +{ +} + + +// virtual +InstanceReferenceRecord::~InstanceReferenceRecord() +{ +} + + +void InstanceReferenceRecord::endian() +{ +} + + + diff --git a/src/osgPlugins/flt/InstanceRecords.h b/src/osgPlugins/flt/InstanceRecords.h new file mode 100644 index 000000000..668d6bb24 --- /dev/null +++ b/src/osgPlugins/flt/InstanceRecords.h @@ -0,0 +1,85 @@ +// InstanceRecords.h + + +#ifndef __FLT_INSTANCE_RECORDS_H +#define __FLT_INSTANCE_RECORDS_H + + +#include "opcodes.h" +#include "Record.h" +#include "RecordVisitor.h" + + +namespace flt { + + +//////////////////////////////////////////////////////////////////// +// +// InstanceDefinitionRecord +// +//////////////////////////////////////////////////////////////////// + +typedef struct InstanceDefinitionTag +{ + SRecHeader RecHeader; +}SInstanceDefinition; + + +class InstanceDefinitionRecord : public PrimNodeRecord +{ + public: + InstanceDefinitionRecord(); + + virtual Record* clone() const { return new InstanceDefinitionRecord(); } + virtual const char* className() const { return "InstanceDefinitionRecord"; } + virtual int classOpcode() const { return INSTANCE_DEFINITION_OP; } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + SInstanceDefinition* getData() const { return (SInstanceDefinition*)_pData; } + + protected: + virtual ~InstanceDefinitionRecord(); + + virtual void endian(); +}; + + +//////////////////////////////////////////////////////////////////// +// +// InstanceReferenceRecord +// +//////////////////////////////////////////////////////////////////// + + +typedef struct InstanceReferenceTag +{ + SRecHeader RecHeader; +}SInstanceReference; + + + +class InstanceReferenceRecord : public PrimNodeRecord +{ + public: + InstanceReferenceRecord(); + + virtual Record* clone() const { return new InstanceReferenceRecord(); } + virtual const char* className() const { return "InstanceReferenceRecord"; } + virtual int classOpcode() const { return INSTANCE_REFERENCE_OP; } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + SInstanceReference* getData() const { return (SInstanceReference*)_pData; } + + protected: + virtual ~InstanceReferenceRecord(); + + virtual void endian(); +}; + + +}; // end namespace flt + +#endif + diff --git a/src/osgPlugins/flt/LightPointRecord.cpp b/src/osgPlugins/flt/LightPointRecord.cpp new file mode 100644 index 000000000..b5aadeee6 --- /dev/null +++ b/src/osgPlugins/flt/LightPointRecord.cpp @@ -0,0 +1,73 @@ +// LightPointRecord.cpp + + +#include "flt.h" +#include "Registry.h" +#include "LightPointRecord.h" + +using namespace flt; + +//////////////////////////////////////////////////////////////////// +// +// LightPointRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_LightPointProxy; + + +LightPointRecord::LightPointRecord() +{ +} + + +// virtual +LightPointRecord::~LightPointRecord() +{ +} + + +void LightPointRecord::endian() +{ + SLightPoint *pSLightPoint = (SLightPoint*)getData(); + + ENDIAN( pSLightPoint->iMaterial ); + ENDIAN( pSLightPoint->iFeature ); + ENDIAN( pSLightPoint->diMode ); + ENDIAN( pSLightPoint->sfIntensityFront ); + ENDIAN( pSLightPoint->sfIntensityBack ); + ENDIAN( pSLightPoint->sfMinDefocus ); + ENDIAN( pSLightPoint->sfMaxDefocus ); + ENDIAN( pSLightPoint->diFadeMode ); + ENDIAN( pSLightPoint->diFogPunchMode ); + ENDIAN( pSLightPoint->diDirectionalMode ); + ENDIAN( pSLightPoint->diRangeMode ); + ENDIAN( pSLightPoint->sfMinPixelSize ); + ENDIAN( pSLightPoint->sfMaxPixelSize ); + ENDIAN( pSLightPoint->afActualPixelSize ); + ENDIAN( pSLightPoint->sfTranspFalloff ); + ENDIAN( pSLightPoint->sfTranspFalloffExponent ); + ENDIAN( pSLightPoint->sfTranspFalloffScalar ); + ENDIAN( pSLightPoint->sfTranspFalloffClamp ); + ENDIAN( pSLightPoint->sfFog ); + ENDIAN( pSLightPoint->sfReserved ); + ENDIAN( pSLightPoint->sfSize ); + ENDIAN( pSLightPoint->diDirection ); + ENDIAN( pSLightPoint->sfLobeHoriz ); + ENDIAN( pSLightPoint->sfLobeVert ); + ENDIAN( pSLightPoint->sfLobeRoll ); + ENDIAN( pSLightPoint->sfFalloff ); + ENDIAN( pSLightPoint->sfAmbientIntensity ); + ENDIAN( pSLightPoint->sfAnimPeriod ); + ENDIAN( pSLightPoint->sfAnimPhaseDelay ); + ENDIAN( pSLightPoint->sfAnimPeriodEnable ); + ENDIAN( pSLightPoint->sfSignificance ); + ENDIAN( pSLightPoint->sfDrawOrder ); + ENDIAN( pSLightPoint->sfFlags ); + pSLightPoint->animRot.endian(); +} + + + + + diff --git a/src/osgPlugins/flt/LightPointRecord.h b/src/osgPlugins/flt/LightPointRecord.h new file mode 100644 index 000000000..2063c6a59 --- /dev/null +++ b/src/osgPlugins/flt/LightPointRecord.h @@ -0,0 +1,135 @@ +// LightPointRecord.h + +#ifndef __FLT_LIGHT_POINT_RECORD_H +#define __FLT_LIGHT_POINT_RECORD_H + + +#include "opcodes.h" +#include "Record.h" +#include "RecordVisitor.h" + + +namespace flt { + +struct SLightPoint +{ + SRecHeader RecHeader; + char szIdent[8]; // 7 char ASCII ID; 0 terminates + int16 iMaterial; // Surface material code (for DFAD) + int16 iFeature; // Feature ID (for DFAD) + color32 dwBackColor; // Back color for all bidirectional points + int32 diMode; // Display mode + // 0 = RASTER + // 1 = CALLIGRAPHIC + // 2 = EITHER + float32 sfIntensityFront; // Intensity - scalar for front colors + float32 sfIntensityBack; // - scalar for back color + float32 sfMinDefocus; // Minimum defocus - limit (0.0 - 1.0) for calligraphic points + float32 sfMaxDefocus; // Maximum defocus - limit (0.0 - 1.0) for calligraphic points + int32 diFadeMode; // Fading mode + // 0 = enable perspective fading calculations + // 1 = disable calculations + int32 diFogPunchMode; // Fog Punch mode + // 0 = enable fog punch through calculations + // 1 = disable calculations + int32 diDirectionalMode; // Directional mode + // 0 = enable directional calculations + // 1 = disable calculations + int32 diRangeMode; // Range mode + // 0 = use depth (Z) buffer calculation + // 1 = use slant range calculation + float32 sfMinPixelSize; // Minimum pixel size + // Minimum diameter of points in pixels + float32 sfMaxPixelSize; // Maximum pixel size + // Maximum diameter of points in pixels + float32 afActualPixelSize; // Actual size + // Actual diameter of points in database coordinates + float32 sfTranspFalloff; // Transparent falloff pixel size + // Diameter in pixels when points become transparent + float32 sfTranspFalloffExponent; // Transparent falloff exponent + // >= 0 - falloff multiplier exponent (1.0 = linear falloff) + float32 sfTranspFalloffScalar; // Transparent falloff scalar + // > 0 - falloff multiplier scale factor + float32 sfTranspFalloffClamp; // Transparent falloff clamp + // Minimum permissible falloff multiplier result + float32 sfFog; // Fog scalar + // >= 0 - adjusts range of points for punch threw effect. + float32 sfReserved; + float32 sfSize; // Size difference threshold + // Point size transition hint to renderer + int32 diDirection; // Directional type + // 0 = OMNIDIRECTIONAL + // 1 = UNIDIRECTIONAL + // 2 = BIDIRECTIONAL + float32 sfLobeHoriz; // Horizontal lobe angle [degrees] + float32 sfLobeVert; // Vertical lobe angle [degrees] + float32 sfLobeRoll; // Rotation of lobe about local Y axis [degrees] + float32 sfFalloff; // Directional falloff exponent + // >= 0 - falloff multiplier exponent + // (1.0 = linear falloff) + float32 sfAmbientIntensity; // Directional ambient intensity + float32 sfAnimPeriod; // Animation period [seconds] + float32 sfAnimPhaseDelay; // Animation phase delay [seconds] + float32 sfAnimPeriodEnable; // Animation enabled period [seconds] + float32 sfSignificance; // Drop out priority for RASCAL lights (0.0 - 1.0) + int32 sfDrawOrder; // Calligraphic draw order + uint32 sfFlags; // Flags (bits, from left to right) + // 0 = reserved + // 1 = No back color + // TRUE = don’t use back color for + // bidirectional points + // FALSE = use back color for + // bidirectional points + // 2 = reserved + // 3 = Calligraphic proximity occulting (Debunching) + // 4 = Reflective, non-emissive point + // 5-7 = Randomize intensity + // 0 = never + // 1 = low + // 2 = medium + // 3 = high + // 8 = Perspective mode + // 9 = Flashing + // 10 = Rotating + // 11 = Rotate Counter Clockwise + // Direction of rotation about local Z axis + // 12 = reserved + // 13-14 = Quality + // 0 = Low + // 1 = Medium + // 2 = High + // 3 = Undefined + // 15 = Visible during day + // 16 = Visible during dusk + // 17 = Visible during night + // 18-31 = Spare + float32x3 animRot; // Axis of rotation for rotating animation +}; + + + +class LightPointRecord : public PrimNodeRecord +{ + public: + LightPointRecord(); + + virtual Record* clone() const { return new LightPointRecord(); } + virtual const char* className() const { return "LightPointRecord"; } + virtual int classOpcode() const { return LIGHT_POINT_OP; } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + virtual SLightPoint* getData() const { return (SLightPoint*)_pData; } + + protected: + virtual ~LightPointRecord(); + + virtual void endian(); +}; + + + +}; // end namespace flt + +#endif + diff --git a/src/osgPlugins/flt/LightSourcePaletteRecord.cpp b/src/osgPlugins/flt/LightSourcePaletteRecord.cpp new file mode 100644 index 000000000..f83635705 --- /dev/null +++ b/src/osgPlugins/flt/LightSourcePaletteRecord.cpp @@ -0,0 +1,38 @@ +// LightSourcePaletteRecord.cpp + +#include "flt.h" +#include "Registry.h" +#include "LightSourcePaletteRecord.h" + +using namespace flt; + + +//////////////////////////////////////////////////////////////////// +// +// LightSourcePaletteRecord +// +//////////////////////////////////////////////////////////////////// + + +RegisterRecordProxy g_LightSourcePaletteProxy; + + +LightSourcePaletteRecord::LightSourcePaletteRecord() +{ +} + + +// virtual +LightSourcePaletteRecord::~LightSourcePaletteRecord() +{ +} + + +// virtual +void LightSourcePaletteRecord::endian() +{ +} + + + + diff --git a/src/osgPlugins/flt/LightSourcePaletteRecord.h b/src/osgPlugins/flt/LightSourcePaletteRecord.h new file mode 100644 index 000000000..8848f0824 --- /dev/null +++ b/src/osgPlugins/flt/LightSourcePaletteRecord.h @@ -0,0 +1,66 @@ +// LightSourcePaletteRecord.h + +#ifndef __FLT_LIGHT_SOURCE_PALETTE_RECORD_H +#define __FLT_LIGHT_SOURCE_PALETTE_RECORD_H + + +#include "opcodes.h" +#include "Record.h" +#include "RecordVisitor.h" + + +namespace flt { + + +typedef struct LightSourcePaletteTag +{ + SRecHeader RecHeader; + int32 diIndex; // Palette index + int32 diReserved_1[2]; + char szName[20]; // Light source name + int32 diReserved_2; + float32 sfAmbientRGBA[4]; // Alpha comp. currently unused + float32 sfDiffuseRGBA[4]; // Alpha comp. currently unused + float32 sfSpecularRGBA[4]; // Alpha comp. currently unused + int32 diLightType; // 0 = INFINITE + // 1 = LOCAL + // 2 = SPOT + int32 diReserved_3[10]; + float32 sfDropoff; // Spot exponential dropoff term + float32 sfCutoff; // Spot cutoff angle (radians) + float32 sfYaw; + float32 sfPitch; + float32 sfConstantAttuenation; + float32 sfLinearAttuenation; + float32 sfQuadraticAttuenation; + int32 diModelingLight; // TRUE/FALSE + int32 diSpare[19]; +} SLightSourcePalette; + + + +class LightSourcePaletteRecord : public AncillaryRecord +{ + public: + + LightSourcePaletteRecord(); + + virtual Record* clone() const { return new LightSourcePaletteRecord(); } + virtual const char* className() const { return "LightSourcePaletteRecord"; } + virtual int classOpcode() const { return LIGHT_SOURCE_PALETTE_OP; } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + protected: + + virtual ~LightSourcePaletteRecord(); + + virtual void endian(); + +}; + + +}; // end namespace flt + +#endif + diff --git a/src/osgPlugins/flt/LightSourceRecord.cpp b/src/osgPlugins/flt/LightSourceRecord.cpp new file mode 100644 index 000000000..03b438419 --- /dev/null +++ b/src/osgPlugins/flt/LightSourceRecord.cpp @@ -0,0 +1,47 @@ +// LightSourceRecord.cpp + +#include "flt.h" +#include "Registry.h" +#include "LightSourceRecord.h" + + +using namespace flt; + +//////////////////////////////////////////////////////////////////// +// +// LightSourceRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_LightSourceRecordProxy; + + +LightSourceRecord::LightSourceRecord() +{ +} + + +// virtual +LightSourceRecord::~LightSourceRecord() +{ +} + + +// virtual +void LightSourceRecord::endian() +{ + SLightSource *pSLightSource = (SLightSource*)getData(); + + ENDIAN( pSLightSource->diReserved_1 ); + ENDIAN( pSLightSource->diIndex ); + ENDIAN( pSLightSource->diReserved_2 ); + ENDIAN( pSLightSource->dwFlags ); + ENDIAN( pSLightSource->diReserved_3 ); + pSLightSource->Coord.endian(); + ENDIAN( pSLightSource->sfYaw ); + ENDIAN( pSLightSource->sfPitch ); +} + + + + diff --git a/src/osgPlugins/flt/LightSourceRecord.h b/src/osgPlugins/flt/LightSourceRecord.h new file mode 100644 index 000000000..8ca0c8e57 --- /dev/null +++ b/src/osgPlugins/flt/LightSourceRecord.h @@ -0,0 +1,68 @@ +// LightSourceRecord.h + +#ifndef __FLT_LIGHT_SOURCE_RECORD_H +#define __FLT_LIGHT_SOURCE_RECORD_H + + +#include "opcodes.h" +#include "Record.h" +#include "RecordVisitor.h" + + +namespace flt { + + + +//////////////////////////////////////////////////////////////////// +// +// LightSourceRecord +// +//////////////////////////////////////////////////////////////////// + + +typedef struct LightSourceTag +{ + SRecHeader RecHeader; + char szIdent[8]; // 7 char ASCII ID; 0 terminates + int32 diReserved_1; + int32 diIndex; //index into lightpalette + int32 diReserved_2; + uint32 dwFlags; //bits from left to right + //0=enabled + //1=global + //2=reserve + //3=export + //4=reserved + //5-31 spare + int32 diReserved_3; + float64x3 Coord; // x,y,z coordinate + float32 sfYaw; + float32 sfPitch; +} SLightSource; + + +class LightSourceRecord : public PrimNodeRecord +{ + public: + + LightSourceRecord(); + + virtual Record* clone() const { return new LightSourceRecord(); } + virtual const char* className() const { return "LightSourceRecord"; } + virtual int classOpcode() const { return LIGHT_SOURCE_OP; } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + protected: + + virtual ~LightSourceRecord(); + + virtual void endian(); +}; + + + +}; // end namespace flt + +#endif + diff --git a/src/osgPlugins/flt/LodRecord.cpp b/src/osgPlugins/flt/LodRecord.cpp new file mode 100644 index 000000000..7c7f78407 --- /dev/null +++ b/src/osgPlugins/flt/LodRecord.cpp @@ -0,0 +1,78 @@ +// LodRecord.cpp + +#include "flt.h" +#include "Registry.h" +#include "LodRecord.h" + +using namespace flt; + +//////////////////////////////////////////////////////////////////// +// +// LodRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_LodProxy; + + +LodRecord::LodRecord() +{ +} + + +// virtual +LodRecord::~LodRecord() +{ +} + + +void LodRecord::endian() +{ + SLevelOfDetail *pSLod = (SLevelOfDetail*)getData(); + + ENDIAN( pSLod->dfSwitchInDist ); + ENDIAN( pSLod->dfSwitchOutDist ); + ENDIAN( pSLod->iSpecialId_1 ); + ENDIAN( pSLod->iSpecialId_2 ); + ENDIAN( pSLod->diFlags ); + pSLod->Center.endian(); + ENDIAN( pSLod->dfTransitionRange ); +} + + + +//////////////////////////////////////////////////////////////////// +// +// OldLodRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_OldLodProxy; + + +OldLodRecord::OldLodRecord() +{ +} + + +// virtual +OldLodRecord::~OldLodRecord() +{ +} + + +void OldLodRecord::endian() +{ + SOldLOD *pSLod = (SOldLOD*)getData(); + + ENDIAN( pSLod->dfSwitchInDist ); + ENDIAN( pSLod->dfSwitchOutDist ); + ENDIAN( pSLod->iSpecialId_1 ); + ENDIAN( pSLod->iSpecialId_2 ); + ENDIAN( pSLod->diFlags ); + pSLod->Center.endian(); + ENDIAN( pSLod->dfTransitionRange ); +} + + + diff --git a/src/osgPlugins/flt/LodRecord.h b/src/osgPlugins/flt/LodRecord.h new file mode 100644 index 000000000..69c11032f --- /dev/null +++ b/src/osgPlugins/flt/LodRecord.h @@ -0,0 +1,115 @@ +// LodRecord.h + +#ifndef __FLT_LOD_RECORD_H +#define __FLT_LOD_RECORD_H + + +#include "opcodes.h" +#include "Record.h" +#include "RecordVisitor.h" + + +namespace flt { + +//////////////////////////////////////////////////////////////////// +// +// LodRecord +// +//////////////////////////////////////////////////////////////////// + +typedef struct LevelOfDetailTag +{ + SRecHeader RecHeader; + char szIdent[8]; // 7 char ASCII ID; 0 terminates + int32 iSpare; // Spare + float64 dfSwitchInDist; // Switch in distance + float64 dfSwitchOutDist;// Switch out distance + int16 iSpecialId_1; // Special effects ID 1 - defined by real time + int16 iSpecialId_2; // Special effects ID 2 - defined by real time + int32 diFlags; // Flags (bits, from left to right) + // 0 = Use previous slant range + // 1 = SPT flag: 0 if replacement LOD, 1 for additive LOD + // 2 = Freeze center (don't recalculate) + // 3-31 Spare + float64x3 Center; // Center coordinate (x,y,z) of LOD block + float64 dfTransitionRange; // Transition Range for Morphing +} SLevelOfDetail; + + + +class LodRecord : public PrimNodeRecord +{ + public: + LodRecord(); + + virtual Record* clone() const { return new LodRecord(); } + virtual const char* className() const { return "LodRecord"; } + virtual int classOpcode() const { return LOD_OP; } + virtual int sizeofData() const { return sizeof(SLevelOfDetail); } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + SLevelOfDetail* getData() const { return (SLevelOfDetail*)_pData; } + virtual const std::string getName( void ) const { return std::string(getData()->szIdent); } + + protected: + virtual ~LodRecord(); + + virtual void endian(); +}; + + + +//////////////////////////////////////////////////////////////////// +// +// OldLodRecord +// +//////////////////////////////////////////////////////////////////// + + +typedef struct OldLodTag +{ + SRecHeader RecHeader; + char szIdent[8]; // 7 char ASCII ID; 0 terminates + int32 iSpare; // Spare + float64 dfSwitchInDist; // Switch in distance + float64 dfSwitchOutDist;// Switch out distance + int16 iSpecialId_1; // Special effects ID 1 - defined by real time + int16 iSpecialId_2; // Special effects ID 2 - defined by real time + int32 diFlags; // Flags (bits, from left to right) + // 0 = Use previous slant range + // 1 = SPT flag: 0 if replacement LOD, 1 for additive LOD + // 2 = Freeze center (don't recalculate) + // 3-31 Spare + float64x3 Center; // Center coordinate (x,y,z) of LOD block + float64 dfTransitionRange; // Transition Range for Morphing +} SOldLOD; + + + +class OldLodRecord : public PrimNodeRecord +{ + public: + OldLodRecord(); + + virtual Record* clone() const { return new OldLodRecord(); } + virtual const char* className() const { return "OldLodRecord"; } + virtual int classOpcode() const { return OLD_LOD_OP; } + virtual int sizeofData() const { return sizeof(SOldLOD); } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + SOldLOD* getData() const { return (SOldLOD*)_pData; } +// virtual const std::string getName( void ) const { return std::string(getData()->szIdent); } + + protected: + virtual ~OldLodRecord(); + + virtual void endian(); +}; + + +}; // end namespace flt + +#endif + diff --git a/src/osgPlugins/flt/LongIDRecord.cpp b/src/osgPlugins/flt/LongIDRecord.cpp new file mode 100644 index 000000000..da9679666 --- /dev/null +++ b/src/osgPlugins/flt/LongIDRecord.cpp @@ -0,0 +1,37 @@ +// LongIDRecord.cpp + +#include "flt.h" +#include "Registry.h" +#include "LongIDRecord.h" + +using namespace flt; + + +//////////////////////////////////////////////////////////////////// +// +// MaterialPaletteRecord +// +//////////////////////////////////////////////////////////////////// + + +RegisterRecordProxy g_LongIDProxy; + + +LongIDRecord::LongIDRecord() +{ +} + + +// virtual +LongIDRecord::~LongIDRecord() +{ +} + + +// virtual +void LongIDRecord::endian() +{ + +} + + diff --git a/src/osgPlugins/flt/LongIDRecord.h b/src/osgPlugins/flt/LongIDRecord.h new file mode 100644 index 000000000..ce27f606e --- /dev/null +++ b/src/osgPlugins/flt/LongIDRecord.h @@ -0,0 +1,46 @@ +// LongIDRecord.h + +#ifndef __FLT_LONG_ID_RECORD_H +#define __FLT_LONG_ID_RECORD_H + + +#include "opcodes.h" +#include "Record.h" +#include "RecordVisitor.h" + + +namespace flt { + + +struct SLongID +{ + SRecHeader RecHeader; + char szIdent[1]; // (Length - 4) ASCII ID of node +}; + + + +class LongIDRecord : public AncillaryRecord +{ + public: + + LongIDRecord(); + + virtual Record* clone() const { return new LongIDRecord(); } + virtual const char* className() const { return "LongIDRecord"; } + virtual int classOpcode() const { return LONG_ID_OP; } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + protected: + + virtual ~LongIDRecord(); + + virtual void endian(); +}; + + +}; // end namespace flt + +#endif + diff --git a/src/osgPlugins/flt/Makedepend b/src/osgPlugins/flt/Makedepend new file mode 100644 index 000000000..e69de29bb diff --git a/src/osgPlugins/flt/Makefile b/src/osgPlugins/flt/Makefile new file mode 100644 index 000000000..0f8f08f72 --- /dev/null +++ b/src/osgPlugins/flt/Makefile @@ -0,0 +1,51 @@ +#!smake +include ../../../Make/makedefs + +C++FILES = \ + BoundingVolumeRecords.cpp\ + LongIDRecord.cpp\ + ColorPaletteRecord.cpp\ + MaterialPaletteRecord.cpp\ + CommentRecord.cpp\ + ObjectRecord.cpp\ + ControlRecord.cpp\ + OldVertexRecords.cpp\ + DofRecord.cpp\ + ExtensionRecord.cpp\ + ExternalRecord.cpp\ + Record.cpp\ + FaceRecord.cpp\ + FltFile.cpp\ + RecordVisitor.cpp\ + GeoSetBuilder.cpp\ + Registry.cpp\ + GroupRecord.cpp\ + SwitchRecord.cpp\ + HeaderRecord.cpp\ + TexturePaletteRecord.cpp\ + Input.cpp\ + TransformationRecords.cpp\ + InstanceRecords.cpp\ + UnknownRecord.cpp\ + LightPointRecord.cpp\ + VertexPoolRecords.cpp\ + LightSourcePaletteRecord.cpp\ + flt.cpp\ + LightSourceRecord.cpp\ + flt2osg.cpp\ + LodRecord.cpp\ + Pool.cpp\ + TextureMappingPaletteRecord.cpp\ + ReaderWriterFLT.cpp\ +# PointLight.cpp\ + + +C++FLAGS += -I../../../include + +LIB = ../../../lib/osgPlugins/osgdb_flt.so + +TARGET_LOADER_FILES = osgPlugins/osgdb_flt.so + + +include ../../../Make/makerules + diff --git a/src/osgPlugins/flt/MaterialPaletteRecord.cpp b/src/osgPlugins/flt/MaterialPaletteRecord.cpp new file mode 100644 index 000000000..c69551fd3 --- /dev/null +++ b/src/osgPlugins/flt/MaterialPaletteRecord.cpp @@ -0,0 +1,49 @@ +// MaterialPaletteRecord.cpp + +#include "flt.h" +#include "Registry.h" +#include "MaterialPaletteRecord.h" + +using namespace flt; + + +//////////////////////////////////////////////////////////////////// +// +// MaterialPaletteRecord +// +//////////////////////////////////////////////////////////////////// + + +RegisterRecordProxy g_MaterialPaletteProxy; + + +MaterialPaletteRecord::MaterialPaletteRecord() +{ +} + + +// virtual +MaterialPaletteRecord::~MaterialPaletteRecord() +{ +} + + +// virtual +void MaterialPaletteRecord::endian() +{ + SMaterial *pSMaterial = (SMaterial*)getData(); + + ENDIAN( pSMaterial->diIndex ); + ENDIAN( pSMaterial->diFlags ); + pSMaterial->Ambient.endian(); + pSMaterial->Diffuse.endian(); + pSMaterial->Specular.endian(); + pSMaterial->Emissive.endian(); + ENDIAN( pSMaterial->sfShininess ); + ENDIAN( pSMaterial->sfAlpha ); +} + + + + + diff --git a/src/osgPlugins/flt/MaterialPaletteRecord.h b/src/osgPlugins/flt/MaterialPaletteRecord.h new file mode 100644 index 000000000..1005a9693 --- /dev/null +++ b/src/osgPlugins/flt/MaterialPaletteRecord.h @@ -0,0 +1,60 @@ +// MaterialPaletteRecord.h + +#ifndef __FLT_MATERIAL_PALETTE_RECORD_H +#define __FLT_MATERIAL_PALETTE_RECORD_H + + +#include "opcodes.h" +#include "Record.h" +#include "RecordVisitor.h" + + +namespace flt { + + +struct SMaterial +{ + SRecHeader RecHeader; + int32 diIndex; + char szName[12]; + uint32 diFlags; // bit 0 Materials used + // bit 1-31 Spare + float32x3 Ambient; // Ambient component of material + float32x3 Diffuse; // Diffuse component of material + float32x3 Specular; // Specular component of material + float32x3 Emissive; // Emissive component of material + float32 sfShininess; // Shininess. [0.0-128.0] + float32 sfAlpha; // Alpha. [0.0-1.0], where 1.0 is opaque + int32 diSpare; +}; + + +class MaterialPaletteRecord : public AncillaryRecord +{ + public: + + MaterialPaletteRecord(); + + virtual Record* clone() const { return new MaterialPaletteRecord(); } + virtual const char* className() const { return "MaterialPaletteRecord"; } + virtual int classOpcode() const { return MATERIAL_PALETTE_OP; } + virtual int sizeofData() const { return sizeof(SMaterial); } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + protected: + + virtual ~MaterialPaletteRecord(); + + virtual void endian(); +// virtual void decode(); + +// virtual bool readLocalData(Input& fr); +// virtual bool writeLocalData(Output& fw); + +}; + + +}; // end namespace flt + +#endif diff --git a/src/osgPlugins/flt/ObjectRecord.cpp b/src/osgPlugins/flt/ObjectRecord.cpp new file mode 100644 index 000000000..8b3348346 --- /dev/null +++ b/src/osgPlugins/flt/ObjectRecord.cpp @@ -0,0 +1,42 @@ +// ObjectRecord.cpp + +#include "flt.h" +#include "Registry.h" +#include "ObjectRecord.h" + +using namespace flt; + +//////////////////////////////////////////////////////////////////// +// +// ObjectRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_ObjectProxy; + + +ObjectRecord::ObjectRecord() +{ +} + + +// virtual +ObjectRecord::~ObjectRecord() +{ +} + + +void ObjectRecord::endian() +{ + SObject *pSObject = (SObject*)getData(); + + ENDIAN( pSObject->dwFlags ); + ENDIAN( pSObject->iObjectRelPriority ); + ENDIAN( pSObject->wTransparency ); + ENDIAN( pSObject->iSpecialId_1 ); + ENDIAN( pSObject->iSpecialId_2 ); + ENDIAN( pSObject->iSignificance ); +} + + + diff --git a/src/osgPlugins/flt/ObjectRecord.h b/src/osgPlugins/flt/ObjectRecord.h new file mode 100644 index 000000000..14c0399e5 --- /dev/null +++ b/src/osgPlugins/flt/ObjectRecord.h @@ -0,0 +1,66 @@ +// ObjectRecord.h + +#ifndef __FLT_OBJECT_RECORD_H +#define __FLT_OBJECT_RECORD_H + + +#include "opcodes.h" +#include "Record.h" +#include "RecordVisitor.h" + + +namespace flt { + + +typedef struct ObjectTag +{ + SRecHeader RecHeader; + char szIdent[8]; // 7 char ASCII ID; 0 terminates + uint32 dwFlags; // Flags (bits from to right) + // 0 = Don't display in daylight + // 1 = Don't display at dusk + // 2 = Don't display at night + // 3 = Don't illuminate + // 4 = Flat shaded + // 5 = Group's shadow object + // 6-31 Spare + int16 iObjectRelPriority; // Object relative priority + uint16 wTransparency; // Transparency factor + // = 0 opaque + // = 65535 for totally clear + int16 iSpecialId_1; // Special effects ID 1 - defined by real time + int16 iSpecialId_2; // Special effects ID 2 - defined by real time + int16 iSignificance; // Significance + int16 iSpare; // Spare +} SObject; + + + +class ObjectRecord : public PrimNodeRecord +{ + public: + ObjectRecord(); + + virtual Record* clone() const { return new ObjectRecord(); } + virtual const char* className() const { return "ObjectRecord"; } + virtual int classOpcode() const { return OBJECT_OP; } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + SObject* getData() const { return (SObject*)_pData; } + virtual const std::string getName( void ) const { return std::string(getData()->szIdent); } + + protected: + virtual ~ObjectRecord(); + + virtual void endian(); + +// virtual bool readLocalData(Input& fr); +// virtual bool writeLocalData(Output& fw); + +}; + + +}; // end namespace flt + +#endif diff --git a/src/osgPlugins/flt/OldVertexRecords.cpp b/src/osgPlugins/flt/OldVertexRecords.cpp new file mode 100644 index 000000000..2477549c2 --- /dev/null +++ b/src/osgPlugins/flt/OldVertexRecords.cpp @@ -0,0 +1,138 @@ +// OldVertexRecords.cpp + +#include "flt.h" +#include "Registry.h" +#include "OldVertexRecords.h" + + +using namespace flt; + + + +//////////////////////////////////////////////////////////////////// +// +// OldVertexRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_OldVertexProxy; + + +OldVertexRecord::OldVertexRecord() +{ +} + + +// virtual +OldVertexRecord::~OldVertexRecord() +{ +} + +// virtual +void OldVertexRecord::endian() +{ + SOldVertex *pVertex = (SOldVertex*)getData(); + + ENDIAN( pVertex->v[0] ); + ENDIAN( pVertex->v[1] ); + ENDIAN( pVertex->v[2] ); +} + + +/* +ostream& operator << (ostream& output, const OldVertexRecord& rec) +{ + output << rec.className() << " " + << rec.getData()->swFlags << " " + << rec.getData()->Coord; + return output; // to enable cascading +} +*/ + + +//////////////////////////////////////////////////////////////////// +// +// OldVertexColorRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_OldVertexColorProxy; + + +OldVertexColorRecord::OldVertexColorRecord() +{ +} + + +// virtual +OldVertexColorRecord::~OldVertexColorRecord() +{ +} + +// virtual +void OldVertexColorRecord::endian() +{ + SOldVertexColor *pVertex = (SOldVertexColor*)getData(); + + ENDIAN( pVertex->v[0] ); + ENDIAN( pVertex->v[1] ); + ENDIAN( pVertex->v[2] ); +} + + +/* +ostream& operator << (ostream& output, const OldVertexColorRecord& rec) +{ + output << rec.className() << " " + << rec.getData()->swFlags << " " + << rec.getData()->Coord; + return output; // to enable cascading +} +*/ + +//////////////////////////////////////////////////////////////////// +// +// OldVertexColorNormalRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_OldVertexColorNormalProxy; + + +OldVertexColorNormalRecord::OldVertexColorNormalRecord() +{ +} + + +// virtual +OldVertexColorNormalRecord::~OldVertexColorNormalRecord() +{ +} + + +// virtual +void OldVertexColorNormalRecord::endian() +{ + SOldVertexColorNormal *pVertex = (SOldVertexColorNormal*)getData(); + + ENDIAN( pVertex->Coord[0] ); + ENDIAN( pVertex->Coord[1] ); + ENDIAN( pVertex->Coord[2] ); + ENDIAN( pVertex->swColor ); + ENDIAN( pVertex->swFlags ); +// ENDIAN( pVertex->Normal[0] ); +// ENDIAN( pVertex->Normal[1] ); +// ENDIAN( pVertex->Normal[2] ); +} + +/* +ostream& operator << (ostream& output, const OldVertexColorNormalRecord& rec) +{ + output << rec.className() << " " + << rec.getData()->swFlags << " " + << rec.getData()->Coord; + return output; // to enable cascading +} +*/ + + diff --git a/src/osgPlugins/flt/OldVertexRecords.h b/src/osgPlugins/flt/OldVertexRecords.h new file mode 100644 index 000000000..6c37f5e66 --- /dev/null +++ b/src/osgPlugins/flt/OldVertexRecords.h @@ -0,0 +1,137 @@ +// OldVertexRecords.h + +#ifndef __FLT_OLD_VERTEX_RECORDS_H +#define __FLT_OLD_VERTEX_RECORDS_H + +#include + +#include "opcodes.h" +#include "Record.h" +#include "RecordVisitor.h" + +#ifdef OSG_USE_IO_DOT_H +#include +#else +#include +using namespace std; +#endif + + +namespace flt { + + +//////////////////////////////////////////////////////////////////// +// +// OldVertexRecord +// +//////////////////////////////////////////////////////////////////// + +typedef struct OldVertexTag +{ + SRecHeader RecHeader; + int32 v[3]; +} SOldVertex; + + +class OldVertexRecord : public PrimNodeRecord +{ + public: + OldVertexRecord(); + virtual Record* clone() const { return new OldVertexRecord(); } + virtual const char* className() const { return "OldVertexRecord"; } + virtual int classOpcode() const { return OLD_VERTEX_OP; } + virtual int sizeofData() const { return sizeof(SOldVertex); } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + virtual SOldVertex* getData() const { return (SOldVertex*)_pData; } +// friend ostream& operator << (ostream& output, const OldVertexRecord& rec); + + protected: + virtual ~OldVertexRecord(); + + virtual void endian(); +}; + + +//////////////////////////////////////////////////////////////////// +// +// OldVertexColorRecord +// +//////////////////////////////////////////////////////////////////// + + +typedef struct OldVertexColorTag +{ + SRecHeader RecHeader; + int32 v[3]; +/* + float64_t x; + float64_t y; + float64_t z; + uint16_t color_name_index; + uint16_t flags; + uint32_t packed_color; + uint32_t color_index; +*/ +} SOldVertexColor; + + +class OldVertexColorRecord : public PrimNodeRecord +{ + public: + OldVertexColorRecord(); + virtual Record* clone() const { return new OldVertexColorRecord(); } + virtual const char* className() const { return "OldVertexColorRecord"; } + virtual int classOpcode() const { return OLD_VERTEX_COLOR_OP; } + virtual int sizeofData() const { return sizeof(SOldVertexColor); } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + virtual SOldVertexColor* getData() const { return (SOldVertexColor*)_pData; } +// friend ostream& operator << (ostream& output, const OldVertexColorRecord& rec); + + protected: + virtual ~OldVertexColorRecord(); + + virtual void endian(); +}; + + +//////////////////////////////////////////////////////////////////// +// +// OldVertexColorNormalRecord +// +//////////////////////////////////////////////////////////////////// + +typedef struct OldVertexColorNormalTag +{ + SRecHeader RecHeader; + int32 Coord[3]; + uint16 swColor; // Color Name Index + uint16 swFlags; // Flags (bits, from left to right) + int16 Normal[3]; +} SOldVertexColorNormal; + + +class OldVertexColorNormalRecord : public PrimNodeRecord +{ + public: + OldVertexColorNormalRecord(); + virtual Record* clone() const { return new OldVertexColorNormalRecord(); } + virtual const char* className() const { return "OldVertexColorNormalRecord"; } + virtual int classOpcode() const { return OLD_VERTEX_COLOR_NORMAL_OP; } + virtual int sizeofData() const { return sizeof(SOldVertexColorNormal); } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + virtual SOldVertexColorNormal* getData() const { return (SOldVertexColorNormal*)_pData; } +// friend ostream& operator << (ostream& output, const OldVertexColorNormalRecord& rec); + + protected: + virtual ~OldVertexColorNormalRecord(); + + virtual void endian(); +}; + + +}; // end namespace flt + +#endif // __FLT_VERTEX_POOL_RECORDS_H diff --git a/src/osgPlugins/flt/Pool.cpp b/src/osgPlugins/flt/Pool.cpp new file mode 100644 index 000000000..56ac16970 --- /dev/null +++ b/src/osgPlugins/flt/Pool.cpp @@ -0,0 +1,150 @@ +// Pool.cpp + +#include +#include + +#include "Pool.h" + +using namespace flt; + +ColorPool::ColorPool() +{ +} + + +// virtual +ColorPool::~ColorPool() +{ + eraseAll(); +} + + +osg::Vec4 ColorPool::getColor(int nColorIndex) +{ + osg::Vec4 col(1,1,1,1); + + if (nColorIndex >= 0) + { + int index = nColorIndex / 128; + float intensity = (nColorIndex % 128) / 128.0f; + + ColorName* cn = getColorName(index); + if (cn) + col = cn->getColor(); + + col[0] *= intensity; + col[1] *= intensity; + col[2] *= intensity; + } + + return col; +} + + +void ColorPool::regisiterColor(int nIndex, const osg::Vec4& color) +{ + if (nIndex >= 0) + { + ColorName* colorname = new ColorName; + colorname->setColor(color); + + _colorNameMap[nIndex] = colorname; + } +} + + +ColorPool::ColorName* ColorPool::getColorName(int nIndex) +{ + ColorNameMap::iterator itr = _colorNameMap.find(nIndex); + if (itr != _colorNameMap.end()) + return (*itr).second; + + return NULL; +} + + +void ColorPool::eraseAll() +{ + for(ColorNameMap::iterator itr=_colorNameMap.begin(); + itr!=_colorNameMap.end(); + ++itr) + { + ColorName* colorname = (*itr).second; + if (colorname) + delete colorname; + } + _colorNameMap.erase(_colorNameMap.begin(), _colorNameMap.end()); +} + + +//////////////////////////////////////////////////////////////////// + + +TexturePool::TexturePool() +{ +} + + +// virtual +TexturePool::~TexturePool() +{ + eraseAll(); +} + + +osg::Texture* TexturePool::getTexture(int nIndex) +{ + TexturePaletteMap::iterator fitr = _textureMap.find(nIndex); + if (fitr != _textureMap.end()) + return (*fitr).second; + else + return NULL; +} + + +void TexturePool::regisiterTexture(int nIndex, osg::Texture* osgTexture) +{ + _textureMap[nIndex] = osgTexture; +} + + +void TexturePool::eraseAll() +{ + _textureMap.erase(_textureMap.begin(), _textureMap.end()); +} + + +//////////////////////////////////////////////////////////////////// + +MaterialPool::MaterialPool() +{ +} + + +// virtual +MaterialPool::~MaterialPool() +{ + eraseAll(); +} + + +SMaterial* MaterialPool::getMaterial(int nIndex) +{ + MaterialMap::iterator fitr = _MaterialMap.find(nIndex); + if (fitr != _MaterialMap.end()) + return (*fitr).second; + + return NULL; +} + + +void MaterialPool::regisiterMaterial(int nIndex, SMaterial* material) +{ + _MaterialMap[nIndex] = material; +} + + +void MaterialPool::eraseAll() +{ + _MaterialMap.erase(_MaterialMap.begin(), _MaterialMap.end()); +} diff --git a/src/osgPlugins/flt/Pool.h b/src/osgPlugins/flt/Pool.h new file mode 100644 index 000000000..95e74d0c9 --- /dev/null +++ b/src/osgPlugins/flt/Pool.h @@ -0,0 +1,93 @@ +// Pool.cpp + +#ifndef __FLT_POOL_H +#define __FLT_POOL_H + +#include +#include +#include +//#include + +#include +#include + + +namespace flt { + +struct SMaterial; + +class ColorPool +{ + +public: + ColorPool(); + virtual ~ColorPool(); + + osg::Vec4 getColor(int nColorIndex); + void regisiterColor(int nIndex, const osg::Vec4& color); + +private: + + class ColorName + { + public: + void setName( const std::string& name ) { _name = name; } + const std::string& getName( void ) { return _name; } + void setColor(const osg::Vec4& color ) { _color = color; } + osg::Vec4& getColor() { return _color; } + + private: + osg::Vec4 _color; + std::string _name; + }; + + void eraseAll(); + ColorName* getColorName(int nIndex); + + typedef std::mapColorNameMap; + ColorNameMap _colorNameMap; +}; + + +class TexturePool +{ +public: + + TexturePool(); + virtual ~TexturePool(); + + osg::Texture* getTexture(int nIndex); + void regisiterTexture(int nIndex, osg::Texture* osgTexture); + +private: + + void eraseAll(); + + typedef std::map TexturePaletteMap; + TexturePaletteMap _textureMap; +}; + + +class MaterialPool +{ +public: + + MaterialPool(); + virtual ~MaterialPool(); + + SMaterial* getMaterial(int nIndex); + void regisiterMaterial(int nIndex, SMaterial* material); + +private: + + void eraseAll(); + + typedef std::map MaterialMap; + MaterialMap _MaterialMap; +}; + + +}; // end namespace flt + +#endif + diff --git a/src/osgPlugins/flt/ReaderWriterFLT.cpp b/src/osgPlugins/flt/ReaderWriterFLT.cpp new file mode 100644 index 000000000..7f82c0b0b --- /dev/null +++ b/src/osgPlugins/flt/ReaderWriterFLT.cpp @@ -0,0 +1,41 @@ +// ReaderWriterFLT.cpp + +#ifdef WIN32 +#pragma warning( disable : 4786 ) +#endif + +#include "ReaderWriterFLT.h" +#include "FltFile.h" + +#include +#include +#include + + +using namespace flt; + + +osg::Object* ReaderWriterFLT::readObject(const std::string& fileName) +{ + FltFile read; + + return read.readObject(fileName); +} + + +osg::Node* ReaderWriterFLT::readNode(const std::string& fileName) +{ + FltFile read; + + return read.readNode(fileName); +} + + +// now register with Registry to instantiate the above +// reader/writer. +osg::RegisterReaderWriterProxy g_fltReaderWriterProxy; + + + + + diff --git a/src/osgPlugins/flt/ReaderWriterFLT.h b/src/osgPlugins/flt/ReaderWriterFLT.h new file mode 100644 index 000000000..755b641a6 --- /dev/null +++ b/src/osgPlugins/flt/ReaderWriterFLT.h @@ -0,0 +1,66 @@ + +// +// OpenFlight® loader for Open Scene Graph +// +// Copyright (C) 2000 Brede Johansen +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. +// +// The Open Scene Graph (OSG) is a cross platform C++/OpenGL library for +// real-time rendering of large 3D photo-realistic models. +// The OSG homepage is http://www.openscenegraph.org/ +// +// MultiGen, OpenFlight, and Flight Format are registered trademarks of MultiGen Inc. +// + +#ifndef __FLT_READER_WRITER_FLT_H +#define __FLT_READER_WRITER_FLT_H + + + +#include + +#include +#include +#include + +#include "export.h" + + +namespace flt { + + +class FLT_EXPORT ReaderWriterFLT : public osg::ReaderWriter +{ +public: + + virtual const char* className() { return "FLT Reader/Writer"; } + virtual bool acceptsExtension(const std::string& extension) { return extension=="flt"; } + + virtual bool writeObject(osg::Object& obj,const std::string& fileName) { return false; } + virtual bool writeNode(osg::Node& node,const std::string& fileName) { return false; } + + virtual osg::Object* readObject(const std::string& fileName); + virtual osg::Node* readNode(const std::string& fileName); +}; + + +}; // end namespace flt + +#endif // __FLT_CONTROL_RECORD_H + + diff --git a/src/osgPlugins/flt/Record.cpp b/src/osgPlugins/flt/Record.cpp new file mode 100644 index 000000000..80673ef1d --- /dev/null +++ b/src/osgPlugins/flt/Record.cpp @@ -0,0 +1,338 @@ +// Record.cpp + +#include +#include +#include + +#include + +#include "export.h" +#include "flt.h" +#include "Registry.h" +#include "Record.h" +#include "FltRecords.h" +#include "UnknownRecord.h" +#include "opcodes.h" +#include "Input.h" +#include "RecordVisitor.h" + +#ifdef OSG_USE_IO_DOT_H +#include +#else +#include +using namespace std; +#endif + + +using namespace flt; + + +//////////////////////////////////////////////////////////////////// +// +// Record +// +//////////////////////////////////////////////////////////////////// + + + +Record::Record() +{ + _pData = NULL; + _pParent = NULL; +} + + +Record::~Record() +{ + if (_pData) ::free(_pData); +} + +Record* Record::cloneRecord(SRecHeader* pData) +{ + Record* pRec = clone(); + + if (pRec->sizeofData() > pData->length()) + pData = (SRecHeader*)::realloc(pData, pRec->sizeofData()); + + pRec->_pData = (SRecHeader*)pData; + + return pRec; +} + + +void Record::accept(RecordVisitor& rv) +{ + rv.apply(*this); +} + +/* +void Record::ascend(RecordVisitor& rv) +{ + std::for_each(_parents.begin(),_parents.end(),RecordAcceptOp(rv)); +} +*/ + + +ostream& operator << (ostream& output, const Record& rec) +{ + output << rec.className() + << " op=" << rec.getOpcode() + << " size=" << rec.getSize(); + return output; // to enable cascading +} + + +//////////////////////////////////////////////////////////////////// +// +// PrimNodeRecord +// +//////////////////////////////////////////////////////////////////// + +PrimNodeRecord::PrimNodeRecord() +{ +} + + +// virtual +PrimNodeRecord::~PrimNodeRecord() +{ + removeAllChildren(); +} + + +// virtual +void PrimNodeRecord::accept(RecordVisitor& rv) +{ + rv.apply(*this); +} + + +// virtual +void PrimNodeRecord::traverse(RecordVisitor& rv) +{ + for(ChildList::iterator itr=_children.begin(); + itr!=_children.end(); + ++itr) + { + (*itr)->accept(rv); + } +} + + +void PrimNodeRecord::addChild( Record *child ) +{ + if (child==NULL) return; + + ChildList::iterator itr = std::find(_children.begin(),_children.end(),child); + if (itr==_children.end()) + { + + // add child to group. + _children.push_back(child); + + // register as parent of child. +#if 0 +// child->_parents.push_back(this); +#else + child->_pParent = this; +#endif + } +} + + +void PrimNodeRecord::removeChild( Record *child ) +{ + if (child==NULL) return; + + ChildList::iterator itr = std::find(_children.begin(),_children.end(),child); + if (itr!=_children.end()) + { + _children.erase(itr); + +// ParentList::iterator pitr = std::find(child->_parents.begin(),child->_parents.end(),child); +// if (pitr!=child->_parents.end()) child->_parents.erase(pitr); + } +} + + +void PrimNodeRecord::removeAllChildren() +{ + _children.erase(_children.begin(),_children.end()); +} + + +bool PrimNodeRecord::readExtensions(Input& fr) +{ + Record* pRec; + + while ((pRec=readNextRecord(fr))) + { + if (pRec->isOfType(POP_EXTENSION_OP)) return true; + // ignore extensions for now + } + return false; +} + + +bool PrimNodeRecord::readLevel(Input& fr) +{ + Record* pRec; + + while ((pRec=readNextRecord(fr))) + { + if (pRec->isOfType(POP_LEVEL_OP)) return true; + if (!pRec->isPrimaryNode()) + { + osg::notify(osg::WARN) << "Non primary record found as child. op="; + osg::notify(osg::WARN) << pRec->getOpcode() << endl; + return false; + } + addChild(pRec); + + if (!((PrimNodeRecord*)pRec)->readLocalData(fr)) + return false; + } + return false; +} + + +Record* PrimNodeRecord::readNextRecord(Input& fr) +{ + Record* pRec; + + while ((pRec=fr.readCreateRecord())) + { + switch (pRec->getOpcode()) + { + case PUSH_EXTENSION_OP: + readExtensions(fr); + break; + case PUSH_LEVEL_OP: + readLevel(fr); + break; + default: + return pRec; + } + } + return pRec; +} + + +// virtual +bool PrimNodeRecord::readLocalData(Input& fr) +{ + Record* pRec; + + while ((pRec=readNextRecord(fr))) + { +// if (pRec->isOfType(PUSH_LEVEL_OP)) +// return true; + if (!pRec->isAncillaryRecord()) + return fr.rewindLast(); + + addChild(pRec); + } + return false; +} + + +/* +// virtual +bool PrimNodeRecord::readLocalData(Input& fr) +{ + Record* pRec; + int until_op = 0; + + // + // read ancillary records + // + + while (pRec=fr.readCreateRecord()) + { + // read extension records + if (pRec->isOfType(PUSH_EXTENSION_OP)) + { + while (pRec=fr.readCreateRecord()) + { + if (pRec->isOfType(POP_EXTENSION_OP)) + { + pRec=fr.readCreateRecord(); + break; + } + }; + } + + + + + if (!pRec->isAncillaryRecord()) + break; + + addChild(pRec); + }; +// if (pRec == NULL) return false; + + if (pRec == NULL) return false; + + + if (pRec->getOpcode() != PUSH_LEVEL_OP) + { +// if (pRec->isPrimaryNode()) + return fr.rewindLast(); + +// osg::notify(osg::INFO) << "Missing PUSH_LEVEL_OP" << endl; +// return false; + } + + // + // read primary node records + // + + while (pRec=fr.readCreateRecord()) + { + if (pRec->getOpcode() == POP_LEVEL_OP) return true; + + if (pRec->isPrimaryNode()) + { + addChild(pRec); + + if (!((PrimNodeRecord*)pRec)->readLocalData(fr)) + return false; + } + } + + if (pRec == NULL) + return false; + + return true; +} +*/ + + +//////////////////////////////////////////////////////////////////// +// +// ControlRecord +// +//////////////////////////////////////////////////////////////////// + + +// virtual +void ControlRecord::accept(RecordVisitor& rv) +{ + rv.apply(*this); +} + +//////////////////////////////////////////////////////////////////// +// +// AncillaryRecord +// +//////////////////////////////////////////////////////////////////// + +// virtual +void AncillaryRecord::accept(RecordVisitor& rv) +{ + rv.apply(*this); +} + + + diff --git a/src/osgPlugins/flt/Record.h b/src/osgPlugins/flt/Record.h new file mode 100644 index 000000000..32a9e0631 --- /dev/null +++ b/src/osgPlugins/flt/Record.h @@ -0,0 +1,239 @@ +#ifndef __FLT_RECORD_H +#define __FLT_RECORD_H + +#include +#include + +#include + +#include "FltRecords.h" + +#ifdef OSG_USE_IO_DOT_H +#include +#else +#include +using namespace std; +#endif + + +namespace flt { + +class Record; +class Input; +class RecordVisitor; +class FltFile; +class PrimNodeRecord; +class FaceRecord; + + +//////////////////////////////////////////////////////////////////// +// +// Record +// +//////////////////////////////////////////////////////////////////// + +class Record : public osg::Referenced +{ + public: + + Record(); + + virtual Record* clone() const = 0; + Record* cloneRecord(SRecHeader* pData); + + virtual const char* className() const { return "Record"; } //const = 0; + virtual int classOpcode() const { return 0; } //const = 0; + virtual int sizeofData() const { return 0; } //const = 0; + virtual void accept(RecordVisitor& rv); + virtual void traverse(RecordVisitor&) {} + + virtual const std::string getName( void ) const { return std::string("?"); } + + virtual bool isPrimaryNode() const { return false; } + virtual bool isControlRecord() const { return false; } + virtual bool isAncillaryRecord() const { return false; } + virtual void endian(){} + + int getRecordType() const; + + SRecHeader* getData() const; + void* getBody() const; + int getOpcode() const; + int getSize() const; + int getHeaderLength() const; + int getBodyLength() const; + bool isOfType(int op) const; + Record* getParent() const { return _pParent; } + + friend ostream& operator << (ostream& output, const Record& rec); + + protected: + + /** disallow creation of Records on the stack.*/ + virtual ~Record(); + + + /** Template Method local read and write methods */ + virtual bool readLocalData(Input& /*fr*/) { return false; } +// virtual bool writeLocalData(Output& fw) { return false; } + + SRecHeader* _pData; + Record* _pParent; + + friend FltFile; + friend PrimNodeRecord; + + private: + + /** disallow copy */ + Record& operator = (const Record&) { return *this;} + Record(const Record&) : osg::Referenced() {} + +}; + + + +inline +SRecHeader* Record::getData() const +{ + return _pData; +} + + +inline +void* Record::getBody() const +{ + return (_pData) ? _pData+1 : NULL; +} + + +inline +int Record::getOpcode() const +{ + return (_pData) ? _pData->opcode() : 0; +} + +inline +int Record::getSize() const +{ + return (_pData) ? _pData->length() : 0; +} + +inline +int Record::getHeaderLength() const +{ + return sizeof(SRecHeader); +} + +inline +int Record::getBodyLength() const +{ + return getSize() - getHeaderLength(); +} + +inline +bool Record::isOfType(int op) const +{ + return (op == getOpcode()); +} + + + +//////////////////////////////////////////////////////////////////// +// +// PrimNodeRecord +// +//////////////////////////////////////////////////////////////////// + + +class PrimNodeRecord : public Record +{ + public: + PrimNodeRecord(); + virtual bool isPrimaryNode() const { return true; } + virtual void accept(RecordVisitor& rv); + virtual void traverse(RecordVisitor& rv); + + void addChild( Record* child ); + void removeChild( Record* child ); + void removeAllChildren(); + int getNumChildren( void ) { return _children.size(); } + Record* getChild( int i ) { return _children[i].get(); } + + protected: + + /** disallow creation of PrimNodeRecords on the stack.*/ + virtual ~PrimNodeRecord(); + + virtual bool readLocalData(Input& fr); + + private: + bool readExtensions(Input& fr); + bool readLevel(Input& fr); + Record* readNextRecord(Input& fr); + + typedef std::vector > ChildList; + ChildList _children; + + friend FaceRecord; +}; + + +//////////////////////////////////////////////////////////////////// +// +// ControlRecord +// +//////////////////////////////////////////////////////////////////// + +class ControlRecord : public Record +{ + public: + +// ControlRecord(); + virtual bool isControlRecord() const { return true; } + virtual void accept(RecordVisitor& rv); +// virtual void traverse(RecordVisitor& rv); + + + protected: + + /** disallow creation of ControlRecord on the stack.*/ +// virtual ~ControlRecord(); + + virtual bool readLocalData(Input& /*fr*/) { return true; } +}; + + +//////////////////////////////////////////////////////////////////// +// +// AncillaryRecord +// +//////////////////////////////////////////////////////////////////// + +class AncillaryRecord : public Record +{ + public: + +// AncillaryRecord(); + virtual bool isAncillaryRecord() const { return true; } + virtual void accept(RecordVisitor& rv); +// virtual void traverse(RecordVisitor& rv); + + protected: + + /** disallow creation of AncillaryRecord on the stack.*/ +// virtual ~AncillaryRecord(); + + virtual bool readLocalData(Input& /*fr*/) { return true; } +}; + +//////////////////////////////////////////////////////////////////// + + + +}; // end namespace flt + +#endif // __FLT_RECORD_H + + + diff --git a/src/osgPlugins/flt/RecordVisitor.cpp b/src/osgPlugins/flt/RecordVisitor.cpp new file mode 100644 index 000000000..9c74547ca --- /dev/null +++ b/src/osgPlugins/flt/RecordVisitor.cpp @@ -0,0 +1,42 @@ +// RecordVisitor.cpp + +#include "RecordVisitor.h" +#include + +using namespace flt; + +RecordVisitor::RecordVisitor(TraversalMode tm) +{ + _traverseVisitor = NULL; + _traverseMode = tm; +} + +RecordVisitor::~RecordVisitor() +{ + // if (_traverseVisitor) detach from _traverseVisitor; +} + +void RecordVisitor::setTraverseMode(TraversalMode mode) +{ + if (_traverseMode==mode) return; + if (mode==TRAVERSE_VISITOR) + { + if (_traverseVisitor==NULL) _traverseMode = TRAVERSE_NONE; + else _traverseMode = TRAVERSE_VISITOR; + } + else + { + if (_traverseVisitor) _traverseVisitor=NULL; + _traverseMode = mode; + } +} + +void RecordVisitor::setTraverseVisitor(RecordVisitor* rv) +{ + if (_traverseVisitor==rv) return; + // if (_traverseVisitor) detach from _traverseVisitor; + _traverseVisitor = rv; + if (_traverseVisitor) _traverseMode = TRAVERSE_VISITOR; + else _traverseMode = TRAVERSE_NONE; + // attach to _traverseVisitor; +} diff --git a/src/osgPlugins/flt/RecordVisitor.h b/src/osgPlugins/flt/RecordVisitor.h new file mode 100644 index 000000000..00e27e229 --- /dev/null +++ b/src/osgPlugins/flt/RecordVisitor.h @@ -0,0 +1,161 @@ +// RecordVisitor.h + +#ifndef __FLT_RECORD_VISITOR_H +#define __FLT_RECORD_VISITOR_H + +#include "Record.h" + +namespace flt { + +// Palette records +class ColorPaletteRecord; +class MaterialPaletteRecord; +class LightSourcePaletteRecord; +class TexturePaletteRecord; +class VertexPaletteRecord; +class VertexRecord; +class NormalVertexRecord; +class TextureVertexRecord; +class NormalTextureVertexRecord; + +// Primary records +class HeaderRecord; +class GroupRecord; +class LodRecord; +class OldLodRecord; +class DofRecord; +class ObjectRecord; +class FaceRecord; +class VertexListRecord; +class MorphVertexListRecord; +class LightSourceRecord; +class LightPointRecord; +class SwitchRecord; +class ExtensionRecord; +class ExternalRecord; + +// Ancillary records +class CommentRecord; +class LongIDRecord; +class VectorRecord; + +// Transformation records (ancillary) +class MatrixRecord; +class RotatAboutEdgeRecord; +class TranslateRecord; +class ScaleRecord; +class RotatAboutPointRecord; +class RotatScaleToPointRecord; +class PutTransformRecord; +class GeneralMatrixRecord; + + +/** Visitor for type safe operations on flt::Record's. + Based on GOF's Visitor pattern.*/ +class RecordVisitor +{ + public: + + enum TraversalMode { + TRAVERSE_NONE, +// TRAVERSE_PARENTS, + TRAVERSE_ALL_CHILDREN, + TRAVERSE_ACTIVE_CHILDREN, + TRAVERSE_VISITOR + }; + + RecordVisitor(TraversalMode tm=TRAVERSE_NONE); + virtual ~RecordVisitor(); + + + /** Set the traversal mode for Node::traverse() to use when + deciding which children of a node to traverse. If a + NodeVisitor has been attached via setTraverseVisitor() + and the new mode is not TRAVERSE_VISITOR then the attached + visitor is detached. Default mode is TRAVERSE_NONE.*/ + void setTraverseMode(TraversalMode mode); + /** Get the traversal mode.*/ + TraversalMode getTraverseMode() { return _traverseMode; } + /** Set a visitor to handle traversal. + Overides the traverse mode setting it to TRAVERSE_VISITOR.*/ + + void setTraverseVisitor(RecordVisitor* rv); + /** Get the traverse visitor, returns NULL if none is attached.*/ + RecordVisitor* getTraverseVisitor() { return _traverseVisitor; } + + /** Inline method for passing handling traversal of a nodes. + If you intend to use the visitor for actively traversing + the scene graph then make sure the accept() methods call + this method unless they handle traversal directly.*/ + void traverse(Record& rec) + { + if (_traverseVisitor) rec.accept(*_traverseVisitor); +// else if (_traverseMode==TRAVERSE_PARENTS) rec.ascend(*this); + else if (_traverseMode!=TRAVERSE_NONE) rec.traverse(*this); + } + + virtual void apply(Record& rec) { traverse(rec);} + virtual void apply(PrimNodeRecord& rec) { apply((Record&)rec);} + + + // Palette records + virtual void apply(ColorPaletteRecord& rec) { apply((Record&)rec); } + virtual void apply(MaterialPaletteRecord& rec) { apply((Record&)rec); } + virtual void apply(LightSourcePaletteRecord& rec) { apply((Record&)rec); } + virtual void apply(TexturePaletteRecord& rec) { apply((Record&)rec); } + virtual void apply(VertexPaletteRecord& rec) { apply((Record&)rec); } + virtual void apply(VertexRecord& rec) { apply((Record&)rec); } + virtual void apply(NormalVertexRecord& rec) { apply((Record&)rec); } + virtual void apply(TextureVertexRecord& rec) { apply((Record&)rec); } + virtual void apply(NormalTextureVertexRecord& rec) { apply((Record&)rec); } + + // Primary records + virtual void apply(HeaderRecord& rec) { apply((PrimNodeRecord&)rec); } + virtual void apply(GroupRecord& rec) { apply((PrimNodeRecord&)rec); } + virtual void apply(LodRecord& rec) { apply((PrimNodeRecord&)rec); } + virtual void apply(OldLodRecord& rec) { apply((PrimNodeRecord&)rec); } + virtual void apply(DofRecord& rec) { apply((PrimNodeRecord&)rec); } + virtual void apply(ObjectRecord& rec) { apply((PrimNodeRecord&)rec); } + virtual void apply(FaceRecord& rec) { apply((PrimNodeRecord&)rec); } + virtual void apply(VertexListRecord& rec) { apply((PrimNodeRecord&)rec); } + virtual void apply(MorphVertexListRecord& rec) { apply((PrimNodeRecord&)rec); } + virtual void apply(LightSourceRecord& rec) { apply((PrimNodeRecord&)rec); } + virtual void apply(LightPointRecord& rec) { apply((PrimNodeRecord&)rec); } + virtual void apply(SwitchRecord& rec) { apply((PrimNodeRecord&)rec); } + virtual void apply(ExtensionRecord& rec) { apply((PrimNodeRecord&)rec); } + virtual void apply(ExternalRecord& rec) { apply((PrimNodeRecord&)rec); } + + // Ancillary records + virtual void apply(CommentRecord& rec) { apply((Record&)rec); } + virtual void apply(LongIDRecord& rec) { apply((Record&)rec); } + virtual void apply(VectorRecord& rec) { apply((Record&)rec); } + + // Transformation records (ancillary) + virtual void apply(MatrixRecord& rec) { apply((Record&)rec); } + virtual void apply(RotatAboutEdgeRecord& rec) { apply((Record&)rec); } + virtual void apply(TranslateRecord& rec) { apply((Record&)rec); } + virtual void apply(ScaleRecord& rec) { apply((Record&)rec); } + virtual void apply(RotatAboutPointRecord& rec) { apply((Record&)rec); } + virtual void apply(RotatScaleToPointRecord& rec) { apply((Record&)rec); } + virtual void apply(PutTransformRecord& rec) { apply((Record&)rec); } + virtual void apply(GeneralMatrixRecord& rec) { apply((Record&)rec); } + + protected: + + RecordVisitor* _traverseVisitor; + TraversalMode _traverseMode; + +}; + + +/** Convinience functor for assisting visiting of arrays of flt::Records's.*/ +struct RecordAcceptOp +{ + RecordVisitor& _rv; + RecordAcceptOp(RecordVisitor& rv):_rv(rv) {} + void operator () (Record* rec) { rec->accept(_rv); } +}; + +}; + +#endif diff --git a/src/osgPlugins/flt/Registry.cpp b/src/osgPlugins/flt/Registry.cpp new file mode 100644 index 000000000..9e907332f --- /dev/null +++ b/src/osgPlugins/flt/Registry.cpp @@ -0,0 +1,108 @@ + +#include "osg/Node" +#include "osg/Group" +#include "osg/Output" +#include + +#include +#include + +#include "Record.h" +#include "Input.h" +#include "Registry.h" + +#ifdef OSG_USE_IO_DOT_H +//#include +#else +#include +using namespace std; +#endif + +#include + + +using namespace flt; + +// definition of the Registry +Registry::Registry() +{ + osg::notify(osg::INFO) << "Constructing flt record flt::Registry\n"; +} + + +Registry::~Registry() +{ + + osg::notify(osg::INFO) << "Destructing flt flt::Registry"<< endl; + + // note, do not need to unrefence records as the combination of + // std::vector and ref_ptr will do it automatical on destruction. +} + + +Registry* Registry::instance() +{ + static Registry s_nodeFactory; + return &s_nodeFactory; +} + + +void Registry::addPrototype(Record* rec) +{ + if (rec==0L) return; + + osg::notify(osg::INFO) << "flt::Registry::addPrototype("<< rec->className()<<")\n"; + + RecordProtoList::iterator pitr = std::find(_recordProtoList.begin(),_recordProtoList.end(),rec); + if (pitr==_recordProtoList.end()) + { + _recordProtoList.push_back(rec); + } + else + { + osg::notify(osg::INFO) << " failed - flt::Registry::addPrototype() - prototype already exists"<<")\n"; + } + + rec->ref(); +} + + +void Registry::removePrototype(Record* rec) +{ + if (rec==0L) return; + + osg::notify(osg::INFO) << "flt::Registry::removePrototype("<className()<<")\n"; + + RecordProtoList::iterator pitr = std::find(_recordProtoList.begin(),_recordProtoList.end(),rec); + if (pitr!=_recordProtoList.end()) + { + _recordProtoList.erase(pitr); + } + +} + + +Registry::RecordProtoList::iterator Registry::getRecordProtoItr(const int opcode) +{ + for(RecordProtoList::iterator itr=_recordProtoList.begin(); + itr!=_recordProtoList.end(); + ++itr) + { + if ((*itr)->classOpcode() == opcode) + return itr; + } + + return _recordProtoList.end(); +} + + + +Record* Registry::getRecordProto(const int opcode) +{ + RecordProtoList::iterator itr = getRecordProtoItr(opcode); + if (itr==_recordProtoList.end()) + return NULL; + + return itr->get(); +} + diff --git a/src/osgPlugins/flt/Registry.h b/src/osgPlugins/flt/Registry.h new file mode 100644 index 000000000..0f8f2d1ed --- /dev/null +++ b/src/osgPlugins/flt/Registry.h @@ -0,0 +1,94 @@ +#ifndef __FLT_REGISTRY_H +#define __FLT_REGISTRY_H + +#include +#include + +#include "osg/Referenced" + +namespace osg { +class Node; +}; + +namespace flt { + +// forward declare referenced classes to help avoid mutiple includes +class Record; +class Input; + + +/** + Registry is a singleton factory which stores + the Objects types available at runtime for loading, + and any Object reader or writers which are linked in + at runtime for reading non-native file formats. + + The RegisterObjectProxy defined in Object.h can be + used to automatically register at runtime a Object + with the Registry. + + The RegisterReaderWriterProxy defined in ReaderWriter.h can + be used to automatically register at runtime a reader/writer + with the Registry. +*/ + +class Registry +{ + public: + + ~Registry(); + + static Registry* instance(); + + void addPrototype(Record* rec); + void removePrototype(Record* rec); + + Record* getRecordProto(const int opcode); +// bool apply(Record& rec); +// Record* readRecord(Input& fr); +// osg::Node* readNode(Input& fr); + + private: + + typedef std::vector > RecordProtoList; + + /** constructor is private, as its a singleton, preventing + construction other than via the instance() method and + therefore ensuring only one copy is ever constructed*/ + Registry(); + + RecordProtoList::iterator getRecordProtoItr(const int opcode); + + RecordProtoList _recordProtoList; +}; + + +/** Proxy class for automatic registration of reader/writers with the + Registry.*/ +template +class RegisterRecordProxy +{ + public: + RegisterRecordProxy() + { + _obj = new T; + _obj->ref(); + Registry::instance()->addPrototype(_obj); + } + ~RegisterRecordProxy() + { + //commented out to prevent seg fault under Linux + //due to the registry being previously destructed. + //Registry::instance()->removePrototype(_obj); + _obj->unref(); + } + + protected: + T* _obj; +}; + + + +}; // end namespace flt + +#endif // __FLT_REGISTRY_H diff --git a/src/osgPlugins/flt/SwitchRecord.cpp b/src/osgPlugins/flt/SwitchRecord.cpp new file mode 100644 index 000000000..ba61207d6 --- /dev/null +++ b/src/osgPlugins/flt/SwitchRecord.cpp @@ -0,0 +1,42 @@ +// SwitchRecord.cpp + + +#include "flt.h" +#include "Registry.h" +#include "SwitchRecord.h" + +using namespace flt; + +//////////////////////////////////////////////////////////////////// +// +// SwitchRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_SwitchProxy; + + +SwitchRecord::SwitchRecord() +{ +} + + +// virtual +SwitchRecord::~SwitchRecord() +{ +} + + +void SwitchRecord::endian() +{ + SSwitch *pSSwitch = (SSwitch*)getData(); + + ENDIAN( pSSwitch->dwCurrentMask ); + ENDIAN( pSSwitch->diWordsInMask ); + ENDIAN( pSSwitch->diMasks ); +} + + + + + diff --git a/src/osgPlugins/flt/SwitchRecord.h b/src/osgPlugins/flt/SwitchRecord.h new file mode 100644 index 000000000..d5763455a --- /dev/null +++ b/src/osgPlugins/flt/SwitchRecord.h @@ -0,0 +1,53 @@ +// SwitchRecord.h + +#ifndef __FLT_SWITCH_RECORD_H +#define __FLT_SWITCH_RECORD_H + + +#include "opcodes.h" +#include "Record.h" +#include "RecordVisitor.h" + + +namespace flt { + +struct SSwitch +{ + SRecHeader RecHeader; + char szIdent[8]; // // 7 char ASCII ID; 0 terminates + uint8 reserved[4]; // Reserved + uint32 dwCurrentMask; // Current mask + int32 diWordsInMask; // Number of 32 bit words required for each mask + // (number of children / 32 + number of children modulo 32) + int32 diMasks; // Number of masks +// ??? Mask[1]; // Variable Mask words + // (length = number of words per mask * number of masks * 4 bytes) +}; + + +class SwitchRecord : public PrimNodeRecord +{ + public: + SwitchRecord(); + + virtual Record* clone() const { return new SwitchRecord(); } + virtual const char* className() const { return "SwitchRecord"; } + virtual int classOpcode() const { return SWITCH_OP; } + virtual int sizeofData() const { return sizeof(SSwitch); } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + SSwitch* getData() const { return (SSwitch*)_pData; } + + protected: + virtual ~SwitchRecord(); + + virtual void endian(); +}; + + + +}; // end namespace flt + +#endif + diff --git a/src/osgPlugins/flt/TextureMappingPaletteRecord.cpp b/src/osgPlugins/flt/TextureMappingPaletteRecord.cpp new file mode 100644 index 000000000..011b86beb --- /dev/null +++ b/src/osgPlugins/flt/TextureMappingPaletteRecord.cpp @@ -0,0 +1,55 @@ +// TextureMappingPaletteRecord.cpp + +#include "flt.h" +#include "Registry.h" +#include "TextureMappingPaletteRecord.h" + +using namespace flt; + + +//////////////////////////////////////////////////////////////////// +// +// TextureMappingPaletteRecord +// +//////////////////////////////////////////////////////////////////// + + +RegisterRecordProxy g_TextureMappingPaletteProxy; + + +TextureMappingPaletteRecord::TextureMappingPaletteRecord() +{ +} + + +// virtual +TextureMappingPaletteRecord::~TextureMappingPaletteRecord() +{ +} + + +// virtual +void TextureMappingPaletteRecord::endian() +{ + STextureMapping *pSMapping = (STextureMapping*)getData(); + + if (pSMapping) + { + ENDIAN( pSMapping->diIndex ); + ENDIAN( pSMapping->diType ); + ENDIAN( pSMapping->diWarpFlag ); + + for(int i=0;i<4;++i) + { + for(int j=0;j<4;++j) + { + ENDIAN( pSMapping->dfMat[i][j] ); + } + } + } +} + + + + + diff --git a/src/osgPlugins/flt/TextureMappingPaletteRecord.h b/src/osgPlugins/flt/TextureMappingPaletteRecord.h new file mode 100644 index 000000000..22e6e80cf --- /dev/null +++ b/src/osgPlugins/flt/TextureMappingPaletteRecord.h @@ -0,0 +1,195 @@ +// TextureMappingPaletteRecord.h + +#ifndef __FLT_TEXTURE_MAPPING_PALETTE_RECORD_H +#define __FLT_TEXTURE_MAPPING_PALETTE_RECORD_H + + +#include "opcodes.h" +#include "Record.h" +#include "RecordVisitor.h" + + +namespace flt { + + +struct STextureMapping +{ + SRecHeader RecHeader; + float32 reserved; // Reserved + int32 diIndex; // Texture mapping index + char szName[20]; // Texture mapping name + int32 diType; // Texture mapping type + // 0 = None + // 1 = Put + // 2 = 4 Point Put + // 3 = Reserved + // 4 = Spherical Project + // 5 = Radial Project + // 6 = Reserved + int32 diWarpFlag; // Warped flag; if TRUE, 8 point warp applied + float64 dfMat[4][4]; // Transformation matrix (valid only for Types 1 & 2) +// Variable Variable; // Parameters (see below for parameters for each mapping type) + + +#if 0 +// Parameters for Put Texture Mapping (Type 1) + uint32 dwState; // State of Put Texture tool + // 0 = Start state - no points entered + // 1 = One point entered + // 2 = Two points entered + // 3 = Three points entered + int32 active; // Active geometry point + // 1 = Origin point + // 2 = Alignment point + // 3 = Shear point + float64x3 lower_left; // lower-left corner of bounding box + float64x3 upper_right; // upper-right corner of bounding box + int32 sizeFlags[3]; // Use real world size flags for each of the three put points + float64x3 dfTxtOrigin; // Texture origin point + float64x3 dfTxtAlignment; // Texture alignment point + float64x3 dfTxtShear; // Texture shear point + float64x3 dfGeoOrigin; // Geometry origin point + float64x3 dfGeoAlignmentM // Geometry alignment point + float64x3 dfGeoShear; // Geometry shear point + int32 TxtActive; // Active texture point + // 1 = Origin point + // 2 = Alignment point + // 3 = Shear point + int32 Reserved; // should always be set to 1 +// Variable Variable; // Parameters (see parameters below for each mapping type) + + +//Parameters for 4 Point Put Texture Mapping (Type 2) + int32 state; // State of Put Texture tool + // 0 = Start state - no points entered + // 1 = One point entered + // 2 = Two points entered + // 3 = Three points entered + // 4 = Four points entered + int32 active; // Active geometry point + // 1 = Origin point + // 2 = Alignment point + // 3 = Shear point + // 4 = Perspective point + float64x3 lower_left; // lower-left corner of bounding box + float64x3 upper_right; // upper-right corner of bounding box + int32 sizeFlags[4]; // Use real world size flags for each of the four put points + float64x3 dfTxtOrigin; // Texture origin point + float64x3 dfTxtAlignment; // Texture alignment point + float64x3 dfTxtShear; // Texture shear point + float64x3 dfTxtPerspective; // Texture perspective point + float64x3 dfGeoOrigin; // Geometry origin point + float64x3 dfGeoAlignment; // Geometry alignment point + float64x3 dfGeoShear; // Geometry shear point + float64x3 dfGeoPerspective; // Geometry perspective point + + int32 TxtActive; // Active texture point + // 1 = Origin point + // 2 = Alignment point + // 3 = Shear point + // 4 = Perspective point + int32 Reserved; // should always be set to 1 + float32 sfScale; // Depth scale factor + float64 dfMat[4][4]; // Transformation matrix for the 4 point projection plane + + + +// Parameters for Spherical Project Mapping (Type 4) + float32 sfScale; // Scale + float64x3 Center; // Center of the projection sphere + float32 sfScale; // Scale / (maximum dimension of the mapped geometry + // bounding box) + float32 sfMaxDimension; // Maximum dimension of the mapped geometry + // bounding box + + +// Parameters for Radial Project Mapping (Type 5) + int32 active // Active geometry point + // 1 = End point 1 of cylinder center line + // 2 = End point 2 of cylinder center line + int32 reserved; // Reserved + float32 sfRadialScale; // Radial scale + float32 sfLengthScale; // Scale along length of cylinder + float64 dfMat[4][4]; // Trackplane to XY plane transformation matrix + float64x3 endpoint1; // End point 1 of cylinder center line + float64x3 endpoint2; // End point 2 of cylinder center line + +// Parameters for Warped Mapping (Warped Flag Set) + int32 active; // Active geometry point + // 0 = First warp FROM point + // 1 = Second warp FROM point + // 2 =Third warp FROM point + // 3 = Fourth warp FROM point + // 4 = Fifth warp FROM point + // 5 = Sixth warp FROM point + // 6 = Seventh warp FROM point + // 7 = Eighth warp FROM point + // 8 = First warp TO point + // 9 = Second warp TO point + // 10 = Third warp TO point + // 11 = Fourth warp TO point + // 12 = Fifth warp TO point + // 13 = Sixth warp TO point + // 14 = Seventh warp TO point + // 15 = Eighth warp TO point + int32 warpState; // Warp tool state + // 0 = Start state - no points entered + // 1 = One FROM point entered + // 2 = Two FROM point entered + // 3 = Three FROM point entered + // 4 = Four FROM point entered + // 5 = Five FROM point entered + // 6 = Six FROM point entered + // 7 = Seven FROM point entered + // 8 = All FROM point entered + float64 dfMat[4][4]; // Trackplane to XY plane transformation matrix +/* + Double 16*2 x, y of the first FROM point transformed to the XY plane by the above matrix + Double 16*2 x, y of the second FROM point transformed to the XY plane by the above matrix + Double 16*2 x, y of the third FROM point transformed to the XY plane by the above matrix + Double 16*2 x, y of the fourth FROM point transformed to the XY plane by the above matrix + Double 16*2 x, y of the fifth FROM point transformed to the XY plane by the above matrix + Double 16*2 x, y of the sixth FROM point transformed to the XY plane by the above matrix + Double 16*2 x, y of the seventh FROM point transformed to the XY plane by the above matrix + Double 16*2 x, y of the eighth FROM point transformed to the XY plane by the above matrix + Double 16*2 x, y of the first TO point transformed to the XY plane by the above matrix + Double 16*2 x, y of the second TO point transformed to the XY plane by the above matrix + Double 16*2 x, y of the third TO point transformed to the XY plane by the above matrix + Double 16*2 x, y of the fourth TO point transformed to the XY plane by the above matrix + Double 16*2 x, y of the fifth TO point transformed to the XY plane by the above matrix + Double 16*2 x, y of the sixth TO point transformed to the XY plane by the above matrix + Double 16*2 x, y of the seventh TO point transformed to the XY plane by the above matrix + Double 16*2 x, y of the eighth TO point transformed to the XY plane by the above matrix +*/ +#endif +}; + + +class TextureMappingPaletteRecord : public AncillaryRecord +{ + public: + + TextureMappingPaletteRecord(); + + virtual Record* clone() const { return new TextureMappingPaletteRecord(); } + virtual const char* className() const { return "TextureMappingPaletteRecord"; } + virtual int classOpcode() const { return TEXTURE_MAPPING_PALETTE_OP; } + virtual int sizeofData() const { return sizeof(STextureMapping); } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + protected: + + virtual ~TextureMappingPaletteRecord(); + + virtual void endian(); + +// virtual bool readLocalData(Input& fr); +// virtual bool writeLocalData(Output& fw); + +}; + + +}; // end namespace flt + +#endif diff --git a/src/osgPlugins/flt/TexturePaletteRecord.cpp b/src/osgPlugins/flt/TexturePaletteRecord.cpp new file mode 100644 index 000000000..7bb46d15f --- /dev/null +++ b/src/osgPlugins/flt/TexturePaletteRecord.cpp @@ -0,0 +1,44 @@ +// TexturePaletteRecord.cpp + +#include "flt.h" +#include "Registry.h" +#include "TexturePaletteRecord.h" + +using namespace flt; + + +//////////////////////////////////////////////////////////////////// +// +// TexturePaletteRecord +// +//////////////////////////////////////////////////////////////////// + + +RegisterRecordProxy g_TexturePaletteProxy; + + +TexturePaletteRecord::TexturePaletteRecord() +{ +} + + +// virtual +TexturePaletteRecord::~TexturePaletteRecord() +{ +} + + +// virtual +void TexturePaletteRecord::endian() +{ + STexturePalette *pSTexture = (STexturePalette*)getData(); + + ENDIAN( pSTexture->diIndex ); + ENDIAN( pSTexture->diX ); + ENDIAN( pSTexture->diY ); +} + + + + + diff --git a/src/osgPlugins/flt/TexturePaletteRecord.h b/src/osgPlugins/flt/TexturePaletteRecord.h new file mode 100644 index 000000000..65f373ebd --- /dev/null +++ b/src/osgPlugins/flt/TexturePaletteRecord.h @@ -0,0 +1,50 @@ +// TexturePaletteRecord.h + +#ifndef __FLT_TEXTURE_PALETTE_RECORD_H +#define __FLT_TEXTURE_PALETTE_RECORD_H + + +#include "opcodes.h" +#include "Record.h" +#include "RecordVisitor.h" + + +namespace flt { + + +typedef struct TexturePaletteTag +{ + SRecHeader RecHeader; + char szFilename[200]; // Filename of texture pattern + int32 diIndex; // Pattern index + int32 diX; // x location in texture palette + int32 diY; // y location in texture palette +} STexturePalette; + + +class TexturePaletteRecord : public AncillaryRecord +{ + public: + + TexturePaletteRecord(); + + virtual Record* clone() const { return new TexturePaletteRecord(); } + virtual const char* className() const { return "TexturePaletteRecord"; } + virtual int classOpcode() const { return TEXTURE_PALETTE_OP; } + virtual int sizeofData() const { return sizeof(STexturePalette); } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + protected: + + virtual ~TexturePaletteRecord(); + + virtual void endian(); +}; + + +}; // end namespace flt + +#endif + + diff --git a/src/osgPlugins/flt/TransformationRecords.cpp b/src/osgPlugins/flt/TransformationRecords.cpp new file mode 100644 index 000000000..1fc58cdc6 --- /dev/null +++ b/src/osgPlugins/flt/TransformationRecords.cpp @@ -0,0 +1,253 @@ +// TransformationRecords.cpp + + +#include "flt.h" +#include "Registry.h" +#include "TransformationRecords.h" + +using namespace flt; + + +//////////////////////////////////////////////////////////////////// +// +// MatrixRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_MatrixProxy; + + +MatrixRecord::MatrixRecord() +{ +} + + +// virtual +MatrixRecord::~MatrixRecord() +{ +} + + +// virtual +void MatrixRecord::endian() +{ + SMatrix* pSMatrix = (SMatrix*)getData(); + + if (pSMatrix) + { + for(int i=0;i<4;++i) + { + for(int j=0;j<4;++j) + { + ENDIAN( pSMatrix->sfMat[i][j] ); + } + } + } +} + + +//////////////////////////////////////////////////////////////////// +// +// RotatAboutEdgeRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_RotatAboutEdgeProxy; + + +RotatAboutEdgeRecord::RotatAboutEdgeRecord() +{ +} + + +// virtual +RotatAboutEdgeRecord::~RotatAboutEdgeRecord() +{ +} + + +// virtual +void RotatAboutEdgeRecord::endian() +{ +} + + +//////////////////////////////////////////////////////////////////// +// +// TranslateRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_TranslateProxy; + + +TranslateRecord::TranslateRecord() +{ +} + + +// virtual +TranslateRecord::~TranslateRecord() +{ +} + + +// virtual +void TranslateRecord::endian() +{ +} + + +//////////////////////////////////////////////////////////////////// +// +// ScaleRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_ScaleProxy; + + +ScaleRecord::ScaleRecord() +{ +} + + +// virtual +ScaleRecord::~ScaleRecord() +{ +} + + +// virtual +void ScaleRecord::endian() +{ +} + + +//////////////////////////////////////////////////////////////////// +// +// RotatAboutPointRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_RotatAboutPointProxy; + + +RotatAboutPointRecord::RotatAboutPointRecord() +{ +} + + +// virtual +RotatAboutPointRecord::~RotatAboutPointRecord() +{ +} + + + +// virtual +void RotatAboutPointRecord::endian() +{ +} + + +//////////////////////////////////////////////////////////////////// +// +// RotatScaleToPointRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_RotatScaleToPointProxy; + + +RotatScaleToPointRecord::RotatScaleToPointRecord() +{ +} + + +// virtual +RotatScaleToPointRecord::~RotatScaleToPointRecord() +{ +} + + +// virtual +void RotatScaleToPointRecord::endian() +{ +} + + +//////////////////////////////////////////////////////////////////// +// +// PutTransformRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_PutTransformProxy; + + +PutTransformRecord::PutTransformRecord() +{ +} + + +// virtual +PutTransformRecord::~PutTransformRecord() +{ +} + + + +// virtual +void PutTransformRecord::endian() +{ + SPutTransform *pSPutTransform = (SPutTransform*)getData(); + + ENDIAN( pSPutTransform->tmp1 ); + pSPutTransform->FromOrigin.endian(); + pSPutTransform->FromAlign.endian(); + pSPutTransform->FromTrack.endian(); + pSPutTransform->ToOrigin.endian(); + pSPutTransform->ToAlign.endian(); + pSPutTransform->ToTrack.endian(); +} + + +//////////////////////////////////////////////////////////////////// +// +// GeneralMatrixRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_GeneralMatrixProxy; + + +GeneralMatrixRecord::GeneralMatrixRecord() +{ +} + + +// virtual +GeneralMatrixRecord::~GeneralMatrixRecord() +{ +} + + + +// virtual +void GeneralMatrixRecord::endian() +{ + SGeneralMatrix* pSMatrix = (SGeneralMatrix*)getData(); + + if (pSMatrix) + { + for(int i=0;i<4;++i) + { + for(int j=0;j<4;++j) + { + ENDIAN( pSMatrix->sfMat[i][j] ); + } + } + } +} + diff --git a/src/osgPlugins/flt/TransformationRecords.h b/src/osgPlugins/flt/TransformationRecords.h new file mode 100644 index 000000000..2436ca9a6 --- /dev/null +++ b/src/osgPlugins/flt/TransformationRecords.h @@ -0,0 +1,301 @@ +// TransformationRecords.h + +#ifndef __FLT_TRANSFORMATION_RECORDS_H +#define __FLT_TRANSFORMATION_RECORDS_H + + +#include "opcodes.h" +#include "Record.h" +#include "RecordVisitor.h" + + +namespace flt { + + + +//////////////////////////////////////////////////////////////////// +// +// MatrixRecord +// +//////////////////////////////////////////////////////////////////// + +typedef struct MatrixTag +{ + SRecHeader RecHeader; + float32 sfMat[4][4]; // 4x4 Single Precision Matrix +} SMatrix; // row major order + + +class MatrixRecord : public AncillaryRecord +{ + public: + MatrixRecord(); + + virtual Record* clone() const { return new MatrixRecord(); } + virtual const char* className() const { return "MatrixRecord"; } + virtual int classOpcode() const { return MATRIX_OP; } + virtual int sizeofData() const { return sizeof(SMatrix); } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + virtual SMatrix* getData() const { return (SMatrix*)_pData; } + + protected: + virtual ~MatrixRecord(); + + virtual void endian(); +}; + + +//////////////////////////////////////////////////////////////////// +// +// RotatAboutEdgeRecord +// +//////////////////////////////////////////////////////////////////// + +typedef struct RotatAboutEdgeTag +{ + SRecHeader RecHeader; + int32 diReserved; + float64x3 Point1; // first point on edge + float64x3 Point2; // second point on edge + float32 sfAngle; // Angle by which to rotate +} SRotatAboutEdge; + + +class RotatAboutEdgeRecord : public AncillaryRecord +{ + public: + RotatAboutEdgeRecord(); + + virtual Record* clone() const { return new RotatAboutEdgeRecord(); } + virtual const char* className() const { return "RotatAboutEdgeRecord"; } + virtual int classOpcode() const { return ROTATE_ABOUT_EDGE_OP; } + virtual int sizeofData() const { return sizeof(SRotatAboutEdge); } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + virtual SRotatAboutEdge* getData() const { return (SRotatAboutEdge*)_pData; } + + protected: + virtual ~RotatAboutEdgeRecord(); + + virtual void endian(); +}; + + +//////////////////////////////////////////////////////////////////// +// +// TranslateRecord +// +//////////////////////////////////////////////////////////////////// + + +typedef struct TranslateTag +{ + SRecHeader RecHeader; + int32 diReserved; + float64x3 From; // reference FROM point + float64x3 Delta; // Delta to translate node by +} STranslate; + + +class TranslateRecord : public AncillaryRecord +{ + public: + TranslateRecord(); + + virtual Record* clone() const { return new TranslateRecord(); } + virtual const char* className() const { return "TranslateRecord"; } + virtual int classOpcode() const { return TRANSLATE_OP; } + virtual int sizeofData() const { return sizeof(STranslate); } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + virtual STranslate* getData() const { return (STranslate*)_pData; } + + protected: + virtual ~TranslateRecord(); + + virtual void endian(); +}; + + +//////////////////////////////////////////////////////////////////// +// +// ScaleRecord +// +//////////////////////////////////////////////////////////////////// + +typedef struct ScaleTag +{ + SRecHeader RecHeader; + int32 Reserved; + float64x3 center; + float32x3 scale; +} SScale; + +class ScaleRecord : public AncillaryRecord +{ + public: + ScaleRecord(); + + virtual Record* clone() const { return new ScaleRecord(); } + virtual const char* className() const { return "ScaleRecord"; } + virtual int classOpcode() const { return SCALE_OP; } + virtual int sizeofData() const { return sizeof(SScale); } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + +// virtual SGroup* getData() const { return (SGroup*)_pData; } + + protected: + virtual ~ScaleRecord(); + + virtual void endian(); +}; + + +//////////////////////////////////////////////////////////////////// +// +// RotatAboutPointRecord +// +//////////////////////////////////////////////////////////////////// + +typedef struct RotatAboutPointTag +{ + SRecHeader RecHeader; + // TODO +} SRotatAboutPoint; + +class RotatAboutPointRecord : public AncillaryRecord +{ + public: + RotatAboutPointRecord(); + + virtual Record* clone() const { return new RotatAboutPointRecord(); } + virtual const char* className() const { return "RotatAboutPointRecord"; } + virtual int classOpcode() const { return ROTATE_ABOUT_POINT_OP; } + virtual int sizeofData() const { return sizeof(SRotatAboutPoint); } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + +// virtual SGroup* getData() const { return (SGroup*)_pData; } + + protected: + virtual ~RotatAboutPointRecord(); + + virtual void endian(); +}; + + +//////////////////////////////////////////////////////////////////// +// +// RotatScaleToPointRecord +// +//////////////////////////////////////////////////////////////////// + +typedef struct RotatScaleToPointTag +{ + SRecHeader RecHeader; + // TODO +} SRotatScaleToPoint; + +class RotatScaleToPointRecord : public AncillaryRecord +{ + public: + RotatScaleToPointRecord(); + + virtual Record* clone() const { return new RotatScaleToPointRecord(); } + virtual const char* className() const { return "RotatScaleToPointRecord"; } + virtual int classOpcode() const { return ROTATE_SCALE_TO_POINT_OP; } + virtual int sizeofData() const { return sizeof(SRotatScaleToPoint); } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + +// virtual SGroup* getData() const { return (SGroup*)_pData; } + + protected: + virtual ~RotatScaleToPointRecord(); + + virtual void endian(); +}; + + +//////////////////////////////////////////////////////////////////// +// +// PutTransformRecord +// +//////////////////////////////////////////////////////////////////// + +typedef struct PutTransformTag //follows normally a matrix record to +{ //make up the transformation + SRecHeader RecHeader; + int32 tmp1; //mismatch with spec! + float64x3 FromOrigin; + float64x3 FromAlign; + float64x3 FromTrack; + float64x3 ToOrigin; //mismatch !! + float64x3 ToAlign; + float64x3 ToTrack; +} SPutTransform; + + +class PutTransformRecord : public AncillaryRecord +{ + public: + PutTransformRecord(); + + virtual Record* clone() const { return new PutTransformRecord(); } + virtual const char* className() const { return "PutTransformRecord"; } + virtual int classOpcode() const { return PUT_TRANSFORM_OP; } + virtual int sizeofData() const { return sizeof(SPutTransform); } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + virtual SPutTransform* getData() const { return (SPutTransform*)_pData; } + + protected: + virtual ~PutTransformRecord(); + + virtual void endian(); +}; + + +//////////////////////////////////////////////////////////////////// +// +// GeneralMatrixRecord +// +//////////////////////////////////////////////////////////////////// + +typedef struct GeneralMatrixTag +{ + SRecHeader RecHeader; + float32 sfMat[4][4]; // 4x4 Single Precision Matrix +} SGeneralMatrix; // row major order + + +class GeneralMatrixRecord : public AncillaryRecord +{ + public: + GeneralMatrixRecord(); + + virtual Record* clone() const { return new GeneralMatrixRecord(); } + virtual const char* className() const { return "GeneralMatrixRecord"; } + virtual int classOpcode() const { return GENERAL_MATRIX_OP; } + virtual int sizeofData() const { return sizeof(SGeneralMatrix); } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + +// virtual SGroup* getData() const { return (SGroup*)_pData; } + + protected: + virtual ~GeneralMatrixRecord(); + + virtual void endian(); +}; + + +}; // end namespace flt + +#endif // __FLT_TRANSFORMATION_RECORDS_H diff --git a/src/osgPlugins/flt/UnknownRecord.cpp b/src/osgPlugins/flt/UnknownRecord.cpp new file mode 100644 index 000000000..372e7ae70 --- /dev/null +++ b/src/osgPlugins/flt/UnknownRecord.cpp @@ -0,0 +1,27 @@ +// UnknownRecord.cpp + +#include "flt.h" +#include "Registry.h" +#include "UnknownRecord.h" + +using namespace flt; + + +//////////////////////////////////////////////////////////////////// +// +// UnknownRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_UnknownProxy; + + +UnknownRecord::UnknownRecord() +{ +} + +// virtual +UnknownRecord::~UnknownRecord() +{ +} + diff --git a/src/osgPlugins/flt/UnknownRecord.h b/src/osgPlugins/flt/UnknownRecord.h new file mode 100644 index 000000000..1a6a93e76 --- /dev/null +++ b/src/osgPlugins/flt/UnknownRecord.h @@ -0,0 +1,37 @@ +// UnknownRecord.h + +#ifndef __FLT_UNKNOWN_RECORD_H +#define __FLT_UNKNOWN_RECORD_H + +#include "opcodes.h" +#include "Record.h" +#include "RecordVisitor.h" + + +namespace flt { + + +//////////////////////////////////////////////////////////////////// + +class UnknownRecord : public AncillaryRecord +{ + public: + + UnknownRecord(); + virtual ~UnknownRecord(); + + virtual Record* clone() const { return new UnknownRecord(); } + virtual const char* className() const { return "UnknownRecord"; } + virtual int classOpcode() const { return 0; } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + + protected: + + +}; + +}; // end namespace flt + +#endif + diff --git a/src/osgPlugins/flt/VertexPoolRecords.cpp b/src/osgPlugins/flt/VertexPoolRecords.cpp new file mode 100644 index 000000000..8e04bb49f --- /dev/null +++ b/src/osgPlugins/flt/VertexPoolRecords.cpp @@ -0,0 +1,220 @@ +// VertexPoolRecords.cpp + +#include "flt.h" +#include "Registry.h" +#include "VertexPoolRecords.h" + + +using namespace flt; + + +//////////////////////////////////////////////////////////////////// +// +// VertexPaletteRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_VertexPaletteProxy; + + +VertexPaletteRecord::VertexPaletteRecord() +{ +} + + +// virtual +VertexPaletteRecord::~VertexPaletteRecord() +{ +} + + + +// virtual +void VertexPaletteRecord::endian() +{ + SVertexTableHeader *pVertexTableHeader = (SVertexTableHeader*)getData(); + + ENDIAN( pVertexTableHeader->diVertexTableLength ); +} + + + +ostream& operator << (ostream& output, const VertexPaletteRecord& rec) +{ + output << rec.className(); + return output; // to enable cascading +} + + + +//////////////////////////////////////////////////////////////////// +// +// VertexRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_VertexProxy; + + +VertexRecord::VertexRecord() +{ +} + + +// virtual +VertexRecord::~VertexRecord() +{ +} + +// virtual +void VertexRecord::endian() +{ + SVertex *pVertex = (SVertex*)getData(); + + ENDIAN( pVertex->swColor ); + ENDIAN( pVertex->swFlags ); + pVertex->Coord.endian(); + ENDIAN( pVertex->dwVertexColorIndex ); +} + + +ostream& operator << (ostream& output, const VertexRecord& rec) +{ + output << rec.className() << " " + << rec.getData()->swFlags << " " + << rec.getData()->Coord; + return output; // to enable cascading +} + + + +//////////////////////////////////////////////////////////////////// +// +// NormalVertexRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_NormalVertexProxy; + + +NormalVertexRecord::NormalVertexRecord() +{ +} + + +// virtual +NormalVertexRecord::~NormalVertexRecord() +{ +} + +// virtual +void NormalVertexRecord::endian() +{ + SNormalVertex *pVertex = (SNormalVertex*)getData(); + + ENDIAN( pVertex->swColor ); + ENDIAN( pVertex->swFlags ); + pVertex->Coord.endian(); + pVertex->Normal.endian(); +// ENDIAN( pVertex->PackedColor ); + ENDIAN( pVertex->dwVertexColorIndex ); +} + + + +ostream& operator << (ostream& output, const NormalVertexRecord& rec) +{ + output << rec.className() << " " + << rec.getData()->swFlags << " " + << rec.getData()->Coord; + return output; // to enable cascading +} + + +//////////////////////////////////////////////////////////////////// +// +// TextureVertexRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_TextureVertexProxy; + + +TextureVertexRecord::TextureVertexRecord() +{ +} + + +// virtual +TextureVertexRecord::~TextureVertexRecord() +{ +} + + +// virtual +void TextureVertexRecord::endian() +{ + STextureVertex *pVertex = (STextureVertex*)getData(); + + ENDIAN( pVertex->swColor ); + ENDIAN( pVertex->swFlags ); + pVertex->Coord.endian(); + pVertex->Texture.endian(); +// ENDIAN( pVertex->PackedColor ); + ENDIAN( pVertex->dwVertexColorIndex ); +} + + +ostream& operator << (ostream& output, const TextureVertexRecord& rec) +{ + output << rec.className() << " " + << rec.getData()->swFlags << " " + << rec.getData()->Coord; + return output; // to enable cascading +} + + + +//////////////////////////////////////////////////////////////////// +// +// NormalTextureVertexRecord +// +//////////////////////////////////////////////////////////////////// + +RegisterRecordProxy g_NormalTextureVertexProxy; + + +NormalTextureVertexRecord::NormalTextureVertexRecord() +{ +} + + +// virtual +NormalTextureVertexRecord::~NormalTextureVertexRecord() +{ +} + +// virtual +void NormalTextureVertexRecord::endian() +{ + SNormalTextureVertex *pVertex = (SNormalTextureVertex*)getData(); + + ENDIAN( pVertex->swColor ); + ENDIAN( pVertex->swFlags ); + pVertex->Coord.endian(); + pVertex->Normal.endian(); + pVertex->Texture.endian(); +// ENDIAN( pVertex->PackedColor ); + ENDIAN( pVertex->dwVertexColorIndex ); +} + + +ostream& operator << (ostream& output, const NormalTextureVertexRecord& rec) +{ + output << rec.className() << " " + << rec.getData()->swFlags << " " + << rec.getData()->Coord; + return output; // to enable cascading +} + + diff --git a/src/osgPlugins/flt/VertexPoolRecords.h b/src/osgPlugins/flt/VertexPoolRecords.h new file mode 100644 index 000000000..592c3ed57 --- /dev/null +++ b/src/osgPlugins/flt/VertexPoolRecords.h @@ -0,0 +1,230 @@ +// VertexPoolRecords.h + +#ifndef __FLT_VERTEX_POOL_RECORDS_H +#define __FLT_VERTEX_POOL_RECORDS_H + +#include + +#include "opcodes.h" +#include "Record.h" +#include "RecordVisitor.h" + +#ifdef OSG_USE_IO_DOT_H +#include +#else +#include +using namespace std; +#endif + +namespace flt { + +//////////////////////////////////////////////////////////////////// +// +// VertexPaletteRecord +// +//////////////////////////////////////////////////////////////////// + +typedef struct VertexTableHeaderTag //Vertex Palette Header record +{ + SRecHeader RecHeader; + int32 diVertexTableLength; //Length of this record plus pool +} SVertexTableHeader; + + + +class VertexPaletteRecord : public AncillaryRecord +{ + public: + VertexPaletteRecord(); + + virtual Record* clone() const { return new VertexPaletteRecord(); } + virtual const char* className() const { return "VertexPaletteRecord"; } + virtual int classOpcode() const { return VERTEX_PALETTE_OP; } + virtual int sizeofData() const { return sizeof(SVertexTableHeader); } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + friend ostream& operator << (ostream& output, const VertexPaletteRecord& rec); + + protected: + virtual ~VertexPaletteRecord(); + + virtual void endian(); +}; + + +//////////////////////////////////////////////////////////////////// +// +// VertexRecord +// +//////////////////////////////////////////////////////////////////// + +typedef struct VertexTag // Vertex with Color Record Format +{ + SRecHeader RecHeader; + uint16 swColor; // Color Name Index + uint16 swFlags; // Flags (bits, from left to right) + // 0 = Start Hard Edge + // 1 = Normal frozen + // 2 = no Vertex Color + // 3 = Packed Color + // 4-15 Spare + float64x3 Coord; // x,y,z coordinate + color32 PackedColor; // Packed color (A, B, G, R) + uint32 dwVertexColorIndex; +} SVertex; + + +class VertexRecord : public AncillaryRecord +{ + public: + VertexRecord(); + virtual Record* clone() const { return new VertexRecord(); } + virtual const char* className() const { return "VertexRecord"; } + virtual int classOpcode() const { return VERTEX_C_OP; } + virtual int sizeofData() const { return sizeof(SVertex); } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + virtual SVertex* getData() const { return (SVertex*)_pData; } + friend ostream& operator << (ostream& output, const VertexRecord& rec); + + protected: + virtual ~VertexRecord(); + + virtual void endian(); +}; + + +//////////////////////////////////////////////////////////////////// +// +// NormalVertexRecord +// +//////////////////////////////////////////////////////////////////// + + +typedef struct NormalVertexTag // Vertex with Normal Record Format +{ + SRecHeader RecHeader; + uint16 swColor; // Color Name Index + uint16 swFlags; // Flags (bits, from left to right) + // 0 = Start Hard Edge + // 1 = Normal frozen + // 2 = no Vertex Color + // 3 = Packed Color + // 4-15 Spare + float64x3 Coord; // x,y,z coordinate + float32x3 Normal; // Vertex normal + color32 PackedColor; // Packed color (A, B, G, R) + uint32 dwVertexColorIndex; +} SNormalVertex; + + +class NormalVertexRecord : public AncillaryRecord +{ + public: + NormalVertexRecord(); + virtual Record* clone() const { return new NormalVertexRecord(); } + virtual const char* className() const { return "NormalVertexRecord"; } + virtual int classOpcode() const { return VERTEX_CN_OP; } + virtual int sizeofData() const { return sizeof(SNormalVertex); } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + virtual SNormalVertex* getData() const { return (SNormalVertex*)_pData; } + friend ostream& operator << (ostream& output, const NormalVertexRecord& rec); + + protected: + virtual ~NormalVertexRecord(); + + virtual void endian(); +}; + + +//////////////////////////////////////////////////////////////////// +// +// TextureVertexRecord +// +//////////////////////////////////////////////////////////////////// + +typedef struct TextureVertexTag // Vertex with Texture Record Format +{ + SRecHeader RecHeader; + uint16 swColor; // Color Name Index + uint16 swFlags; // Flags (bits, from left to right) + // 0 = Start Hard Edge + // 1 = Normal frozen + // 2 = no Vertex Color + // 3 = Packed Color + // 4-15 Spare + float64x3 Coord; // x,y,z coordinate + float32x2 Texture; // Texture (u,v) + color32 PackedColor; // Packed color (A, B, G, R) + uint32 dwVertexColorIndex; +} STextureVertex; + + +class TextureVertexRecord : public AncillaryRecord +{ + public: + TextureVertexRecord(); + virtual Record* clone() const { return new TextureVertexRecord(); } + virtual const char* className() const { return "TextureVertexRecord"; } + virtual int classOpcode() const { return VERTEX_CT_OP; } + virtual int sizeofData() const { return sizeof(STextureVertex); } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + virtual STextureVertex* getData() const { return (STextureVertex*)_pData; } + friend ostream& operator << (ostream& output, const TextureVertexRecord& rec); + + protected: + virtual ~TextureVertexRecord(); + + virtual void endian(); +}; + + +//////////////////////////////////////////////////////////////////// +// +// NormalTextureVertexRecord +// +//////////////////////////////////////////////////////////////////// + +typedef struct NormalTextureVertexTag //Vertex with Normal and Texture Format +{ + SRecHeader RecHeader; + uint16 swColor; // Color Name Index + uint16 swFlags; // Flags (bits, from left to right) + // 0 = Start Hard Edge + // 1 = Normal frozen + // 2 = no Vertex Color + // 3 = Packed Color + // 4-15 Spare + float64x3 Coord; // x,y,z coordinate + float32x3 Normal; // Vertex normal + float32x2 Texture; // Texture (u,v) + color32 PackedColor; // Packed color (A, B, G, R) + uint32 dwVertexColorIndex; +} SNormalTextureVertex; + + +class NormalTextureVertexRecord : public AncillaryRecord +{ + public: + NormalTextureVertexRecord(); + virtual Record* clone() const { return new NormalTextureVertexRecord(); } + virtual const char* className() const { return "NormalTextureVertexRecord"; } + virtual int classOpcode() const { return VERTEX_CNT_OP; } + virtual int sizeofData() const { return sizeof(SNormalTextureVertex); } + virtual void accept(RecordVisitor& rv) { rv.apply(*this); } +// virtual void traverse(RecordVisitor& rv); + virtual SNormalTextureVertex* getData() const { return (SNormalTextureVertex*)_pData; } + friend ostream& operator << (ostream& output, const NormalTextureVertexRecord& rec); + + protected: + virtual ~NormalTextureVertexRecord(); + + virtual void endian(); +}; + + +}; // end namespace flt + +#endif // __FLT_VERTEX_POOL_RECORDS_H diff --git a/src/osgPlugins/flt/export.h b/src/osgPlugins/flt/export.h new file mode 100644 index 000000000..c617d008e --- /dev/null +++ b/src/osgPlugins/flt/export.h @@ -0,0 +1,22 @@ +#ifndef __FLT_EXPORT_H +#define __FLT_EXPORT_H + +#define FLT_DLL + +#ifdef WIN32 +#pragma warning( disable : 4251 ) +#pragma warning( disable : 4275 ) +#pragma warning( disable : 4786 ) +#endif + +#if defined(FLT_DLL) && defined(_MSC_VER) +# ifdef FLT_LIBRARY +# define FLT_EXPORT __declspec(dllexport) +# else +# define FLT_EXPORT __declspec(dllimport) +# endif /* FLT_LIBRARY */ +#else +# define FLT_EXPORT +#endif /* FLT_DLL && _MSC_VER */ + +#endif diff --git a/src/osgPlugins/flt/flt.cpp b/src/osgPlugins/flt/flt.cpp new file mode 100644 index 000000000..f0464fb05 --- /dev/null +++ b/src/osgPlugins/flt/flt.cpp @@ -0,0 +1,45 @@ +// flt.cpp + +#include "flt.h" + + +using namespace flt; + +//////////////////////////////////////////////////////////////////// + +int flt::isLittleEndianMachine() +{ + int a = 1; + return (int)(*(char*)&a); +} + + +void flt::endian2(void* pSrc, int nSrc, void* pDst, int nDst) +{ + if (nSrc == 2) + { + short tmp1; + tmp1 = *(short *)pSrc; + tmp1 = (tmp1 << 8) | ((tmp1 >> 8) & 0xff); + *(short *)pDst = tmp1; + } + else if (nSrc == 4) + { + long tmp1; + tmp1 = *(long *)pSrc; + tmp1 = (tmp1 << 24) | ((tmp1 << 8) & 0xff0000) | ((tmp1 >> 8) & 0xff00) | ((tmp1 >> 24) & 0xff); + *(long *)pDst = tmp1; + } + else if (nSrc == 8) + { + long tmp1, tmp2; + tmp1 = *(long *)pSrc; + tmp2 = *(1 + (long *)pSrc); + tmp1 = (tmp1 << 24) | ((tmp1 << 8) & 0xff0000) | ((tmp1 >> 8) & 0xff00) | ((tmp1 >> 24) & 0xff); + tmp2 = (tmp2 << 24) | ((tmp2 << 8) & 0xff0000) | ((tmp2 >> 8) & 0xff00) | ((tmp2 >> 24) & 0xff); + *(long *)pDst = tmp2; + *(1 + (long *)pDst) = tmp1; + } +} + + diff --git a/src/osgPlugins/flt/flt.h b/src/osgPlugins/flt/flt.h new file mode 100644 index 000000000..095d51820 --- /dev/null +++ b/src/osgPlugins/flt/flt.h @@ -0,0 +1,175 @@ + +#ifndef __FLT_H +#define __FLT_H + +#include + +#ifdef OSG_USE_IO_DOT_H +#include +#else +#include +using namespace std; +#endif + +namespace flt { + +#define ENDIAN2(SRC, DST) endian2((void*)&(SRC), sizeof(SRC), (void*)&(DST), sizeof(DST)) +#define ENDIAN(A) ENDIAN2((A), (A)) + +#define BIT0 0x0001 +#define BIT1 0x0002 +#define BIT2 0x0004 +#define BIT3 0x0008 +#define BIT4 0x0010 +#define BIT5 0x0020 +#define BIT6 0x0040 +#define BIT7 0x0080 +#define BIT8 0x0100 +#define BIT9 0x0200 +#define BIT10 0x0400 +#define BIT11 0x0800 +#define BIT12 0x1000 +#define BIT13 0x2000 +#define BIT14 0x4000 +#define BIT15 0x8000 + +//////////////////////////////////////////////////////////////////// + +typedef signed char int8; +typedef unsigned char uint8; +typedef signed short int16; +typedef unsigned short uint16; +typedef signed long int32; +typedef unsigned long uint32; +typedef float float32; +typedef double float64; + +//////////////////////////////////////////////////////////////////// + + +extern int isLittleEndianMachine(); +extern void endian2( void* pSrc, int nSrc, void* pDst, int nDst ); + + +struct float32x2 +{ + float32 _v[2]; + + inline float32 x() { return _v[0]; } + inline float32 y() { return _v[1]; } + inline float32 operator [] (int i) { return _v[i]; } + void endian() { + ENDIAN( _v[0] ); + ENDIAN( _v[1] ); + } + + friend inline ostream& operator << (ostream& output, const float32x2& f) + { + output << f._v[0] << " " + << f._v[1]; + return output; // to enable cascading + } +}; + + +struct float32x3 +{ + float32 _v[3]; + inline float32 x() { return _v[0]; } + inline float32 y() { return _v[1]; } + inline float32 z() { return _v[2]; } + inline float32 operator [] (int i) { return _v[i]; } + void endian() { + ENDIAN( _v[0] ); + ENDIAN( _v[1] ); + ENDIAN( _v[2] ); + } + + friend inline ostream& operator << (ostream& output, const float32x3& f) + { + output << f._v[0] << " " + << f._v[1] << " " + << f._v[2]; + return output; // to enable cascading + } +}; + + +struct float64x2 +{ + float64 _v[2]; + inline float64 x() { return _v[0]; } + inline float64 y() { return _v[1]; } + inline float64 operator [] (int i) { return _v[i]; } + void endian() { + ENDIAN( _v[0] ); + ENDIAN( _v[1] ); + } + + friend inline ostream& operator << (ostream& output, const float64x2& f) + { + output << f._v[0] << " " + << f._v[1]; + return output; // to enable cascading + } +}; + + +struct float64x3 +{ + float64 _v[3]; + + inline float64 x() { return _v[0]; } + inline float64 y() { return _v[1]; } + inline float64 z() { return _v[2]; } + inline float64 operator [] (int i) { return _v[i]; } + void endian() { + ENDIAN( _v[0] ); + ENDIAN( _v[1] ); + ENDIAN( _v[2] ); + } + + friend inline ostream& operator << (ostream& output, const float64x3& f) + { + output << f._v[0] << " " + << f._v[1] << " " + << f._v[2]; + return output; // to enable cascading + } +}; + +struct color32 +{ + uint8 _alpha; + uint8 _blue; + uint8 _green; + uint8 _red; + + inline float red() { return (float)_red/255; } + inline float green() { return (float)_green/255; } + inline float blue() { return (float)_blue/255; } + inline float alpha() { return (float)_alpha/255; } + inline osg::Vec4 get() + { return osg::Vec4( red(), green(), blue(), alpha()); } +}; + + +struct SRecHeader +{ + uint16 _wOpcode; // identifies record type + uint16 _wLength; // total length of record + + inline int opcode() { return (int)_wOpcode; } + inline int length() { return (int)_wLength; } + void endian() { + ENDIAN( _wOpcode ); + ENDIAN( _wLength ); + } +}; + + +}; // end namespace flt + +#endif + + diff --git a/src/osgPlugins/flt/flt2osg.cpp b/src/osgPlugins/flt/flt2osg.cpp new file mode 100644 index 000000000..2d9e60def --- /dev/null +++ b/src/osgPlugins/flt/flt2osg.cpp @@ -0,0 +1,738 @@ +// flt2osg.cpp + +#include +#include "osg/GL" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "opcodes.h" +#include "flt.h" +#include "flt2osg.h" +#include "FltFile.h" +#include "Record.h" +#include "HeaderRecord.h" +#include "ColorPaletteRecord.h" +#include "MaterialPaletteRecord.h" +#include "TexturePaletteRecord.h" +#include "VertexPoolRecords.h" +#include "GroupRecord.h" +#include "LodRecord.h" +#include "DofRecord.h" +#include "SwitchRecord.h" +#include "ObjectRecord.h" +#include "FaceRecord.h" +#include "TransformationRecords.h" +#include "ExternalRecord.h" +#include "LightPointRecord.h" +#include "Input.h" +#include "GeoSetBuilder.h" +#include "LongIDRecord.h" + + +using namespace flt; + + +ConvertFromFLT::ConvertFromFLT(FltFile* pFltFile) +{ + _pFltFile = pFltFile; + _diOpenFlightVersion = 0; + _diCurrentOffset = 0; + _wObjTransparency = 0; + _nSubfaceLevel = 0; +} + + +ConvertFromFLT::~ConvertFromFLT() +{ +} + + +osg::Node* ConvertFromFLT::convert(Record* rec) +{ + if (rec==NULL) return NULL; + return visitNode(NULL, rec); +} + + +//////////////////////////////////////////////////////////////////// + + +Record* ConvertFromFLT::getVertexFromPool(int nOffset) +{ + VertexPaletteOffsetMap::iterator fitr = _VertexPaletteOffsetMap.find(nOffset); + if (fitr != _VertexPaletteOffsetMap.end()) + { + return (*fitr).second; + } + else return NULL; +} + + +void ConvertFromFLT::regisiterVertex(int nOffset, Record* pRec) +{ + _VertexPaletteOffsetMap[nOffset] = pRec; +} + + + +//////////////////////////////////////////////////////////////////// + +osg::Node* ConvertFromFLT::visitNode(osg::Group* osgParent, Record* rec) +{ + if (rec==NULL) return NULL; + + if (rec->isOfType(HEADER_OP)) return visitHeader(osgParent, (HeaderRecord*)rec); + else if (rec->isOfType(COLOR_PALETTE_OP)) return visitColorPalette(osgParent, (ColorPaletteRecord*)rec); + else if (rec->isOfType(MATERIAL_PALETTE_OP)) return visitMaterialPalette(osgParent, (MaterialPaletteRecord*)rec); + else if (rec->isOfType(TEXTURE_PALETTE_OP)) return visitTexturePalette(osgParent, (TexturePaletteRecord*)rec); + else if (rec->isOfType(VERTEX_PALETTE_OP)) return visitVertexPalette(osgParent, (VertexPaletteRecord*)rec); + else if (rec->isOfType(VERTEX_C_OP)) return visitVertex(osgParent, (VertexRecord*)rec); + else if (rec->isOfType(VERTEX_CN_OP)) return visitNormalVertex(osgParent, (NormalVertexRecord*)rec); + else if (rec->isOfType(VERTEX_CNT_OP)) return visitNormalTextureVertex(osgParent, (NormalTextureVertexRecord*)rec); + else if (rec->isOfType(VERTEX_CT_OP)) return visitTextureVertex(osgParent, (TextureVertexRecord*)rec); + else if (rec->isOfType(GROUP_OP)) return visitGroup(osgParent, (GroupRecord*)rec); + else if (rec->isOfType(LOD_OP)) return visitLOD(osgParent, (LodRecord*)rec); + else if (rec->isOfType(OLD_LOD_OP)) return visitOldLOD(osgParent, (OldLodRecord*)rec); + else if (rec->isOfType(DOF_OP)) return visitDOF(osgParent, (DofRecord*)rec); + else if (rec->isOfType(SWITCH_OP)) return visitSwitch(osgParent, (SwitchRecord*)rec); + else if (rec->isOfType(OBJECT_OP)) return visitObject(osgParent, (ObjectRecord*)rec); + else if (rec->isOfType(EXTERNAL_REFERENCE_OP)) return visitExternal(osgParent, (ExternalRecord*)rec); + else if (rec->isOfType(MATRIX_OP)) return visitMatrix(osgParent, (MatrixRecord*)rec); + else if (rec->isOfType(LONG_ID_OP)) return visitLongID(osgParent, (LongIDRecord*)rec); + + return NULL; +} + + +osg::Node* ConvertFromFLT::visitAncillary(osg::Group* osgParent, PrimNodeRecord* rec) +{ + osg::Node* node = NULL; + + // Visit + for(int i=0; i < rec->getNumChildren(); i++) + { + Record* child = rec->getChild(i); + + if (child && child->isAncillaryRecord()) + { + node = visitNode(osgParent, child); + if (node) osgParent = (osg::Group*)node; + } + } + + return osgParent; +} + + +osg::Node* ConvertFromFLT::visitPrimaryNode(osg::Group* osgParent, PrimNodeRecord* rec) +{ + osg::Node* node = NULL; + GeoSetBuilder geoSetBuilder(_pFltFile); + + // Visit + for(int i=0; i < rec->getNumChildren(); i++) + { + Record* child = rec->getChild(i); + + if (child && child->isPrimaryNode()) + { + if (child->isOfType(FACE_OP)) + visitFace(&geoSetBuilder, (FaceRecord*)child); + else if (child->isOfType(LIGHT_POINT_OP)) + visitLightPoint(&geoSetBuilder, (LightPointRecord*)child); + else + node = visitNode(osgParent, child); + } + } + + osg::Geode* geode = geoSetBuilder.createOsgGeoSets(); + if (osgParent && geode) + osgParent->addChild( geode ); + + return node; +} + + +osg::Node* ConvertFromFLT::visitLongID(osg::Group* osgParent, LongIDRecord* rec) +{ + SLongID *pSLongID = (SLongID*)rec->getData(); + + osgParent->setName(pSLongID->szIdent); + + return NULL; +} + + +osg::Node* ConvertFromFLT::visitHeader(osg::Group* osgParent, HeaderRecord* rec) +{ + SHeader *pSHeader = (SHeader*)rec->getData(); + + osg::Group* group = new osg::Group; + + _diOpenFlightVersion = pSHeader->diFormatRevLev; + + osg::notify(osg::INFO) << "Version " << _diOpenFlightVersion << endl; + + if (group) + { + visitAncillary(osgParent, rec); + + visitPrimaryNode(group, (PrimNodeRecord*)rec); + group->setName(pSHeader->szIdent); + if (osgParent) osgParent->addChild(group); + } + + return (osg::Node*)group; +} + + +osg::Node* ConvertFromFLT::visitColorPalette(osg::Group* osgParent, ColorPaletteRecord* rec) +{ + SColorPalette* pCol = (SColorPalette*)rec->getData(); + + ColorPool* pColorPool = _pFltFile->getColorPool(); + if (pCol && pColorPool) + { + for (int n=0; n<1024; n++) + pColorPool->regisiterColor(n, pCol->Colors[n].get()); + } + return NULL; +} + + +osg::Node* ConvertFromFLT::visitMaterialPalette(osg::Group* osgParent, MaterialPaletteRecord* rec) +{ + SMaterial* pSMaterial = (SMaterial*)rec->getData(); + + MaterialPool* pMaterialPool = _pFltFile->getMaterialPool(); + if (pSMaterial && pMaterialPool /* && (pMaterial->diFlags & BIT0) */) + pMaterialPool->regisiterMaterial((int)pSMaterial->diIndex, pSMaterial); + return NULL; +} + + +osg::Node* ConvertFromFLT::visitTexturePalette(osg::Group* osgParent, TexturePaletteRecord* rec) +{ + STexturePalette* pTexture = (STexturePalette*)rec->getData(); + + if (pTexture) + { + osg::notify(osg::INFO) << "Texture" << pTexture->diIndex << " = " << pTexture->szFilename << endl; + + osg::ref_ptr image = osg::Registry::instance()->readImage(pTexture->szFilename); + if (image.valid()) + { + osg::Texture *osgTexture = new osg::Texture; + TexturePool* pTexturePool = _pFltFile->getTexturePool(); + if (osgTexture && pTexturePool) + { + osgTexture->setWrap( osg::Texture::WRAP_S, osg::Texture::REPEAT ); + osgTexture->setWrap( osg::Texture::WRAP_T, osg::Texture::REPEAT ); + osgTexture->setImage(image.get()); + pTexturePool->regisiterTexture((int)pTexture->diIndex, osgTexture); + } + } + } + return NULL; +} + + +osg::Node* ConvertFromFLT::visitVertexPalette(osg::Group* osgParent, VertexPaletteRecord* rec) +{ + _diCurrentOffset = rec->getSize(); + return NULL; +} + + +osg::Node* ConvertFromFLT::visitVertex(osg::Group* osgParent, VertexRecord* rec) +{ + regisiterVertex(_diCurrentOffset, rec); + _diCurrentOffset += rec->getSize(); + return NULL; +} + + +osg::Node* ConvertFromFLT::visitNormalVertex(osg::Group* osgParent, NormalVertexRecord* rec) +{ + regisiterVertex(_diCurrentOffset, rec); + _diCurrentOffset += rec->getSize(); + return NULL; +} + + +osg::Node* ConvertFromFLT::visitTextureVertex(osg::Group* osgParent, TextureVertexRecord* rec) +{ + regisiterVertex(_diCurrentOffset, rec); + _diCurrentOffset += rec->getSize(); + return NULL; +} + + +osg::Node* ConvertFromFLT::visitNormalTextureVertex(osg::Group* osgParent, NormalTextureVertexRecord* rec) +{ + regisiterVertex(_diCurrentOffset, rec); + _diCurrentOffset += rec->getSize(); + return NULL; +} + + +osg::Node* ConvertFromFLT::visitGroup(osg::Group* osgParent, GroupRecord* rec) +{ + osg::Group* group = new osg::Group; + if (group) + { + osg::Node* node = visitAncillary(osgParent, rec); + if (node) osgParent = (osg::Group*)node; + + visitPrimaryNode(group, (PrimNodeRecord*)rec); + group->setName(rec->getData()->szIdent); + osgParent->addChild( group ); + } + + return (osg::Node*)group; +} + + +osg::Node* ConvertFromFLT::visitLOD(osg::Group* osgParent, LodRecord* rec) +{ + SLevelOfDetail* pSLOD = rec->getData(); + osg::LOD* lod = new osg::LOD; + osg::Group* group = new osg::Group; + if (lod && group) + { + osg::Node* node = visitAncillary(osgParent, rec); + if (node) osgParent = (osg::Group*)node; + + visitPrimaryNode(group, (PrimNodeRecord*)rec); + float64x3* pCenter = &pSLOD->Center; + lod->addChild(group); + lod->setCenter(osg::Vec3(pCenter->x(), pCenter->y(), pCenter->z())); + lod->setRange(0, pSLOD->dfSwitchOutDist); + lod->setRange(1, pSLOD->dfSwitchInDist); + lod->setName(pSLOD->szIdent); + osgParent->addChild( lod ); + } + + return (osg::Node*)lod; +} + + +osg::Node* ConvertFromFLT::visitOldLOD(osg::Group* osgParent, OldLodRecord* rec) +{ + osg::Group* group = new osg::Group; + if (group) + { + osg::Node* node = visitAncillary(osgParent, rec); + if (node) osgParent = (osg::Group*)node; + + visitPrimaryNode(group, (PrimNodeRecord*)rec); + group->setName(rec->getData()->szIdent); + osgParent->addChild( group ); + } + + return (osg::Node*)group; +} + + +// TODO: DOF node implemented as Group. +osg::Node* ConvertFromFLT::visitDOF(osg::Group* osgParent, DofRecord* rec) +{ + osg::Group* group = new osg::Group; + + if (group) + { + osg::Node* node = visitAncillary(osgParent, rec); + if (node) osgParent = (osg::Group*)node; + + visitPrimaryNode(group, (PrimNodeRecord*)rec); + group->setName(rec->getData()->szIdent); + osgParent->addChild( group ); + } + + return (osg::Node*)group; +} + + +osg::Node* ConvertFromFLT::visitSwitch(osg::Group* osgParent, SwitchRecord* rec) +{ + osg::Switch* switc = new osg::Switch; + + if (switc) + { + osg::Node* node = visitAncillary(osgParent, rec); + if (node) osgParent = (osg::Group*)node; + + visitPrimaryNode(switc, (PrimNodeRecord*)rec); + switc->setName(rec->getData()->szIdent); + switc->setVal(rec->getData()->dwCurrentMask); + osgParent->addChild( switc ); + +/* + TODO: + mask_bit = 1 << (child_num % 32) + mask_word = mask_words [mask_num * num_words + child_num / 32] + child_selected = mask_word & mask_bit +*/ + } + + return (osg::Node*)switc; +} + + +osg::Node* ConvertFromFLT::visitObject(osg::Group* osgParent, ObjectRecord* rec) +{ + osg::Group* group = new osg::Group; + if (group) + { + osg::Node* node = visitAncillary(osgParent, rec); + if (node) osgParent = (osg::Group*)node; + + unsigned short wPrevTransparency = _wObjTransparency; + _wObjTransparency = rec->getData()->wTransparency; + visitPrimaryNode(group, (PrimNodeRecord*)rec); + _wObjTransparency = wPrevTransparency; + + group->setName(rec->getData()->szIdent); + osgParent->addChild( group ); + } + + return (osg::Node*)group; +} + + +void ConvertFromFLT::visitFace(GeoSetBuilder* pBuilder, FaceRecord* rec) +{ + SFace *pSFace = (SFace*)rec->getData(); + osg::Vec4 color(1,1,1,1); + + // Cull face & wireframe + int drawMode = pSFace->swDrawFlag & (BIT0 | BIT1); + switch(drawMode) + { + case FaceRecord::SOLID_BACKFACED: + pBuilder->setCullface(true); + break; + case FaceRecord::SOLID_NO_BACKFACE: + pBuilder->setCullface(false); + break; + case FaceRecord::WIREFRAME_NOT_CLOSED: + pBuilder->setPrimType(osg::GeoSet::LINE_STRIP); + break; + case FaceRecord::WIREFRAME_CLOSED: + pBuilder->setPrimType(osg::GeoSet::LINE_LOOP); + break; + } +/* + TODO: + + int directionalLight = pSFace->swDrawFlag & (BIT3 | BIT4); + switch(directionalLight) + { + case FaceRecord::OMNIDIRECTIONAL_LIGHT: + break; + case FaceRecord::UNIDIRECTIONAL_LIGHT: + break; + case FaceRecord::BIDIRECTIONAL_LIGHT: + break; + } +*/ + + // Lighting + switch(pSFace->swLightMode) + { + case FaceRecord::FACE_COLOR: + case FaceRecord::VERTEX_COLOR: + pBuilder->setLighting(false); + break; + case FaceRecord::FACE_COLOR_LIGHTING: + case FaceRecord::VERTEX_COLOR_LIGHTING: + pBuilder->setLighting(true); + break; + } + + // Color + switch(pSFace->swLightMode) + { + case FaceRecord::FACE_COLOR: + case FaceRecord::FACE_COLOR_LIGHTING: + case FaceRecord::VERTEX_COLOR: + case FaceRecord::VERTEX_COLOR_LIGHTING: + if (!(pSFace->diFlags & BIT1)) // face color bit + { + float alpha; + + if (pSFace->diFlags & BIT3) // Packed color bit + color = pSFace->PrimaryPackedColor.get(); + else + { + ColorPool* pColorPool = _pFltFile->getColorPool(); + if (pColorPool) + color = pColorPool->getColor(pSFace->dwPrimaryColorIndex); + } + + alpha = 1.0f - (float)pSFace->wTransparency / 65535.0f; + color[3] = alpha; + + if (alpha < 1.0f) + pBuilder->setTransparency(true); + + pBuilder->setColorBinding(osg::GeoSet::BIND_OVERALL); + pBuilder->setColor(color); + } + break; + } + + // Material + MaterialPool* pMaterialPool = _pFltFile->getMaterialPool(); + if (pMaterialPool) + { + SMaterial* pSMaterial = pMaterialPool->getMaterial((int)pSFace->iMaterial); + + if (pSMaterial) + { + osg::Material* osgMaterial = new osg::Material; + osg::Vec4 ambient; + osg::Vec4 diffuse; + osg::Vec4 specular; + osg::Vec4 emissiv; + float alpha; + + alpha = pSMaterial->sfAlpha * (1.0f - ( + ((float)pSFace->wTransparency / 65535.0f) * ((float)_wObjTransparency / 65535.0f) )); + + ambient[0] = pSMaterial->Ambient[0] * color[0]; + ambient[1] = pSMaterial->Ambient[1] * color[1]; + ambient[2] = pSMaterial->Ambient[2] * color[2]; + ambient[3] = alpha; + + diffuse[0] = pSMaterial->Diffuse[0] * color[0]; + diffuse[1] = pSMaterial->Diffuse[1] * color[1]; + diffuse[2] = pSMaterial->Diffuse[2] * color[2]; + diffuse[3] = alpha; + + specular[0] = pSMaterial->Specular[0]; + specular[1] = pSMaterial->Specular[1]; + specular[2] = pSMaterial->Specular[2]; + specular[3] = alpha; + + emissiv[0] = pSMaterial->Emissive[0]; + emissiv[1] = pSMaterial->Emissive[1]; + emissiv[2] = pSMaterial->Emissive[2]; + emissiv[3] = alpha; + + osgMaterial->setAmbient(osg::Material::FACE_FRONT_AND_BACK, ambient); + osgMaterial->setDiffuse(osg::Material::FACE_FRONT_AND_BACK, diffuse); + osgMaterial->setSpecular(osg::Material::FACE_FRONT_AND_BACK, specular); + osgMaterial->setEmission(osg::Material::FACE_FRONT_AND_BACK, emissiv); + osgMaterial->setShininess(osg::Material::FACE_FRONT_AND_BACK, pSMaterial->sfShininess/128.0f); + osgMaterial->setColorMode(osg::Material::OFF); + + if (alpha < 1.0f) + pBuilder->setTransparency(true); + + pBuilder->setMaterial(osgMaterial); + } + } + + // Subface + if (rec->getParent()->isOfType(FACE_OP)) + { + pBuilder->setSubface(_nSubfaceLevel); + } + + // Texture + TexturePool* pTexturePool = _pFltFile->getTexturePool(); + if (pTexturePool) + { + osg::Texture* osgTexture = pTexturePool->getTexture((int)pSFace->iTexturePattern); + if (osgTexture) + { + osg::Image* image = osgTexture->getImage(); + if (image) + { + switch (image->pixelFormat()) + { + case GL_LUMINANCE_ALPHA: + case GL_RGBA: + pBuilder->setTransparency(true); + break; + } + } + pBuilder->setTexture(osgTexture); + } + } + + // Visit vertices + for(int i=0; i < rec->getNumChildren(); i++) + { + Record* child = rec->getChild(i); + + if (child) + { + int op = child->getOpcode(); + switch (op) + { + case VERTEX_LIST_OP: + visitVertexList(pBuilder, (VertexListRecord*)child); + break; + + case OLD_VERTEX_OP: + case OLD_VERTEX_COLOR_OP: + case OLD_VERTEX_COLOR_NORMAL_OP: + pBuilder->addVertex(child); + break; + + } + } + } + + // Add primitive to GeoSet and prepare for next. + pBuilder->addPrimitive(); + + // Look for sufbfaces + _nSubfaceLevel++; + for(i=0; i < rec->getNumChildren(); i++) + { + Record* child = rec->getChild(i); + + if (child && child->isOfType(FACE_OP)) + visitFace(pBuilder, (FaceRecord*)child); + } + _nSubfaceLevel--; +} + + +void ConvertFromFLT::visitVertexList(GeoSetBuilder* pBuilder, VertexListRecord* rec) +{ + int vertices = rec->numberOfVertices(); + + // Add vertices to GeoSetBuilder + if (pBuilder->getPrimType() == osg::GeoSet::POINTS) + { + for (int i=0; i < vertices; i++) + { + Record* vertex = getVertexFromPool(rec->getVertexPoolOffset(i)); + if (vertex) + { + pBuilder->setPrimType(osg::GeoSet::POINTS); + pBuilder->setColorBinding(osg::GeoSet::BIND_PERVERTEX); + pBuilder->addVertex(vertex); + pBuilder->addPrimitive(); + } + } + } + else + { + for (int i=0; i < vertices; i++) + { + Record* vertex = getVertexFromPool(rec->getVertexPoolOffset(i)); + if (vertex) + pBuilder->addVertex(vertex); + } + } +} + + +osg::Node* ConvertFromFLT::visitMatrix(osg::Group* osgParent, MatrixRecord* rec) +{ + SMatrix* pSMatrix = (SMatrix*)rec->getData(); + + osg::DCS* dcs = new osg::DCS; + if (dcs) + { + osg::Matrix m; + for(int i=0;i<4;++i) + { + for(int j=0;j<4;++j) + { + m._mat[i][j] = pSMatrix->sfMat[i][j]; + } + } + dcs->setMatrix(m); + osgParent->addChild(dcs); + return (osg::Node*)dcs; + } + + return NULL; +} + + + +osg::Node* ConvertFromFLT::visitExternal(osg::Group* osgParent, ExternalRecord* rec) +{ + SExternalReference *pSExternal = (SExternalReference*)rec->getData(); + + if (osgParent) + { + osg::Node* node = visitAncillary(osgParent, rec); + if (node) osgParent = (osg::Group*)node; + + FltFile* pFile = rec->getExternal(); + if (pFile) + { + node = pFile->convert(); + if (node) + { + osgParent->addChild(node); + return node; + } + } + } + + return NULL; +} + + +void ConvertFromFLT::visitLightPoint(GeoSetBuilder* pBuilder, LightPointRecord* rec) +{ + SLightPoint *pSLightPoint = (SLightPoint*)rec->getData(); + + // Visit vertices + for(int i=0; i < rec->getNumChildren(); i++) + { + Record* child = rec->getChild(i); + + if (child) + { + int op = child->getOpcode(); + switch (op) + { + case VERTEX_LIST_OP: + pBuilder->setPrimType(osg::GeoSet::POINTS); + visitVertexList(pBuilder, (VertexListRecord*)child); + break; + + case OLD_VERTEX_OP: + case OLD_VERTEX_COLOR_OP: + case OLD_VERTEX_COLOR_NORMAL_OP: + pBuilder->setColorBinding(osg::GeoSet::BIND_PERVERTEX); + pBuilder->addVertex(child); + pBuilder->addPrimitive(); + break; + } + } + } +} + + + diff --git a/src/osgPlugins/flt/flt2osg.h b/src/osgPlugins/flt/flt2osg.h new file mode 100644 index 000000000..1b549ee2b --- /dev/null +++ b/src/osgPlugins/flt/flt2osg.h @@ -0,0 +1,116 @@ +// flt2osg.h + +#ifndef __FLT_2_OSG_H +#define __FLT_2_OSG_H + +#include +#include +#include + +#include + +#include "Record.h" + + +namespace osg { +class Object; +class Group; +class LOD; +class Geode; +class GeoSet; +class Material; +class Texture; +class Vec4; +}; + + +namespace flt { + +class Record; +class HeaderRecord; +class ColorPaletteRecord; +class MaterialPaletteRecord; +class TexturePaletteRecord; +class VertexPaletteRecord; +class VertexRecord; +class NormalVertexRecord; +class TextureVertexRecord; +class NormalTextureVertexRecord; +class GroupRecord; +class LodRecord; +class OldLodRecord; +class DofRecord; +class SwitchRecord; +class ObjectRecord; +class FaceRecord; +class MatrixRecord; +class ExternalRecord; +class LightPointRecord; +class VertexListRecord; +class LongIDRecord; + +class GeoSetBuilder; +class FltFile; + +struct SMaterial; + + +class ConvertFromFLT +{ +public: + + ConvertFromFLT(FltFile* pFltFile); + virtual ~ConvertFromFLT(); + + osg::Node* convert(Record* rec); + + osg::Node* visitNode(osg::Group* osgParent,Record* rec); + osg::Node* visitAncillary(osg::Group* osgParent, PrimNodeRecord* rec); + osg::Node* visitPrimaryNode(osg::Group* osgParent, PrimNodeRecord* rec); + + osg::Node* visitLongID(osg::Group* osgParent, LongIDRecord* rec); + + osg::Node* visitHeader(osg::Group* osgParent, HeaderRecord* rec); + osg::Node* visitColorPalette(osg::Group* osgParent, ColorPaletteRecord* rec); + osg::Node* visitMaterialPalette(osg::Group* osgParent, MaterialPaletteRecord* rec); + osg::Node* visitTexturePalette(osg::Group* osgParent, TexturePaletteRecord* rec); + osg::Node* visitVertexPalette(osg::Group* osgParent, VertexPaletteRecord* rec); + osg::Node* visitVertex(osg::Group* osgParent, VertexRecord* rec); + osg::Node* visitNormalVertex(osg::Group* osgParent, NormalVertexRecord* rec); + osg::Node* visitTextureVertex(osg::Group* osgParent, TextureVertexRecord* rec); + osg::Node* visitNormalTextureVertex(osg::Group* osgParent, NormalTextureVertexRecord* rec); + osg::Node* visitGroup(osg::Group* osgParent, GroupRecord* rec); + osg::Node* visitLOD(osg::Group* osgParent, LodRecord* rec); + osg::Node* visitOldLOD(osg::Group* osgParent, OldLodRecord* rec); + osg::Node* visitDOF(osg::Group* osgParent, DofRecord* rec); + osg::Node* visitSwitch(osg::Group* osgParent, SwitchRecord* rec); + osg::Node* visitObject(osg::Group* osgParent, ObjectRecord* rec); + osg::Node* visitMatrix(osg::Group* osgParent, MatrixRecord* rec); + osg::Node* visitExternal(osg::Group* osgParent, ExternalRecord* rec); + + void visitFace(GeoSetBuilder* pParent, FaceRecord* rec); + void visitLightPoint(GeoSetBuilder* pBuilder, LightPointRecord* rec); + void visitVertexList(GeoSetBuilder* pParent, VertexListRecord* rec); + +private: + + Record* getVertexFromPool(int nOffset); + void regisiterVertex(int nOffset, Record* pRec); + + typedef std::map VertexPaletteOffsetMap; + VertexPaletteOffsetMap _VertexPaletteOffsetMap; + + FltFile* _pFltFile; + + int _diOpenFlightVersion; + int _diCurrentOffset; + unsigned short _wObjTransparency; + int _nSubfaceLevel; + +}; + + +}; // end namespace flt + +#endif // __FLT_2_OSG_H + diff --git a/src/osgPlugins/flt/license.txt b/src/osgPlugins/flt/license.txt new file mode 100644 index 000000000..4c01d13d3 --- /dev/null +++ b/src/osgPlugins/flt/license.txt @@ -0,0 +1,28 @@ + +// +// OpenFlight® loader for Open Scene Graph +// +// Copyright (C) 2000 Brede Johansen +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. +// +// The Open Scene Graph (OSG) is a cross platform C++/OpenGL library for +// real-time rendering of large 3D photo-realistic models. +// The OSG homepage is http://www.openscenegraph.org/ +// +// MultiGen, OpenFlight, and Flight Format are registered trademarks of MultiGen Inc. +// diff --git a/src/osgPlugins/flt/opcodes.h b/src/osgPlugins/flt/opcodes.h new file mode 100644 index 000000000..a16ce960b --- /dev/null +++ b/src/osgPlugins/flt/opcodes.h @@ -0,0 +1,70 @@ +// Opcode.h + + +#ifndef __FLT_OPCODE_H +#define __FLT_OPCODE_H + +#define OF_VERSION 1520 //OpenFlight version + +#define UNKNOWN_OP 0 + +#define HEADER_OP 1 +#define GROUP_OP 2 +#define OLD_LOD_OP 3 +#define OBJECT_OP 4 +#define FACE_OP 5 +#define OLD_VERTEX_OP 7 +#define OLD_VERTEX_COLOR_OP 8 +#define OLD_VERTEX_COLOR_NORMAL_OP 9 +#define PUSH_LEVEL_OP 10 +#define POP_LEVEL_OP 11 +#define DOF_OP 14 +#define PUSH_SUBFACE_OP 19 +#define POP_SUBFACE_OP 20 +#define PUSH_EXTENSION_OP 21 +#define POP_EXTENSION_OP 22 +#define COMMENT_OP 31 +#define COLOR_PALETTE_OP 32 +#define LONG_ID_OP 33 + // Opcodes 40 to 48 are obsolete +#define MATRIX_OP 49 +#define VECTOR_OP 50 +#define REPLICATE_OP 60 +#define INSTANCE_REFERENCE_OP 61 +#define INSTANCE_DEFINITION_OP 62 +#define EXTERNAL_REFERENCE_OP 63 +#define TEXTURE_PALETTE_OP 64 +#define VERTEX_PALETTE_OP 67 +#define VERTEX_C_OP 68 +#define VERTEX_CN_OP 69 +#define VERTEX_CNT_OP 70 +#define VERTEX_CT_OP 71 +#define VERTEX_LIST_OP 72 +#define LOD_OP 73 +#define BOUNDING_BOX_OP 74 +#define ROTATE_ABOUT_EDGE_OP 76 +#define TRANSLATE_OP 78 +#define SCALE_OP 79 +#define ROTATE_ABOUT_POINT_OP 80 +#define ROTATE_SCALE_TO_POINT_OP 81 +#define PUT_TRANSFORM_OP 82 +#define ROAD_ZONE_OP 88 +#define MORPH_VERTEX_LIST_OP 89 +#define GENERAL_MATRIX_OP 94 +#define SWITCH_OP 96 +#define EXTENSION_OP 100 +#define LIGHT_SOURCE_OP 101 +#define LIGHT_SOURCE_PALETTE_OP 102 +#define BOUNDING_SPHERE_OP 105 +#define BOUNDING_CYLINDER_OP 106 +#define BOUNDING_VOLUME_CENTER_OP 108 +#define BOUNDING_VOLUME_ORIENTATION_OP 109 +#define LIGHT_POINT_OP 111 +#define TEXTURE_MAPPING_PALETTE_OP 112 +#define MATERIAL_PALETTE_OP 113 +#define CAT_OP 115 +#define CAT_DATA_OP 116 + +#endif // __FLT_OPCODE_H + + diff --git a/src/osgPlugins/fly/Makedepend b/src/osgPlugins/fly/Makedepend new file mode 100644 index 000000000..e69de29bb diff --git a/src/osgPlugins/fly/Makefile b/src/osgPlugins/fly/Makefile new file mode 100644 index 000000000..49975f3bb --- /dev/null +++ b/src/osgPlugins/fly/Makefile @@ -0,0 +1,26 @@ +#!smake +include ../../../Make/makedefs + +C++FILES = \ + hat.cpp\ + vector.cpp\ + matrix.cpp\ + fly.cpp\ + terrain.cpp\ + tank.cpp\ + sky.cpp\ + base.cpp\ + trees.cpp\ + + +LIB = ../../../lib/osgPlugins/osgdb_fly.so + +TARGET_LOADER_FILES = osgPlugins/osgdb_fly.so + +C++FLAGS += -I../../../include +LDFLAGS += -L../../../lib + +include ../../../Make/makerules + + + diff --git a/src/osgPlugins/fly/base.cpp b/src/osgPlugins/fly/base.cpp new file mode 100644 index 000000000..cd17e92c3 --- /dev/null +++ b/src/osgPlugins/fly/base.cpp @@ -0,0 +1,97 @@ +#include + +#include +#include +#include +#include +#include +#include + +using namespace osg; + +Node *makeBase( void ) +{ + int i, c; + float theta; + float ir, ori; + ir = 6.0; + ori = 20.0; + + + Vec3 *coords = new Vec3[38]; + Vec2 *tcoords = new Vec2[38]; + Vec4 *colors = new Vec4[1]; + int *lengths = new int[1]; + + colors[0][0] = colors[0][1] = colors[0][2] = colors[0][3] = 1; + + c = 0; + for( i = 0; i <= 18; i++ ) + { + theta = (float)i * 20.0 * M_PI/180.0; + + coords[c][0] = ir * cosf( theta ); + coords[c][1] = ir * sinf( theta ); + coords[c][2] = 0.0; + tcoords[c][0] = coords[c][0]/36.; + tcoords[c][1] = coords[c][1]/36.; + + c++; + + coords[c][0] = ori * cosf( theta ); + coords[c][1] = ori * sinf( theta ); + coords[c][2] = 0.0f; + + tcoords[c][0] = coords[c][0]/36.; + tcoords[c][1] = coords[c][1]/36.; + + c++; + } + *lengths = 38; + + + GeoSet *gset = new GeoSet; + + gset->setCoords( coords ); + + gset->setTextureCoords( tcoords ); + gset->setTextureBinding( GeoSet::BIND_PERVERTEX ); + + gset->setColors( colors ); + gset->setColorBinding( GeoSet::BIND_OVERALL ); + + gset->setPrimType( GeoSet::TRIANGLE_STRIP ); + gset->setNumPrims( 1 ); + gset->setPrimLengths( lengths ); + + Texture *tex = new Texture; + + tex->setImage(Registry::instance()->readImage("water.rgb")); + + tex->setWrap( Texture::WRAP_S, Texture::REPEAT ); + tex->setWrap( Texture::WRAP_T, Texture::REPEAT ); + + GeoState *gstate = new GeoState; + gstate->setMode( GeoState::TEXTURE, GeoState::ON ); + gstate->setMode( GeoState::LIGHTING, GeoState::OFF ); + gstate->setAttribute( GeoState::TEXTURE, tex ); + gstate->setAttribute( GeoState::TEXENV, new TexEnv ); +/* + pfFog *fog = new pfFog; + + fog->setFogType( PFFOG_PIX_EXP2 ); + fog->setColor( 0.1, 0.2, 0.2 ); + fog->setRange( 16.0, 22.0 ); + + gstate->setMode( PFSTATE_ENFOG, PF_ON ); + gstate->setAttr( PFSTATE_FOG, fog ); +*/ + + gset->setGeoState( gstate ); + + + Geode *geode = new Geode; + geode->addGeoSet( gset ); + + return geode; +} diff --git a/src/osgPlugins/fly/fly.cpp b/src/osgPlugins/fly/fly.cpp new file mode 100644 index 000000000..6137e7e2c --- /dev/null +++ b/src/osgPlugins/fly/fly.cpp @@ -0,0 +1,137 @@ +#include +#include +#include +#include +#include +#include +#include + +using namespace osg; + +extern Node *makeTerrain( void ); +extern Node *makeTrees( void ); +extern Node *makeTank( void ); +extern Node *makeWindsocks( void ); +extern Node *makeGliders( void ); +extern Node *makeGlider( void ); +extern Node *makeSky( void ); +extern Node *makeBase( void ); +extern Node *makeClouds( void ); + + +extern "C" { +Node* LoadFile_fly( const char *file ); +void InitConverter_fly( void ); +} + +static struct _nodes { + char *name; + Node *(*fptr)(void); +}nodes[] = { + { "terrain", makeTerrain }, + { "tank", makeTank }, + { "sky", makeSky }, + { "base", makeBase }, + { "trees", makeTrees }, +// { "gliders", makeGliders }, +// { "clouds", makeClouds }, + + { 0L, 0L } +}; + +void InitConverter_fly( void ) +{ +} + + +Node* LoadFile_fly( const char *file ) +{ + char buff[256]; + + osg::notify(osg::INFO)<< "sgLoadFile_fly( "<name; nptr ++ ) + { + if( !strncmp( buff, nptr->name, strlen( nptr->name ) )) + { + Node *node = nptr->fptr(); + node->setName( nptr->name ); + grp->addChild( node ); + break; + } + } + } + fclose( fp ); + + return grp; +} + +class sgReaderWriterFLY : public ReaderWriter { + public: + virtual const char* className() { return "Default FLY Database Reader/Writer"; } + virtual bool acceptsExtension(const std::string& extension) { return extension=="fly"; } + + virtual Node* readNode(const std::string& fileName) + { + char buff[256]; + + osg::notify(osg::INFO)<< "sgReaderWriterFLY::readNode( "<name; nptr ++ ) + { + if( !strncmp( buff, nptr->name, strlen( nptr->name ) )) + { + Node *node = nptr->fptr(); + node->setName( nptr->name ); + grp->addChild( node ); + break; + } + } + } + fclose( fp ); + + return grp; + + } + + virtual bool writeNode(Node& obj,const std::string& fileName) { + return false; + } + +}; + +// now register with sgRegistry to instantiate the above +// reader/writer. +RegisterReaderWriterProxy g_readerWriter_FLY_Proxy; diff --git a/src/osgPlugins/fly/hat.cpp b/src/osgPlugins/fly/hat.cpp new file mode 100644 index 000000000..a2f89eb9c --- /dev/null +++ b/src/osgPlugins/fly/hat.cpp @@ -0,0 +1,149 @@ +#ifdef WIN32 +#include +#pragma warning( disable : 4244 ) +#endif + +#include +#include +#include + +#include "terrain_data.h" +#include "hat.h" + +static int inited = 0; + +static float dbcenter[3]; +static float dbradius; + +static void getDatabaseCenterRadius( float dbcenter[3], float *dbradius ) +{ + int i; + double n=0.0; + double center[3] = { 0.0f, 0.0f, 0.0f }; + float cnt; + + cnt = 39 * 38; + for( i = 0; i < cnt; i++ ) + { + center[0] += (double)vertex[i][0]; + center[1] += (double)vertex[i][1]; + center[2] += (double)vertex[i][2]; + + n = n + 1.0; + } + + center[0] /= n; + center[1] /= n; + center[2] /= n; + + float r = 0.0; + +// for( i = 0; i < sizeof( vertex ) / (sizeof( float[3] )); i++ ) + for( i = 0; i < cnt; i++ ) + { + double d = sqrt( + (((double)vertex[i][0] - center[0]) * ((double)vertex[i][0] - center[0])) + + (((double)vertex[i][1] - center[1]) * ((double)vertex[i][1] - center[1])) + + (((double)vertex[i][2] - center[2]) * ((double)vertex[i][2] - center[2])) ); + + if( d > (double)r ) r = (float)d; + + } + + *dbradius = r; + dbcenter[0] = (float)center[0]; + dbcenter[1] = (float)center[1]; + dbcenter[2] = (float)center[2]; + + int index = 19 * 39 + 19; + dbcenter[0] = vertex[index][0] - 0.15; + dbcenter[1] = vertex[index][1]; + dbcenter[2] = vertex[index][2] + 0.35; +} + +static void init( void ) +{ + getDatabaseCenterRadius( dbcenter, &dbradius ); + inited = 1; +} + +static void getNormal( float *v1, float *v2, float *v3, float *n ) +{ + float V1[4], V2[4]; + float f; + int i; + +/* Two vectors v2->v1 and v2->v3 */ + + for( i = 0; i < 3; i++ ) + { + V1[i] = v1[i] - v2[i]; + V2[i] = v3[i] - v2[i]; + } + +/* Cross product between V1 and V2 */ + + n[0] = (V1[1] * V2[2]) - (V1[2] * V2[1]); + n[1] = -((V1[0] * V2[2]) - ( V1[2] * V2[0] )); + n[2] = (V1[0] * V2[1] ) - (V1[1] * V2[0] ); + +/* Normalize */ + + f = sqrtf( ( n[0] * n[0] ) + ( n[1] * n[1] ) + ( n[2] * n[2] ) ); + n[0] /= f; + n[1] /= f; + n[2] /= f; +} + + +float Hat( float x, float y, float z ) +{ + int m, n; + int i, j; + float tri[3][3]; + float norm[3]; + float d, pz; + + if( inited == 0 ) init(); + + // m = columns + // n = rows + m = (sizeof( vertex ) /(sizeof( float[3])))/39; + n = 39; + + i = 0; + while( i < ((m-1)*39) && x > (vertex[i+n][0] - dbcenter[0]) ) + i += n; + + j = 0; + + while( j < n-1 && y > (vertex[i+j+1][1] - dbcenter[1]) ) + j++; + + + tri[0][0] = vertex[i+0+j+0][0] - dbcenter[0]; + tri[0][1] = vertex[i+0+j+0][1] - dbcenter[1]; + //tri[0][2] = vertex[i+0+j+0][2] - dbcenter[2]; + tri[0][2] = vertex[i+0+j+0][2]; + + tri[1][0] = vertex[i+n+j+0][0] - dbcenter[0]; + tri[1][1] = vertex[i+n+j+0][1] - dbcenter[1]; + //tri[1][2] = vertex[i+n+j+0][2] - dbcenter[2]; + tri[1][2] = vertex[i+n+j+0][2]; + + tri[2][0] = vertex[i+0+j+1][0] - dbcenter[0]; + tri[2][1] = vertex[i+0+j+1][1] - dbcenter[1]; + //tri[2][2] = vertex[i+0+j+1][2] - dbcenter[2]; + tri[2][2] = vertex[i+0+j+1][2]; + + getNormal( tri[0], tri[1], tri[2], norm ); + + d = (tri[0][0] * norm[0]) + + (tri[0][1] * norm[1]) + + (tri[0][2] * norm[2]); + + d *= -1; + pz = (-(norm[0] * x) - (norm[1] * y) - d)/norm[2]; + + return z - pz; +} diff --git a/src/osgPlugins/fly/hat.h b/src/osgPlugins/fly/hat.h new file mode 100644 index 000000000..1e4a20384 --- /dev/null +++ b/src/osgPlugins/fly/hat.h @@ -0,0 +1,4 @@ +#ifndef __HAT_H +#define __HAT_H +extern float Hat( float x, float y, float z ); +#endif diff --git a/src/osgPlugins/fly/matrix.cpp b/src/osgPlugins/fly/matrix.cpp new file mode 100644 index 000000000..cf151b73c --- /dev/null +++ b/src/osgPlugins/fly/matrix.cpp @@ -0,0 +1,113 @@ +#include +#include +#include "matrix.h" +#include + +static float ID[4][4] = { + { 1.0, 0.0, 0.0, 0.0 }, + { 0.0, 1.0, 0.0, 0.0 }, + { 0.0, 0.0, 1.0, 0.0 }, + { 0.0, 0.0, 0.0, 1.0 }, +}; + + +static float M[2][4][4]; +static int mi = 0; +static float R[4][4]; +static float T[4][4]; +static float S[4][4]; + +static void preMultiply( float m[4][4] ) +{ + int i, j, k; + int mo; + + mo = 1 - mi; + + for( i = 0; i < 4; i++ ) + { + for( j = 0; j < 4; j++ ) + { + M[mo][i][j] = 0.0; + for( k = 0; k < 4; k++ ) + M[mo][i][j] += m[i][k] * M[mi][k][j]; + } + } + + mi = mo; +} + +void m_LoadID( void ) +{ + memcpy( M[mi], ID, sizeof( float ) * 16 ); +} + + +void m_Rotate( float a, char axis ) +{ + float theta; + + theta = a * M_PI/180.0; + + memcpy( R, ID, sizeof( float) * 16 ); + switch( axis ) + { + case 'x' : + R[1][1] = cosf( theta ); + R[1][2] = -sinf( theta ); + R[2][1] = sinf( theta ); + R[2][2] = cosf( theta ); + break; + + case 'y' : + R[0][0] = cosf( theta ); + R[0][2] = -sinf( theta ); + R[2][0] = sinf( theta ); + R[2][2] = cosf( theta ); + break; + + case 'z' : + R[0][0] = cosf( theta ); + R[0][1] = -sinf( theta ); + R[1][0] = sinf( theta ); + R[1][1] = cosf( theta ); + break; + } + + preMultiply( R ); +} + +void m_Translate( float x, float y, float z ) +{ + memcpy( T, ID, sizeof( float) * 16 ); + + T[3][0] = x; + T[3][1] = y; + T[3][2] = z; + + preMultiply( T ); +} + +void m_Scale( float x, float y, float z ) +{ + memcpy( S, ID, sizeof( float ) * 16 ); + + S[0][0] = x; + S[1][1] = y; + S[2][2] = z; + + preMultiply( S ); +} + + +void m_MultV( float v[4], float r[4] ) +{ + int i, j; + + for( i = 0; i < 4; i++ ) + { + r[i] = 0.0; + for( j = 0; j < 4; j++ ) + r[i] += v[j] * M[mi][j][i]; + } +} diff --git a/src/osgPlugins/fly/matrix.h b/src/osgPlugins/fly/matrix.h new file mode 100644 index 000000000..d4a843c78 --- /dev/null +++ b/src/osgPlugins/fly/matrix.h @@ -0,0 +1,15 @@ +#ifndef __MATRIX_H +#define __MATRIX_H + + + +extern void m_LoadID( void ); +extern void m_Rotate( float, char ); +extern void m_Translate( float, float, float ); +extern void m_Scale( float, float, float ); +extern void m_MultV( float [4], float [4] ); + + + + +#endif diff --git a/src/osgPlugins/fly/oldtrees.cpp b/src/osgPlugins/fly/oldtrees.cpp new file mode 100644 index 000000000..f22d490ee --- /dev/null +++ b/src/osgPlugins/fly/oldtrees.cpp @@ -0,0 +1,261 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#include "hat.h" + +#ifdef WIN32 +#pragma warning( disable : 4244 ) +#pragma warning( disable : 4305 ) +#endif + +using namespace osg; + +#define sqr(x) ((x)*(x)) + +extern void getDatabaseCenterRadius( float dbcenter[3], float *dbradius ); + +static float dbcenter[3], dbradius; + +static struct _tree{ + int n; + float x, y, z; + float w, h; +}trees[] = { + { 0, -0.4769, -0.8972, -0.4011, 0.2000, 0.1200 }, + { 1, -0.2543, -0.9117, -0.3873, 0.2000, 0.1200 }, + { 2, -0.0424, -0.8538, -0.3728, 0.2000, 0.1200 }, + { 3, 0.1590, -0.8827, -0.3594, 0.2000, 0.1200 }, + { 4, -0.4981, -1.0853, -0.4016, 0.3500, 0.1200 }, + { 5, -0.5405, -1.2590, -0.4050, 0.2000, 0.1200 }, + { 6, -0.5723, -1.5339, -0.4152, 0.2000, 0.1200 }, + { 7, -0.6252, -1.8667, -0.4280, 0.2000, 0.1200 }, + { 8, -0.5617, -2.1851, -0.4309, 0.2000, 0.1200 }, + { 9, -0.5087, -2.4166, -0.4215, 0.2000, 0.1200 }, + { 10, -0.4345, -2.3443, -0.4214, 0.2000, 0.1200 }, + { 11, -3.0308, -1.5484, -0.4876, 0.2000, 0.1200 }, + { 12, -3.0202, -1.6497, -0.4963, 0.2000, 0.1200 }, + { 13, -2.9355, -1.8378, -0.4969, 0.2000, 0.1200 }, + { 14, -0.6040, -2.0259, -0.4300, 0.2000, 0.1200 }, + { 15, -0.5442, -1.3442, -0.4080, 0.1000, 0.1200 }, + { 16, -0.5639, -1.6885, -0.4201, 0.1000, 0.1200 }, + { 17, 0.9246, 3.4835, 0.5898, 0.2500, 0.1000 }, + { 18, 0.0787, 3.8687, 0.3329, 0.2500, 0.1200 }, + { 19, 0.2885, 3.7130, 0.4047, 0.2500, 0.1200 }, + { 20, 0.2033, 3.6228, 0.3704, 0.2500, 0.1200 }, + { 21, -0.2098, 3.9015, 0.2327, 0.2500, 0.1200 }, + { 22, -0.3738, 3.7376, 0.1722, 0.2500, 0.1200 }, + { 23, -0.2557, 3.6064, 0.1989, 0.2500, 0.1200 }, + { 24, 0.0590, 3.7294, 0.3210, 0.2500, 0.1200 }, + { 25, -0.4721, 3.8851, 0.1525, 0.2500, 0.1200 }, + { 26, 0.9639, 3.2048, 0.5868, 0.1200, 0.0800 }, + { 27, 0.7082, -1.0409, -0.3221, 0.1000, 0.1000 }, + { 28, -0.2426, -2.3442, -0.4150, 0.1000, 0.1380 }, + { 29, -0.1770, -2.4179, -0.4095, 0.1000, 0.1580 }, + { 30, -0.0852, -2.5327, -0.4056, 0.1000, 0.1130 }, + { 31, -0.0131, -2.6065, -0.4031, 0.1000, 0.1150 }, + { 32, 0.0787, -2.6638, -0.4012, 0.1000, 0.1510 }, + { 33, 0.1049, -2.7622, -0.3964, 0.1000, 0.1270 }, + { 34, 0.1770, -2.8687, -0.3953, 0.1000, 0.1100 }, + { 35, 0.3213, -2.9507, -0.3974, 0.1000, 0.1190 }, + { 36, 0.4065, -3.0163, -0.4014, 0.1000, 0.1120 }, + { 37, 0.3738, -3.1802, -0.4025, 0.1000, 0.1860 }, + { 38, 0.5508, -3.2048, -0.3966, 0.1000, 0.1490 }, + { 39, 0.5836, -3.3031, -0.3900, 0.1000, 0.1670 }, + { 40, -0.3082, -2.7212, -0.3933, 0.1000, 0.1840 }, + { 41, -0.1967, -2.6474, -0.4017, 0.1000, 0.1600 }, + { 42, -0.1180, -2.7458, -0.3980, 0.1000, 0.1250 }, + { 43, -0.3344, -2.8359, -0.3964, 0.1000, 0.1430 }, + { 44, -0.2492, -2.8933, -0.3838, 0.1000, 0.1890 }, + { 45, -0.1246, -3.0491, -0.3768, 0.1000, 0.1830 }, + { 46, 0.0000, -3.0818, -0.3696, 0.1000, 0.1370 }, + { 47, -0.2295, -3.0409, -0.3706, 0.1000, 0.1660 }, + { 48, -1.3245, 2.6638, 0.0733, 0.0500, 0.0500 }, + { 49, 2.2425, -1.5491, -0.2821, 0.2300, 0.1200 }, + { 50, 0.2164, -2.1311, -0.4000, 0.1000, 0.0690 }, + { 51, 0.2885, -2.2130, -0.4000, 0.1000, 0.0790 }, + { 52, 0.3606, -2.2786, -0.4000, 0.1000, 0.0565 }, + { 53, 0.4328, -2.3442, -0.4000, 0.1000, 0.0575 }, + { 54, 0.5246, -2.4343, -0.4086, 0.1000, 0.0755 }, + { 55, 0.6360, -2.5245, -0.4079, 0.1000, 0.0635 }, + { 56, 0.7541, -2.4261, -0.4007, 0.1000, 0.0550 }, + { 57, 0.7934, -2.2786, -0.3944, 0.1000, 0.0595 }, + { 58, 1.0295, -2.2868, -0.3837, 0.1000, 0.0560 }, + { 59, 0.8459, -2.6474, -0.4051, 0.1000, 0.0930 }, + { 60, 1.0426, -2.6884, -0.4001, 0.1000, 0.0745 }, + { 61, 1.1475, -2.7458, -0.3883, 0.1000, 0.0835 }, + { 62, -0.1967, -1.4180, -0.3988, 0.1000, 0.0920 }, + { 63, -0.0131, -1.2704, -0.3856, 0.1000, 0.0690 }, + { 64, 0.2098, -1.2049, -0.3664, 0.1000, 0.0790 }, + { 65, 0.3410, -1.3196, -0.3652, 0.1000, 0.0565 }, + { 66, 0.5705, -1.2704, -0.3467, 0.1000, 0.0575 }, + { 67, 0.6360, -1.4344, -0.3532, 0.1000, 0.0755 }, + { 68, 0.9246, -1.4180, -0.3329, 0.1000, 0.0635 }, + { 69, 1.0623, -1.3360, -0.3183, 0.1000, 0.0550 }, + { 70, 1.2393, -1.3934, -0.3103, 0.1000, 0.0595 }, + { 71, 1.3639, -1.4753, -0.3079, 0.1000, 0.0560 }, + { 72, 1.4819, -1.5983, -0.3210, 0.1000, 0.0930 }, + { 73, 1.7835, -1.5819, -0.3065, 0.1000, 0.0745 }, + { 74, 1.9343, -2.1065, -0.3307, 0.1000, 0.0835 }, + { 75, 2.1245, -2.3196, -0.3314, 0.1000, 0.0920 }, + { 76, 2.2556, -2.3032, -0.3230, 0.1000, 0.0800 }, + { 77, 2.4196, -2.3688, -0.3165, 0.1000, 0.0625 }, + { 78, 1.7835, -2.5327, -0.3543, 0.1000, 0.0715 }, + { 79, 1.7180, -2.8933, -0.3742, 0.1000, 0.0945 }, + { 80, 1.9343, -3.0409, -0.3727, 0.1000, 0.0915 }, + { 81, 2.4524, -3.4671, -0.3900, 0.1000, 0.0685 }, + { 82, 2.4786, -2.8851, -0.3538, 0.1000, 0.0830 }, + { 83, 2.3343, -2.6228, -0.3420, 0.1000, 0.0830 }, + { 84, 2.8130, -2.0737, -0.2706, 0.1000, 0.0890 }, + { 85, 2.6360, -1.8278, -0.2661, 0.1000, 0.0975 }, + { 86, 2.3958, -1.7130, -0.2774, 0.2000, 0.1555 }, + { 87, 2.2688, -1.2868, -0.2646, 0.1000, 0.0835 }, + { 88, 2.4196, -1.1147, -0.2486, 0.1000, 0.0770 }, + { 89, 2.7802, -2.3933, -0.3017, 0.1000, 0.0655 }, + { 90, 3.0163, -2.4179, -0.2905, 0.1000, 0.0725 }, + { 91, 2.9310, -2.2540, -0.2798, 0.1000, 0.0910 }, + { 92, 2.6622, -2.0983, -0.2823, 0.1000, 0.0680 }, + { 93, 2.3147, -1.9753, -0.2973, 0.1000, 0.0620 }, + { 94, 2.1573, -1.8770, -0.3013, 0.1000, 0.0525 }, + { 95, 2.0196, -1.7868, -0.3044, 0.1000, 0.0970 }, + { 96, 2.7802, -3.3031, -0.3900, 0.1000, 0.0510 }, + { 97, 2.8589, -3.1720, -0.3900, 0.1000, 0.0755 }, + { 98, 3.0163, -2.8114, -0.3383, 0.1000, 0.0835 }, + { 99, 3.5081, -2.4179, -0.2558, 0.1000, 0.0770 }, + { 100, 3.5277, -2.3196, -0.2366, 0.1000, 0.0765 }, + { 101, 3.6654, -2.5819, -0.2566, 0.1000, 0.0805 }, + { 102, 3.7179, -2.7622, -0.2706, 0.1000, 0.0980 }, + { 103, 3.7769, -2.4671, -0.2339, 0.1000, 0.0640 }, + { 104, 3.3441, -2.4671, -0.2693, 0.1000, 0.0940 }, + { -1, 0, 0, 0, 0, 0 }, +}; + + +static GeoSet *makeTree( _tree *tree, GeoState *gstate ) +{ + float vv[][3] = { + { -tree->w/2.0, 0.0, 0.0 }, + { tree->w/2.0, 0.0, 0.0 }, + { tree->w/2.0, 0.0, 2 * tree->h }, + { -tree->w/2.0, 0.0, 2 * tree->h }, + }; + + Vec3 *v = new Vec3[4]; + Vec2 *t = new Vec2[4]; + Vec4 *l = new Vec4[1]; + + int i; + + l[0][0] = l[0][1] = l[0][2] = l[0][3] = 1; + + for( i = 0; i < 4; i++ ) + { + v[i][0] = vv[i][0]; + v[i][1] = vv[i][1]; + v[i][2] = vv[i][2]; + } + + + + + t[0][0] = 0.0; t[0][1] = 0.0; + t[1][0] = 1.0; t[1][1] = 0.0; + t[2][0] = 1.0; t[2][1] = 1.0; + t[3][0] = 0.0; t[3][1] = 1.0; + + GeoSet *gset = new GeoSet; + + gset->setCoords( v ); + + gset->setTextureCoords( t ); + gset->setTextureBinding( GeoSet::BIND_PERVERTEX ); + + gset->setColors( l ); + gset->setColorBinding( GeoSet::BIND_OVERALL ); + + gset->setPrimType( GeoSet::QUADS ); + gset->setNumPrims( 1 ); + + gset->setGeoState( gstate ); + + return gset; +} + +static float ttx, tty; + +static int ct( const void *a, const void *b ) +{ + _tree *ta = (_tree *)a; + _tree *tb = (_tree *)b; + + float da = sqrtf( sqr(ta->x - ttx) + sqr(ta->y - tty) ); + float db = sqrtf( sqr(tb->x - ttx) + sqr(tb->y - tty) ); + + if( da < db ) + return -1; + else + return 1; +} + +Node *makeTrees( void ) +{ + Group *group = new Group; + int i; + + getDatabaseCenterRadius( dbcenter, &dbradius ); + struct _tree *t; + + Texture *tex = new Texture; + tex->setImage(Registry::instance()->readImage("tree0.rgba")); + + GeoState *gstate = new GeoState; + gstate->setMode( GeoState::TRANSPARENCY, GeoState::ON ); + gstate->setAttribute( GeoState::TRANSPARENCY, new Transparency ); + gstate->setMode( GeoState::TEXTURE, GeoState::ON ); + gstate->setAttribute( GeoState::TEXTURE, tex ); + gstate->setAttribute( GeoState::TEXENV, new TexEnv ); + + gstate->setMode( GeoState::LIGHTING, GeoState::OFF ); + + int tt[] = { 15, 30, 45, 58, 72, 75, 93, 96, 105, -1 }; + int *ttp = tt; + + i = 0; + while( i < 105 ) + { + ttx = trees[i].x; + tty = trees[i].y; + qsort( &trees[i], 105 - i, sizeof( _tree ), ct ); + + i += *ttp; + ttp++; + } + + t = trees; + i = 0; + ttp = tt; + while( *ttp != -1 ) + { + Billboard *bb = new Billboard; + //int starti = i; + + for( ; i < (*ttp); i++ ) + { + t->x -= 0.3f; + float h = Hat(t->x, t->y, t->z ); + Vec3 pos( t->x, t->y, t->z-h ); + GeoSet *gset = makeTree( t, gstate ); + bb->addGeoSet( gset, pos ); + t++; + } + group->addChild( bb ); + ttp++; + } + + return group; +} diff --git a/src/osgPlugins/fly/sky.cpp b/src/osgPlugins/fly/sky.cpp new file mode 100644 index 000000000..3d3e214cd --- /dev/null +++ b/src/osgPlugins/fly/sky.cpp @@ -0,0 +1,109 @@ +#include + +#include +#include +#include +#include +#include +#include + +#ifdef WIN32 +#pragma warning( disable : 4244 ) +#pragma warning( disable : 4305 ) +#endif + +using namespace osg; + +Node *makeSky( void ) +{ + int i, j; + float lev[] = { -5, -1.0, 1.0, 15.0, 30.0, 60.0, 90.0 }; + float cc[][4] = { + { 0.0, 0.0, 0.15 }, + { 0.0, 0.0, 0.15 }, + { 0.4, 0.4, 0.7 }, + { 0.2, 0.2, 0.6 }, + { 0.1, 0.1, 0.6 }, + { 0.1, 0.1, 0.6 }, + { 0.1, 0.1, 0.6 }, + }; + float x, y, z; + float alpha, theta; + float radius = 20.0f; + int nlev = sizeof( lev )/sizeof(float); + + Vec3 *coords = new Vec3[19*nlev]; + Vec4 *colors = new Vec4[19*nlev]; + Vec2 *tcoords = new Vec2[19*nlev]; + osg::ushort *idx = new osg::ushort[38* nlev]; + int *lengths = new int[nlev]; + + + int ci, ii; + ii = ci = 0; + + for( i = 0; i < nlev; i++ ) + { + for( j = 0; j <= 18; j++ ) + { + alpha = lev[i] * M_PI/180.0; + theta = (float)(j*20) * M_PI/180.0; + + x = radius * cosf( alpha ) * cosf( theta ); + y = radius * cosf( alpha ) * -sinf( theta ); + z = radius * sinf( alpha ); + + coords[ci][0] = x; + coords[ci][1] = y; + coords[ci][2] = z; + + colors[ci][0] = cc[i][0]; + colors[ci][1] = cc[i][1]; + colors[ci][2] = cc[i][2]; + colors[ci][3] = 1.0; + + + tcoords[ci][0] = (float)j/18.0; + tcoords[ci][0] = (float)i/(float)(nlev-1); + + ci++; + + idx[ii++] = ((i+1)*19+j); + idx[ii++] = ((i+0)*19+j); + } + lengths[i] = 38; + } + + GeoSet *gset = new GeoSet; + + gset->setCoords( coords, idx ); + gset->setTextureCoords( tcoords, idx ); + gset->setTextureBinding( GeoSet::BIND_PERVERTEX ); + + gset->setColors( colors, idx ); + gset->setColorBinding( GeoSet::BIND_PERVERTEX ); + + gset->setPrimType( GeoSet::TRIANGLE_STRIP ); + gset->setNumPrims( nlev - 1 ); + gset->setPrimLengths( lengths ); + + Texture *tex = new Texture; + tex->setImage(Registry::instance()->readImage( "white.rgb")); + + GeoState *gstate = new GeoState; +// gstate->setMode( GeoState::TEXTURE, GeoState::ON ); + gstate->setMode( GeoState::TEXTURE, GeoState::OFF); + gstate->setAttribute( GeoState::TEXTURE, tex ); + gstate->setAttribute( GeoState::TEXENV, new TexEnv ); + gstate->setMode( GeoState::LIGHTING, GeoState::OFF ); + gstate->setMode( GeoState::FACE_CULL, GeoState::ON ); + + gset->setGeoState( gstate ); + + Geode *geode = new Geode; + geode->addGeoSet( gset ); + + geode->setName( "Sky" ); + + return geode; +} diff --git a/src/osgPlugins/fly/tank.cpp b/src/osgPlugins/fly/tank.cpp new file mode 100644 index 000000000..667f5614f --- /dev/null +++ b/src/osgPlugins/fly/tank.cpp @@ -0,0 +1,193 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef WIN32 +#pragma warning( disable : 4244 ) +#pragma warning( disable : 4305 ) +#endif + +using namespace osg; + +extern void getDatabaseCenterRadius( float dbcenter[3], float *dbradius ); + +static float radius = 2.0; +static float dbcenter[3], dbradius; + +static void conv( const Vec3& a, const Matrix& mat, Vec3& b ) +{ + int i; + Vec3 t; + + for( i = 0; i < 3; i++ ) + { + t[i] = (a[0] * mat._mat[0][i]) + + (a[1] * mat._mat[1][i]) + + (a[2] * mat._mat[2][i]) + + mat._mat[3][i]; + } + b[0] = t[0]; + b[1] = t[1]; + b[2] = t[2]; +} + +Node *makeTank( void ) +{ + + Geode *geode1 = new Geode; + + getDatabaseCenterRadius( dbcenter, &dbradius ); + + ref_ptr mat = new Matrix( + 0.05, 0, 0, 0, + 0, 0.05, 0, 0, + 0, 0, 0.05, 0, + 1.5999 - 0.3, + 3.1474, + dbcenter[2] + 0.6542 - 0.09, + 1 + ); + + Vec3 *vc = new Vec3[42]; + Vec2 *tc = new Vec2[42]; + int *lens = new int[1]; + int i, c; + + c = 0; + for( i = 0; i <= 360; i += 18 ) + { + float x, y, z; + float s, t; + float theta = (float)i * M_PI/180.0; + + s = (float)i/90.0; + t = 1.0; + + x = radius * cosf( theta ); + y = radius * sinf( theta ); + z = 1.0; + + vc[c][0] = x; + vc[c][1] = y; + vc[c][2] = z; + + tc[c][0] = s; + tc[c][1] = t; + + c++; + + t = 0.0; + z = 0.0; + + vc[c][0] = x; + vc[c][1] = y; + vc[c][2] = z; + + tc[c][0] = s; + tc[c][1] = t; + c++; + } + *lens = 42; + + for( i = 0; i < c; i++ ) + conv( vc[i], *mat, vc[i] ); + + GeoSet *gset = new GeoSet; + gset->setCoords( vc ); + + gset->setTextureCoords( tc ); + gset->setTextureBinding( GeoSet::BIND_PERVERTEX ); + + gset->setPrimType( GeoSet::TRIANGLE_STRIP ); + gset->setNumPrims( 1 ); + gset->setPrimLengths( lens ); + + Texture *tex = new Texture; + + tex->setWrap( Texture::WRAP_S, Texture::REPEAT ); + tex->setWrap( Texture::WRAP_T, Texture::REPEAT ); + tex->setImage(Registry::instance()->readImage( "tank.rgb")); + + GeoState *gstate = new GeoState; + gstate->setMode( GeoState::TEXTURE, GeoState::ON ); + gstate->setAttribute( GeoState::TEXTURE, tex ); + gstate->setAttribute( GeoState::TEXENV, new TexEnv ); + + gset->setGeoState( gstate ); + geode1->addGeoSet( gset ); + + lens = new int[1]; + *lens = 22; + + vc = new Vec3[22]; + tc = new Vec2[22]; + + c = 0; + vc[c][0] = 0; + vc[c][1] = 0; + vc[c][2] = 1; + c++; + + for( i = 0; i <= 360; i += 18 ) + { + float x, y, z; + float s, t; + float theta = (float)i * M_PI/180.0; + + // s = (float)i/360.0; + // t = 1.0; + s = cosf( theta ); + t = sinf( theta ); + + x = radius * cosf( theta ); + y = radius * sinf( theta ); + z = 1.0; + + + vc[c][0] = x; + vc[c][1] = y; + vc[c][2] = z; + + tc[c][0] = s; + tc[c][1] = t; + + c++; + } + + for( i = 0; i < c; i++ ) + conv( vc[i], *mat, vc[i] ); + + gset = new GeoSet; + gset->setCoords( vc ); + gset->setTextureCoords( tc ); + gset->setPrimType(GeoSet::TRIANGLE_FAN); + gset->setNumPrims( 1 ); + gset->setPrimLengths( lens ); + + gset->setGeoState( gstate ); + + Geode *geode2 = new Geode; + geode2->addGeoSet( gset ); + + + + //DCS *dcs = new DCS(mat); + //dcs->addChild( geode2 ); + + + Group *grp = new Group; + grp->addChild( geode1 ); + grp->addChild( geode2 ); + + geode1->setName( "Geode 1" ); + geode2->setName( "Geode 2" ); + + return grp; +} diff --git a/src/osgPlugins/fly/terrain.cpp b/src/osgPlugins/fly/terrain.cpp new file mode 100644 index 000000000..b71d90acc --- /dev/null +++ b/src/osgPlugins/fly/terrain.cpp @@ -0,0 +1,137 @@ +// #include + +#include +#include +#include +#include +#include +#include + +#include "terrain_data.h" + +using namespace osg; + +void getDatabaseCenterRadius( float dbcenter[3], float *dbradius ) +{ + int i; + double n=0.0; + double center[3] = { 0.0f, 0.0f, 0.0f }; + float cnt; + + cnt = 39 * 38; + for( i = 0; i < cnt; i++ ) + { + center[0] += (double)vertex[i][0]; + center[1] += (double)vertex[i][1]; + center[2] += (double)vertex[i][2]; + + n = n + 1.0; + } + + center[0] /= n; + center[1] /= n; + center[2] /= n; + + float r = 0.0; + +// for( i = 0; i < sizeof( vertex ) / (sizeof( float[3] )); i++ ) + for( i = 0; i < cnt; i++ ) + { + double d = sqrt( + (((double)vertex[i][0] - center[0]) * ((double)vertex[i][0] - center[0])) + + (((double)vertex[i][1] - center[1]) * ((double)vertex[i][1] - center[1])) + + (((double)vertex[i][2] - center[2]) * ((double)vertex[i][2] - center[2])) ); + + if( d > (double)r ) r = (float)d; + + } + + *dbradius = r; + dbcenter[0] = (float)center[0]; + dbcenter[1] = (float)center[1]; + dbcenter[2] = (float)center[2]; + +int index = 19 * 39 + 19; + dbcenter[0] = vertex[index][0] - 0.15; + dbcenter[1] = vertex[index][1]; + dbcenter[2] = vertex[index][2] + 0.35; + +} + +Node *makeTerrain( void ) +{ + int m, n; + int i, j, c; + float dbcenter[3]; + float dbradius; + + getDatabaseCenterRadius( dbcenter, &dbradius ); + + m = (sizeof( vertex ) /(sizeof( float[3])))/39; + n = 39; + + Vec3 *v = new Vec3[m*n]; + Vec2 *t = new Vec2[m*n]; + Vec4 *col = new Vec4[1]; + osg::ushort *cidx = new osg::ushort; + osg::ushort *idx = new osg::ushort[m*n*2]; + int *lens = new int[m]; + + col[0][0] = col[0][1] = col[0][2] = col[0][3] = 1; + *cidx = 0; + + for( i = 0; i < m * n; i++ ) + { + v[i][0] = vertex[i][0] - dbcenter[0]; + v[i][1] = vertex[i][1] - dbcenter[1]; + v[i][2] = vertex[i][2]; + + t[i][0] = texcoord[i][0] + 0.025; + t[i][1] = texcoord[i][1]; + } + + c = 0; + for( i = 0; i < m-2; i++ ) + { + for( j = 0; j < n; j++ ) + { + idx[c++] = (i+0)*n+j; + idx[c++] = (i+1)*n+j; + } + lens[i] = 39*2; + } + + GeoSet *gset = new GeoSet; + + gset->setCoords( v, idx ); + gset->setTextureCoords( t, idx ); + gset->setTextureBinding( GeoSet::BIND_PERVERTEX ); + + gset->setColors( col, cidx ); + gset->setColorBinding( GeoSet::BIND_OVERALL ); + + gset->setPrimType( GeoSet::TRIANGLE_STRIP ); + gset->setNumPrims( m-2 ); + gset->setPrimLengths( lens ); + + Texture *tex = new Texture; + + tex->setImage(Registry::instance()->readImage("lz.rgb")); + + GeoState *gstate = new GeoState; + gstate->setMode( GeoState::TEXTURE, GeoState::ON ); + gstate->setMode( GeoState::LIGHTING, GeoState::OFF ); + gstate->setAttribute( GeoState::TEXTURE, tex ); + gstate->setAttribute( GeoState::TEXENV, new TexEnv ); + + gstate->check(); + + gset->setGeoState( gstate ); + + Geode *geode = new Geode; + geode->addGeoSet( gset ); + + gset->check(); + + return geode; +} diff --git a/src/osgPlugins/fly/terrain_data.h b/src/osgPlugins/fly/terrain_data.h new file mode 100644 index 000000000..7869738d6 --- /dev/null +++ b/src/osgPlugins/fly/terrain_data.h @@ -0,0 +1,5944 @@ +#ifdef WIN32 +#pragma warning( disable : 4305 ) +#endif + +static float vertex[][3] = { + + { 5998.7998, 41456.1016, 1.7800 }, + { 5998.7998, 41456.3984, 1.8200 }, + { 5998.7998, 41456.6992, 1.8600 }, + { 5998.7998, 41457.0000, 1.8800 }, + { 5998.7998, 41457.3008, 1.9000 }, + { 5998.7998, 41457.6016, 1.9000 }, + { 5998.7998, 41457.8984, 1.8900 }, + { 5998.7998, 41458.1992, 1.8800 }, + { 5998.7998, 41458.5000, 1.8600 }, + { 5998.7998, 41458.8008, 1.8500 }, + { 5998.7998, 41459.1016, 1.8300 }, + { 5998.7998, 41459.3984, 1.8100 }, + { 5998.7998, 41459.6992, 1.7800 }, + { 5998.7998, 41460.0000, 1.7500 }, + { 5998.7998, 41460.3008, 1.7300 }, + { 5998.7998, 41460.6016, 1.7100 }, + { 5998.7998, 41460.8984, 1.7000 }, + { 5998.7998, 41461.1992, 1.6900 }, + { 5998.7998, 41461.5000, 1.7000 }, + { 5998.7998, 41461.8008, 1.7400 }, + { 5998.7998, 41462.1016, 1.7900 }, + { 5998.7998, 41462.3984, 1.8600 }, + { 5998.7998, 41462.6992, 1.9400 }, + { 5998.7998, 41463.0000, 1.9900 }, + { 5998.7998, 41463.3008, 2.0200 }, + { 5998.7998, 41463.6016, 2.0300 }, + { 5998.7998, 41463.8984, 2.0300 }, + { 5998.7998, 41464.1992, 2.0200 }, + { 5998.7998, 41464.5000, 2.0100 }, + { 5998.7998, 41464.8008, 1.9900 }, + { 5998.7998, 41465.1016, 1.9700 }, + { 5998.7998, 41465.3984, 1.9600 }, + { 5998.7998, 41465.6992, 1.9500 }, + { 5998.7998, 41466.0000, 1.9500 }, + { 5998.7998, 41466.3008, 1.9500 }, + { 5998.7998, 41466.6016, 1.9500 }, + { 5998.7998, 41466.8984, 1.9400 }, + { 5998.7998, 41467.1992, 1.9300 }, + { 5998.7998, 41467.5000, 1.9200 }, + + { 5999.1001, 41456.1016, 1.8600 }, + { 5999.1001, 41456.3984, 1.9100 }, + { 5999.1001, 41456.6992, 1.9600 }, + { 5999.1001, 41457.0000, 1.9900 }, + { 5999.1001, 41457.3008, 2.0100 }, + { 5999.1001, 41457.6016, 2.0000 }, + { 5999.1001, 41457.8984, 1.9700 }, + { 5999.1001, 41458.1992, 1.9400 }, + { 5999.1001, 41458.5000, 1.9100 }, + { 5999.1001, 41458.8008, 1.8700 }, + { 5999.1001, 41459.1016, 1.8400 }, + { 5999.1001, 41459.3984, 1.8000 }, + { 5999.1001, 41459.6992, 1.7700 }, + { 5999.1001, 41460.0000, 1.7400 }, + { 5999.1001, 41460.3008, 1.7300 }, + { 5999.1001, 41460.6016, 1.7200 }, + { 5999.1001, 41460.8984, 1.7200 }, + { 5999.1001, 41461.1992, 1.7300 }, + { 5999.1001, 41461.5000, 1.7600 }, + { 5999.1001, 41461.8008, 1.7900 }, + { 5999.1001, 41462.1016, 1.8300 }, + { 5999.1001, 41462.3984, 1.8700 }, + { 5999.1001, 41462.6992, 1.9100 }, + { 5999.1001, 41463.0000, 1.9400 }, + { 5999.1001, 41463.3008, 1.9700 }, + { 5999.1001, 41463.6016, 1.9900 }, + { 5999.1001, 41463.8984, 2.0100 }, + { 5999.1001, 41464.1992, 2.0200 }, + { 5999.1001, 41464.5000, 2.0100 }, + { 5999.1001, 41464.8008, 1.9900 }, + { 5999.1001, 41465.1016, 1.9700 }, + { 5999.1001, 41465.3984, 1.9600 }, + { 5999.1001, 41465.6992, 1.9600 }, + { 5999.1001, 41466.0000, 1.9600 }, + { 5999.1001, 41466.3008, 1.9600 }, + { 5999.1001, 41466.6016, 1.9600 }, + { 5999.1001, 41466.8984, 1.9600 }, + { 5999.1001, 41467.1992, 1.9600 }, + { 5999.1001, 41467.5000, 1.9600 }, + + { 5999.3999, 41456.1016, 1.9200 }, + { 5999.3999, 41456.3984, 1.9800 }, + { 5999.3999, 41456.6992, 2.0300 }, + { 5999.3999, 41457.0000, 2.0600 }, + { 5999.3999, 41457.3008, 2.0700 }, + { 5999.3999, 41457.6016, 2.0500 }, + { 5999.3999, 41457.8984, 2.0100 }, + { 5999.3999, 41458.1992, 1.9700 }, + { 5999.3999, 41458.5000, 1.9200 }, + { 5999.3999, 41458.8008, 1.8700 }, + { 5999.3999, 41459.1016, 1.8300 }, + { 5999.3999, 41459.3984, 1.7900 }, + { 5999.3999, 41459.6992, 1.7500 }, + { 5999.3999, 41460.0000, 1.7300 }, + { 5999.3999, 41460.3008, 1.7200 }, + { 5999.3999, 41460.6016, 1.7200 }, + { 5999.3999, 41460.8984, 1.7400 }, + { 5999.3999, 41461.1992, 1.7700 }, + { 5999.3999, 41461.5000, 1.8100 }, + { 5999.3999, 41461.8008, 1.8400 }, + { 5999.3999, 41462.1016, 1.8700 }, + { 5999.3999, 41462.3984, 1.8900 }, + { 5999.3999, 41462.6992, 1.9100 }, + { 5999.3999, 41463.0000, 1.9200 }, + { 5999.3999, 41463.3008, 1.9400 }, + { 5999.3999, 41463.6016, 1.9700 }, + { 5999.3999, 41463.8984, 2.0000 }, + { 5999.3999, 41464.1992, 2.0100 }, + { 5999.3999, 41464.5000, 2.0100 }, + { 5999.3999, 41464.8008, 2.0000 }, + { 5999.3999, 41465.1016, 1.9800 }, + { 5999.3999, 41465.3984, 1.9700 }, + { 5999.3999, 41465.6992, 1.9700 }, + { 5999.3999, 41466.0000, 1.9700 }, + { 5999.3999, 41466.3008, 1.9800 }, + { 5999.3999, 41466.6016, 1.9800 }, + { 5999.3999, 41466.8984, 1.9900 }, + { 5999.3999, 41467.1992, 1.9900 }, + { 5999.3999, 41467.5000, 2.0100 }, + + { 5999.7002, 41456.1016, 1.9800 }, + { 5999.7002, 41456.3984, 2.0300 }, + { 5999.7002, 41456.6992, 2.0700 }, + { 5999.7002, 41457.0000, 2.0900 }, + { 5999.7002, 41457.3008, 2.0800 }, + { 5999.7002, 41457.6016, 2.0500 }, + { 5999.7002, 41457.8984, 2.0000 }, + { 5999.7002, 41458.1992, 1.9500 }, + { 5999.7002, 41458.5000, 1.9000 }, + { 5999.7002, 41458.8008, 1.8400 }, + { 5999.7002, 41459.1016, 1.8000 }, + { 5999.7002, 41459.3984, 1.7600 }, + { 5999.7002, 41459.6992, 1.7200 }, + { 5999.7002, 41460.0000, 1.7100 }, + { 5999.7002, 41460.3008, 1.7100 }, + { 5999.7002, 41460.6016, 1.7200 }, + { 5999.7002, 41460.8984, 1.7500 }, + { 5999.7002, 41461.1992, 1.8000 }, + { 5999.7002, 41461.5000, 1.8600 }, + { 5999.7002, 41461.8008, 1.9000 }, + { 5999.7002, 41462.1016, 1.9300 }, + { 5999.7002, 41462.3984, 1.9400 }, + { 5999.7002, 41462.6992, 1.9400 }, + { 5999.7002, 41463.0000, 1.9500 }, + { 5999.7002, 41463.3008, 1.9600 }, + { 5999.7002, 41463.6016, 1.9800 }, + { 5999.7002, 41463.8984, 2.0000 }, + { 5999.7002, 41464.1992, 2.0100 }, + { 5999.7002, 41464.5000, 2.0100 }, + { 5999.7002, 41464.8008, 2.0000 }, + { 5999.7002, 41465.1016, 1.9900 }, + { 5999.7002, 41465.3984, 1.9800 }, + { 5999.7002, 41465.6992, 1.9800 }, + { 5999.7002, 41466.0000, 1.9900 }, + { 5999.7002, 41466.3008, 2.0000 }, + { 5999.7002, 41466.6016, 2.0100 }, + { 5999.7002, 41466.8984, 2.0200 }, + { 5999.7002, 41467.1992, 2.0400 }, + { 5999.7002, 41467.5000, 2.0600 }, + + { 6000.0000, 41456.1016, 2.0200 }, + { 6000.0000, 41456.3984, 2.0400 }, + { 6000.0000, 41456.6992, 2.0600 }, + { 6000.0000, 41457.0000, 2.0600 }, + { 6000.0000, 41457.3008, 2.0400 }, + { 6000.0000, 41457.6016, 2.0000 }, + { 6000.0000, 41457.8984, 1.9500 }, + { 6000.0000, 41458.1992, 1.9000 }, + { 6000.0000, 41458.5000, 1.8400 }, + { 6000.0000, 41458.8008, 1.7900 }, + { 6000.0000, 41459.1016, 1.7500 }, + { 6000.0000, 41459.3984, 1.7100 }, + { 6000.0000, 41459.6992, 1.6900 }, + { 6000.0000, 41460.0000, 1.6800 }, + { 6000.0000, 41460.3008, 1.6900 }, + { 6000.0000, 41460.6016, 1.7200 }, + { 6000.0000, 41460.8984, 1.7600 }, + { 6000.0000, 41461.1992, 1.8200 }, + { 6000.0000, 41461.5000, 1.8800 }, + { 6000.0000, 41461.8008, 1.9300 }, + { 6000.0000, 41462.1016, 1.9600 }, + { 6000.0000, 41462.3984, 1.9600 }, + { 6000.0000, 41462.6992, 1.9600 }, + { 6000.0000, 41463.0000, 1.9600 }, + { 6000.0000, 41463.3008, 1.9700 }, + { 6000.0000, 41463.6016, 1.9900 }, + { 6000.0000, 41463.8984, 2.0100 }, + { 6000.0000, 41464.1992, 2.0200 }, + { 6000.0000, 41464.5000, 2.0200 }, + { 6000.0000, 41464.8008, 2.0100 }, + { 6000.0000, 41465.1016, 1.9900 }, + { 6000.0000, 41465.3984, 1.9900 }, + { 6000.0000, 41465.6992, 1.9900 }, + { 6000.0000, 41466.0000, 2.0000 }, + { 6000.0000, 41466.3008, 2.0200 }, + { 6000.0000, 41466.6016, 2.0400 }, + { 6000.0000, 41466.8984, 2.0600 }, + { 6000.0000, 41467.1992, 2.0800 }, + { 6000.0000, 41467.5000, 2.1000 }, + + { 6000.2998, 41456.1016, 2.0600 }, + { 6000.2998, 41456.3984, 2.0700 }, + { 6000.2998, 41456.6992, 2.0700 }, + { 6000.2998, 41457.0000, 2.0500 }, + { 6000.2998, 41457.3008, 2.0200 }, + { 6000.2998, 41457.6016, 1.9700 }, + { 6000.2998, 41457.8984, 1.9000 }, + { 6000.2998, 41458.1992, 1.8400 }, + { 6000.2998, 41458.5000, 1.7800 }, + { 6000.2998, 41458.8008, 1.7400 }, + { 6000.2998, 41459.1016, 1.7000 }, + { 6000.2998, 41459.3984, 1.6800 }, + { 6000.2998, 41459.6992, 1.6700 }, + { 6000.2998, 41460.0000, 1.6700 }, + { 6000.2998, 41460.3008, 1.6800 }, + { 6000.2998, 41460.6016, 1.7100 }, + { 6000.2998, 41460.8984, 1.7400 }, + { 6000.2998, 41461.1992, 1.7800 }, + { 6000.2998, 41461.5000, 1.8300 }, + { 6000.2998, 41461.8008, 1.8700 }, + { 6000.2998, 41462.1016, 1.8900 }, + { 6000.2998, 41462.3984, 1.9000 }, + { 6000.2998, 41462.6992, 1.9000 }, + { 6000.2998, 41463.0000, 1.9100 }, + { 6000.2998, 41463.3008, 1.9300 }, + { 6000.2998, 41463.6016, 1.9500 }, + { 6000.2998, 41463.8984, 1.9800 }, + { 6000.2998, 41464.1992, 2.0000 }, + { 6000.2998, 41464.5000, 2.0100 }, + { 6000.2998, 41464.8008, 2.0100 }, + { 6000.2998, 41465.1016, 2.0000 }, + { 6000.2998, 41465.3984, 2.0000 }, + { 6000.2998, 41465.6992, 2.0000 }, + { 6000.2998, 41466.0000, 2.0200 }, + { 6000.2998, 41466.3008, 2.0400 }, + { 6000.2998, 41466.6016, 2.0600 }, + { 6000.2998, 41466.8984, 2.0800 }, + { 6000.2998, 41467.1992, 2.1100 }, + { 6000.2998, 41467.5000, 2.1300 }, + + { 6000.6001, 41456.1016, 2.1000 }, + { 6000.6001, 41456.3984, 2.1100 }, + { 6000.6001, 41456.6992, 2.1000 }, + { 6000.6001, 41457.0000, 2.0700 }, + { 6000.6001, 41457.3008, 2.0200 }, + { 6000.6001, 41457.6016, 1.9500 }, + { 6000.6001, 41457.8984, 1.8700 }, + { 6000.6001, 41458.1992, 1.8000 }, + { 6000.6001, 41458.5000, 1.7400 }, + { 6000.6001, 41458.8008, 1.7000 }, + { 6000.6001, 41459.1016, 1.6800 }, + { 6000.6001, 41459.3984, 1.6600 }, + { 6000.6001, 41459.6992, 1.6600 }, + { 6000.6001, 41460.0000, 1.6700 }, + { 6000.6001, 41460.3008, 1.6800 }, + { 6000.6001, 41460.6016, 1.7000 }, + { 6000.6001, 41460.8984, 1.7200 }, + { 6000.6001, 41461.1992, 1.7400 }, + { 6000.6001, 41461.5000, 1.7700 }, + { 6000.6001, 41461.8008, 1.7900 }, + { 6000.6001, 41462.1016, 1.8100 }, + { 6000.6001, 41462.3984, 1.8200 }, + { 6000.6001, 41462.6992, 1.8200 }, + { 6000.6001, 41463.0000, 1.8400 }, + { 6000.6001, 41463.3008, 1.8600 }, + { 6000.6001, 41463.6016, 1.9000 }, + { 6000.6001, 41463.8984, 1.9400 }, + { 6000.6001, 41464.1992, 1.9600 }, + { 6000.6001, 41464.5000, 1.9800 }, + { 6000.6001, 41464.8008, 1.9900 }, + { 6000.6001, 41465.1016, 2.0000 }, + { 6000.6001, 41465.3984, 2.0100 }, + { 6000.6001, 41465.6992, 2.0200 }, + { 6000.6001, 41466.0000, 2.0400 }, + { 6000.6001, 41466.3008, 2.0600 }, + { 6000.6001, 41466.6016, 2.0900 }, + { 6000.6001, 41466.8984, 2.1100 }, + { 6000.6001, 41467.1992, 2.1300 }, + { 6000.6001, 41467.5000, 2.1600 }, + + { 6000.8999, 41456.1016, 2.1000 }, + { 6000.8999, 41456.3984, 2.1000 }, + { 6000.8999, 41456.6992, 2.0800 }, + { 6000.8999, 41457.0000, 2.0500 }, + { 6000.8999, 41457.3008, 2.0000 }, + { 6000.8999, 41457.6016, 1.9200 }, + { 6000.8999, 41457.8984, 1.8400 }, + { 6000.8999, 41458.1992, 1.7800 }, + { 6000.8999, 41458.5000, 1.7200 }, + { 6000.8999, 41458.8008, 1.6900 }, + { 6000.8999, 41459.1016, 1.6700 }, + { 6000.8999, 41459.3984, 1.6600 }, + { 6000.8999, 41459.6992, 1.6600 }, + { 6000.8999, 41460.0000, 1.6700 }, + { 6000.8999, 41460.3008, 1.6800 }, + { 6000.8999, 41460.6016, 1.6900 }, + { 6000.8999, 41460.8984, 1.7100 }, + { 6000.8999, 41461.1992, 1.7200 }, + { 6000.8999, 41461.5000, 1.7300 }, + { 6000.8999, 41461.8008, 1.7400 }, + { 6000.8999, 41462.1016, 1.7500 }, + { 6000.8999, 41462.3984, 1.7600 }, + { 6000.8999, 41462.6992, 1.7700 }, + { 6000.8999, 41463.0000, 1.7900 }, + { 6000.8999, 41463.3008, 1.8200 }, + { 6000.8999, 41463.6016, 1.8600 }, + { 6000.8999, 41463.8984, 1.9000 }, + { 6000.8999, 41464.1992, 1.9400 }, + { 6000.8999, 41464.5000, 1.9700 }, + { 6000.8999, 41464.8008, 1.9900 }, + { 6000.8999, 41465.1016, 2.0100 }, + { 6000.8999, 41465.3984, 2.0300 }, + { 6000.8999, 41465.6992, 2.0500 }, + { 6000.8999, 41466.0000, 2.0700 }, + { 6000.8999, 41466.3008, 2.0900 }, + { 6000.8999, 41466.6016, 2.1200 }, + { 6000.8999, 41466.8984, 2.1400 }, + { 6000.8999, 41467.1992, 2.1600 }, + { 6000.8999, 41467.5000, 2.1800 }, + + { 6001.2002, 41456.1016, 2.0600 }, + { 6001.2002, 41456.3984, 2.0400 }, + { 6001.2002, 41456.6992, 2.0200 }, + { 6001.2002, 41457.0000, 1.9800 }, + { 6001.2002, 41457.3008, 1.9400 }, + { 6001.2002, 41457.6016, 1.8800 }, + { 6001.2002, 41457.8984, 1.8100 }, + { 6001.2002, 41458.1992, 1.7600 }, + { 6001.2002, 41458.5000, 1.7200 }, + { 6001.2002, 41458.8008, 1.7000 }, + { 6001.2002, 41459.1016, 1.6800 }, + { 6001.2002, 41459.3984, 1.6700 }, + { 6001.2002, 41459.6992, 1.6700 }, + { 6001.2002, 41460.0000, 1.6800 }, + { 6001.2002, 41460.3008, 1.6900 }, + { 6001.2002, 41460.6016, 1.7000 }, + { 6001.2002, 41460.8984, 1.7100 }, + { 6001.2002, 41461.1992, 1.7100 }, + { 6001.2002, 41461.5000, 1.7200 }, + { 6001.2002, 41461.8008, 1.7200 }, + { 6001.2002, 41462.1016, 1.7300 }, + { 6001.2002, 41462.3984, 1.7400 }, + { 6001.2002, 41462.6992, 1.7500 }, + { 6001.2002, 41463.0000, 1.7700 }, + { 6001.2002, 41463.3008, 1.8100 }, + { 6001.2002, 41463.6016, 1.8700 }, + { 6001.2002, 41463.8984, 1.9300 }, + { 6001.2002, 41464.1992, 1.9800 }, + { 6001.2002, 41464.5000, 2.0200 }, + { 6001.2002, 41464.8008, 2.0400 }, + { 6001.2002, 41465.1016, 2.0500 }, + { 6001.2002, 41465.3984, 2.0600 }, + { 6001.2002, 41465.6992, 2.0800 }, + { 6001.2002, 41466.0000, 2.1000 }, + { 6001.2002, 41466.3008, 2.1200 }, + { 6001.2002, 41466.6016, 2.1500 }, + { 6001.2002, 41466.8984, 2.1700 }, + { 6001.2002, 41467.1992, 2.1900 }, + { 6001.2002, 41467.5000, 2.2200 }, + + { 6001.5000, 41456.1016, 2.0000 }, + { 6001.5000, 41456.3984, 1.9700 }, + { 6001.5000, 41456.6992, 1.9400 }, + { 6001.5000, 41457.0000, 1.9000 }, + { 6001.5000, 41457.3008, 1.8600 }, + { 6001.5000, 41457.6016, 1.8200 }, + { 6001.5000, 41457.8984, 1.7800 }, + { 6001.5000, 41458.1992, 1.7500 }, + { 6001.5000, 41458.5000, 1.7200 }, + { 6001.5000, 41458.8008, 1.7100 }, + { 6001.5000, 41459.1016, 1.7000 }, + { 6001.5000, 41459.3984, 1.6900 }, + { 6001.5000, 41459.6992, 1.6900 }, + { 6001.5000, 41460.0000, 1.7000 }, + { 6001.5000, 41460.3008, 1.7100 }, + { 6001.5000, 41460.6016, 1.7100 }, + { 6001.5000, 41460.8984, 1.7200 }, + { 6001.5000, 41461.1992, 1.7200 }, + { 6001.5000, 41461.5000, 1.7200 }, + { 6001.5000, 41461.8008, 1.7200 }, + { 6001.5000, 41462.1016, 1.7200 }, + { 6001.5000, 41462.3984, 1.7300 }, + { 6001.5000, 41462.6992, 1.7500 }, + { 6001.5000, 41463.0000, 1.7800 }, + { 6001.5000, 41463.3008, 1.8200 }, + { 6001.5000, 41463.6016, 1.8900 }, + { 6001.5000, 41463.8984, 1.9700 }, + { 6001.5000, 41464.1992, 2.0300 }, + { 6001.5000, 41464.5000, 2.0800 }, + { 6001.5000, 41464.8008, 2.0900 }, + { 6001.5000, 41465.1016, 2.0900 }, + { 6001.5000, 41465.3984, 2.0900 }, + { 6001.5000, 41465.6992, 2.1000 }, + { 6001.5000, 41466.0000, 2.1200 }, + { 6001.5000, 41466.3008, 2.1500 }, + { 6001.5000, 41466.6016, 2.1700 }, + { 6001.5000, 41466.8984, 2.2000 }, + { 6001.5000, 41467.1992, 2.2200 }, + { 6001.5000, 41467.5000, 2.2600 }, + + { 6001.7998, 41456.1016, 1.9400 }, + { 6001.7998, 41456.3984, 1.9100 }, + { 6001.7998, 41456.6992, 1.8700 }, + { 6001.7998, 41457.0000, 1.8400 }, + { 6001.7998, 41457.3008, 1.8100 }, + { 6001.7998, 41457.6016, 1.7900 }, + { 6001.7998, 41457.8984, 1.7700 }, + { 6001.7998, 41458.1992, 1.7500 }, + { 6001.7998, 41458.5000, 1.7300 }, + { 6001.7998, 41458.8008, 1.7200 }, + { 6001.7998, 41459.1016, 1.7100 }, + { 6001.7998, 41459.3984, 1.7100 }, + { 6001.7998, 41459.6992, 1.7100 }, + { 6001.7998, 41460.0000, 1.7100 }, + { 6001.7998, 41460.3008, 1.7200 }, + { 6001.7998, 41460.6016, 1.7200 }, + { 6001.7998, 41460.8984, 1.7300 }, + { 6001.7998, 41461.1992, 1.7300 }, + { 6001.7998, 41461.5000, 1.7200 }, + { 6001.7998, 41461.8008, 1.7200 }, + { 6001.7998, 41462.1016, 1.7200 }, + { 6001.7998, 41462.3984, 1.7300 }, + { 6001.7998, 41462.6992, 1.7600 }, + { 6001.7998, 41463.0000, 1.7900 }, + { 6001.7998, 41463.3008, 1.8400 }, + { 6001.7998, 41463.6016, 1.9200 }, + { 6001.7998, 41463.8984, 2.0100 }, + { 6001.7998, 41464.1992, 2.0800 }, + { 6001.7998, 41464.5000, 2.1200 }, + { 6001.7998, 41464.8008, 2.1300 }, + { 6001.7998, 41465.1016, 2.1200 }, + { 6001.7998, 41465.3984, 2.1100 }, + { 6001.7998, 41465.6992, 2.1200 }, + { 6001.7998, 41466.0000, 2.1300 }, + { 6001.7998, 41466.3008, 2.1600 }, + { 6001.7998, 41466.6016, 2.1800 }, + { 6001.7998, 41466.8984, 2.2100 }, + { 6001.7998, 41467.1992, 2.2400 }, + { 6001.7998, 41467.5000, 2.2800 }, + + { 6002.1001, 41456.1016, 1.8900 }, + { 6002.1001, 41456.3984, 1.8500 }, + { 6002.1001, 41456.6992, 1.8200 }, + { 6002.1001, 41457.0000, 1.8000 }, + { 6002.1001, 41457.3008, 1.7800 }, + { 6002.1001, 41457.6016, 1.7600 }, + { 6002.1001, 41457.8984, 1.7500 }, + { 6002.1001, 41458.1992, 1.7400 }, + { 6002.1001, 41458.5000, 1.7400 }, + { 6002.1001, 41458.8008, 1.7300 }, + { 6002.1001, 41459.1016, 1.7300 }, + { 6002.1001, 41459.3984, 1.7200 }, + { 6002.1001, 41459.6992, 1.7200 }, + { 6002.1001, 41460.0000, 1.7200 }, + { 6002.1001, 41460.3008, 1.7300 }, + { 6002.1001, 41460.6016, 1.7300 }, + { 6002.1001, 41460.8984, 1.7400 }, + { 6002.1001, 41461.1992, 1.7300 }, + { 6002.1001, 41461.5000, 1.7200 }, + { 6002.1001, 41461.8008, 1.7200 }, + { 6002.1001, 41462.1016, 1.7300 }, + { 6002.1001, 41462.3984, 1.7500 }, + { 6002.1001, 41462.6992, 1.7800 }, + { 6002.1001, 41463.0000, 1.8200 }, + { 6002.1001, 41463.3008, 1.8800 }, + { 6002.1001, 41463.6016, 1.9600 }, + { 6002.1001, 41463.8984, 2.0600 }, + { 6002.1001, 41464.1992, 2.1300 }, + { 6002.1001, 41464.5000, 2.1700 }, + { 6002.1001, 41464.8008, 2.1700 }, + { 6002.1001, 41465.1016, 2.1500 }, + { 6002.1001, 41465.3984, 2.1400 }, + { 6002.1001, 41465.6992, 2.1300 }, + { 6002.1001, 41466.0000, 2.1400 }, + { 6002.1001, 41466.3008, 2.1600 }, + { 6002.1001, 41466.6016, 2.1800 }, + { 6002.1001, 41466.8984, 2.2100 }, + { 6002.1001, 41467.1992, 2.2400 }, + { 6002.1001, 41467.5000, 2.2900 }, + + { 6002.3999, 41456.1016, 1.8300 }, + { 6002.3999, 41456.3984, 1.8000 }, + { 6002.3999, 41456.6992, 1.7800 }, + { 6002.3999, 41457.0000, 1.7600 }, + { 6002.3999, 41457.3008, 1.7400 }, + { 6002.3999, 41457.6016, 1.7400 }, + { 6002.3999, 41457.8984, 1.7400 }, + { 6002.3999, 41458.1992, 1.7400 }, + { 6002.3999, 41458.5000, 1.7400 }, + { 6002.3999, 41458.8008, 1.7400 }, + { 6002.3999, 41459.1016, 1.7300 }, + { 6002.3999, 41459.3984, 1.7300 }, + { 6002.3999, 41459.6992, 1.7300 }, + { 6002.3999, 41460.0000, 1.7300 }, + { 6002.3999, 41460.3008, 1.7400 }, + { 6002.3999, 41460.6016, 1.7400 }, + { 6002.3999, 41460.8984, 1.7400 }, + { 6002.3999, 41461.1992, 1.7400 }, + { 6002.3999, 41461.5000, 1.7300 }, + { 6002.3999, 41461.8008, 1.7300 }, + { 6002.3999, 41462.1016, 1.7400 }, + { 6002.3999, 41462.3984, 1.7700 }, + { 6002.3999, 41462.6992, 1.8000 }, + { 6002.3999, 41463.0000, 1.8500 }, + { 6002.3999, 41463.3008, 1.9200 }, + { 6002.3999, 41463.6016, 2.0100 }, + { 6002.3999, 41463.8984, 2.1100 }, + { 6002.3999, 41464.1992, 2.1800 }, + { 6002.3999, 41464.5000, 2.2200 }, + { 6002.3999, 41464.8008, 2.2200 }, + { 6002.3999, 41465.1016, 2.1900 }, + { 6002.3999, 41465.3984, 2.1700 }, + { 6002.3999, 41465.6992, 2.1500 }, + { 6002.3999, 41466.0000, 2.1600 }, + { 6002.3999, 41466.3008, 2.1700 }, + { 6002.3999, 41466.6016, 2.1900 }, + { 6002.3999, 41466.8984, 2.2100 }, + { 6002.3999, 41467.1992, 2.2400 }, + { 6002.3999, 41467.5000, 2.2900 }, + + { 6002.7002, 41456.1016, 1.8100 }, + { 6002.7002, 41456.3984, 1.7900 }, + { 6002.7002, 41456.6992, 1.7800 }, + { 6002.7002, 41457.0000, 1.7600 }, + { 6002.7002, 41457.3008, 1.7500 }, + { 6002.7002, 41457.6016, 1.7500 }, + { 6002.7002, 41457.8984, 1.7500 }, + { 6002.7002, 41458.1992, 1.7500 }, + { 6002.7002, 41458.5000, 1.7500 }, + { 6002.7002, 41458.8008, 1.7500 }, + { 6002.7002, 41459.1016, 1.7400 }, + { 6002.7002, 41459.3984, 1.7300 }, + { 6002.7002, 41459.6992, 1.7300 }, + { 6002.7002, 41460.0000, 1.7300 }, + { 6002.7002, 41460.3008, 1.7400 }, + { 6002.7002, 41460.6016, 1.7400 }, + { 6002.7002, 41460.8984, 1.7500 }, + { 6002.7002, 41461.1992, 1.7400 }, + { 6002.7002, 41461.5000, 1.7400 }, + { 6002.7002, 41461.8008, 1.7400 }, + { 6002.7002, 41462.1016, 1.7500 }, + { 6002.7002, 41462.3984, 1.7900 }, + { 6002.7002, 41462.6992, 1.8300 }, + { 6002.7002, 41463.0000, 1.8800 }, + { 6002.7002, 41463.3008, 1.9500 }, + { 6002.7002, 41463.6016, 2.0400 }, + { 6002.7002, 41463.8984, 2.1400 }, + { 6002.7002, 41464.1992, 2.2100 }, + { 6002.7002, 41464.5000, 2.2600 }, + { 6002.7002, 41464.8008, 2.2500 }, + { 6002.7002, 41465.1016, 2.2200 }, + { 6002.7002, 41465.3984, 2.2000 }, + { 6002.7002, 41465.6992, 2.1900 }, + { 6002.7002, 41466.0000, 2.1900 }, + { 6002.7002, 41466.3008, 2.2100 }, + { 6002.7002, 41466.6016, 2.2200 }, + { 6002.7002, 41466.8984, 2.2400 }, + { 6002.7002, 41467.1992, 2.2700 }, + { 6002.7002, 41467.5000, 2.3100 }, + + { 6003.0000, 41456.1016, 1.8400 }, + { 6003.0000, 41456.3984, 1.8300 }, + { 6003.0000, 41456.6992, 1.8200 }, + { 6003.0000, 41457.0000, 1.8100 }, + { 6003.0000, 41457.3008, 1.8000 }, + { 6003.0000, 41457.6016, 1.7900 }, + { 6003.0000, 41457.8984, 1.7800 }, + { 6003.0000, 41458.1992, 1.7700 }, + { 6003.0000, 41458.5000, 1.7600 }, + { 6003.0000, 41458.8008, 1.7600 }, + { 6003.0000, 41459.1016, 1.7500 }, + { 6003.0000, 41459.3984, 1.7400 }, + { 6003.0000, 41459.6992, 1.7400 }, + { 6003.0000, 41460.0000, 1.7400 }, + { 6003.0000, 41460.3008, 1.7500 }, + { 6003.0000, 41460.6016, 1.7500 }, + { 6003.0000, 41460.8984, 1.7500 }, + { 6003.0000, 41461.1992, 1.7500 }, + { 6003.0000, 41461.5000, 1.7500 }, + { 6003.0000, 41461.8008, 1.7500 }, + { 6003.0000, 41462.1016, 1.7700 }, + { 6003.0000, 41462.3984, 1.8000 }, + { 6003.0000, 41462.6992, 1.8500 }, + { 6003.0000, 41463.0000, 1.9100 }, + { 6003.0000, 41463.3008, 1.9800 }, + { 6003.0000, 41463.6016, 2.0600 }, + { 6003.0000, 41463.8984, 2.1500 }, + { 6003.0000, 41464.1992, 2.2200 }, + { 6003.0000, 41464.5000, 2.2700 }, + { 6003.0000, 41464.8008, 2.2700 }, + { 6003.0000, 41465.1016, 2.2400 }, + { 6003.0000, 41465.3984, 2.2300 }, + { 6003.0000, 41465.6992, 2.2200 }, + { 6003.0000, 41466.0000, 2.2300 }, + { 6003.0000, 41466.3008, 2.2600 }, + { 6003.0000, 41466.6016, 2.2800 }, + { 6003.0000, 41466.8984, 2.3000 }, + { 6003.0000, 41467.1992, 2.3300 }, + { 6003.0000, 41467.5000, 2.3700 }, + + { 6003.2998, 41456.1016, 1.8500 }, + { 6003.2998, 41456.3984, 1.8600 }, + { 6003.2998, 41456.6992, 1.8700 }, + { 6003.2998, 41457.0000, 1.8700 }, + { 6003.2998, 41457.3008, 1.8600 }, + { 6003.2998, 41457.6016, 1.8500 }, + { 6003.2998, 41457.8984, 1.8200 }, + { 6003.2998, 41458.1992, 1.8000 }, + { 6003.2998, 41458.5000, 1.7800 }, + { 6003.2998, 41458.8008, 1.7700 }, + { 6003.2998, 41459.1016, 1.7600 }, + { 6003.2998, 41459.3984, 1.7500 }, + { 6003.2998, 41459.6992, 1.7500 }, + { 6003.2998, 41460.0000, 1.7500 }, + { 6003.2998, 41460.3008, 1.7600 }, + { 6003.2998, 41460.6016, 1.7600 }, + { 6003.2998, 41460.8984, 1.7600 }, + { 6003.2998, 41461.1992, 1.7600 }, + { 6003.2998, 41461.5000, 1.7600 }, + { 6003.2998, 41461.8008, 1.7700 }, + { 6003.2998, 41462.1016, 1.7800 }, + { 6003.2998, 41462.3984, 1.8200 }, + { 6003.2998, 41462.6992, 1.8700 }, + { 6003.2998, 41463.0000, 1.9300 }, + { 6003.2998, 41463.3008, 1.9900 }, + { 6003.2998, 41463.6016, 2.0700 }, + { 6003.2998, 41463.8984, 2.1500 }, + { 6003.2998, 41464.1992, 2.2100 }, + { 6003.2998, 41464.5000, 2.2600 }, + { 6003.2998, 41464.8008, 2.2600 }, + { 6003.2998, 41465.1016, 2.2500 }, + { 6003.2998, 41465.3984, 2.2500 }, + { 6003.2998, 41465.6992, 2.2500 }, + { 6003.2998, 41466.0000, 2.2800 }, + { 6003.2998, 41466.3008, 2.3200 }, + { 6003.2998, 41466.6016, 2.3500 }, + { 6003.2998, 41466.8984, 2.3800 }, + { 6003.2998, 41467.1992, 2.4100 }, + { 6003.2998, 41467.5000, 2.4400 }, + + { 6003.6001, 41456.1016, 1.8600 }, + { 6003.6001, 41456.3984, 1.8800 }, + { 6003.6001, 41456.6992, 1.9000 }, + { 6003.6001, 41457.0000, 1.9200 }, + { 6003.6001, 41457.3008, 1.9200 }, + { 6003.6001, 41457.6016, 1.9000 }, + { 6003.6001, 41457.8984, 1.8700 }, + { 6003.6001, 41458.1992, 1.8400 }, + { 6003.6001, 41458.5000, 1.8100 }, + { 6003.6001, 41458.8008, 1.7900 }, + { 6003.6001, 41459.1016, 1.7700 }, + { 6003.6001, 41459.3984, 1.7600 }, + { 6003.6001, 41459.6992, 1.7600 }, + { 6003.6001, 41460.0000, 1.7600 }, + { 6003.6001, 41460.3008, 1.7700 }, + { 6003.6001, 41460.6016, 1.7700 }, + { 6003.6001, 41460.8984, 1.7800 }, + { 6003.6001, 41461.1992, 1.7700 }, + { 6003.6001, 41461.5000, 1.7700 }, + { 6003.6001, 41461.8008, 1.7800 }, + { 6003.6001, 41462.1016, 1.8000 }, + { 6003.6001, 41462.3984, 1.8400 }, + { 6003.6001, 41462.6992, 1.9000 }, + { 6003.6001, 41463.0000, 1.9500 }, + { 6003.6001, 41463.3008, 2.0200 }, + { 6003.6001, 41463.6016, 2.0900 }, + { 6003.6001, 41463.8984, 2.1600 }, + { 6003.6001, 41464.1992, 2.2200 }, + { 6003.6001, 41464.5000, 2.2600 }, + { 6003.6001, 41464.8008, 2.2700 }, + { 6003.6001, 41465.1016, 2.2700 }, + { 6003.6001, 41465.3984, 2.2700 }, + { 6003.6001, 41465.6992, 2.2900 }, + { 6003.6001, 41466.0000, 2.3400 }, + { 6003.6001, 41466.3008, 2.4000 }, + { 6003.6001, 41466.6016, 2.4500 }, + { 6003.6001, 41466.8984, 2.4900 }, + { 6003.6001, 41467.1992, 2.5100 }, + { 6003.6001, 41467.5000, 2.5200 }, + + { 6003.8999, 41456.1016, 1.8800 }, + { 6003.8999, 41456.3984, 1.9000 }, + { 6003.8999, 41456.6992, 1.9300 }, + { 6003.8999, 41457.0000, 1.9600 }, + { 6003.8999, 41457.3008, 1.9600 }, + { 6003.8999, 41457.6016, 1.9400 }, + { 6003.8999, 41457.8984, 1.9000 }, + { 6003.8999, 41458.1992, 1.8700 }, + { 6003.8999, 41458.5000, 1.8400 }, + { 6003.8999, 41458.8008, 1.8100 }, + { 6003.8999, 41459.1016, 1.7800 }, + { 6003.8999, 41459.3984, 1.7700 }, + { 6003.8999, 41459.6992, 1.7600 }, + { 6003.8999, 41460.0000, 1.7700 }, + { 6003.8999, 41460.3008, 1.7800 }, + { 6003.8999, 41460.6016, 1.7900 }, + { 6003.8999, 41460.8984, 1.7900 }, + { 6003.8999, 41461.1992, 1.7900 }, + { 6003.8999, 41461.5000, 1.7900 }, + { 6003.8999, 41461.8008, 1.8000 }, + { 6003.8999, 41462.1016, 1.8200 }, + { 6003.8999, 41462.3984, 1.8700 }, + { 6003.8999, 41462.6992, 1.9300 }, + { 6003.8999, 41463.0000, 2.0000 }, + { 6003.8999, 41463.3008, 2.0600 }, + { 6003.8999, 41463.6016, 2.1400 }, + { 6003.8999, 41463.8984, 2.2100 }, + { 6003.8999, 41464.1992, 2.2800 }, + { 6003.8999, 41464.5000, 2.3200 }, + { 6003.8999, 41464.8008, 2.3200 }, + { 6003.8999, 41465.1016, 2.3200 }, + { 6003.8999, 41465.3984, 2.3300 }, + { 6003.8999, 41465.6992, 2.3500 }, + { 6003.8999, 41466.0000, 2.4100 }, + { 6003.8999, 41466.3008, 2.4900 }, + { 6003.8999, 41466.6016, 2.5500 }, + { 6003.8999, 41466.8984, 2.5900 }, + { 6003.8999, 41467.1992, 2.6000 }, + { 6003.8999, 41467.5000, 2.6000 }, + + { 6004.2002, 41456.1016, 1.9100 }, + { 6004.2002, 41456.3984, 1.9200 }, + { 6004.2002, 41456.6992, 1.9600 }, + { 6004.2002, 41457.0000, 1.9800 }, + { 6004.2002, 41457.3008, 1.9800 }, + { 6004.2002, 41457.6016, 1.9500 }, + { 6004.2002, 41457.8984, 1.9100 }, + { 6004.2002, 41458.1992, 1.8700 }, + { 6004.2002, 41458.5000, 1.8400 }, + { 6004.2002, 41458.8008, 1.8100 }, + { 6004.2002, 41459.1016, 1.7900 }, + { 6004.2002, 41459.3984, 1.7800 }, + { 6004.2002, 41459.6992, 1.7700 }, + { 6004.2002, 41460.0000, 1.7800 }, + { 6004.2002, 41460.3008, 1.7900 }, + { 6004.2002, 41460.6016, 1.8000 }, + { 6004.2002, 41460.8984, 1.8100 }, + { 6004.2002, 41461.1992, 1.8100 }, + { 6004.2002, 41461.5000, 1.8000 }, + { 6004.2002, 41461.8008, 1.8100 }, + { 6004.2002, 41462.1016, 1.8400 }, + { 6004.2002, 41462.3984, 1.9000 }, + { 6004.2002, 41462.6992, 1.9700 }, + { 6004.2002, 41463.0000, 2.0500 }, + { 6004.2002, 41463.3008, 2.1400 }, + { 6004.2002, 41463.6016, 2.2200 }, + { 6004.2002, 41463.8984, 2.3100 }, + { 6004.2002, 41464.1992, 2.3800 }, + { 6004.2002, 41464.5000, 2.4300 }, + { 6004.2002, 41464.8008, 2.4400 }, + { 6004.2002, 41465.1016, 2.4200 }, + { 6004.2002, 41465.3984, 2.4200 }, + { 6004.2002, 41465.6992, 2.4400 }, + { 6004.2002, 41466.0000, 2.5100 }, + { 6004.2002, 41466.3008, 2.5800 }, + { 6004.2002, 41466.6016, 2.6500 }, + { 6004.2002, 41466.8984, 2.6900 }, + { 6004.2002, 41467.1992, 2.6900 }, + { 6004.2002, 41467.5000, 2.6800 }, + + { 6004.5000, 41456.1016, 1.9500 }, + { 6004.5000, 41456.3984, 1.9500 }, + { 6004.5000, 41456.6992, 1.9600 }, + { 6004.5000, 41457.0000, 1.9700 }, + { 6004.5000, 41457.3008, 1.9600 }, + { 6004.5000, 41457.6016, 1.9300 }, + { 6004.5000, 41457.8984, 1.8900 }, + { 6004.5000, 41458.1992, 1.8500 }, + { 6004.5000, 41458.5000, 1.8200 }, + { 6004.5000, 41458.8008, 1.8000 }, + { 6004.5000, 41459.1016, 1.7900 }, + { 6004.5000, 41459.3984, 1.7800 }, + { 6004.5000, 41459.6992, 1.7800 }, + { 6004.5000, 41460.0000, 1.7900 }, + { 6004.5000, 41460.3008, 1.8000 }, + { 6004.5000, 41460.6016, 1.8200 }, + { 6004.5000, 41460.8984, 1.8300 }, + { 6004.5000, 41461.1992, 1.8300 }, + { 6004.5000, 41461.5000, 1.8300 }, + { 6004.5000, 41461.8008, 1.8400 }, + { 6004.5000, 41462.1016, 1.8700 }, + { 6004.5000, 41462.3984, 1.9400 }, + { 6004.5000, 41462.6992, 2.0200 }, + { 6004.5000, 41463.0000, 2.1200 }, + { 6004.5000, 41463.3008, 2.2100 }, + { 6004.5000, 41463.6016, 2.3200 }, + { 6004.5000, 41463.8984, 2.4200 }, + { 6004.5000, 41464.1992, 2.5000 }, + { 6004.5000, 41464.5000, 2.5600 }, + { 6004.5000, 41464.8008, 2.5600 }, + { 6004.5000, 41465.1016, 2.5400 }, + { 6004.5000, 41465.3984, 2.5400 }, + { 6004.5000, 41465.6992, 2.5500 }, + { 6004.5000, 41466.0000, 2.6100 }, + { 6004.5000, 41466.3008, 2.6800 }, + { 6004.5000, 41466.6016, 2.7400 }, + { 6004.5000, 41466.8984, 2.7800 }, + { 6004.5000, 41467.1992, 2.7800 }, + { 6004.5000, 41467.5000, 2.7600 }, + + { 6004.7998, 41456.1016, 1.9800 }, + { 6004.7998, 41456.3984, 1.9600 }, + { 6004.7998, 41456.6992, 1.9400 }, + { 6004.7998, 41457.0000, 1.9100 }, + { 6004.7998, 41457.3008, 1.8900 }, + { 6004.7998, 41457.6016, 1.8600 }, + { 6004.7998, 41457.8984, 1.8300 }, + { 6004.7998, 41458.1992, 1.8100 }, + { 6004.7998, 41458.5000, 1.7900 }, + { 6004.7998, 41458.8008, 1.7900 }, + { 6004.7998, 41459.1016, 1.7900 }, + { 6004.7998, 41459.3984, 1.7900 }, + { 6004.7998, 41459.6992, 1.7900 }, + { 6004.7998, 41460.0000, 1.8000 }, + { 6004.7998, 41460.3008, 1.8200 }, + { 6004.7998, 41460.6016, 1.8400 }, + { 6004.7998, 41460.8984, 1.8500 }, + { 6004.7998, 41461.1992, 1.8600 }, + { 6004.7998, 41461.5000, 1.8700 }, + { 6004.7998, 41461.8008, 1.8900 }, + { 6004.7998, 41462.1016, 1.9200 }, + { 6004.7998, 41462.3984, 1.9900 }, + { 6004.7998, 41462.6992, 2.0800 }, + { 6004.7998, 41463.0000, 2.1700 }, + { 6004.7998, 41463.3008, 2.2700 }, + { 6004.7998, 41463.6016, 2.3900 }, + { 6004.7998, 41463.8984, 2.5100 }, + { 6004.7998, 41464.1992, 2.6100 }, + { 6004.7998, 41464.5000, 2.6700 }, + { 6004.7998, 41464.8008, 2.6800 }, + { 6004.7998, 41465.1016, 2.6600 }, + { 6004.7998, 41465.3984, 2.6500 }, + { 6004.7998, 41465.6992, 2.6600 }, + { 6004.7998, 41466.0000, 2.7100 }, + { 6004.7998, 41466.3008, 2.7700 }, + { 6004.7998, 41466.6016, 2.8300 }, + { 6004.7998, 41466.8984, 2.8700 }, + { 6004.7998, 41467.1992, 2.8700 }, + { 6004.7998, 41467.5000, 2.8500 }, + + { 6005.1001, 41456.1016, 2.0300 }, + { 6005.1001, 41456.3984, 1.9800 }, + { 6005.1001, 41456.6992, 1.9300 }, + { 6005.1001, 41457.0000, 1.8900 }, + { 6005.1001, 41457.3008, 1.8400 }, + { 6005.1001, 41457.6016, 1.8200 }, + { 6005.1001, 41457.8984, 1.8000 }, + { 6005.1001, 41458.1992, 1.8000 }, + { 6005.1001, 41458.5000, 1.8000 }, + { 6005.1001, 41458.8008, 1.8000 }, + { 6005.1001, 41459.1016, 1.7800 }, + { 6005.1001, 41459.3984, 1.7900 }, + { 6005.1001, 41459.6992, 1.8000 }, + { 6005.1001, 41460.0000, 1.8200 }, + { 6005.1001, 41460.3008, 1.8400 }, + { 6005.1001, 41460.6016, 1.8600 }, + { 6005.1001, 41460.8984, 1.8800 }, + { 6005.1001, 41461.1992, 1.9000 }, + { 6005.1001, 41461.5000, 1.9200 }, + { 6005.1001, 41461.8008, 1.9400 }, + { 6005.1001, 41462.1016, 1.9800 }, + { 6005.1001, 41462.3984, 2.0500 }, + { 6005.1001, 41462.6992, 2.1300 }, + { 6005.1001, 41463.0000, 2.2100 }, + { 6005.1001, 41463.3008, 2.3100 }, + { 6005.1001, 41463.6016, 2.4300 }, + { 6005.1001, 41463.8984, 2.5600 }, + { 6005.1001, 41464.1992, 2.6600 }, + { 6005.1001, 41464.5000, 2.7400 }, + { 6005.1001, 41464.8008, 2.7600 }, + { 6005.1001, 41465.1016, 2.7400 }, + { 6005.1001, 41465.3984, 2.7400 }, + { 6005.1001, 41465.6992, 2.7500 }, + { 6005.1001, 41466.0000, 2.7900 }, + { 6005.1001, 41466.3008, 2.8600 }, + { 6005.1001, 41466.6016, 2.9100 }, + { 6005.1001, 41466.8984, 2.9400 }, + { 6005.1001, 41467.1992, 2.9500 }, + { 6005.1001, 41467.5000, 2.9300 }, + + { 6005.3999, 41456.1016, 2.0700 }, + { 6005.3999, 41456.3984, 2.0200 }, + { 6005.3999, 41456.6992, 1.9500 }, + { 6005.3999, 41457.0000, 1.8900 }, + { 6005.3999, 41457.3008, 1.8400 }, + { 6005.3999, 41457.6016, 1.8100 }, + { 6005.3999, 41457.8984, 1.8000 }, + { 6005.3999, 41458.1992, 1.8000 }, + { 6005.3999, 41458.5000, 1.8000 }, + { 6005.3999, 41458.8008, 1.8000 }, + { 6005.3999, 41459.1016, 1.7900 }, + { 6005.3999, 41459.3984, 1.8000 }, + { 6005.3999, 41459.6992, 1.8200 }, + { 6005.3999, 41460.0000, 1.8400 }, + { 6005.3999, 41460.3008, 1.8600 }, + { 6005.3999, 41460.6016, 1.8800 }, + { 6005.3999, 41460.8984, 1.9100 }, + { 6005.3999, 41461.1992, 1.9300 }, + { 6005.3999, 41461.5000, 1.9600 }, + { 6005.3999, 41461.8008, 1.9900 }, + { 6005.3999, 41462.1016, 2.0300 }, + { 6005.3999, 41462.3984, 2.0900 }, + { 6005.3999, 41462.6992, 2.1700 }, + { 6005.3999, 41463.0000, 2.2500 }, + { 6005.3999, 41463.3008, 2.3400 }, + { 6005.3999, 41463.6016, 2.4500 }, + { 6005.3999, 41463.8984, 2.5600 }, + { 6005.3999, 41464.1992, 2.6600 }, + { 6005.3999, 41464.5000, 2.7400 }, + { 6005.3999, 41464.8008, 2.7700 }, + { 6005.3999, 41465.1016, 2.7800 }, + { 6005.3999, 41465.3984, 2.8000 }, + { 6005.3999, 41465.6992, 2.8300 }, + { 6005.3999, 41466.0000, 2.8800 }, + { 6005.3999, 41466.3008, 2.9400 }, + { 6005.3999, 41466.6016, 2.9800 }, + { 6005.3999, 41466.8984, 3.0200 }, + { 6005.3999, 41467.1992, 3.0300 }, + { 6005.3999, 41467.5000, 3.0200 }, + + { 6005.7002, 41456.1016, 2.0900 }, + { 6005.7002, 41456.3984, 2.0300 }, + { 6005.7002, 41456.6992, 1.9600 }, + { 6005.7002, 41457.0000, 1.8900 }, + { 6005.7002, 41457.3008, 1.8300 }, + { 6005.7002, 41457.6016, 1.8000 }, + { 6005.7002, 41457.8984, 1.8000 }, + { 6005.7002, 41458.1992, 1.8000 }, + { 6005.7002, 41458.5000, 1.8000 }, + { 6005.7002, 41458.8008, 1.8000 }, + { 6005.7002, 41459.1016, 1.8100 }, + { 6005.7002, 41459.3984, 1.8200 }, + { 6005.7002, 41459.6992, 1.8300 }, + { 6005.7002, 41460.0000, 1.8500 }, + { 6005.7002, 41460.3008, 1.8800 }, + { 6005.7002, 41460.6016, 1.9000 }, + { 6005.7002, 41460.8984, 1.9200 }, + { 6005.7002, 41461.1992, 1.9500 }, + { 6005.7002, 41461.5000, 1.9800 }, + { 6005.7002, 41461.8008, 2.0200 }, + { 6005.7002, 41462.1016, 2.0600 }, + { 6005.7002, 41462.3984, 2.1200 }, + { 6005.7002, 41462.6992, 2.2000 }, + { 6005.7002, 41463.0000, 2.2800 }, + { 6005.7002, 41463.3008, 2.3700 }, + { 6005.7002, 41463.6016, 2.4600 }, + { 6005.7002, 41463.8984, 2.5500 }, + { 6005.7002, 41464.1992, 2.6400 }, + { 6005.7002, 41464.5000, 2.7200 }, + { 6005.7002, 41464.8008, 2.7700 }, + { 6005.7002, 41465.1016, 2.8100 }, + { 6005.7002, 41465.3984, 2.8600 }, + { 6005.7002, 41465.6992, 2.9100 }, + { 6005.7002, 41466.0000, 2.9600 }, + { 6005.7002, 41466.3008, 3.0100 }, + { 6005.7002, 41466.6016, 3.0500 }, + { 6005.7002, 41466.8984, 3.0900 }, + { 6005.7002, 41467.1992, 3.1000 }, + { 6005.7002, 41467.5000, 3.1000 }, + + { 6006.0000, 41456.1016, 2.0700 }, + { 6006.0000, 41456.3984, 2.0100 }, + { 6006.0000, 41456.6992, 1.9400 }, + { 6006.0000, 41457.0000, 1.8700 }, + { 6006.0000, 41457.3008, 1.8000 }, + { 6006.0000, 41457.6016, 1.8000 }, + { 6006.0000, 41457.8984, 1.8000 }, + { 6006.0000, 41458.1992, 1.8000 }, + { 6006.0000, 41458.5000, 1.8000 }, + { 6006.0000, 41458.8008, 1.8100 }, + { 6006.0000, 41459.1016, 1.8200 }, + { 6006.0000, 41459.3984, 1.8300 }, + { 6006.0000, 41459.6992, 1.8400 }, + { 6006.0000, 41460.0000, 1.8600 }, + { 6006.0000, 41460.3008, 1.8900 }, + { 6006.0000, 41460.6016, 1.9100 }, + { 6006.0000, 41460.8984, 1.9300 }, + { 6006.0000, 41461.1992, 1.9600 }, + { 6006.0000, 41461.5000, 1.9900 }, + { 6006.0000, 41461.8008, 2.0300 }, + { 6006.0000, 41462.1016, 2.0800 }, + { 6006.0000, 41462.3984, 2.1500 }, + { 6006.0000, 41462.6992, 2.2400 }, + { 6006.0000, 41463.0000, 2.3200 }, + { 6006.0000, 41463.3008, 2.4100 }, + { 6006.0000, 41463.6016, 2.5000 }, + { 6006.0000, 41463.8984, 2.6000 }, + { 6006.0000, 41464.1992, 2.6900 }, + { 6006.0000, 41464.5000, 2.7800 }, + { 6006.0000, 41464.8008, 2.8300 }, + { 6006.0000, 41465.1016, 2.8800 }, + { 6006.0000, 41465.3984, 2.9200 }, + { 6006.0000, 41465.6992, 2.9700 }, + { 6006.0000, 41466.0000, 3.0200 }, + { 6006.0000, 41466.3008, 3.0700 }, + { 6006.0000, 41466.6016, 3.1200 }, + { 6006.0000, 41466.8984, 3.1500 }, + { 6006.0000, 41467.1992, 3.1700 }, + { 6006.0000, 41467.5000, 3.1700 }, + + { 6006.2998, 41456.1016, 2.0300 }, + { 6006.2998, 41456.3984, 1.9700 }, + { 6006.2998, 41456.6992, 1.9000 }, + { 6006.2998, 41457.0000, 1.8300 }, + { 6006.2998, 41457.3008, 1.8000 }, + { 6006.2998, 41457.6016, 1.8000 }, + { 6006.2998, 41457.8984, 1.8000 }, + { 6006.2998, 41458.1992, 1.8000 }, + { 6006.2998, 41458.5000, 1.8000 }, + { 6006.2998, 41458.8008, 1.8200 }, + { 6006.2998, 41459.1016, 1.8300 }, + { 6006.2998, 41459.3984, 1.8500 }, + { 6006.2998, 41459.6992, 1.8600 }, + { 6006.2998, 41460.0000, 1.8800 }, + { 6006.2998, 41460.3008, 1.9000 }, + { 6006.2998, 41460.6016, 1.9200 }, + { 6006.2998, 41460.8984, 1.9400 }, + { 6006.2998, 41461.1992, 1.9700 }, + { 6006.2998, 41461.5000, 2.0100 }, + { 6006.2998, 41461.8008, 2.0500 }, + { 6006.2998, 41462.1016, 2.1000 }, + { 6006.2998, 41462.3984, 2.1800 }, + { 6006.2998, 41462.6992, 2.2700 }, + { 6006.2998, 41463.0000, 2.3600 }, + { 6006.2998, 41463.3008, 2.4500 }, + { 6006.2998, 41463.6016, 2.5600 }, + { 6006.2998, 41463.8984, 2.6700 }, + { 6006.2998, 41464.1992, 2.7700 }, + { 6006.2998, 41464.5000, 2.8600 }, + { 6006.2998, 41464.8008, 2.9100 }, + { 6006.2998, 41465.1016, 2.9400 }, + { 6006.2998, 41465.3984, 2.9700 }, + { 6006.2998, 41465.6992, 3.0100 }, + { 6006.2998, 41466.0000, 3.0600 }, + { 6006.2998, 41466.3008, 3.1200 }, + { 6006.2998, 41466.6016, 3.1800 }, + { 6006.2998, 41466.8984, 3.2200 }, + { 6006.2998, 41467.1992, 3.2400 }, + { 6006.2998, 41467.5000, 3.2400 }, + + { 6006.6001, 41456.1016, 1.9600 }, + { 6006.6001, 41456.3984, 1.9100 }, + { 6006.6001, 41456.6992, 1.8500 }, + { 6006.6001, 41457.0000, 1.8000 }, + { 6006.6001, 41457.3008, 1.8000 }, + { 6006.6001, 41457.6016, 1.8000 }, + { 6006.6001, 41457.8984, 1.8000 }, + { 6006.6001, 41458.1992, 1.8000 }, + { 6006.6001, 41458.5000, 1.8000 }, + { 6006.6001, 41458.8008, 1.8200 }, + { 6006.6001, 41459.1016, 1.8400 }, + { 6006.6001, 41459.3984, 1.8600 }, + { 6006.6001, 41459.6992, 1.8800 }, + { 6006.6001, 41460.0000, 1.9000 }, + { 6006.6001, 41460.3008, 1.9100 }, + { 6006.6001, 41460.6016, 1.9300 }, + { 6006.6001, 41460.8984, 1.9500 }, + { 6006.6001, 41461.1992, 1.9800 }, + { 6006.6001, 41461.5000, 2.0200 }, + { 6006.6001, 41461.8008, 2.0700 }, + { 6006.6001, 41462.1016, 2.1200 }, + { 6006.6001, 41462.3984, 2.2000 }, + { 6006.6001, 41462.6992, 2.3000 }, + { 6006.6001, 41463.0000, 2.3900 }, + { 6006.6001, 41463.3008, 2.4900 }, + { 6006.6001, 41463.6016, 2.6100 }, + { 6006.6001, 41463.8984, 2.7300 }, + { 6006.6001, 41464.1992, 2.8400 }, + { 6006.6001, 41464.5000, 2.9300 }, + { 6006.6001, 41464.8008, 2.9700 }, + { 6006.6001, 41465.1016, 2.9800 }, + { 6006.6001, 41465.3984, 3.0000 }, + { 6006.6001, 41465.6992, 3.0300 }, + { 6006.6001, 41466.0000, 3.0900 }, + { 6006.6001, 41466.3008, 3.1700 }, + { 6006.6001, 41466.6016, 3.2400 }, + { 6006.6001, 41466.8984, 3.3000 }, + { 6006.6001, 41467.1992, 3.3200 }, + { 6006.6001, 41467.5000, 3.3200 }, + + { 6006.8999, 41456.1016, 1.8800 }, + { 6006.8999, 41456.3984, 1.8500 }, + { 6006.8999, 41456.6992, 1.8000 }, + { 6006.8999, 41457.0000, 1.8000 }, + { 6006.8999, 41457.3008, 1.8000 }, + { 6006.8999, 41457.6016, 1.8000 }, + { 6006.8999, 41457.8984, 1.8000 }, + { 6006.8999, 41458.1992, 1.8000 }, + { 6006.8999, 41458.5000, 1.8000 }, + { 6006.8999, 41458.8008, 1.8200 }, + { 6006.8999, 41459.1016, 1.8500 }, + { 6006.8999, 41459.3984, 1.8800 }, + { 6006.8999, 41459.6992, 1.9000 }, + { 6006.8999, 41460.0000, 1.9200 }, + { 6006.8999, 41460.3008, 1.9300 }, + { 6006.8999, 41460.6016, 1.9400 }, + { 6006.8999, 41460.8984, 1.9600 }, + { 6006.8999, 41461.1992, 1.9900 }, + { 6006.8999, 41461.5000, 2.0400 }, + { 6006.8999, 41461.8008, 2.0800 }, + { 6006.8999, 41462.1016, 2.1400 }, + { 6006.8999, 41462.3984, 2.2300 }, + { 6006.8999, 41462.6992, 2.3300 }, + { 6006.8999, 41463.0000, 2.4300 }, + { 6006.8999, 41463.3008, 2.5400 }, + { 6006.8999, 41463.6016, 2.6700 }, + { 6006.8999, 41463.8984, 2.7900 }, + { 6006.8999, 41464.1992, 2.9100 }, + { 6006.8999, 41464.5000, 3.0000 }, + { 6006.8999, 41464.8008, 3.0400 }, + { 6006.8999, 41465.1016, 3.0400 }, + { 6006.8999, 41465.3984, 3.0500 }, + { 6006.8999, 41465.6992, 3.0800 }, + { 6006.8999, 41466.0000, 3.1500 }, + { 6006.8999, 41466.3008, 3.2400 }, + { 6006.8999, 41466.6016, 3.3200 }, + { 6006.8999, 41466.8984, 3.3800 }, + { 6006.8999, 41467.1992, 3.4000 }, + { 6006.8999, 41467.5000, 3.4000 }, + + { 6007.2002, 41456.1016, 1.8300 }, + { 6007.2002, 41456.3984, 1.8000 }, + { 6007.2002, 41456.6992, 1.8000 }, + { 6007.2002, 41457.0000, 1.8000 }, + { 6007.2002, 41457.3008, 1.8000 }, + { 6007.2002, 41457.6016, 1.8000 }, + { 6007.2002, 41457.8984, 1.8000 }, + { 6007.2002, 41458.1992, 1.8000 }, + { 6007.2002, 41458.5000, 1.8000 }, + { 6007.2002, 41458.8008, 1.8000 }, + { 6007.2002, 41459.1016, 1.8600 }, + { 6007.2002, 41459.3984, 1.8900 }, + { 6007.2002, 41459.6992, 1.9200 }, + { 6007.2002, 41460.0000, 1.9400 }, + { 6007.2002, 41460.3008, 1.9500 }, + { 6007.2002, 41460.6016, 1.9600 }, + { 6007.2002, 41460.8984, 1.9800 }, + { 6007.2002, 41461.1992, 2.0100 }, + { 6007.2002, 41461.5000, 2.0600 }, + { 6007.2002, 41461.8008, 2.1100 }, + { 6007.2002, 41462.1016, 2.1700 }, + { 6007.2002, 41462.3984, 2.2600 }, + { 6007.2002, 41462.6992, 2.3700 }, + { 6007.2002, 41463.0000, 2.4800 }, + { 6007.2002, 41463.3008, 2.6000 }, + { 6007.2002, 41463.6016, 2.7300 }, + { 6007.2002, 41463.8984, 2.8600 }, + { 6007.2002, 41464.1992, 2.9700 }, + { 6007.2002, 41464.5000, 3.0600 }, + { 6007.2002, 41464.8008, 3.0900 }, + { 6007.2002, 41465.1016, 3.0900 }, + { 6007.2002, 41465.3984, 3.1000 }, + { 6007.2002, 41465.6992, 3.1300 }, + { 6007.2002, 41466.0000, 3.2100 }, + { 6007.2002, 41466.3008, 3.3100 }, + { 6007.2002, 41466.6016, 3.4100 }, + { 6007.2002, 41466.8984, 3.4800 }, + { 6007.2002, 41467.1992, 3.5000 }, + { 6007.2002, 41467.5000, 3.4800 }, + + { 6007.5000, 41456.1016, 1.8000 }, + { 6007.5000, 41456.3984, 1.7800 }, + { 6007.5000, 41456.6992, 1.8000 }, + { 6007.5000, 41457.0000, 1.8000 }, + { 6007.5000, 41457.3008, 1.8000 }, + { 6007.5000, 41457.6016, 1.8000 }, + { 6007.5000, 41457.8984, 1.8000 }, + { 6007.5000, 41458.1992, 1.8000 }, + { 6007.5000, 41458.5000, 1.8000 }, + { 6007.5000, 41458.8008, 1.8400 }, + { 6007.5000, 41459.1016, 1.8800 }, + { 6007.5000, 41459.3984, 1.9100 }, + { 6007.5000, 41459.6992, 1.9400 }, + { 6007.5000, 41460.0000, 1.9600 }, + { 6007.5000, 41460.3008, 1.9700 }, + { 6007.5000, 41460.6016, 1.9900 }, + { 6007.5000, 41460.8984, 2.0100 }, + { 6007.5000, 41461.1992, 2.0500 }, + { 6007.5000, 41461.5000, 2.1000 }, + { 6007.5000, 41461.8008, 2.1600 }, + { 6007.5000, 41462.1016, 2.2300 }, + { 6007.5000, 41462.3984, 2.3200 }, + { 6007.5000, 41462.6992, 2.4400 }, + { 6007.5000, 41463.0000, 2.5600 }, + { 6007.5000, 41463.3008, 2.6800 }, + { 6007.5000, 41463.6016, 2.8000 }, + { 6007.5000, 41463.8984, 2.9200 }, + { 6007.5000, 41464.1992, 3.0200 }, + { 6007.5000, 41464.5000, 3.1100 }, + { 6007.5000, 41464.8008, 3.1300 }, + { 6007.5000, 41465.1016, 3.1200 }, + { 6007.5000, 41465.3984, 3.1200 }, + { 6007.5000, 41465.6992, 3.1500 }, + { 6007.5000, 41466.0000, 3.2400 }, + { 6007.5000, 41466.3008, 3.3700 }, + { 6007.5000, 41466.6016, 3.4800 }, + { 6007.5000, 41466.8984, 3.5700 }, + { 6007.5000, 41467.1992, 3.5800 }, + { 6007.5000, 41467.5000, 3.5600 }, + + { 6007.7998, 41456.1016, 1.8100 }, + { 6007.7998, 41456.3984, 1.7800 }, + { 6007.7998, 41456.6992, 1.8000 }, + { 6007.7998, 41457.0000, 1.8000 }, + { 6007.7998, 41457.3008, 1.8000 }, + { 6007.7998, 41457.6016, 1.8000 }, + { 6007.7998, 41457.8984, 1.8000 }, + { 6007.7998, 41458.1992, 1.8000 }, + { 6007.7998, 41458.5000, 1.8000 }, + { 6007.7998, 41458.8008, 1.8700 }, + { 6007.7998, 41459.1016, 1.9000 }, + { 6007.7998, 41459.3984, 1.9400 }, + { 6007.7998, 41459.6992, 1.9700 }, + { 6007.7998, 41460.0000, 1.9900 }, + { 6007.7998, 41460.3008, 2.0000 }, + { 6007.7998, 41460.6016, 2.0200 }, + { 6007.7998, 41460.8984, 2.0500 }, + { 6007.7998, 41461.1992, 2.1000 }, + { 6007.7998, 41461.5000, 2.1600 }, + { 6007.7998, 41461.8008, 2.2300 }, + { 6007.7998, 41462.1016, 2.3100 }, + { 6007.7998, 41462.3984, 2.4100 }, + { 6007.7998, 41462.6992, 2.5400 }, + { 6007.7998, 41463.0000, 2.6600 }, + { 6007.7998, 41463.3008, 2.7800 }, + { 6007.7998, 41463.6016, 2.8900 }, + { 6007.7998, 41463.8984, 2.9900 }, + { 6007.7998, 41464.1992, 3.0800 }, + { 6007.7998, 41464.5000, 3.1600 }, + { 6007.7998, 41464.8008, 3.1800 }, + { 6007.7998, 41465.1016, 3.1700 }, + { 6007.7998, 41465.3984, 3.1800 }, + { 6007.7998, 41465.6992, 3.2100 }, + { 6007.7998, 41466.0000, 3.3000 }, + { 6007.7998, 41466.3008, 3.4300 }, + { 6007.7998, 41466.6016, 3.5400 }, + { 6007.7998, 41466.8984, 3.6300 }, + { 6007.7998, 41467.1992, 3.6400 }, + { 6007.7998, 41467.5000, 3.6000 }, + + { 6008.1001, 41456.1016, 1.8200 }, + { 6008.1001, 41456.3984, 1.7900 }, + { 6008.1001, 41456.6992, 1.8000 }, + { 6008.1001, 41457.0000, 1.8000 }, + { 6008.1001, 41457.3008, 1.8000 }, + { 6008.1001, 41457.6016, 1.8000 }, + { 6008.1001, 41457.8984, 1.8000 }, + { 6008.1001, 41458.1992, 1.8000 }, + { 6008.1001, 41458.5000, 1.8700 }, + { 6008.1001, 41458.8008, 1.9000 }, + { 6008.1001, 41459.1016, 1.9300 }, + { 6008.1001, 41459.3984, 1.9600 }, + { 6008.1001, 41459.6992, 2.0000 }, + { 6008.1001, 41460.0000, 2.0200 }, + { 6008.1001, 41460.3008, 2.0400 }, + { 6008.1001, 41460.6016, 2.0700 }, + { 6008.1001, 41460.8984, 2.1000 }, + { 6008.1001, 41461.1992, 2.1600 }, + { 6008.1001, 41461.5000, 2.2300 }, + { 6008.1001, 41461.8008, 2.3100 }, + { 6008.1001, 41462.1016, 2.3900 }, + { 6008.1001, 41462.3984, 2.5000 }, + { 6008.1001, 41462.6992, 2.6300 }, + { 6008.1001, 41463.0000, 2.7500 }, + { 6008.1001, 41463.3008, 2.8700 }, + { 6008.1001, 41463.6016, 2.9800 }, + { 6008.1001, 41463.8984, 3.0800 }, + { 6008.1001, 41464.1992, 3.1600 }, + { 6008.1001, 41464.5000, 3.2300 }, + { 6008.1001, 41464.8008, 3.2600 }, + { 6008.1001, 41465.1016, 3.2500 }, + { 6008.1001, 41465.3984, 3.2600 }, + { 6008.1001, 41465.6992, 3.2900 }, + { 6008.1001, 41466.0000, 3.3800 }, + { 6008.1001, 41466.3008, 3.4900 }, + { 6008.1001, 41466.6016, 3.5900 }, + { 6008.1001, 41466.8984, 3.6700 }, + { 6008.1001, 41467.1992, 3.6700 }, + { 6008.1001, 41467.5000, 3.6400 }, + + { 6008.3999, 41456.1016, 1.8100 }, + { 6008.3999, 41456.3984, 1.8000 }, + { 6008.3999, 41456.6992, 1.8000 }, + { 6008.3999, 41457.0000, 1.8000 }, + { 6008.3999, 41457.3008, 1.8000 }, + { 6008.3999, 41457.6016, 1.8000 }, + { 6008.3999, 41457.8984, 1.8000 }, + { 6008.3999, 41458.1992, 1.8000 }, + { 6008.3999, 41458.5000, 1.9100 }, + { 6008.3999, 41458.8008, 1.9400 }, + { 6008.3999, 41459.1016, 1.9600 }, + { 6008.3999, 41459.3984, 1.9900 }, + { 6008.3999, 41459.6992, 2.0200 }, + { 6008.3999, 41460.0000, 2.0500 }, + { 6008.3999, 41460.3008, 2.0800 }, + { 6008.3999, 41460.6016, 2.1200 }, + { 6008.3999, 41460.8984, 2.1600 }, + { 6008.3999, 41461.1992, 2.2200 }, + { 6008.3999, 41461.5000, 2.2900 }, + { 6008.3999, 41461.8008, 2.3600 }, + { 6008.3999, 41462.1016, 2.4400 }, + { 6008.3999, 41462.3984, 2.5600 }, + { 6008.3999, 41462.6992, 2.6900 }, + { 6008.3999, 41463.0000, 2.8100 }, + { 6008.3999, 41463.3008, 2.9400 }, + { 6008.3999, 41463.6016, 3.0600 }, + { 6008.3999, 41463.8984, 3.1700 }, + { 6008.3999, 41464.1992, 3.2700 }, + { 6008.3999, 41464.5000, 3.3500 }, + { 6008.3999, 41464.8008, 3.3700 }, + { 6008.3999, 41465.1016, 3.3600 }, + { 6008.3999, 41465.3984, 3.3600 }, + { 6008.3999, 41465.6992, 3.3800 }, + { 6008.3999, 41466.0000, 3.4500 }, + { 6008.3999, 41466.3008, 3.5500 }, + { 6008.3999, 41466.6016, 3.6400 }, + { 6008.3999, 41466.8984, 3.7100 }, + { 6008.3999, 41467.1992, 3.7100 }, + { 6008.3999, 41467.5000, 3.6900 }, + + { 6008.7002, 41456.1016, 1.7800 }, + { 6008.7002, 41456.3984, 1.7800 }, + { 6008.7002, 41456.6992, 1.8000 }, + { 6008.7002, 41457.0000, 1.8000 }, + { 6008.7002, 41457.3008, 1.8000 }, + { 6008.7002, 41457.6016, 1.8000 }, + { 6008.7002, 41457.8984, 1.8000 }, + { 6008.7002, 41458.1992, 1.9000 }, + { 6008.7002, 41458.5000, 1.9400 }, + { 6008.7002, 41458.8008, 1.9800 }, + { 6008.7002, 41459.1016, 2.0100 }, + { 6008.7002, 41459.3984, 2.0400 }, + { 6008.7002, 41459.6992, 2.0800 }, + { 6008.7002, 41460.0000, 2.1100 }, + { 6008.7002, 41460.3008, 2.1500 }, + { 6008.7002, 41460.6016, 2.1800 }, + { 6008.7002, 41460.8984, 2.2300 }, + { 6008.7002, 41461.1992, 2.2800 }, + { 6008.7002, 41461.5000, 2.3300 }, + { 6008.7002, 41461.8008, 2.3800 }, + { 6008.7002, 41462.1016, 2.4600 }, + { 6008.7002, 41462.3984, 2.5700 }, + { 6008.7002, 41462.6992, 2.7000 }, + { 6008.7002, 41463.0000, 2.8300 }, + { 6008.7002, 41463.3008, 2.9700 }, + { 6008.7002, 41463.6016, 3.1000 }, + { 6008.7002, 41463.8984, 3.2300 }, + { 6008.7002, 41464.1992, 3.3600 }, + { 6008.7002, 41464.5000, 3.4500 }, + { 6008.7002, 41464.8008, 3.4800 }, + { 6008.7002, 41465.1016, 3.4600 }, + { 6008.7002, 41465.3984, 3.4600 }, + { 6008.7002, 41465.6992, 3.4700 }, + { 6008.7002, 41466.0000, 3.5300 }, + { 6008.7002, 41466.3008, 3.6200 }, + { 6008.7002, 41466.6016, 3.7000 }, + { 6008.7002, 41466.8984, 3.7600 }, + { 6008.7002, 41467.1992, 3.7700 }, + { 6008.7002, 41467.5000, 3.7500 }, + + { 6009.0000, 41456.1016, 1.7300 }, + { 6009.0000, 41456.3984, 1.7500 }, + { 6009.0000, 41456.6992, 1.7500 }, + { 6009.0000, 41457.0000, 1.8000 }, + { 6009.0000, 41457.3008, 1.8000 }, + { 6009.0000, 41457.6016, 1.8000 }, + { 6009.0000, 41457.8984, 1.8600 }, + { 6009.0000, 41458.1992, 1.9000 }, + { 6009.0000, 41458.5000, 1.9500 }, + { 6009.0000, 41458.8008, 2.0000 }, + { 6009.0000, 41459.1016, 2.0600 }, + { 6009.0000, 41459.3984, 2.1100 }, + { 6009.0000, 41459.6992, 2.1700 }, + { 6009.0000, 41460.0000, 2.2100 }, + { 6009.0000, 41460.3008, 2.2400 }, + { 6009.0000, 41460.6016, 2.2800 }, + { 6009.0000, 41460.8984, 2.3200 }, + { 6009.0000, 41461.1992, 2.3400 }, + { 6009.0000, 41461.5000, 2.3700 }, + { 6009.0000, 41461.8008, 2.4000 }, + { 6009.0000, 41462.1016, 2.4500 }, + { 6009.0000, 41462.3984, 2.5500 }, + { 6009.0000, 41462.6992, 2.6800 }, + { 6009.0000, 41463.0000, 2.8100 }, + { 6009.0000, 41463.3008, 2.9400 }, + { 6009.0000, 41463.6016, 3.0900 }, + { 6009.0000, 41463.8984, 3.2300 }, + { 6009.0000, 41464.1992, 3.3700 }, + { 6009.0000, 41464.5000, 3.4900 }, + { 6009.0000, 41464.8008, 3.5200 }, + { 6009.0000, 41465.1016, 3.5200 }, + { 6009.0000, 41465.3984, 3.5200 }, + { 6009.0000, 41465.6992, 3.5400 }, + { 6009.0000, 41466.0000, 3.6000 }, + { 6009.0000, 41466.3008, 3.6900 }, + { 6009.0000, 41466.6016, 3.7600 }, + { 6009.0000, 41466.8984, 3.8300 }, + { 6009.0000, 41467.1992, 3.8400 }, + { 6009.0000, 41467.5000, 3.8300 }, + + { 6009.2998, 41456.1016, 1.7000 }, + { 6009.2998, 41456.3984, 1.7100 }, + { 6009.2998, 41456.6992, 1.7200 }, + { 6009.2998, 41457.0000, 1.7400 }, + { 6009.2998, 41457.3008, 1.7600 }, + { 6009.2998, 41457.6016, 1.7900 }, + { 6009.2998, 41457.8984, 1.8400 }, + { 6009.2998, 41458.1992, 1.8900 }, + { 6009.2998, 41458.5000, 1.9400 }, + { 6009.2998, 41458.8008, 2.0000 }, + { 6009.2998, 41459.1016, 2.0800 }, + { 6009.2998, 41459.3984, 2.1500 }, + { 6009.2998, 41459.6992, 2.2300 }, + { 6009.2998, 41460.0000, 2.2800 }, + { 6009.2998, 41460.3008, 2.3300 }, + { 6009.2998, 41460.6016, 2.3800 }, + { 6009.2998, 41460.8984, 2.4200 }, + { 6009.2998, 41461.1992, 2.4300 }, + { 6009.2998, 41461.5000, 2.4300 }, + { 6009.2998, 41461.8008, 2.4300 }, + { 6009.2998, 41462.1016, 2.4500 }, + { 6009.2998, 41462.3984, 2.5400 }, + { 6009.2998, 41462.6992, 2.6500 }, + { 6009.2998, 41463.0000, 2.7700 }, + { 6009.2998, 41463.3008, 2.8900 }, + { 6009.2998, 41463.6016, 3.0300 }, + { 6009.2998, 41463.8984, 3.1800 }, + { 6009.2998, 41464.1992, 3.3200 }, + { 6009.2998, 41464.5000, 3.4500 }, + { 6009.2998, 41464.8008, 3.5000 }, + { 6009.2998, 41465.1016, 3.5200 }, + { 6009.2998, 41465.3984, 3.5400 }, + { 6009.2998, 41465.6992, 3.5800 }, + { 6009.2998, 41466.0000, 3.6500 }, + { 6009.2998, 41466.3008, 3.7500 }, + { 6009.2998, 41466.6016, 3.8400 }, + { 6009.2998, 41466.8984, 3.9100 }, + { 6009.2998, 41467.1992, 3.9400 }, + { 6009.2998, 41467.5000, 3.9300 }, + + { 6009.6001, 41456.3984, 1.6900 }, + { 6009.6001, 41456.6992, 1.7000 }, + { 6009.6001, 41457.0000, 1.7100 }, + { 6009.6001, 41457.3008, 1.7300 }, + { 6009.6001, 41457.6016, 1.7600 }, + { 6009.6001, 41457.8984, 1.8000 }, + { 6009.6001, 41458.1992, 1.8500 }, + { 6009.6001, 41458.5000, 1.9000 }, + { 6009.6001, 41458.8008, 1.9700 }, + { 6009.6001, 41459.1016, 2.0500 }, + { 6009.6001, 41459.3984, 2.1400 }, + { 6009.6001, 41459.6992, 2.2200 }, + { 6009.6001, 41460.0000, 2.3100 }, + { 6009.6001, 41460.3008, 2.3800 }, + { 6009.6001, 41460.6016, 2.4600 }, + { 6009.6001, 41460.8984, 2.5200 }, + { 6009.6001, 41461.1992, 2.5400 }, + { 6009.6001, 41461.5000, 2.5200 }, + { 6009.6001, 41461.8008, 2.5200 }, + { 6009.6001, 41462.1016, 2.5300 }, + { 6009.6001, 41462.3984, 2.5900 }, + { 6009.6001, 41462.6992, 2.6900 }, + { 6009.6001, 41463.0000, 2.7900 }, + { 6009.6001, 41463.3008, 2.8900 }, + { 6009.6001, 41463.6016, 3.0100 }, + { 6009.6001, 41463.8984, 3.1400 }, + { 6009.6001, 41464.1992, 3.2600 }, + { 6009.6001, 41464.5000, 3.3700 }, + { 6009.6001, 41464.8008, 3.4400 }, + { 6009.6001, 41465.1016, 3.4900 }, + { 6009.6001, 41465.3984, 3.5500 }, + { 6009.6001, 41465.6992, 3.6100 }, + { 6009.6001, 41466.0000, 3.7000 }, + { 6009.6001, 41466.3008, 3.8100 }, + { 6009.6001, 41466.6016, 3.9200 }, + { 6009.6001, 41466.8984, 4.0000 }, + { 6009.6001, 41467.1992, 4.0400 }, + { 6009.6001, 41467.5000, 4.0400 }, + { 6009.6001, 41467.8008, 4.0500 }, + + { 6009.8999, 41456.3984, 1.6900 }, + { 6009.8999, 41456.6992, 1.7000 }, + { 6009.8999, 41457.0000, 1.7100 }, + { 6009.8999, 41457.3008, 1.7200 }, + { 6009.8999, 41457.6016, 1.7400 }, + { 6009.8999, 41457.8984, 1.7600 }, + { 6009.8999, 41458.1992, 1.7900 }, + { 6009.8999, 41458.5000, 1.8200 }, + { 6009.8999, 41458.8008, 1.9000 }, + { 6009.8999, 41459.1016, 2.0000 }, + { 6009.8999, 41459.3984, 2.1000 }, + { 6009.8999, 41459.6992, 2.2000 }, + { 6009.8999, 41460.0000, 2.3100 }, + { 6009.8999, 41460.3008, 2.4200 }, + { 6009.8999, 41460.6016, 2.5200 }, + { 6009.8999, 41460.8984, 2.6200 }, + { 6009.8999, 41461.1992, 2.6500 }, + { 6009.8999, 41461.5000, 2.6600 }, + { 6009.8999, 41461.8008, 2.6700 }, + { 6009.8999, 41462.1016, 2.6900 }, + { 6009.8999, 41462.3984, 2.7400 }, + { 6009.8999, 41462.6992, 2.8200 }, + { 6009.8999, 41463.0000, 2.9000 }, + { 6009.8999, 41463.3008, 2.9900 }, + { 6009.8999, 41463.6016, 3.0700 }, + { 6009.8999, 41463.8984, 3.1600 }, + { 6009.8999, 41464.1992, 3.2400 }, + { 6009.8999, 41464.5000, 3.3100 }, + { 6009.8999, 41464.8008, 3.4000 }, + { 6009.8999, 41465.1016, 3.4800 }, + { 6009.8999, 41465.3984, 3.5700 }, + { 6009.8999, 41465.6992, 3.6600 }, + { 6009.8999, 41466.0000, 3.7700 }, + { 6009.8999, 41466.3008, 3.8800 }, + { 6009.8999, 41466.6016, 3.9900 }, + { 6009.8999, 41466.8984, 4.0900 }, + { 6009.8999, 41467.1992, 4.1300 }, + { 6009.8999, 41467.5000, 4.1400 }, + { 6009.8999, 41467.8008, 4.1600 }, + +}; + +static float normal[][3] = { + { -0.2560, -0.1125, 0.9600 }, + { -0.2850, -0.1272, 0.9501 }, + { -0.3146, -0.0941, 0.9440 }, + { -0.3295, -0.0626, 0.9419 }, + { -0.3154, -0.0315, 0.9474 }, + { -0.2560, 0.0162, 0.9644 }, + { -0.1784, 0.0328, 0.9801 }, + { -0.1145, 0.0493, 0.9887 }, + { -0.0488, 0.0494, 0.9908 }, + { 0.0001, 0.0497, 0.9964 }, + { 0.0331, 0.0666, 0.9950 }, + { 0.0825, 0.0828, 0.9918 }, + { 0.0824, 0.0988, 0.9905 }, + { 0.0662, 0.0826, 0.9937 }, + { 0.0166, 0.0663, 0.9975 }, + { -0.0166, 0.0500, 0.9983 }, + { -0.0665, 0.0334, 0.9972 }, + { -0.1157, 0.0000, 0.9926 }, + { -0.1794, -0.0812, 0.9791 }, + { -0.1626, -0.1459, 0.9757 }, + { -0.1135, -0.1954, 0.9734 }, + { -0.0161, -0.2432, 0.9696 }, + { 0.0810, -0.2098, 0.9731 }, + { 0.1469, -0.1302, 0.9799 }, + { 0.1639, -0.0653, 0.9838 }, + { 0.1321, -0.0165, 0.9910 }, + { 0.0665, 0.0166, 0.9975 }, + { 0.0167, 0.0332, 0.9992 }, + { -0.0166, 0.0498, 0.9983 }, + { -0.0166, 0.0663, 0.9975 }, + { -0.0166, 0.0500, 0.9983 }, + { -0.0167, 0.0334, 0.9992 }, + { -0.0333, 0.0166, 0.9992 }, + { -0.0333, 0.0000, 0.9994 }, + { -0.0333, 0.0000, 0.9994 }, + { -0.0499, 0.0168, 0.9983 }, + { -0.0665, 0.0334, 0.9972 }, + { -0.0829, 0.0331, 0.9959 }, + { -0.0992, 0.0000, 0.9940 }, + { -0.2244, -0.1451, 0.9630 }, + { -0.2539, -0.1595, 0.9535 }, + { -0.2693, -0.1266, 0.9531 }, + { -0.2847, -0.0792, 0.9533 }, + { -0.2698, -0.0159, 0.9586 }, + { -0.2396, 0.0647, 0.9650 }, + { -0.1939, 0.0978, 0.9741 }, + { -0.1470, 0.0981, 0.9831 }, + { -0.0981, 0.1147, 0.9862 }, + { -0.0330, 0.1154, 0.9921 }, + { 0.0000, 0.1163, 0.9925 }, + { 0.0331, 0.1163, 0.9925 }, + { 0.0497, 0.0991, 0.9937 }, + { 0.0332, 0.0662, 0.9967 }, + { 0.0167, 0.0332, 0.9992 }, + { -0.0166, 0.0166, 0.9994 }, + { -0.0665, -0.0166, 0.9975 }, + { -0.1318, -0.0657, 0.9886 }, + { -0.1794, -0.0976, 0.9788 }, + { -0.1633, -0.1140, 0.9798 }, + { -0.1310, -0.1315, 0.9826 }, + { -0.0495, -0.1325, 0.9898 }, + { 0.0494, -0.1153, 0.9907 }, + { 0.1148, -0.0985, 0.9873 }, + { 0.1314, -0.0820, 0.9873 }, + { 0.0991, -0.0664, 0.9923 }, + { 0.0498, -0.0502, 0.9972 }, + { 0.0167, 0.0000, 0.9992 }, + { 0.0000, 0.0498, 0.9986 }, + { -0.0166, 0.0663, 0.9975 }, + { -0.0166, 0.0500, 0.9983 }, + { -0.0167, 0.0168, 0.9994 }, + { -0.0333, 0.0000, 0.9994 }, + { -0.0333, 0.0000, 0.9994 }, + { -0.0499, 0.0000, 0.9986 }, + { -0.0499, 0.0000, 0.9986 }, + { -0.0830, 0.0000, 0.9964 }, + { -0.0995, 0.0000, 0.9950 }, + { -0.1481, -0.0328, 0.9877 }, + { -0.1934, -0.1619, 0.9671 }, + { -0.1927, -0.1776, 0.9644 }, + { -0.1781, -0.1294, 0.9738 }, + { -0.1630, -0.0652, 0.9818 }, + { -0.1146, 0.0164, 0.9887 }, + { -0.0818, 0.0993, 0.9877 }, + { -0.0491, 0.1321, 0.9866 }, + { -0.0164, 0.1474, 0.9854 }, + { 0.0163, 0.1638, 0.9851 }, + { 0.0492, 0.1475, 0.9865 }, + { 0.0658, 0.1323, 0.9885 }, + { 0.0658, 0.1323, 0.9885 }, + { 0.0825, 0.0987, 0.9910 }, + { 0.0498, 0.0497, 0.9972 }, + { 0.0333, 0.0166, 0.9992 }, + { 0.0000, -0.0336, 0.9989 }, + { -0.0497, -0.0831, 0.9950 }, + { -0.1150, -0.1148, 0.9864 }, + { -0.1633, -0.1140, 0.9798 }, + { -0.1794, -0.0976, 0.9788 }, + { -0.1635, -0.0821, 0.9825 }, + { -0.1152, -0.0663, 0.9899 }, + { -0.0496, -0.0497, 0.9962 }, + { -0.0164, -0.0496, 0.9951 }, + { 0.0165, -0.0825, 0.9929 }, + { 0.0166, -0.0998, 0.9936 }, + { 0.0166, -0.0669, 0.9969 }, + { 0.0167, -0.0166, 0.9994 }, + { 0.0000, 0.0166, 0.9997 }, + { -0.0166, 0.0498, 0.9983 }, + { -0.0333, 0.0500, 0.9981 }, + { -0.0333, 0.0168, 0.9992 }, + { -0.0333, 0.0000, 0.9994 }, + { -0.0499, -0.0166, 0.9983 }, + { -0.0665, -0.0166, 0.9975 }, + { -0.0830, -0.0168, 0.9961 }, + { -0.0995, -0.0167, 0.9948 }, + { -0.1318, -0.0329, 0.9897 }, + { -0.1638, -0.0817, 0.9830 }, + { -0.1619, -0.1628, 0.9728 }, + { -0.0977, -0.1479, 0.9819 }, + { -0.0491, -0.0986, 0.9900 }, + { 0.0001, -0.0165, 0.9937 }, + { 0.0494, 0.0659, 0.9926 }, + { 0.0815, 0.1318, 0.9840 }, + { 0.0976, 0.1639, 0.9795 }, + { 0.1139, 0.1627, 0.9789 }, + { 0.1293, 0.1779, 0.9733 }, + { 0.1301, 0.1623, 0.9771 }, + { 0.1308, 0.1315, 0.9821 }, + { 0.1308, 0.1315, 0.9821 }, + { 0.0990, 0.0821, 0.9905 }, + { 0.0830, 0.0166, 0.9961 }, + { 0.0499, -0.0166, 0.9983 }, + { 0.0000, -0.0669, 0.9972 }, + { -0.0330, -0.1322, 0.9902 }, + { -0.0816, -0.1792, 0.9802 }, + { -0.1138, -0.1625, 0.9784 }, + { -0.1468, -0.1141, 0.9812 }, + { -0.1474, -0.0657, 0.9852 }, + { -0.1154, -0.0167, 0.9918 }, + { -0.0830, -0.0166, 0.9961 }, + { -0.0663, -0.0331, 0.9967 }, + { -0.0498, -0.0497, 0.9972 }, + { -0.0332, -0.0667, 0.9972 }, + { -0.0166, -0.0502, 0.9983 }, + { -0.0167, -0.0166, 0.9994 }, + { -0.0167, 0.0166, 0.9994 }, + { -0.0167, 0.0332, 0.9992 }, + { -0.0166, 0.0334, 0.9992 }, + { -0.0333, 0.0168, 0.9992 }, + { -0.0333, -0.0166, 0.9992 }, + { -0.0499, -0.0332, 0.9981 }, + { -0.0665, -0.0332, 0.9972 }, + { -0.0994, -0.0333, 0.9945 }, + { -0.1157, -0.0497, 0.9918 }, + { -0.1479, -0.0656, 0.9867 }, + { -0.1477, -0.0819, 0.9854 }, + { -0.1315, -0.0987, 0.9859 }, + { -0.0663, -0.0666, 0.9950 }, + { 0.0000, -0.0332, 0.9983 }, + { 0.0664, 0.0331, 0.9961 }, + { 0.0989, 0.0985, 0.9891 }, + { 0.1306, 0.1476, 0.9797 }, + { 0.1623, 0.1628, 0.9732 }, + { 0.1775, 0.1769, 0.9678 }, + { 0.1931, 0.1764, 0.9651 }, + { 0.1627, 0.1459, 0.9757 }, + { 0.1631, 0.1309, 0.9779 }, + { 0.1313, 0.0990, 0.9853 }, + { 0.0830, 0.0496, 0.9950 }, + { 0.0664, 0.0000, 0.9967 }, + { 0.0498, -0.0661, 0.9959 }, + { 0.0166, -0.1164, 0.9928 }, + { 0.0164, -0.1644, 0.9845 }, + { 0.0322, -0.1946, 0.9755 }, + { 0.0482, -0.1784, 0.9760 }, + { 0.0479, -0.1300, 0.9789 }, + { 0.0638, -0.0489, 0.9821 }, + { 0.0648, 0.0000, 0.9892 }, + { 0.0648, 0.0000, 0.9892 }, + { 0.0656, -0.0165, 0.9926 }, + { 0.0494, -0.0496, 0.9940 }, + { 0.0493, -0.0665, 0.9931 }, + { 0.0331, -0.0501, 0.9958 }, + { 0.0166, -0.0166, 0.9983 }, + { 0.0000, 0.0166, 0.9992 }, + { -0.0166, 0.0498, 0.9983 }, + { -0.0166, 0.0332, 0.9986 }, + { -0.0333, 0.0000, 0.9994 }, + { -0.0333, -0.0166, 0.9992 }, + { -0.0499, -0.0497, 0.9972 }, + { -0.0664, -0.0662, 0.9956 }, + { -0.0829, -0.0665, 0.9942 }, + { -0.0992, -0.0664, 0.9923 }, + { -0.1157, -0.0659, 0.9910 }, + { -0.1155, -0.0822, 0.9896 }, + { -0.1318, -0.0659, 0.9886 }, + { -0.1158, -0.0167, 0.9929 }, + { -0.0663, 0.0331, 0.9962 }, + { -0.0165, 0.0827, 0.9951 }, + { 0.0330, 0.1315, 0.9897 }, + { 0.0814, 0.1961, 0.9765 }, + { 0.1290, 0.2107, 0.9683 }, + { 0.1611, 0.1930, 0.9674 }, + { 0.1619, 0.1615, 0.9725 }, + { 0.1470, 0.1304, 0.9804 }, + { 0.1149, 0.0987, 0.9867 }, + { 0.0829, 0.0500, 0.9950 }, + { 0.0499, 0.0166, 0.9983 }, + { 0.0167, -0.0166, 0.9994 }, + { 0.0166, -0.0662, 0.9970 }, + { 0.0331, -0.0998, 0.9945 }, + { 0.0661, -0.1159, 0.9909 }, + { 0.1307, -0.1466, 0.9804 }, + { 0.1783, -0.1455, 0.9729 }, + { 0.2257, -0.0965, 0.9684 }, + { 0.2421, -0.0485, 0.9688 }, + { 0.2268, -0.0164, 0.9732 }, + { 0.2268, -0.0162, 0.9732 }, + { 0.1955, -0.0488, 0.9788 }, + { 0.1793, -0.0652, 0.9805 }, + { 0.1477, -0.0825, 0.9853 }, + { 0.1154, -0.0829, 0.9896 }, + { 0.0992, -0.0495, 0.9932 }, + { 0.0664, -0.0166, 0.9970 }, + { 0.0332, 0.0166, 0.9986 }, + { -0.0167, 0.0166, 0.9994 }, + { -0.0333, 0.0000, 0.9994 }, + { -0.0498, -0.0331, 0.9975 }, + { -0.0664, -0.0662, 0.9956 }, + { -0.0664, -0.0662, 0.9956 }, + { -0.0828, -0.0665, 0.9942 }, + { -0.0827, -0.0829, 0.9929 }, + { -0.0827, -0.0825, 0.9929 }, + { -0.0991, -0.0824, 0.9915 }, + { -0.0658, -0.0662, 0.9929 }, + { -0.0493, -0.0002, 0.9948 }, + { -0.0164, 0.0660, 0.9937 }, + { 0.0001, 0.1313, 0.9886 }, + { 0.0326, 0.1951, 0.9792 }, + { 0.0805, 0.2426, 0.9665 }, + { 0.0965, 0.2423, 0.9652 }, + { 0.0971, 0.2100, 0.9722 }, + { 0.0979, 0.1629, 0.9807 }, + { 0.0822, 0.0986, 0.9900 }, + { 0.0498, 0.0667, 0.9964 }, + { 0.0332, 0.0336, 0.9978 }, + { 0.0166, -0.0166, 0.9994 }, + { 0.0000, -0.0332, 0.9994 }, + { 0.0000, -0.0498, 0.9986 }, + { 0.0332, -0.0667, 0.9972 }, + { 0.0498, -0.0667, 0.9964 }, + { 0.0989, -0.0823, 0.9910 }, + { 0.1635, -0.0816, 0.9825 }, + { 0.2105, -0.0648, 0.9743 }, + { 0.2265, -0.0487, 0.9721 }, + { 0.2268, -0.0164, 0.9732 }, + { 0.2107, -0.0324, 0.9753 }, + { 0.1953, -0.0650, 0.9781 }, + { 0.1787, -0.0974, 0.9774 }, + { 0.1470, -0.1312, 0.9803 }, + { 0.1314, -0.0991, 0.9858 }, + { 0.0991, -0.0660, 0.9923 }, + { 0.0663, -0.0497, 0.9959 }, + { 0.0332, -0.0332, 0.9983 }, + { -0.0167, -0.0334, 0.9992 }, + { -0.0499, -0.0334, 0.9981 }, + { -0.0829, -0.0496, 0.9950 }, + { -0.0828, -0.0661, 0.9942 }, + { -0.0827, -0.0825, 0.9929 }, + { -0.0991, -0.0828, 0.9915 }, + { -0.0993, -0.0665, 0.9928 }, + { -0.0827, -0.0825, 0.9929 }, + { -0.0827, -0.0825, 0.9929 }, + { 0.0660, -0.0165, 0.9953 }, + { 0.1145, 0.0328, 0.9890 }, + { 0.1308, 0.0819, 0.9857 }, + { 0.1455, 0.1298, 0.9770 }, + { 0.1282, 0.2083, 0.9664 }, + { 0.1119, 0.2570, 0.9598 }, + { 0.0968, 0.2268, 0.9685 }, + { 0.0652, 0.1952, 0.9786 }, + { 0.0329, 0.1473, 0.9868 }, + { 0.0000, 0.0828, 0.9959 }, + { 0.0000, 0.0500, 0.9981 }, + { -0.0166, 0.0168, 0.9994 }, + { -0.0166, -0.0166, 0.9994 }, + { -0.0166, -0.0332, 0.9992 }, + { -0.0166, -0.0332, 0.9992 }, + { 0.0000, -0.0502, 0.9980 }, + { 0.0166, -0.0502, 0.9983 }, + { 0.0499, -0.0332, 0.9981 }, + { 0.0827, -0.0331, 0.9948 }, + { 0.1154, -0.0330, 0.9915 }, + { 0.1313, -0.0331, 0.9886 }, + { 0.1313, -0.0331, 0.9886 }, + { 0.1153, -0.0494, 0.9907 }, + { 0.1151, -0.0821, 0.9886 }, + { 0.0822, -0.1150, 0.9886 }, + { 0.0491, -0.1321, 0.9866 }, + { 0.0163, -0.1318, 0.9845 }, + { -0.0325, -0.1149, 0.9878 }, + { -0.0652, -0.0822, 0.9894 }, + { -0.0819, -0.0659, 0.9911 }, + { -0.0825, -0.0665, 0.9931 }, + { -0.0828, -0.0665, 0.9942 }, + { -0.0993, -0.0660, 0.9929 }, + { -0.0993, -0.0660, 0.9929 }, + { -0.0991, -0.0824, 0.9915 }, + { -0.0991, -0.0828, 0.9915 }, + { -0.0993, -0.0665, 0.9928 }, + { -0.0993, -0.0660, 0.9929 }, + { -0.0989, -0.0823, 0.9910 }, + { 0.1638, 0.0658, 0.9838 }, + { 0.2112, 0.0653, 0.9751 }, + { 0.2257, 0.0965, 0.9684 }, + { 0.2404, 0.1279, 0.9621 }, + { 0.2239, 0.1595, 0.9605 }, + { 0.1605, 0.2097, 0.9638 }, + { 0.0975, 0.1958, 0.9752 }, + { 0.0493, 0.1477, 0.9875 }, + { 0.0000, 0.0991, 0.9945 }, + { -0.0332, 0.0663, 0.9972 }, + { -0.0499, 0.0499, 0.9972 }, + { -0.0499, 0.0168, 0.9983 }, + { -0.0499, -0.0166, 0.9983 }, + { -0.0499, -0.0332, 0.9981 }, + { -0.0499, -0.0332, 0.9981 }, + { -0.0333, -0.0334, 0.9989 }, + { -0.0167, -0.0168, 0.9994 }, + { 0.0000, -0.0166, 0.9992 }, + { 0.0166, -0.0166, 0.9994 }, + { 0.0332, -0.0166, 0.9986 }, + { 0.0499, -0.0334, 0.9981 }, + { 0.0499, -0.0334, 0.9981 }, + { 0.0332, -0.0497, 0.9975 }, + { 0.0165, -0.0990, 0.9932 }, + { 0.0000, -0.1636, 0.9854 }, + { -0.0489, -0.1966, 0.9791 }, + { -0.1139, -0.1798, 0.9768 }, + { -0.1467, -0.1463, 0.9780 }, + { -0.1793, -0.0975, 0.9783 }, + { -0.1642, -0.0491, 0.9851 }, + { -0.1321, -0.0332, 0.9907 }, + { -0.0994, -0.0498, 0.9937 }, + { -0.0828, -0.0661, 0.9942 }, + { -0.0828, -0.0661, 0.9942 }, + { -0.0991, -0.0824, 0.9915 }, + { -0.0827, -0.0829, 0.9929 }, + { -0.0993, -0.0665, 0.9928 }, + { -0.0991, -0.0824, 0.9915 }, + { -0.1315, -0.0984, 0.9864 }, + { 0.1953, 0.0980, 0.9758 }, + { 0.2108, 0.0976, 0.9725 }, + { 0.2410, 0.1121, 0.9638 }, + { 0.2252, 0.1284, 0.9653 }, + { 0.2094, 0.1288, 0.9682 }, + { 0.1466, 0.1311, 0.9793 }, + { 0.0660, 0.1161, 0.9903 }, + { 0.0166, 0.0992, 0.9948 }, + { -0.0166, 0.0662, 0.9970 }, + { -0.0333, 0.0332, 0.9989 }, + { -0.0499, 0.0334, 0.9981 }, + { -0.0665, 0.0168, 0.9975 }, + { -0.0665, -0.0166, 0.9975 }, + { -0.0499, -0.0332, 0.9981 }, + { -0.0499, -0.0166, 0.9983 }, + { -0.0333, -0.0168, 0.9992 }, + { -0.0333, -0.0168, 0.9992 }, + { -0.0333, 0.0000, 0.9994 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0167, -0.0168, 0.9994 }, + { 0.0166, -0.0500, 0.9983 }, + { -0.0166, -0.0828, 0.9962 }, + { -0.0331, -0.1155, 0.9926 }, + { -0.0491, -0.1790, 0.9813 }, + { -0.0806, -0.2426, 0.9665 }, + { -0.1288, -0.2260, 0.9650 }, + { -0.1619, -0.1774, 0.9706 }, + { -0.1631, -0.0972, 0.9791 }, + { -0.1483, -0.0164, 0.9885 }, + { -0.1159, 0.0000, 0.9931 }, + { -0.0830, -0.0166, 0.9961 }, + { -0.0665, -0.0497, 0.9964 }, + { -0.0498, -0.0827, 0.9951 }, + { -0.0662, -0.0826, 0.9937 }, + { -0.0498, -0.0833, 0.9950 }, + { -0.0662, -0.0832, 0.9936 }, + { -0.0826, -0.0987, 0.9910 }, + { -0.0985, -0.1311, 0.9859 }, + { 0.1786, 0.1301, 0.9746 }, + { 0.1948, 0.1140, 0.9741 }, + { 0.1945, 0.1133, 0.9737 }, + { 0.1634, 0.0979, 0.9812 }, + { 0.1315, 0.0820, 0.9872 }, + { 0.0993, 0.0665, 0.9928 }, + { 0.0498, 0.0667, 0.9964 }, + { 0.0166, 0.0663, 0.9975 }, + { -0.0333, 0.0498, 0.9981 }, + { -0.0333, 0.0332, 0.9989 }, + { -0.0499, 0.0166, 0.9983 }, + { -0.0499, 0.0000, 0.9986 }, + { -0.0499, 0.0000, 0.9986 }, + { -0.0333, -0.0166, 0.9992 }, + { -0.0333, -0.0166, 0.9992 }, + { -0.0333, -0.0168, 0.9992 }, + { -0.0333, -0.0168, 0.9992 }, + { -0.0167, 0.0166, 0.9994 }, + { 0.0000, 0.0166, 0.9997 }, + { 0.0000, 0.0000, 1.0000 }, + { -0.0166, -0.0168, 0.9994 }, + { -0.0331, -0.0664, 0.9962 }, + { -0.0496, -0.0991, 0.9937 }, + { -0.0658, -0.1313, 0.9881 }, + { -0.0970, -0.2094, 0.9713 }, + { -0.1114, -0.2718, 0.9556 }, + { -0.1432, -0.2557, 0.9554 }, + { -0.1616, -0.1769, 0.9697 }, + { -0.1476, -0.0816, 0.9843 }, + { -0.1321, 0.0000, 0.9907 }, + { -0.0994, 0.0333, 0.9945 }, + { -0.0829, 0.0002, 0.9959 }, + { -0.0499, -0.0332, 0.9981 }, + { -0.0332, -0.0662, 0.9967 }, + { -0.0166, -0.0828, 0.9962 }, + { -0.0166, -0.0834, 0.9961 }, + { -0.0166, -0.0999, 0.9947 }, + { -0.0331, -0.1154, 0.9921 }, + { -0.0492, -0.1635, 0.9846 }, + { 0.1783, 0.1464, 0.9728 }, + { 0.1790, 0.1145, 0.9769 }, + { 0.1477, 0.0819, 0.9854 }, + { 0.1319, 0.0658, 0.9891 }, + { 0.1156, 0.0659, 0.9910 }, + { 0.0829, 0.0498, 0.9950 }, + { 0.0499, 0.0334, 0.9981 }, + { 0.0166, 0.0166, 0.9994 }, + { -0.0166, 0.0166, 0.9994 }, + { -0.0333, 0.0166, 0.9992 }, + { -0.0332, 0.0168, 0.9986 }, + { -0.0333, 0.0168, 0.9992 }, + { -0.0333, 0.0000, 0.9994 }, + { -0.0333, -0.0166, 0.9992 }, + { -0.0333, -0.0166, 0.9992 }, + { -0.0333, -0.0168, 0.9992 }, + { -0.0166, -0.0002, 0.9992 }, + { -0.0167, 0.0332, 0.9992 }, + { -0.0167, 0.0166, 0.9994 }, + { -0.0167, -0.0166, 0.9994 }, + { -0.0333, -0.0502, 0.9980 }, + { -0.0663, -0.0830, 0.9942 }, + { -0.0661, -0.1153, 0.9910 }, + { -0.0981, -0.1629, 0.9812 }, + { -0.1287, -0.2245, 0.9654 }, + { -0.1420, -0.2852, 0.9472 }, + { -0.1581, -0.2695, 0.9487 }, + { -0.1616, -0.1769, 0.9697 }, + { -0.1637, -0.0650, 0.9822 }, + { -0.1481, 0.0328, 0.9877 }, + { -0.1157, 0.0497, 0.9918 }, + { -0.0994, 0.0333, 0.9945 }, + { -0.0499, 0.0000, 0.9981 }, + { -0.0499, -0.0497, 0.9972 }, + { -0.0166, -0.0663, 0.9975 }, + { -0.0166, -0.0834, 0.9961 }, + { 0.0000, -0.0999, 0.9950 }, + { 0.0000, -0.1316, 0.9908 }, + { -0.0164, -0.1798, 0.9833 }, + { 0.1302, 0.1309, 0.9802 }, + { 0.0985, 0.0829, 0.9894 }, + { 0.0660, 0.0661, 0.9934 }, + { 0.0660, 0.0661, 0.9934 }, + { 0.0494, 0.0330, 0.9942 }, + { 0.0166, 0.0000, 0.9986 }, + { 0.0000, 0.0000, 0.9994 }, + { -0.0166, 0.0000, 0.9997 }, + { -0.0166, 0.0000, 0.9997 }, + { -0.0333, 0.0166, 0.9992 }, + { -0.0166, 0.0166, 0.9994 }, + { -0.0167, 0.0000, 0.9997 }, + { -0.0167, 0.0000, 0.9997 }, + { -0.0167, -0.0166, 0.9994 }, + { -0.0167, -0.0166, 0.9994 }, + { -0.0167, 0.0000, 0.9997 }, + { -0.0166, 0.0000, 0.9997 }, + { -0.0167, 0.0166, 0.9994 }, + { -0.0333, 0.0166, 0.9992 }, + { -0.0333, -0.0166, 0.9992 }, + { -0.0332, -0.0668, 0.9966 }, + { -0.0662, -0.0997, 0.9928 }, + { -0.0822, -0.1312, 0.9873 }, + { -0.0975, -0.1944, 0.9755 }, + { -0.1119, -0.2550, 0.9598 }, + { -0.1259, -0.3004, 0.9448 }, + { -0.1269, -0.2706, 0.9526 }, + { -0.1297, -0.1776, 0.9738 }, + { -0.1476, -0.0652, 0.9846 }, + { -0.1316, 0.0492, 0.9883 }, + { -0.1154, 0.0827, 0.9896 }, + { -0.0993, 0.0665, 0.9928 }, + { -0.0992, 0.0165, 0.9932 }, + { -0.0829, -0.0331, 0.9959 }, + { -0.0826, -0.0496, 0.9940 }, + { -0.0662, -0.0666, 0.9950 }, + { -0.0495, -0.0830, 0.9940 }, + { -0.0492, -0.1313, 0.9884 }, + { -0.0327, -0.1796, 0.9825 }, + { -0.0165, 0.0829, 0.9928 }, + { -0.0494, 0.0500, 0.9939 }, + { -0.0660, 0.0496, 0.9942 }, + { -0.0821, 0.0494, 0.9918 }, + { -0.0989, 0.0165, 0.9926 }, + { -0.0828, 0.0000, 0.9953 }, + { -0.0664, 0.0000, 0.9972 }, + { -0.0499, 0.0000, 0.9986 }, + { -0.0333, 0.0000, 0.9994 }, + { -0.0333, 0.0166, 0.9992 }, + { -0.0333, 0.0334, 0.9989 }, + { -0.0167, 0.0168, 0.9994 }, + { -0.0167, 0.0000, 0.9997 }, + { -0.0167, -0.0166, 0.9994 }, + { -0.0167, -0.0166, 0.9994 }, + { -0.0167, -0.0168, 0.9994 }, + { -0.0166, -0.0002, 0.9992 }, + { -0.0167, 0.0166, 0.9994 }, + { -0.0333, 0.0000, 0.9994 }, + { -0.0333, -0.0166, 0.9992 }, + { -0.0497, -0.0833, 0.9939 }, + { -0.0495, -0.1325, 0.9898 }, + { -0.0821, -0.1474, 0.9854 }, + { -0.0975, -0.1944, 0.9755 }, + { -0.0961, -0.2555, 0.9615 }, + { -0.0791, -0.3020, 0.9498 }, + { -0.0638, -0.2723, 0.9584 }, + { -0.0651, -0.1948, 0.9776 }, + { -0.0821, -0.0651, 0.9884 }, + { -0.0828, 0.0660, 0.9937 }, + { -0.0827, 0.0829, 0.9929 }, + { -0.0993, 0.0500, 0.9937 }, + { -0.1158, 0.0165, 0.9929 }, + { -0.1157, -0.0329, 0.9921 }, + { -0.1481, -0.0492, 0.9875 }, + { -0.1476, -0.0496, 0.9864 }, + { -0.1473, -0.0822, 0.9843 }, + { -0.1468, -0.1141, 0.9812 }, + { -0.1299, -0.1463, 0.9784 }, + { -0.0664, 0.0168, 0.9970 }, + { -0.1158, 0.0332, 0.9926 }, + { -0.1483, 0.0329, 0.9883 }, + { -0.1803, 0.0327, 0.9829 }, + { -0.1803, 0.0327, 0.9829 }, + { -0.1642, 0.0330, 0.9854 }, + { -0.1158, 0.0332, 0.9926 }, + { -0.0830, 0.0331, 0.9959 }, + { -0.0499, 0.0166, 0.9983 }, + { -0.0333, 0.0166, 0.9992 }, + { -0.0333, 0.0334, 0.9989 }, + { -0.0333, 0.0168, 0.9992 }, + { -0.0333, 0.0000, 0.9994 }, + { -0.0333, -0.0166, 0.9992 }, + { -0.0333, -0.0166, 0.9992 }, + { -0.0333, 0.0000, 0.9994 }, + { -0.0167, 0.0000, 0.9997 }, + { -0.0333, 0.0000, 0.9994 }, + { -0.0333, 0.0000, 0.9994 }, + { -0.0499, -0.0331, 0.9975 }, + { -0.0498, -0.0833, 0.9950 }, + { -0.0495, -0.1321, 0.9893 }, + { -0.0655, -0.1794, 0.9815 }, + { -0.0812, -0.2104, 0.9740 }, + { -0.0645, -0.2412, 0.9677 }, + { -0.0480, -0.2732, 0.9605 }, + { -0.0161, -0.2583, 0.9652 }, + { 0.0000, -0.1952, 0.9797 }, + { 0.0000, -0.0819, 0.9927 }, + { -0.0166, 0.0496, 0.9962 }, + { -0.0498, 0.0664, 0.9959 }, + { -0.0830, 0.0333, 0.9959 }, + { -0.0995, 0.0000, 0.9945 }, + { -0.1480, -0.0655, 0.9861 }, + { -0.1797, -0.0814, 0.9801 }, + { -0.2114, -0.0653, 0.9751 }, + { -0.2263, -0.0810, 0.9701 }, + { -0.2256, -0.1125, 0.9671 }, + { -0.2096, -0.1446, 0.9668 }, + { -0.0333, -0.0168, 0.9992 }, + { -0.0830, -0.0333, 0.9959 }, + { -0.1319, -0.0165, 0.9904 }, + { -0.1802, 0.0163, 0.9832 }, + { -0.1960, 0.0326, 0.9801 }, + { -0.1798, 0.0658, 0.9808 }, + { -0.1477, 0.0825, 0.9853 }, + { -0.1156, 0.0659, 0.9910 }, + { -0.0829, 0.0496, 0.9951 }, + { -0.0499, 0.0332, 0.9981 }, + { -0.0333, 0.0334, 0.9989 }, + { -0.0333, 0.0168, 0.9992 }, + { -0.0333, 0.0000, 0.9994 }, + { -0.0333, -0.0166, 0.9992 }, + { -0.0333, -0.0166, 0.9992 }, + { -0.0333, 0.0000, 0.9994 }, + { -0.0499, 0.0000, 0.9986 }, + { -0.0333, 0.0000, 0.9994 }, + { -0.0333, -0.0166, 0.9992 }, + { -0.0499, -0.0332, 0.9981 }, + { -0.0497, -0.0833, 0.9939 }, + { -0.0658, -0.1484, 0.9866 }, + { -0.0816, -0.1792, 0.9802 }, + { -0.0652, -0.1952, 0.9786 }, + { -0.0646, -0.2257, 0.9710 }, + { -0.0482, -0.2583, 0.9647 }, + { -0.0162, -0.2278, 0.9729 }, + { 0.0000, -0.1797, 0.9830 }, + { 0.0166, -0.0820, 0.9930 }, + { 0.0000, 0.0166, 0.9992 }, + { -0.0499, 0.0166, 0.9983 }, + { -0.0665, 0.0000, 0.9978 }, + { -0.1155, -0.0493, 0.9907 }, + { -0.1790, -0.1137, 0.9770 }, + { -0.2254, -0.1125, 0.9671 }, + { -0.2704, -0.0961, 0.9568 }, + { -0.2995, -0.0952, 0.9483 }, + { -0.2856, -0.0951, 0.9531 }, + { -0.2408, -0.1121, 0.9638 }, + { -0.0499, -0.0170, 0.9972 }, + { -0.0664, -0.0666, 0.9956 }, + { -0.0993, -0.0660, 0.9929 }, + { -0.1481, -0.0328, 0.9878 }, + { -0.1639, 0.0327, 0.9849 }, + { -0.1477, 0.0825, 0.9853 }, + { -0.1313, 0.0990, 0.9859 }, + { -0.1152, 0.0986, 0.9883 }, + { -0.0991, 0.0824, 0.9915 }, + { -0.0664, 0.0662, 0.9956 }, + { -0.0333, 0.0500, 0.9981 }, + { -0.0333, 0.0168, 0.9992 }, + { -0.0166, 0.0000, 0.9997 }, + { -0.0333, -0.0166, 0.9992 }, + { -0.0333, -0.0166, 0.9992 }, + { -0.0499, -0.0168, 0.9983 }, + { -0.0499, -0.0002, 0.9981 }, + { -0.0499, 0.0166, 0.9983 }, + { -0.0499, -0.0166, 0.9983 }, + { -0.0499, -0.0497, 0.9972 }, + { -0.0661, -0.0997, 0.9922 }, + { -0.0818, -0.1640, 0.9824 }, + { -0.0979, -0.1789, 0.9788 }, + { -0.1132, -0.1938, 0.9728 }, + { -0.1129, -0.2252, 0.9676 }, + { -0.1125, -0.2264, 0.9663 }, + { -0.0967, -0.2111, 0.9704 }, + { -0.1132, -0.1621, 0.9764 }, + { -0.0977, -0.0817, 0.9858 }, + { -0.0989, -0.0165, 0.9926 }, + { -0.1155, 0.0000, 0.9921 }, + { -0.1312, -0.0328, 0.9881 }, + { -0.1629, -0.1136, 0.9784 }, + { -0.2083, -0.1758, 0.9619 }, + { -0.2683, -0.1732, 0.9474 }, + { -0.3130, -0.1413, 0.9391 }, + { -0.3285, -0.0944, 0.9391 }, + { -0.3014, -0.0475, 0.9521 }, + { -0.2575, -0.0321, 0.9657 }, + { -0.0828, -0.0004, 0.9942 }, + { -0.0663, -0.0830, 0.9942 }, + { -0.0990, -0.0988, 0.9902 }, + { -0.0991, -0.0494, 0.9921 }, + { -0.0992, 0.0330, 0.9934 }, + { -0.0823, 0.0995, 0.9898 }, + { -0.0660, 0.1161, 0.9903 }, + { -0.0495, 0.0990, 0.9926 }, + { -0.0495, 0.0990, 0.9926 }, + { -0.0331, 0.0991, 0.9940 }, + { -0.0332, 0.0664, 0.9967 }, + { -0.0333, 0.0334, 0.9989 }, + { -0.0166, 0.0000, 0.9992 }, + { -0.0333, -0.0332, 0.9989 }, + { -0.0333, -0.0332, 0.9989 }, + { -0.0499, -0.0166, 0.9983 }, + { -0.0499, 0.0000, 0.9986 }, + { -0.0665, 0.0000, 0.9978 }, + { -0.0499, -0.0166, 0.9983 }, + { -0.0499, -0.0497, 0.9972 }, + { -0.0660, -0.1160, 0.9898 }, + { -0.0979, -0.1800, 0.9787 }, + { -0.1132, -0.2098, 0.9709 }, + { -0.1607, -0.2084, 0.9646 }, + { -0.1899, -0.2218, 0.9539 }, + { -0.2049, -0.2378, 0.9482 }, + { -0.2344, -0.2210, 0.9436 }, + { -0.2520, -0.1731, 0.9490 }, + { -0.2690, -0.0633, 0.9559 }, + { -0.2678, 0.0000, 0.9575 }, + { -0.2402, -0.0163, 0.9673 }, + { -0.2414, -0.0485, 0.9680 }, + { -0.2392, -0.1271, 0.9594 }, + { -0.2650, -0.2180, 0.9377 }, + { -0.2803, -0.2173, 0.9345 }, + { -0.3121, -0.1564, 0.9366 }, + { -0.3148, -0.0792, 0.9446 }, + { -0.2872, -0.0159, 0.9576 }, + { -0.2576, 0.0000, 0.9662 }, + { -0.1155, 0.0326, 0.9904 }, + { -0.0826, -0.0825, 0.9918 }, + { -0.0494, -0.0988, 0.9921 }, + { -0.0165, -0.0331, 0.9975 }, + { 0.0001, 0.0495, 0.9953 }, + { 0.0165, 0.1162, 0.9917 }, + { 0.0165, 0.1325, 0.9898 }, + { 0.0331, 0.1154, 0.9921 }, + { 0.0331, 0.0991, 0.9940 }, + { 0.0166, 0.0828, 0.9962 }, + { -0.0166, 0.0500, 0.9983 }, + { -0.0166, 0.0334, 0.9992 }, + { -0.0333, 0.0000, 0.9989 }, + { -0.0333, -0.0332, 0.9989 }, + { -0.0333, -0.0332, 0.9989 }, + { -0.0499, -0.0334, 0.9981 }, + { -0.0665, -0.0168, 0.9975 }, + { -0.0665, 0.0166, 0.9975 }, + { -0.0664, 0.0000, 0.9967 }, + { -0.0662, -0.0661, 0.9945 }, + { -0.0820, -0.1482, 0.9842 }, + { -0.1132, -0.2110, 0.9707 }, + { -0.1439, -0.2393, 0.9600 }, + { -0.1887, -0.2668, 0.9445 }, + { -0.2338, -0.2643, 0.9354 }, + { -0.2768, -0.2628, 0.9237 }, + { -0.3200, -0.2448, 0.9146 }, + { -0.3378, -0.1838, 0.9222 }, + { -0.3686, -0.0917, 0.9226 }, + { -0.3709, 0.0154, 0.9274 }, + { -0.3434, 0.0311, 0.9377 }, + { -0.3290, -0.0313, 0.9422 }, + { -0.3118, -0.1392, 0.9363 }, + { -0.3087, -0.2156, 0.9264 }, + { -0.2946, -0.2166, 0.9306 }, + { -0.2969, -0.1720, 0.9381 }, + { -0.3005, -0.0637, 0.9494 }, + { -0.2872, 0.0159, 0.9576 }, + { -0.2575, 0.0321, 0.9657 }, + { -0.1156, 0.0493, 0.9907 }, + { -0.0664, -0.0166, 0.9970 }, + { 0.0333, -0.0332, 0.9983 }, + { 0.1147, 0.0000, 0.9895 }, + { 0.1466, 0.0653, 0.9832 }, + { 0.1460, 0.1148, 0.9791 }, + { 0.1303, 0.1313, 0.9806 }, + { 0.0987, 0.1149, 0.9878 }, + { 0.0828, 0.0825, 0.9929 }, + { 0.0333, 0.0498, 0.9981 }, + { 0.0000, 0.0334, 0.9994 }, + { -0.0167, 0.0168, 0.9994 }, + { -0.0333, -0.0166, 0.9992 }, + { -0.0333, -0.0332, 0.9989 }, + { -0.0499, -0.0497, 0.9972 }, + { -0.0665, -0.0499, 0.9964 }, + { -0.0665, -0.0168, 0.9975 }, + { -0.0831, 0.0000, 0.9964 }, + { -0.1159, -0.0165, 0.9929 }, + { -0.1317, -0.0656, 0.9880 }, + { -0.1300, -0.1629, 0.9753 }, + { -0.1440, -0.2407, 0.9596 }, + { -0.1730, -0.2819, 0.9431 }, + { -0.1872, -0.2956, 0.9362 }, + { -0.2014, -0.3086, 0.9290 }, + { -0.2576, -0.3198, 0.9106 }, + { -0.3037, -0.2744, 0.9114 }, + { -0.3497, -0.2120, 0.9119 }, + { -0.3680, -0.0910, 0.9204 }, + { -0.3712, 0.0308, 0.9275 }, + { -0.3712, 0.0308, 0.9275 }, + { -0.3579, -0.0155, 0.9334 }, + { -0.3414, -0.1076, 0.9306 }, + { -0.3099, -0.2008, 0.9292 }, + { -0.2957, -0.2017, 0.9335 }, + { -0.2838, -0.1578, 0.9453 }, + { -0.2863, -0.0640, 0.9538 }, + { -0.2872, 0.0318, 0.9568 }, + { -0.2721, 0.0638, 0.9600 }, + { -0.1314, 0.0825, 0.9872 }, + { -0.0498, 0.0667, 0.9964 }, + { 0.0497, 0.0827, 0.9951 }, + { 0.1309, 0.0819, 0.9857 }, + { 0.1951, 0.0812, 0.9768 }, + { 0.1788, 0.0982, 0.9778 }, + { 0.1473, 0.0824, 0.9843 }, + { 0.0826, 0.0660, 0.9932 }, + { 0.0331, 0.0331, 0.9961 }, + { 0.0000, 0.0000, 0.9994 }, + { 0.0166, 0.0000, 0.9997 }, + { -0.0167, 0.0000, 0.9997 }, + { -0.0333, -0.0166, 0.9992 }, + { -0.0498, -0.0497, 0.9972 }, + { -0.0664, -0.0662, 0.9956 }, + { -0.0664, -0.0499, 0.9964 }, + { -0.0829, -0.0333, 0.9959 }, + { -0.1157, -0.0330, 0.9926 }, + { -0.1480, -0.0492, 0.9875 }, + { -0.1638, -0.0817, 0.9830 }, + { -0.1775, -0.1618, 0.9684 }, + { -0.1742, -0.2541, 0.9508 }, + { -0.1729, -0.2823, 0.9435 }, + { -0.1415, -0.2980, 0.9438 }, + { -0.1544, -0.3388, 0.9272 }, + { -0.1672, -0.3670, 0.9139 }, + { -0.2127, -0.3366, 0.9148 }, + { -0.2461, -0.2467, 0.9310 }, + { -0.2832, -0.1096, 0.9476 }, + { -0.3141, 0.0157, 0.9462 }, + { -0.3141, 0.0474, 0.9462 }, + { -0.3156, 0.0002, 0.9479 }, + { -0.3138, -0.0936, 0.9423 }, + { -0.2826, -0.1724, 0.9430 }, + { -0.2822, -0.1877, 0.9408 }, + { -0.2689, -0.1585, 0.9494 }, + { -0.2562, -0.0645, 0.9618 }, + { -0.2722, 0.0319, 0.9611 }, + { -0.2719, 0.0638, 0.9601 }, + { -0.1471, 0.1149, 0.9810 }, + { -0.0980, 0.1642, 0.9810 }, + { -0.0165, 0.1477, 0.9875 }, + { 0.0329, 0.1477, 0.9878 }, + { 0.0815, 0.1144, 0.9855 }, + { 0.0825, 0.0665, 0.9931 }, + { 0.0496, 0.0335, 0.9964 }, + { 0.0166, 0.0000, 0.9997 }, + { -0.0166, 0.0000, 0.9997 }, + { -0.0166, 0.0332, 0.9986 }, + { 0.0000, 0.0163, 0.9981 }, + { -0.0167, -0.0334, 0.9992 }, + { -0.0499, -0.0497, 0.9972 }, + { -0.0664, -0.0662, 0.9956 }, + { -0.0664, -0.0662, 0.9956 }, + { -0.0664, -0.0666, 0.9956 }, + { -0.0993, -0.0665, 0.9928 }, + { -0.1156, -0.0659, 0.9910 }, + { -0.1479, -0.0656, 0.9867 }, + { -0.1635, -0.0978, 0.9812 }, + { -0.1771, -0.1778, 0.9666 }, + { -0.1593, -0.2400, 0.9570 }, + { -0.1434, -0.2544, 0.9563 }, + { -0.1266, -0.2840, 0.9500 }, + { -0.1088, -0.3409, 0.9332 }, + { -0.0917, -0.3840, 0.9181 }, + { -0.0767, -0.3562, 0.9270 }, + { -0.0787, -0.2845, 0.9517 }, + { -0.1116, -0.1597, 0.9697 }, + { -0.1451, 0.0000, 0.9808 }, + { -0.1946, 0.0325, 0.9777 }, + { -0.2416, -0.0161, 0.9690 }, + { -0.2713, -0.0794, 0.9579 }, + { -0.2681, -0.1727, 0.9465 }, + { -0.2675, -0.1882, 0.9444 }, + { -0.2403, -0.1284, 0.9616 }, + { -0.2418, -0.0649, 0.9675 }, + { -0.2573, 0.0160, 0.9650 }, + { -0.2721, 0.0479, 0.9608 }, + { -0.0986, 0.1156, 0.9866 }, + { -0.0811, 0.1955, 0.9756 }, + { -0.0488, 0.2109, 0.9760 }, + { 0.0000, 0.1798, 0.9836 }, + { 0.0165, 0.1316, 0.9905 }, + { 0.0332, 0.0664, 0.9967 }, + { 0.0000, 0.0168, 0.9997 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0166, 0.9997 }, + { -0.0499, -0.0002, 0.9981 }, + { -0.0498, -0.0499, 0.9972 }, + { -0.0498, -0.0663, 0.9964 }, + { -0.0498, -0.0663, 0.9964 }, + { -0.0664, -0.0662, 0.9956 }, + { -0.0663, -0.0833, 0.9942 }, + { -0.0662, -0.0832, 0.9936 }, + { -0.0827, -0.0825, 0.9929 }, + { -0.0989, -0.0987, 0.9896 }, + { -0.1311, -0.1145, 0.9841 }, + { -0.1301, -0.1635, 0.9768 }, + { -0.1128, -0.2261, 0.9670 }, + { -0.1120, -0.2554, 0.9602 }, + { -0.1115, -0.2701, 0.9561 }, + { -0.0944, -0.3137, 0.9444 }, + { -0.0469, -0.3450, 0.9373 }, + { 0.0157, -0.3314, 0.9431 }, + { 0.0318, -0.2860, 0.9567 }, + { 0.0326, -0.1780, 0.9797 }, + { -0.0166, -0.0662, 0.9970 }, + { -0.1157, -0.0499, 0.9918 }, + { -0.1954, -0.0816, 0.9772 }, + { -0.2554, -0.1273, 0.9579 }, + { -0.2683, -0.1732, 0.9474 }, + { -0.2392, -0.1590, 0.9572 }, + { -0.2253, -0.1293, 0.9657 }, + { -0.2413, -0.0809, 0.9657 }, + { -0.2423, 0.0000, 0.9695 }, + { -0.2723, 0.0320, 0.9615 }, + { 0.0001, 0.1319, 0.9868 }, + { 0.0163, 0.2121, 0.9758 }, + { 0.0162, 0.2264, 0.9727 }, + { 0.0325, 0.2109, 0.9763 }, + { 0.0656, 0.1470, 0.9852 }, + { 0.0166, 0.0496, 0.9973 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { -0.0167, -0.0166, 0.9994 }, + { -0.0499, -0.0334, 0.9981 }, + { -0.0499, -0.0334, 0.9981 }, + { -0.0333, -0.0498, 0.9981 }, + { -0.0332, -0.0828, 0.9959 }, + { -0.0497, -0.0827, 0.9951 }, + { -0.0498, -0.0667, 0.9964 }, + { -0.0332, -0.0832, 0.9959 }, + { -0.0497, -0.0991, 0.9937 }, + { -0.0496, -0.1154, 0.9918 }, + { -0.0658, -0.1315, 0.9886 }, + { -0.0818, -0.1644, 0.9823 }, + { -0.0969, -0.2265, 0.9687 }, + { -0.1120, -0.2554, 0.9602 }, + { -0.1115, -0.2701, 0.9561 }, + { -0.1110, -0.2849, 0.9520 }, + { -0.0793, -0.2872, 0.9534 }, + { -0.0629, -0.2865, 0.9513 }, + { -0.0472, -0.2699, 0.9552 }, + { -0.0634, -0.2083, 0.9663 }, + { -0.0971, -0.1465, 0.9795 }, + { -0.1616, -0.1467, 0.9736 }, + { -0.1935, -0.1619, 0.9676 }, + { -0.2239, -0.1597, 0.9609 }, + { -0.2239, -0.1597, 0.9609 }, + { -0.2094, -0.1446, 0.9668 }, + { -0.2253, -0.1293, 0.9657 }, + { -0.2107, -0.0815, 0.9728 }, + { -0.2271, -0.0162, 0.9736 }, + { -0.2424, 0.0000, 0.9701 }, + { 0.0982, 0.1479, 0.9823 }, + { 0.0972, 0.2113, 0.9719 }, + { 0.0969, 0.2255, 0.9689 }, + { 0.0969, 0.2255, 0.9689 }, + { 0.0491, 0.1131, 0.9846 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, -0.0166, 0.9997 }, + { -0.0333, -0.0332, 0.9989 }, + { -0.0333, -0.0334, 0.9989 }, + { -0.0499, -0.0334, 0.9981 }, + { -0.0499, -0.0497, 0.9972 }, + { -0.0498, -0.0827, 0.9951 }, + { -0.0332, -0.0828, 0.9959 }, + { -0.0333, -0.0667, 0.9972 }, + { -0.0332, -0.0832, 0.9959 }, + { -0.0332, -0.0992, 0.9945 }, + { -0.0496, -0.1154, 0.9918 }, + { -0.0494, -0.1477, 0.9875 }, + { -0.0652, -0.1963, 0.9778 }, + { -0.0962, -0.2569, 0.9612 }, + { -0.1116, -0.2701, 0.9561 }, + { -0.1273, -0.2696, 0.9544 }, + { -0.1268, -0.2843, 0.9503 }, + { -0.1567, -0.2991, 0.9406 }, + { -0.1871, -0.2975, 0.9356 }, + { -0.2027, -0.2804, 0.9371 }, + { -0.2211, -0.2197, 0.9477 }, + { -0.2241, -0.1597, 0.9609 }, + { -0.2095, -0.1454, 0.9667 }, + { -0.1784, -0.1464, 0.9728 }, + { -0.1621, -0.1617, 0.9729 }, + { -0.1621, -0.1617, 0.9729 }, + { -0.1780, -0.1613, 0.9706 }, + { -0.2099, -0.1293, 0.9685 }, + { -0.2111, -0.0816, 0.9738 }, + { -0.2271, -0.0323, 0.9728 }, + { -0.2274, 0.0000, 0.9738 }, + { 0.1775, 0.1462, 0.9708 }, + { 0.1604, 0.2095, 0.9639 }, + { 0.1445, 0.2243, 0.9636 }, + { 0.1141, 0.1619, 0.9780 }, + { 0.0000, 0.0496, 0.9975 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, -0.0332, 0.9989 }, + { -0.0166, -0.0498, 0.9983 }, + { -0.0333, -0.0502, 0.9980 }, + { -0.0499, -0.0502, 0.9972 }, + { -0.0664, -0.0497, 0.9964 }, + { -0.0664, -0.0662, 0.9956 }, + { -0.0332, -0.0663, 0.9972 }, + { -0.0332, -0.0667, 0.9972 }, + { -0.0332, -0.0832, 0.9959 }, + { -0.0331, -0.1155, 0.9926 }, + { -0.0495, -0.1316, 0.9899 }, + { -0.0658, -0.1476, 0.9867 }, + { -0.0649, -0.2116, 0.9740 }, + { -0.0799, -0.2725, 0.9586 }, + { -0.0954, -0.2854, 0.9537 }, + { -0.1110, -0.2849, 0.9520 }, + { -0.1255, -0.3126, 0.9411 }, + { -0.1695, -0.3404, 0.9247 }, + { -0.2002, -0.3247, 0.9241 }, + { -0.2318, -0.2928, 0.9274 }, + { -0.2361, -0.2190, 0.9446 }, + { -0.2249, -0.1282, 0.9649 }, + { -0.1633, -0.0985, 0.9811 }, + { -0.1311, -0.1151, 0.9840 }, + { -0.0983, -0.1471, 0.9836 }, + { -0.1140, -0.1786, 0.9770 }, + { -0.1613, -0.1931, 0.9678 }, + { -0.1934, -0.1615, 0.9672 }, + { -0.2411, -0.0970, 0.9650 }, + { -0.2421, -0.0322, 0.9690 }, + { -0.2424, 0.0000, 0.9701 }, + { 0.2406, 0.1128, 0.9627 }, + { 0.1930, 0.1775, 0.9649 }, + { 0.1617, 0.1774, 0.9706 }, + { 0.0494, 0.0818, 0.9908 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, -0.0332, 0.9989 }, + { 0.0000, -0.0663, 0.9978 }, + { -0.0332, -0.0667, 0.9972 }, + { -0.0498, -0.0667, 0.9964 }, + { -0.0664, -0.0662, 0.9956 }, + { -0.0664, -0.0497, 0.9964 }, + { -0.0499, -0.0497, 0.9972 }, + { -0.0332, -0.0667, 0.9972 }, + { -0.0332, -0.0832, 0.9959 }, + { -0.0331, -0.1155, 0.9926 }, + { -0.0494, -0.1477, 0.9875 }, + { -0.0492, -0.1638, 0.9851 }, + { -0.0649, -0.2116, 0.9740 }, + { -0.0795, -0.2869, 0.9541 }, + { -0.0949, -0.2997, 0.9492 }, + { -0.1105, -0.2992, 0.9475 }, + { -0.1394, -0.3396, 0.9296 }, + { -0.1676, -0.3673, 0.9147 }, + { -0.1834, -0.3530, 0.9173 }, + { -0.2161, -0.3076, 0.9262 }, + { -0.2217, -0.2041, 0.9504 }, + { -0.2107, -0.0807, 0.9729 }, + { -0.1639, -0.0495, 0.9846 }, + { -0.1315, -0.0825, 0.9872 }, + { -0.1141, -0.1463, 0.9802 }, + { -0.1440, -0.2237, 0.9623 }, + { -0.1902, -0.2373, 0.9520 }, + { -0.2219, -0.2070, 0.9522 }, + { -0.2550, -0.1279, 0.9563 }, + { -0.2574, -0.0321, 0.9653 }, + { -0.2576, 0.0161, 0.9660 }, + { 0.2100, 0.0975, 0.9716 }, + { 0.1786, 0.1301, 0.9746 }, + { 0.0817, 0.0814, 0.9866 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, -0.0332, 0.9989 }, + { 0.0331, -0.0827, 0.9953 }, + { -0.0331, -0.0998, 0.9945 }, + { -0.0497, -0.0833, 0.9950 }, + { -0.0664, -0.0662, 0.9956 }, + { -0.0664, -0.0497, 0.9964 }, + { -0.0665, -0.0332, 0.9972 }, + { -0.0498, -0.0502, 0.9972 }, + { -0.0497, -0.0831, 0.9950 }, + { -0.0494, -0.1314, 0.9894 }, + { -0.0658, -0.1476, 0.9867 }, + { -0.0654, -0.1633, 0.9833 }, + { -0.0804, -0.2421, 0.9656 }, + { -0.0949, -0.3014, 0.9487 }, + { -0.1100, -0.3135, 0.9431 }, + { -0.1401, -0.3262, 0.9346 }, + { -0.1677, -0.3648, 0.9153 }, + { -0.1814, -0.3793, 0.9072 }, + { -0.1970, -0.3653, 0.9097 }, + { -0.2002, -0.3219, 0.9242 }, + { -0.2065, -0.2048, 0.9535 }, + { -0.1950, -0.0646, 0.9760 }, + { -0.1802, -0.0166, 0.9832 }, + { -0.1639, -0.0656, 0.9838 }, + { -0.1619, -0.1608, 0.9715 }, + { -0.1897, -0.2520, 0.9485 }, + { -0.2190, -0.2653, 0.9389 }, + { -0.2657, -0.2194, 0.9382 }, + { -0.2840, -0.1268, 0.9478 }, + { -0.2866, -0.0318, 0.9565 }, + { -0.2576, 0.0161, 0.9660 }, + { 0.1313, 0.0990, 0.9859 }, + { 0.1151, 0.0499, 0.9896 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { -0.0326, -0.0973, 0.9850 }, + { -0.0493, -0.1479, 0.9865 }, + { -0.0497, -0.0998, 0.9936 }, + { -0.0663, -0.0826, 0.9942 }, + { -0.0664, -0.0497, 0.9964 }, + { -0.0665, -0.0332, 0.9972 }, + { -0.0829, -0.0500, 0.9950 }, + { -0.0827, -0.0829, 0.9928 }, + { -0.0984, -0.1309, 0.9854 }, + { -0.0980, -0.1631, 0.9812 }, + { -0.1298, -0.1782, 0.9747 }, + { -0.1433, -0.2401, 0.9577 }, + { -0.1404, -0.3133, 0.9377 }, + { -0.1692, -0.3382, 0.9246 }, + { -0.1977, -0.3496, 0.9146 }, + { -0.2103, -0.3749, 0.9023 }, + { -0.1948, -0.3912, 0.8993 }, + { -0.1969, -0.3650, 0.9093 }, + { -0.1712, -0.3104, 0.9345 }, + { -0.1761, -0.1900, 0.9611 }, + { -0.1479, -0.0491, 0.9864 }, + { -0.1319, -0.0167, 0.9904 }, + { -0.1151, -0.0659, 0.9894 }, + { -0.1132, -0.1768, 0.9733 }, + { -0.1417, -0.2831, 0.9469 }, + { -0.2013, -0.3090, 0.9294 }, + { -0.2479, -0.2639, 0.9307 }, + { -0.2978, -0.1413, 0.9407 }, + { -0.2863, 0.0000, 0.9555 }, + { -0.2571, 0.0641, 0.9643 }, + { 0.0329, 0.0992, 0.9918 }, + { 0.0332, 0.0004, 0.9967 }, + { 0.0000, -0.0332, 0.9989 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, -0.0659, 0.9956 }, + { -0.1149, -0.1309, 0.9846 }, + { -0.0661, -0.1159, 0.9909 }, + { -0.0827, -0.0995, 0.9915 }, + { -0.0828, -0.0825, 0.9929 }, + { -0.0830, -0.0496, 0.9950 }, + { -0.0830, -0.0496, 0.9950 }, + { -0.0993, -0.0665, 0.9928 }, + { -0.1153, -0.0988, 0.9877 }, + { -0.1468, -0.1463, 0.9780 }, + { -0.1616, -0.1773, 0.9701 }, + { -0.1917, -0.2071, 0.9587 }, + { -0.2196, -0.2520, 0.9414 }, + { -0.2289, -0.3213, 0.9169 }, + { -0.2539, -0.3581, 0.8975 }, + { -0.2682, -0.3568, 0.8944 }, + { -0.2682, -0.3568, 0.8944 }, + { -0.2401, -0.3616, 0.9004 }, + { -0.1992, -0.3382, 0.9191 }, + { -0.1722, -0.2965, 0.9391 }, + { -0.1610, -0.1743, 0.9651 }, + { -0.1482, -0.0164, 0.9875 }, + { -0.1320, 0.0165, 0.9904 }, + { -0.1311, -0.0491, 0.9868 }, + { -0.1284, -0.1910, 0.9664 }, + { -0.1390, -0.3380, 0.9279 }, + { -0.1827, -0.3639, 0.9129 }, + { -0.2013, -0.3103, 0.9286 }, + { -0.2369, -0.1570, 0.9493 }, + { -0.2267, 0.0161, 0.9721 }, + { -0.1944, 0.0810, 0.9754 }, + { -0.0331, 0.0998, 0.9945 }, + { -0.0166, 0.0171, 0.9961 }, + { 0.0000, -0.0332, 0.9989 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { -0.1121, -0.1119, 0.9744 }, + { -0.0980, -0.1622, 0.9798 }, + { -0.0824, -0.1160, 0.9895 }, + { -0.0824, -0.1160, 0.9895 }, + { -0.0991, -0.0824, 0.9915 }, + { -0.0994, -0.0495, 0.9937 }, + { -0.1156, -0.0494, 0.9918 }, + { -0.1314, -0.0827, 0.9872 }, + { -0.1469, -0.1308, 0.9798 }, + { -0.1774, -0.1769, 0.9679 }, + { -0.2070, -0.2065, 0.9560 }, + { -0.2356, -0.2350, 0.9428 }, + { -0.2472, -0.2792, 0.9273 }, + { -0.2694, -0.3448, 0.8983 }, + { -0.2805, -0.3682, 0.8862 }, + { -0.2821, -0.3555, 0.8910 }, + { -0.2835, -0.3423, 0.8956 }, + { -0.2723, -0.3188, 0.9078 }, + { -0.2459, -0.2935, 0.9232 }, + { -0.2187, -0.2651, 0.9385 }, + { -0.1924, -0.1586, 0.9632 }, + { -0.2107, -0.0162, 0.9751 }, + { -0.2109, -0.0002, 0.9758 }, + { -0.2262, -0.0647, 0.9709 }, + { -0.2218, -0.1881, 0.9517 }, + { -0.2135, -0.3337, 0.9159 }, + { -0.1826, -0.3639, 0.9129 }, + { -0.1712, -0.3121, 0.9340 }, + { -0.1607, -0.1596, 0.9650 }, + { -0.1472, 0.0487, 0.9833 }, + { -0.1313, 0.1145, 0.9846 }, + { 0.0000, 0.0668, 0.9966 }, + { -0.0332, 0.0336, 0.9966 }, + { 0.0000, -0.0166, 0.9997 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, -0.1133, 0.9870 }, + { -0.1770, -0.1602, 0.9678 }, + { -0.1153, -0.0986, 0.9883 }, + { -0.0990, -0.0994, 0.9901 }, + { -0.0824, -0.1158, 0.9896 }, + { -0.0825, -0.0987, 0.9910 }, + { -0.0993, -0.0660, 0.9929 }, + { -0.1317, -0.0821, 0.9878 }, + { -0.1636, -0.0985, 0.9816 }, + { -0.1781, -0.1457, 0.9719 }, + { -0.1918, -0.2072, 0.9592 }, + { -0.2056, -0.2367, 0.9493 }, + { -0.2042, -0.2513, 0.9450 }, + { -0.2013, -0.2958, 0.9315 }, + { -0.2252, -0.3622, 0.9031 }, + { -0.2242, -0.3735, 0.8990 }, + { -0.2255, -0.3607, 0.9040 }, + { -0.2413, -0.3463, 0.9060 }, + { -0.2581, -0.3201, 0.9114 }, + { -0.2759, -0.2770, 0.9199 }, + { -0.2928, -0.2310, 0.9267 }, + { -0.2951, -0.1553, 0.9378 }, + { -0.3002, -0.0315, 0.9502 }, + { -0.3008, -0.0002, 0.9521 }, + { -0.2862, -0.0636, 0.9550 }, + { -0.2665, -0.1861, 0.9411 }, + { -0.2306, -0.3065, 0.9229 }, + { -0.1855, -0.3238, 0.9277 }, + { -0.1575, -0.2843, 0.9453 }, + { -0.1299, -0.1290, 0.9744 }, + { -0.1155, 0.0493, 0.9907 }, + { -0.1476, 0.0981, 0.9840 }, + { 0.0663, -0.0163, 0.9959 }, + { 0.0166, 0.0168, 0.9983 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { -0.1536, -0.1678, 0.9461 }, + { -0.1121, -0.2200, 0.9609 }, + { -0.1317, -0.0821, 0.9878 }, + { -0.1314, -0.0827, 0.9872 }, + { -0.1313, -0.0990, 0.9859 }, + { -0.1306, -0.0982, 0.9844 }, + { -0.1470, -0.0981, 0.9831 }, + { -0.1785, -0.1135, 0.9761 }, + { -0.1787, -0.1305, 0.9751 }, + { -0.2088, -0.1609, 0.9640 }, + { -0.1918, -0.2072, 0.9592 }, + { -0.1600, -0.2236, 0.9609 }, + { -0.1121, -0.2401, 0.9629 }, + { -0.1094, -0.3137, 0.9400 }, + { -0.1061, -0.3824, 0.9146 }, + { -0.1062, -0.3804, 0.9155 }, + { -0.1215, -0.3801, 0.9148 }, + { -0.1513, -0.3785, 0.9110 }, + { -0.1825, -0.3523, 0.9159 }, + { -0.2288, -0.3223, 0.9173 }, + { -0.3037, -0.2726, 0.9120 }, + { -0.3383, -0.1522, 0.9237 }, + { -0.3438, -0.0156, 0.9378 }, + { -0.3301, 0.0157, 0.9436 }, + { -0.3159, -0.0315, 0.9478 }, + { -0.2836, -0.1406, 0.9454 }, + { -0.2336, -0.2636, 0.9347 }, + { -0.2022, -0.2948, 0.9337 }, + { -0.1742, -0.2541, 0.9508 }, + { -0.1463, -0.1135, 0.9759 }, + { -0.1639, 0.0327, 0.9849 }, + { -0.1796, 0.0814, 0.9801 }, + { 0.1316, -0.0492, 0.9883 }, + { 0.0829, -0.0331, 0.9953 }, + { 0.0822, -0.0329, 0.9921 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { 0.0000, 0.0000, 1.0000 }, + { -0.0957, -0.1564, 0.9654 }, + { -0.1537, -0.2183, 0.9466 }, + { -0.0658, -0.1315, 0.9886 }, + { -0.0986, -0.1149, 0.9878 }, + { -0.1636, -0.0985, 0.9816 }, + { -0.1945, -0.1139, 0.9736 }, + { -0.2402, -0.1120, 0.9630 }, + { -0.2546, -0.1115, 0.9585 }, + { -0.2556, -0.1116, 0.9597 }, + { -0.2539, -0.1281, 0.9562 }, + { -0.2540, -0.1595, 0.9535 }, + { -0.1935, -0.1609, 0.9678 }, + { -0.1304, -0.1626, 0.9780 }, + { -0.0649, -0.2101, 0.9744 }, + { -0.0158, -0.3019, 0.9509 }, + { 0.0154, -0.3716, 0.9267 }, + { 0.0153, -0.3963, 0.9169 }, + { 0.0000, -0.4086, 0.9106 }, + { 0.0001, -0.4077, 0.9085 }, + { -0.0453, -0.3974, 0.9134 }, + { -0.0901, -0.3957, 0.9095 }, + { -0.1509, -0.3353, 0.9202 }, + { -0.2192, -0.1875, 0.9485 }, + { -0.2373, -0.0159, 0.9619 }, + { -0.2558, 0.0320, 0.9637 }, + { -0.2560, -0.0160, 0.9644 }, + { -0.2548, -0.1106, 0.9569 }, + { -0.2354, -0.2344, 0.9420 }, + { -0.2190, -0.2653, 0.9389 }, + { -0.1910, -0.2234, 0.9554 }, + { -0.1939, -0.1134, 0.9705 }, + { -0.2114, 0.0162, 0.9759 }, + { -0.2264, 0.0646, 0.9714 }, + { 0.1316, -0.0825, 0.9872 }, + { 0.1158, -0.0334, 0.9920 }, + { 0.1312, -0.0812, 0.9841 }, + { 0.0975, -0.0812, 0.9837 }, + { 0.0661, 0.0000, 0.9956 }, + { 0.0165, -0.0990, 0.9898 }, + { -0.0640, -0.1632, 0.9753 }, + { 0.0165, -0.1479, 0.9886 }, + { 0.0000, -0.1639, 0.9859 }, + { -0.0327, -0.1796, 0.9825 }, + { -0.1137, -0.1795, 0.9759 }, + { -0.1769, -0.1778, 0.9667 }, + { -0.2387, -0.1588, 0.9564 }, + { -0.2702, -0.1111, 0.9551 }, + { -0.2857, -0.1107, 0.9518 }, + { -0.3139, -0.1260, 0.9411 }, + { -0.3004, -0.0953, 0.9484 }, + { -0.2411, -0.0803, 0.9659 }, + { -0.1635, -0.0979, 0.9812 }, + { -0.0823, -0.1312, 0.9873 }, + { 0.0161, -0.2415, 0.9668 }, + { 0.0466, -0.3575, 0.9317 }, + { 0.0763, -0.3955, 0.9152 }, + { 0.0913, -0.3949, 0.9137 }, + { 0.1199, -0.4183, 0.8995 }, + { 0.1036, -0.4329, 0.8924 }, + { 0.0747, -0.4219, 0.9005 }, + { 0.0603, -0.3939, 0.9122 }, + { 0.0000, -0.2331, 0.9541 }, + { -0.0328, -0.0494, 0.9921 }, + { -0.0981, 0.0000, 0.9903 }, + { -0.1313, -0.0328, 0.9881 }, + { -0.1779, -0.1288, 0.9723 }, + { -0.1902, -0.2366, 0.9512 }, + { -0.2049, -0.2512, 0.9454 }, + { -0.2214, -0.2223, 0.9490 }, + { -0.2395, -0.1276, 0.9575 }, + { -0.2718, 0.0000, 0.9607 }, + { -0.2870, 0.0318, 0.9569 }, + { 0.0988, -0.0661, 0.9921 }, + { 0.0994, -0.0333, 0.9939 }, + { 0.0911, -0.0496, 0.9944 }, + { 0.1475, -0.0655, 0.9857 }, + { 0.1072, -0.0823, 0.9903 }, + { 0.0653, -0.1322, 0.9877 }, + { 0.0985, -0.1641, 0.9810 }, + { 0.0816, -0.1632, 0.9820 }, + { 0.0572, -0.1794, 0.9816 }, + { 0.0322, -0.2260, 0.9723 }, + { -0.0090, -0.2429, 0.9683 }, + { -0.0554, -0.2422, 0.9657 }, + { -0.1204, -0.2084, 0.9662 }, + { -0.1933, -0.1608, 0.9674 }, + { -0.2691, -0.1579, 0.9500 }, + { -0.3063, -0.1416, 0.9411 }, + { -0.3069, -0.0797, 0.9466 }, + { -0.2798, -0.0160, 0.9597 }, + { -0.2417, 0.0000, 0.9692 }, + { -0.1929, -0.0325, 0.9752 }, + { -0.1321, -0.1761, 0.9566 }, + { -0.0613, -0.3148, 0.9419 }, + { 0.0077, -0.3557, 0.9305 }, + { 0.0615, -0.3692, 0.9253 }, + { 0.0907, -0.3938, 0.9120 }, + { 0.1393, -0.4319, 0.8901 }, + { 0.1710, -0.4299, 0.8860 }, + { 0.2001, -0.4005, 0.8926 }, + { 0.2097, -0.2705, 0.9252 }, + { 0.1062, -0.1142, 0.9852 }, + { -0.0168, -0.0668, 0.9975 }, + { -0.0985, -0.0990, 0.9889 }, + { -0.1688, -0.1767, 0.9671 }, + { -0.1958, -0.2657, 0.9415 }, + { -0.2095, -0.2943, 0.9320 }, + { -0.2501, -0.2499, 0.9347 }, + { -0.2527, -0.1594, 0.9511 }, + { -0.3003, -0.0320, 0.9501 }, + { -0.3434, -0.0002, 0.9380 }, + { 0.0331, -0.0334, 0.9983 }, + { 0.0332, -0.0332, 0.9983 }, + { 0.0414, -0.0497, 0.9968 }, + { 0.0743, -0.0825, 0.9928 }, + { 0.0909, -0.1158, 0.9886 }, + { 0.1221, -0.1476, 0.9813 }, + { 0.1620, -0.1617, 0.9729 }, + { 0.2068, -0.1908, 0.9577 }, + { 0.1823, -0.2376, 0.9531 }, + { 0.1357, -0.2709, 0.9525 }, + { 0.1027, -0.2720, 0.9563 }, + { 0.0560, -0.2714, 0.9606 }, + { -0.0001, -0.2566, 0.9658 }, + { -0.1045, -0.2405, 0.9645 }, + { -0.1904, -0.2234, 0.9552 }, + { -0.3126, -0.1261, 0.9383 }, + { -0.3562, -0.0007, 0.9314 }, + { -0.3690, 0.0306, 0.9264 }, + { -0.3598, -0.0155, 0.9280 }, + { -0.3370, -0.1083, 0.9200 }, + { -0.3128, -0.2418, 0.9067 }, + { -0.2683, -0.3017, 0.9074 }, + { -0.2271, -0.3055, 0.9188 }, + { -0.1652, -0.3350, 0.9169 }, + { -0.0818, -0.3826, 0.9146 }, + { -0.0090, -0.3853, 0.9210 }, + { 0.0851, -0.3556, 0.9303 }, + { 0.1563, -0.2810, 0.9435 }, + { 0.1760, -0.1919, 0.9636 }, + { 0.1210, -0.1789, 0.9721 }, + { 0.0155, -0.1962, 0.9771 }, + { -0.0720, -0.2394, 0.9625 }, + { -0.1398, -0.3110, 0.9362 }, + { -0.1843, -0.3374, 0.9226 }, + { -0.2234, -0.2943, 0.9277 }, + { -0.2956, -0.1877, 0.9334 }, + { -0.3137, -0.0632, 0.9439 }, + { -0.3089, -0.0158, 0.9507 }, + { -0.3368, -0.0469, 0.9402 }, + { -0.0166, -0.0334, 0.9992 }, + { -0.0166, -0.0332, 0.9992 }, + { -0.0166, -0.0332, 0.9992 }, + { -0.0165, -0.0497, 0.9972 }, + { 0.0332, -0.0667, 0.9967 }, + { 0.0825, -0.0828, 0.9918 }, + { 0.1634, -0.0979, 0.9812 }, + { 0.2072, -0.1741, 0.9583 }, + { 0.1878, -0.2810, 0.9401 }, + { 0.1408, -0.3142, 0.9387 }, + { 0.1099, -0.3154, 0.9424 }, + { 0.0471, -0.3291, 0.9429 }, + { -0.0156, -0.3434, 0.9389 }, + { -0.1094, -0.3275, 0.9383 }, + { -0.1863, -0.3118, 0.9317 }, + { -0.2794, -0.2010, 0.9322 }, + { -0.3434, -0.0622, 0.9366 }, + { -0.4100, -0.0303, 0.9115 }, + { -0.4467, -0.0445, 0.8935 }, + { -0.4787, -0.1021, 0.8708 }, + { -0.4502, -0.1890, 0.8716 }, + { -0.3862, -0.2371, 0.8914 }, + { -0.3190, -0.2576, 0.9118 }, + { -0.2622, -0.2621, 0.9275 }, + { -0.1888, -0.2687, 0.9444 }, + { -0.1111, -0.2716, 0.9547 }, + { -0.0474, -0.2401, 0.9630 }, + { 0.0001, -0.2520, 0.9485 }, + { -0.0154, -0.2690, 0.9522 }, + { -0.0783, -0.2711, 0.9528 }, + { -0.1408, -0.2846, 0.9450 }, + { -0.1861, -0.3094, 0.9316 }, + { -0.2140, -0.3355, 0.9174 }, + { -0.1993, -0.3365, 0.9202 }, + { -0.2002, -0.3246, 0.9242 }, + { -0.2194, -0.2197, 0.9439 }, + { -0.2562, -0.0797, 0.9616 }, + { -0.3014, -0.0475, 0.9521 }, + { -0.3435, -0.0623, 0.9371 }, +}; + +static float texcoord[][2] = { +#ifdef _ORIGINAL_ /* [ */ + { 0.1121, 0.0171 }, + { 0.1094, 0.0411 }, + { 0.1066, 0.0654 }, + { 0.1038, 0.0898 }, + { 0.1010, 0.1141 }, + { 0.0982, 0.1384 }, + { 0.0954, 0.1624 }, + { 0.0926, 0.1868 }, + { 0.0898, 0.2111 }, + { 0.0870, 0.2354 }, + { 0.0842, 0.2598 }, + { 0.0815, 0.2838 }, + { 0.0787, 0.3081 }, + { 0.0759, 0.3325 }, + { 0.0731, 0.3568 }, + { 0.0703, 0.3811 }, + { 0.0675, 0.4052 }, + { 0.0647, 0.4295 }, + { 0.0619, 0.4538 }, + { 0.0591, 0.4782 }, + { 0.0564, 0.5025 }, + { 0.0536, 0.5265 }, + { 0.0508, 0.5508 }, + { 0.0480, 0.5752 }, + { 0.0452, 0.5995 }, + { 0.0424, 0.6239 }, + { 0.0397, 0.6479 }, + { 0.0369, 0.6722 }, + { 0.0341, 0.6965 }, + { 0.0313, 0.7209 }, + { 0.0285, 0.7452 }, + { 0.0257, 0.7692 }, + { 0.0229, 0.7936 }, + { 0.0201, 0.8179 }, + { 0.0173, 0.8422 }, + { 0.0145, 0.8666 }, + { 0.0118, 0.8906 }, + { 0.0090, 0.9149 }, + { 0.0062, 0.9393 }, + { 0.1364, 0.0199 }, + { 0.1336, 0.0439 }, + { 0.1309, 0.0682 }, + { 0.1281, 0.0925 }, + { 0.1253, 0.1169 }, + { 0.1225, 0.1412 }, + { 0.1197, 0.1652 }, + { 0.1169, 0.1896 }, + { 0.1141, 0.2139 }, + { 0.1113, 0.2382 }, + { 0.1085, 0.2626 }, + { 0.1058, 0.2866 }, + { 0.1030, 0.3109 }, + { 0.1002, 0.3353 }, + { 0.0974, 0.3596 }, + { 0.0946, 0.3839 }, + { 0.0918, 0.4079 }, + { 0.0890, 0.4323 }, + { 0.0862, 0.4566 }, + { 0.0834, 0.4810 }, + { 0.0806, 0.5053 }, + { 0.0779, 0.5293 }, + { 0.0751, 0.5536 }, + { 0.0723, 0.5780 }, + { 0.0695, 0.6023 }, + { 0.0667, 0.6266 }, + { 0.0640, 0.6507 }, + { 0.0612, 0.6750 }, + { 0.0584, 0.6993 }, + { 0.0556, 0.7237 }, + { 0.0528, 0.7480 }, + { 0.0500, 0.7720 }, + { 0.0472, 0.7964 }, + { 0.0444, 0.8207 }, + { 0.0416, 0.8450 }, + { 0.0388, 0.8694 }, + { 0.0361, 0.8934 }, + { 0.0333, 0.9177 }, + { 0.0305, 0.9420 }, + { 0.1607, 0.0226 }, + { 0.1579, 0.0467 }, + { 0.1551, 0.0710 }, + { 0.1523, 0.0953 }, + { 0.1495, 0.1197 }, + { 0.1467, 0.1440 }, + { 0.1440, 0.1680 }, + { 0.1412, 0.1924 }, + { 0.1384, 0.2167 }, + { 0.1356, 0.2410 }, + { 0.1328, 0.2654 }, + { 0.1300, 0.2894 }, + { 0.1272, 0.3137 }, + { 0.1244, 0.3380 }, + { 0.1216, 0.3624 }, + { 0.1188, 0.3867 }, + { 0.1161, 0.4107 }, + { 0.1133, 0.4351 }, + { 0.1105, 0.4594 }, + { 0.1077, 0.4837 }, + { 0.1049, 0.5081 }, + { 0.1021, 0.5321 }, + { 0.0994, 0.5564 }, + { 0.0966, 0.5808 }, + { 0.0938, 0.6051 }, + { 0.0910, 0.6294 }, + { 0.0882, 0.6534 }, + { 0.0854, 0.6778 }, + { 0.0826, 0.7021 }, + { 0.0798, 0.7265 }, + { 0.0770, 0.7508 }, + { 0.0743, 0.7748 }, + { 0.0715, 0.7991 }, + { 0.0687, 0.8235 }, + { 0.0659, 0.8478 }, + { 0.0631, 0.8721 }, + { 0.0603, 0.8962 }, + { 0.0575, 0.9205 }, + { 0.0547, 0.9448 }, + { 0.1850, 0.0254 }, + { 0.1822, 0.0495 }, + { 0.1794, 0.0738 }, + { 0.1766, 0.0981 }, + { 0.1738, 0.1225 }, + { 0.1710, 0.1468 }, + { 0.1683, 0.1708 }, + { 0.1655, 0.1951 }, + { 0.1627, 0.2195 }, + { 0.1599, 0.2438 }, + { 0.1571, 0.2681 }, + { 0.1543, 0.2922 }, + { 0.1515, 0.3165 }, + { 0.1487, 0.3408 }, + { 0.1459, 0.3652 }, + { 0.1431, 0.3895 }, + { 0.1404, 0.4135 }, + { 0.1376, 0.4379 }, + { 0.1348, 0.4622 }, + { 0.1320, 0.4865 }, + { 0.1292, 0.5109 }, + { 0.1264, 0.5349 }, + { 0.1236, 0.5592 }, + { 0.1209, 0.5835 }, + { 0.1181, 0.6079 }, + { 0.1153, 0.6322 }, + { 0.1125, 0.6562 }, + { 0.1097, 0.6806 }, + { 0.1069, 0.7049 }, + { 0.1041, 0.7292 }, + { 0.1013, 0.7536 }, + { 0.0986, 0.7776 }, + { 0.0958, 0.8019 }, + { 0.0930, 0.8263 }, + { 0.0902, 0.8506 }, + { 0.0874, 0.8749 }, + { 0.0846, 0.8990 }, + { 0.0818, 0.9233 }, + { 0.0790, 0.9476 }, + { 0.2092, 0.0282 }, + { 0.2065, 0.0522 }, + { 0.2037, 0.0766 }, + { 0.2009, 0.1009 }, + { 0.1981, 0.1252 }, + { 0.1953, 0.1496 }, + { 0.1925, 0.1736 }, + { 0.1897, 0.1979 }, + { 0.1869, 0.2223 }, + { 0.1841, 0.2466 }, + { 0.1813, 0.2709 }, + { 0.1786, 0.2950 }, + { 0.1758, 0.3193 }, + { 0.1730, 0.3436 }, + { 0.1702, 0.3680 }, + { 0.1674, 0.3923 }, + { 0.1646, 0.4163 }, + { 0.1618, 0.4406 }, + { 0.1590, 0.4650 }, + { 0.1563, 0.4893 }, + { 0.1535, 0.5136 }, + { 0.1507, 0.5377 }, + { 0.1479, 0.5620 }, + { 0.1451, 0.5863 }, + { 0.1423, 0.6107 }, + { 0.1395, 0.6350 }, + { 0.1368, 0.6590 }, + { 0.1340, 0.6834 }, + { 0.1312, 0.7077 }, + { 0.1284, 0.7320 }, + { 0.1256, 0.7564 }, + { 0.1228, 0.7804 }, + { 0.1200, 0.8047 }, + { 0.1172, 0.8290 }, + { 0.1144, 0.8534 }, + { 0.1116, 0.8777 }, + { 0.1089, 0.9017 }, + { 0.1061, 0.9261 }, + { 0.1033, 0.9504 }, + { 0.2335, 0.0310 }, + { 0.2307, 0.0550 }, + { 0.2279, 0.0794 }, + { 0.2251, 0.1037 }, + { 0.2223, 0.1280 }, + { 0.2195, 0.1524 }, + { 0.2168, 0.1764 }, + { 0.2140, 0.2007 }, + { 0.2112, 0.2251 }, + { 0.2084, 0.2494 }, + { 0.2056, 0.2737 }, + { 0.2028, 0.2977 }, + { 0.2000, 0.3221 }, + { 0.1972, 0.3464 }, + { 0.1944, 0.3707 }, + { 0.1916, 0.3951 }, + { 0.1889, 0.4191 }, + { 0.1861, 0.4434 }, + { 0.1833, 0.4678 }, + { 0.1805, 0.4921 }, + { 0.1777, 0.5164 }, + { 0.1750, 0.5405 }, + { 0.1722, 0.5648 }, + { 0.1694, 0.5891 }, + { 0.1666, 0.6135 }, + { 0.1638, 0.6378 }, + { 0.1610, 0.6618 }, + { 0.1582, 0.6861 }, + { 0.1554, 0.7105 }, + { 0.1526, 0.7348 }, + { 0.1498, 0.7591 }, + { 0.1471, 0.7832 }, + { 0.1443, 0.8075 }, + { 0.1415, 0.8318 }, + { 0.1387, 0.8562 }, + { 0.1359, 0.8805 }, + { 0.1331, 0.9045 }, + { 0.1303, 0.9289 }, + { 0.1275, 0.9532 }, + { 0.2578, 0.0338 }, + { 0.2550, 0.0578 }, + { 0.2522, 0.0822 }, + { 0.2494, 0.1065 }, + { 0.2466, 0.1308 }, + { 0.2438, 0.1552 }, + { 0.2411, 0.1792 }, + { 0.2383, 0.2035 }, + { 0.2355, 0.2278 }, + { 0.2327, 0.2522 }, + { 0.2299, 0.2765 }, + { 0.2271, 0.3005 }, + { 0.2243, 0.3249 }, + { 0.2215, 0.3492 }, + { 0.2187, 0.3735 }, + { 0.2159, 0.3979 }, + { 0.2132, 0.4219 }, + { 0.2104, 0.4462 }, + { 0.2076, 0.4706 }, + { 0.2048, 0.4949 }, + { 0.2020, 0.5192 }, + { 0.1992, 0.5432 }, + { 0.1965, 0.5676 }, + { 0.1937, 0.5919 }, + { 0.1909, 0.6162 }, + { 0.1881, 0.6406 }, + { 0.1853, 0.6646 }, + { 0.1825, 0.6889 }, + { 0.1797, 0.7133 }, + { 0.1769, 0.7376 }, + { 0.1741, 0.7619 }, + { 0.1714, 0.7860 }, + { 0.1686, 0.8103 }, + { 0.1658, 0.8346 }, + { 0.1630, 0.8590 }, + { 0.1602, 0.8833 }, + { 0.1574, 0.9073 }, + { 0.1546, 0.9316 }, + { 0.1518, 0.9560 }, + { 0.2820, 0.0366 }, + { 0.2793, 0.0606 }, + { 0.2765, 0.0849 }, + { 0.2737, 0.1093 }, + { 0.2709, 0.1336 }, + { 0.2681, 0.1579 }, + { 0.2653, 0.1820 }, + { 0.2625, 0.2063 }, + { 0.2597, 0.2306 }, + { 0.2569, 0.2550 }, + { 0.2541, 0.2793 }, + { 0.2514, 0.3033 }, + { 0.2486, 0.3277 }, + { 0.2458, 0.3520 }, + { 0.2430, 0.3763 }, + { 0.2402, 0.4007 }, + { 0.2374, 0.4247 }, + { 0.2346, 0.4490 }, + { 0.2319, 0.4733 }, + { 0.2291, 0.4977 }, + { 0.2263, 0.5220 }, + { 0.2235, 0.5460 }, + { 0.2207, 0.5704 }, + { 0.2179, 0.5947 }, + { 0.2151, 0.6190 }, + { 0.2123, 0.6434 }, + { 0.2096, 0.6674 }, + { 0.2068, 0.6917 }, + { 0.2040, 0.7161 }, + { 0.2012, 0.7404 }, + { 0.1984, 0.7647 }, + { 0.1956, 0.7887 }, + { 0.1928, 0.8131 }, + { 0.1900, 0.8374 }, + { 0.1872, 0.8617 }, + { 0.1844, 0.8861 }, + { 0.1817, 0.9101 }, + { 0.1789, 0.9344 }, + { 0.1761, 0.9588 }, + { 0.3063, 0.0394 }, + { 0.3036, 0.0634 }, + { 0.3008, 0.0877 }, + { 0.2980, 0.1121 }, + { 0.2952, 0.1364 }, + { 0.2924, 0.1607 }, + { 0.2896, 0.1848 }, + { 0.2868, 0.2091 }, + { 0.2840, 0.2334 }, + { 0.2812, 0.2578 }, + { 0.2784, 0.2821 }, + { 0.2757, 0.3061 }, + { 0.2729, 0.3304 }, + { 0.2701, 0.3548 }, + { 0.2673, 0.3791 }, + { 0.2645, 0.4034 }, + { 0.2617, 0.4275 }, + { 0.2589, 0.4518 }, + { 0.2561, 0.4761 }, + { 0.2534, 0.5005 }, + { 0.2506, 0.5248 }, + { 0.2478, 0.5488 }, + { 0.2450, 0.5732 }, + { 0.2422, 0.5975 }, + { 0.2394, 0.6218 }, + { 0.2366, 0.6462 }, + { 0.2339, 0.6702 }, + { 0.2311, 0.6945 }, + { 0.2283, 0.7188 }, + { 0.2255, 0.7432 }, + { 0.2227, 0.7675 }, + { 0.2199, 0.7915 }, + { 0.2171, 0.8159 }, + { 0.2143, 0.8402 }, + { 0.2115, 0.8645 }, + { 0.2087, 0.8889 }, + { 0.2060, 0.9129 }, + { 0.2032, 0.9372 }, + { 0.2004, 0.9616 }, + { 0.3306, 0.0422 }, + { 0.3278, 0.0662 }, + { 0.3250, 0.0905 }, + { 0.3222, 0.1148 }, + { 0.3194, 0.1392 }, + { 0.3166, 0.1635 }, + { 0.3139, 0.1875 }, + { 0.3111, 0.2119 }, + { 0.3083, 0.2362 }, + { 0.3055, 0.2605 }, + { 0.3027, 0.2849 }, + { 0.2999, 0.3089 }, + { 0.2971, 0.3332 }, + { 0.2943, 0.3576 }, + { 0.2915, 0.3819 }, + { 0.2888, 0.4062 }, + { 0.2860, 0.4302 }, + { 0.2832, 0.4546 }, + { 0.2804, 0.4789 }, + { 0.2776, 0.5033 }, + { 0.2748, 0.5276 }, + { 0.2721, 0.5516 }, + { 0.2693, 0.5759 }, + { 0.2665, 0.6003 }, + { 0.2637, 0.6246 }, + { 0.2609, 0.6489 }, + { 0.2581, 0.6730 }, + { 0.2553, 0.6973 }, + { 0.2525, 0.7216 }, + { 0.2497, 0.7460 }, + { 0.2469, 0.7703 }, + { 0.2442, 0.7943 }, + { 0.2414, 0.8187 }, + { 0.2386, 0.8430 }, + { 0.2358, 0.8673 }, + { 0.2330, 0.8917 }, + { 0.2302, 0.9157 }, + { 0.2274, 0.9400 }, + { 0.2246, 0.9643 }, + { 0.3548, 0.0449 }, + { 0.3521, 0.0690 }, + { 0.3493, 0.0933 }, + { 0.3465, 0.1176 }, + { 0.3437, 0.1420 }, + { 0.3409, 0.1663 }, + { 0.3381, 0.1903 }, + { 0.3353, 0.2147 }, + { 0.3325, 0.2390 }, + { 0.3297, 0.2633 }, + { 0.3269, 0.2877 }, + { 0.3242, 0.3117 }, + { 0.3214, 0.3360 }, + { 0.3186, 0.3603 }, + { 0.3158, 0.3847 }, + { 0.3130, 0.4090 }, + { 0.3102, 0.4330 }, + { 0.3075, 0.4574 }, + { 0.3047, 0.4817 }, + { 0.3019, 0.5060 }, + { 0.2991, 0.5304 }, + { 0.2963, 0.5544 }, + { 0.2935, 0.5787 }, + { 0.2907, 0.6031 }, + { 0.2879, 0.6274 }, + { 0.2851, 0.6517 }, + { 0.2824, 0.6757 }, + { 0.2796, 0.7001 }, + { 0.2768, 0.7244 }, + { 0.2740, 0.7488 }, + { 0.2712, 0.7731 }, + { 0.2684, 0.7971 }, + { 0.2656, 0.8214 }, + { 0.2628, 0.8458 }, + { 0.2600, 0.8701 }, + { 0.2573, 0.8944 }, + { 0.2545, 0.9185 }, + { 0.2517, 0.9428 }, + { 0.2489, 0.9671 }, + { 0.3791, 0.0477 }, + { 0.3764, 0.0718 }, + { 0.3736, 0.0961 }, + { 0.3708, 0.1204 }, + { 0.3680, 0.1448 }, + { 0.3652, 0.1691 }, + { 0.3624, 0.1931 }, + { 0.3596, 0.2174 }, + { 0.3568, 0.2418 }, + { 0.3540, 0.2661 }, + { 0.3512, 0.2905 }, + { 0.3485, 0.3145 }, + { 0.3457, 0.3388 }, + { 0.3429, 0.3631 }, + { 0.3401, 0.3875 }, + { 0.3373, 0.4118 }, + { 0.3345, 0.4358 }, + { 0.3317, 0.4602 }, + { 0.3290, 0.4845 }, + { 0.3262, 0.5088 }, + { 0.3234, 0.5332 }, + { 0.3206, 0.5572 }, + { 0.3178, 0.5815 }, + { 0.3150, 0.6059 }, + { 0.3122, 0.6302 }, + { 0.3094, 0.6545 }, + { 0.3067, 0.6785 }, + { 0.3039, 0.7029 }, + { 0.3011, 0.7272 }, + { 0.2983, 0.7515 }, + { 0.2955, 0.7759 }, + { 0.2927, 0.7999 }, + { 0.2899, 0.8242 }, + { 0.2871, 0.8486 }, + { 0.2843, 0.8729 }, + { 0.2815, 0.8972 }, + { 0.2788, 0.9213 }, + { 0.2760, 0.9456 }, + { 0.2732, 0.9699 }, + { 0.4034, 0.0505 }, + { 0.4006, 0.0745 }, + { 0.3978, 0.0989 }, + { 0.3950, 0.1232 }, + { 0.3922, 0.1475 }, + { 0.3894, 0.1719 }, + { 0.3867, 0.1959 }, + { 0.3839, 0.2202 }, + { 0.3811, 0.2446 }, + { 0.3783, 0.2689 }, + { 0.3755, 0.2932 }, + { 0.3727, 0.3173 }, + { 0.3699, 0.3416 }, + { 0.3671, 0.3659 }, + { 0.3644, 0.3903 }, + { 0.3616, 0.4146 }, + { 0.3588, 0.4386 }, + { 0.3560, 0.4629 }, + { 0.3532, 0.4873 }, + { 0.3504, 0.5116 }, + { 0.3476, 0.5359 }, + { 0.3449, 0.5600 }, + { 0.3421, 0.5843 }, + { 0.3393, 0.6086 }, + { 0.3365, 0.6330 }, + { 0.3337, 0.6573 }, + { 0.3309, 0.6813 }, + { 0.3281, 0.7057 }, + { 0.3253, 0.7300 }, + { 0.3225, 0.7543 }, + { 0.3197, 0.7787 }, + { 0.3170, 0.8027 }, + { 0.3142, 0.8270 }, + { 0.3114, 0.8513 }, + { 0.3086, 0.8757 }, + { 0.3058, 0.9000 }, + { 0.3030, 0.9240 }, + { 0.3002, 0.9484 }, + { 0.2975, 0.9727 }, + { 0.4277, 0.0533 }, + { 0.4249, 0.0773 }, + { 0.4221, 0.1017 }, + { 0.4193, 0.1260 }, + { 0.4165, 0.1503 }, + { 0.4137, 0.1747 }, + { 0.4110, 0.1987 }, + { 0.4082, 0.2230 }, + { 0.4054, 0.2474 }, + { 0.4026, 0.2717 }, + { 0.3998, 0.2960 }, + { 0.3970, 0.3200 }, + { 0.3942, 0.3444 }, + { 0.3914, 0.3687 }, + { 0.3886, 0.3930 }, + { 0.3859, 0.4174 }, + { 0.3831, 0.4414 }, + { 0.3803, 0.4657 }, + { 0.3775, 0.4901 }, + { 0.3747, 0.5144 }, + { 0.3719, 0.5387 }, + { 0.3692, 0.5628 }, + { 0.3664, 0.5871 }, + { 0.3636, 0.6114 }, + { 0.3608, 0.6358 }, + { 0.3580, 0.6601 }, + { 0.3552, 0.6841 }, + { 0.3524, 0.7084 }, + { 0.3496, 0.7328 }, + { 0.3468, 0.7571 }, + { 0.3440, 0.7815 }, + { 0.3413, 0.8055 }, + { 0.3385, 0.8298 }, + { 0.3357, 0.8541 }, + { 0.3329, 0.8785 }, + { 0.3301, 0.9028 }, + { 0.3273, 0.9268 }, + { 0.3245, 0.9512 }, + { 0.3217, 0.9755 }, + { 0.4519, 0.0561 }, + { 0.4492, 0.0801 }, + { 0.4464, 0.1045 }, + { 0.4436, 0.1288 }, + { 0.4408, 0.1531 }, + { 0.4380, 0.1775 }, + { 0.4352, 0.2015 }, + { 0.4324, 0.2258 }, + { 0.4296, 0.2501 }, + { 0.4268, 0.2745 }, + { 0.4240, 0.2988 }, + { 0.4213, 0.3228 }, + { 0.4185, 0.3472 }, + { 0.4157, 0.3715 }, + { 0.4129, 0.3958 }, + { 0.4101, 0.4202 }, + { 0.4073, 0.4442 }, + { 0.4046, 0.4685 }, + { 0.4018, 0.4929 }, + { 0.3990, 0.5172 }, + { 0.3962, 0.5415 }, + { 0.3934, 0.5655 }, + { 0.3906, 0.5899 }, + { 0.3878, 0.6142 }, + { 0.3850, 0.6385 }, + { 0.3822, 0.6629 }, + { 0.3795, 0.6869 }, + { 0.3767, 0.7112 }, + { 0.3739, 0.7356 }, + { 0.3711, 0.7599 }, + { 0.3683, 0.7842 }, + { 0.3655, 0.8083 }, + { 0.3627, 0.8326 }, + { 0.3599, 0.8569 }, + { 0.3571, 0.8813 }, + { 0.3544, 0.9056 }, + { 0.3516, 0.9296 }, + { 0.3488, 0.9539 }, + { 0.3460, 0.9783 }, + { 0.4762, 0.0589 }, + { 0.4734, 0.0829 }, + { 0.4706, 0.1072 }, + { 0.4678, 0.1316 }, + { 0.4650, 0.1559 }, + { 0.4622, 0.1802 }, + { 0.4595, 0.2043 }, + { 0.4567, 0.2286 }, + { 0.4539, 0.2529 }, + { 0.4511, 0.2773 }, + { 0.4483, 0.3016 }, + { 0.4455, 0.3256 }, + { 0.4427, 0.3500 }, + { 0.4400, 0.3743 }, + { 0.4372, 0.3986 }, + { 0.4344, 0.4230 }, + { 0.4316, 0.4470 }, + { 0.4288, 0.4713 }, + { 0.4260, 0.4956 }, + { 0.4232, 0.5200 }, + { 0.4204, 0.5443 }, + { 0.4177, 0.5683 }, + { 0.4149, 0.5927 }, + { 0.4121, 0.6170 }, + { 0.4093, 0.6413 }, + { 0.4065, 0.6657 }, + { 0.4037, 0.6897 }, + { 0.4009, 0.7140 }, + { 0.3981, 0.7384 }, + { 0.3953, 0.7627 }, + { 0.3925, 0.7870 }, + { 0.3898, 0.8110 }, + { 0.3870, 0.8354 }, + { 0.3842, 0.8597 }, + { 0.3814, 0.8840 }, + { 0.3786, 0.9084 }, + { 0.3758, 0.9324 }, + { 0.3731, 0.9567 }, + { 0.3703, 0.9811 }, + { 0.5005, 0.0617 }, + { 0.4977, 0.0857 }, + { 0.4949, 0.1100 }, + { 0.4921, 0.1344 }, + { 0.4893, 0.1587 }, + { 0.4865, 0.1830 }, + { 0.4838, 0.2071 }, + { 0.4810, 0.2314 }, + { 0.4782, 0.2557 }, + { 0.4754, 0.2801 }, + { 0.4726, 0.3044 }, + { 0.4698, 0.3284 }, + { 0.4670, 0.3527 }, + { 0.4642, 0.3771 }, + { 0.4615, 0.4014 }, + { 0.4587, 0.4257 }, + { 0.4559, 0.4498 }, + { 0.4531, 0.4741 }, + { 0.4503, 0.4984 }, + { 0.4475, 0.5228 }, + { 0.4447, 0.5471 }, + { 0.4420, 0.5711 }, + { 0.4392, 0.5955 }, + { 0.4364, 0.6198 }, + { 0.4336, 0.6441 }, + { 0.4308, 0.6685 }, + { 0.4280, 0.6925 }, + { 0.4252, 0.7168 }, + { 0.4224, 0.7411 }, + { 0.4196, 0.7655 }, + { 0.4168, 0.7898 }, + { 0.4141, 0.8138 }, + { 0.4113, 0.8382 }, + { 0.4085, 0.8625 }, + { 0.4057, 0.8868 }, + { 0.4029, 0.9112 }, + { 0.4001, 0.9352 }, + { 0.3973, 0.9595 }, + { 0.3946, 0.9839 }, + { 0.5247, 0.0645 }, + { 0.5220, 0.0885 }, + { 0.5192, 0.1128 }, + { 0.5164, 0.1371 }, + { 0.5136, 0.1615 }, + { 0.5108, 0.1858 }, + { 0.5080, 0.2098 }, + { 0.5052, 0.2342 }, + { 0.5024, 0.2585 }, + { 0.4996, 0.2828 }, + { 0.4969, 0.3072 }, + { 0.4941, 0.3312 }, + { 0.4913, 0.3555 }, + { 0.4885, 0.3799 }, + { 0.4857, 0.4042 }, + { 0.4829, 0.4285 }, + { 0.4802, 0.4526 }, + { 0.4774, 0.4769 }, + { 0.4746, 0.5012 }, + { 0.4718, 0.5256 }, + { 0.4690, 0.5499 }, + { 0.4662, 0.5739 }, + { 0.4634, 0.5982 }, + { 0.4606, 0.6226 }, + { 0.4578, 0.6469 }, + { 0.4550, 0.6712 }, + { 0.4523, 0.6953 }, + { 0.4495, 0.7196 }, + { 0.4467, 0.7439 }, + { 0.4439, 0.7683 }, + { 0.4411, 0.7926 }, + { 0.4383, 0.8166 }, + { 0.4355, 0.8410 }, + { 0.4327, 0.8653 }, + { 0.4300, 0.8896 }, + { 0.4272, 0.9140 }, + { 0.4244, 0.9380 }, + { 0.4216, 0.9623 }, + { 0.4188, 0.9866 }, + { 0.5490, 0.0673 }, + { 0.5463, 0.0913 }, + { 0.5435, 0.1156 }, + { 0.5407, 0.1399 }, + { 0.5379, 0.1643 }, + { 0.5351, 0.1886 }, + { 0.5323, 0.2126 }, + { 0.5295, 0.2370 }, + { 0.5267, 0.2613 }, + { 0.5239, 0.2856 }, + { 0.5211, 0.3100 }, + { 0.5184, 0.3340 }, + { 0.5156, 0.3583 }, + { 0.5128, 0.3827 }, + { 0.5100, 0.4070 }, + { 0.5072, 0.4313 }, + { 0.5044, 0.4553 }, + { 0.5017, 0.4797 }, + { 0.4989, 0.5040 }, + { 0.4961, 0.5283 }, + { 0.4933, 0.5527 }, + { 0.4905, 0.5767 }, + { 0.4877, 0.6010 }, + { 0.4849, 0.6254 }, + { 0.4821, 0.6497 }, + { 0.4793, 0.6740 }, + { 0.4766, 0.6981 }, + { 0.4738, 0.7224 }, + { 0.4710, 0.7467 }, + { 0.4682, 0.7711 }, + { 0.4654, 0.7954 }, + { 0.4626, 0.8194 }, + { 0.4598, 0.8437 }, + { 0.4570, 0.8681 }, + { 0.4542, 0.8924 }, + { 0.4515, 0.9167 }, + { 0.4487, 0.9408 }, + { 0.4459, 0.9651 }, + { 0.4431, 0.9894 }, + { 0.5733, 0.0700 }, + { 0.5705, 0.0941 }, + { 0.5677, 0.1184 }, + { 0.5649, 0.1427 }, + { 0.5621, 0.1671 }, + { 0.5593, 0.1914 }, + { 0.5566, 0.2154 }, + { 0.5538, 0.2397 }, + { 0.5510, 0.2641 }, + { 0.5482, 0.2884 }, + { 0.5454, 0.3128 }, + { 0.5426, 0.3368 }, + { 0.5398, 0.3611 }, + { 0.5371, 0.3854 }, + { 0.5343, 0.4098 }, + { 0.5315, 0.4341 }, + { 0.5287, 0.4581 }, + { 0.5259, 0.4825 }, + { 0.5231, 0.5068 }, + { 0.5203, 0.5311 }, + { 0.5175, 0.5555 }, + { 0.5148, 0.5795 }, + { 0.5120, 0.6038 }, + { 0.5092, 0.6282 }, + { 0.5064, 0.6525 }, + { 0.5036, 0.6768 }, + { 0.5008, 0.7008 }, + { 0.4980, 0.7252 }, + { 0.4952, 0.7495 }, + { 0.4924, 0.7738 }, + { 0.4896, 0.7982 }, + { 0.4869, 0.8222 }, + { 0.4841, 0.8465 }, + { 0.4813, 0.8709 }, + { 0.4785, 0.8952 }, + { 0.4757, 0.9195 }, + { 0.4729, 0.9436 }, + { 0.4702, 0.9679 }, + { 0.4674, 0.9922 }, + { 0.5975, 0.0728 }, + { 0.5948, 0.0968 }, + { 0.5920, 0.1212 }, + { 0.5892, 0.1455 }, + { 0.5864, 0.1698 }, + { 0.5836, 0.1942 }, + { 0.5808, 0.2182 }, + { 0.5780, 0.2425 }, + { 0.5752, 0.2669 }, + { 0.5725, 0.2912 }, + { 0.5697, 0.3155 }, + { 0.5669, 0.3396 }, + { 0.5641, 0.3639 }, + { 0.5613, 0.3882 }, + { 0.5585, 0.4126 }, + { 0.5557, 0.4369 }, + { 0.5530, 0.4609 }, + { 0.5502, 0.4852 }, + { 0.5474, 0.5096 }, + { 0.5446, 0.5339 }, + { 0.5418, 0.5583 }, + { 0.5390, 0.5823 }, + { 0.5362, 0.6066 }, + { 0.5334, 0.6309 }, + { 0.5306, 0.6553 }, + { 0.5278, 0.6796 }, + { 0.5251, 0.7036 }, + { 0.5223, 0.7280 }, + { 0.5195, 0.7523 }, + { 0.5167, 0.7766 }, + { 0.5139, 0.8010 }, + { 0.5111, 0.8250 }, + { 0.5083, 0.8493 }, + { 0.5056, 0.8737 }, + { 0.5028, 0.8980 }, + { 0.5000, 0.9223 }, + { 0.4972, 0.9463 }, + { 0.4944, 0.9707 }, + { 0.4916, 0.9950 }, + { 0.6218, 0.0756 }, + { 0.6191, 0.0996 }, + { 0.6163, 0.1240 }, + { 0.6135, 0.1483 }, + { 0.6107, 0.1726 }, + { 0.6079, 0.1970 }, + { 0.6051, 0.2210 }, + { 0.6023, 0.2453 }, + { 0.5995, 0.2697 }, + { 0.5967, 0.2940 }, + { 0.5940, 0.3183 }, + { 0.5912, 0.3423 }, + { 0.5884, 0.3667 }, + { 0.5856, 0.3910 }, + { 0.5828, 0.4153 }, + { 0.5800, 0.4397 }, + { 0.5773, 0.4637 }, + { 0.5745, 0.4880 }, + { 0.5717, 0.5124 }, + { 0.5689, 0.5367 }, + { 0.5661, 0.5610 }, + { 0.5633, 0.5851 }, + { 0.5605, 0.6094 }, + { 0.5577, 0.6337 }, + { 0.5549, 0.6581 }, + { 0.5521, 0.6824 }, + { 0.5494, 0.7064 }, + { 0.5466, 0.7308 }, + { 0.5438, 0.7551 }, + { 0.5410, 0.7794 }, + { 0.5382, 0.8038 }, + { 0.5354, 0.8278 }, + { 0.5326, 0.8521 }, + { 0.5298, 0.8764 }, + { 0.5271, 0.9008 }, + { 0.5243, 0.9251 }, + { 0.5215, 0.9491 }, + { 0.5187, 0.9735 }, + { 0.5159, 0.9978 }, + { 0.6461, 0.0784 }, + { 0.6433, 0.1024 }, + { 0.6405, 0.1268 }, + { 0.6377, 0.1511 }, + { 0.6349, 0.1754 }, + { 0.6321, 0.1998 }, + { 0.6294, 0.2238 }, + { 0.6266, 0.2481 }, + { 0.6238, 0.2724 }, + { 0.6210, 0.2968 }, + { 0.6182, 0.3211 }, + { 0.6154, 0.3451 }, + { 0.6127, 0.3695 }, + { 0.6099, 0.3938 }, + { 0.6071, 0.4181 }, + { 0.6043, 0.4425 }, + { 0.6015, 0.4665 }, + { 0.5987, 0.4908 }, + { 0.5959, 0.5152 }, + { 0.5931, 0.5395 }, + { 0.5903, 0.5638 }, + { 0.5876, 0.5878 }, + { 0.5848, 0.6122 }, + { 0.5820, 0.6365 }, + { 0.5792, 0.6608 }, + { 0.5764, 0.6852 }, + { 0.5736, 0.7092 }, + { 0.5708, 0.7335 }, + { 0.5680, 0.7579 }, + { 0.5652, 0.7822 }, + { 0.5625, 0.8065 }, + { 0.5597, 0.8306 }, + { 0.5569, 0.8549 }, + { 0.5541, 0.8792 }, + { 0.5513, 0.9036 }, + { 0.5485, 0.9279 }, + { 0.5458, 0.9519 }, + { 0.5430, 0.9762 }, + { 0.5402, 1.0006 }, + { 0.6704, 0.0812 }, + { 0.6676, 0.1052 }, + { 0.6648, 0.1295 }, + { 0.6620, 0.1539 }, + { 0.6592, 0.1782 }, + { 0.6564, 0.2025 }, + { 0.6537, 0.2266 }, + { 0.6509, 0.2509 }, + { 0.6481, 0.2752 }, + { 0.6453, 0.2996 }, + { 0.6425, 0.3239 }, + { 0.6397, 0.3479 }, + { 0.6369, 0.3723 }, + { 0.6342, 0.3966 }, + { 0.6314, 0.4209 }, + { 0.6286, 0.4453 }, + { 0.6258, 0.4693 }, + { 0.6230, 0.4936 }, + { 0.6202, 0.5179 }, + { 0.6174, 0.5423 }, + { 0.6146, 0.5666 }, + { 0.6119, 0.5906 }, + { 0.6091, 0.6150 }, + { 0.6063, 0.6393 }, + { 0.6035, 0.6636 }, + { 0.6007, 0.6880 }, + { 0.5979, 0.7120 }, + { 0.5951, 0.7363 }, + { 0.5923, 0.7607 }, + { 0.5895, 0.7850 }, + { 0.5867, 0.8093 }, + { 0.5840, 0.8333 }, + { 0.5812, 0.8577 }, + { 0.5784, 0.8820 }, + { 0.5756, 0.9064 }, + { 0.5728, 0.9307 }, + { 0.5701, 0.9547 }, + { 0.5673, 0.9790 }, + { 0.5645, 1.0034 }, + { 0.6946, 0.0840 }, + { 0.6919, 0.1080 }, + { 0.6891, 0.1323 }, + { 0.6863, 0.1567 }, + { 0.6835, 0.1810 }, + { 0.6807, 0.2053 }, + { 0.6779, 0.2294 }, + { 0.6751, 0.2537 }, + { 0.6723, 0.2780 }, + { 0.6696, 0.3024 }, + { 0.6668, 0.3267 }, + { 0.6640, 0.3507 }, + { 0.6612, 0.3750 }, + { 0.6584, 0.3994 }, + { 0.6556, 0.4237 }, + { 0.6528, 0.4480 }, + { 0.6501, 0.4721 }, + { 0.6473, 0.4964 }, + { 0.6445, 0.5207 }, + { 0.6417, 0.5451 }, + { 0.6389, 0.5694 }, + { 0.6361, 0.5934 }, + { 0.6333, 0.6178 }, + { 0.6305, 0.6421 }, + { 0.6277, 0.6664 }, + { 0.6249, 0.6908 }, + { 0.6222, 0.7148 }, + { 0.6194, 0.7391 }, + { 0.6166, 0.7634 }, + { 0.6138, 0.7878 }, + { 0.6110, 0.8121 }, + { 0.6082, 0.8361 }, + { 0.6055, 0.8605 }, + { 0.6027, 0.8848 }, + { 0.5999, 0.9091 }, + { 0.5971, 0.9335 }, + { 0.5943, 0.9575 }, + { 0.5915, 0.9818 }, + { 0.5887, 1.0062 }, + { 0.7189, 0.0868 }, + { 0.7161, 0.1108 }, + { 0.7133, 0.1351 }, + { 0.7105, 0.1595 }, + { 0.7077, 0.1838 }, + { 0.7050, 0.2081 }, + { 0.7022, 0.2321 }, + { 0.6994, 0.2565 }, + { 0.6966, 0.2808 }, + { 0.6938, 0.3051 }, + { 0.6910, 0.3295 }, + { 0.6883, 0.3535 }, + { 0.6855, 0.3778 }, + { 0.6827, 0.4022 }, + { 0.6799, 0.4265 }, + { 0.6771, 0.4508 }, + { 0.6743, 0.4749 }, + { 0.6715, 0.4992 }, + { 0.6687, 0.5235 }, + { 0.6659, 0.5479 }, + { 0.6631, 0.5722 }, + { 0.6604, 0.5962 }, + { 0.6576, 0.6205 }, + { 0.6548, 0.6449 }, + { 0.6520, 0.6692 }, + { 0.6492, 0.6935 }, + { 0.6464, 0.7176 }, + { 0.6436, 0.7419 }, + { 0.6408, 0.7662 }, + { 0.6381, 0.7906 }, + { 0.6353, 0.8149 }, + { 0.6325, 0.8389 }, + { 0.6297, 0.8633 }, + { 0.6269, 0.8876 }, + { 0.6241, 0.9119 }, + { 0.6213, 0.9363 }, + { 0.6186, 0.9603 }, + { 0.6158, 0.9846 }, + { 0.6130, 1.0089 }, + { 0.7432, 0.0896 }, + { 0.7404, 0.1136 }, + { 0.7376, 0.1379 }, + { 0.7348, 0.1622 }, + { 0.7320, 0.1866 }, + { 0.7292, 0.2109 }, + { 0.7265, 0.2349 }, + { 0.7237, 0.2593 }, + { 0.7209, 0.2836 }, + { 0.7181, 0.3079 }, + { 0.7153, 0.3323 }, + { 0.7126, 0.3563 }, + { 0.7098, 0.3806 }, + { 0.7070, 0.4050 }, + { 0.7042, 0.4293 }, + { 0.7014, 0.4536 }, + { 0.6986, 0.4776 }, + { 0.6958, 0.5020 }, + { 0.6930, 0.5263 }, + { 0.6902, 0.5506 }, + { 0.6874, 0.5750 }, + { 0.6847, 0.5990 }, + { 0.6819, 0.6233 }, + { 0.6791, 0.6477 }, + { 0.6763, 0.6720 }, + { 0.6735, 0.6963 }, + { 0.6707, 0.7204 }, + { 0.6679, 0.7447 }, + { 0.6651, 0.7690 }, + { 0.6623, 0.7934 }, + { 0.6596, 0.8177 }, + { 0.6568, 0.8417 }, + { 0.6540, 0.8660 }, + { 0.6512, 0.8904 }, + { 0.6484, 0.9147 }, + { 0.6456, 0.9390 }, + { 0.6429, 0.9631 }, + { 0.6401, 0.9874 }, + { 0.6373, 1.0117 }, + { 0.7674, 0.0923 }, + { 0.7647, 0.1164 }, + { 0.7619, 0.1407 }, + { 0.7591, 0.1650 }, + { 0.7563, 0.1894 }, + { 0.7535, 0.2137 }, + { 0.7507, 0.2377 }, + { 0.7479, 0.2620 }, + { 0.7452, 0.2864 }, + { 0.7424, 0.3107 }, + { 0.7396, 0.3351 }, + { 0.7368, 0.3591 }, + { 0.7340, 0.3834 }, + { 0.7312, 0.4077 }, + { 0.7284, 0.4321 }, + { 0.7256, 0.4564 }, + { 0.7229, 0.4804 }, + { 0.7201, 0.5048 }, + { 0.7173, 0.5291 }, + { 0.7145, 0.5534 }, + { 0.7117, 0.5778 }, + { 0.7089, 0.6018 }, + { 0.7061, 0.6261 }, + { 0.7033, 0.6505 }, + { 0.7005, 0.6748 }, + { 0.6977, 0.6991 }, + { 0.6950, 0.7231 }, + { 0.6922, 0.7475 }, + { 0.6894, 0.7718 }, + { 0.6866, 0.7961 }, + { 0.6838, 0.8205 }, + { 0.6811, 0.8445 }, + { 0.6783, 0.8688 }, + { 0.6755, 0.8932 }, + { 0.6727, 0.9175 }, + { 0.6699, 0.9418 }, + { 0.6671, 0.9659 }, + { 0.6643, 0.9902 }, + { 0.6615, 1.0145 }, + { 0.7917, 0.0951 }, + { 0.7890, 0.1191 }, + { 0.7862, 0.1435 }, + { 0.7834, 0.1678 }, + { 0.7806, 0.1922 }, + { 0.7778, 0.2165 }, + { 0.7750, 0.2405 }, + { 0.7722, 0.2648 }, + { 0.7694, 0.2892 }, + { 0.7667, 0.3135 }, + { 0.7639, 0.3378 }, + { 0.7611, 0.3619 }, + { 0.7583, 0.3862 }, + { 0.7555, 0.4105 }, + { 0.7527, 0.4349 }, + { 0.7499, 0.4592 }, + { 0.7472, 0.4832 }, + { 0.7444, 0.5076 }, + { 0.7416, 0.5319 }, + { 0.7388, 0.5562 }, + { 0.7360, 0.5806 }, + { 0.7332, 0.6046 }, + { 0.7304, 0.6289 }, + { 0.7276, 0.6532 }, + { 0.7248, 0.6776 }, + { 0.7220, 0.7019 }, + { 0.7193, 0.7259 }, + { 0.7165, 0.7503 }, + { 0.7137, 0.7746 }, + { 0.7109, 0.7989 }, + { 0.7081, 0.8233 }, + { 0.7053, 0.8473 }, + { 0.7026, 0.8716 }, + { 0.6998, 0.8960 }, + { 0.6970, 0.9203 }, + { 0.6942, 0.9446 }, + { 0.6914, 0.9686 }, + { 0.6886, 0.9930 }, + { 0.6858, 1.0173 }, + { 0.8160, 0.0979 }, + { 0.8132, 0.1219 }, + { 0.8104, 0.1463 }, + { 0.8076, 0.1706 }, + { 0.8048, 0.1949 }, + { 0.8021, 0.2193 }, + { 0.7993, 0.2433 }, + { 0.7965, 0.2676 }, + { 0.7937, 0.2920 }, + { 0.7909, 0.3163 }, + { 0.7881, 0.3406 }, + { 0.7854, 0.3646 }, + { 0.7826, 0.3890 }, + { 0.7798, 0.4133 }, + { 0.7770, 0.4377 }, + { 0.7742, 0.4620 }, + { 0.7714, 0.4860 }, + { 0.7686, 0.5103 }, + { 0.7658, 0.5347 }, + { 0.7630, 0.5590 }, + { 0.7602, 0.5833 }, + { 0.7575, 0.6074 }, + { 0.7547, 0.6317 }, + { 0.7519, 0.6560 }, + { 0.7491, 0.6804 }, + { 0.7463, 0.7047 }, + { 0.7435, 0.7287 }, + { 0.7407, 0.7531 }, + { 0.7380, 0.7774 }, + { 0.7352, 0.8017 }, + { 0.7324, 0.8261 }, + { 0.7296, 0.8501 }, + { 0.7268, 0.8744 }, + { 0.7240, 0.8987 }, + { 0.7212, 0.9231 }, + { 0.7184, 0.9474 }, + { 0.7157, 0.9714 }, + { 0.7129, 0.9958 }, + { 0.7101, 1.0201 }, + { 0.8402, 0.1007 }, + { 0.8375, 0.1247 }, + { 0.8347, 0.1491 }, + { 0.8319, 0.1734 }, + { 0.8291, 0.1977 }, + { 0.8263, 0.2221 }, + { 0.8236, 0.2461 }, + { 0.8208, 0.2704 }, + { 0.8180, 0.2947 }, + { 0.8152, 0.3191 }, + { 0.8124, 0.3434 }, + { 0.8096, 0.3674 }, + { 0.8068, 0.3918 }, + { 0.8040, 0.4161 }, + { 0.8012, 0.4404 }, + { 0.7984, 0.4648 }, + { 0.7957, 0.4888 }, + { 0.7929, 0.5131 }, + { 0.7901, 0.5375 }, + { 0.7873, 0.5618 }, + { 0.7845, 0.5861 }, + { 0.7817, 0.6101 }, + { 0.7789, 0.6345 }, + { 0.7761, 0.6588 }, + { 0.7733, 0.6831 }, + { 0.7706, 0.7075 }, + { 0.7678, 0.7315 }, + { 0.7650, 0.7558 }, + { 0.7622, 0.7802 }, + { 0.7594, 0.8045 }, + { 0.7566, 0.8288 }, + { 0.7539, 0.8529 }, + { 0.7511, 0.8772 }, + { 0.7483, 0.9015 }, + { 0.7455, 0.9259 }, + { 0.7427, 0.9502 }, + { 0.7399, 0.9742 }, + { 0.7371, 0.9986 }, + { 0.7343, 1.0229 }, + { 0.8645, 0.1035 }, + { 0.8618, 0.1275 }, + { 0.8590, 0.1518 }, + { 0.8562, 0.1762 }, + { 0.8534, 0.2005 }, + { 0.8506, 0.2248 }, + { 0.8478, 0.2489 }, + { 0.8451, 0.2732 }, + { 0.8423, 0.2975 }, + { 0.8395, 0.3219 }, + { 0.8367, 0.3462 }, + { 0.8339, 0.3702 }, + { 0.8311, 0.3946 }, + { 0.8283, 0.4189 }, + { 0.8255, 0.4432 }, + { 0.8227, 0.4676 }, + { 0.8200, 0.4916 }, + { 0.8172, 0.5159 }, + { 0.8144, 0.5402 }, + { 0.8116, 0.5646 }, + { 0.8088, 0.5889 }, + { 0.8060, 0.6129 }, + { 0.8032, 0.6373 }, + { 0.8004, 0.6616 }, + { 0.7976, 0.6859 }, + { 0.7948, 0.7103 }, + { 0.7921, 0.7343 }, + { 0.7893, 0.7586 }, + { 0.7865, 0.7830 }, + { 0.7837, 0.8073 }, + { 0.7809, 0.8316 }, + { 0.7782, 0.8556 }, + { 0.7754, 0.8800 }, + { 0.7726, 0.9043 }, + { 0.7698, 0.9287 }, + { 0.7670, 0.9530 }, + { 0.7642, 0.9770 }, + { 0.7614, 1.0013 }, + { 0.7586, 1.0257 }, + { 0.8888, 0.1063 }, + { 0.8860, 0.1303 }, + { 0.8832, 0.1546 }, + { 0.8805, 0.1790 }, + { 0.8777, 0.2033 }, + { 0.8749, 0.2276 }, + { 0.8721, 0.2517 }, + { 0.8693, 0.2760 }, + { 0.8665, 0.3003 }, + { 0.8637, 0.3247 }, + { 0.8609, 0.3490 }, + { 0.8582, 0.3730 }, + { 0.8554, 0.3973 }, + { 0.8526, 0.4217 }, + { 0.8498, 0.4460 }, + { 0.8470, 0.4703 }, + { 0.8442, 0.4944 }, + { 0.8414, 0.5187 }, + { 0.8386, 0.5430 }, + { 0.8358, 0.5674 }, + { 0.8330, 0.5917 }, + { 0.8303, 0.6157 }, + { 0.8275, 0.6401 }, + { 0.8247, 0.6644 }, + { 0.8219, 0.6887 }, + { 0.8191, 0.7131 }, + { 0.8163, 0.7371 }, + { 0.8136, 0.7614 }, + { 0.8108, 0.7857 }, + { 0.8080, 0.8101 }, + { 0.8052, 0.8344 }, + { 0.8024, 0.8584 }, + { 0.7996, 0.8828 }, + { 0.7968, 0.9071 }, + { 0.7940, 0.9314 }, + { 0.7912, 0.9558 }, + { 0.7885, 0.9798 }, + { 0.7857, 1.0041 }, + { 0.7829, 1.0285 }, + { 0.9131, 0.1091 }, + { 0.9103, 0.1331 }, + { 0.9075, 0.1574 }, + { 0.9047, 0.1818 }, + { 0.9020, 0.2061 }, + { 0.8992, 0.2304 }, + { 0.8964, 0.2544 }, + { 0.8936, 0.2788 }, + { 0.8908, 0.3031 }, + { 0.8880, 0.3274 }, + { 0.8852, 0.3518 }, + { 0.8825, 0.3758 }, + { 0.8797, 0.4001 }, + { 0.8769, 0.4245 }, + { 0.8741, 0.4488 }, + { 0.8713, 0.4731 }, + { 0.8685, 0.4972 }, + { 0.8657, 0.5215 }, + { 0.8629, 0.5458 }, + { 0.8601, 0.5702 }, + { 0.8573, 0.5945 }, + { 0.8546, 0.6185 }, + { 0.8518, 0.6428 }, + { 0.8490, 0.6672 }, + { 0.8462, 0.6915 }, + { 0.8434, 0.7159 }, + { 0.8406, 0.7399 }, + { 0.8378, 0.7642 }, + { 0.8351, 0.7885 }, + { 0.8323, 0.8129 }, + { 0.8295, 0.8372 }, + { 0.8267, 0.8612 }, + { 0.8239, 0.8856 }, + { 0.8211, 0.9099 }, + { 0.8183, 0.9342 }, + { 0.8155, 0.9586 }, + { 0.8128, 0.9826 }, + { 0.8100, 1.0069 }, + { 0.8072, 1.0313 }, + { 0.9373, 0.1119 }, + { 0.9346, 0.1359 }, + { 0.9318, 0.1602 }, + { 0.9290, 0.1845 }, + { 0.9262, 0.2089 }, + { 0.9234, 0.2332 }, + { 0.9207, 0.2572 }, + { 0.9179, 0.2816 }, + { 0.9151, 0.3059 }, + { 0.9123, 0.3302 }, + { 0.9095, 0.3546 }, + { 0.9067, 0.3786 }, + { 0.9039, 0.4029 }, + { 0.9011, 0.4273 }, + { 0.8983, 0.4516 }, + { 0.8955, 0.4759 }, + { 0.8928, 0.4999 }, + { 0.8900, 0.5243 }, + { 0.8872, 0.5486 }, + { 0.8844, 0.5729 }, + { 0.8816, 0.5973 }, + { 0.8788, 0.6213 }, + { 0.8760, 0.6456 }, + { 0.8732, 0.6700 }, + { 0.8705, 0.6943 }, + { 0.8677, 0.7186 }, + { 0.8649, 0.7427 }, + { 0.8621, 0.7670 }, + { 0.8593, 0.7913 }, + { 0.8565, 0.8157 }, + { 0.8537, 0.8400 }, + { 0.8510, 0.8640 }, + { 0.8482, 0.8883 }, + { 0.8454, 0.9127 }, + { 0.8426, 0.9370 }, + { 0.8398, 0.9614 }, + { 0.8370, 0.9854 }, + { 0.8342, 1.0097 }, + { 0.8314, 1.0340 }, + { 0.9616, 0.1146 }, + { 0.9588, 0.1387 }, + { 0.9561, 0.1630 }, + { 0.9533, 0.1873 }, + { 0.9505, 0.2117 }, + { 0.9477, 0.2360 }, + { 0.9449, 0.2600 }, + { 0.9421, 0.2844 }, + { 0.9393, 0.3087 }, + { 0.9365, 0.3330 }, + { 0.9337, 0.3574 }, + { 0.9310, 0.3814 }, + { 0.9282, 0.4057 }, + { 0.9254, 0.4300 }, + { 0.9226, 0.4544 }, + { 0.9198, 0.4787 }, + { 0.9170, 0.5027 }, + { 0.9142, 0.5271 }, + { 0.9114, 0.5514 }, + { 0.9086, 0.5757 }, + { 0.9058, 0.6001 }, + { 0.9031, 0.6241 }, + { 0.9003, 0.6484 }, + { 0.8975, 0.6728 }, + { 0.8947, 0.6971 }, + { 0.8919, 0.7214 }, + { 0.8892, 0.7454 }, + { 0.8864, 0.7698 }, + { 0.8836, 0.7941 }, + { 0.8808, 0.8184 }, + { 0.8780, 0.8428 }, + { 0.8752, 0.8668 }, + { 0.8724, 0.8911 }, + { 0.8696, 0.9155 }, + { 0.8668, 0.9398 }, + { 0.8640, 0.9641 }, + { 0.8613, 0.9882 }, + { 0.8585, 1.0125 }, + { 0.8557, 1.0368 }, + { 0.9831, 0.1414 }, + { 0.9803, 0.1658 }, + { 0.9776, 0.1901 }, + { 0.9748, 0.2145 }, + { 0.9720, 0.2388 }, + { 0.9692, 0.2628 }, + { 0.9664, 0.2871 }, + { 0.9636, 0.3115 }, + { 0.9608, 0.3358 }, + { 0.9580, 0.3601 }, + { 0.9553, 0.3842 }, + { 0.9525, 0.4085 }, + { 0.9497, 0.4328 }, + { 0.9469, 0.4572 }, + { 0.9441, 0.4815 }, + { 0.9413, 0.5055 }, + { 0.9385, 0.5299 }, + { 0.9357, 0.5542 }, + { 0.9329, 0.5785 }, + { 0.9301, 0.6029 }, + { 0.9274, 0.6269 }, + { 0.9246, 0.6512 }, + { 0.9218, 0.6755 }, + { 0.9190, 0.6999 }, + { 0.9162, 0.7242 }, + { 0.9134, 0.7482 }, + { 0.9107, 0.7726 }, + { 0.9079, 0.7969 }, + { 0.9051, 0.8212 }, + { 0.9023, 0.8456 }, + { 0.8995, 0.8696 }, + { 0.8967, 0.8939 }, + { 0.8939, 0.9183 }, + { 0.8911, 0.9426 }, + { 0.8883, 0.9669 }, + { 0.8856, 0.9909 }, + { 0.8828, 1.0153 }, + { 0.8800, 1.0396 }, + { 0.8772, 1.0639 }, + { 1.0074, 0.1442 }, + { 1.0046, 0.1686 }, + { 1.0018, 0.1929 }, + { 0.9990, 0.2172 }, + { 0.9962, 0.2416 }, + { 0.9935, 0.2656 }, + { 0.9907, 0.2899 }, + { 0.9879, 0.3143 }, + { 0.9851, 0.3386 }, + { 0.9823, 0.3629 }, + { 0.9795, 0.3869 }, + { 0.9767, 0.4113 }, + { 0.9739, 0.4356 }, + { 0.9711, 0.4600 }, + { 0.9683, 0.4843 }, + { 0.9656, 0.5083 }, + { 0.9628, 0.5326 }, + { 0.9600, 0.5570 }, + { 0.9572, 0.5813 }, + { 0.9544, 0.6056 }, + { 0.9516, 0.6297 }, + { 0.9488, 0.6540 }, + { 0.9461, 0.6783 }, + { 0.9433, 0.7027 }, + { 0.9405, 0.7270 }, + { 0.9377, 0.7510 }, + { 0.9349, 0.7754 }, + { 0.9321, 0.7997 }, + { 0.9293, 0.8240 }, + { 0.9265, 0.8484 }, + { 0.9238, 0.8724 }, + { 0.9210, 0.8967 }, + { 0.9182, 0.9210 }, + { 0.9154, 0.9454 }, + { 0.9126, 0.9697 }, + { 0.9098, 0.9937 }, + { 0.9070, 1.0181 }, + { 0.9042, 1.0424 }, + { 0.9014, 1.0667 }, +#endif /* ] */ + + { 0.0871, 0.0171 }, + { 0.0844, 0.0411 }, + { 0.0816, 0.0654 }, + { 0.0788, 0.0898 }, + { 0.0760, 0.1141 }, + { 0.0732, 0.1384 }, + { 0.0704, 0.1624 }, + { 0.0676, 0.1868 }, + { 0.0648, 0.2111 }, + { 0.0620, 0.2354 }, + { 0.0592, 0.2598 }, + { 0.0565, 0.2838 }, + { 0.0537, 0.3081 }, + { 0.0509, 0.3325 }, + { 0.0481, 0.3568 }, + { 0.0453, 0.3811 }, + { 0.0425, 0.4052 }, + { 0.0397, 0.4295 }, + { 0.0369, 0.4538 }, + { 0.0341, 0.4782 }, + { 0.0314, 0.5025 }, + { 0.0286, 0.5265 }, + { 0.0258, 0.5508 }, + { 0.0230, 0.5752 }, + { 0.0202, 0.5995 }, + { 0.0174, 0.6239 }, + { 0.0147, 0.6479 }, + { 0.0119, 0.6722 }, + { 0.0091, 0.6965 }, + { 0.0063, 0.7209 }, + { 0.0035, 0.7452 }, + { 0.0007, 0.7692 }, + { -0.0021, 0.7936 }, + { -0.0049, 0.8179 }, + { -0.0077, 0.8422 }, + { -0.0105, 0.8666 }, + { -0.0132, 0.8906 }, + { -0.0160, 0.9149 }, + { -0.0188, 0.9393 }, + { 0.1114, 0.0199 }, + { 0.1086, 0.0439 }, + { 0.1059, 0.0682 }, + { 0.1031, 0.0925 }, + { 0.1003, 0.1169 }, + { 0.0975, 0.1412 }, + { 0.0947, 0.1652 }, + { 0.0919, 0.1896 }, + { 0.0891, 0.2139 }, + { 0.0863, 0.2382 }, + { 0.0835, 0.2626 }, + { 0.0808, 0.2866 }, + { 0.0780, 0.3109 }, + { 0.0752, 0.3353 }, + { 0.0724, 0.3596 }, + { 0.0696, 0.3839 }, + { 0.0668, 0.4079 }, + { 0.0640, 0.4323 }, + { 0.0612, 0.4566 }, + { 0.0584, 0.4810 }, + { 0.0556, 0.5053 }, + { 0.0529, 0.5293 }, + { 0.0501, 0.5536 }, + { 0.0473, 0.5780 }, + { 0.0445, 0.6023 }, + { 0.0417, 0.6266 }, + { 0.0390, 0.6507 }, + { 0.0362, 0.6750 }, + { 0.0334, 0.6993 }, + { 0.0306, 0.7237 }, + { 0.0278, 0.7480 }, + { 0.0250, 0.7720 }, + { 0.0222, 0.7964 }, + { 0.0194, 0.8207 }, + { 0.0166, 0.8450 }, + { 0.0138, 0.8694 }, + { 0.0111, 0.8934 }, + { 0.0083, 0.9177 }, + { 0.0055, 0.9420 }, + { 0.1357, 0.0226 }, + { 0.1329, 0.0467 }, + { 0.1301, 0.0710 }, + { 0.1273, 0.0953 }, + { 0.1245, 0.1197 }, + { 0.1217, 0.1440 }, + { 0.1190, 0.1680 }, + { 0.1162, 0.1924 }, + { 0.1134, 0.2167 }, + { 0.1106, 0.2410 }, + { 0.1078, 0.2654 }, + { 0.1050, 0.2894 }, + { 0.1022, 0.3137 }, + { 0.0994, 0.3380 }, + { 0.0966, 0.3624 }, + { 0.0938, 0.3867 }, + { 0.0911, 0.4107 }, + { 0.0883, 0.4351 }, + { 0.0855, 0.4594 }, + { 0.0827, 0.4837 }, + { 0.0799, 0.5081 }, + { 0.0771, 0.5321 }, + { 0.0744, 0.5564 }, + { 0.0716, 0.5808 }, + { 0.0688, 0.6051 }, + { 0.0660, 0.6294 }, + { 0.0632, 0.6534 }, + { 0.0604, 0.6778 }, + { 0.0576, 0.7021 }, + { 0.0548, 0.7265 }, + { 0.0520, 0.7508 }, + { 0.0493, 0.7748 }, + { 0.0465, 0.7991 }, + { 0.0437, 0.8235 }, + { 0.0409, 0.8478 }, + { 0.0381, 0.8721 }, + { 0.0353, 0.8962 }, + { 0.0325, 0.9205 }, + { 0.0297, 0.9448 }, + { 0.1600, 0.0254 }, + { 0.1572, 0.0495 }, + { 0.1544, 0.0738 }, + { 0.1516, 0.0981 }, + { 0.1488, 0.1225 }, + { 0.1460, 0.1468 }, + { 0.1433, 0.1708 }, + { 0.1405, 0.1951 }, + { 0.1377, 0.2195 }, + { 0.1349, 0.2438 }, + { 0.1321, 0.2681 }, + { 0.1293, 0.2922 }, + { 0.1265, 0.3165 }, + { 0.1237, 0.3408 }, + { 0.1209, 0.3652 }, + { 0.1181, 0.3895 }, + { 0.1154, 0.4135 }, + { 0.1126, 0.4379 }, + { 0.1098, 0.4622 }, + { 0.1070, 0.4865 }, + { 0.1042, 0.5109 }, + { 0.1014, 0.5349 }, + { 0.0986, 0.5592 }, + { 0.0959, 0.5835 }, + { 0.0931, 0.6079 }, + { 0.0903, 0.6322 }, + { 0.0875, 0.6562 }, + { 0.0847, 0.6806 }, + { 0.0819, 0.7049 }, + { 0.0791, 0.7292 }, + { 0.0763, 0.7536 }, + { 0.0736, 0.7776 }, + { 0.0708, 0.8019 }, + { 0.0680, 0.8263 }, + { 0.0652, 0.8506 }, + { 0.0624, 0.8749 }, + { 0.0596, 0.8990 }, + { 0.0568, 0.9233 }, + { 0.0540, 0.9476 }, + { 0.1842, 0.0282 }, + { 0.1815, 0.0522 }, + { 0.1787, 0.0766 }, + { 0.1759, 0.1009 }, + { 0.1731, 0.1252 }, + { 0.1703, 0.1496 }, + { 0.1675, 0.1736 }, + { 0.1647, 0.1979 }, + { 0.1619, 0.2223 }, + { 0.1591, 0.2466 }, + { 0.1563, 0.2709 }, + { 0.1536, 0.2950 }, + { 0.1508, 0.3193 }, + { 0.1480, 0.3436 }, + { 0.1452, 0.3680 }, + { 0.1424, 0.3923 }, + { 0.1396, 0.4163 }, + { 0.1368, 0.4406 }, + { 0.1340, 0.4650 }, + { 0.1313, 0.4893 }, + { 0.1285, 0.5136 }, + { 0.1257, 0.5377 }, + { 0.1229, 0.5620 }, + { 0.1201, 0.5863 }, + { 0.1173, 0.6107 }, + { 0.1145, 0.6350 }, + { 0.1118, 0.6590 }, + { 0.1090, 0.6834 }, + { 0.1062, 0.7077 }, + { 0.1034, 0.7320 }, + { 0.1006, 0.7564 }, + { 0.0978, 0.7804 }, + { 0.0950, 0.8047 }, + { 0.0922, 0.8290 }, + { 0.0894, 0.8534 }, + { 0.0866, 0.8777 }, + { 0.0839, 0.9017 }, + { 0.0811, 0.9261 }, + { 0.0783, 0.9504 }, + { 0.2085, 0.0310 }, + { 0.2057, 0.0550 }, + { 0.2029, 0.0794 }, + { 0.2001, 0.1037 }, + { 0.1973, 0.1280 }, + { 0.1945, 0.1524 }, + { 0.1918, 0.1764 }, + { 0.1890, 0.2007 }, + { 0.1862, 0.2251 }, + { 0.1834, 0.2494 }, + { 0.1806, 0.2737 }, + { 0.1778, 0.2977 }, + { 0.1750, 0.3221 }, + { 0.1722, 0.3464 }, + { 0.1694, 0.3707 }, + { 0.1666, 0.3951 }, + { 0.1639, 0.4191 }, + { 0.1611, 0.4434 }, + { 0.1583, 0.4678 }, + { 0.1555, 0.4921 }, + { 0.1527, 0.5164 }, + { 0.1500, 0.5405 }, + { 0.1472, 0.5648 }, + { 0.1444, 0.5891 }, + { 0.1416, 0.6135 }, + { 0.1388, 0.6378 }, + { 0.1360, 0.6618 }, + { 0.1332, 0.6861 }, + { 0.1304, 0.7105 }, + { 0.1276, 0.7348 }, + { 0.1248, 0.7591 }, + { 0.1221, 0.7832 }, + { 0.1193, 0.8075 }, + { 0.1165, 0.8318 }, + { 0.1137, 0.8562 }, + { 0.1109, 0.8805 }, + { 0.1081, 0.9045 }, + { 0.1053, 0.9289 }, + { 0.1025, 0.9532 }, + { 0.2328, 0.0338 }, + { 0.2300, 0.0578 }, + { 0.2272, 0.0822 }, + { 0.2244, 0.1065 }, + { 0.2216, 0.1308 }, + { 0.2188, 0.1552 }, + { 0.2161, 0.1792 }, + { 0.2133, 0.2035 }, + { 0.2105, 0.2278 }, + { 0.2077, 0.2522 }, + { 0.2049, 0.2765 }, + { 0.2021, 0.3005 }, + { 0.1993, 0.3249 }, + { 0.1965, 0.3492 }, + { 0.1937, 0.3735 }, + { 0.1909, 0.3979 }, + { 0.1882, 0.4219 }, + { 0.1854, 0.4462 }, + { 0.1826, 0.4706 }, + { 0.1798, 0.4949 }, + { 0.1770, 0.5192 }, + { 0.1742, 0.5432 }, + { 0.1715, 0.5676 }, + { 0.1687, 0.5919 }, + { 0.1659, 0.6162 }, + { 0.1631, 0.6406 }, + { 0.1603, 0.6646 }, + { 0.1575, 0.6889 }, + { 0.1547, 0.7133 }, + { 0.1519, 0.7376 }, + { 0.1491, 0.7619 }, + { 0.1464, 0.7860 }, + { 0.1436, 0.8103 }, + { 0.1408, 0.8346 }, + { 0.1380, 0.8590 }, + { 0.1352, 0.8833 }, + { 0.1324, 0.9073 }, + { 0.1296, 0.9316 }, + { 0.1268, 0.9560 }, + { 0.2570, 0.0366 }, + { 0.2543, 0.0606 }, + { 0.2515, 0.0849 }, + { 0.2487, 0.1093 }, + { 0.2459, 0.1336 }, + { 0.2431, 0.1579 }, + { 0.2403, 0.1820 }, + { 0.2375, 0.2063 }, + { 0.2347, 0.2306 }, + { 0.2319, 0.2550 }, + { 0.2291, 0.2793 }, + { 0.2264, 0.3033 }, + { 0.2236, 0.3277 }, + { 0.2208, 0.3520 }, + { 0.2180, 0.3763 }, + { 0.2152, 0.4007 }, + { 0.2124, 0.4247 }, + { 0.2096, 0.4490 }, + { 0.2069, 0.4733 }, + { 0.2041, 0.4977 }, + { 0.2013, 0.5220 }, + { 0.1985, 0.5460 }, + { 0.1957, 0.5704 }, + { 0.1929, 0.5947 }, + { 0.1901, 0.6190 }, + { 0.1873, 0.6434 }, + { 0.1846, 0.6674 }, + { 0.1818, 0.6917 }, + { 0.1790, 0.7161 }, + { 0.1762, 0.7404 }, + { 0.1734, 0.7647 }, + { 0.1706, 0.7887 }, + { 0.1678, 0.8131 }, + { 0.1650, 0.8374 }, + { 0.1622, 0.8617 }, + { 0.1594, 0.8861 }, + { 0.1567, 0.9101 }, + { 0.1539, 0.9344 }, + { 0.1511, 0.9588 }, + { 0.2813, 0.0394 }, + { 0.2786, 0.0634 }, + { 0.2758, 0.0877 }, + { 0.2730, 0.1121 }, + { 0.2702, 0.1364 }, + { 0.2674, 0.1607 }, + { 0.2646, 0.1848 }, + { 0.2618, 0.2091 }, + { 0.2590, 0.2334 }, + { 0.2562, 0.2578 }, + { 0.2534, 0.2821 }, + { 0.2507, 0.3061 }, + { 0.2479, 0.3304 }, + { 0.2451, 0.3548 }, + { 0.2423, 0.3791 }, + { 0.2395, 0.4034 }, + { 0.2367, 0.4275 }, + { 0.2339, 0.4518 }, + { 0.2311, 0.4761 }, + { 0.2284, 0.5005 }, + { 0.2256, 0.5248 }, + { 0.2228, 0.5488 }, + { 0.2200, 0.5732 }, + { 0.2172, 0.5975 }, + { 0.2144, 0.6218 }, + { 0.2116, 0.6462 }, + { 0.2089, 0.6702 }, + { 0.2061, 0.6945 }, + { 0.2033, 0.7188 }, + { 0.2005, 0.7432 }, + { 0.1977, 0.7675 }, + { 0.1949, 0.7915 }, + { 0.1921, 0.8159 }, + { 0.1893, 0.8402 }, + { 0.1865, 0.8645 }, + { 0.1837, 0.8889 }, + { 0.1810, 0.9129 }, + { 0.1782, 0.9372 }, + { 0.1754, 0.9616 }, + { 0.3056, 0.0422 }, + { 0.3028, 0.0662 }, + { 0.3000, 0.0905 }, + { 0.2972, 0.1148 }, + { 0.2944, 0.1392 }, + { 0.2916, 0.1635 }, + { 0.2889, 0.1875 }, + { 0.2861, 0.2119 }, + { 0.2833, 0.2362 }, + { 0.2805, 0.2605 }, + { 0.2777, 0.2849 }, + { 0.2749, 0.3089 }, + { 0.2721, 0.3332 }, + { 0.2693, 0.3576 }, + { 0.2665, 0.3819 }, + { 0.2638, 0.4062 }, + { 0.2610, 0.4302 }, + { 0.2582, 0.4546 }, + { 0.2554, 0.4789 }, + { 0.2526, 0.5033 }, + { 0.2498, 0.5276 }, + { 0.2471, 0.5516 }, + { 0.2443, 0.5759 }, + { 0.2415, 0.6003 }, + { 0.2387, 0.6246 }, + { 0.2359, 0.6489 }, + { 0.2331, 0.6730 }, + { 0.2303, 0.6973 }, + { 0.2275, 0.7216 }, + { 0.2247, 0.7460 }, + { 0.2219, 0.7703 }, + { 0.2192, 0.7943 }, + { 0.2164, 0.8187 }, + { 0.2136, 0.8430 }, + { 0.2108, 0.8673 }, + { 0.2080, 0.8917 }, + { 0.2052, 0.9157 }, + { 0.2024, 0.9400 }, + { 0.1996, 0.9643 }, + { 0.3298, 0.0449 }, + { 0.3271, 0.0690 }, + { 0.3243, 0.0933 }, + { 0.3215, 0.1176 }, + { 0.3187, 0.1420 }, + { 0.3159, 0.1663 }, + { 0.3131, 0.1903 }, + { 0.3103, 0.2147 }, + { 0.3075, 0.2390 }, + { 0.3047, 0.2633 }, + { 0.3019, 0.2877 }, + { 0.2992, 0.3117 }, + { 0.2964, 0.3360 }, + { 0.2936, 0.3603 }, + { 0.2908, 0.3847 }, + { 0.2880, 0.4090 }, + { 0.2852, 0.4330 }, + { 0.2825, 0.4574 }, + { 0.2797, 0.4817 }, + { 0.2769, 0.5060 }, + { 0.2741, 0.5304 }, + { 0.2713, 0.5544 }, + { 0.2685, 0.5787 }, + { 0.2657, 0.6031 }, + { 0.2629, 0.6274 }, + { 0.2601, 0.6517 }, + { 0.2574, 0.6757 }, + { 0.2546, 0.7001 }, + { 0.2518, 0.7244 }, + { 0.2490, 0.7488 }, + { 0.2462, 0.7731 }, + { 0.2434, 0.7971 }, + { 0.2406, 0.8214 }, + { 0.2378, 0.8458 }, + { 0.2350, 0.8701 }, + { 0.2323, 0.8944 }, + { 0.2295, 0.9185 }, + { 0.2267, 0.9428 }, + { 0.2239, 0.9671 }, + { 0.3541, 0.0477 }, + { 0.3514, 0.0718 }, + { 0.3486, 0.0961 }, + { 0.3458, 0.1204 }, + { 0.3430, 0.1448 }, + { 0.3402, 0.1691 }, + { 0.3374, 0.1931 }, + { 0.3346, 0.2174 }, + { 0.3318, 0.2418 }, + { 0.3290, 0.2661 }, + { 0.3262, 0.2905 }, + { 0.3235, 0.3145 }, + { 0.3207, 0.3388 }, + { 0.3179, 0.3631 }, + { 0.3151, 0.3875 }, + { 0.3123, 0.4118 }, + { 0.3095, 0.4358 }, + { 0.3067, 0.4602 }, + { 0.3040, 0.4845 }, + { 0.3012, 0.5088 }, + { 0.2984, 0.5332 }, + { 0.2956, 0.5572 }, + { 0.2928, 0.5815 }, + { 0.2900, 0.6059 }, + { 0.2872, 0.6302 }, + { 0.2844, 0.6545 }, + { 0.2817, 0.6785 }, + { 0.2789, 0.7029 }, + { 0.2761, 0.7272 }, + { 0.2733, 0.7515 }, + { 0.2705, 0.7759 }, + { 0.2677, 0.7999 }, + { 0.2649, 0.8242 }, + { 0.2621, 0.8486 }, + { 0.2593, 0.8729 }, + { 0.2565, 0.8972 }, + { 0.2538, 0.9213 }, + { 0.2510, 0.9456 }, + { 0.2482, 0.9699 }, + { 0.3784, 0.0505 }, + { 0.3756, 0.0745 }, + { 0.3728, 0.0989 }, + { 0.3700, 0.1232 }, + { 0.3672, 0.1475 }, + { 0.3644, 0.1719 }, + { 0.3617, 0.1959 }, + { 0.3589, 0.2202 }, + { 0.3561, 0.2446 }, + { 0.3533, 0.2689 }, + { 0.3505, 0.2932 }, + { 0.3477, 0.3173 }, + { 0.3449, 0.3416 }, + { 0.3421, 0.3659 }, + { 0.3394, 0.3903 }, + { 0.3366, 0.4146 }, + { 0.3338, 0.4386 }, + { 0.3310, 0.4629 }, + { 0.3282, 0.4873 }, + { 0.3254, 0.5116 }, + { 0.3226, 0.5359 }, + { 0.3199, 0.5600 }, + { 0.3171, 0.5843 }, + { 0.3143, 0.6086 }, + { 0.3115, 0.6330 }, + { 0.3087, 0.6573 }, + { 0.3059, 0.6813 }, + { 0.3031, 0.7057 }, + { 0.3003, 0.7300 }, + { 0.2975, 0.7543 }, + { 0.2947, 0.7787 }, + { 0.2920, 0.8027 }, + { 0.2892, 0.8270 }, + { 0.2864, 0.8513 }, + { 0.2836, 0.8757 }, + { 0.2808, 0.9000 }, + { 0.2780, 0.9240 }, + { 0.2752, 0.9484 }, + { 0.2725, 0.9727 }, + { 0.4027, 0.0533 }, + { 0.3999, 0.0773 }, + { 0.3971, 0.1017 }, + { 0.3943, 0.1260 }, + { 0.3915, 0.1503 }, + { 0.3887, 0.1747 }, + { 0.3860, 0.1987 }, + { 0.3832, 0.2230 }, + { 0.3804, 0.2474 }, + { 0.3776, 0.2717 }, + { 0.3748, 0.2960 }, + { 0.3720, 0.3200 }, + { 0.3692, 0.3444 }, + { 0.3664, 0.3687 }, + { 0.3636, 0.3930 }, + { 0.3609, 0.4174 }, + { 0.3581, 0.4414 }, + { 0.3553, 0.4657 }, + { 0.3525, 0.4901 }, + { 0.3497, 0.5144 }, + { 0.3469, 0.5387 }, + { 0.3442, 0.5628 }, + { 0.3414, 0.5871 }, + { 0.3386, 0.6114 }, + { 0.3358, 0.6358 }, + { 0.3330, 0.6601 }, + { 0.3302, 0.6841 }, + { 0.3274, 0.7084 }, + { 0.3246, 0.7328 }, + { 0.3218, 0.7571 }, + { 0.3190, 0.7815 }, + { 0.3163, 0.8055 }, + { 0.3135, 0.8298 }, + { 0.3107, 0.8541 }, + { 0.3079, 0.8785 }, + { 0.3051, 0.9028 }, + { 0.3023, 0.9268 }, + { 0.2995, 0.9512 }, + { 0.2967, 0.9755 }, + { 0.4269, 0.0561 }, + { 0.4242, 0.0801 }, + { 0.4214, 0.1045 }, + { 0.4186, 0.1288 }, + { 0.4158, 0.1531 }, + { 0.4130, 0.1775 }, + { 0.4102, 0.2015 }, + { 0.4074, 0.2258 }, + { 0.4046, 0.2501 }, + { 0.4018, 0.2745 }, + { 0.3990, 0.2988 }, + { 0.3963, 0.3228 }, + { 0.3935, 0.3472 }, + { 0.3907, 0.3715 }, + { 0.3879, 0.3958 }, + { 0.3851, 0.4202 }, + { 0.3823, 0.4442 }, + { 0.3796, 0.4685 }, + { 0.3768, 0.4929 }, + { 0.3740, 0.5172 }, + { 0.3712, 0.5415 }, + { 0.3684, 0.5655 }, + { 0.3656, 0.5899 }, + { 0.3628, 0.6142 }, + { 0.3600, 0.6385 }, + { 0.3572, 0.6629 }, + { 0.3545, 0.6869 }, + { 0.3517, 0.7112 }, + { 0.3489, 0.7356 }, + { 0.3461, 0.7599 }, + { 0.3433, 0.7842 }, + { 0.3405, 0.8083 }, + { 0.3377, 0.8326 }, + { 0.3349, 0.8569 }, + { 0.3321, 0.8813 }, + { 0.3294, 0.9056 }, + { 0.3266, 0.9296 }, + { 0.3238, 0.9539 }, + { 0.3210, 0.9783 }, + { 0.4512, 0.0589 }, + { 0.4484, 0.0829 }, + { 0.4456, 0.1072 }, + { 0.4428, 0.1316 }, + { 0.4400, 0.1559 }, + { 0.4372, 0.1802 }, + { 0.4345, 0.2043 }, + { 0.4317, 0.2286 }, + { 0.4289, 0.2529 }, + { 0.4261, 0.2773 }, + { 0.4233, 0.3016 }, + { 0.4205, 0.3256 }, + { 0.4177, 0.3500 }, + { 0.4150, 0.3743 }, + { 0.4122, 0.3986 }, + { 0.4094, 0.4230 }, + { 0.4066, 0.4470 }, + { 0.4038, 0.4713 }, + { 0.4010, 0.4956 }, + { 0.3982, 0.5200 }, + { 0.3954, 0.5443 }, + { 0.3927, 0.5683 }, + { 0.3899, 0.5927 }, + { 0.3871, 0.6170 }, + { 0.3843, 0.6413 }, + { 0.3815, 0.6657 }, + { 0.3787, 0.6897 }, + { 0.3759, 0.7140 }, + { 0.3731, 0.7384 }, + { 0.3703, 0.7627 }, + { 0.3675, 0.7870 }, + { 0.3648, 0.8110 }, + { 0.3620, 0.8354 }, + { 0.3592, 0.8597 }, + { 0.3564, 0.8840 }, + { 0.3536, 0.9084 }, + { 0.3508, 0.9324 }, + { 0.3481, 0.9567 }, + { 0.3453, 0.9811 }, + { 0.4755, 0.0617 }, + { 0.4727, 0.0857 }, + { 0.4699, 0.1100 }, + { 0.4671, 0.1344 }, + { 0.4643, 0.1587 }, + { 0.4615, 0.1830 }, + { 0.4588, 0.2071 }, + { 0.4560, 0.2314 }, + { 0.4532, 0.2557 }, + { 0.4504, 0.2801 }, + { 0.4476, 0.3044 }, + { 0.4448, 0.3284 }, + { 0.4420, 0.3527 }, + { 0.4392, 0.3771 }, + { 0.4365, 0.4014 }, + { 0.4337, 0.4257 }, + { 0.4309, 0.4498 }, + { 0.4281, 0.4741 }, + { 0.4253, 0.4984 }, + { 0.4225, 0.5228 }, + { 0.4197, 0.5471 }, + { 0.4170, 0.5711 }, + { 0.4142, 0.5955 }, + { 0.4114, 0.6198 }, + { 0.4086, 0.6441 }, + { 0.4058, 0.6685 }, + { 0.4030, 0.6925 }, + { 0.4002, 0.7168 }, + { 0.3974, 0.7411 }, + { 0.3946, 0.7655 }, + { 0.3918, 0.7898 }, + { 0.3891, 0.8138 }, + { 0.3863, 0.8382 }, + { 0.3835, 0.8625 }, + { 0.3807, 0.8868 }, + { 0.3779, 0.9112 }, + { 0.3751, 0.9352 }, + { 0.3723, 0.9595 }, + { 0.3696, 0.9839 }, + { 0.4997, 0.0645 }, + { 0.4970, 0.0885 }, + { 0.4942, 0.1128 }, + { 0.4914, 0.1371 }, + { 0.4886, 0.1615 }, + { 0.4858, 0.1858 }, + { 0.4830, 0.2098 }, + { 0.4802, 0.2342 }, + { 0.4774, 0.2585 }, + { 0.4746, 0.2828 }, + { 0.4719, 0.3072 }, + { 0.4691, 0.3312 }, + { 0.4663, 0.3555 }, + { 0.4635, 0.3799 }, + { 0.4607, 0.4042 }, + { 0.4579, 0.4285 }, + { 0.4552, 0.4526 }, + { 0.4524, 0.4769 }, + { 0.4496, 0.5012 }, + { 0.4468, 0.5256 }, + { 0.4440, 0.5499 }, + { 0.4412, 0.5739 }, + { 0.4384, 0.5982 }, + { 0.4356, 0.6226 }, + { 0.4328, 0.6469 }, + { 0.4300, 0.6712 }, + { 0.4273, 0.6953 }, + { 0.4245, 0.7196 }, + { 0.4217, 0.7439 }, + { 0.4189, 0.7683 }, + { 0.4161, 0.7926 }, + { 0.4133, 0.8166 }, + { 0.4105, 0.8410 }, + { 0.4077, 0.8653 }, + { 0.4050, 0.8896 }, + { 0.4022, 0.9140 }, + { 0.3994, 0.9380 }, + { 0.3966, 0.9623 }, + { 0.3938, 0.9866 }, + { 0.5240, 0.0673 }, + { 0.5213, 0.0913 }, + { 0.5185, 0.1156 }, + { 0.5157, 0.1399 }, + { 0.5129, 0.1643 }, + { 0.5101, 0.1886 }, + { 0.5073, 0.2126 }, + { 0.5045, 0.2370 }, + { 0.5017, 0.2613 }, + { 0.4989, 0.2856 }, + { 0.4961, 0.3100 }, + { 0.4934, 0.3340 }, + { 0.4906, 0.3583 }, + { 0.4878, 0.3827 }, + { 0.4850, 0.4070 }, + { 0.4822, 0.4313 }, + { 0.4794, 0.4553 }, + { 0.4767, 0.4797 }, + { 0.4739, 0.5040 }, + { 0.4711, 0.5283 }, + { 0.4683, 0.5527 }, + { 0.4655, 0.5767 }, + { 0.4627, 0.6010 }, + { 0.4599, 0.6254 }, + { 0.4571, 0.6497 }, + { 0.4543, 0.6740 }, + { 0.4516, 0.6981 }, + { 0.4488, 0.7224 }, + { 0.4460, 0.7467 }, + { 0.4432, 0.7711 }, + { 0.4404, 0.7954 }, + { 0.4376, 0.8194 }, + { 0.4348, 0.8437 }, + { 0.4320, 0.8681 }, + { 0.4292, 0.8924 }, + { 0.4265, 0.9167 }, + { 0.4237, 0.9408 }, + { 0.4209, 0.9651 }, + { 0.4181, 0.9894 }, + { 0.5483, 0.0700 }, + { 0.5455, 0.0941 }, + { 0.5427, 0.1184 }, + { 0.5399, 0.1427 }, + { 0.5371, 0.1671 }, + { 0.5343, 0.1914 }, + { 0.5316, 0.2154 }, + { 0.5288, 0.2397 }, + { 0.5260, 0.2641 }, + { 0.5232, 0.2884 }, + { 0.5204, 0.3128 }, + { 0.5176, 0.3368 }, + { 0.5148, 0.3611 }, + { 0.5121, 0.3854 }, + { 0.5093, 0.4098 }, + { 0.5065, 0.4341 }, + { 0.5037, 0.4581 }, + { 0.5009, 0.4825 }, + { 0.4981, 0.5068 }, + { 0.4953, 0.5311 }, + { 0.4925, 0.5555 }, + { 0.4898, 0.5795 }, + { 0.4870, 0.6038 }, + { 0.4842, 0.6282 }, + { 0.4814, 0.6525 }, + { 0.4786, 0.6768 }, + { 0.4758, 0.7008 }, + { 0.4730, 0.7252 }, + { 0.4702, 0.7495 }, + { 0.4674, 0.7738 }, + { 0.4646, 0.7982 }, + { 0.4619, 0.8222 }, + { 0.4591, 0.8465 }, + { 0.4563, 0.8709 }, + { 0.4535, 0.8952 }, + { 0.4507, 0.9195 }, + { 0.4479, 0.9436 }, + { 0.4452, 0.9679 }, + { 0.4424, 0.9922 }, + { 0.5725, 0.0728 }, + { 0.5698, 0.0968 }, + { 0.5670, 0.1212 }, + { 0.5642, 0.1455 }, + { 0.5614, 0.1698 }, + { 0.5586, 0.1942 }, + { 0.5558, 0.2182 }, + { 0.5530, 0.2425 }, + { 0.5502, 0.2669 }, + { 0.5475, 0.2912 }, + { 0.5447, 0.3155 }, + { 0.5419, 0.3396 }, + { 0.5391, 0.3639 }, + { 0.5363, 0.3882 }, + { 0.5335, 0.4126 }, + { 0.5307, 0.4369 }, + { 0.5280, 0.4609 }, + { 0.5252, 0.4852 }, + { 0.5224, 0.5096 }, + { 0.5196, 0.5339 }, + { 0.5168, 0.5583 }, + { 0.5140, 0.5823 }, + { 0.5112, 0.6066 }, + { 0.5084, 0.6309 }, + { 0.5056, 0.6553 }, + { 0.5028, 0.6796 }, + { 0.5001, 0.7036 }, + { 0.4973, 0.7280 }, + { 0.4945, 0.7523 }, + { 0.4917, 0.7766 }, + { 0.4889, 0.8010 }, + { 0.4861, 0.8250 }, + { 0.4833, 0.8493 }, + { 0.4806, 0.8737 }, + { 0.4778, 0.8980 }, + { 0.4750, 0.9223 }, + { 0.4722, 0.9463 }, + { 0.4694, 0.9707 }, + { 0.4666, 0.9950 }, + { 0.5968, 0.0756 }, + { 0.5941, 0.0996 }, + { 0.5913, 0.1240 }, + { 0.5885, 0.1483 }, + { 0.5857, 0.1726 }, + { 0.5829, 0.1970 }, + { 0.5801, 0.2210 }, + { 0.5773, 0.2453 }, + { 0.5745, 0.2697 }, + { 0.5717, 0.2940 }, + { 0.5690, 0.3183 }, + { 0.5662, 0.3423 }, + { 0.5634, 0.3667 }, + { 0.5606, 0.3910 }, + { 0.5578, 0.4153 }, + { 0.5550, 0.4397 }, + { 0.5523, 0.4637 }, + { 0.5495, 0.4880 }, + { 0.5467, 0.5124 }, + { 0.5439, 0.5367 }, + { 0.5411, 0.5610 }, + { 0.5383, 0.5851 }, + { 0.5355, 0.6094 }, + { 0.5327, 0.6337 }, + { 0.5299, 0.6581 }, + { 0.5271, 0.6824 }, + { 0.5244, 0.7064 }, + { 0.5216, 0.7308 }, + { 0.5188, 0.7551 }, + { 0.5160, 0.7794 }, + { 0.5132, 0.8038 }, + { 0.5104, 0.8278 }, + { 0.5076, 0.8521 }, + { 0.5048, 0.8764 }, + { 0.5021, 0.9008 }, + { 0.4993, 0.9251 }, + { 0.4965, 0.9491 }, + { 0.4937, 0.9735 }, + { 0.4909, 0.9978 }, + { 0.6211, 0.0784 }, + { 0.6183, 0.1024 }, + { 0.6155, 0.1268 }, + { 0.6127, 0.1511 }, + { 0.6099, 0.1754 }, + { 0.6071, 0.1998 }, + { 0.6044, 0.2238 }, + { 0.6016, 0.2481 }, + { 0.5988, 0.2724 }, + { 0.5960, 0.2968 }, + { 0.5932, 0.3211 }, + { 0.5904, 0.3451 }, + { 0.5877, 0.3695 }, + { 0.5849, 0.3938 }, + { 0.5821, 0.4181 }, + { 0.5793, 0.4425 }, + { 0.5765, 0.4665 }, + { 0.5737, 0.4908 }, + { 0.5709, 0.5152 }, + { 0.5681, 0.5395 }, + { 0.5653, 0.5638 }, + { 0.5626, 0.5878 }, + { 0.5598, 0.6122 }, + { 0.5570, 0.6365 }, + { 0.5542, 0.6608 }, + { 0.5514, 0.6852 }, + { 0.5486, 0.7092 }, + { 0.5458, 0.7335 }, + { 0.5430, 0.7579 }, + { 0.5402, 0.7822 }, + { 0.5375, 0.8065 }, + { 0.5347, 0.8306 }, + { 0.5319, 0.8549 }, + { 0.5291, 0.8792 }, + { 0.5263, 0.9036 }, + { 0.5235, 0.9279 }, + { 0.5208, 0.9519 }, + { 0.5180, 0.9762 }, + { 0.5152, 1.0006 }, + { 0.6454, 0.0812 }, + { 0.6426, 0.1052 }, + { 0.6398, 0.1295 }, + { 0.6370, 0.1539 }, + { 0.6342, 0.1782 }, + { 0.6314, 0.2025 }, + { 0.6287, 0.2266 }, + { 0.6259, 0.2509 }, + { 0.6231, 0.2752 }, + { 0.6203, 0.2996 }, + { 0.6175, 0.3239 }, + { 0.6147, 0.3479 }, + { 0.6119, 0.3723 }, + { 0.6092, 0.3966 }, + { 0.6064, 0.4209 }, + { 0.6036, 0.4453 }, + { 0.6008, 0.4693 }, + { 0.5980, 0.4936 }, + { 0.5952, 0.5179 }, + { 0.5924, 0.5423 }, + { 0.5896, 0.5666 }, + { 0.5869, 0.5906 }, + { 0.5841, 0.6150 }, + { 0.5813, 0.6393 }, + { 0.5785, 0.6636 }, + { 0.5757, 0.6880 }, + { 0.5729, 0.7120 }, + { 0.5701, 0.7363 }, + { 0.5673, 0.7607 }, + { 0.5645, 0.7850 }, + { 0.5617, 0.8093 }, + { 0.5590, 0.8333 }, + { 0.5562, 0.8577 }, + { 0.5534, 0.8820 }, + { 0.5506, 0.9064 }, + { 0.5478, 0.9307 }, + { 0.5451, 0.9547 }, + { 0.5423, 0.9790 }, + { 0.5395, 1.0034 }, + { 0.6696, 0.0840 }, + { 0.6669, 0.1080 }, + { 0.6641, 0.1323 }, + { 0.6613, 0.1567 }, + { 0.6585, 0.1810 }, + { 0.6557, 0.2053 }, + { 0.6529, 0.2294 }, + { 0.6501, 0.2537 }, + { 0.6473, 0.2780 }, + { 0.6446, 0.3024 }, + { 0.6418, 0.3267 }, + { 0.6390, 0.3507 }, + { 0.6362, 0.3750 }, + { 0.6334, 0.3994 }, + { 0.6306, 0.4237 }, + { 0.6278, 0.4480 }, + { 0.6251, 0.4721 }, + { 0.6223, 0.4964 }, + { 0.6195, 0.5207 }, + { 0.6167, 0.5451 }, + { 0.6139, 0.5694 }, + { 0.6111, 0.5934 }, + { 0.6083, 0.6178 }, + { 0.6055, 0.6421 }, + { 0.6027, 0.6664 }, + { 0.5999, 0.6908 }, + { 0.5972, 0.7148 }, + { 0.5944, 0.7391 }, + { 0.5916, 0.7634 }, + { 0.5888, 0.7878 }, + { 0.5860, 0.8121 }, + { 0.5832, 0.8361 }, + { 0.5805, 0.8605 }, + { 0.5777, 0.8848 }, + { 0.5749, 0.9091 }, + { 0.5721, 0.9335 }, + { 0.5693, 0.9575 }, + { 0.5665, 0.9818 }, + { 0.5637, 1.0062 }, + { 0.6939, 0.0868 }, + { 0.6911, 0.1108 }, + { 0.6883, 0.1351 }, + { 0.6855, 0.1595 }, + { 0.6827, 0.1838 }, + { 0.6800, 0.2081 }, + { 0.6772, 0.2321 }, + { 0.6744, 0.2565 }, + { 0.6716, 0.2808 }, + { 0.6688, 0.3051 }, + { 0.6660, 0.3295 }, + { 0.6633, 0.3535 }, + { 0.6605, 0.3778 }, + { 0.6577, 0.4022 }, + { 0.6549, 0.4265 }, + { 0.6521, 0.4508 }, + { 0.6493, 0.4749 }, + { 0.6465, 0.4992 }, + { 0.6437, 0.5235 }, + { 0.6409, 0.5479 }, + { 0.6381, 0.5722 }, + { 0.6354, 0.5962 }, + { 0.6326, 0.6205 }, + { 0.6298, 0.6449 }, + { 0.6270, 0.6692 }, + { 0.6242, 0.6935 }, + { 0.6214, 0.7176 }, + { 0.6186, 0.7419 }, + { 0.6158, 0.7662 }, + { 0.6131, 0.7906 }, + { 0.6103, 0.8149 }, + { 0.6075, 0.8389 }, + { 0.6047, 0.8633 }, + { 0.6019, 0.8876 }, + { 0.5991, 0.9119 }, + { 0.5963, 0.9363 }, + { 0.5936, 0.9603 }, + { 0.5908, 0.9846 }, + { 0.5880, 1.0089 }, + { 0.7182, 0.0896 }, + { 0.7154, 0.1136 }, + { 0.7126, 0.1379 }, + { 0.7098, 0.1622 }, + { 0.7070, 0.1866 }, + { 0.7042, 0.2109 }, + { 0.7015, 0.2349 }, + { 0.6987, 0.2593 }, + { 0.6959, 0.2836 }, + { 0.6931, 0.3079 }, + { 0.6903, 0.3323 }, + { 0.6876, 0.3563 }, + { 0.6848, 0.3806 }, + { 0.6820, 0.4050 }, + { 0.6792, 0.4293 }, + { 0.6764, 0.4536 }, + { 0.6736, 0.4776 }, + { 0.6708, 0.5020 }, + { 0.6680, 0.5263 }, + { 0.6652, 0.5506 }, + { 0.6624, 0.5750 }, + { 0.6597, 0.5990 }, + { 0.6569, 0.6233 }, + { 0.6541, 0.6477 }, + { 0.6513, 0.6720 }, + { 0.6485, 0.6963 }, + { 0.6457, 0.7204 }, + { 0.6429, 0.7447 }, + { 0.6401, 0.7690 }, + { 0.6373, 0.7934 }, + { 0.6346, 0.8177 }, + { 0.6318, 0.8417 }, + { 0.6290, 0.8660 }, + { 0.6262, 0.8904 }, + { 0.6234, 0.9147 }, + { 0.6206, 0.9390 }, + { 0.6179, 0.9631 }, + { 0.6151, 0.9874 }, + { 0.6123, 1.0117 }, + { 0.7424, 0.0923 }, + { 0.7397, 0.1164 }, + { 0.7369, 0.1407 }, + { 0.7341, 0.1650 }, + { 0.7313, 0.1894 }, + { 0.7285, 0.2137 }, + { 0.7257, 0.2377 }, + { 0.7229, 0.2620 }, + { 0.7202, 0.2864 }, + { 0.7174, 0.3107 }, + { 0.7146, 0.3351 }, + { 0.7118, 0.3591 }, + { 0.7090, 0.3834 }, + { 0.7062, 0.4077 }, + { 0.7034, 0.4321 }, + { 0.7006, 0.4564 }, + { 0.6979, 0.4804 }, + { 0.6951, 0.5048 }, + { 0.6923, 0.5291 }, + { 0.6895, 0.5534 }, + { 0.6867, 0.5778 }, + { 0.6839, 0.6018 }, + { 0.6811, 0.6261 }, + { 0.6783, 0.6505 }, + { 0.6755, 0.6748 }, + { 0.6727, 0.6991 }, + { 0.6700, 0.7231 }, + { 0.6672, 0.7475 }, + { 0.6644, 0.7718 }, + { 0.6616, 0.7961 }, + { 0.6588, 0.8205 }, + { 0.6561, 0.8445 }, + { 0.6533, 0.8688 }, + { 0.6505, 0.8932 }, + { 0.6477, 0.9175 }, + { 0.6449, 0.9418 }, + { 0.6421, 0.9659 }, + { 0.6393, 0.9902 }, + { 0.6365, 1.0145 }, + { 0.7667, 0.0951 }, + { 0.7640, 0.1191 }, + { 0.7612, 0.1435 }, + { 0.7584, 0.1678 }, + { 0.7556, 0.1922 }, + { 0.7528, 0.2165 }, + { 0.7500, 0.2405 }, + { 0.7472, 0.2648 }, + { 0.7444, 0.2892 }, + { 0.7417, 0.3135 }, + { 0.7389, 0.3378 }, + { 0.7361, 0.3619 }, + { 0.7333, 0.3862 }, + { 0.7305, 0.4105 }, + { 0.7277, 0.4349 }, + { 0.7249, 0.4592 }, + { 0.7222, 0.4832 }, + { 0.7194, 0.5076 }, + { 0.7166, 0.5319 }, + { 0.7138, 0.5562 }, + { 0.7110, 0.5806 }, + { 0.7082, 0.6046 }, + { 0.7054, 0.6289 }, + { 0.7026, 0.6532 }, + { 0.6998, 0.6776 }, + { 0.6970, 0.7019 }, + { 0.6943, 0.7259 }, + { 0.6915, 0.7503 }, + { 0.6887, 0.7746 }, + { 0.6859, 0.7989 }, + { 0.6831, 0.8233 }, + { 0.6803, 0.8473 }, + { 0.6776, 0.8716 }, + { 0.6748, 0.8960 }, + { 0.6720, 0.9203 }, + { 0.6692, 0.9446 }, + { 0.6664, 0.9686 }, + { 0.6636, 0.9930 }, + { 0.6608, 1.0173 }, + { 0.7910, 0.0979 }, + { 0.7882, 0.1219 }, + { 0.7854, 0.1463 }, + { 0.7826, 0.1706 }, + { 0.7798, 0.1949 }, + { 0.7771, 0.2193 }, + { 0.7743, 0.2433 }, + { 0.7715, 0.2676 }, + { 0.7687, 0.2920 }, + { 0.7659, 0.3163 }, + { 0.7631, 0.3406 }, + { 0.7604, 0.3646 }, + { 0.7576, 0.3890 }, + { 0.7548, 0.4133 }, + { 0.7520, 0.4377 }, + { 0.7492, 0.4620 }, + { 0.7464, 0.4860 }, + { 0.7436, 0.5103 }, + { 0.7408, 0.5347 }, + { 0.7380, 0.5590 }, + { 0.7352, 0.5833 }, + { 0.7325, 0.6074 }, + { 0.7297, 0.6317 }, + { 0.7269, 0.6560 }, + { 0.7241, 0.6804 }, + { 0.7213, 0.7047 }, + { 0.7185, 0.7287 }, + { 0.7157, 0.7531 }, + { 0.7130, 0.7774 }, + { 0.7102, 0.8017 }, + { 0.7074, 0.8261 }, + { 0.7046, 0.8501 }, + { 0.7018, 0.8744 }, + { 0.6990, 0.8987 }, + { 0.6962, 0.9231 }, + { 0.6934, 0.9474 }, + { 0.6907, 0.9714 }, + { 0.6879, 0.9958 }, + { 0.6851, 1.0201 }, + { 0.8152, 0.1007 }, + { 0.8125, 0.1247 }, + { 0.8097, 0.1491 }, + { 0.8069, 0.1734 }, + { 0.8041, 0.1977 }, + { 0.8013, 0.2221 }, + { 0.7986, 0.2461 }, + { 0.7958, 0.2704 }, + { 0.7930, 0.2947 }, + { 0.7902, 0.3191 }, + { 0.7874, 0.3434 }, + { 0.7846, 0.3674 }, + { 0.7818, 0.3918 }, + { 0.7790, 0.4161 }, + { 0.7762, 0.4404 }, + { 0.7734, 0.4648 }, + { 0.7707, 0.4888 }, + { 0.7679, 0.5131 }, + { 0.7651, 0.5375 }, + { 0.7623, 0.5618 }, + { 0.7595, 0.5861 }, + { 0.7567, 0.6101 }, + { 0.7539, 0.6345 }, + { 0.7511, 0.6588 }, + { 0.7483, 0.6831 }, + { 0.7456, 0.7075 }, + { 0.7428, 0.7315 }, + { 0.7400, 0.7558 }, + { 0.7372, 0.7802 }, + { 0.7344, 0.8045 }, + { 0.7316, 0.8288 }, + { 0.7289, 0.8529 }, + { 0.7261, 0.8772 }, + { 0.7233, 0.9015 }, + { 0.7205, 0.9259 }, + { 0.7177, 0.9502 }, + { 0.7149, 0.9742 }, + { 0.7121, 0.9986 }, + { 0.7093, 1.0229 }, + { 0.8395, 0.1035 }, + { 0.8368, 0.1275 }, + { 0.8340, 0.1518 }, + { 0.8312, 0.1762 }, + { 0.8284, 0.2005 }, + { 0.8256, 0.2248 }, + { 0.8228, 0.2489 }, + { 0.8201, 0.2732 }, + { 0.8173, 0.2975 }, + { 0.8145, 0.3219 }, + { 0.8117, 0.3462 }, + { 0.8089, 0.3702 }, + { 0.8061, 0.3946 }, + { 0.8033, 0.4189 }, + { 0.8005, 0.4432 }, + { 0.7977, 0.4676 }, + { 0.7950, 0.4916 }, + { 0.7922, 0.5159 }, + { 0.7894, 0.5402 }, + { 0.7866, 0.5646 }, + { 0.7838, 0.5889 }, + { 0.7810, 0.6129 }, + { 0.7782, 0.6373 }, + { 0.7754, 0.6616 }, + { 0.7726, 0.6859 }, + { 0.7698, 0.7103 }, + { 0.7671, 0.7343 }, + { 0.7643, 0.7586 }, + { 0.7615, 0.7830 }, + { 0.7587, 0.8073 }, + { 0.7559, 0.8316 }, + { 0.7532, 0.8556 }, + { 0.7504, 0.8800 }, + { 0.7476, 0.9043 }, + { 0.7448, 0.9287 }, + { 0.7420, 0.9530 }, + { 0.7392, 0.9770 }, + { 0.7364, 1.0013 }, + { 0.7336, 1.0257 }, + { 0.8638, 0.1063 }, + { 0.8610, 0.1303 }, + { 0.8582, 0.1546 }, + { 0.8555, 0.1790 }, + { 0.8527, 0.2033 }, + { 0.8499, 0.2276 }, + { 0.8471, 0.2517 }, + { 0.8443, 0.2760 }, + { 0.8415, 0.3003 }, + { 0.8387, 0.3247 }, + { 0.8359, 0.3490 }, + { 0.8332, 0.3730 }, + { 0.8304, 0.3973 }, + { 0.8276, 0.4217 }, + { 0.8248, 0.4460 }, + { 0.8220, 0.4703 }, + { 0.8192, 0.4944 }, + { 0.8164, 0.5187 }, + { 0.8136, 0.5430 }, + { 0.8108, 0.5674 }, + { 0.8080, 0.5917 }, + { 0.8053, 0.6157 }, + { 0.8025, 0.6401 }, + { 0.7997, 0.6644 }, + { 0.7969, 0.6887 }, + { 0.7941, 0.7131 }, + { 0.7913, 0.7371 }, + { 0.7886, 0.7614 }, + { 0.7858, 0.7857 }, + { 0.7830, 0.8101 }, + { 0.7802, 0.8344 }, + { 0.7774, 0.8584 }, + { 0.7746, 0.8828 }, + { 0.7718, 0.9071 }, + { 0.7690, 0.9314 }, + { 0.7662, 0.9558 }, + { 0.7635, 0.9798 }, + { 0.7607, 1.0041 }, + { 0.7579, 1.0285 }, + { 0.8881, 0.1091 }, + { 0.8853, 0.1331 }, + { 0.8825, 0.1574 }, + { 0.8797, 0.1818 }, + { 0.8770, 0.2061 }, + { 0.8742, 0.2304 }, + { 0.8714, 0.2544 }, + { 0.8686, 0.2788 }, + { 0.8658, 0.3031 }, + { 0.8630, 0.3274 }, + { 0.8602, 0.3518 }, + { 0.8575, 0.3758 }, + { 0.8547, 0.4001 }, + { 0.8519, 0.4245 }, + { 0.8491, 0.4488 }, + { 0.8463, 0.4731 }, + { 0.8435, 0.4972 }, + { 0.8407, 0.5215 }, + { 0.8379, 0.5458 }, + { 0.8351, 0.5702 }, + { 0.8323, 0.5945 }, + { 0.8296, 0.6185 }, + { 0.8268, 0.6428 }, + { 0.8240, 0.6672 }, + { 0.8212, 0.6915 }, + { 0.8184, 0.7159 }, + { 0.8156, 0.7399 }, + { 0.8128, 0.7642 }, + { 0.8101, 0.7885 }, + { 0.8073, 0.8129 }, + { 0.8045, 0.8372 }, + { 0.8017, 0.8612 }, + { 0.7989, 0.8856 }, + { 0.7961, 0.9099 }, + { 0.7933, 0.9342 }, + { 0.7905, 0.9586 }, + { 0.7878, 0.9826 }, + { 0.7850, 1.0069 }, + { 0.7822, 1.0313 }, + { 0.9123, 0.1119 }, + { 0.9096, 0.1359 }, + { 0.9068, 0.1602 }, + { 0.9040, 0.1845 }, + { 0.9012, 0.2089 }, + { 0.8984, 0.2332 }, + { 0.8957, 0.2572 }, + { 0.8929, 0.2816 }, + { 0.8901, 0.3059 }, + { 0.8873, 0.3302 }, + { 0.8845, 0.3546 }, + { 0.8817, 0.3786 }, + { 0.8789, 0.4029 }, + { 0.8761, 0.4273 }, + { 0.8733, 0.4516 }, + { 0.8705, 0.4759 }, + { 0.8678, 0.4999 }, + { 0.8650, 0.5243 }, + { 0.8622, 0.5486 }, + { 0.8594, 0.5729 }, + { 0.8566, 0.5973 }, + { 0.8538, 0.6213 }, + { 0.8510, 0.6456 }, + { 0.8482, 0.6700 }, + { 0.8455, 0.6943 }, + { 0.8427, 0.7186 }, + { 0.8399, 0.7427 }, + { 0.8371, 0.7670 }, + { 0.8343, 0.7913 }, + { 0.8315, 0.8157 }, + { 0.8287, 0.8400 }, + { 0.8260, 0.8640 }, + { 0.8232, 0.8883 }, + { 0.8204, 0.9127 }, + { 0.8176, 0.9370 }, + { 0.8148, 0.9614 }, + { 0.8120, 0.9854 }, + { 0.8092, 1.0097 }, + { 0.8064, 1.0340 }, + { 0.9366, 0.1146 }, + { 0.9338, 0.1387 }, + { 0.9311, 0.1630 }, + { 0.9283, 0.1873 }, + { 0.9255, 0.2117 }, + { 0.9227, 0.2360 }, + { 0.9199, 0.2600 }, + { 0.9171, 0.2844 }, + { 0.9143, 0.3087 }, + { 0.9115, 0.3330 }, + { 0.9087, 0.3574 }, + { 0.9060, 0.3814 }, + { 0.9032, 0.4057 }, + { 0.9004, 0.4300 }, + { 0.8976, 0.4544 }, + { 0.8948, 0.4787 }, + { 0.8920, 0.5027 }, + { 0.8892, 0.5271 }, + { 0.8864, 0.5514 }, + { 0.8836, 0.5757 }, + { 0.8808, 0.6001 }, + { 0.8781, 0.6241 }, + { 0.8753, 0.6484 }, + { 0.8725, 0.6728 }, + { 0.8697, 0.6971 }, + { 0.8669, 0.7214 }, + { 0.8642, 0.7454 }, + { 0.8614, 0.7698 }, + { 0.8586, 0.7941 }, + { 0.8558, 0.8184 }, + { 0.8530, 0.8428 }, + { 0.8502, 0.8668 }, + { 0.8474, 0.8911 }, + { 0.8446, 0.9155 }, + { 0.8418, 0.9398 }, + { 0.8390, 0.9641 }, + { 0.8363, 0.9882 }, + { 0.8335, 1.0125 }, + { 0.8307, 1.0368 }, + { 0.9581, 0.1414 }, + { 0.9553, 0.1658 }, + { 0.9526, 0.1901 }, + { 0.9498, 0.2145 }, + { 0.9470, 0.2388 }, + { 0.9442, 0.2628 }, + { 0.9414, 0.2871 }, + { 0.9386, 0.3115 }, + { 0.9358, 0.3358 }, + { 0.9330, 0.3601 }, + { 0.9303, 0.3842 }, + { 0.9275, 0.4085 }, + { 0.9247, 0.4328 }, + { 0.9219, 0.4572 }, + { 0.9191, 0.4815 }, + { 0.9163, 0.5055 }, + { 0.9135, 0.5299 }, + { 0.9107, 0.5542 }, + { 0.9079, 0.5785 }, + { 0.9051, 0.6029 }, + { 0.9024, 0.6269 }, + { 0.8996, 0.6512 }, + { 0.8968, 0.6755 }, + { 0.8940, 0.6999 }, + { 0.8912, 0.7242 }, + { 0.8884, 0.7482 }, + { 0.8857, 0.7726 }, + { 0.8829, 0.7969 }, + { 0.8801, 0.8212 }, + { 0.8773, 0.8456 }, + { 0.8745, 0.8696 }, + { 0.8717, 0.8939 }, + { 0.8689, 0.9183 }, + { 0.8661, 0.9426 }, + { 0.8633, 0.9669 }, + { 0.8606, 0.9909 }, + { 0.8578, 1.0153 }, + { 0.8550, 1.0396 }, + { 0.8522, 1.0639 }, +}; + diff --git a/src/osgPlugins/fly/trees.cpp b/src/osgPlugins/fly/trees.cpp new file mode 100644 index 000000000..0478533af --- /dev/null +++ b/src/osgPlugins/fly/trees.cpp @@ -0,0 +1,265 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#include "hat.h" + +#ifdef WIN32 +#pragma warning( disable : 4244 ) +#pragma warning( disable : 4305 ) +#endif + +using namespace osg; + +#define sqr(x) ((x)*(x)) + +extern void getDatabaseCenterRadius( float dbcenter[3], float *dbradius ); + +static float dbcenter[3], dbradius; + +static struct _tree{ + int n; + float x, y, z; + float w, h; +}trees[] = { + { 0, -0.4769, -0.8972, -0.4011, 0.2000, 0.1200 }, + { 1, -0.2543, -0.9117, -0.3873, 0.2000, 0.1200 }, + { 2, -0.0424, -0.8538, -0.3728, 0.2000, 0.1200 }, + { 3, 0.1590, -0.8827, -0.3594, 0.2000, 0.1200 }, + { 4, -0.4981, -1.0853, -0.4016, 0.3500, 0.1200 }, + { 5, -0.5405, -1.2590, -0.4050, 0.2000, 0.1200 }, + { 6, -0.5723, -1.5339, -0.4152, 0.2000, 0.1200 }, + { 7, -0.6252, -1.8667, -0.4280, 0.2000, 0.1200 }, + { 8, -0.5617, -2.1851, -0.4309, 0.2000, 0.1200 }, + { 9, -0.5087, -2.4166, -0.4215, 0.2000, 0.1200 }, + { 10, -0.4345, -2.3443, -0.4214, 0.2000, 0.1200 }, + { 11, -3.0308, -1.5484, -0.4876, 0.2000, 0.1200 }, + { 12, -3.0202, -1.6497, -0.4963, 0.2000, 0.1200 }, + { 13, -2.9355, -1.8378, -0.4969, 0.2000, 0.1200 }, + { 14, -0.6040, -2.0259, -0.4300, 0.2000, 0.1200 }, + { 15, -0.5442, -1.3442, -0.4080, 0.1000, 0.1200 }, + { 16, -0.5639, -1.6885, -0.4201, 0.1000, 0.1200 }, + { 17, 0.9246, 3.4835, 0.5898, 0.2500, 0.1000 }, + { 18, 0.0787, 3.8687, 0.3329, 0.2500, 0.1200 }, + { 19, 0.2885, 3.7130, 0.4047, 0.2500, 0.1200 }, + { 20, 0.2033, 3.6228, 0.3704, 0.2500, 0.1200 }, + { 21, -0.2098, 3.9015, 0.2327, 0.2500, 0.1200 }, + { 22, -0.3738, 3.7376, 0.1722, 0.2500, 0.1200 }, + { 23, -0.2557, 3.6064, 0.1989, 0.2500, 0.1200 }, + { 24, 0.0590, 3.7294, 0.3210, 0.2500, 0.1200 }, + { 25, -0.4721, 3.8851, 0.1525, 0.2500, 0.1200 }, + { 26, 0.9639, 3.2048, 0.5868, 0.1200, 0.0800 }, + { 27, 0.7082, -1.0409, -0.3221, 0.1000, 0.1000 }, + { 28, -0.2426, -2.3442, -0.4150, 0.1000, 0.1380 }, + { 29, -0.1770, -2.4179, -0.4095, 0.1000, 0.1580 }, + { 30, -0.0852, -2.5327, -0.4056, 0.1000, 0.1130 }, + { 31, -0.0131, -2.6065, -0.4031, 0.1000, 0.1150 }, + { 32, 0.0787, -2.6638, -0.4012, 0.1000, 0.1510 }, + { 33, 0.1049, -2.7622, -0.3964, 0.1000, 0.1270 }, + { 34, 0.1770, -2.8687, -0.3953, 0.1000, 0.1100 }, + { 35, 0.3213, -2.9507, -0.3974, 0.1000, 0.1190 }, + { 36, 0.4065, -3.0163, -0.4014, 0.1000, 0.1120 }, + { 37, 0.3738, -3.1802, -0.4025, 0.1000, 0.1860 }, + { 38, 0.5508, -3.2048, -0.3966, 0.1000, 0.1490 }, + { 39, 0.5836, -3.3031, -0.3900, 0.1000, 0.1670 }, + { 40, -0.3082, -2.7212, -0.3933, 0.1000, 0.1840 }, + { 41, -0.1967, -2.6474, -0.4017, 0.1000, 0.1600 }, + { 42, -0.1180, -2.7458, -0.3980, 0.1000, 0.1250 }, + { 43, -0.3344, -2.8359, -0.3964, 0.1000, 0.1430 }, + { 44, -0.2492, -2.8933, -0.3838, 0.1000, 0.1890 }, + { 45, -0.1246, -3.0491, -0.3768, 0.1000, 0.1830 }, + { 46, 0.0000, -3.0818, -0.3696, 0.1000, 0.1370 }, + { 47, -0.2295, -3.0409, -0.3706, 0.1000, 0.1660 }, + { 48, -1.3245, 2.6638, 0.0733, 0.0500, 0.0500 }, + { 49, 2.2425, -1.5491, -0.2821, 0.2300, 0.1200 }, + { 50, 0.2164, -2.1311, -0.4000, 0.1000, 0.0690 }, + { 51, 0.2885, -2.2130, -0.4000, 0.1000, 0.0790 }, + { 52, 0.3606, -2.2786, -0.4000, 0.1000, 0.0565 }, + { 53, 0.4328, -2.3442, -0.4000, 0.1000, 0.0575 }, + { 54, 0.5246, -2.4343, -0.4086, 0.1000, 0.0755 }, + { 55, 0.6360, -2.5245, -0.4079, 0.1000, 0.0635 }, + { 56, 0.7541, -2.4261, -0.4007, 0.1000, 0.0550 }, + { 57, 0.7934, -2.2786, -0.3944, 0.1000, 0.0595 }, + { 58, 1.0295, -2.2868, -0.3837, 0.1000, 0.0560 }, + { 59, 0.8459, -2.6474, -0.4051, 0.1000, 0.0930 }, + { 60, 1.0426, -2.6884, -0.4001, 0.1000, 0.0745 }, + { 61, 1.1475, -2.7458, -0.3883, 0.1000, 0.0835 }, + { 62, -0.1967, -1.4180, -0.3988, 0.1000, 0.0920 }, + { 63, -0.0131, -1.2704, -0.3856, 0.1000, 0.0690 }, + { 64, 0.2098, -1.2049, -0.3664, 0.1000, 0.0790 }, + { 65, 0.3410, -1.3196, -0.3652, 0.1000, 0.0565 }, + { 66, 0.5705, -1.2704, -0.3467, 0.1000, 0.0575 }, + { 67, 0.6360, -1.4344, -0.3532, 0.1000, 0.0755 }, + { 68, 0.9246, -1.4180, -0.3329, 0.1000, 0.0635 }, + { 69, 1.0623, -1.3360, -0.3183, 0.1000, 0.0550 }, + { 70, 1.2393, -1.3934, -0.3103, 0.1000, 0.0595 }, + { 71, 1.3639, -1.4753, -0.3079, 0.1000, 0.0560 }, + { 72, 1.4819, -1.5983, -0.3210, 0.1000, 0.0930 }, + { 73, 1.7835, -1.5819, -0.3065, 0.1000, 0.0745 }, + { 74, 1.9343, -2.1065, -0.3307, 0.1000, 0.0835 }, + { 75, 2.1245, -2.3196, -0.3314, 0.1000, 0.0920 }, + { 76, 2.2556, -2.3032, -0.3230, 0.1000, 0.0800 }, + { 77, 2.4196, -2.3688, -0.3165, 0.1000, 0.0625 }, + { 78, 1.7835, -2.5327, -0.3543, 0.1000, 0.0715 }, + { 79, 1.7180, -2.8933, -0.3742, 0.1000, 0.0945 }, + { 80, 1.9343, -3.0409, -0.3727, 0.1000, 0.0915 }, + { 81, 2.4524, -3.4671, -0.3900, 0.1000, 0.0685 }, + { 82, 2.4786, -2.8851, -0.3538, 0.1000, 0.0830 }, + { 83, 2.3343, -2.6228, -0.3420, 0.1000, 0.0830 }, + { 84, 2.8130, -2.0737, -0.2706, 0.1000, 0.0890 }, + { 85, 2.6360, -1.8278, -0.2661, 0.1000, 0.0975 }, + { 86, 2.3958, -1.7130, -0.2774, 0.2000, 0.1555 }, + { 87, 2.2688, -1.2868, -0.2646, 0.1000, 0.0835 }, + { 88, 2.4196, -1.1147, -0.2486, 0.1000, 0.0770 }, + { 89, 2.7802, -2.3933, -0.3017, 0.1000, 0.0655 }, + { 90, 3.0163, -2.4179, -0.2905, 0.1000, 0.0725 }, + { 91, 2.9310, -2.2540, -0.2798, 0.1000, 0.0910 }, + { 92, 2.6622, -2.0983, -0.2823, 0.1000, 0.0680 }, + { 93, 2.3147, -1.9753, -0.2973, 0.1000, 0.0620 }, + { 94, 2.1573, -1.8770, -0.3013, 0.1000, 0.0525 }, + { 95, 2.0196, -1.7868, -0.3044, 0.1000, 0.0970 }, + { 96, 2.7802, -3.3031, -0.3900, 0.1000, 0.0510 }, + { 97, 2.8589, -3.1720, -0.3900, 0.1000, 0.0755 }, + { 98, 3.0163, -2.8114, -0.3383, 0.1000, 0.0835 }, + { 99, 3.5081, -2.4179, -0.2558, 0.1000, 0.0770 }, + { 100, 3.5277, -2.3196, -0.2366, 0.1000, 0.0765 }, + { 101, 3.6654, -2.5819, -0.2566, 0.1000, 0.0805 }, + { 102, 3.7179, -2.7622, -0.2706, 0.1000, 0.0980 }, + { 103, 3.7769, -2.4671, -0.2339, 0.1000, 0.0640 }, + { 104, 3.3441, -2.4671, -0.2693, 0.1000, 0.0940 }, + { -1, 0, 0, 0, 0, 0 }, +}; + + +static GeoSet *makeTree( _tree *tree, GeoState *gstate ) +{ + float vv[][3] = { + { -tree->w/2.0, 0.0, 0.0 }, + { tree->w/2.0, 0.0, 0.0 }, + { tree->w/2.0, 0.0, 2 * tree->h }, + { -tree->w/2.0, 0.0, 2 * tree->h }, + }; + + Vec3 *v = new Vec3[4]; + Vec2 *t = new Vec2[4]; + Vec4 *l = new Vec4[1]; + + int i; + + l[0][0] = l[0][1] = l[0][2] = l[0][3] = 1; + + for( i = 0; i < 4; i++ ) + { + v[i][0] = vv[i][0]; + v[i][1] = vv[i][1]; + v[i][2] = vv[i][2]; + } + + + + + t[0][0] = 0.0; t[0][1] = 0.0; + t[1][0] = 1.0; t[1][1] = 0.0; + t[2][0] = 1.0; t[2][1] = 1.0; + t[3][0] = 0.0; t[3][1] = 1.0; + + GeoSet *gset = new GeoSet; + + gset->setCoords( v ); + + gset->setTextureCoords( t ); + gset->setTextureBinding( GeoSet::BIND_PERVERTEX ); + + gset->setColors( l ); + gset->setColorBinding( GeoSet::BIND_OVERALL ); + + gset->setPrimType( GeoSet::QUADS ); + gset->setNumPrims( 1 ); + + gset->setGeoState( gstate ); + + return gset; +} + +static float ttx, tty; + +static int ct( const void *a, const void *b ) +{ + _tree *ta = (_tree *)a; + _tree *tb = (_tree *)b; + + float da = sqrtf( sqr(ta->x - ttx) + sqr(ta->y - tty) ); + float db = sqrtf( sqr(tb->x - ttx) + sqr(tb->y - tty) ); + + if( da < db ) + return -1; + else + return 1; +} + +Node *makeTrees( void ) +{ + Group *group = new Group; + int i; + + getDatabaseCenterRadius( dbcenter, &dbradius ); + struct _tree *t; + + Texture *tex = new Texture; + tex->setImage(Registry::instance()->readImage("tree0.rgba")); + + GeoState *gstate = new GeoState; + gstate->setMode( GeoState::TEXTURE, GeoState::ON ); + gstate->setAttribute( GeoState::TEXTURE, tex ); + gstate->setAttribute( GeoState::TEXENV, new TexEnv ); + + + AlphaFunc* alphaFunc = new AlphaFunc; + alphaFunc->setFunction(AlphaFunc::GEQUAL,0.1f); + gstate->setMode( GeoState::ALPHAFUNC, GeoState::ON ); + gstate->setAttribute( GeoState::ALPHAFUNC, alphaFunc ); + + gstate->setMode( GeoState::LIGHTING, GeoState::OFF ); + + int tt[] = { 15, 30, 45, 58, 72, 75, 93, 96, 105, -1 }; + int *ttp = tt; + + i = 0; + while( i < 105 ) + { + ttx = trees[i].x; + tty = trees[i].y; + qsort( &trees[i], 105 - i, sizeof( _tree ), ct ); + + i += *ttp; + ttp++; + } + + t = trees; + i = 0; + ttp = tt; + while( *ttp != -1 ) + { + Billboard *bb = new Billboard; + //int starti = i; + + for( ; i < (*ttp); i++ ) + { + t->x -= 0.3f; + float h = Hat(t->x, t->y, t->z ); + Vec3 pos( t->x, t->y, t->z-h ); + GeoSet *gset = makeTree( t, gstate ); + bb->addGeoSet( gset, pos ); + t++; + } + group->addChild( bb ); + ttp++; + } + + return group; +} diff --git a/src/osgPlugins/fly/vector.cpp b/src/osgPlugins/fly/vector.cpp new file mode 100644 index 000000000..981accfe2 --- /dev/null +++ b/src/osgPlugins/fly/vector.cpp @@ -0,0 +1,138 @@ +#include +#include +#include +#include +#include "vector.h" + +#ifdef WIN32 +#pragma warning( disable : 4244 ) +#pragma warning( disable : 4305 ) +#endif + +#define SET_VEC( v, a, b, c ) v->x = (a); v->y = (b); v->z = (c) + +Vector NewVector( void ) +{ + Vector temp; + + temp = (Vector)calloc( 1, sizeof( struct _vector ) ); + + SET_VEC( temp, 0., 0., 0. ); + + return temp; +} + +void DeleteVector( Vector v ) +{ + SET_VEC( v, 0., 0., 0. ); + free( v ); +} + +void VectorSet( Vector v, float a, float b, float c ) +{ + SET_VEC( v, a, b, c ); +} + +void VectorGet( Vector v, float *a, float *b, float *c ) +{ + *a = v->x; + *b = v->y; + *c = v->z; +} + +float VectorDotProduct( Vector p, Vector q ) +{ + return (p->x * p->x) + (p->y * p->y) + (p->z * p->z); +} + + +void VectorNormalize( Vector v ) +{ + float f; + + f = sqrt( (v->x*v->x)+(v->y*v->y)+(v->z*v->z)); + + if( f == 0.0 ) + v->x = v->y = v->z = 0.0; + else + { + v->x /= f; + v->y /= f; + v->z /= f; + } +} + +void VectorCrossProduct(Vector v1, Vector v2, Vector prod) +{ + struct _vector p; /* in case prod == v1 or v2 */ + + p.x = v1->y*v2->z - v2->y*v1->z; + p.y = v1->z*v2->x - v2->z*v1->x; + p.z = v1->x*v2->y - v2->x*v1->y; + prod->x = p.x; prod->y = p.y; prod->z = p.z; +} + +void VectorAdd( Vector v1, Vector v2, Vector sum ) +{ + sum->x = v1->x + v2->x; + sum->y = v1->y + v2->y; + sum->z = v1->z + v2->z; +} + +void VectorDiff( Vector v1, Vector v2, Vector diff ) +{ + diff->x = v1->x - v2->x; + diff->y = v1->y - v2->y; + diff->z = v1->z - v2->z; +} + +float VectorAngle( Vector v1, Vector v2 ) +{ + float d; + float f1, f2; + + d = ((v1->x*v2->x) + (v1->y*v2->y) + (v1->z*v2->z)); + + f1 = sqrt( (v1->x*v1->x) + (v1->y *v1->y) + (v1->z*v1->z) ); + f2 = sqrt( (v2->x*v2->x) + (v2->y *v2->y) + (v2->z*v2->z) ); + + if( f1*f2 == 0.0 ) return 0.0; + + return acos( d/(f1*f2) ); +} + +char * VectorToA( Vector v, char *ptr, int size ) +{ + char buff[512]; + + sprintf( buff, "%12.4f %12.4f %12.4f", v->x, v->y, v->z ); + + strncpy( ptr, buff, size ); + + return ptr; +} + +float VectorMagnitude( Vector v ) +{ + return sqrt( (v->x*v->x) + (v->y *v->y) + (v->z*v->z) ); +} + +void VectorMagnify( Vector v, float magnitude, Vector res ) +{ + float x; + float d; + + x = magnitude; + d = sqrt( (v->x*v->x) + (v->y*v->y) + (v->z*v->z) ); + + if( d == 0.0 ) + { + res->x = res->y = res->z = 0.0; + } + else + { + res->x = x * v->x/d; + res->y = x * v->y/d; + res->z = x * v->z/d; + } +} diff --git a/src/osgPlugins/fly/vector.h b/src/osgPlugins/fly/vector.h new file mode 100644 index 000000000..1b8edc59a --- /dev/null +++ b/src/osgPlugins/fly/vector.h @@ -0,0 +1,27 @@ +#ifndef __VECTOR_H +#define __VECTOR_H + + +struct _vector { + float x, y, z; +}; + +typedef struct _vector *Vector; +typedef struct _vector sgvector; + +extern Vector NewVector( void ); +extern void DeleteVector( Vector v ); +extern void VectorSet( Vector v, float a, float b, float c ); +extern void VectorGet( Vector v, float *a, float *b, float *c ); +extern float VectorDotProduct( Vector p, Vector q ); +extern void VectorCrossProduct(Vector v1, Vector v2, Vector prod); +extern void VectorAdd( Vector v1, Vector v2, Vector diff ); +extern void VectorDiff( Vector v1, Vector v2, Vector diff ); +extern void VectorNormalize( Vector v ); +extern float VectorAngle( Vector v1, Vector v2 ); +extern char * VectorToA( Vector v, char *cptr, int size ); +extern float VectorMagnitude( Vector v ); +extern void VectorMagnify( Vector v, float magnitude, Vector res ); + + +#endif diff --git a/src/osgPlugins/gif/Makedepend b/src/osgPlugins/gif/Makedepend new file mode 100644 index 000000000..e69de29bb diff --git a/src/osgPlugins/gif/Makefile b/src/osgPlugins/gif/Makefile new file mode 100644 index 000000000..ca33b997e --- /dev/null +++ b/src/osgPlugins/gif/Makefile @@ -0,0 +1,19 @@ +#!smake +include ../../../Make/makedefs + +C++FILES = \ + ReaderWriterGIF.cpp\ + +LIB = ../../../lib/osgPlugins/osgdb_gif.so + +TARGET_LOADER_FILES = osgPlugins/osgdb_gif.so + +LIBS = -lungif + +C++FLAGS += -I. -I../../../include +LDFLAGS += -L../../../lib + +include ../../../Make/makerules + + + diff --git a/src/osgPlugins/gif/ReaderWriterGIF.cpp b/src/osgPlugins/gif/ReaderWriterGIF.cpp new file mode 100644 index 000000000..50e0b916a --- /dev/null +++ b/src/osgPlugins/gif/ReaderWriterGIF.cpp @@ -0,0 +1,348 @@ +#include +#include +#include +#include +#include +#include +#include + +#include + +/**************************************************************************** + * + * Follows is code extracted from the simage library. Original Authors: + * + * Systems in Motion, + * + * + * Peder Blekken + * Morten Eriksen + * Marius Bugge Monsen + * + * The original COPYING notice + * + * All files in this library are public domain, except simage_rgb.cpp which is + * Copyright (c) Mark J Kilgard . I will contact Mark + * very soon to hear if this source also can become public domain. + * + * Please send patches for bugs and new features to: . + * + * Peder Blekken + * + * + * Ported into the OSG as a plugin, Robert Osfield Decemeber 2000. + * Note, reference above to license of simage_rgb is not relevent to the OSG + * as the OSG does not use it. Also for patches, bugs and new features + * please send them direct to the OSG dev team rather than address above. + * + **********************************************************************/ + +/*! + GIF loader, using libungif + Based, in part, on source code found in libungif, gif2rgb.c +*/ +#include +#include +#include + +extern "C" { +#include +}; + +#define ERR_NO_ERROR 0 +#define ERR_OPEN 1 +#define ERR_READ 2 +#define ERR_MEM 3 + +#define MY_GIF_DEBUG 1 + +static int giferror = ERR_NO_ERROR; + +int +simage_gif_error(char * buffer, int buflen) +{ + switch (giferror) { + case ERR_OPEN: + strncpy(buffer, "GIF loader: Error opening file", buflen); + break; + case ERR_READ: + strncpy(buffer, "GIF loader: Error reading file", buflen); + break; + case ERR_MEM: + strncpy(buffer, "GIF loader: Out of memory error", buflen); + break; + } + return giferror; +} + +int +simage_gif_identify(const char *filename, + const unsigned char *header, + int headerlen) +{ + static unsigned char gifcmp[] = {'G', 'I', 'F'}; + if (headerlen < 3) return 0; + if (memcmp((const void*)header, + (const void*)gifcmp, 3) == 0) return 1; + return 0; +} + +static void +decode_row(GifFileType * giffile, + unsigned char * buffer, + unsigned char * rowdata, + int x, int y, int len, + int transparent) +{ + GifColorType * cmentry; + ColorMapObject * colormap; + int colormapsize; + unsigned char col; + unsigned char * ptr; + y = giffile->SHeight - (y+1); + ptr = buffer + (giffile->SWidth * y + x) * 4; + + colormap = (giffile->Image.ColorMap + ? giffile->Image.ColorMap + : giffile->SColorMap); + colormapsize = colormap ? colormap->ColorCount : 255; + + while (len--) { + col = *rowdata++; + if (col >= colormapsize) col = 0; /* just in case */ + cmentry = colormap ? &colormap->Colors[col] : NULL; + if (cmentry) { + *ptr++ = cmentry->Red; + *ptr++ = cmentry->Green; + *ptr++ = cmentry->Blue; + } + else { + *ptr++ = col; + *ptr++ = col; + *ptr++ = col; + } + *ptr++ = (col == transparent ? 0x00 : 0xff); + } +} + +unsigned char * +simage_gif_load(const char *filename, + int *width_ret, + int *height_ret, + int *numComponents_ret) +{ + int i, j, n, row, col, width, height, extcode; + unsigned char * rowdata; + unsigned char * buffer, * ptr; + unsigned char bg; + int transparent; + GifRecordType recordtype; + GifByteType * extension; + GifFileType * giffile; + GifColorType * bgcol; + + /* The way an interlaced image should be read - offsets and jumps */ + int interlacedoffset[] = { 0, 4, 2, 1 }; + int interlacedjumps[] = { 8, 8, 4, 2 }; + + giffile = DGifOpenFileName(filename); + if (!giffile) { + giferror = ERR_OPEN; + return NULL; + } + + transparent = -1; /* no transparent color by default */ + + n = giffile->SHeight * giffile->SWidth; + buffer = (unsigned char *)malloc(n * 4); + if (!buffer) { + giferror = ERR_MEM; + return NULL; + } + rowdata = (unsigned char *)malloc(giffile->SWidth); + if (!rowdata) { + giferror = ERR_MEM; + free(buffer); + return NULL; + } + + bg = giffile->SBackGroundColor; + if (giffile->SColorMap && bg < giffile->SColorMap->ColorCount) { + bgcol = &giffile->SColorMap->Colors[bg]; + } + else bgcol = NULL; + ptr = buffer; + for (i = 0; i < n; i++) { + if (bgcol) { + *ptr++ = bgcol->Red; + *ptr++ = bgcol->Green; + *ptr++ = bgcol->Blue; + *ptr++ = 0xff; + } + else { + *ptr++ = 0x00; + *ptr++ = 0x00; + *ptr++ = 0x00; + *ptr++ = 0xff; + } + } + + /* Scan the content of the GIF file and load the image(s) in: */ + do { + if (DGifGetRecordType(giffile, &recordtype) == GIF_ERROR) { + giferror = ERR_READ; + free(buffer); + free(rowdata); + return NULL; + } + switch (recordtype) { + case IMAGE_DESC_RECORD_TYPE: + if (DGifGetImageDesc(giffile) == GIF_ERROR) { + giferror = ERR_READ; + free(buffer); + free(rowdata); + return NULL; + } + row = giffile->Image.Top; /* subimage position in composite image */ + col = giffile->Image.Left; + width = giffile->Image.Width; + height = giffile->Image.Height; + if (giffile->Image.Left + giffile->Image.Width > giffile->SWidth || + giffile->Image.Top + giffile->Image.Height > giffile->SHeight) { + /* image is not confined to screen dimension */ + giferror = ERR_READ; + free(buffer); + free(rowdata); + return NULL; + } + if (giffile->Image.Interlace) { + fprintf(stderr,"interlace\n"); + /* Need to perform 4 passes on the images: */ + for (i = 0; i < 4; i++) { + for (j = row + interlacedoffset[i]; j < row + height; + j += interlacedjumps[i]) { + if (DGifGetLine(giffile, rowdata, width) == GIF_ERROR) { + giferror = ERR_READ; + free(buffer); + free(rowdata); + return NULL; + } + else decode_row(giffile, buffer, rowdata, col, j, width, transparent); + } + } + } + else { + for (i = 0; i < height; i++, row++) { + if (DGifGetLine(giffile, rowdata, width) == GIF_ERROR) { + giferror = ERR_READ; + free(buffer); + free(rowdata); + return NULL; + } + else decode_row(giffile, buffer, rowdata, col, row, width, transparent); + } + } + break; + case EXTENSION_RECORD_TYPE: + /* Skip any extension blocks in file: */ + if (DGifGetExtension(giffile, &extcode, &extension) == GIF_ERROR) { + giferror = ERR_READ; + free(buffer); + free(rowdata); + return NULL; + } + /* transparent test from the gimp gif-plugin. Open Source rulez! */ + else if (extcode == 0xf9) { + if (extension[0] >= 4 && extension[1] & 0x1) transparent = extension[4]; + else transparent = -1; + } + while (extension != NULL) { + if (DGifGetExtensionNext(giffile, &extension) == GIF_ERROR) { + giferror = ERR_READ; + free(buffer); + free(rowdata); + return NULL; + } + } + break; + case TERMINATE_RECORD_TYPE: + break; + default: /* Should be trapped by DGifGetRecordType. */ + break; + } + } + while (recordtype != TERMINATE_RECORD_TYPE); + + free(rowdata); + *width_ret = giffile->SWidth; + *height_ret = giffile->SHeight; + *numComponents_ret = 4; + DGifCloseFile(giffile); + return buffer; +} + + + +class ReaderWriterGIF : public osg::ReaderWriter +{ + public: + virtual const char* className() { return "GIF Image Reader"; } + virtual bool acceptsExtension(const std::string& extension) { return extension=="gif"; } + + virtual osg::Node* readNode(const std::string& fileName) + { + osg::Image* image = readImage(fileName); + if (image) + { + osg::Geode* geode = osg::createGeodeForImage(image); + if (geode==NULL) image->unref(); + return geode; + } + else + { + return NULL; + } + } + + virtual osg::Image* readImage(const std::string& fileName) + { + + unsigned char *imageData = NULL; + int width_ret; + int height_ret; + int numComponents_ret; + + imageData = simage_gif_load(fileName.c_str(),&width_ret,&height_ret,&numComponents_ret); + + if (imageData==NULL) return NULL; + + int s = width_ret; + int t = height_ret; + int r = 1; + + int internalFormat = numComponents_ret; + + unsigned int pixelFormat = + numComponents_ret == 1 ? GL_LUMINANCE : + numComponents_ret == 2 ? GL_LUMINANCE_ALPHA : + numComponents_ret == 3 ? GL_RGB : + numComponents_ret == 4 ? GL_RGBA : (GLenum)-1; + + unsigned int dataType = GL_UNSIGNED_BYTE; + + osg::Image* pOsgImage = new osg::Image; + pOsgImage->setFileName(fileName.c_str()); + pOsgImage->setImage(s,t,r, + internalFormat, + pixelFormat, + dataType, + imageData); + + return pOsgImage; + + } +}; + +// now register with Registry to instantiate the above +// reader/writer. +osg::RegisterReaderWriterProxy g_readerWriter_GIF_Proxy; diff --git a/src/osgPlugins/jpeg/Makedepend b/src/osgPlugins/jpeg/Makedepend new file mode 100644 index 000000000..e69de29bb diff --git a/src/osgPlugins/jpeg/Makefile b/src/osgPlugins/jpeg/Makefile new file mode 100644 index 000000000..d8691dc1a --- /dev/null +++ b/src/osgPlugins/jpeg/Makefile @@ -0,0 +1,18 @@ +#!smake +include ../../../Make/makedefs + +C++FILES = \ + ReaderWriterJPEG.cpp\ + +LIB = ../../../lib/osgPlugins/osgdb_jpg.so + +TARGET_LOADER_FILES = osgPlugins/osgdb_jpg.so + +LIBS = -ljpeg +C++FLAGS += -I. -I../../../include +LDFLAGS += -L../../../lib + +include ../../../Make/makerules + + + diff --git a/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp b/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp new file mode 100644 index 000000000..ca3a34754 --- /dev/null +++ b/src/osgPlugins/jpeg/ReaderWriterJPEG.cpp @@ -0,0 +1,354 @@ +#include +#include +#include +#include +#include +#include +#include + +#include + + +/**************************************************************************** + * + * Follows is code extracted from the simage library. Original Authors: + * + * Systems in Motion, + * + * + * Peder Blekken + * Morten Eriksen + * Marius Bugge Monsen + * + * The original COPYING notice + * + * All files in this library are public domain, except simage_rgb.cpp which is + * Copyright (c) Mark J Kilgard . I will contact Mark + * very soon to hear if this source also can become public domain. + * + * Please send patches for bugs and new features to: . + * + * Peder Blekken + * + * + * Ported into the OSG as a plugin, Robert Osfield Decemeber 2000. + * Note, reference above to license of simage_rgb is not relevent to the OSG + * as the OSG does not use it. Also for patches, bugs and new features + * please send them direct to the OSG dev team rather than address above. + * + **********************************************************************/ + +/* + * Based on example code found in the libjpeg archive + * + */ + +#include + +extern "C" { +#include +}; + +#include +#include +#include +#include + +#define ERR_NO_ERROR 0 +#define ERR_OPEN 1 +#define ERR_MEM 2 +#define ERR_JPEGLIB 3 + +static int jpegerror = ERR_NO_ERROR; + +int +simage_jpeg_error(char * buffer, int buflen) +{ + switch (jpegerror) { + case ERR_OPEN: + strncpy(buffer, "JPEG loader: Error opening file", buflen); + break; + case ERR_MEM: + strncpy(buffer, "JPEG loader: Out of memory error", buflen); + break; + case ERR_JPEGLIB: + strncpy(buffer, "JPEG loader: Illegal jpeg file", buflen); + break; + } + return jpegerror; +} + +struct my_error_mgr { + struct jpeg_error_mgr pub; /* "public" fields */ + + jmp_buf setjmp_buffer; /* for return to caller */ +}; + + +typedef struct my_error_mgr * my_error_ptr; + +static void +my_error_exit (j_common_ptr cinfo) +{ + /* cinfo->err really points to a my_error_mgr struct, so coerce pointer */ + my_error_ptr myerr = (my_error_ptr) cinfo->err; + + /* Always display the message. */ + /* We could postpone this until after returning, if we chose. */ + /*(*cinfo->err->output_message) (cinfo);*/ + + /* FIXME: get error messahe from jpeglib */ + + /* Return control to the setjmp point */ + longjmp(myerr->setjmp_buffer, 1); +} + +int +simage_jpeg_identify(const char * ptr, + const unsigned char *header, + int headerlen) +{ + static unsigned char jpgcmp[] = {'J', 'F', 'I', 'F' }; + if (headerlen < 4) return 0; + if (memcmp((const void*)&header[6], + (const void*)jpgcmp, 4) == 0) return 1; + return 0; +} + + +static unsigned char* +copyScanline(unsigned char *currPtr, unsigned char *from, int cnt) +{ + memcpy((void*)currPtr, (void*)from, cnt); + currPtr -= cnt; + return currPtr; +} + + +unsigned char * +simage_jpeg_load(const char *filename, + int *width_ret, + int *height_ret, + int *numComponents_ret) +{ + int width; + int height; + unsigned char *currPtr; + int format; + unsigned char *buffer; + /* This struct contains the JPEG decompression parameters and pointers to + * working space (which is allocated as needed by the JPEG library). + */ + struct jpeg_decompress_struct cinfo; + /* We use our private extension JPEG error handler. + * Note that this struct must live as long as the main JPEG parameter + * struct, to avoid dangling-pointer problems. + */ + struct my_error_mgr jerr; + /* More stuff */ + FILE * infile; /* source file */ + JSAMPARRAY rowbuffer; /* Output row buffer */ + int row_stride; /* physical row width in output buffer */ + + jpegerror = ERR_NO_ERROR; + + /* In this example we want to open the input file before doing anything else, + * so that the setjmp() error recovery below can assume the file is open. + * VERY IMPORTANT: use "b" option to fopen() if you are on a machine that + * requires it in order to read binary files. + */ + + if ((infile = fopen(filename, "rb")) == NULL) { + jpegerror = ERR_OPEN; + return NULL; + } + + /* Step 1: allocate and initialize JPEG decompression object */ + + buffer = NULL; + + /* We set up the normal JPEG error routines, then override error_exit. */ + cinfo.err = jpeg_std_error(&jerr.pub); + jerr.pub.error_exit = my_error_exit; + /* Establish the setjmp return context for my_error_exit to use. */ + if (setjmp(jerr.setjmp_buffer)) { + /* If we get here, the JPEG code has signaled an error. + * We need to clean up the JPEG object, close the input file, and return. + */ + jpegerror = ERR_JPEGLIB; + jpeg_destroy_decompress(&cinfo); + fclose(infile); + if (buffer) free(buffer); + return NULL; + } + /* Now we can initialize the JPEG decompression object. */ + jpeg_create_decompress(&cinfo); + + /* Step 2: specify data source (eg, a file) */ + + jpeg_stdio_src(&cinfo, infile); + + /* Step 3: read file parameters with jpeg_read_header() */ + + (void) jpeg_read_header(&cinfo, TRUE); + /* We can ignore the return value from jpeg_read_header since + * (a) suspension is not possible with the stdio data source, and + * (b) we passed TRUE to reject a tables-only JPEG file as an error. + * See libjpeg.doc for more info. + */ + + /* Step 4: set parameters for decompression */ + /* In this example, we don't need to change any of the defaults set by + * jpeg_read_header(), so we do nothing here. + */ + + /* Step 5: Start decompressor */ + if (cinfo.jpeg_color_space == JCS_GRAYSCALE) { + format = 1; + cinfo.out_color_space = JCS_GRAYSCALE; + } + else { /* use rgb */ + format = 3; + cinfo.out_color_space = JCS_RGB; + } + + (void) jpeg_start_decompress(&cinfo); + /* We can ignore the return value since suspension is not possible + * with the stdio data source. + */ + + /* We may need to do some setup of our own at this point before reading + * the data. After jpeg_start_decompress() we have the correct scaled + * output image dimensions available, as well as the output colormap + * if we asked for color quantization. + * In this example, we need to make an output work buffer of the right size. + */ + /* JSAMPLEs per row in output buffer */ + row_stride = cinfo.output_width * cinfo.output_components; + /* Make a one-row-high sample array that will go away when done with image */ + rowbuffer = (*cinfo.mem->alloc_sarray) + ((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1); + width = cinfo.output_width; + height = cinfo.output_height; + buffer = currPtr = (unsigned char*) + malloc(width*height*cinfo.output_components); + + /* Step 6: while (scan lines remain to be read) */ + /* jpeg_read_scanlines(...); */ + + /* Here we use the library's state variable cinfo.output_scanline as the + * loop counter, so that we don't have to keep track ourselves. + */ + + /* flip image upside down */ + if (buffer) { + currPtr = buffer + row_stride * (cinfo.output_height-1); + + while (cinfo.output_scanline < cinfo.output_height) { + /* jpeg_read_scanlines expects an array of pointers to scanlines. + * Here the array is only one element long, but you could ask for + * more than one scanline at a time if that's more convenient. + */ + (void) jpeg_read_scanlines(&cinfo, rowbuffer, 1); + /* Assume put_scanline_someplace wants a pointer and sample count. */ + currPtr = copyScanline(currPtr, rowbuffer[0], row_stride); + } + } + /* Step 7: Finish decompression */ + + (void) jpeg_finish_decompress(&cinfo); + /* We can ignore the return value since suspension is not possible + * with the stdio data source. + */ + + /* Step 8: Release JPEG decompression object */ + + /* This is an important step since it will release a good deal of memory. */ + jpeg_destroy_decompress(&cinfo); + + /* After finish_decompress, we can close the input file. + * Here we postpone it until after no more JPEG errors are possible, + * so as to simplify the setjmp error logic above. (Actually, I don't + * think that jpeg_destroy can do an error exit, but why assume anything...) + */ + fclose(infile); + + /* At this point you may want to check to see whether any corrupt-data + * warnings occurred (test whether jerr.pub.num_warnings is nonzero). + */ + + /* And we're done! */ + if (buffer) { + *width_ret = width; + *height_ret = height; + *numComponents_ret = format; + } + else { + jpegerror = ERR_MEM; + } + return buffer; +} + +class ReaderWriterJPEG : public osg::ReaderWriter +{ + public: + virtual const char* className() { return "JPEG Image Reader"; } + virtual bool acceptsExtension(const std::string& extension) { return extension=="jpeg"; } + + virtual osg::Node* readNode(const std::string& fileName) + { + osg::Image* image = readImage(fileName); + if (image) + { + osg::Geode* geode = osg::createGeodeForImage(image); + if (geode==NULL) image->unref(); + return geode; + } + else + { + return NULL; + } + } + + virtual osg::Image* readImage(const std::string& fileName) + { + + unsigned char *imageData = NULL; + int width_ret; + int height_ret; + int numComponents_ret; + + imageData = simage_jpeg_load(fileName.c_str(),&width_ret,&height_ret,&numComponents_ret); + + if (imageData==NULL) return NULL; + + int s = width_ret; + int t = height_ret; + int r = 1; + + int internalFormat = numComponents_ret; + + unsigned int pixelFormat = + numComponents_ret == 1 ? GL_LUMINANCE : + numComponents_ret == 2 ? GL_LUMINANCE_ALPHA : + numComponents_ret == 3 ? GL_RGB : + numComponents_ret == 4 ? GL_RGBA : (GLenum)-1; + + unsigned int dataType = GL_UNSIGNED_BYTE; + + osg::Image* pOsgImage = new osg::Image; + pOsgImage->setFileName(fileName.c_str()); + pOsgImage->setImage(s,t,r, + internalFormat, + pixelFormat, + dataType, + imageData); + + return pOsgImage; + + } +}; + +// now register with Registry to instantiate the above +// reader/writer. +osg::RegisterReaderWriterProxy g_readerWriter_JPEG_Proxy; diff --git a/src/osgPlugins/osgtgz/Makedepend b/src/osgPlugins/osgtgz/Makedepend new file mode 100644 index 000000000..e69de29bb diff --git a/src/osgPlugins/osgtgz/Makefile b/src/osgPlugins/osgtgz/Makefile new file mode 100644 index 000000000..7b1a99a74 --- /dev/null +++ b/src/osgPlugins/osgtgz/Makefile @@ -0,0 +1,18 @@ +#!smake +include ../../../Make/makedefs + +C++FILES = \ + osgtgz.cpp\ + + +LIB = ../../../lib/osgPlugins/osgdb_osgtgz.so + +TARGET_LOADER_FILES = osgPlugins/osgdb_osgtgz.so + +C++FLAGS += -I../../../include +LDFLAGS += -L../../../lib + +include ../../../Make/makerules + + + diff --git a/src/osgPlugins/osgtgz/osgtgz.cpp b/src/osgPlugins/osgtgz/osgtgz.cpp new file mode 100644 index 000000000..e687b7a43 --- /dev/null +++ b/src/osgPlugins/osgtgz/osgtgz.cpp @@ -0,0 +1,94 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "osg/FileNameUtils" + +using namespace osg; + +#ifdef __sgi +static int dirent_select( dirent *dent ) +#else +static int dirent_select( const dirent *dent ) +#endif +{ + if( strlen( dent->d_name) < 4 ) + return 0; + + return !strncmp( ".osg", &dent->d_name[strlen(dent->d_name)-4], 4 ); +} + +class sgReaderWriterOSGTGZ : public ReaderWriter { + public: + virtual const char* className() { return "Default OSGTGZ Database Reader/Writer"; } + virtual bool acceptsExtension(const std::string& extension) { return extension=="osgtgz"; } + + virtual Node* readNode(const std::string& fileName) + { + std::string ext = getLowerCaseFileExtension(fileName); + if (!acceptsExtension(ext)) return NULL; + + osg::notify(osg::INFO)<< "sgReaderWriterOSGTGZ::readNode( "<d_name ); + grp->addChild( node ); + } + + sprintf( command, "rm -rf %s", dirname ); + system( command ); + + if( grp->getNumChildren() == 0 ) + { + grp->unref(); + return NULL; + } + + else + return grp; + } + + virtual bool writeNode(Node& obj,const std::string& fileName) { + return false; + } + +}; + +// now register with sgRegistry to instantiate the above +// reader/writer. +RegisterReaderWriterProxy g_readerWriter_OSGTGZ_Proxy; diff --git a/src/osgPlugins/pfb/ConvertFromPerformer.cpp b/src/osgPlugins/pfb/ConvertFromPerformer.cpp new file mode 100644 index 000000000..f78da0fcf --- /dev/null +++ b/src/osgPlugins/pfb/ConvertFromPerformer.cpp @@ -0,0 +1,1125 @@ +#include "ConvertFromPerformer.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef OSG_USE_IO_DOT_H +#include +#else +#include +using namespace std; +#endif + +extern "C" +{ + +extern int +pfdStoreFile_osg (pfNode* root, char *fileName) +{ + ConvertFromPerformer converter; + osg::Node* node = converter.convert(root); + + if (node==NULL) return 0; + if (osg::saveNodeFile(*node,fileName)) return 1; + else return 0; +} + +}; +ConvertFromPerformer::ConvertFromPerformer() +{ + _osgRoot = NULL; + + _gsetPrimMap[PFGS_POINTS] = osg::GeoSet::POINTS; + _gsetPrimMap[PFGS_LINES] = osg::GeoSet::LINES; + _gsetPrimMap[PFGS_LINESTRIPS] = osg::GeoSet::LINE_STRIP; + _gsetPrimMap[PFGS_TRIS] = osg::GeoSet::TRIANGLES; + _gsetPrimMap[PFGS_QUADS] = osg::GeoSet::QUADS; + _gsetPrimMap[PFGS_TRISTRIPS] = osg::GeoSet::TRIANGLE_STRIP; + _gsetPrimMap[PFGS_FLAT_LINESTRIPS] = osg::GeoSet::FLAT_LINE_STRIP; + _gsetPrimMap[PFGS_FLAT_TRISTRIPS] = osg::GeoSet::FLAT_TRIANGLE_STRIP; + _gsetPrimMap[PFGS_TRIFANS] = osg::GeoSet::TRIANGLE_FAN; + _gsetPrimMap[PFGS_FLAT_TRIFANS] = osg::GeoSet::FLAT_TRIANGLE_FAN; + _gsetPrimMap[PFGS_POLYS] = osg::GeoSet::POLYGON; + _gsetPrimMap[PFGS_NUM_PRIMS] = osg::GeoSet::NO_TYPE; + + _gsetBindMap[PFGS_OFF] = osg::GeoSet::BIND_OFF; + _gsetBindMap[PFGS_OVERALL] = osg::GeoSet::BIND_OVERALL; + _gsetBindMap[PFGS_PER_PRIM] = osg::GeoSet::BIND_PERPRIM; + _gsetBindMap[PFGS_PER_VERTEX] = osg::GeoSet::BIND_PERVERTEX; + + + _gstateTypeMap[PFSTATE_TRANSPARENCY] = osg::GeoState::TRANSPARENCY; + _gstateTypeMap[PFSTATE_ANTIALIAS] = osg::GeoState::ANTIALIAS; + _gstateTypeMap[PFSTATE_ENLIGHTING] = osg::GeoState::LIGHTING; + _gstateTypeMap[PFSTATE_ENTEXTURE] = osg::GeoState::TEXTURE; + _gstateTypeMap[PFSTATE_ENFOG] = osg::GeoState::FOG; + _gstateTypeMap[PFSTATE_CULLFACE] = osg::GeoState::FACE_CULL; + _gstateTypeMap[PFSTATE_ENWIREFRAME] = osg::GeoState::WIREFRAME; + _gstateTypeMap[PFSTATE_ENTEXGEN] = osg::GeoState::TEXGEN; + _gstateTypeMap[PFSTATE_ENTEXMAT] = osg::GeoState::TEXMAT; + +// not currently supported under the OSG. +// _gstateTypeMap[PFSTATE_DECAL] = ; +// _gstateTypeMap[PFSTATE_ENTEXLOD] = ; +// _gstateTypeMap[PFSTATE_ALPHAFUNC] = ; +// _gstateTypeMap[PFSTATE_ENCOLORTABLE] = ; +// _gstateTypeMap[PFSTATE_ENHIGHLIGHTING] = ; +// _gstateTypeMap[PFSTATE_ENLPOINTSTATE] = ; + + _saveImagesAsRGB = false; + _saveAbsoluteImagePath = false; + +} + +ConvertFromPerformer::~ConvertFromPerformer() +{ +} + + +osg::Node* ConvertFromPerformer::convert(pfNode* node) +{ + if (node==NULL) return NULL; + return visitNode(NULL,node); +} + + +osg::Object* ConvertFromPerformer::getOsgObject(pfObject* pfObj) +{ + PfObjectToOsgObjectMap::iterator fitr = _pfToOsgMap.find(pfObj); + if (fitr != _pfToOsgMap.end()) + { +// osg::notify(DEBUG) << "Found shared object"<getType()->isDerivedFrom( pfBillboard::getClassType())) return visitBillboard(osgParent,(pfBillboard*)node); + else if (node->getType()->isDerivedFrom( pfGeode::getClassType())) return visitGeode(osgParent,(pfGeode*)node); + else if (node->getType()->isDerivedFrom( pfScene::getClassType())) return visitScene(osgParent,(pfScene*)node); + else if (node->getType()->isDerivedFrom( pfDCS::getClassType())) return visitDCS(osgParent,(pfDCS*)node); + else if (node->getType()->isDerivedFrom( pfSCS::getClassType())) return visitSCS(osgParent,(pfSCS*)node); + else if (node->getType()->isDerivedFrom( pfLOD::getClassType())) return visitLOD(osgParent,(pfLOD*)node); + else if (node->getType()->isDerivedFrom( pfSequence::getClassType())) return visitSequence(osgParent,(pfSequence*)node); + else if (node->getType()->isDerivedFrom( pfSwitch::getClassType())) return visitSwitch(osgParent,(pfSwitch*)node); + else if (node->getType()->isDerivedFrom( pfGroup::getClassType())) return visitGroup(osgParent,(pfGroup*)node); + + return NULL; +} + +osg::Node* ConvertFromPerformer::visitScene(osg::Group* osgParent,pfScene* scene) +{ + osg::Scene* osgScene = dynamic_cast(getOsgObject(scene)); + if (osgScene) + { + if (osgParent) osgParent->addChild(osgScene); + return osgScene; + } + + osgScene = new osg::Scene; + if (osgParent) osgParent->addChild(osgScene); + + regisiterPfObjectForOsgObject(scene,osgScene); + + const char* name = scene->getName(); + if (name) osgScene->setName(name); + + for(int i=0;igetNumChildren();++i) + { + visitNode(osgScene,scene->getChild(i)); + } + return (osg::Node*)osgScene; +} + +osg::Node* ConvertFromPerformer::visitGroup(osg::Group* osgParent,pfGroup* group) +{ + osg::Group* osgGroup = dynamic_cast(getOsgObject(group)); + if (osgGroup) + { + if (osgParent) osgParent->addChild(osgGroup); + return osgGroup; + } + + osgGroup = new osg::Group; + if (osgParent) osgParent->addChild(osgGroup); + + regisiterPfObjectForOsgObject(group,osgGroup); + + const char* name = group->getName(); + if (name) osgGroup->setName(name); + + for(int i=0;igetNumChildren();++i) + { + visitNode(osgGroup,group->getChild(i)); + } + return (osg::Node*)osgGroup; +} + +osg::Node* ConvertFromPerformer::visitLOD(osg::Group* osgParent,pfLOD* lod) +{ + osg::LOD* osgLOD = dynamic_cast(getOsgObject(lod)); + if (osgLOD) + { + if (osgParent) osgParent->addChild(osgLOD); + return osgLOD; + } + + osgLOD = new osg::LOD; + if (osgParent) osgParent->addChild(osgLOD); + + regisiterPfObjectForOsgObject(lod,osgLOD); + + const char* name = lod->getName(); + if (name) osgLOD->setName(name); + + pfVec3 center; + lod->getCenter(center); + osg::Vec3 osgCenter(center[0],center[1],center[2]); + osgLOD->setCenter(osgCenter); + + int i; + for(i=0;igetNumRanges();++i) + { + osgLOD->setRange(i,lod->getRange(i)); + } + + for(i=0;igetNumChildren();++i) + { + visitNode(osgLOD,lod->getChild(i)); + } + return (osg::Node*)osgLOD; + +} + +osg::Node* ConvertFromPerformer::visitSwitch(osg::Group* osgParent,pfSwitch* switchNode) +{ + osg::Switch* osgSwitch = dynamic_cast(getOsgObject(switchNode)); + if (osgSwitch) + { + if (osgParent) osgParent->addChild(osgSwitch); + return osgSwitch; + } + + osgSwitch = new osg::Switch; + if (osgParent) osgParent->addChild(osgSwitch); + + regisiterPfObjectForOsgObject(switchNode,osgSwitch); + + const char* name = switchNode->getName(); + if (name) osgSwitch->setName(name); + + float val = switchNode->getVal(); + if (val==PFSWITCH_ON) + { + osgSwitch->setVal(osg::Switch::ALL_CHILDREN_ON); + } + else if (val==PFSWITCH_OFF) + { + osgSwitch->setVal(osg::Switch::ALL_CHILDREN_OFF); + } + else + { + osgSwitch->setVal((int)val); + } + + for(int i=0;igetNumChildren();++i) + { + visitNode(osgSwitch,switchNode->getChild(i)); + } + return (osg::Node*)osgSwitch; +} + +osg::Node* ConvertFromPerformer::visitSequence(osg::Group* osgParent,pfSequence* sequence) +{ + osg::Sequence* osgSequence = dynamic_cast(getOsgObject(sequence)); + if (osgSequence) + { + if (osgParent) osgParent->addChild(osgSequence); + return osgSequence; + } + + osgSequence = new osg::Sequence; + if (osgParent) osgParent->addChild(osgSequence); + + regisiterPfObjectForOsgObject(sequence,osgSequence); + + for(int i=0;igetNumChildren();++i) + { + visitNode(osgSequence,sequence->getChild(i)); + } + return (osg::Node*)osgSequence; +} + +osg::Node* ConvertFromPerformer::visitDCS(osg::Group* osgParent,pfDCS* dcs) +{ + + osg::DCS* osgDCS = dynamic_cast(getOsgObject(dcs)); + if (osgDCS) + { + if (osgParent) osgParent->addChild(osgDCS); + return osgDCS; + } + + osgDCS = new osg::DCS; + if (osgParent) osgParent->addChild(osgDCS); + + regisiterPfObjectForOsgObject(dcs,osgDCS); + + const char* name = dcs->getName(); + if (name) osgDCS->setName(name); + + pfMatrix matrix; + dcs->getMat(matrix); + + osg::Matrix osgMatrix(matrix[0][0],matrix[0][1],matrix[0][2],matrix[0][3], + matrix[1][0],matrix[1][1],matrix[1][2],matrix[1][3], + matrix[2][0],matrix[2][1],matrix[2][2],matrix[2][3], + matrix[3][0],matrix[3][1],matrix[3][2],matrix[3][3]); + + osgDCS->setMatrix(osgMatrix); + + for(int i=0;igetNumChildren();++i) + { + visitNode(osgDCS,dcs->getChild(i)); + } + return (osg::Node*)osgDCS; +} + +osg::Node* ConvertFromPerformer::visitSCS(osg::Group* osgParent,pfSCS* scs) +{ + // note the OSG does not currently have a SCS, so use DCS instead. + osg::DCS* osgDCS = dynamic_cast(getOsgObject(scs)); + if (osgDCS) + { + if (osgParent) osgParent->addChild(osgDCS); + return osgDCS; + } + + osgDCS = new osg::DCS; + if (osgParent) osgParent->addChild(osgDCS); + + regisiterPfObjectForOsgObject(scs,osgDCS); + + const char* name = scs->getName(); + if (name) osgDCS->setName(name); + + pfMatrix matrix; + scs->getMat(matrix); + osg::Matrix osgMatrix(matrix[0][0],matrix[0][1],matrix[0][2],matrix[0][3], + matrix[1][0],matrix[1][1],matrix[1][2],matrix[1][3], + matrix[2][0],matrix[2][1],matrix[2][2],matrix[2][3], + matrix[3][0],matrix[3][1],matrix[3][2],matrix[3][3]); + + osgDCS->setMatrix(osgMatrix); + + for(int i=0;igetNumChildren();++i) + { + visitNode(osgDCS,scs->getChild(i)); + } + return (osg::Node*)osgDCS; +} + +osg::Node* ConvertFromPerformer::visitGeode(osg::Group* osgParent,pfGeode* geode) +{ + osg::Geode* osgGeode = dynamic_cast(getOsgObject(geode)); + if (osgGeode) + { + if (osgParent) osgParent->addChild(osgGeode); + return osgGeode; + } + + osgGeode = new osg::Geode; + if (osgParent) osgParent->addChild(osgGeode); + + regisiterPfObjectForOsgObject(geode,osgGeode); + + const char* name = geode->getName(); + if (name) osgGeode->setName(name); + + for(int i=0;igetNumGSets();++i) + { + visitGeoSet(osgGeode,geode->getGSet(i)); + } + + return (osg::Node*)osgGeode; +} + +osg::Node* ConvertFromPerformer::visitBillboard(osg::Group* osgParent,pfBillboard* billboard) +{ +// return NULL; + + osg::Billboard* osgBillboard = dynamic_cast(getOsgObject(billboard)); + if (osgBillboard) + { + if (osgParent) osgParent->addChild(osgBillboard); + return osgBillboard; + } + + osgBillboard = new osg::Billboard; + if (osgParent) osgParent->addChild(osgBillboard); + + regisiterPfObjectForOsgObject(billboard,osgBillboard); + + const char* name = billboard->getName(); + if (name) osgBillboard->setName(name); + + pfVec3 axis; + billboard->getAxis(axis); + osgBillboard->setAxis(osg::Vec3(axis[0],axis[1],axis[2])); + + for(int i=0;igetNumGSets();++i) + { + /* osg::GeoSet* osggset = */visitGeoSet(osgBillboard,billboard->getGSet(i)); + pfVec3 pos; + billboard->getPos(i,pos); + osgBillboard->setPos(i,osg::Vec3(pos[0],pos[1],pos[2])); + } + + return (osg::Node*)osgBillboard; +} + +int ConvertFromPerformer::getNumVerts(pfGeoSet *gset) +{ + int nv; + int np; + int *lens; + int i; + + np = gset->getNumPrims(); + nv = 0; + + switch( gset->getPrimType() ) + { + case PFGS_POINTS : + nv = np; + break; + + case PFGS_LINES : + nv = 2 * np; + break; + + case PFGS_TRIS : + nv = 3 * np; + break; + + case PFGS_QUADS : + nv = 4 * np; + break; + + case PFGS_TRISTRIPS : + case PFGS_FLAT_TRISTRIPS : + case PFGS_POLYS : + case PFGS_LINESTRIPS : + case PFGS_FLAT_LINESTRIPS : + + lens = gset->getPrimLengths(); + for( i = 0; i < np; i++ ) + nv += lens[i]; + break; + + } + + + return nv; +} + +osg::GeoSet* ConvertFromPerformer::visitGeoSet(osg::Geode* osgGeode,pfGeoSet* geoset) +{ + if (geoset==NULL) return NULL; + + osg::GeoSet* osgGeoSet = dynamic_cast(getOsgObject(geoset)); + if (osgGeoSet) + { + if (osgGeode) osgGeode->addGeoSet(osgGeoSet); + return osgGeoSet; + } + + osgGeoSet = new osg::GeoSet; + if (osgGeode) osgGeode->addGeoSet(osgGeoSet); + + regisiterPfObjectForOsgObject(geoset,osgGeoSet); + + visitGeoState(osgGeoSet,geoset->getGState()); + + int i; + + // number of prims + int np = geoset->getNumPrims(); + int *plen = geoset->getPrimLengths(); + + // Number of verticies (may be different than number of coords) + int nv = getNumVerts( geoset ); + + int prim = geoset->getPrimType(); + int flat_shaded_offset=0; + if (prim == PFGS_FLAT_LINESTRIPS) flat_shaded_offset=np; + else if (prim == PFGS_FLAT_TRISTRIPS) flat_shaded_offset=2*np; + else if (prim == PFGS_FLAT_TRIFANS) flat_shaded_offset=2*np; + + osgGeoSet->setPrimType(_gsetPrimMap[geoset->getPrimType()]); + osgGeoSet->setNumPrims(np); + + if (plen) + { + int *osg_plen = new int [np]; + for(i=0;isetPrimLengths(osg_plen); + } + + pfVec3 *coords; + ushort *ilist; + geoset->getAttrLists( PFGS_COORD3, (void **)&coords, &ilist ); + + // copy the vertex coordinates across. + if( coords ) + { + // calc the maximum num of vertex from the index list. + int cc; + if (ilist) + { + cc = 0; + for( i = 0; i < nv; i++ ) + if( ilist[i] > cc ) cc = ilist[i]; + cc++; + } + else + cc = nv; + + + osg::Vec3* osg_coords = new osg::Vec3 [cc]; + for( i = 0; i < cc; i++ ) + { + osg_coords[i][0] = coords[i][0]; + osg_coords[i][1] = coords[i][1]; + osg_coords[i][2] = coords[i][2]; + } + + if(ilist) + { + osg::ushort* osg_cindex = new osg::ushort [nv]; + for( i = 0; i < nv; i++ ) + { + osg_cindex[i] = ilist[i]; + } + osgGeoSet->setCoords(osg_coords, osg_cindex ); + } + else + { + osgGeoSet->setCoords(osg_coords); + } + + } + + pfVec3 *norms; + geoset->getAttrLists( PFGS_NORMAL3, (void **)&norms, &ilist ); + + // copy normals + if(norms) + { + int bind = geoset->getAttrBind( PFGS_NORMAL3 ); + int nn = bind == PFGS_OFF ? 0 : + bind == PFGS_OVERALL ? 1 : + bind == PFGS_PER_PRIM ? geoset->getNumPrims() : + bind == PFGS_PER_VERTEX ? nv-flat_shaded_offset : 0; + + // set the normal binding type. + osgGeoSet->setNormalBinding(_gsetBindMap[bind]); + + // calc the maximum num of vertex from the index list. + int cc; + if (ilist) + { + cc = 0; + for( i = 0; i < nn; i++ ) + if( ilist[i] > cc ) cc = ilist[i]; + cc++; + } + else + cc = nn; + + + osg::Vec3* osg_norms = new osg::Vec3 [cc]; + for( i = 0; i < cc; i++ ) + { + osg_norms[i][0] = norms[i][0]; + osg_norms[i][1] = norms[i][1]; + osg_norms[i][2] = norms[i][2]; + } + + if(ilist) + { + osg::ushort* osg_cindex = new osg::ushort [nn]; + for( i = 0; i < nn; i++ ) + { + osg_cindex[i] = ilist[i]; + } + osgGeoSet->setNormals(osg_norms, osg_cindex ); + } + else + { + osgGeoSet->setNormals(osg_norms); + } + + } + + pfVec2 *tcoords; + geoset->getAttrLists( PFGS_TEXCOORD2, (void **)&tcoords, &ilist ); + + // copy texture coords + if(tcoords) + { + int bind = geoset->getAttrBind( PFGS_TEXCOORD2 ); + int nn = bind == PFGS_OFF ? 0 : + bind == PFGS_OVERALL ? 1 : + bind == PFGS_PER_PRIM ? geoset->getNumPrims() : + bind == PFGS_PER_VERTEX ? nv : 0; + + // set the normal binding type. + osgGeoSet->setTextureBinding(_gsetBindMap[bind]); + + // calc the maximum num of vertex from the index list. + int cc; + if (ilist) + { + cc = 0; + for( i = 0; i < nv; i++ ) + if( ilist[i] > cc ) cc = ilist[i]; + cc++; + } + else + cc = nn; + + + osg::Vec2* osg_tcoords = new osg::Vec2 [cc]; + for( i = 0; i < cc; i++ ) + { + osg_tcoords[i][0] = tcoords[i][0]; + osg_tcoords[i][1] = tcoords[i][1]; + } + + if(ilist) + { + osg::ushort* osg_cindex = new osg::ushort [nn]; + for( i = 0; i < nn; i++ ) + { + osg_cindex[i] = ilist[i]; + } + osgGeoSet->setTextureCoords(osg_tcoords, osg_cindex ); + } + else + { + osgGeoSet->setTextureCoords(osg_tcoords); + } + + } + + pfVec4 *colors; + geoset->getAttrLists( PFGS_COLOR4, (void **)&colors, &ilist ); + + // copy color coords + if(colors) + { + int bind = geoset->getAttrBind( PFGS_COLOR4 ); + int nn = bind == PFGS_OFF ? 0 : + bind == PFGS_OVERALL ? 1 : + bind == PFGS_PER_PRIM ? geoset->getNumPrims() : + bind == PFGS_PER_VERTEX ? nv-flat_shaded_offset : 0; + + // set the normal binding type. + osgGeoSet->setColorBinding(_gsetBindMap[bind]); + + // calc the maximum num of vertex from the index list. + int cc; + if (ilist) + { + cc = 0; + for( i = 0; i < nn; i++ ) + if( ilist[i] > cc ) cc = ilist[i]; + cc++; + } + else + cc = nn; + + + osg::Vec4* osg_colors = new osg::Vec4 [cc]; + for( i = 0; i < cc; i++ ) + { + osg_colors[i][0] = colors[i][0]; + osg_colors[i][1] = colors[i][1]; + osg_colors[i][2] = colors[i][2]; + osg_colors[i][3] = colors[i][3]; + } + + if(ilist) + { + osg::ushort* osg_cindex = new osg::ushort [nn]; + for( i = 0; i < nn; i++ ) + { + osg_cindex[i] = ilist[i]; + } + osgGeoSet->setColors(osg_colors, osg_cindex ); + } + else + { + osgGeoSet->setColors(osg_colors); + } + + } + + return osgGeoSet; +} + +osg::GeoState* ConvertFromPerformer::visitGeoState(osg::GeoSet* osgGeoSet,pfGeoState* geostate) +{ + if (geostate==NULL) return NULL; + + osg::GeoState* osgGeoState = dynamic_cast(getOsgObject(geostate)); + if (osgGeoState) + { + if (osgGeoSet) osgGeoSet->setGeoState(osgGeoState); + return osgGeoState; + } + + osgGeoState = new osg::GeoState; + if (osgGeoSet) osgGeoSet->setGeoState(osgGeoState); + + regisiterPfObjectForOsgObject(geostate,osgGeoState); + + + // Don could you fill in some of these blanks??? + unsigned int inherit = geostate->getInherit(); +// osg::notify(DEBUG) << endl << "Inherit = "<setMode(osg::GeoState::TRANSPARENCY,osg::GeoState::INHERIT); + else + { + int mode = geostate->getMode(PFSTATE_TRANSPARENCY); + switch(mode) + { + case(PFTR_FAST): + case(PFTR_HIGH_QUALITY): + case(PFTR_BLEND_ALPHA): + case(PFTR_MS_ALPHA): + case(PFTR_MS_ALPHA_MASK): + case(PFTR_NO_OCCLUDE): + case(PFTR_ON): osgGeoState->setMode(osg::GeoState::TRANSPARENCY,osg::GeoState::ON);break; + case(PFTR_OFF): osgGeoState->setMode(osg::GeoState::TRANSPARENCY,osg::GeoState::OFF);break; + default: osgGeoState->setMode(osg::GeoState::TRANSPARENCY,osg::GeoState::INHERIT);break; + } + } + + if (inherit & PFSTATE_ENTEXTURE) osgGeoState->setMode(osg::GeoState::TEXTURE,osg::GeoState::INHERIT); + else + { + int mode = geostate->getMode(PFSTATE_ENTEXTURE); + switch(mode) + { + case(PF_ON): osgGeoState->setMode(osg::GeoState::TEXTURE,osg::GeoState::ON);break; + case(PF_OFF): + default: osgGeoState->setMode(osg::GeoState::TEXTURE,osg::GeoState::OFF);break; + } + } + + if (inherit & PFSTATE_CULLFACE) osgGeoState->setMode(osg::GeoState::FACE_CULL,osg::GeoState::INHERIT); + else + { + int mode = geostate->getMode(PFSTATE_CULLFACE); + switch(mode) + { + case(PFCF_BACK): + { + osgGeoState->setMode(osg::GeoState::FACE_CULL,osg::GeoState::ON); + osg::CullFace *cf = new osg::CullFace; + cf->setMode(osg::CullFace::BACK); + osgGeoState->setAttribute(osg::GeoState::FACE_CULL,cf); + } + break; + + case(PFCF_FRONT): + { + osgGeoState->setMode(osg::GeoState::FACE_CULL,osg::GeoState::ON); + osg::CullFace *cf = new osg::CullFace; + cf->setMode(osg::CullFace::FRONT); + osgGeoState->setAttribute(osg::GeoState::FACE_CULL,cf); + } + break; + case(PFCF_BOTH): + { + osgGeoState->setMode(osg::GeoState::FACE_CULL,osg::GeoState::ON); + osg::CullFace *cf = new osg::CullFace; + cf->setMode(osg::CullFace::FRONT_AND_BACK); + osgGeoState->setAttribute(osg::GeoState::FACE_CULL,cf); + } + break; + case(PFCF_OFF): + default: osgGeoState->setMode(osg::GeoState::FACE_CULL,osg::GeoState::OFF);break; + } + } + + if (inherit & PFSTATE_ENLIGHTING) osgGeoState->setMode(osg::GeoState::LIGHTING,osg::GeoState::INHERIT); + else + { + int mode = geostate->getMode(PFSTATE_ENLIGHTING); + switch(mode) + { + case(PF_ON): osgGeoState->setMode(osg::GeoState::LIGHTING,osg::GeoState::ON);break; + case(PF_OFF): + default: osgGeoState->setMode(osg::GeoState::LIGHTING,osg::GeoState::OFF);break; + } + } + + if (inherit & PFSTATE_ENFOG) osgGeoState->setMode(osg::GeoState::FOG,osg::GeoState::INHERIT); + else + { + int mode = geostate->getMode(PFSTATE_ENFOG); + switch(mode) + { + case(PF_ON): osgGeoState->setMode(osg::GeoState::FOG,osg::GeoState::ON);break; + case(PF_OFF): + default: osgGeoState->setMode(osg::GeoState::FOG,osg::GeoState::OFF);break; + } + } + +// not currently supported by OSG +// if (inherit & PFSTATE_ENWIREFRAME) osgGeoState->setMode(osg::GeoState::WIREFRAME,osg::GeoState::INHERIT); +// else +// { +// int mode = geostate->getMode(PFSTATE_ENWIREFRAME); +// switch(mode) +// { +// case(PF_ON): osgGeoState->setMode(osg::GeoState::WIREFRAME,osg::GeoState::ON);break; +// case(PF_OFF): +// default: osgGeoState->setMode(osg::GeoState::WIREFRAME,osg::GeoState::OFF);break; +// } +// } + + +// redundent in OSG's implementation of texmat mode +// if (inherit & PFSTATE_ENTEXMAT) osgGeoState->setMode(osg::GeoState::TEXMAT,osg::GeoState::INHERIT); +// else +// { +// int mode = geostate->getMode(PFSTATE_ENTEXMAT); +// switch(mode) +// { +// case(PF_ON): osgGeoState->setMode(osg::GeoState::TEXMAT,osg::GeoState::ON);break; +// case(PF_OFF): +// default: osgGeoState->setMode(osg::GeoState::TEXMAT,osg::GeoState::OFF);break; +// } +// } + + if (inherit & PFSTATE_ENTEXGEN) osgGeoState->setMode(osg::GeoState::TEXGEN,osg::GeoState::INHERIT); + else + { + int mode = geostate->getMode(PFSTATE_ENTEXGEN); + switch(mode) + { + case(PF_ON): osgGeoState->setMode(osg::GeoState::TEXGEN,osg::GeoState::ON);break; + case(PF_OFF): + default: osgGeoState->setMode(osg::GeoState::TEXGEN,osg::GeoState::OFF);break; + } + } + + pfMaterial* front_mat = (pfMaterial*)geostate->getAttr(PFSTATE_FRONTMTL); + pfMaterial* back_mat = (pfMaterial*)geostate->getAttr(PFSTATE_BACKMTL); + visitMaterial(osgGeoState,front_mat,back_mat); + + pfTexture* tex = (pfTexture*)geostate->getAttr(PFSTATE_TEXTURE); + visitTexture(osgGeoState,tex); + + pfTexGen* texgen = (pfTexGen*)geostate->getAttr(PFSTATE_TEXGEN); + if (texgen) + { + osg::TexGen* osgTexGen = new osg::TexGen(); + int mode = texgen->getMode(PF_S); + switch(mode) + { + case(PFTG_OBJECT_LINEAR) : + osgTexGen->setMode(osg::TexGen::OBJECT_LINEAR); + osgGeoState->setAttribute(osg::GeoState::TEXGEN,osgTexGen); + break; + case(PFTG_EYE_LINEAR_IDENT) : + cerr << "TexGen Mode PFTG_EYE_LINEAR_IDENT not currently supported by the OSG,"<setMode(osg::TexGen::EYE_LINEAR); + osgGeoState->setAttribute(osg::GeoState::TEXGEN,osgTexGen); + break; + case(PFTG_SPHERE_MAP) : + osgTexGen->setMode(osg::TexGen::SPHERE_MAP); + osgGeoState->setAttribute(osg::GeoState::TEXGEN,osgTexGen); + break; + case(PFTG_OFF) : + osgGeoState->setMode(osg::GeoState::TEXGEN,osg::GeoState::OFF); + break; + case(PFTG_OBJECT_DISTANCE_TO_LINE) : + cerr << "TexGen Mode PFTG_OBJECT_DISTANCE_TO_LINE not currently supported by the OSG."<setMode(osg::GeoState::TEXGEN,osg::GeoState::OFF); + break; + case(PFTG_EYE_DISTANCE_TO_LINE) : + cerr << "TexGen Mode PFTG_EYE_DISTANCE_TO_LINE not currently supported by the OSG."<setMode(osg::GeoState::TEXGEN,osg::GeoState::OFF); + break; + default: + cerr << "TexGen Mode "<setMode(osg::GeoState::TEXGEN,osg::GeoState::OFF); + break; + } + + } + + pfMatrix* texmat = (pfMatrix*)geostate->getAttr(PFSTATE_TEXMAT); + if (texmat) + { + osg::Matrix osgMatrix((*texmat)[0][0],(*texmat)[0][1],(*texmat)[0][2],(*texmat)[0][3], + (*texmat)[1][0],(*texmat)[1][1],(*texmat)[1][2],(*texmat)[1][3], + (*texmat)[2][0],(*texmat)[2][1],(*texmat)[2][2],(*texmat)[2][3], + (*texmat)[3][0],(*texmat)[3][1],(*texmat)[3][2],(*texmat)[3][3]); + + osg::TexMat* osgTexMat = new osg::TexMat(); + osgTexMat->copy(osgMatrix); + osgGeoState->setAttribute(osg::GeoState::TEXMAT,osgTexMat); + } + + + return osgGeoState; +} + +osg::Material* ConvertFromPerformer::visitMaterial(osg::GeoState* osgGeoState,pfMaterial* front_mat,pfMaterial* back_mat) +{ + if (front_mat==NULL && back_mat==NULL) return NULL; + + + osg::Material* osgMaterial = new osg::Material; + if (osgGeoState) osgGeoState->setAttribute(osg::GeoState::MATERIAL,osgMaterial); + + pfMaterial* material = NULL; + if (front_mat==back_mat) material = front_mat; + else if (back_mat==NULL) material = front_mat; + else if (front_mat==NULL) material = back_mat; + + if (material) // single materials for front and back. + { + + int colorMode = material->getColorMode(material->getSide()); + + switch(colorMode){ + case(PFMTL_CMODE_AMBIENT_AND_DIFFUSE): osgMaterial->setColorMode(osg::Material::AMBIENT_AND_DIFFUSE); break; + case(PFMTL_CMODE_AMBIENT): osgMaterial->setColorMode(osg::Material::AMBIENT); break; + case(PFMTL_CMODE_DIFFUSE): osgMaterial->setColorMode(osg::Material::DIFFUSE); break; + case(PFMTL_CMODE_EMISSION): osgMaterial->setColorMode(osg::Material::EMISSION); break; + case(PFMTL_CMODE_SPECULAR): osgMaterial->setColorMode(osg::Material::SPECULAR); break; + case(PFMTL_CMODE_OFF): osgMaterial->setColorMode(osg::Material::OFF); break; + } + + + float s = material->getShininess(); + osgMaterial->setShininess(osg::Material::FACE_FRONT_AND_BACK,s); + + float a = material->getAlpha(); + float r,g,b; + + material->getColor(PFMTL_AMBIENT,&r,&g,&b); + osgMaterial->setAmbient(osg::Material::FACE_FRONT_AND_BACK,osg::Vec4(r,g,b,a)); + + material->getColor(PFMTL_DIFFUSE,&r,&g,&b); + osgMaterial->setDiffuse(osg::Material::FACE_FRONT_AND_BACK,osg::Vec4(r,g,b,a)); + + material->getColor(PFMTL_EMISSION,&r,&g,&b); + osgMaterial->setEmission(osg::Material::FACE_FRONT_AND_BACK,osg::Vec4(r,g,b,a)); + + material->getColor(PFMTL_SPECULAR,&r,&g,&b); + osgMaterial->setSpecular(osg::Material::FACE_FRONT_AND_BACK,osg::Vec4(r,g,b,a)); + } + else // seperate materials for front and back. + { + + int colorMode = front_mat->getColorMode(front_mat->getSide()); + + switch(colorMode){ + case(PFMTL_CMODE_AMBIENT_AND_DIFFUSE): osgMaterial->setColorMode(osg::Material::AMBIENT_AND_DIFFUSE); break; + case(PFMTL_CMODE_AMBIENT): osgMaterial->setColorMode(osg::Material::AMBIENT); break; + case(PFMTL_CMODE_DIFFUSE): osgMaterial->setColorMode(osg::Material::DIFFUSE); break; + case(PFMTL_CMODE_EMISSION): osgMaterial->setColorMode(osg::Material::EMISSION); break; + case(PFMTL_CMODE_SPECULAR): osgMaterial->setColorMode(osg::Material::SPECULAR); break; + case(PFMTL_CMODE_OFF): osgMaterial->setColorMode(osg::Material::OFF); break; + } + + + float s; + float a; + float r,g,b; + + // front material + s = front_mat->getShininess(); + osgMaterial->setShininess(osg::Material::FACE_FRONT,s); + + a = front_mat->getAlpha(); + + front_mat->getColor(PFMTL_AMBIENT,&r,&g,&b); + osgMaterial->setAmbient(osg::Material::FACE_FRONT,osg::Vec4(r,g,b,a)); + + front_mat->getColor(PFMTL_DIFFUSE,&r,&g,&b); + osgMaterial->setDiffuse(osg::Material::FACE_FRONT,osg::Vec4(r,g,b,a)); + + front_mat->getColor(PFMTL_EMISSION,&r,&g,&b); + osgMaterial->setEmission(osg::Material::FACE_FRONT,osg::Vec4(r,g,b,a)); + + front_mat->getColor(PFMTL_SPECULAR,&r,&g,&b); + osgMaterial->setSpecular(osg::Material::FACE_FRONT,osg::Vec4(r,g,b,a)); + + + // back material + s = back_mat->getShininess(); + osgMaterial->setShininess(osg::Material::FACE_BACK,s); + + a = back_mat->getAlpha(); + + back_mat->getColor(PFMTL_AMBIENT,&r,&g,&b); + osgMaterial->setAmbient(osg::Material::FACE_BACK,osg::Vec4(r,g,b,a)); + + back_mat->getColor(PFMTL_DIFFUSE,&r,&g,&b); + osgMaterial->setDiffuse(osg::Material::FACE_BACK,osg::Vec4(r,g,b,a)); + + back_mat->getColor(PFMTL_EMISSION,&r,&g,&b); + osgMaterial->setEmission(osg::Material::FACE_BACK,osg::Vec4(r,g,b,a)); + + back_mat->getColor(PFMTL_SPECULAR,&r,&g,&b); + osgMaterial->setSpecular(osg::Material::FACE_BACK,osg::Vec4(r,g,b,a)); + + } + + return osgMaterial; +} + +osg::Texture* ConvertFromPerformer::visitTexture(osg::GeoState* osgGeoState,pfTexture* tex) +{ + if (tex==NULL) return NULL; + + osg::Texture* osgTexture = new osg::Texture; + _pfToOsgMap[tex] = osgTexture; + + if (osgGeoState) osgGeoState->setAttribute(osg::GeoState::TEXTURE,osgTexture); + + + int repeat_r = tex->getRepeat(PFTEX_WRAP_R); + int repeat_s = tex->getRepeat(PFTEX_WRAP_S); + int repeat_t = tex->getRepeat(PFTEX_WRAP_T); + + if (repeat_r==PFTEX_CLAMP) osgTexture->setWrap(osg::Texture::WRAP_R,osg::Texture::CLAMP); + else osgTexture->setWrap(osg::Texture::WRAP_R,osg::Texture::REPEAT); + + if (repeat_s==PFTEX_CLAMP) osgTexture->setWrap(osg::Texture::WRAP_S,osg::Texture::CLAMP); + else osgTexture->setWrap(osg::Texture::WRAP_S,osg::Texture::REPEAT); + + if (repeat_t==PFTEX_CLAMP) osgTexture->setWrap(osg::Texture::WRAP_T,osg::Texture::CLAMP); + else osgTexture->setWrap(osg::Texture::WRAP_T,osg::Texture::REPEAT); + + std::string texName = tex->getName(); + + if (_saveImagesAsRGB) + { + std::string strippedName = osg::getStrippedName(texName); + texName = _saveImageDirectory+strippedName+".rgb"; + tex->saveFile(texName.c_str()); + } + + if (!_saveAbsoluteImagePath) texName = osg::getSimpleFileName(texName); + + + int s=0; + int t=0; + int r=0; + int comp=0; + unsigned int* imageData = NULL; + + tex->getImage(&imageData,&comp,&s,&t,&r); + + int internalFormat = comp; + + unsigned int pixelFormat = + comp == 1 ? GL_LUMINANCE : + comp == 2 ? GL_LUMINANCE_ALPHA : + comp == 3 ? GL_RGB : + comp == 4 ? GL_RGBA : (GLenum)-1; + + unsigned int dataType = GL_UNSIGNED_BYTE; + + osg::Image* image = new osg::Image; + image->setFileName(texName.c_str()); + image->setImage(s,t,r, + internalFormat, + pixelFormat, + dataType, + (unsigned char*)imageData); + + osgTexture->setImage(image); + + return osgTexture; +} diff --git a/src/osgPlugins/pfb/ConvertFromPerformer.h b/src/osgPlugins/pfb/ConvertFromPerformer.h new file mode 100644 index 000000000..1cd4df47c --- /dev/null +++ b/src/osgPlugins/pfb/ConvertFromPerformer.h @@ -0,0 +1,72 @@ +#ifndef __CONVERTFROMPERFORMER_H +#define __CONVERTFROMPERFORMER_H + +#include +#include +#include + +// Open Scene Graph includes. +#include +#include +#include +#include + +// Performer includes. +#include + +class ConvertFromPerformer { + public: + + ConvertFromPerformer(); + ~ConvertFromPerformer(); + + osg::Node* convert(pfNode* node); + + void setSaveImageDirectory(const std::string& directory) { _saveImageDirectory = directory; } + void setSaveImagesAsRGB(bool b) { _saveImagesAsRGB=b; } + void setSaveAbsoluteImagePath(bool b) { _saveAbsoluteImagePath = b; } + + private: + + osg::Object* getOsgObject(pfObject* pfObj); + void regisiterPfObjectForOsgObject(pfObject* pfObj,osg::Object* osgObj); + + osg::Node* visitNode(osg::Group* osgParent,pfNode* node); + osg::Node* visitScene(osg::Group* osgParent,pfScene* scene); + osg::Node* visitGroup(osg::Group* osgParent,pfGroup* group); + osg::Node* visitDCS(osg::Group* osgParent,pfDCS* dcs); + osg::Node* visitLOD(osg::Group* osgParent,pfLOD* lod); + osg::Node* visitSwitch(osg::Group* osgParent,pfSwitch* switchNode); + osg::Node* visitSequence(osg::Group* osgParent,pfSequence* sequence); + osg::Node* visitSCS(osg::Group* osgParent,pfSCS* scs); + osg::Node* visitGeode(osg::Group* osgParent,pfGeode* geode); + osg::Node* visitBillboard(osg::Group* osgParent,pfBillboard* billboard); + + int getNumVerts(pfGeoSet *gset); + osg::GeoSet* visitGeoSet(osg::Geode* osgParent,pfGeoSet* geoset); + osg::GeoState* visitGeoState(osg::GeoSet* osgGeoSet,pfGeoState* geostate); + osg::Material* visitMaterial(osg::GeoState* osgGeoState,pfMaterial* front_mat,pfMaterial* back_mat); + osg::Texture* visitTexture(osg::GeoState* osgGeoState,pfTexture* tex); + + typedef std::map GSetPrimitiveMap; + typedef std::map GSetBindingMap; + typedef std::map GStateTypeMap; + typedef std::map GStateModeMap; + + GSetPrimitiveMap _gsetPrimMap; + GSetBindingMap _gsetBindMap; + GStateTypeMap _gstateTypeMap; + GStateModeMap _gstateModeMap; + + bool _saveImagesAsRGB; + bool _saveAbsoluteImagePath; + std::string _saveImageDirectory; + + typedef std::map PfObjectToOsgObjectMap; + PfObjectToOsgObjectMap _pfToOsgMap; + + osg::Node* _osgRoot; + +}; + +#endif diff --git a/src/osgPlugins/pfb/ConvertToPerformer.cpp b/src/osgPlugins/pfb/ConvertToPerformer.cpp new file mode 100644 index 000000000..49c842535 --- /dev/null +++ b/src/osgPlugins/pfb/ConvertToPerformer.cpp @@ -0,0 +1,617 @@ +#include "ConvertToPerformer.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef OSG_USE_IO_DOT_H +#include +#else +#include +using namespace std; +#endif + +extern "C" { + +extern pfNode * +pfdLoadFile_osg (char *fileName) +{ + osg::Node* node = osg::loadNodeFile(fileName); + if (node==NULL) return 0; + + ConvertToPerformer converter; + return converter.convert(node); +} + +}; + + +ConvertToPerformer::ConvertToPerformer() +{ + setTraverseMode(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN); + + _pfParent = NULL; + _pfRoot = NULL; + + _gsetPrimMap[osg::GeoSet::POINTS] = PFGS_POINTS; + _gsetPrimMap[osg::GeoSet::LINES] = PFGS_LINES; + _gsetPrimMap[osg::GeoSet::LINE_STRIP] = PFGS_LINESTRIPS; + _gsetPrimMap[osg::GeoSet::TRIANGLES] = PFGS_TRIS; + _gsetPrimMap[osg::GeoSet::QUADS] = PFGS_QUADS; + _gsetPrimMap[osg::GeoSet::TRIANGLE_STRIP] = PFGS_TRISTRIPS; + _gsetPrimMap[osg::GeoSet::FLAT_LINE_STRIP] = PFGS_FLAT_LINESTRIPS; + _gsetPrimMap[osg::GeoSet::FLAT_TRIANGLE_STRIP] = PFGS_FLAT_TRISTRIPS; + _gsetPrimMap[osg::GeoSet::TRIANGLE_FAN] = PFGS_TRIFANS; + _gsetPrimMap[osg::GeoSet::FLAT_TRIANGLE_FAN] = PFGS_FLAT_TRIFANS; + _gsetPrimMap[osg::GeoSet::POLYGON] = PFGS_POLYS; + _gsetPrimMap[osg::GeoSet::NO_TYPE] = PFGS_NUM_PRIMS; + + _gsetBindMap[osg::GeoSet::BIND_OFF] = PFGS_OFF; + _gsetBindMap[osg::GeoSet::BIND_OVERALL] = PFGS_OVERALL; + _gsetBindMap[osg::GeoSet::BIND_PERPRIM] = PFGS_PER_PRIM; + _gsetBindMap[osg::GeoSet::BIND_PERVERTEX] = PFGS_PER_VERTEX; + + + _gstateTypeMap[osg::GeoState::TRANSPARENCY] = PFSTATE_TRANSPARENCY; + _gstateTypeMap[osg::GeoState::ANTIALIAS] = PFSTATE_ANTIALIAS; + _gstateTypeMap[osg::GeoState::LIGHTING] = PFSTATE_ENLIGHTING; + _gstateTypeMap[osg::GeoState::TEXTURE] = PFSTATE_ENTEXTURE; + _gstateTypeMap[osg::GeoState::FOG] = PFSTATE_ENFOG; + _gstateTypeMap[osg::GeoState::FACE_CULL] = PFSTATE_CULLFACE; + _gstateTypeMap[osg::GeoState::WIREFRAME] = PFSTATE_ENWIREFRAME; + _gstateTypeMap[osg::GeoState::TEXGEN] = PFSTATE_ENTEXGEN; + _gstateTypeMap[osg::GeoState::TEXMAT] = PFSTATE_ENTEXMAT; + +} + +ConvertToPerformer::~ConvertToPerformer() +{ +} + +pfNode* ConvertToPerformer::convert(osg::Node* node) +{ + _pfRoot = NULL; + if (node) + { + node->accept(*this); + } + return _pfRoot; +} + +pfObject* ConvertToPerformer::getPfObject(osg::Object* osgObj) +{ + OsgObjectToPfObjectMap::iterator fitr = _osgToPfMap.find(osgObj); + if (fitr != _osgToPfMap.end()) + { + osg::notify(osg::DEBUG) << "Found shared object"<(getPfObject(&node)); + if (pf_group) + { + if (_pfParent) _pfParent->addChild(pf_group); + return; + } + + pf_group = new pfGroup; + if (!_pfRoot) _pfRoot = pf_group; + if (_pfParent) _pfParent->addChild(pf_group); + + regisiterOsgObjectForPfObject(&node,pf_group); + + if (!node.getName().empty()) pf_group->setName(node.getName().c_str()); + + _pfParent = pf_group; + + node.traverse(*this); + + _pfParent = parent; +} + +void ConvertToPerformer::apply(osg::DCS& osgDCS) +{ + pfGroup* parent = _pfParent; + + pfDCS* pf_dcs = dynamic_cast(getPfObject(&osgDCS)); + if (pf_dcs) + { + if (_pfParent) _pfParent->addChild(pf_dcs); + return; + } + + pf_dcs = new pfDCS; + if (!_pfRoot) _pfRoot = pf_dcs; + if (_pfParent) _pfParent->addChild(pf_dcs); + + regisiterOsgObjectForPfObject(&osgDCS,pf_dcs); + + if (!osgDCS.getName().empty()) pf_dcs->setName(osgDCS.getName().c_str()); + + osg::Matrix* matrix = osgDCS.getMatrix(); + + pfMatrix pf_matrix(matrix->_mat[0][0],matrix->_mat[0][1],matrix->_mat[0][2],matrix->_mat[0][3], + matrix->_mat[1][0],matrix->_mat[1][1],matrix->_mat[1][2],matrix->_mat[1][3], + matrix->_mat[2][0],matrix->_mat[2][1],matrix->_mat[2][2],matrix->_mat[2][3], + matrix->_mat[3][0],matrix->_mat[3][1],matrix->_mat[3][2],matrix->_mat[3][3]); + + pf_dcs->setMat(pf_matrix); + + + _pfParent = pf_dcs; + + osgDCS.traverse(*this); + + _pfParent = parent; + +} + +void ConvertToPerformer::apply(osg::Switch& node) +{ + pfGroup* parent = _pfParent; + + pfSwitch* pf_switch = dynamic_cast(getPfObject(&node)); + if (pf_switch) + { + if (_pfParent) _pfParent->addChild(pf_switch); + return; + } + + pf_switch = new pfSwitch; + if (!_pfRoot) _pfRoot = pf_switch; + if (_pfParent) _pfParent->addChild(pf_switch); + + regisiterOsgObjectForPfObject(&node,pf_switch); + + if (!node.getName().empty()) pf_switch->setName(node.getName().c_str()); + + _pfParent = pf_switch; + + node.traverse(*this); + + _pfParent = parent; +} + +void ConvertToPerformer::apply(osg::LOD& node) +{ + pfGroup* parent = _pfParent; + + pfLOD* pf_lod = dynamic_cast(getPfObject(&node)); + if (pf_lod) + { + if (_pfParent) _pfParent->addChild(pf_lod); + return; + } + + pf_lod = new pfLOD; + if (!_pfRoot) _pfRoot = pf_lod; + if (_pfParent) _pfParent->addChild(pf_lod); + + regisiterOsgObjectForPfObject(&node,pf_lod); + + if (!node.getName().empty()) pf_lod->setName(node.getName().c_str()); + + _pfParent = pf_lod; + + node.traverse(*this); + + _pfParent = parent; +} + +void ConvertToPerformer::apply(osg::Scene& scene) +{ + pfGroup* parent = _pfParent; + + pfScene* pf_scene = dynamic_cast(getPfObject(&scene)); + if (pf_scene) + { + if (_pfParent) _pfParent->addChild(pf_scene); + return; + } + + pf_scene = new pfScene; + if (!_pfRoot) _pfRoot = pf_scene; + if (_pfParent) _pfParent->addChild(pf_scene); + + regisiterOsgObjectForPfObject(&scene,pf_scene); + + if (!scene.getName().empty()) pf_scene->setName(scene.getName().c_str()); + + _pfParent = pf_scene; + + scene.traverse(*this); + + _pfParent = parent; +} + + +void ConvertToPerformer::apply(osg::Billboard& node) +{ + pfGroup* parent = _pfParent; + + pfBillboard* pf_billboard = dynamic_cast(getPfObject(&node)); + if (pf_billboard) + { + if (_pfParent) _pfParent->addChild(pf_billboard); + return; + } + + pf_billboard = new pfBillboard; + if (!_pfRoot) _pfRoot = pf_billboard; + if (_pfParent) _pfParent->addChild(pf_billboard); + + regisiterOsgObjectForPfObject(&node,pf_billboard); + + if (!node.getName().empty()) pf_billboard->setName(node.getName().c_str()); + + for(int i=0;iaddGSet(pf_geoset); + } + + _pfParent = parent; +} + +void ConvertToPerformer::apply(osg::Geode& node) +{ + pfGroup* parent = _pfParent; + + pfGeode* pf_geode = dynamic_cast(getPfObject(&node)); + if (pf_geode) + { + if (_pfParent) _pfParent->addChild(pf_geode); + return; + } + + pf_geode = new pfGeode; + if (!_pfRoot) _pfRoot = pf_geode; + if (_pfParent) _pfParent->addChild(pf_geode); + + regisiterOsgObjectForPfObject(&node,pf_geode); + + if (!node.getName().empty()) pf_geode->setName(node.getName().c_str()); + + for(int i=0;iaddGSet(pf_geoset); + } + + _pfParent = parent; +} + +pfGeoSet* ConvertToPerformer::visitGeoSet(osg::GeoSet* geoset) +{ + if (geoset==NULL) return NULL; + + void* arena = pfGetSharedArena(); + + pfGeoSet* pf_geoset = new pfGeoSet(); + + pf_geoset->setGState(visitGeoState(geoset->getGeoState())); + + int i; + + // number of prims + int np = geoset->getNumPrims(); + int *plen = geoset->getPrimLengths(); + + // Number of verticies (may be different than number of coords) + geoset->computeNumVerts(); + + pf_geoset->setPrimType(_gsetPrimMap[geoset->getPrimType()]); + pf_geoset->setNumPrims(np); + + if (plen) + { + //int *pf_plen = new int [np]; + int* pf_plen = (int*) pfMalloc(sizeof(int) * np, arena); + for(i=0;isetPrimLengths(pf_plen); + } + + osg::Vec3 *coords = geoset->getCoords(); + osg::ushort *ilist = geoset->getCIndex(); + + + // copy the vertex coordinates across. + if( coords ) + { + + int cc = geoset->getNumCoords(); + + pfVec3* pf_coords = (pfVec3*) pfMalloc(sizeof(pfVec3) * cc, arena); + + for( i = 0; i < cc; i++ ) + { + pf_coords[i][0] = coords[i][0]; + pf_coords[i][1] = coords[i][1]; + pf_coords[i][2] = coords[i][2]; + } + + if(ilist) + { + int ni=geoset->getNumIndices(); + ushort* pf_cindex = (ushort*) pfMalloc(sizeof(ushort) * ni, arena); + for( i = 0; i < ni; i++ ) + { + pf_cindex[i] = ilist[i]; + } + pf_geoset->setAttr( PFGS_COORD3, PFGS_PER_VERTEX, pf_coords, pf_cindex ); + } + else + { + pf_geoset->setAttr( PFGS_COORD3, PFGS_PER_VERTEX, pf_coords, NULL ); + } + + } + + osg::Vec3 *norms = geoset->getNormals(); + ilist = geoset->getNIndex(); + + // copy normals + if(norms) + { + int bind = _gsetBindMap[geoset->getNormalBinding()]; + + int cc = geoset->getNumNormals(); + + pfVec3* pf_norms = (pfVec3*) pfMalloc(sizeof(pfVec3) * cc, arena); + + for( i = 0; i < cc; i++ ) + { + pf_norms[i][0] = norms[i][0]; + pf_norms[i][1] = norms[i][1]; + pf_norms[i][2] = norms[i][2]; + } + + if(ilist) + { + int ni=geoset->getNumNIndices(); + ushort* pf_nindex = (ushort*) pfMalloc(sizeof(ushort) * ni, arena); + for( i = 0; i < ni; i++ ) + { + pf_nindex[i] = ilist[i]; + } + pf_geoset->setAttr(PFGS_NORMAL3, bind, pf_norms,pf_nindex); + } + else + { + pf_geoset->setAttr(PFGS_NORMAL3, bind, pf_norms,NULL); + } + + } + + osg::Vec4 *colors = geoset->getColors(); + ilist = geoset->getColIndex(); + + // copy colors + if(colors) + { + int bind = _gsetBindMap[geoset->getColorBinding()]; + + int cc = geoset->getNumColors(); + + pfVec4* pf_colors = (pfVec4*) pfMalloc(sizeof(pfVec4) * cc, arena); + + for( i = 0; i < cc; i++ ) + { + pf_colors[i][0] = colors[i][0]; + pf_colors[i][1] = colors[i][1]; + pf_colors[i][2] = colors[i][2]; + pf_colors[i][3] = colors[i][3]; + } + + if(ilist) + { + int ni=geoset->getNumCIndices(); + ushort* pf_cindex = (ushort*) pfMalloc(sizeof(ushort) * ni, arena); + for( i = 0; i < ni; i++ ) + { + pf_cindex[i] = ilist[i]; + } + pf_geoset->setAttr(PFGS_COLOR4, bind, pf_colors,pf_cindex); + } + else + { + pf_geoset->setAttr(PFGS_COLOR4, bind, pf_colors,NULL); + } + + } + +// +// pfVec2 *tcoords; +// geoset->getAttrLists( PFGS_TEXCOORD2, (void **)&tcoords, &ilist ); +// +// // copy texture coords +// if(tcoords) +// { +// int bind = geoset->getAttrBind( PFGS_TEXCOORD2 ); +// int nn = bind == PFGS_OFF ? 0 : +// bind == PFGS_OVERALL ? 1 : +// bind == PFGS_PER_PRIM ? geoset->getNumPrims() : +// bind == PFGS_PER_VERTEX ? nv : 0; +// +// // set the normal binding type. +// pf_geoset->setTextureBinding(_gsetBindMap[bind]); +// +// // calc the maximum num of vertex from the index list. +// int cc; +// if (ilist) +// { +// cc = 0; +// for( i = 0; i < nv; i++ ) +// if( ilist[i] > cc ) cc = ilist[i]; +// cc++; +// } +// else +// cc = nn; +// +// +// osg::Vec2* osg_tcoords = new osg::Vec2 [cc]; +// for( i = 0; i < cc; i++ ) +// { +// osg_tcoords[i][0] = tcoords[i][0]; +// osg_tcoords[i][1] = tcoords[i][1]; +// } +// +// if(ilist) +// { +// osg::ushort* osg_cindex = new osg::ushort [nn]; +// for( i = 0; i < nn; i++ ) +// { +// osg_cindex[i] = ilist[i]; +// } +// pf_geoset->setTextureCoords(osg_tcoords, osg_cindex ); +// } +// else +// { +// pf_geoset->setTextureCoords(osg_tcoords); +// } +// +// } +// +// pfVec4 *colors; +// geoset->getAttrLists( PFGS_COLOR4, (void **)&colors, &ilist ); +// +// // copy color coords +// if(colors) +// { +// int bind = geoset->getAttrBind( PFGS_COLOR4 ); +// int nn = bind == PFGS_OFF ? 0 : +// bind == PFGS_OVERALL ? 1 : +// bind == PFGS_PER_PRIM ? geoset->getNumPrims() : +// bind == PFGS_PER_VERTEX ? nv-flat_shaded_offset : 0; +// +// // set the normal binding type. +// pf_geoset->setColorBinding(_gsetBindMap[bind]); +// +// // calc the maximum num of vertex from the index list. +// int cc; +// if (ilist) +// { +// cc = 0; +// for( i = 0; i < nn; i++ ) +// if( ilist[i] > cc ) cc = ilist[i]; +// cc++; +// } +// else +// cc = nn; +// +// +// osg::Vec4* osg_colors = new osg::Vec4 [cc]; +// for( i = 0; i < cc; i++ ) +// { +// osg_colors[i][0] = colors[i][0]; +// osg_colors[i][1] = colors[i][1]; +// osg_colors[i][2] = colors[i][2]; +// osg_colors[i][3] = colors[i][3]; +// } +// +// if(ilist) +// { +// osg::ushort* osg_cindex = new osg::ushort [nn]; +// for( i = 0; i < nn; i++ ) +// { +// osg_cindex[i] = ilist[i]; +// } +// pf_geoset->setColors(osg_colors, osg_cindex ); +// } +// else +// { +// pf_geoset->setColors(osg_colors); +// } +// +// } +// + + + return pf_geoset; +} + +pfGeoState* ConvertToPerformer::visitGeoState(osg::GeoState* geostate) +{ + if (geostate==NULL) return NULL; + + pfGeoState* pf_geostate = new pfGeoState(); + + switch(geostate->getMode(osg::GeoState::LIGHTING)) + { + case(osg::GeoState::OVERRIDE_ON): + case(osg::GeoState::ON): pf_geostate->setMode(PFSTATE_ENLIGHTING,PF_ON);break; + case(osg::GeoState::OVERRIDE_OFF): + case(osg::GeoState::OFF): pf_geostate->setMode(PFSTATE_ENLIGHTING,PF_OFF);break; + } + + switch(geostate->getMode(osg::GeoState::TEXTURE)) + { + case(osg::GeoState::OVERRIDE_ON): + case(osg::GeoState::ON): pf_geostate->setMode(PFSTATE_ENTEXTURE,PF_ON);break; + case(osg::GeoState::OVERRIDE_OFF): + case(osg::GeoState::OFF): pf_geostate->setMode(PFSTATE_ENTEXTURE,PF_OFF);break; + } + + return pf_geostate; +} + +pfMaterial* ConvertToPerformer::visitMaterial(osg::Material* material) +{ + if (material==NULL) return NULL; + + pfMaterial* pf_material = new pfMaterial(); + + return pf_material; +} + +pfTexture* ConvertToPerformer::visitTexture(osg::Texture* tex) +{ + if (tex==NULL) return NULL; + + pfTexture* pf_texture = new pfTexture(); + + return pf_texture; +} + diff --git a/src/osgPlugins/pfb/ConvertToPerformer.h b/src/osgPlugins/pfb/ConvertToPerformer.h new file mode 100644 index 000000000..64c281c17 --- /dev/null +++ b/src/osgPlugins/pfb/ConvertToPerformer.h @@ -0,0 +1,66 @@ +#ifndef __CONVERTTOPERFORMER_H +#define __CONVERTTOPERFORMER_H + +#include +#include +#include + +// Open Scene Graph includes. +#include +#include +#include +#include +#include + +// Performer includes. +#include + +class ConvertToPerformer : protected osg::NodeVisitor { + public: + + ConvertToPerformer(); + ~ConvertToPerformer(); + + pfNode* convert(osg::Node* node); + + virtual void apply(osg::Node&); + + virtual void apply(osg::Geode& node); + virtual void apply(osg::Billboard& node); + + virtual void apply(osg::Group& node); + virtual void apply(osg::DCS& node); + virtual void apply(osg::Switch& node); + virtual void apply(osg::LOD& node); + virtual void apply(osg::Scene& node); + + + private: + + pfGroup* _pfParent; + pfNode* _pfRoot; + + virtual pfObject* getPfObject(osg::Object* osgObj); + virtual void regisiterOsgObjectForPfObject(osg::Object* osgObj,pfObject* pfObj); + + pfGeoSet* visitGeoSet(osg::GeoSet* geoset); + pfGeoState* visitGeoState(osg::GeoState* geostate); + pfMaterial* visitMaterial(osg::Material* material); + pfTexture* visitTexture(osg::Texture* tex); + + + typedef std::map OsgObjectToPfObjectMap; + typedef std::map GSetPrimitiveMap; + typedef std::map GSetBindingMap; + typedef std::map GStateTypeMap; + typedef std::map GStateModeMap; + + OsgObjectToPfObjectMap _osgToPfMap; + GSetPrimitiveMap _gsetPrimMap; + GSetBindingMap _gsetBindMap; + GStateTypeMap _gstateTypeMap; + GStateModeMap _gstateModeMap; + +}; + +#endif diff --git a/src/osgPlugins/pfb/Makedepend b/src/osgPlugins/pfb/Makedepend new file mode 100644 index 000000000..e69de29bb diff --git a/src/osgPlugins/pfb/Makefile b/src/osgPlugins/pfb/Makefile new file mode 100644 index 000000000..5520f948c --- /dev/null +++ b/src/osgPlugins/pfb/Makefile @@ -0,0 +1,25 @@ +#!smake +include ../../../Make/makedefs + +C++FILES = \ + ConvertFromPerformer.cpp\ + ConvertToPerformer.cpp\ + ReaderWriterPFB.cpp\ + +LIB = ../../../lib/osgPlugins/osgdb_pfb.so + +#LIB = ../../../lib/libpfosg.so + +#LIBS = -u __ucmpdi2 -lgcc -losg ${PFLIBS} +LIBS = -losg ${PFLIBS} + +TARGET_LOADER_FILES = osgPlugins/osgdb_pfb.so + +C++FLAGS += -I../../../include + +LDFLAGS += -L../../../lib -L/usr/X11R6/lib + +include ../../../Make/makerules + + + diff --git a/src/osgPlugins/pfb/README.txt b/src/osgPlugins/pfb/README.txt new file mode 100644 index 000000000..a13409fc0 --- /dev/null +++ b/src/osgPlugins/pfb/README.txt @@ -0,0 +1,55 @@ +Features and issues with Performer plugin +========================================= + +Issues +------ +After compiling the Peformer plugin you can run sgv and it will +pick up the library osgPlugins/osgdb_pfb correctly, so you'll now be +able to type something like : + + cd /usr/share/Performer/data + sgv iris.pfb + +Unfortunately this then results in the following error message : + + DynamicLibrary::failed loading /home/robert/OpenSceneGraph-0.8/lib/osgPlugins/osgdb_pfb.so + DynamicLibrary::error /usr/lib/libpr.so: undefined symbol: __ucmpdi2 + +An attempt to fixing the undefined symbol by including -lgcc did not fix the +problem, have a look at src/osgPlugins/pfb/Makefile, for the link lines +tested. Suggestions welcome. + +This error disappears if you link sgv with Performer, you can do this by +simply swapping the #comment around in src/Viewier/Makefile so that : + + LIBS = -losgUtil -losg -lglut -lGLU -lGL -lm -lXmu -lX11 -lXi + #LIBS = ${PFLIBS} -losgUtil -losg -lglut -lGLU -lGL -lm -lXmu -lX11 -lXi + +is edited to become: + + #LIBS = -losgUtil -losg -lglut -lGLU -lGL -lm -lXmu -lX11 -lXi + LIBS = ${PFLIBS} -losgUtil -losg -lglut -lGLU -lGL -lm -lXmu -lX11 -lXi + +Not an ideal solution but it does work. Now try : + + cd /usr/share/Performer/data + sgv town_ogl_pfi.pfb + + +Features +-------- +You can also use osgdb_pfb.so as a Performer plugin, by linking/copying the +osgPlugins/osgdb_pfb.so to libpfosg.so. Try something like : + + cd OpenSceneGraph-0.8/lib + ln -s osgPlugins/osgdb_pfb.so libpfosg.so + +then + + perfly turtle.osg + +or + + pfconv /usr/share/Performer/data/iris.pfb iris.osg + sgv iris.osg + diff --git a/src/osgPlugins/pfb/ReaderWriterPFB.cpp b/src/osgPlugins/pfb/ReaderWriterPFB.cpp new file mode 100644 index 000000000..96ea6848b --- /dev/null +++ b/src/osgPlugins/pfb/ReaderWriterPFB.cpp @@ -0,0 +1,140 @@ +#include +#include + +#include +#include +#include +#include +#include + +#include "ConvertToPerformer.h" +#include "ConvertFromPerformer.h" + +#include +#include + +class ReaderWriterPFB : public osg::ReaderWriter { + + public: + + ReaderWriterPFB(); + ~ReaderWriterPFB(); + + void initPerformer(); + + virtual const char* className() { return "Performer Reader/Writer"; } + virtual bool acceptsExtension(const std::string& extension) { return extension=="pfb"; } + + virtual osg::Image* readImage(const std::string& fileName) + { + osg::notify(osg::INFO)<< "ReaderWriterPFB::readImage( "<loadFile(fileName.c_str())) + { + int s=0; + int t=0; + int r=0; + int comp=0; + unsigned int* imageData = NULL; + + tex->getImage(&imageData,&comp,&s,&t,&r); + + int internalFormat = comp; + + unsigned int pixelFormat = + comp == 1 ? GL_LUMINANCE : + comp == 2 ? GL_LUMINANCE_ALPHA : + comp == 3 ? GL_RGB : + comp == 4 ? GL_RGBA : (GLenum)-1; + + unsigned int dataType = GL_UNSIGNED_BYTE; + + osg::Image* image = new osg::Image; + image->setFileName(fileName.c_str()); + image->setImage(s,t,r, + internalFormat, + pixelFormat, + dataType, + (unsigned char*)imageData); + + return image; + } + + return NULL; + } + + + virtual osg::Node* readNode(const std::string& fileName) + { + osg::notify(osg::INFO)<< "ReaderWriterPFB::readNode( "< g_readerWriter_PFB_Proxy; diff --git a/src/osgPlugins/pfb/osg2pf/ConvertToPerformer.cpp b/src/osgPlugins/pfb/osg2pf/ConvertToPerformer.cpp new file mode 100644 index 000000000..5e0da317b --- /dev/null +++ b/src/osgPlugins/pfb/osg2pf/ConvertToPerformer.cpp @@ -0,0 +1,600 @@ +#include "ConvertToPerformer.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef OSG_USE_IO_DOT_H +#include +#else +#include +using namespace std; +#endif + +ConvertToPerformer::ConvertToPerformer() +{ + setTraverseMode(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN); + + _pfParent = NULL; + _pfRoot = NULL; + + _gsetPrimMap[osg::GeoSet::POINTS] = PFGS_POINTS; + _gsetPrimMap[osg::GeoSet::LINES] = PFGS_LINES; + _gsetPrimMap[osg::GeoSet::LINE_STRIP] = PFGS_LINESTRIPS; + _gsetPrimMap[osg::GeoSet::TRIANGLES] = PFGS_TRIS; + _gsetPrimMap[osg::GeoSet::QUADS] = PFGS_QUADS; + _gsetPrimMap[osg::GeoSet::TRIANGLE_STRIP] = PFGS_TRISTRIPS; + _gsetPrimMap[osg::GeoSet::FLAT_LINE_STRIP] = PFGS_FLAT_LINESTRIPS; + _gsetPrimMap[osg::GeoSet::FLAT_TRIANGLE_STRIP] = PFGS_FLAT_TRISTRIPS; + _gsetPrimMap[osg::GeoSet::TRIANGLE_FAN] = PFGS_TRIFANS; + _gsetPrimMap[osg::GeoSet::FLAT_TRIANGLE_FAN] = PFGS_FLAT_TRIFANS; + _gsetPrimMap[osg::GeoSet::POLYGON] = PFGS_POLYS; + _gsetPrimMap[osg::GeoSet::NO_TYPE] = PFGS_NUM_PRIMS; + + _gsetBindMap[osg::GeoSet::BIND_OFF] = PFGS_OFF; + _gsetBindMap[osg::GeoSet::BIND_OVERALL] = PFGS_OVERALL; + _gsetBindMap[osg::GeoSet::BIND_PERPRIM] = PFGS_PER_PRIM; + _gsetBindMap[osg::GeoSet::BIND_PERVERTEX] = PFGS_PER_VERTEX; + + + _gstateTypeMap[osg::GeoState::TRANSPARENCY] = PFSTATE_TRANSPARENCY; + _gstateTypeMap[osg::GeoState::ANTIALIAS] = PFSTATE_ANTIALIAS; + _gstateTypeMap[osg::GeoState::LIGHTING] = PFSTATE_ENLIGHTING; + _gstateTypeMap[osg::GeoState::TEXTURE] = PFSTATE_ENTEXTURE; + _gstateTypeMap[osg::GeoState::FOG] = PFSTATE_ENFOG; + _gstateTypeMap[osg::GeoState::FACE_CULL] = PFSTATE_CULLFACE; + _gstateTypeMap[osg::GeoState::WIREFRAME] = PFSTATE_ENWIREFRAME; + _gstateTypeMap[osg::GeoState::TEXGEN] = PFSTATE_ENTEXGEN; + _gstateTypeMap[osg::GeoState::TEXMAT] = PFSTATE_ENTEXMAT; + +} + +ConvertToPerformer::~ConvertToPerformer() +{ +} + +pfNode* ConvertToPerformer::convert(osg::Node* node) +{ + _pfRoot = NULL; + if (node) + { + node->accept(*this); + } + return _pfRoot; +} + +pfObject* ConvertToPerformer::getPfObject(osg::Object* osgObj) +{ + OsgObjectToPfObjectMap::iterator fitr = _osgToPfMap.find(osgObj); + if (fitr != _osgToPfMap.end()) + { + osg::notify(osg::DEBUG) << "Found shared object"<(getPfObject(&node)); + if (pf_group) + { + if (_pfParent) _pfParent->addChild(pf_group); + return; + } + + pf_group = new pfGroup; + if (!_pfRoot) _pfRoot = pf_group; + if (_pfParent) _pfParent->addChild(pf_group); + + regisiterOsgObjectForPfObject(&node,pf_group); + + if (!node.getName().empty()) pf_group->setName(node.getName().c_str()); + + _pfParent = pf_group; + + node.traverse(*this); + + _pfParent = parent; +} + +void ConvertToPerformer::apply(osg::DCS& osgDCS) +{ + pfGroup* parent = _pfParent; + + pfDCS* pf_dcs = dynamic_cast(getPfObject(&osgDCS)); + if (pf_dcs) + { + if (_pfParent) _pfParent->addChild(pf_dcs); + return; + } + + pf_dcs = new pfDCS; + if (!_pfRoot) _pfRoot = pf_dcs; + if (_pfParent) _pfParent->addChild(pf_dcs); + + regisiterOsgObjectForPfObject(&osgDCS,pf_dcs); + + if (!osgDCS.getName().empty()) pf_dcs->setName(osgDCS.getName().c_str()); + + osg::Matrix* matrix = osgDCS.getMatrix(); + + pfMatrix pf_matrix(matrix->_mat[0][0],matrix->_mat[0][1],matrix->_mat[0][2],matrix->_mat[0][3], + matrix->_mat[1][0],matrix->_mat[1][1],matrix->_mat[1][2],matrix->_mat[1][3], + matrix->_mat[2][0],matrix->_mat[2][1],matrix->_mat[2][2],matrix->_mat[2][3], + matrix->_mat[3][0],matrix->_mat[3][1],matrix->_mat[3][2],matrix->_mat[3][3]); + + pf_dcs->setMat(pf_matrix); + + + _pfParent = pf_dcs; + + osgDCS.traverse(*this); + + _pfParent = parent; + +} + +void ConvertToPerformer::apply(osg::Switch& node) +{ + pfGroup* parent = _pfParent; + + pfSwitch* pf_switch = dynamic_cast(getPfObject(&node)); + if (pf_switch) + { + if (_pfParent) _pfParent->addChild(pf_switch); + return; + } + + pf_switch = new pfSwitch; + if (!_pfRoot) _pfRoot = pf_switch; + if (_pfParent) _pfParent->addChild(pf_switch); + + regisiterOsgObjectForPfObject(&node,pf_switch); + + if (!node.getName().empty()) pf_switch->setName(node.getName().c_str()); + + _pfParent = pf_switch; + + node.traverse(*this); + + _pfParent = parent; +} + +void ConvertToPerformer::apply(osg::LOD& node) +{ + pfGroup* parent = _pfParent; + + pfLOD* pf_lod = dynamic_cast(getPfObject(&node)); + if (pf_lod) + { + if (_pfParent) _pfParent->addChild(pf_lod); + return; + } + + pf_lod = new pfLOD; + if (!_pfRoot) _pfRoot = pf_lod; + if (_pfParent) _pfParent->addChild(pf_lod); + + regisiterOsgObjectForPfObject(&node,pf_lod); + + if (!node.getName().empty()) pf_lod->setName(node.getName().c_str()); + + _pfParent = pf_lod; + + node.traverse(*this); + + _pfParent = parent; +} + +void ConvertToPerformer::apply(osg::Scene& scene) +{ + pfGroup* parent = _pfParent; + + pfScene* pf_scene = dynamic_cast(getPfObject(&scene)); + if (pf_scene) + { + if (_pfParent) _pfParent->addChild(pf_scene); + return; + } + + pf_scene = new pfScene; + if (!_pfRoot) _pfRoot = pf_scene; + if (_pfParent) _pfParent->addChild(pf_scene); + + regisiterOsgObjectForPfObject(&scene,pf_scene); + + if (!scene.getName().empty()) pf_scene->setName(scene.getName().c_str()); + + _pfParent = pf_scene; + + scene.traverse(*this); + + _pfParent = parent; +} + + +void ConvertToPerformer::apply(osg::Billboard& node) +{ + pfGroup* parent = _pfParent; + + pfBillboard* pf_billboard = dynamic_cast(getPfObject(&node)); + if (pf_billboard) + { + if (_pfParent) _pfParent->addChild(pf_billboard); + return; + } + + pf_billboard = new pfBillboard; + if (!_pfRoot) _pfRoot = pf_billboard; + if (_pfParent) _pfParent->addChild(pf_billboard); + + regisiterOsgObjectForPfObject(&node,pf_billboard); + + if (!node.getName().empty()) pf_billboard->setName(node.getName().c_str()); + + for(int i=0;iaddGSet(pf_geoset); + } + + _pfParent = parent; +} + +void ConvertToPerformer::apply(osg::Geode& node) +{ + pfGroup* parent = _pfParent; + + pfGeode* pf_geode = dynamic_cast(getPfObject(&node)); + if (pf_geode) + { + if (_pfParent) _pfParent->addChild(pf_geode); + return; + } + + pf_geode = new pfGeode; + if (!_pfRoot) _pfRoot = pf_geode; + if (_pfParent) _pfParent->addChild(pf_geode); + + regisiterOsgObjectForPfObject(&node,pf_geode); + + if (!node.getName().empty()) pf_geode->setName(node.getName().c_str()); + + for(int i=0;iaddGSet(pf_geoset); + } + + _pfParent = parent; +} + +pfGeoSet* ConvertToPerformer::visitGeoSet(osg::GeoSet* geoset) +{ + if (geoset==NULL) return NULL; + + void* arena = pfGetSharedArena(); + + pfGeoSet* pf_geoset = new pfGeoSet(); + + pf_geoset->setGState(visitGeoState(geoset->getGeoState())); + + int i; + + // number of prims + int np = geoset->getNumPrims(); + int *plen = geoset->getPrimLengths(); + + // Number of verticies (may be different than number of coords) + geoset->computeNumVerts(); + + pf_geoset->setPrimType(_gsetPrimMap[geoset->getPrimType()]); + pf_geoset->setNumPrims(np); + + if (plen) + { + //int *pf_plen = new int [np]; + int* pf_plen = (int*) pfMalloc(sizeof(int) * np, arena); + for(i=0;isetPrimLengths(pf_plen); + } + + osg::Vec3 *coords = geoset->getCoords(); + osg::ushort *ilist = geoset->getCIndex(); + + + // copy the vertex coordinates across. + if( coords ) + { + + int cc = geoset->getNumCoords(); + + pfVec3* pf_coords = (pfVec3*) pfMalloc(sizeof(pfVec3) * cc, arena); + + for( i = 0; i < cc; i++ ) + { + pf_coords[i][0] = coords[i][0]; + pf_coords[i][1] = coords[i][1]; + pf_coords[i][2] = coords[i][2]; + } + + if(ilist) + { + int ni=geoset->getNumIndices(); + ushort* pf_cindex = (ushort*) pfMalloc(sizeof(ushort) * ni, arena); + for( i = 0; i < ni; i++ ) + { + pf_cindex[i] = ilist[i]; + } + pf_geoset->setAttr( PFGS_COORD3, PFGS_PER_VERTEX, pf_coords, pf_cindex ); + } + else + { + pf_geoset->setAttr( PFGS_COORD3, PFGS_PER_VERTEX, pf_coords, NULL ); + } + + } + + osg::Vec3 *norms = geoset->getNormals(); + ilist = geoset->getNIndex(); + + // copy normals + if(norms) + { + int bind = _gsetBindMap[geoset->getNormalBinding()]; + + int cc = geoset->getNumNormals(); + + pfVec3* pf_norms = (pfVec3*) pfMalloc(sizeof(pfVec3) * cc, arena); + + for( i = 0; i < cc; i++ ) + { + pf_norms[i][0] = norms[i][0]; + pf_norms[i][1] = norms[i][1]; + pf_norms[i][2] = norms[i][2]; + } + + if(ilist) + { + int ni=geoset->getNumNIndices(); + ushort* pf_nindex = (ushort*) pfMalloc(sizeof(ushort) * ni, arena); + for( i = 0; i < ni; i++ ) + { + pf_nindex[i] = ilist[i]; + } + pf_geoset->setAttr(PFGS_NORMAL3, bind, pf_norms,pf_nindex); + } + else + { + pf_geoset->setAttr(PFGS_NORMAL3, bind, pf_norms,NULL); + } + + } + + osg::Vec4 *colors = geoset->getColors(); + ilist = geoset->getColIndex(); + + // copy colors + if(colors) + { + int bind = _gsetBindMap[geoset->getColorBinding()]; + + int cc = geoset->getNumColors(); + + pfVec4* pf_colors = (pfVec4*) pfMalloc(sizeof(pfVec4) * cc, arena); + + for( i = 0; i < cc; i++ ) + { + pf_colors[i][0] = colors[i][0]; + pf_colors[i][1] = colors[i][1]; + pf_colors[i][2] = colors[i][2]; + pf_colors[i][3] = colors[i][3]; + } + + if(ilist) + { + int ni=geoset->getNumCIndices(); + ushort* pf_cindex = (ushort*) pfMalloc(sizeof(ushort) * ni, arena); + for( i = 0; i < ni; i++ ) + { + pf_cindex[i] = ilist[i]; + } + pf_geoset->setAttr(PFGS_COLOR4, bind, pf_colors,pf_cindex); + } + else + { + pf_geoset->setAttr(PFGS_COLOR4, bind, pf_colors,NULL); + } + + } + +// +// pfVec2 *tcoords; +// geoset->getAttrLists( PFGS_TEXCOORD2, (void **)&tcoords, &ilist ); +// +// // copy texture coords +// if(tcoords) +// { +// int bind = geoset->getAttrBind( PFGS_TEXCOORD2 ); +// int nn = bind == PFGS_OFF ? 0 : +// bind == PFGS_OVERALL ? 1 : +// bind == PFGS_PER_PRIM ? geoset->getNumPrims() : +// bind == PFGS_PER_VERTEX ? nv : 0; +// +// // set the normal binding type. +// pf_geoset->setTextureBinding(_gsetBindMap[bind]); +// +// // calc the maximum num of vertex from the index list. +// int cc; +// if (ilist) +// { +// cc = 0; +// for( i = 0; i < nv; i++ ) +// if( ilist[i] > cc ) cc = ilist[i]; +// cc++; +// } +// else +// cc = nn; +// +// +// osg::Vec2* osg_tcoords = new osg::Vec2 [cc]; +// for( i = 0; i < cc; i++ ) +// { +// osg_tcoords[i][0] = tcoords[i][0]; +// osg_tcoords[i][1] = tcoords[i][1]; +// } +// +// if(ilist) +// { +// osg::ushort* osg_cindex = new osg::ushort [nn]; +// for( i = 0; i < nn; i++ ) +// { +// osg_cindex[i] = ilist[i]; +// } +// pf_geoset->setTextureCoords(osg_tcoords, osg_cindex ); +// } +// else +// { +// pf_geoset->setTextureCoords(osg_tcoords); +// } +// +// } +// +// pfVec4 *colors; +// geoset->getAttrLists( PFGS_COLOR4, (void **)&colors, &ilist ); +// +// // copy color coords +// if(colors) +// { +// int bind = geoset->getAttrBind( PFGS_COLOR4 ); +// int nn = bind == PFGS_OFF ? 0 : +// bind == PFGS_OVERALL ? 1 : +// bind == PFGS_PER_PRIM ? geoset->getNumPrims() : +// bind == PFGS_PER_VERTEX ? nv-flat_shaded_offset : 0; +// +// // set the normal binding type. +// pf_geoset->setColorBinding(_gsetBindMap[bind]); +// +// // calc the maximum num of vertex from the index list. +// int cc; +// if (ilist) +// { +// cc = 0; +// for( i = 0; i < nn; i++ ) +// if( ilist[i] > cc ) cc = ilist[i]; +// cc++; +// } +// else +// cc = nn; +// +// +// osg::Vec4* osg_colors = new osg::Vec4 [cc]; +// for( i = 0; i < cc; i++ ) +// { +// osg_colors[i][0] = colors[i][0]; +// osg_colors[i][1] = colors[i][1]; +// osg_colors[i][2] = colors[i][2]; +// osg_colors[i][3] = colors[i][3]; +// } +// +// if(ilist) +// { +// osg::ushort* osg_cindex = new osg::ushort [nn]; +// for( i = 0; i < nn; i++ ) +// { +// osg_cindex[i] = ilist[i]; +// } +// pf_geoset->setColors(osg_colors, osg_cindex ); +// } +// else +// { +// pf_geoset->setColors(osg_colors); +// } +// +// } +// + + + return pf_geoset; +} + +pfGeoState* ConvertToPerformer::visitGeoState(osg::GeoState* geostate) +{ + if (geostate==NULL) return NULL; + + pfGeoState* pf_geostate = new pfGeoState(); + + switch(geostate->getMode(osg::GeoState::LIGHTING)) + { + case(osg::GeoState::OVERRIDE_ON): + case(osg::GeoState::ON): pf_geostate->setMode(PFSTATE_ENLIGHTING,PF_ON);break; + case(osg::GeoState::OVERRIDE_OFF): + case(osg::GeoState::OFF): pf_geostate->setMode(PFSTATE_ENLIGHTING,PF_OFF);break; + } + + switch(geostate->getMode(osg::GeoState::TEXTURE)) + { + case(osg::GeoState::OVERRIDE_ON): + case(osg::GeoState::ON): pf_geostate->setMode(PFSTATE_ENTEXTURE,PF_ON);break; + case(osg::GeoState::OVERRIDE_OFF): + case(osg::GeoState::OFF): pf_geostate->setMode(PFSTATE_ENTEXTURE,PF_OFF);break; + } + + return pf_geostate; +} + +pfMaterial* ConvertToPerformer::visitMaterial(osg::Material* material) +{ + if (material==NULL) return NULL; + + pfMaterial* pf_material = new pfMaterial(); + + return pf_material; +} + +pfTexture* ConvertToPerformer::visitTexture(osg::Texture* tex) +{ + if (tex==NULL) return NULL; + + pfTexture* pf_texture = new pfTexture(); + + return pf_texture; +} + diff --git a/src/osgPlugins/pfb/osg2pf/ConvertToPerformer.h b/src/osgPlugins/pfb/osg2pf/ConvertToPerformer.h new file mode 100644 index 000000000..64c281c17 --- /dev/null +++ b/src/osgPlugins/pfb/osg2pf/ConvertToPerformer.h @@ -0,0 +1,66 @@ +#ifndef __CONVERTTOPERFORMER_H +#define __CONVERTTOPERFORMER_H + +#include +#include +#include + +// Open Scene Graph includes. +#include +#include +#include +#include +#include + +// Performer includes. +#include + +class ConvertToPerformer : protected osg::NodeVisitor { + public: + + ConvertToPerformer(); + ~ConvertToPerformer(); + + pfNode* convert(osg::Node* node); + + virtual void apply(osg::Node&); + + virtual void apply(osg::Geode& node); + virtual void apply(osg::Billboard& node); + + virtual void apply(osg::Group& node); + virtual void apply(osg::DCS& node); + virtual void apply(osg::Switch& node); + virtual void apply(osg::LOD& node); + virtual void apply(osg::Scene& node); + + + private: + + pfGroup* _pfParent; + pfNode* _pfRoot; + + virtual pfObject* getPfObject(osg::Object* osgObj); + virtual void regisiterOsgObjectForPfObject(osg::Object* osgObj,pfObject* pfObj); + + pfGeoSet* visitGeoSet(osg::GeoSet* geoset); + pfGeoState* visitGeoState(osg::GeoState* geostate); + pfMaterial* visitMaterial(osg::Material* material); + pfTexture* visitTexture(osg::Texture* tex); + + + typedef std::map OsgObjectToPfObjectMap; + typedef std::map GSetPrimitiveMap; + typedef std::map GSetBindingMap; + typedef std::map GStateTypeMap; + typedef std::map GStateModeMap; + + OsgObjectToPfObjectMap _osgToPfMap; + GSetPrimitiveMap _gsetPrimMap; + GSetBindingMap _gsetBindMap; + GStateTypeMap _gstateTypeMap; + GStateModeMap _gstateModeMap; + +}; + +#endif diff --git a/src/osgPlugins/pfb/osg2pf/Makedepend b/src/osgPlugins/pfb/osg2pf/Makedepend new file mode 100644 index 000000000..e69de29bb diff --git a/src/osgPlugins/pfb/osg2pf/Makefile b/src/osgPlugins/pfb/osg2pf/Makefile new file mode 100644 index 000000000..9abea6949 --- /dev/null +++ b/src/osgPlugins/pfb/osg2pf/Makefile @@ -0,0 +1,20 @@ +#!smake +include ../../Make/makedefs + +C++FILES = \ + ConvertToPerformer.cpp\ + osg2pf.cpp + +C++FLAGS += -I../../include -O + + +LIBS = -losg + +TARGET = ../../bin/osg2pf + +LDFLAGS += -L../../lib -L/usr/X11R6/lib + +LIBS = -losg -lGLU -lm ${PFLIBS} + +include ../../Make/makerules + diff --git a/src/osgPlugins/pfb/osg2pf/Makefile.lib b/src/osgPlugins/pfb/osg2pf/Makefile.lib new file mode 100644 index 000000000..4f1a6a1e2 --- /dev/null +++ b/src/osgPlugins/pfb/osg2pf/Makefile.lib @@ -0,0 +1,18 @@ +#!smake +include ../../Make/makedefs + +C++FILES = \ + ConvertToPerformer.cpp\ + osg.cpp +# osg2pf.cpp\ + + +LIB = ../../lib/libpfosg_ogl.so + +C++FLAGS += -I../../include +LDFLAGS += -L../../lib + +include ../../Make/makerules + + + diff --git a/src/osgPlugins/pfb/osg2pf/osg2pf.cpp b/src/osgPlugins/pfb/osg2pf/osg2pf.cpp new file mode 100644 index 000000000..79b6d9606 --- /dev/null +++ b/src/osgPlugins/pfb/osg2pf/osg2pf.cpp @@ -0,0 +1,114 @@ +#include "ConvertToPerformer.h" + +#include + +#include +#include +#include + +// Performer includes. +#include + +#ifdef OSG_USE_IO_DOT_H +#include +#else +#include +using namespace std; +#endif + + +int main( int argc, const char **argv ) +{ + + // create the list of input files from the command line arguments + typedef std::vector FileList; + FileList filelist; + + bool saveImagesAsRGB = false; + for(int i=1;i nodeList; + for(itr=filelist.begin();itr!=filelist.end();++itr) + { + osg::Node* osg_file_root = osg::Registry::instance()->readNode((*itr).c_str()); + if (osg_file_root) + { + nodeList.push_back(osg_file_root); + } + } + + + if (!nodeList.empty()) + { + osg::Node* osg_root = NULL; + if (nodeList.size()==1) + { + osg_root = nodeList[0]; + } + else + { + osg::Group* group = new osg::Group(); + for(std::vector::iterator ni=nodeList.begin(); + ni!=nodeList.end(); + ++ni) + { + group->addChild(*ni); + } + osg_root = group; + } + + ConvertToPerformer converter; + //converter.setSaveImageDirectory(outpath); + //converter.setSaveImagesAsRGB(saveImagesAsRGB); + + pfNode* pf_root = converter.convert(osg_root); + if (pf_root) + { + pfdStoreFile(pf_root,outfile.c_str()); + } + else + { + cerr << "error : failed to convert OSG scene graph to Performer."< +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef OSG_USE_IO_DOT_H +#include +#else +#include +using namespace std; +#endif + +ConvertFromPerformer::ConvertFromPerformer() +{ + _osgRoot = NULL; + + _gsetPrimMap[PFGS_POINTS] = osg::GeoSet::POINTS; + _gsetPrimMap[PFGS_LINES] = osg::GeoSet::LINES; + _gsetPrimMap[PFGS_LINESTRIPS] = osg::GeoSet::LINE_STRIP; + _gsetPrimMap[PFGS_TRIS] = osg::GeoSet::TRIANGLES; + _gsetPrimMap[PFGS_QUADS] = osg::GeoSet::QUADS; + _gsetPrimMap[PFGS_TRISTRIPS] = osg::GeoSet::TRIANGLE_STRIP; + _gsetPrimMap[PFGS_FLAT_LINESTRIPS] = osg::GeoSet::FLAT_LINE_STRIP; + _gsetPrimMap[PFGS_FLAT_TRISTRIPS] = osg::GeoSet::FLAT_TRIANGLE_STRIP; + _gsetPrimMap[PFGS_TRIFANS] = osg::GeoSet::TRIANGLE_FAN; + _gsetPrimMap[PFGS_FLAT_TRIFANS] = osg::GeoSet::FLAT_TRIANGLE_FAN; + _gsetPrimMap[PFGS_POLYS] = osg::GeoSet::POLYGON; + _gsetPrimMap[PFGS_NUM_PRIMS] = osg::GeoSet::NO_TYPE; + + _gsetBindMap[PFGS_OFF] = osg::GeoSet::BIND_OFF; + _gsetBindMap[PFGS_OVERALL] = osg::GeoSet::BIND_OVERALL; + _gsetBindMap[PFGS_PER_PRIM] = osg::GeoSet::BIND_PERPRIM; + _gsetBindMap[PFGS_PER_VERTEX] = osg::GeoSet::BIND_PERVERTEX; + + + _gstateTypeMap[PFSTATE_TRANSPARENCY] = osg::GeoState::TRANSPARENCY; + _gstateTypeMap[PFSTATE_ANTIALIAS] = osg::GeoState::ANTIALIAS; + _gstateTypeMap[PFSTATE_ENLIGHTING] = osg::GeoState::LIGHTING; + _gstateTypeMap[PFSTATE_ENTEXTURE] = osg::GeoState::TEXTURE; + _gstateTypeMap[PFSTATE_ENFOG] = osg::GeoState::FOG; + _gstateTypeMap[PFSTATE_CULLFACE] = osg::GeoState::FACE_CULL; + _gstateTypeMap[PFSTATE_ENWIREFRAME] = osg::GeoState::WIREFRAME; + _gstateTypeMap[PFSTATE_ENTEXGEN] = osg::GeoState::TEXGEN; + _gstateTypeMap[PFSTATE_ENTEXMAT] = osg::GeoState::TEXMAT; + +// not currently supported under the OSG. +// _gstateTypeMap[PFSTATE_DECAL] = ; +// _gstateTypeMap[PFSTATE_ENTEXLOD] = ; +// _gstateTypeMap[PFSTATE_ALPHAFUNC] = ; +// _gstateTypeMap[PFSTATE_ENCOLORTABLE] = ; +// _gstateTypeMap[PFSTATE_ENHIGHLIGHTING] = ; +// _gstateTypeMap[PFSTATE_ENLPOINTSTATE] = ; + + _saveImagesAsRGB = false; + _saveAbsoluteImagePath = false; + +} + +ConvertFromPerformer::~ConvertFromPerformer() +{ +} + + +osg::Node* ConvertFromPerformer::convert(pfNode* node) +{ + if (node==NULL) return NULL; + return visitNode(NULL,node); +} + + +osg::Object* ConvertFromPerformer::getOsgObject(pfObject* pfObj) +{ + PfObjectToOsgObjectMap::iterator fitr = _pfToOsgMap.find(pfObj); + if (fitr != _pfToOsgMap.end()) + { +// osg::notify(DEBUG) << "Found shared object"<getType()->isDerivedFrom( pfBillboard::getClassType())) return visitBillboard(osgParent,(pfBillboard*)node); + else if (node->getType()->isDerivedFrom( pfGeode::getClassType())) return visitGeode(osgParent,(pfGeode*)node); + else if (node->getType()->isDerivedFrom( pfScene::getClassType())) return visitScene(osgParent,(pfScene*)node); + else if (node->getType()->isDerivedFrom( pfDCS::getClassType())) return visitDCS(osgParent,(pfDCS*)node); + else if (node->getType()->isDerivedFrom( pfSCS::getClassType())) return visitSCS(osgParent,(pfSCS*)node); + else if (node->getType()->isDerivedFrom( pfLOD::getClassType())) return visitLOD(osgParent,(pfLOD*)node); + else if (node->getType()->isDerivedFrom( pfSequence::getClassType())) return visitSequence(osgParent,(pfSequence*)node); + else if (node->getType()->isDerivedFrom( pfSwitch::getClassType())) return visitSwitch(osgParent,(pfSwitch*)node); + else if (node->getType()->isDerivedFrom( pfGroup::getClassType())) return visitGroup(osgParent,(pfGroup*)node); + + return NULL; +} + +osg::Node* ConvertFromPerformer::visitScene(osg::Group* osgParent,pfScene* scene) +{ + osg::Scene* osgScene = dynamic_cast(getOsgObject(scene)); + if (osgScene) + { + if (osgParent) osgParent->addChild(osgScene); + return osgScene; + } + + osgScene = new osg::Scene; + if (osgParent) osgParent->addChild(osgScene); + + regisiterPfObjectForOsgObject(scene,osgScene); + + const char* name = scene->getName(); + if (name) osgScene->setName(name); + + for(int i=0;igetNumChildren();++i) + { + visitNode(osgScene,scene->getChild(i)); + } + return (osg::Node*)osgScene; +} + +osg::Node* ConvertFromPerformer::visitGroup(osg::Group* osgParent,pfGroup* group) +{ + osg::Group* osgGroup = dynamic_cast(getOsgObject(group)); + if (osgGroup) + { + if (osgParent) osgParent->addChild(osgGroup); + return osgGroup; + } + + osgGroup = new osg::Group; + if (osgParent) osgParent->addChild(osgGroup); + + regisiterPfObjectForOsgObject(group,osgGroup); + + const char* name = group->getName(); + if (name) osgGroup->setName(name); + + for(int i=0;igetNumChildren();++i) + { + visitNode(osgGroup,group->getChild(i)); + } + return (osg::Node*)osgGroup; +} + +osg::Node* ConvertFromPerformer::visitLOD(osg::Group* osgParent,pfLOD* lod) +{ + osg::LOD* osgLOD = dynamic_cast(getOsgObject(lod)); + if (osgLOD) + { + if (osgParent) osgParent->addChild(osgLOD); + return osgLOD; + } + + osgLOD = new osg::LOD; + if (osgParent) osgParent->addChild(osgLOD); + + regisiterPfObjectForOsgObject(lod,osgLOD); + + const char* name = lod->getName(); + if (name) osgLOD->setName(name); + + pfVec3 center; + lod->getCenter(center); + osg::Vec3 osgCenter(center[0],center[1],center[2]); + osgLOD->setCenter(osgCenter); + + int i; + for(i=0;igetNumRanges();++i) + { + osgLOD->setRange(i,lod->getRange(i)); + } + + for(i=0;igetNumChildren();++i) + { + visitNode(osgLOD,lod->getChild(i)); + } + return (osg::Node*)osgLOD; + +} + +osg::Node* ConvertFromPerformer::visitSwitch(osg::Group* osgParent,pfSwitch* switchNode) +{ + osg::Switch* osgSwitch = dynamic_cast(getOsgObject(switchNode)); + if (osgSwitch) + { + if (osgParent) osgParent->addChild(osgSwitch); + return osgSwitch; + } + + osgSwitch = new osg::Switch; + if (osgParent) osgParent->addChild(osgSwitch); + + regisiterPfObjectForOsgObject(switchNode,osgSwitch); + + const char* name = switchNode->getName(); + if (name) osgSwitch->setName(name); + + float val = switchNode->getVal(); + if (val==PFSWITCH_ON) + { + osgSwitch->setVal(osg::Switch::ALL_CHILDREN_ON); + } + else if (val==PFSWITCH_OFF) + { + osgSwitch->setVal(osg::Switch::ALL_CHILDREN_OFF); + } + else + { + osgSwitch->setVal((int)val); + } + + for(int i=0;igetNumChildren();++i) + { + visitNode(osgSwitch,switchNode->getChild(i)); + } + return (osg::Node*)osgSwitch; +} + +osg::Node* ConvertFromPerformer::visitSequence(osg::Group* osgParent,pfSequence* sequence) +{ + osg::Sequence* osgSequence = dynamic_cast(getOsgObject(sequence)); + if (osgSequence) + { + if (osgParent) osgParent->addChild(osgSequence); + return osgSequence; + } + + osgSequence = new osg::Sequence; + if (osgParent) osgParent->addChild(osgSequence); + + regisiterPfObjectForOsgObject(sequence,osgSequence); + + for(int i=0;igetNumChildren();++i) + { + visitNode(osgSequence,sequence->getChild(i)); + } + return (osg::Node*)osgSequence; +} + +osg::Node* ConvertFromPerformer::visitDCS(osg::Group* osgParent,pfDCS* dcs) +{ + + osg::DCS* osgDCS = dynamic_cast(getOsgObject(dcs)); + if (osgDCS) + { + if (osgParent) osgParent->addChild(osgDCS); + return osgDCS; + } + + osgDCS = new osg::DCS; + if (osgParent) osgParent->addChild(osgDCS); + + regisiterPfObjectForOsgObject(dcs,osgDCS); + + const char* name = dcs->getName(); + if (name) osgDCS->setName(name); + + pfMatrix matrix; + dcs->getMat(matrix); + + osg::Matrix osgMatrix(matrix[0][0],matrix[0][1],matrix[0][2],matrix[0][3], + matrix[1][0],matrix[1][1],matrix[1][2],matrix[1][3], + matrix[2][0],matrix[2][1],matrix[2][2],matrix[2][3], + matrix[3][0],matrix[3][1],matrix[3][2],matrix[3][3]); + + osgDCS->setMatrix(osgMatrix); + + for(int i=0;igetNumChildren();++i) + { + visitNode(osgDCS,dcs->getChild(i)); + } + return (osg::Node*)osgDCS; +} + +osg::Node* ConvertFromPerformer::visitSCS(osg::Group* osgParent,pfSCS* scs) +{ + // note the OSG does not currently have a SCS, so use DCS instead. + osg::DCS* osgDCS = dynamic_cast(getOsgObject(scs)); + if (osgDCS) + { + if (osgParent) osgParent->addChild(osgDCS); + return osgDCS; + } + + osgDCS = new osg::DCS; + if (osgParent) osgParent->addChild(osgDCS); + + regisiterPfObjectForOsgObject(scs,osgDCS); + + const char* name = scs->getName(); + if (name) osgDCS->setName(name); + + pfMatrix matrix; + scs->getMat(matrix); + osg::Matrix osgMatrix(matrix[0][0],matrix[0][1],matrix[0][2],matrix[0][3], + matrix[1][0],matrix[1][1],matrix[1][2],matrix[1][3], + matrix[2][0],matrix[2][1],matrix[2][2],matrix[2][3], + matrix[3][0],matrix[3][1],matrix[3][2],matrix[3][3]); + + osgDCS->setMatrix(osgMatrix); + + for(int i=0;igetNumChildren();++i) + { + visitNode(osgDCS,scs->getChild(i)); + } + return (osg::Node*)osgDCS; +} + +osg::Node* ConvertFromPerformer::visitGeode(osg::Group* osgParent,pfGeode* geode) +{ + osg::Geode* osgGeode = dynamic_cast(getOsgObject(geode)); + if (osgGeode) + { + if (osgParent) osgParent->addChild(osgGeode); + return osgGeode; + } + + osgGeode = new osg::Geode; + if (osgParent) osgParent->addChild(osgGeode); + + regisiterPfObjectForOsgObject(geode,osgGeode); + + const char* name = geode->getName(); + if (name) osgGeode->setName(name); + + for(int i=0;igetNumGSets();++i) + { + visitGeoSet(osgGeode,geode->getGSet(i)); + } + + return (osg::Node*)osgGeode; +} + +osg::Node* ConvertFromPerformer::visitBillboard(osg::Group* osgParent,pfBillboard* billboard) +{ +// return NULL; + + osg::Billboard* osgBillboard = dynamic_cast(getOsgObject(billboard)); + if (osgBillboard) + { + if (osgParent) osgParent->addChild(osgBillboard); + return osgBillboard; + } + + osgBillboard = new osg::Billboard; + if (osgParent) osgParent->addChild(osgBillboard); + + regisiterPfObjectForOsgObject(billboard,osgBillboard); + + const char* name = billboard->getName(); + if (name) osgBillboard->setName(name); + + pfVec3 axis; + billboard->getAxis(axis); + osgBillboard->setAxis(osg::Vec3(axis[0],axis[1],axis[2])); + + for(int i=0;igetNumGSets();++i) + { + /* osg::GeoSet* osggset = */visitGeoSet(osgBillboard,billboard->getGSet(i)); + pfVec3 pos; + billboard->getPos(i,pos); + osgBillboard->setPos(i,osg::Vec3(pos[0],pos[1],pos[2])); + } + + return (osg::Node*)osgBillboard; +} + +int ConvertFromPerformer::getNumVerts(pfGeoSet *gset) +{ + int nv; + int np; + int *lens; + int i; + + np = gset->getNumPrims(); + nv = 0; + + switch( gset->getPrimType() ) + { + case PFGS_POINTS : + nv = np; + break; + + case PFGS_LINES : + nv = 2 * np; + break; + + case PFGS_TRIS : + nv = 3 * np; + break; + + case PFGS_QUADS : + nv = 4 * np; + break; + + case PFGS_TRISTRIPS : + case PFGS_FLAT_TRISTRIPS : + case PFGS_POLYS : + case PFGS_LINESTRIPS : + case PFGS_FLAT_LINESTRIPS : + + lens = gset->getPrimLengths(); + for( i = 0; i < np; i++ ) + nv += lens[i]; + break; + + } + + + return nv; +} + +osg::GeoSet* ConvertFromPerformer::visitGeoSet(osg::Geode* osgGeode,pfGeoSet* geoset) +{ + if (geoset==NULL) return NULL; + + osg::GeoSet* osgGeoSet = dynamic_cast(getOsgObject(geoset)); + if (osgGeoSet) + { + if (osgGeode) osgGeode->addGeoSet(osgGeoSet); + return osgGeoSet; + } + + osgGeoSet = new osg::GeoSet; + if (osgGeode) osgGeode->addGeoSet(osgGeoSet); + + regisiterPfObjectForOsgObject(geoset,osgGeoSet); + + visitGeoState(osgGeoSet,geoset->getGState()); + + int i; + + // number of prims + int np = geoset->getNumPrims(); + int *plen = geoset->getPrimLengths(); + + // Number of verticies (may be different than number of coords) + int nv = getNumVerts( geoset ); + + int prim = geoset->getPrimType(); + int flat_shaded_offset=0; + if (prim == PFGS_FLAT_LINESTRIPS) flat_shaded_offset=np; + else if (prim == PFGS_FLAT_TRISTRIPS) flat_shaded_offset=2*np; + else if (prim == PFGS_FLAT_TRIFANS) flat_shaded_offset=2*np; + + osgGeoSet->setPrimType(_gsetPrimMap[geoset->getPrimType()]); + osgGeoSet->setNumPrims(np); + + if (plen) + { + int *osg_plen = new int [np]; + for(i=0;isetPrimLengths(osg_plen); + } + + pfVec3 *coords; + ushort *ilist; + geoset->getAttrLists( PFGS_COORD3, (void **)&coords, &ilist ); + + // copy the vertex coordinates across. + if( coords ) + { + // calc the maximum num of vertex from the index list. + int cc; + if (ilist) + { + cc = 0; + for( i = 0; i < nv; i++ ) + if( ilist[i] > cc ) cc = ilist[i]; + cc++; + } + else + cc = nv; + + + osg::Vec3* osg_coords = new osg::Vec3 [cc]; + for( i = 0; i < cc; i++ ) + { + osg_coords[i][0] = coords[i][0]; + osg_coords[i][1] = coords[i][1]; + osg_coords[i][2] = coords[i][2]; + } + + if(ilist) + { + osg::ushort* osg_cindex = new osg::ushort [nv]; + for( i = 0; i < nv; i++ ) + { + osg_cindex[i] = ilist[i]; + } + osgGeoSet->setCoords(osg_coords, osg_cindex ); + } + else + { + osgGeoSet->setCoords(osg_coords); + } + + } + + pfVec3 *norms; + geoset->getAttrLists( PFGS_NORMAL3, (void **)&norms, &ilist ); + + // copy normals + if(norms) + { + int bind = geoset->getAttrBind( PFGS_NORMAL3 ); + int nn = bind == PFGS_OFF ? 0 : + bind == PFGS_OVERALL ? 1 : + bind == PFGS_PER_PRIM ? geoset->getNumPrims() : + bind == PFGS_PER_VERTEX ? nv-flat_shaded_offset : 0; + + // set the normal binding type. + osgGeoSet->setNormalBinding(_gsetBindMap[bind]); + + // calc the maximum num of vertex from the index list. + int cc; + if (ilist) + { + cc = 0; + for( i = 0; i < nn; i++ ) + if( ilist[i] > cc ) cc = ilist[i]; + cc++; + } + else + cc = nn; + + + osg::Vec3* osg_norms = new osg::Vec3 [cc]; + for( i = 0; i < cc; i++ ) + { + osg_norms[i][0] = norms[i][0]; + osg_norms[i][1] = norms[i][1]; + osg_norms[i][2] = norms[i][2]; + } + + if(ilist) + { + osg::ushort* osg_cindex = new osg::ushort [nn]; + for( i = 0; i < nn; i++ ) + { + osg_cindex[i] = ilist[i]; + } + osgGeoSet->setNormals(osg_norms, osg_cindex ); + } + else + { + osgGeoSet->setNormals(osg_norms); + } + + } + + pfVec2 *tcoords; + geoset->getAttrLists( PFGS_TEXCOORD2, (void **)&tcoords, &ilist ); + + // copy texture coords + if(tcoords) + { + int bind = geoset->getAttrBind( PFGS_TEXCOORD2 ); + int nn = bind == PFGS_OFF ? 0 : + bind == PFGS_OVERALL ? 1 : + bind == PFGS_PER_PRIM ? geoset->getNumPrims() : + bind == PFGS_PER_VERTEX ? nv : 0; + + // set the normal binding type. + osgGeoSet->setTextureBinding(_gsetBindMap[bind]); + + // calc the maximum num of vertex from the index list. + int cc; + if (ilist) + { + cc = 0; + for( i = 0; i < nv; i++ ) + if( ilist[i] > cc ) cc = ilist[i]; + cc++; + } + else + cc = nn; + + + osg::Vec2* osg_tcoords = new osg::Vec2 [cc]; + for( i = 0; i < cc; i++ ) + { + osg_tcoords[i][0] = tcoords[i][0]; + osg_tcoords[i][1] = tcoords[i][1]; + } + + if(ilist) + { + osg::ushort* osg_cindex = new osg::ushort [nn]; + for( i = 0; i < nn; i++ ) + { + osg_cindex[i] = ilist[i]; + } + osgGeoSet->setTextureCoords(osg_tcoords, osg_cindex ); + } + else + { + osgGeoSet->setTextureCoords(osg_tcoords); + } + + } + + pfVec4 *colors; + geoset->getAttrLists( PFGS_COLOR4, (void **)&colors, &ilist ); + + // copy color coords + if(colors) + { + int bind = geoset->getAttrBind( PFGS_COLOR4 ); + int nn = bind == PFGS_OFF ? 0 : + bind == PFGS_OVERALL ? 1 : + bind == PFGS_PER_PRIM ? geoset->getNumPrims() : + bind == PFGS_PER_VERTEX ? nv-flat_shaded_offset : 0; + + // set the normal binding type. + osgGeoSet->setColorBinding(_gsetBindMap[bind]); + + // calc the maximum num of vertex from the index list. + int cc; + if (ilist) + { + cc = 0; + for( i = 0; i < nn; i++ ) + if( ilist[i] > cc ) cc = ilist[i]; + cc++; + } + else + cc = nn; + + + osg::Vec4* osg_colors = new osg::Vec4 [cc]; + for( i = 0; i < cc; i++ ) + { + osg_colors[i][0] = colors[i][0]; + osg_colors[i][1] = colors[i][1]; + osg_colors[i][2] = colors[i][2]; + osg_colors[i][3] = colors[i][3]; + } + + if(ilist) + { + osg::ushort* osg_cindex = new osg::ushort [nn]; + for( i = 0; i < nn; i++ ) + { + osg_cindex[i] = ilist[i]; + } + osgGeoSet->setColors(osg_colors, osg_cindex ); + } + else + { + osgGeoSet->setColors(osg_colors); + } + + } + + return osgGeoSet; +} + +osg::GeoState* ConvertFromPerformer::visitGeoState(osg::GeoSet* osgGeoSet,pfGeoState* geostate) +{ + if (geostate==NULL) return NULL; + + osg::GeoState* osgGeoState = dynamic_cast(getOsgObject(geostate)); + if (osgGeoState) + { + if (osgGeoSet) osgGeoSet->setGeoState(osgGeoState); + return osgGeoState; + } + + osgGeoState = new osg::GeoState; + if (osgGeoSet) osgGeoSet->setGeoState(osgGeoState); + + regisiterPfObjectForOsgObject(geostate,osgGeoState); + + + // Don could you fill in some of these blanks??? + unsigned int inherit = geostate->getInherit(); +// osg::notify(DEBUG) << endl << "Inherit = "<setMode(osg::GeoState::TRANSPARENCY,osg::GeoState::INHERIT); + else + { + int mode = geostate->getMode(PFSTATE_TRANSPARENCY); + switch(mode) + { + case(PFTR_FAST): + case(PFTR_HIGH_QUALITY): + case(PFTR_BLEND_ALPHA): + case(PFTR_MS_ALPHA): + case(PFTR_MS_ALPHA_MASK): + case(PFTR_NO_OCCLUDE): + case(PFTR_ON): osgGeoState->setMode(osg::GeoState::TRANSPARENCY,osg::GeoState::ON);break; + case(PFTR_OFF): osgGeoState->setMode(osg::GeoState::TRANSPARENCY,osg::GeoState::OFF);break; + default: osgGeoState->setMode(osg::GeoState::TRANSPARENCY,osg::GeoState::INHERIT);break; + } + } + + if (inherit & PFSTATE_ENTEXTURE) osgGeoState->setMode(osg::GeoState::TEXTURE,osg::GeoState::INHERIT); + else + { + int mode = geostate->getMode(PFSTATE_ENTEXTURE); + switch(mode) + { + case(PF_ON): osgGeoState->setMode(osg::GeoState::TEXTURE,osg::GeoState::ON);break; + case(PF_OFF): + default: osgGeoState->setMode(osg::GeoState::TEXTURE,osg::GeoState::OFF);break; + } + } + + if (inherit & PFSTATE_CULLFACE) osgGeoState->setMode(osg::GeoState::FACE_CULL,osg::GeoState::INHERIT); + else + { + int mode = geostate->getMode(PFSTATE_CULLFACE); + switch(mode) + { + case(PFCF_BACK): + { + osgGeoState->setMode(osg::GeoState::FACE_CULL,osg::GeoState::ON); + osg::CullFace *cf = new osg::CullFace; + cf->setMode(osg::CullFace::BACK); + osgGeoState->setAttribute(osg::GeoState::FACE_CULL,cf); + } + break; + + case(PFCF_FRONT): + { + osgGeoState->setMode(osg::GeoState::FACE_CULL,osg::GeoState::ON); + osg::CullFace *cf = new osg::CullFace; + cf->setMode(osg::CullFace::FRONT); + osgGeoState->setAttribute(osg::GeoState::FACE_CULL,cf); + } + break; + case(PFCF_BOTH): + { + osgGeoState->setMode(osg::GeoState::FACE_CULL,osg::GeoState::ON); + osg::CullFace *cf = new osg::CullFace; + cf->setMode(osg::CullFace::FRONT_AND_BACK); + osgGeoState->setAttribute(osg::GeoState::FACE_CULL,cf); + } + break; + case(PFCF_OFF): + default: osgGeoState->setMode(osg::GeoState::FACE_CULL,osg::GeoState::OFF);break; + } + } + + if (inherit & PFSTATE_ENLIGHTING) osgGeoState->setMode(osg::GeoState::LIGHTING,osg::GeoState::INHERIT); + else + { + int mode = geostate->getMode(PFSTATE_ENLIGHTING); + switch(mode) + { + case(PF_ON): osgGeoState->setMode(osg::GeoState::LIGHTING,osg::GeoState::ON);break; + case(PF_OFF): + default: osgGeoState->setMode(osg::GeoState::LIGHTING,osg::GeoState::OFF);break; + } + } + + if (inherit & PFSTATE_ENFOG) osgGeoState->setMode(osg::GeoState::FOG,osg::GeoState::INHERIT); + else + { + int mode = geostate->getMode(PFSTATE_ENFOG); + switch(mode) + { + case(PF_ON): osgGeoState->setMode(osg::GeoState::FOG,osg::GeoState::ON);break; + case(PF_OFF): + default: osgGeoState->setMode(osg::GeoState::FOG,osg::GeoState::OFF);break; + } + } + +// not currently supported by OSG +// if (inherit & PFSTATE_ENWIREFRAME) osgGeoState->setMode(osg::GeoState::WIREFRAME,osg::GeoState::INHERIT); +// else +// { +// int mode = geostate->getMode(PFSTATE_ENWIREFRAME); +// switch(mode) +// { +// case(PF_ON): osgGeoState->setMode(osg::GeoState::WIREFRAME,osg::GeoState::ON);break; +// case(PF_OFF): +// default: osgGeoState->setMode(osg::GeoState::WIREFRAME,osg::GeoState::OFF);break; +// } +// } + + +// redundent in OSG's implementation of texmat mode +// if (inherit & PFSTATE_ENTEXMAT) osgGeoState->setMode(osg::GeoState::TEXMAT,osg::GeoState::INHERIT); +// else +// { +// int mode = geostate->getMode(PFSTATE_ENTEXMAT); +// switch(mode) +// { +// case(PF_ON): osgGeoState->setMode(osg::GeoState::TEXMAT,osg::GeoState::ON);break; +// case(PF_OFF): +// default: osgGeoState->setMode(osg::GeoState::TEXMAT,osg::GeoState::OFF);break; +// } +// } + + if (inherit & PFSTATE_ENTEXGEN) osgGeoState->setMode(osg::GeoState::TEXGEN,osg::GeoState::INHERIT); + else + { + int mode = geostate->getMode(PFSTATE_ENTEXGEN); + switch(mode) + { + case(PF_ON): osgGeoState->setMode(osg::GeoState::TEXGEN,osg::GeoState::ON);break; + case(PF_OFF): + default: osgGeoState->setMode(osg::GeoState::TEXGEN,osg::GeoState::OFF);break; + } + } + + pfMaterial* mat = (pfMaterial*)geostate->getAttr(PFSTATE_FRONTMTL); + visitMaterial(osgGeoState,mat); + + pfTexture* tex = (pfTexture*)geostate->getAttr(PFSTATE_TEXTURE); + visitTexture(osgGeoState,tex); + + pfTexGen* texgen = (pfTexGen*)geostate->getAttr(PFSTATE_TEXGEN); + if (texgen) + { + osg::TexGen* osgTexGen = new osg::TexGen(); + int mode = texgen->getMode(PF_S); + switch(mode) + { + case(PFTG_OBJECT_LINEAR) : + osgTexGen->setMode(osg::TexGen::OBJECT_LINEAR); + osgGeoState->setAttribute(osg::GeoState::TEXGEN,osgTexGen); + break; + case(PFTG_EYE_LINEAR_IDENT) : + cerr << "TexGen Mode PFTG_EYE_LINEAR_IDENT not currently supported by the OSG,"<setMode(osg::TexGen::EYE_LINEAR); + osgGeoState->setAttribute(osg::GeoState::TEXGEN,osgTexGen); + break; + case(PFTG_SPHERE_MAP) : + osgTexGen->setMode(osg::TexGen::SPHERE_MAP); + osgGeoState->setAttribute(osg::GeoState::TEXGEN,osgTexGen); + break; + case(PFTG_OFF) : + osgGeoState->setMode(osg::GeoState::TEXGEN,osg::GeoState::OFF); + break; + case(PFTG_OBJECT_DISTANCE_TO_LINE) : + cerr << "TexGen Mode PFTG_OBJECT_DISTANCE_TO_LINE not currently supported by the OSG."<setMode(osg::GeoState::TEXGEN,osg::GeoState::OFF); + break; + case(PFTG_EYE_DISTANCE_TO_LINE) : + cerr << "TexGen Mode PFTG_EYE_DISTANCE_TO_LINE not currently supported by the OSG."<setMode(osg::GeoState::TEXGEN,osg::GeoState::OFF); + break; + default: + cerr << "TexGen Mode "<setMode(osg::GeoState::TEXGEN,osg::GeoState::OFF); + break; + } + + } + + pfMatrix* texmat = (pfMatrix*)geostate->getAttr(PFSTATE_TEXMAT); + if (texmat) + { + osg::Matrix osgMatrix((*texmat)[0][0],(*texmat)[0][1],(*texmat)[0][2],(*texmat)[0][3], + (*texmat)[1][0],(*texmat)[1][1],(*texmat)[1][2],(*texmat)[1][3], + (*texmat)[2][0],(*texmat)[2][1],(*texmat)[2][2],(*texmat)[2][3], + (*texmat)[3][0],(*texmat)[3][1],(*texmat)[3][2],(*texmat)[3][3]); + + osg::TexMat* osgTexMat = new osg::TexMat(); + osgTexMat->copy(osgMatrix); + osgGeoState->setAttribute(osg::GeoState::TEXMAT,osgTexMat); + } + + + return osgGeoState; +} + +osg::Material* ConvertFromPerformer::visitMaterial(osg::GeoState* osgGeoState,pfMaterial* material) +{ + if (material==NULL) return NULL; + + osg::Material* osgMaterial = new osg::Material; + if (osgGeoState) osgGeoState->setAttribute(osg::GeoState::MATERIAL,osgMaterial); + + float s = material->getShininess(); + osgMaterial->setShininess(osg::Material::FACE_FRONT_AND_BACK,s); + + float a = material->getAlpha(); + float r,g,b; + + material->getColor(PFMTL_AMBIENT,&r,&g,&b); + osgMaterial->setAmbient(osg::Material::FACE_FRONT_AND_BACK,osg::Vec4(r,g,b,a)); + + material->getColor(PFMTL_DIFFUSE,&r,&g,&b); + osgMaterial->setDiffuse(osg::Material::FACE_FRONT_AND_BACK,osg::Vec4(r,g,b,a)); + + material->getColor(PFMTL_EMISSION,&r,&g,&b); + osgMaterial->setEmission(osg::Material::FACE_FRONT_AND_BACK,osg::Vec4(r,g,b,a)); + + material->getColor(PFMTL_SPECULAR,&r,&g,&b); + osgMaterial->setSpecular(osg::Material::FACE_FRONT_AND_BACK,osg::Vec4(r,g,b,a)); + + return osgMaterial; +} + +osg::Texture* ConvertFromPerformer::visitTexture(osg::GeoState* osgGeoState,pfTexture* tex) +{ + if (tex==NULL) return NULL; + + osg::Texture* osgTexture = new osg::Texture; + _pfToOsgMap[tex] = osgTexture; + + if (osgGeoState) osgGeoState->setAttribute(osg::GeoState::TEXTURE,osgTexture); + + + int repeat_r = tex->getRepeat(PFTEX_WRAP_R); + int repeat_s = tex->getRepeat(PFTEX_WRAP_S); + int repeat_t = tex->getRepeat(PFTEX_WRAP_T); + + if (repeat_r==PFTEX_CLAMP) osgTexture->setWrap(osg::Texture::WRAP_R,osg::Texture::CLAMP); + else osgTexture->setWrap(osg::Texture::WRAP_R,osg::Texture::REPEAT); + + if (repeat_s==PFTEX_CLAMP) osgTexture->setWrap(osg::Texture::WRAP_S,osg::Texture::CLAMP); + else osgTexture->setWrap(osg::Texture::WRAP_S,osg::Texture::REPEAT); + + if (repeat_t==PFTEX_CLAMP) osgTexture->setWrap(osg::Texture::WRAP_T,osg::Texture::CLAMP); + else osgTexture->setWrap(osg::Texture::WRAP_T,osg::Texture::REPEAT); + + std::string texName = tex->getName(); + + if (_saveImagesAsRGB) + { + std::string strippedName = osg::getStrippedName(texName); + texName = _saveImageDirectory+strippedName+".rgb"; + tex->saveFile(texName.c_str()); + } + + if (!_saveAbsoluteImagePath) texName = osg::getSimpleFileName(texName); + + osg::Image* image = new osg::Image; + image->setFileName(texName.c_str()); + + osgTexture->setImage(image); + + return osgTexture; +} diff --git a/src/osgPlugins/pfb/pf2osg/ConvertFromPerformer.h b/src/osgPlugins/pfb/pf2osg/ConvertFromPerformer.h new file mode 100644 index 000000000..2a7096c97 --- /dev/null +++ b/src/osgPlugins/pfb/pf2osg/ConvertFromPerformer.h @@ -0,0 +1,72 @@ +#ifndef __CONVERTFROMPERFORMER_H +#define __CONVERTFROMPERFORMER_H + +#include +#include +#include + +// Open Scene Graph includes. +#include +#include +#include +#include + +// Performer includes. +#include + +class ConvertFromPerformer { + public: + + ConvertFromPerformer(); + ~ConvertFromPerformer(); + + osg::Node* convert(pfNode* node); + + void setSaveImageDirectory(const std::string& directory) { _saveImageDirectory = directory; } + void setSaveImagesAsRGB(bool b) { _saveImagesAsRGB=b; } + void setSaveAbsoluteImagePath(bool b) { _saveAbsoluteImagePath = b; } + + private: + + osg::Object* getOsgObject(pfObject* pfObj); + void regisiterPfObjectForOsgObject(pfObject* pfObj,osg::Object* osgObj); + + osg::Node* visitNode(osg::Group* osgParent,pfNode* node); + osg::Node* visitScene(osg::Group* osgParent,pfScene* scene); + osg::Node* visitGroup(osg::Group* osgParent,pfGroup* group); + osg::Node* visitDCS(osg::Group* osgParent,pfDCS* dcs); + osg::Node* visitLOD(osg::Group* osgParent,pfLOD* lod); + osg::Node* visitSwitch(osg::Group* osgParent,pfSwitch* switchNode); + osg::Node* visitSequence(osg::Group* osgParent,pfSequence* sequence); + osg::Node* visitSCS(osg::Group* osgParent,pfSCS* scs); + osg::Node* visitGeode(osg::Group* osgParent,pfGeode* geode); + osg::Node* visitBillboard(osg::Group* osgParent,pfBillboard* billboard); + + int getNumVerts(pfGeoSet *gset); + osg::GeoSet* visitGeoSet(osg::Geode* osgParent,pfGeoSet* geoset); + osg::GeoState* visitGeoState(osg::GeoSet* osgGeoSet,pfGeoState* geostate); + osg::Material* visitMaterial(osg::GeoState* osgGeoState,pfMaterial* material); + osg::Texture* visitTexture(osg::GeoState* osgGeoState,pfTexture* tex); + + typedef std::map GSetPrimitiveMap; + typedef std::map GSetBindingMap; + typedef std::map GStateTypeMap; + typedef std::map GStateModeMap; + + GSetPrimitiveMap _gsetPrimMap; + GSetBindingMap _gsetBindMap; + GStateTypeMap _gstateTypeMap; + GStateModeMap _gstateModeMap; + + bool _saveImagesAsRGB; + bool _saveAbsoluteImagePath; + std::string _saveImageDirectory; + + typedef std::map PfObjectToOsgObjectMap; + PfObjectToOsgObjectMap _pfToOsgMap; + + osg::Node* _osgRoot; + +}; + +#endif diff --git a/src/osgPlugins/pfb/pf2osg/Makedepend b/src/osgPlugins/pfb/pf2osg/Makedepend new file mode 100644 index 000000000..e69de29bb diff --git a/src/osgPlugins/pfb/pf2osg/Makefile b/src/osgPlugins/pfb/pf2osg/Makefile new file mode 100644 index 000000000..dbb9e7ea8 --- /dev/null +++ b/src/osgPlugins/pfb/pf2osg/Makefile @@ -0,0 +1,20 @@ +#!smake +include ../../Make/makedefs + +C++FILES = \ + ConvertFromPerformer.cpp\ + pf2osg.cpp + +C++FLAGS += -I../../include -O + + +LIBS = -losg + +TARGET = ../../bin/pf2osg + +LDFLAGS += -L../../lib -L/usr/X11R6/lib + +LIBS = -losg -lGLU -lGL -lm ${PFLIBS} + +include ../../Make/makerules + diff --git a/src/osgPlugins/pfb/pf2osg/Makefile.lib b/src/osgPlugins/pfb/pf2osg/Makefile.lib new file mode 100644 index 000000000..b63aa19a5 --- /dev/null +++ b/src/osgPlugins/pfb/pf2osg/Makefile.lib @@ -0,0 +1,18 @@ +#!smake +include ../../Make/makedefs + +C++FILES = \ + ConvertFromPerformer.cpp\ + osg.cpp +# pf2osg.cpp\ + + +LIB = ../../lib/libpfosg_ogl.so + +C++FLAGS += -I../../include +LDFLAGS += -L../../lib + +include ../../Make/makerules + + + diff --git a/src/osgPlugins/pfb/pf2osg/osg.cpp b/src/osgPlugins/pfb/pf2osg/osg.cpp new file mode 100644 index 000000000..72bf10d42 --- /dev/null +++ b/src/osgPlugins/pfb/pf2osg/osg.cpp @@ -0,0 +1,40 @@ +#include "ConvertFromPerformer.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +// Performer includes. +#include + + +extern "C" { + + int pfdStoreFile_osg(pfNode *root, const char *fileName); + +}; + + +int pfdStoreFile_osg(pfNode *root, const char *fileName) +{ + ConvertFromPerformer converter; + osg::Node* osg_root = converter.convert(root); + if (osg_root) + { + osg::Registry::instance()->writeNode(*osg_root,fileName); + return 1; + } + else + { + cerr << "error : failed to create any perfomer database from input files."< +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +// Performer includes. +#include + +#ifdef OSG_USE_IO_DOT_H +#include +#else +#include +using namespace std; +#endif + + +int main( int argc, const char **argv ) +{ + + // create the list of input files from the command line arguments + typedef std::vector FileList; + FileList filelist; + + bool saveImagesAsRGB = false; + for(int i=1;i nodeList; + for(itr=filelist.begin();itr!=filelist.end();++itr) + { + pfNode* pf_file_root = pfdLoadFile((*itr).c_str()); + if (pf_file_root) + { + nodeList.push_back(pf_file_root); + } + } + + + if (!nodeList.empty()) + { + pfNode* pf_root = NULL; + if (nodeList.size()==1) + { + pf_root = nodeList[0]; + } + else + { + pfGroup* group = new pfGroup; + for(std::vector::iterator ni=nodeList.begin(); + ni!=nodeList.end(); + ++ni) + { + group->addChild(*ni); + } + pf_root = (pfNode*) group; + } + + ConvertFromPerformer converter; + converter.setSaveImageDirectory(outpath); + converter.setSaveImagesAsRGB(saveImagesAsRGB); + + osg::Node* osg_root = converter.convert(pf_root); + if (osg_root) + { + osg::Registry::instance()->writeNode(*osg_root,outfile.c_str()); + } + else + { + osg::notify(osg::NOTICE) << "error : failed to convert perfomer scene graph to OSG."< +#include +#include +#include + +#include +#include +#include + +// Performer includes. +#include + +#include "ConvertFromPerformer.h" +#include "ConvertToPerformer.h" + +using namespace osg; + +// now register with Registry to instantiate the pfb reader/writer. +RegisterReaderWriterProxy g_performerReaderWriterProxy; + +PerformerReaderWriter::PerformerReaderWriter() +{ + _perfomerInitialised = false; +} + +PerformerReaderWriter::~PerformerReaderWriter() +{ + if (_perfomerInitialised) + { + pfExit(); + } +} + +void PerformerReaderWriter::initialisePerformer(const std::string& fileName) +{ + if (_perfomerInitialised) return; + + pfInit(); + pfdInitConverter(fileName.c_str()); + pfConfig(); + + _perfomerInitialised = true; +} + +osg::Object* PerformerReaderWriter::readObject(const std::string& fileName) +{ + return readNode(fileName); +} + +osg::Node* PerformerReaderWriter::readNode(const std::string& fileName) +{ + initialisePerformer(fileName.c_str()); + + osg::Node* osg_root = NULL; + pfNode* pf_root = pfdLoadFile(fileName.c_str()); + if (pf_root) + { + ConvertFromPerformer converter; + osg_root = converter.convert(pf_root); + } + return osg_root; +} + +bool PerformerReaderWriter::writeObject(osg::Object& obj,const std::string& fileName) +{ + osg::Node* node = dynamic_cast(&obj); + if (node) return writeNode(*node,fileName); + return false; +} + +bool PerformerReaderWriter::writeNode(osg::Node& node,const std::string& fileName) +{ + initialisePerformer(fileName.c_str()); + + ConvertToPerformer converter; + pfNode* pf_root = converter.convert(&node); + + if (pf_root) { + pfdStoreFile(pf_root,fileName.c_str()); + } + + return false; +} diff --git a/src/osgPlugins/pfb/pf2osg/pfb.h b/src/osgPlugins/pfb/pf2osg/pfb.h new file mode 100644 index 000000000..c9708151c --- /dev/null +++ b/src/osgPlugins/pfb/pf2osg/pfb.h @@ -0,0 +1,38 @@ +#ifndef __PFB_H +#define __PFB_H + +#include + +// Open Scene Graph includes. +#include + +// Performer includes. +#include + +class PerformerReaderWriter : public osg::ReaderWriter +{ + public: + + PerformerReaderWriter(); + ~PerformerReaderWriter(); + + virtual const char* className() { return "Performer Reader/Writer"; } + virtual bool acceptsExtension(const std::string& extension) { return extension=="pfb"; } + + virtual osg::Object* readObject(const std::string& fileName); + virtual osg::Node* readNode(const std::string& fileName); + virtual bool writeObject(osg::Object& obj,const std::string& fileName); + virtual bool writeNode(osg::Node& node,const std::string& fileName); + + + protected: + + void initialisePerformer(const std::string& fileName); + + private: + + bool _perfomerInitialised; + +}; + +#endif diff --git a/src/osgPlugins/pic/Makedepend b/src/osgPlugins/pic/Makedepend new file mode 100644 index 000000000..e69de29bb diff --git a/src/osgPlugins/pic/Makefile b/src/osgPlugins/pic/Makefile new file mode 100644 index 000000000..314a820ee --- /dev/null +++ b/src/osgPlugins/pic/Makefile @@ -0,0 +1,18 @@ +#!smake +include ../../../Make/makedefs + +C++FILES = \ + ReaderWriterPIC.cpp\ + +LIB = ../../../lib/osgPlugins/osgdb_pic.so + +TARGET_LOADER_FILES = osgPlugins/osgdb_pic.so + +LIBS = +C++FLAGS += -I. -I../../../include +LDFLAGS += -L../../../lib + +include ../../../Make/makerules + + + diff --git a/src/osgPlugins/pic/ReaderWriterPIC.cpp b/src/osgPlugins/pic/ReaderWriterPIC.cpp new file mode 100644 index 000000000..019f0942f --- /dev/null +++ b/src/osgPlugins/pic/ReaderWriterPIC.cpp @@ -0,0 +1,242 @@ +#include +#include +#include +#include +#include +#include +#include + +#include + +/**************************************************************************** + * + * Follows is code extracted from the simage library. Original Authors: + * + * Systems in Motion, + * + * + * Peder Blekken + * Morten Eriksen + * Marius Bugge Monsen + * + * The original COPYING notice + * + * All files in this library are public domain, except simage_rgb.cpp which is + * Copyright (c) Mark J Kilgard . I will contact Mark + * very soon to hear if this source also can become public domain. + * + * Please send patches for bugs and new features to: . + * + * Peder Blekken + * + * + * Ported into the OSG as a plugin, Robert Osfield Decemeber 2000. + * Note, reference above to license of simage_rgb is not relevent to the OSG + * as the OSG does not use it. Also for patches, bugs and new features + * please send them direct to the OSG dev team rather than address above. + * + **********************************************************************/ + +#include +#include +#include + +#define ERROR_NO_ERROR 0 +#define ERROR_READING_HEADER 1 +#define ERROR_READING_PALETTE 2 +#define ERROR_MEMORY 3 +#define ERROR_READ_ERROR 4 + +static int picerror = ERROR_NO_ERROR; + + +int +simage_pic_error(char *buffer, int bufferlen) +{ + switch (picerror) { + case ERROR_READING_HEADER: + strncpy(buffer, "PIC loader: Error reading header", bufferlen); + break; + case ERROR_READING_PALETTE: + strncpy(buffer, "PIC loader: Error reading palette", bufferlen); + break; + case ERROR_MEMORY: + strncpy(buffer, "PIC loader: Out of memory error", bufferlen); + break; + case ERROR_READ_ERROR: + strncpy(buffer, "PIC loader: Read error", bufferlen); + break; + } + return picerror; +} + +/* byte order workaround *sigh* */ + +static int +readint16(FILE *fp, int * res) +{ + unsigned char tmp = 0; + unsigned int tmp2; + if (fread(&tmp, 1, 1, fp) != 1) return 0; + *res = tmp; + if (fread(&tmp, 1, 1, fp) != 1) return 0; + tmp2 = tmp; + tmp2 <<= 8; + *res |= tmp2; + return 1; +} + + +int +simage_pic_identify(const char * ptr, + const unsigned char *header, + int headerlen) +{ + static unsigned char piccmp[] = {0x19, 0x91}; + if (headerlen < 2) return 0; + if (memcmp((const void*)header, + (const void*)piccmp, 2) == 0) return 1; + return 0; +} + +unsigned char * +simage_pic_load(const char *filename, + int *width_ret, + int *height_ret, + int *numComponents_ret) +{ + int w, h, width, height, i, j, format; + unsigned char palette[256][3]; + unsigned char * tmpbuf, * buffer, * ptr; + + FILE *fp = fopen(filename, "rb"); + if (!fp) return NULL; + + picerror = ERROR_NO_ERROR; + + fseek(fp, 2, SEEK_SET); + if (!readint16(fp, &w)) { + picerror = ERROR_READING_HEADER; + fclose(fp); + return NULL; + } + + fseek(fp, 4, SEEK_SET); + if (!readint16(fp, &h)) { + picerror = ERROR_READING_HEADER; + fclose(fp); + return NULL; + } + + width = w; + height = h; + + if (width <= 0 || height <= 0) { + fclose(fp); + return NULL; + } + fseek(fp, 32, SEEK_SET); + + if (fread(&palette, 3, 256, fp) != 256) { + picerror = ERROR_READING_PALETTE; + } + + tmpbuf = (unsigned char *)malloc(width); + buffer = (unsigned char*) malloc(3*width*height); + if (tmpbuf == NULL || buffer == NULL) { + picerror = ERROR_MEMORY; + if (tmpbuf) free(tmpbuf); + if (buffer) free(buffer); + fclose(fp); + return NULL; + } + ptr = buffer; + for (i = 0; i < height; i++) { + if (fread(tmpbuf, 1, width, fp) != (size_t) width) { + picerror = ERROR_READ_ERROR; + fclose(fp); + if (tmpbuf) free(tmpbuf); + if (buffer) free(buffer); + buffer = NULL; + width = height = 0; + return NULL; + } + for (j = 0; j < width; j++) { + int idx = tmpbuf[j]; + *ptr++ = palette[idx][0]; + *ptr++ = palette[idx][1]; + *ptr++ = palette[idx][2]; + } + } + format = 3; + fclose(fp); + + *width_ret = width; + *height_ret = height; + *numComponents_ret = format; + return buffer; +} + +class ReaderWriterPIC : public osg::ReaderWriter +{ + public: + virtual const char* className() { return "PIC Image Reader"; } + virtual bool acceptsExtension(const std::string& extension) { return extension=="pic"; } + + virtual osg::Node* readNode(const std::string& fileName) + { + osg::Image* image = readImage(fileName); + if (image) + { + osg::Geode* geode = osg::createGeodeForImage(image); + if (geode==NULL) image->unref(); + return geode; + } + else + { + return NULL; + } + } + + virtual osg::Image* readImage(const std::string& fileName) + { + + unsigned char *imageData = NULL; + int width_ret; + int height_ret; + int numComponents_ret; + + imageData = simage_pic_load(fileName.c_str(),&width_ret,&height_ret,&numComponents_ret); + + if (imageData==NULL) return NULL; + + int s = width_ret; + int t = height_ret; + int r = 1; + + int internalFormat = numComponents_ret; + + unsigned int pixelFormat = + numComponents_ret == 1 ? GL_LUMINANCE : + numComponents_ret == 2 ? GL_LUMINANCE_ALPHA : + numComponents_ret == 3 ? GL_RGB : + numComponents_ret == 4 ? GL_RGBA : (GLenum)-1; + + unsigned int dataType = GL_UNSIGNED_BYTE; + + osg::Image* pOsgImage = new osg::Image; + pOsgImage->setFileName(fileName.c_str()); + pOsgImage->setImage(s,t,r, + internalFormat, + pixelFormat, + dataType, + imageData); + + return pOsgImage; + + } +}; + +// now register with Registry to instantiate the above +// reader/writer. +osg::RegisterReaderWriterProxy g_readerWriter_PIC_Proxy; diff --git a/src/osgPlugins/png/Makedepend b/src/osgPlugins/png/Makedepend new file mode 100644 index 000000000..e69de29bb diff --git a/src/osgPlugins/png/Makefile b/src/osgPlugins/png/Makefile new file mode 100644 index 000000000..1e3c773f9 --- /dev/null +++ b/src/osgPlugins/png/Makefile @@ -0,0 +1,18 @@ +#!smake +include ../../../Make/makedefs + +C++FILES = \ + ReaderWriterPNG.cpp\ + +LIB = ../../../lib/osgPlugins/osgdb_png.so + +TARGET_LOADER_FILES = osgPlugins/osgdb_png.so + +LIBS = -lpng +C++FLAGS += -I../../../include -I/usr/local/include +LDFLAGS += -L../../../lib -L/usr/local/lib + +include ../../../Make/makerules + + + diff --git a/src/osgPlugins/png/ReaderWriterPNG.cpp b/src/osgPlugins/png/ReaderWriterPNG.cpp new file mode 100644 index 000000000..75f2aa65c --- /dev/null +++ b/src/osgPlugins/png/ReaderWriterPNG.cpp @@ -0,0 +1,183 @@ +#include +#include "osg/Image" +#include "osg/Input" +#include "osg/Output" +#include "osg/Notify" +#include "osg/Registry" +#include + +#include "osg/GL" + +using namespace osg; + +extern "C" { +#include +} + +/* Transparency parameters */ +#define PNG_ALPHA -2 /* Use alpha channel in PNG file, if there is one */ +#define PNG_SOLID -1 /* No transparency */ +#define PNG_STENCIL 0 /* Sets alpha to 0 for r=g=b=0, 1 otherwise */ + +typedef struct { + unsigned int Width; + unsigned int Height; + unsigned int Depth; + unsigned int Alpha; +} pngInfo; + +class ReaderWriterPNG : public ReaderWriter +{ + public: + virtual const char* className() { return "PNG Image Reader/Writer"; } + virtual bool acceptsExtension(const std::string& extension) { return extension=="png"; } + + virtual osg::Node* readNode(const std::string& fileName) + { + osg::Image* image = readImage(fileName); + if (image) + { + osg::Geode* geode = osg::createGeodeForImage(image); + if (geode==NULL) image->unref(); + return geode; + } + else + { + return NULL; + } + } + + virtual Image* readImage(const std::string& fileName) + { + + int trans = PNG_ALPHA; + FILE *fp = NULL; + pngInfo pInfo; + pngInfo *pinfo = &pInfo; + + unsigned char header[8]; + png_structp png; + png_infop info; + png_infop endinfo; + png_bytep data;//, data2; + png_bytep *row_p; + double fileGamma; + + png_uint_32 width, height; + int depth, color; + + png_uint_32 i; + png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + info = png_create_info_struct(png); + endinfo = png_create_info_struct(png); + + fp = fopen(fileName.c_str(), "rb"); + if (fp && fread(header, 1, 8, fp) && png_check_sig(header, 8)) + png_init_io(png, fp); + else + { + png_destroy_read_struct(&png, &info, &endinfo); + return NULL; + } + png_set_sig_bytes(png, 8); + + png_read_info(png, info); + png_get_IHDR(png, info, &width, &height, &depth, &color, NULL, NULL, NULL); + + if (pinfo != NULL) { + pinfo->Width = width; + pinfo->Height = height; + pinfo->Depth = depth; + } + + if (color == PNG_COLOR_TYPE_GRAY || color == PNG_COLOR_TYPE_GRAY_ALPHA) + png_set_gray_to_rgb(png); + + if (color&PNG_COLOR_MASK_ALPHA && trans != PNG_ALPHA) + { + png_set_strip_alpha(png); + color &= ~PNG_COLOR_MASK_ALPHA; + } + + // if (!(PalettedTextures && mipmap >= 0 && trans == PNG_SOLID)) + if (color == PNG_COLOR_TYPE_PALETTE) + png_set_expand(png); + + /*--GAMMA--*/ + // checkForGammaEnv(); + double screenGamma = 2.2 / 1.0; + if (png_get_gAMA(png, info, &fileGamma)) + png_set_gamma(png, screenGamma, fileGamma); + else + png_set_gamma(png, screenGamma, 1.0/2.2); + + png_read_update_info(png, info); + + data = (png_bytep) malloc(png_get_rowbytes(png, info)*height); + row_p = (png_bytep *) malloc(sizeof(png_bytep)*height); + + bool StandardOrientation = false; + for (i = 0; i < height; i++) { + if (StandardOrientation) + row_p[height - 1 - i] = &data[png_get_rowbytes(png, info)*i]; + else + row_p[i] = &data[png_get_rowbytes(png, info)*i]; + } + + png_read_image(png, row_p); + free(row_p); + + int iBitCount; + + if (trans == PNG_SOLID || trans == PNG_ALPHA || color == PNG_COLOR_TYPE_RGB_ALPHA || color == PNG_COLOR_TYPE_GRAY_ALPHA) + { + switch (color) + { + case PNG_COLOR_TYPE_GRAY: + case PNG_COLOR_TYPE_RGB: + case PNG_COLOR_TYPE_PALETTE: + iBitCount = 24; + if (pinfo != NULL) pinfo->Alpha = 0; + break; + + case PNG_COLOR_TYPE_GRAY_ALPHA: + case PNG_COLOR_TYPE_RGB_ALPHA: + iBitCount = 32; + if (pinfo != NULL) pinfo->Alpha = 8; + break; + + default: + return NULL; + } + } + + png_read_end(png, endinfo); + png_destroy_read_struct(&png, &info, &endinfo); + + // free(data); + + if (fp) + fclose(fp); + + osg::Image* pOsgImage = new osg::Image(); + + pOsgImage->setFileName(fileName.c_str()); + if (iBitCount == 24) + pOsgImage->setImage(width, height, 1, + iBitCount / 8, // int internalFormat, + GL_RGB, // unsigned int pixelFormat + GL_UNSIGNED_BYTE, // unsigned int dataType + data); + else + pOsgImage->setImage(width, height, 1, + iBitCount / 8, // int internalFormat, + GL_RGBA, // unsigned int pixelFormat + GL_UNSIGNED_BYTE, // unsigned int dataType + data); + return pOsgImage; + } +}; + +// now register with Registry to instantiate the above +// reader/writer. +RegisterReaderWriterProxy g_readerWriter_PNG_Proxy; diff --git a/src/osgPlugins/tga/Makedepend b/src/osgPlugins/tga/Makedepend new file mode 100644 index 000000000..e69de29bb diff --git a/src/osgPlugins/tga/Makefile b/src/osgPlugins/tga/Makefile new file mode 100644 index 000000000..fb3f6d2ac --- /dev/null +++ b/src/osgPlugins/tga/Makefile @@ -0,0 +1,18 @@ +#!smake +include ../../../Make/makedefs + +C++FILES = \ + ReaderWriterTGA.cpp\ + +LIB = ../../../lib/osgPlugins/osgdb_tga.so + +TARGET_LOADER_FILES = osgPlugins/osgdb_tga.so + +LIBS = +C++FLAGS += -I. -I../../../include +LDFLAGS += -L../../../lib + +include ../../../Make/makerules + + + diff --git a/src/osgPlugins/tga/ReaderWriterTGA.cpp b/src/osgPlugins/tga/ReaderWriterTGA.cpp new file mode 100644 index 000000000..92702cc35 --- /dev/null +++ b/src/osgPlugins/tga/ReaderWriterTGA.cpp @@ -0,0 +1,486 @@ +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +/**************************************************************************** + * + * Follows is code extracted from the simage library. Original Authors: + * + * Systems in Motion, + * + * + * Peder Blekken + * Morten Eriksen + * Marius Bugge Monsen + * + * The original COPYING notice + * + * All files in this library are public domain, except simage_rgb.cpp which is + * Copyright (c) Mark J Kilgard . I will contact Mark + * very soon to hear if this source also can become public domain. + * + * Please send patches for bugs and new features to: . + * + * Peder Blekken + * + * + * Ported into the OSG as a plugin, Robert Osfield Decemeber 2000. + * Note, reference above to license of simage_rgb is not relevent to the OSG + * as the OSG does not use it. Also for patches, bugs and new features + * please send them direct to the OSG dev team rather than address above. + * + **********************************************************************/ + +/* */ +/* Supported types: */ +/* */ +/* 1 (Uncompressed, color-mapped images) */ +/* 2 (RGB uncompressed) */ +/* 9 RLE color-mapped */ +/* 10 RLE RGB */ +/* */ + + +#define ERR_NO_ERROR 0 +#define ERR_OPEN 1 +#define ERR_READ 2 +#define ERR_MEM 3 +#define ERR_UNSUPPORTED 4 + +static int tgaerror = ERR_NO_ERROR; +int +simage_tga_error(char * buffer, int buflen) +{ + switch (tgaerror) { + case ERR_OPEN: + strncpy(buffer, "TGA loader: Error opening file", buflen); + break; + case ERR_READ: + strncpy(buffer, "TGA loader: Error reading file", buflen); + break; + case ERR_MEM: + strncpy(buffer, "TGA loader: Out of memory error", buflen); + break; + } + return tgaerror; +} + +/* TODO: */ +/* - bottom-up images */ +/* - huffman, delta encoding */ +static void +convert_16_to_24(const unsigned char * const src, unsigned char * const dest) +{ + /* RGB for opengl, lo-hi 16 bit for TGA */ + unsigned int t0 = src[0]; + unsigned int t1 = src[1]; + dest[0] = (unsigned char) (t0 & 0x1f) << 2; /* r */ + dest[1] = (unsigned char) (t1 & 0x7c) >> 2; /* g */ + dest[2] = (unsigned char) ((t1 & 0x3)<<3) | ((t0&0xe)>>5); /*b */ +} + +static void +convert_16_to_32(const unsigned char * const src, unsigned char * const dest) +{ + /* RGBA for opengl, lo-hi 16 bit for TGA */ + unsigned int t0 = src[0]; + unsigned int t1 = src[1]; + dest[0] = (unsigned char) (t0 & 0x1f) << 2; /* r */ + dest[1] = (unsigned char) (t1 & 0x7c) >> 2; /* g */ + dest[2] = (unsigned char) ((t1 & 0x3)<<3) | ((t0&0xe)>>5); /*b */ + dest[3] = (t1&0x70)?255:0; /* a */ +} + +static void +convert_24_to_24(const unsigned char * const src, unsigned char * const dest) +{ + /* RGB for opengl */ + /* BGR for TGA */ + dest[0] = src[2]; + dest[1] = src[1]; + dest[2] = src[0]; +} + +static void +convert_32_to_32(const unsigned char * const src, unsigned char * const dest) +{ + /* opengl image format is RGBA, not ARGB */ + /* TGA image format is BGRA for 32 bit */ + dest[0] = src[2]; + dest[1] = src[1]; + dest[2] = src[0]; + dest[3] = src[3]; +} + +static void +convert_data(const unsigned char * const src, unsigned char * const dest, + const int x, const int srcformat, + const int destformat) +{ + if (srcformat == 2) { + if (destformat == 3) + convert_16_to_24(src+x*srcformat, + dest+x*destformat); + else { + assert(destformat == 4); + convert_16_to_32(src+x*srcformat, + dest+x*destformat); + } + } + else if (srcformat == 3) { + assert(destformat == 3); + convert_24_to_24(src+x*srcformat, + dest+x*destformat); + } + else { + assert(srcformat == 4 && destformat == 4); + convert_32_to_32(src+x*srcformat, + dest+x*destformat); + } +} + +/* Intel byte order workaround */ +static int getInt16(unsigned char *ptr) +{ + int res = ptr[0]; + int tmp = ptr[1]; + return res | (tmp<<8); +} + +/* */ +/* decode a new rle packet */ +/* */ +static void +rle_new_packet(unsigned char ** src, + int * rleRemaining, + int * rleIsCompressed, + unsigned char *rleCurrent, + const int rleEntrySize) +{ + int i; + unsigned char code = *(*src)++; + *rleRemaining = (code & 127) + 1; /* number of bytes left in this packet */ + if (code & 128) { /* rle */ + *rleIsCompressed = 1; + for (i = 0; i < rleEntrySize; i++) + rleCurrent[i] = *(*src)++; + } + else { /* uncompressed */ + *rleIsCompressed = 0; + } +} + +/* */ +/* decode the # of specified bytes */ +/* */ +static void +rle_decode(unsigned char ** src, + unsigned char *dest, + const int numbytes, + int * rleRemaining, + int * rleIsCompressed, + unsigned char *rleCurrent, + const int rleEntrySize) +{ + int i; + int size = rleEntrySize; + unsigned char *stop = dest + numbytes; + while (dest < stop) { + if (*rleRemaining == 0) /* start new packet */ + rle_new_packet(src, rleRemaining, rleIsCompressed, + rleCurrent, rleEntrySize); + + if (*rleIsCompressed) { + for (i = 0; i < size; i++) { + *dest++ = rleCurrent[i]; + } + } + else { + for (i = 0; i < size; i++) { + *dest++ = *(*src)++; + } + } + *rleRemaining--; + } +} + +unsigned char * +simage_tga_load(const char *filename, + int *width_ret, + int *height_ret, + int *numComponents_ret) +{ + FILE * fp; + unsigned char header[18]; + int type; + int width; + int height; + int depth; + int flags; + int format; + unsigned char *colormap; + int indexsize; + int rleIsCompressed; + int rleRemaining; + int rleEntrySize; + unsigned char rleCurrent[4]; + unsigned char *buffer; + unsigned char *dest; + int bpr; + unsigned char *linebuf; + + tgaerror = ERR_NO_ERROR; /* clear error */ + + fp = fopen(filename, "rb"); + if (!fp) { + tgaerror = ERR_OPEN; + return NULL; + } + + if (fread(header, 1, 18, fp) != 18) { + tgaerror = ERR_READ; + fclose(fp); + return NULL; + } + + type = header[2]; + width = getInt16(&header[12]); + height = getInt16(&header[14]); + depth = header[16] >> 3; + flags = header[17]; + + /* check for reasonable values in case this is not a tga file */ + if ((type != 2 && type != 10) || + (width < 0 || width > 4096) || + (height < 0 || height > 4096) || + (depth < 2 || depth > 4)) { + tgaerror = ERR_UNSUPPORTED; + fclose(fp); + return NULL; + } + + if (header[0]) /* skip identification field */ + fseek(fp, header[0], SEEK_CUR); + + colormap = NULL; + if (header[1] == 1) { /* there is a colormap */ + int len = getInt16(&header[5]); + indexsize = header[7]>>3; + colormap = (unsigned char *)malloc(len*indexsize); + fread(colormap, 1, len*indexsize, fp); + } + + if (depth == 2) { /* 16 bits */ + if (flags & 1) format = 4; + else format = 3; + } + else format = depth; + + /* SoDebugError::postInfo("simage_tga_load", "TARGA file: %d %d %d %d %d\n", */ + /* type, width, height, depth, format); */ + + + rleIsCompressed = 0; + rleRemaining = 0; + rleEntrySize = depth; + buffer = (unsigned char*)malloc(width*height*format); + dest = buffer; + bpr = format * width; + linebuf = (unsigned char *)malloc(width*depth); + + switch(type) { + case 1: /* colormap, uncompressed */ + { + /* FIXME: write code */ + /* should never get here because simage_tga_identify returns 0 */ + /* for this filetype */ + /* I need example files in this format to write the code... */ + tgaerror = ERR_UNSUPPORTED; + } + break; + case 2: /* RGB, uncompressed */ + { + int x, y; + for (y = 0; y < height; y++) { + if (fread(linebuf, 1, width*depth, fp) != (unsigned int)width*depth) { + tgaerror = ERR_READ; + break; + } + for (x = 0; x < width; x++) { + convert_data(linebuf, dest, x, depth, format); + } + dest += bpr; + } + } + break; + case 9: /* colormap, compressed */ + { + /* FIXME: write code */ + /* should never get here because simage_tga_identify returns 0 */ + /* for this filetype */ + /* I need example files in this format to write the code... */ + tgaerror = ERR_UNSUPPORTED; + } + break; + case 10: /* RGB, compressed */ + { + int size, x, y; + unsigned char *buf; + unsigned char *src; + int pos = ftell(fp); + fseek(fp, 0, SEEK_END); + size = ftell(fp) - pos; + fseek(fp, pos, SEEK_SET); + buf = (unsigned char *)malloc(size); + if (buf == NULL) { + tgaerror = ERR_MEM; + break; + } + src = buf; + if (fread(buf, 1, size, fp) != (unsigned int) size) { + tgaerror = ERR_READ; + break; + } + for (y = 0; y < height; y++) { + rle_decode(&src, linebuf, width*depth, &rleRemaining, + &rleIsCompressed, rleCurrent, rleEntrySize); + assert(src <= buf + size); + for (x = 0; x < width; x++) { + convert_data(linebuf, dest, x, depth, format); + } + dest += bpr; + } + if (buf) free(buf); + } + break; + default: + tgaerror = ERR_UNSUPPORTED; + } + + if (linebuf) free(linebuf); + fclose(fp); + + if (tgaerror) { + if (buffer) free(buffer); + return NULL; + } + + *width_ret = width; + *height_ret = height; + *numComponents_ret = format; + return buffer; +} + + +int +simage_tga_identify(const char *filename, + const unsigned char *buf, + int headerlen) +{ + char * ptr; + if (headerlen < 18) return 0; + ptr = strrchr(filename, '.'); + if (!ptr) return 0; /* TGA files must end with .tga|.TGA */ + + if (strcmp(ptr, ".tga") && strcmp(ptr, ".TGA")) return 0; + + if (buf[1] == 1 && buf[2] == 1 && buf[17] < 64) { + /* SoDebugError::postInfo("simage_tga_identify", */ + /* "TARGA colormap file: %s\n", filename); */ + return 0; + } + if ((buf[1] == 0 || buf[1] == 1) && buf[2] == 2 && buf[17] < 64) return 1; + if (buf[1] == 1 && buf[2] == 9 && buf[17] < 64) { + /* SoDebugError::postInfo("simage_tga_identity", */ + /* "TARGA RLE and colormap file: %s\n", filename); */ + + /* will soon be supported */ + return 0; + } + if ((buf[1] == 0 || buf[1] == 1) && buf[2] == 10 && buf[17] < 64) { + /* RLE and RGB */ + return 1; + } + else { /* unsupported */ + /* SoDebugError::postInfo("simage_tga_identify", */ + /* "Unsupported TARGA type.\n"); */ + } + /* not a TGA, or not supported type */ + return 0; +} + + +class ReaderWriterTGA : public osg::ReaderWriter +{ + public: + virtual const char* className() { return "TGA Image Reader"; } + virtual bool acceptsExtension(const std::string& extension) { return extension=="tga"; } + + virtual osg::Node* readNode(const std::string& fileName) + { + osg::Image* image = readImage(fileName); + if (image) + { + osg::Geode* geode = osg::createGeodeForImage(image); + if (geode==NULL) image->unref(); + return geode; + } + else + { + return NULL; + } + } + + virtual osg::Image* readImage(const std::string& fileName) + { + + unsigned char *imageData = NULL; + int width_ret; + int height_ret; + int numComponents_ret; + + imageData = simage_tga_load(fileName.c_str(),&width_ret,&height_ret,&numComponents_ret); + + if (imageData==NULL) return NULL; + + int s = width_ret; + int t = height_ret; + int r = 1; + + int internalFormat = numComponents_ret; + + unsigned int pixelFormat = + numComponents_ret == 1 ? GL_LUMINANCE : + numComponents_ret == 2 ? GL_LUMINANCE_ALPHA : + numComponents_ret == 3 ? GL_RGB : + numComponents_ret == 4 ? GL_RGBA : (GLenum)-1; + + unsigned int dataType = GL_UNSIGNED_BYTE; + + osg::Image* pOsgImage = new osg::Image; + pOsgImage->setFileName(fileName.c_str()); + pOsgImage->setImage(s,t,r, + internalFormat, + pixelFormat, + dataType, + imageData); + + return pOsgImage; + + } +}; + +// now register with Registry to instantiate the above +// reader/writer. +osg::RegisterReaderWriterProxy g_readerWriter_TGA_Proxy; diff --git a/src/osgPlugins/tgz/Makedepend b/src/osgPlugins/tgz/Makedepend new file mode 100644 index 000000000..e69de29bb diff --git a/src/osgPlugins/tgz/Makefile b/src/osgPlugins/tgz/Makefile new file mode 100644 index 000000000..8e1f00ccb --- /dev/null +++ b/src/osgPlugins/tgz/Makefile @@ -0,0 +1,18 @@ +#!smake +include ../../../Make/makedefs + +C++FILES = \ + ReaderWriterTGZ.cpp\ + + +LIB = ../../../lib/osgPlugins/osgdb_tgz.so + +TARGET_LOADER_FILES = osgPlugins/osgdb_tgz.so + +C++FLAGS += -I../../../include +LDFLAGS += -L../../../lib + +include ../../../Make/makerules + + + diff --git a/src/osgPlugins/tgz/ReaderWriterTGZ.cpp b/src/osgPlugins/tgz/ReaderWriterTGZ.cpp new file mode 100644 index 000000000..4c3c6b79a --- /dev/null +++ b/src/osgPlugins/tgz/ReaderWriterTGZ.cpp @@ -0,0 +1,109 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "osg/FileNameUtils" + +using namespace osg; + +#ifdef __sgi +static int dirent_select( dirent *dent ) +#else +static int dirent_select( const dirent *dent ) +#endif +{ + // if blank name don't pass selection. + if (dent->d_name[0]==0) return 0; + + // if current directory '.' don't pass selection. + if (strcmp(dent->d_name,".")==0) return 0; + + // if parent directory '..' don't pass selection. + if (strcmp(dent->d_name,"..")==0) return 0; + + // should test for file being a directory? + + // if length < 4 chars then can't be .tgz extension three pass test. + if (strlen(dent->d_name)<4) return 1; + + // return 1 (for pass) if + return strncmp( ".tgz", &dent->d_name[strlen(dent->d_name)-4], 4 ); +} + +class ReaderWriterTGZ : public ReaderWriter { + public: + virtual const char* className() { return "TGZ Database Reader/Writer"; } + virtual bool acceptsExtension(const std::string& extension) { return extension=="tgz"; } + + virtual Node* readNode(const std::string& fileName) + { + std::string ext = getLowerCaseFileExtension(fileName); + if (!acceptsExtension(ext)) return NULL; + + osg::notify(osg::INFO)<< "ReaderWriterTGZ::readNode( "<d_name ); + grp->addChild( node ); + } + + + sprintf( command, "rm -rf %s", dirname ); + system( command ); + + if( grp->getNumChildren() == 0 ) + { + grp->unref(); + return NULL; + } + + else + return grp; + } + + virtual bool writeNode(Node& obj,const std::string& fileName) { + return false; + } + +}; + +// now register with sgRegistry to instantiate the above +// reader/writer. +RegisterReaderWriterProxy g_readerWriter_TGZ_Proxy; diff --git a/src/osgPlugins/tiff/Makedepend b/src/osgPlugins/tiff/Makedepend new file mode 100644 index 000000000..e69de29bb diff --git a/src/osgPlugins/tiff/Makefile b/src/osgPlugins/tiff/Makefile new file mode 100644 index 000000000..83849d496 --- /dev/null +++ b/src/osgPlugins/tiff/Makefile @@ -0,0 +1,18 @@ +#!smake +include ../../../Make/makedefs + +C++FILES = \ + ReaderWriterTIFF.cpp\ + +LIB = ../../../lib/osgPlugins/osgdb_tif.so + +TARGET_LOADER_FILES = osgPlugins/osgdb_tif.so + +LIBS = -ltiff +C++FLAGS += -I. -I../../../include +LDFLAGS += -L../../../lib + +include ../../../Make/makerules + + + diff --git a/src/osgPlugins/tiff/ReaderWriterTIFF.cpp b/src/osgPlugins/tiff/ReaderWriterTIFF.cpp new file mode 100644 index 000000000..ccca7e77d --- /dev/null +++ b/src/osgPlugins/tiff/ReaderWriterTIFF.cpp @@ -0,0 +1,427 @@ +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +/**************************************************************************** + * + * Follows is code extracted from the simage library. Original Authors: + * + * Systems in Motion, + * + * + * Peder Blekken + * Morten Eriksen + * Marius Bugge Monsen + * + * The original COPYING notice + * + * All files in this library are public domain, except simage_rgb.cpp which is + * Copyright (c) Mark J Kilgard . I will contact Mark + * very soon to hear if this source also can become public domain. + * + * Please send patches for bugs and new features to: . + * + * Peder Blekken + * + * + * Ported into the OSG as a plugin, Robert Osfield Decemeber 2000. + * Note, reference above to license of simage_rgb is not relevent to the OSG + * as the OSG does not use it. Also for patches, bugs and new features + * please send them direct to the OSG dev team rather than address above. + * + **********************************************************************/ + +#include + +#include +#include +#include +#include + +#define ERR_NO_ERROR 0 +#define ERR_OPEN 1 +#define ERR_READ 2 +#define ERR_MEM 3 +#define ERR_UNSUPPORTED 4 +#define ERR_TIFFLIB 5 + +static int tifferror = ERR_NO_ERROR; + +int +simage_tiff_error(char * buffer, int buflen) +{ + switch (tifferror) { + case ERR_OPEN: + strncpy(buffer, "TIFF loader: Error opening file", buflen); + break; + case ERR_MEM: + strncpy(buffer, "TIFF loader: Out of memory error", buflen); + break; + case ERR_UNSUPPORTED: + strncpy(buffer, "TIFF loader: Unsupported image type", buflen); + break; + case ERR_TIFFLIB: + strncpy(buffer, "TIFF loader: Illegal tiff file", buflen); + break; + } + return tifferror; +} + + +static void +tiff_error(const char* module, const char* fmt, va_list list) +{ + /* FIXME: store error message ? */ +} + +static void +tiff_warn(const char * module, const char * fmt, va_list list) +{ + /* FIXME: notify? */ +} + +static int +checkcmap(int n, uint16* r, uint16* g, uint16* b) +{ + while (n-- > 0) + if (*r++ >= 256 || *g++ >= 256 || *b++ >= 256) + return (16); + /* Assuming 8-bit colormap */ + return (8); +} + +static void +invert_row(unsigned char *ptr, unsigned char *data, int n, int invert) +{ + while (n--) { + if (invert) *ptr++ = 255 - *data++; + else *ptr++ = *data++; + } +} + + +static void +remap_row(unsigned char *ptr, unsigned char *data, int n, + unsigned short *rmap, unsigned short *gmap, unsigned short *bmap) +{ + unsigned int ix; + while (n--) { + ix = *data++; + *ptr++ = (unsigned char) rmap[ix]; + *ptr++ = (unsigned char) gmap[ix]; + *ptr++ = (unsigned char) bmap[ix]; + } +} + +static void +copy_row(unsigned char *ptr, unsigned char *data, int n) +{ + while (n--) { + *ptr++ = *data++; + *ptr++ = *data++; + *ptr++ = *data++; + } +} + +static void +interleave_row(unsigned char *ptr, + unsigned char *red, unsigned char *blue, unsigned char *green, + int n) +{ + while (n--) { + *ptr++ = *red++; + *ptr++ = *green++; + *ptr++ = *blue++; + } +} + +int +simage_tiff_identify(const char *ptr, + const unsigned char *header, + int headerlen) +{ + static unsigned char tifcmp[] = {0x4d, 0x4d, 0x0, 0x2a}; + static unsigned char tifcmp2[] = {0x49, 0x49, 0x2a, 0}; + + if (headerlen < 4) return 0; + if (memcmp((const void*)header, (const void*)tifcmp, 4) == 0) return 1; + if (memcmp((const void*)header, (const void*)tifcmp2, 4) == 0) return 1; + return 0; +} + +/* useful defines (undef'ed below) */ +#define CVT(x) (((x) * 255L) / ((1L<<16)-1)) +#define pack(a,b) ((a)<<8 | (b)) + +unsigned char * +simage_tiff_load(const char *filename, + int *width_ret, + int *height_ret, + int *numComponents_ret) +{ + TIFF *in; + uint16 samplesperpixel; + uint16 bitspersample; + uint16 photometric; + uint32 w, h; + uint16 config; + uint16* red; + uint16* green; + uint16* blue; + unsigned char *inbuf = NULL; + tsize_t rowsize; + uint32 row; + int format; + unsigned char *buffer; + int width; + int height; + unsigned char *currPtr; + + + TIFFSetErrorHandler(tiff_error); + TIFFSetWarningHandler(tiff_warn); + + in = TIFFOpen(filename, "r"); + if (in == NULL) { + tifferror = ERR_OPEN; + return NULL; + } + if (TIFFGetField(in, TIFFTAG_PHOTOMETRIC, &photometric) == 1) { + if (photometric != PHOTOMETRIC_RGB && photometric != PHOTOMETRIC_PALETTE && + photometric != PHOTOMETRIC_MINISWHITE && + photometric != PHOTOMETRIC_MINISBLACK) { + /*Bad photometric; can only handle Grayscale, RGB and Palette images :-( */ + TIFFClose(in); + tifferror = ERR_UNSUPPORTED; + return NULL; + } + } + else { + tifferror = ERR_READ; + TIFFClose(in); + return NULL; + } + + if (TIFFGetField(in, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel) == 1) { + if (samplesperpixel != 1 && samplesperpixel != 3) { + /* Bad samples/pixel */ + tifferror = ERR_UNSUPPORTED; + TIFFClose(in); + return NULL; + } + } + else { + tifferror = ERR_READ; + TIFFClose(in); + return NULL; + } + + if (TIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &bitspersample) == 1) { + if (bitspersample != 8) { + /* can only handle 8-bit samples. */ + TIFFClose(in); + tifferror = ERR_UNSUPPORTED; + return NULL; + } + } + else { + tifferror = ERR_READ; + TIFFClose(in); + return NULL; + } + + if (TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &w) != 1 || + TIFFGetField(in, TIFFTAG_IMAGELENGTH, &h) != 1 || + TIFFGetField(in, TIFFTAG_PLANARCONFIG, &config) != 1) { + TIFFClose(in); + tifferror = ERR_READ; + return NULL; + } + + if (photometric == PHOTOMETRIC_MINISWHITE || + photometric == PHOTOMETRIC_MINISBLACK) + format = 1; + else + format = 3; + + buffer = (unsigned char*)malloc(w*h*format); + + if (!buffer) { + tifferror = ERR_MEM; + TIFFClose(in); + return NULL; + } + + width = w; + height = h; + + currPtr = buffer + (h-1)*w*format; + + tifferror = ERR_NO_ERROR; + + switch (pack(photometric, config)) { + case pack(PHOTOMETRIC_MINISWHITE, PLANARCONFIG_CONTIG): + case pack(PHOTOMETRIC_MINISBLACK, PLANARCONFIG_CONTIG): + case pack(PHOTOMETRIC_MINISWHITE, PLANARCONFIG_SEPARATE): + case pack(PHOTOMETRIC_MINISBLACK, PLANARCONFIG_SEPARATE): + + inbuf = (unsigned char *)malloc(TIFFScanlineSize(in)); + for (row = 0; row < h; row++) { + if (TIFFReadScanline(in, inbuf, row, 0) < 0) { + tifferror = ERR_READ; + break; + } + invert_row(currPtr, inbuf, w, photometric == PHOTOMETRIC_MINISWHITE); + currPtr -= format*w; + } + break; + + case pack(PHOTOMETRIC_PALETTE, PLANARCONFIG_CONTIG): + case pack(PHOTOMETRIC_PALETTE, PLANARCONFIG_SEPARATE): + if (TIFFGetField(in, TIFFTAG_COLORMAP, &red, &green, &blue) != 1) + tifferror = ERR_READ; + /* */ + /* Convert 16-bit colormap to 8-bit (unless it looks */ + /* like an old-style 8-bit colormap). */ + /* */ + if (!tifferror && checkcmap(1<= 0; i--) { + red[i] = CVT(red[i]); + green[i] = CVT(green[i]); + blue[i] = CVT(blue[i]); + } + } + + inbuf = (unsigned char *)malloc(TIFFScanlineSize(in)); + for (row = 0; row < h; row++) { + if (TIFFReadScanline(in, inbuf, row, 0) < 0) { + tifferror = ERR_READ; + break; + } + remap_row(currPtr, inbuf, w, red, green, blue); + currPtr -= format*w; + } + break; + + case pack(PHOTOMETRIC_RGB, PLANARCONFIG_CONTIG): + inbuf = (unsigned char *)malloc(TIFFScanlineSize(in)); + for (row = 0; row < h; row++) { + if (TIFFReadScanline(in, inbuf, row, 0) < 0) { + tifferror = ERR_READ; + break; + } + copy_row(currPtr, inbuf, w); + currPtr -= format*w; + } + break; + + case pack(PHOTOMETRIC_RGB, PLANARCONFIG_SEPARATE): + rowsize = TIFFScanlineSize(in); + inbuf = (unsigned char *)malloc(3*rowsize); + for (row = 0; !tifferror && row < h; row++) { + int s; + for (s = 0; s < 3; s++) { + if (TIFFReadScanline(in, (tdata_t)(inbuf+s*rowsize), (uint32)row, (tsample_t)s) < 0) { + tifferror = ERR_READ; break; + } + } + if (!tifferror) { + interleave_row(currPtr, inbuf, inbuf+rowsize, inbuf+2*rowsize, w); + currPtr -= format*w; + } + } + break; + default: + tifferror = ERR_UNSUPPORTED; + break; + } + + if (inbuf) free(inbuf); + TIFFClose(in); + + if (tifferror) { + if (buffer) free(buffer); + return NULL; + } + *width_ret = width; + *height_ret = height; + *numComponents_ret = format; + return buffer; +} + +#undef CVT +#undef pack + + +class ReaderWriterTIFF : public osg::ReaderWriter +{ + public: + virtual const char* className() { return "TIFF Image Reader"; } + virtual bool acceptsExtension(const std::string& extension) { return extension=="tiff"; } + + virtual osg::Node* readNode(const std::string& fileName) + { + osg::Image* image = readImage(fileName); + if (image) + { + osg::Geode* geode = osg::createGeodeForImage(image); + if (geode==NULL) image->unref(); + return geode; + } + else + { + return NULL; + } + } + + virtual osg::Image* readImage(const std::string& fileName) + { + + unsigned char *imageData = NULL; + int width_ret; + int height_ret; + int numComponents_ret; + + imageData = simage_tiff_load(fileName.c_str(),&width_ret,&height_ret,&numComponents_ret); + + if (imageData==NULL) return NULL; + + int s = width_ret; + int t = height_ret; + int r = 1; + + int internalFormat = numComponents_ret; + + unsigned int pixelFormat = + numComponents_ret == 1 ? GL_LUMINANCE : + numComponents_ret == 2 ? GL_LUMINANCE_ALPHA : + numComponents_ret == 3 ? GL_RGB : + numComponents_ret == 4 ? GL_RGBA : (GLenum)-1; + + unsigned int dataType = GL_UNSIGNED_BYTE; + + osg::Image* pOsgImage = new osg::Image; + pOsgImage->setFileName(fileName.c_str()); + pOsgImage->setImage(s,t,r, + internalFormat, + pixelFormat, + dataType, + imageData); + + return pOsgImage; + + } +}; + +// now register with Registry to instantiate the above +// reader/writer. +osg::RegisterReaderWriterProxy g_readerWriter_TIFF_Proxy; diff --git a/src/osgPlugins/zip/Makedepend b/src/osgPlugins/zip/Makedepend new file mode 100644 index 000000000..e69de29bb diff --git a/src/osgPlugins/zip/Makefile b/src/osgPlugins/zip/Makefile new file mode 100644 index 000000000..d3a77d1e3 --- /dev/null +++ b/src/osgPlugins/zip/Makefile @@ -0,0 +1,18 @@ +#!smake +include ../../../Make/makedefs + +C++FILES = \ + ReaderWriterZIP.cpp\ + + +LIB = ../../../lib/osgPlugins/osgdb_zip.so + +TARGET_LOADER_FILES = osgPlugins/osgdb_zip.so + +C++FLAGS += -I../../../include +LDFLAGS += -L../../../lib + +include ../../../Make/makerules + + + diff --git a/src/osgPlugins/zip/ReaderWriterZIP.cpp b/src/osgPlugins/zip/ReaderWriterZIP.cpp new file mode 100644 index 000000000..12be2bd2c --- /dev/null +++ b/src/osgPlugins/zip/ReaderWriterZIP.cpp @@ -0,0 +1,104 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "osg/FileNameUtils" + +using namespace osg; + +#ifdef __sgi +static int dirent_select( dirent *dent ) +#else +static int dirent_select( const dirent *dent ) +#endif +{ + // if blank name don't pass selection. + if (dent->d_name[0]==0) return 0; + + // if current directory '.' don't pass selection. + if (strcmp(dent->d_name,".")==0) return 0; + + // if parent directory '..' don't pass selection. + if (strcmp(dent->d_name,"..")==0) return 0; + + // should test for file being a directory? + + // if length < 4 chars then can't be .tgz extension three pass test. + if (strlen(dent->d_name)<4) return 1; + + // return 1 (for pass) if + return strncmp( ".zip", &dent->d_name[strlen(dent->d_name)-4], 4 ); +} + +class ReaderWriterZIP : public ReaderWriter { + public: + virtual const char* className() { return "ZIP Database Reader/Writer"; } + virtual bool acceptsExtension(const std::string& extension) { return extension=="zip"; } + + virtual Node* readNode(const std::string& fileName) + { + + std::string ext = osg::getLowerCaseFileExtension(fileName); + if (!acceptsExtension(ext)) return NULL; + + osg::notify(osg::INFO)<<"ReaderWriterZIP::readNode( "<d_name<d_name ); + grp->addChild( node ); + } + + + sprintf( command, "rm -rf %s", dirname ); + system( command ); + + if( grp->getNumChildren() == 0 ) + { + grp->unref(); + return NULL; + } + + else + return grp; + } + + virtual bool writeNode(Node& obj,const std::string& fileName) { + return false; + } + +}; + +// now register with sgRegistry to instantiate the above +// reader/writer. +RegisterReaderWriterProxy g_readerWriter_ZIP_Proxy; diff --git a/src/osgUtil/CameraManipulator.cpp b/src/osgUtil/CameraManipulator.cpp new file mode 100644 index 000000000..8961c134b --- /dev/null +++ b/src/osgUtil/CameraManipulator.cpp @@ -0,0 +1,29 @@ +#include +#include +#include + +using namespace osg; +using namespace osgUtil; + +CameraManipulator::CameraManipulator(): _camera(NULL) +{ +} + +CameraManipulator::~CameraManipulator() +{ +} + +void CameraManipulator::setCamera(Camera *camera) +{ + _camera=camera; +} + +Camera *CameraManipulator::getCamera() const +{ + return _camera.get(); +} + +bool CameraManipulator::update(GUIEventAdapter&,GUIActionAdapter&) +{ + return false; +} diff --git a/src/osgUtil/DisplayListVisitor.cpp b/src/osgUtil/DisplayListVisitor.cpp new file mode 100644 index 000000000..a7b1cb252 --- /dev/null +++ b/src/osgUtil/DisplayListVisitor.cpp @@ -0,0 +1,37 @@ +#include "osgUtil/DisplayListVisitor" +#include "osg/GeoSet" + +using namespace osg; +using namespace osgUtil; + +DisplayListVisitor::DisplayListVisitor(DisplayListMode mode) +{ + setTraverseMode(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN); + _displayListMode = mode; +} + +void DisplayListVisitor::apply(osg::Geode& node) +{ + switch(_displayListMode) + { + case(SWITCH_OFF_DISPLAY_LISTS): + { + for(int i=0;isetUseDisplayList(false); + } + } + break; + case(SWITCH_ON_DISPLAY_LISTS): + { + for(int i=0;isetUseDisplayList(true); + } + } + break; + case(SWITCH_ON_AND_COMPILE_DISPLAY_LISTS): + node.compileGeoSets(); + break; + } +} diff --git a/src/osgUtil/DriveManipulator.cpp b/src/osgUtil/DriveManipulator.cpp new file mode 100644 index 000000000..5284ebd89 --- /dev/null +++ b/src/osgUtil/DriveManipulator.cpp @@ -0,0 +1,535 @@ +#include "osgUtil/DriveManipulator" +#include "osgUtil/IntersectVisitor" +#include "osg/Notify" + +using namespace osg; +using namespace osgUtil; + +DriveManipulator::DriveManipulator() +{ + _modelScale = 0.01f; + _velocity = 0.0f; + _speedMode = USE_MOUSE_Y_FOR_SPEED; +} + +DriveManipulator::~DriveManipulator() +{ +} + +void DriveManipulator::setNode(osg::Node* node) +{ + _node = node; + if (_node.get()) + { + const osg::BoundingSphere& boundingSphere=_node->getBound(); + _modelScale = boundingSphere._radius; + _height = sqrtf(_modelScale)*0.03f; + _buffer = sqrtf(_modelScale)*0.05f; + } +} + +osg::Node* DriveManipulator::getNode() const +{ + return _node.get(); +} + +void DriveManipulator::home(GUIEventAdapter& ea,GUIActionAdapter& us) +{ + + if(_node.get() && _camera.get()) + { + + const osg::BoundingSphere& boundingSphere=_node->getBound(); + + osg::Vec3 ep = boundingSphere._center; + osg::Vec3 bp = ep; + ep.z() -= _modelScale*0.0001f; + bp.z() -= _modelScale; + + // check to see if any obstruction in front. + IntersectVisitor iv; + + bool cameraSet = false; + + osg::ref_ptr segDown = new osg::Seg; + segDown->set(ep,bp); + iv.addSeg(segDown.get()); + + _node->accept(iv); + + if (iv.hits()) + { + osgUtil::IntersectVisitor::HitList& hitList = iv.getHitList(segDown.get()); + if (!hitList.empty()) + { + // notify(INFO) << "Hit terrain ok"<0.0f) uv = np; + else uv = -np; + + float lookDistance = _modelScale*0.1f; + + ep = ip; + ep.z() += _height; + osg::Vec3 lv = uv^osg::Vec3(1.0f,0.0f,0.0f); + osg::Vec3 lp = ep+lv*lookDistance; + + _camera->setView(ep,lp,uv); + _camera->ensureOrthogonalUpVector(); + + cameraSet = true; + + } + + } + + if (!cameraSet) + { + bp = ep; + bp.z() += _modelScale; + + osg::ref_ptr segUp = new osg::Seg; + segUp->set(ep,bp); + iv.addSeg(segUp.get()); + + _node->accept(iv); + + if (iv.hits()) + { + osgUtil::IntersectVisitor::HitList& hitList = iv.getHitList(segUp.get()); + if (!hitList.empty()) + { + // notify(INFO) << "Hit terrain ok"<0.0f) uv = np; + else uv = -np; + + float lookDistance = _modelScale*0.1f; + + ep = ip; + ep.z() += _height; + osg::Vec3 lv = uv^osg::Vec3(1.0f,0.0f,0.0f); + osg::Vec3 lp = ep+lv*lookDistance; + + _camera->setView(ep,lp,uv); + _camera->ensureOrthogonalUpVector(); + + cameraSet = true; + + } + + } + } + + if (!cameraSet) + { + _camera->setView(boundingSphere._center+osg::Vec3( 0.0,-2.0f * boundingSphere._radius,0.0f), // eye + boundingSphere._center, // look + osg::Vec3(0.0f,0.0f,1.0f)); // up + } + + } + + _velocity = 0.0f; + + us.needRedraw(); + + us.needWarpPointer((ea.getXmin()+ea.getXmax())/2,(ea.getYmin()+ea.getYmax())/2); + + flushMouseEventStack(); + +} + +void DriveManipulator::init(GUIEventAdapter& ea,GUIActionAdapter& us) +{ + flushMouseEventStack(); + + us.needContinuousUpdate(false); + + _velocity = 0.0f; + + osg::Vec3 ep = _camera->getEyePoint(); + osg::Vec3 sv = _camera->getSideVector(); + osg::Vec3 bp = ep; + bp.z() -= _modelScale; + + // check to see if any obstruction in front. + IntersectVisitor iv; + + bool cameraSet = false; + + osg::ref_ptr segDown = new osg::Seg; + segDown->set(ep,bp); + iv.addSeg(segDown.get()); + + _node->accept(iv); + + if (iv.hits()) + { + osgUtil::IntersectVisitor::HitList& hitList = iv.getHitList(segDown.get()); + if (!hitList.empty()) + { +// notify(INFO) << "Hit terrain ok"<0.0f) uv = np; + else uv = -np; + + float lookDistance = _modelScale*0.1f; + + ep = ip+uv*_height; + osg::Vec3 lv = uv^sv; + osg::Vec3 lp = ep+lv*lookDistance; + + _camera->setView(ep,lp,uv); + _camera->ensureOrthogonalUpVector(); + + cameraSet = true; + + } + + } + + if (!cameraSet) + { + bp = ep; + bp.z() += _modelScale; + + osg::ref_ptr segUp = new osg::Seg; + segUp->set(ep,bp); + iv.addSeg(segUp.get()); + + _node->accept(iv); + + if (iv.hits()) + { + osgUtil::IntersectVisitor::HitList& hitList = iv.getHitList(segUp.get()); + if (!hitList.empty()) + { + // notify(INFO) << "Hit terrain ok"<0.0f) uv = np; + else uv = -np; + + float lookDistance = _modelScale*0.1f; + + ep = ip+uv*_height; + osg::Vec3 lv = uv^sv; + osg::Vec3 lp = ep+lv*lookDistance; + + _camera->setView(ep,lp,uv); + _camera->ensureOrthogonalUpVector(); + + cameraSet = true; + + } + + } + } + + us.needWarpPointer((ea.getXmin()+ea.getXmax())/2,(ea.getYmin()+ea.getYmax())/2); + +} + +bool DriveManipulator::update(GUIEventAdapter& ea,GUIActionAdapter& us) +{ + if(!_camera.get()) return false; + + switch(ea.getEventType()) + { + case(GUIEventAdapter::PUSH): + { + + addMouseEvent(ea); + us.needContinuousUpdate(true); + if (calcMovement()) us.needRedraw(); + + } + return true; + case(GUIEventAdapter::RELEASE): + { + + addMouseEvent(ea); + us.needContinuousUpdate(true); + if (calcMovement()) us.needRedraw(); + + } + return true; + case(GUIEventAdapter::DRAG): + { + + addMouseEvent(ea); + us.needContinuousUpdate(true); + if (calcMovement()) us.needRedraw(); + + } + return true; + case(GUIEventAdapter::MOVE): + { + + addMouseEvent(ea); + us.needContinuousUpdate(true); + if (calcMovement()) us.needRedraw(); + + } + return true; + + case(GUIEventAdapter::KEYBOARD): + if (ea.getKey()==' ') + { + flushMouseEventStack(); + home(ea,us); + us.needRedraw(); + us.needContinuousUpdate(false); + return true; + } + else if (ea.getKey()=='q') + { + _speedMode = USE_MOUSE_Y_FOR_SPEED; + return true; + } + else if (ea.getKey()=='a') + { + _speedMode = USE_MOUSE_BUTTONS_FOR_SPEED; + return true; + } + + return false; + case(GUIEventAdapter::FRAME): + addMouseEvent(ea); + if (calcMovement()) us.needRedraw(); + return true; + case(GUIEventAdapter::RESIZE): + { + init(ea,us); + us.needRedraw(); + } + return true; + default: + return false; + } +} + +void DriveManipulator::flushMouseEventStack() +{ + _ga_t1 = NULL; + _ga_t0 = NULL; +} + +void DriveManipulator::addMouseEvent(GUIEventAdapter& ea) +{ + _ga_t1 = _ga_t0; + _ga_t0 = &ea; +} + + +bool DriveManipulator::calcMovement() +{ + // return if less then two events have been added. + if (_ga_t0.get()==NULL || _ga_t1.get()==NULL) return false; + + float dt = _ga_t0->time()-_ga_t1->time(); + + + if (dt<0.0f) + { + notify(WARN) << "warning dt = "<getYmin()+_ga_t0->getYmax())/2.0f; + float dy = _ga_t0->getY()-my; + _velocity = -_modelScale*0.0002f*dy; + break; + } + case(USE_MOUSE_BUTTONS_FOR_SPEED): + { + unsigned int buttonMask = _ga_t1->getButtonMask(); + if (buttonMask==GUIEventAdapter::LEFT_BUTTON) + { + // pan model. + + _velocity += dt*_modelScale*0.02f; + + } + else if (buttonMask==GUIEventAdapter::MIDDLE_BUTTON || + buttonMask==(GUIEventAdapter::LEFT_BUTTON|GUIEventAdapter::RIGHT_BUTTON)) + { + + _velocity = 0.0f; + + } + else if (buttonMask==GUIEventAdapter::RIGHT_BUTTON) + { + + _velocity -= dt*_modelScale*0.02f; + + } + break; + } + } + + + // rotate the camera. + osg::Vec3 center = _camera->getEyePoint(); + osg::Vec3 uv = _camera->getUpVector(); + + float mx = (_ga_t0->getXmin()+_ga_t0->getXmax())/2.0f; + + float dx = _ga_t0->getX()-mx; + + float yaw = dx*0.1f*dt; + + osg::Matrix mat; + mat.makeTrans(-center.x(),-center.y(),-center.z()); + mat.postRot(yaw,uv.x(),uv.y(),uv.z()); + mat.postTrans(center.x(),center.y(),center.z()); + + center = _camera->getEyePoint(); + uv = _camera->getUpVector(); + + _camera->mult(*_camera,mat); + + + // get the new forward (look) vector. + osg::Vec3 sv = _camera->getSideVector(); + osg::Vec3 lv = _camera->getLookPoint()-_camera->getEyePoint(); + float lookDistance = lv.length(); + lv.normalize(); + + // movement is big enough the move the eye point along the look vector. + if (fabsf(_velocity*dt)>1e-8) + { + osg::Vec3 ep = _camera->getEyePoint(); + float distanceToMove = _velocity*dt; + + float signedBuffer; + if (distanceToMove>=0.0f) signedBuffer=_buffer; + else signedBuffer=-_buffer; + + // check to see if any obstruction in front. + IntersectVisitor iv; + osg::ref_ptr segForward = new osg::Seg; + segForward->set(ep,ep+lv*(signedBuffer+distanceToMove)); + iv.addSeg(segForward.get()); + + _node->accept(iv); + + if (iv.hits()) + { + osgUtil::IntersectVisitor::HitList& hitList = iv.getHitList(segForward.get()); + if (!hitList.empty()) + { +// notify(INFO) << "Hit obstruction"< segNormal = new osg::Seg; + segNormal->set(fp,lfp); + iv.addSeg(segNormal.get()); + + _node->accept(iv); + + if (iv.hits()) + { + osgUtil::IntersectVisitor::HitList& hitList = iv.getHitList(segNormal.get()); + if (!hitList.empty()) + { +// notify(INFO) << "Hit terrain ok"<0.0f) uv = np; + else uv = -np; + + ep = ip+uv*_height; + lv = uv^sv; + osg::Vec3 lp = ep+lv*lookDistance; + + _camera->setView(ep,lp,uv); + _camera->ensureOrthogonalUpVector(); + + return true; + + } + + } + + // no hit on the terrain found therefore resort to a fall under + // under the influence of gravity. + osg::Vec3 dp = lfp; + dp.z() -= 2*_modelScale; + + iv.reset(); + + osg::ref_ptr segFall = new osg::Seg; + segFall->set(lfp,dp); + iv.addSeg(segFall.get()); + + _node->accept(iv); + + if (iv.hits()) + { + osgUtil::IntersectVisitor::HitList& hitList = iv.getHitList(segFall.get()); + if (!hitList.empty()) + { + + notify(INFO) << "Hit terrain on decent ok"<0.0f) uv = np; + else uv = -np; + + ep = ip+uv*_height; + lv = uv^sv; + osg::Vec3 lp = ep+lv*lookDistance; + + _camera->setView(ep,lp,uv); + _camera->ensureOrthogonalUpVector(); + + return true; + } + } + + // no collision with terrain has been found therefore track horizontally. + + lv *= (_velocity*dt); + ep += lv; + osg::Vec3 lp = _camera->getLookPoint()+lv; + + _camera->setView(ep,lp,uv); + _camera->ensureOrthogonalUpVector(); + + } + + + + return true; +} diff --git a/src/osgUtil/FlightManipulator.cpp b/src/osgUtil/FlightManipulator.cpp new file mode 100644 index 000000000..25d3eab36 --- /dev/null +++ b/src/osgUtil/FlightManipulator.cpp @@ -0,0 +1,217 @@ +#include "osgUtil/FlightManipulator" +#include "osg/Notify" + +using namespace osg; +using namespace osgUtil; + +FlightManipulator::FlightManipulator() +{ + _modelScale = 0.01f; + _velocity = 0.0f; + _yawMode = YAW_AUTOMATICALLY_WHEN_BANKED; +} + +FlightManipulator::~FlightManipulator() +{ +} + +void FlightManipulator::setNode(osg::Node* node) +{ + _node = node; + if (_node.get()) + { + const osg::BoundingSphere& boundingSphere=_node->getBound(); + _modelScale = boundingSphere._radius; + } +} + +osg::Node* FlightManipulator::getNode() const +{ + return _node.get(); +} + +void FlightManipulator::home(GUIEventAdapter& ea,GUIActionAdapter& us) +{ + if(_node.get() && _camera.get()) + { + + const osg::BoundingSphere& boundingSphere=_node->getBound(); + + _camera->setView(boundingSphere._center+osg::Vec3( 0.0,-2.0f * boundingSphere._radius,0.0f), // eye + boundingSphere._center, // look + osg::Vec3(0.0f,0.0f,1.0f)); // up + + _velocity = 0.0f; + + us.needRedraw(); + + us.needWarpPointer((ea.getXmin()+ea.getXmax())/2,(ea.getYmin()+ea.getYmax())/2); + + flushMouseEventStack(); + + } + +} + +void FlightManipulator::init(GUIEventAdapter& ea,GUIActionAdapter& us) +{ + flushMouseEventStack(); + + us.needContinuousUpdate(false); + + _velocity = 0.0f; + + us.needWarpPointer((ea.getXmin()+ea.getXmax())/2,(ea.getYmin()+ea.getYmax())/2); + +} + +bool FlightManipulator::update(GUIEventAdapter& ea,GUIActionAdapter& us) +{ + if(!_camera.get()) return false; + + switch(ea.getEventType()) + { + case(GUIEventAdapter::PUSH): + { + + addMouseEvent(ea); + us.needContinuousUpdate(true); + if (calcMovement()) us.needRedraw(); + + } + return true; + case(GUIEventAdapter::RELEASE): + { + + addMouseEvent(ea); + us.needContinuousUpdate(true); + if (calcMovement()) us.needRedraw(); + + } + return true; + case(GUIEventAdapter::DRAG): + { + + addMouseEvent(ea); + us.needContinuousUpdate(true); + if (calcMovement()) us.needRedraw(); + + } + return true; + case(GUIEventAdapter::MOVE): + { + + addMouseEvent(ea); + us.needContinuousUpdate(true); + if (calcMovement()) us.needRedraw(); + + } + return true; + + case(GUIEventAdapter::KEYBOARD): + if (ea.getKey()==' ') + { + flushMouseEventStack(); + home(ea,us); + us.needRedraw(); + us.needContinuousUpdate(false); + return true; + } + return false; + case(GUIEventAdapter::FRAME): + addMouseEvent(ea); + if (calcMovement()) us.needRedraw(); + return true; + case(GUIEventAdapter::RESIZE): + { + init(ea,us); + us.needRedraw(); + } + return true; + default: + return false; + } +} + +void FlightManipulator::flushMouseEventStack() +{ + _ga_t1 = NULL; + _ga_t0 = NULL; +} + +void FlightManipulator::addMouseEvent(GUIEventAdapter& ea) +{ + _ga_t1 = _ga_t0; + _ga_t0 = &ea; +} + +bool FlightManipulator::calcMovement() +{ + // return if less then two events have been added. + if (_ga_t0.get()==NULL || _ga_t1.get()==NULL) return false; + + float dt = _ga_t0->time()-_ga_t1->time(); + + + if (dt<0.0f) + { + notify(WARN) << "warning dt = "<getButtonMask(); + if (buttonMask==GUIEventAdapter::LEFT_BUTTON) + { + // pan model. + + _velocity += dt*_modelScale*0.05f; + + } + else if (buttonMask==GUIEventAdapter::MIDDLE_BUTTON || + buttonMask==(GUIEventAdapter::LEFT_BUTTON|GUIEventAdapter::RIGHT_BUTTON)) + { + + _velocity = 0.0f; + + } + else if (buttonMask==GUIEventAdapter::RIGHT_BUTTON) + { + + _velocity -= dt*_modelScale*0.05f; + + } + + float mx = (_ga_t0->getXmin()+_ga_t0->getXmax())/2.0f; + float my = (_ga_t0->getYmin()+_ga_t0->getYmax())/2.0f; + + float dx = _ga_t0->getX()-mx; + float dy = _ga_t0->getY()-my; + + osg::Vec3 center = _camera->getEyePoint(); + osg::Vec3 sv = _camera->getSideVector(); + osg::Vec3 lv = _camera->getLookVector(); + + float pitch = -dy*0.15f*dt; + float roll = -dx*0.1f*dt; + + osg::Matrix mat; + mat.makeTrans(-center.x(),-center.y(),-center.z()); + mat.postRot(pitch,sv.x(),sv.y(),sv.z()); + mat.postRot(roll,lv.x(),lv.y(),lv.z()); + if (_yawMode==YAW_AUTOMATICALLY_WHEN_BANKED) + { + float bank = asinf(sv.z()); + float yaw = (-bank*180.0f/M_PI)*dt; + mat.postRot(yaw,0.0f,0.0f,1.0f); + } + mat.postTrans(center.x(),center.y(),center.z()); + + + lv *= (_velocity*dt); + + mat.postTrans(lv.x(),lv.y(),lv.z()); + + _camera->mult(*_camera,mat); + + return true; +} diff --git a/src/osgUtil/IntersectVisitor.cpp b/src/osgUtil/IntersectVisitor.cpp new file mode 100644 index 000000000..879a5099a --- /dev/null +++ b/src/osgUtil/IntersectVisitor.cpp @@ -0,0 +1,591 @@ +#include "osgUtil/IntersectVisitor" +#include "osg/DCS" +#include "osg/Geode" +#include "osg/LOD" +#include "osg/Billboard" +#include "osg/Notify" + +#include +#include +#include + +#ifndef OSG_USE_IO_DOT_H +#include +using namespace std; +#endif + +using namespace osg; +using namespace osgUtil; + +IntersectState::IntersectState() +{ + _matrix = NULL; + _inverse = NULL; + _segmentMaskStack.push_back(0xffffffff); +} + +IntersectState::~IntersectState() +{ + if (_matrix) _matrix->unref(); + if (_inverse) _inverse->unref(); + for(SegList::iterator itr=_segList.begin(); + itr!=_segList.end(); + ++itr) + { + itr->first->unref(); + itr->second->unref(); + } + + _matrix = (osg::Matrix *)0xffffffff; + _inverse = (osg::Matrix *)0xffffffff; +} + +bool IntersectState::isCulled(const BoundingSphere& bs,SegmentMask& segMaskOut) +{ + bool hit = false; + SegmentMask mask = 0x00000001; + segMaskOut = 0x00000000; + SegmentMask segMaskIn = _segmentMaskStack.back(); +// notify(INFO) << << "IntersectState::isCulled() mask in "<second)->intersect(bs)) + { +// notify(INFO) << << "Hit "; + segMaskOut = segMaskOut| mask; + hit = true; + } + mask = mask << 1; + } +// notify(INFO) << << "mask = "<second)->intersect(bb)) + { + segMaskOut = segMaskOut| mask; + hit = true; + } + mask = mask << 1; + } + return !hit; +} + +Hit::Hit() +{ + _originalSeg=NULL; + _localSeg=NULL; + _geode=NULL; + _geoset=NULL; + _matrix=NULL; +} + +Hit::Hit(const Hit& hit):Referenced() +{ + // copy data across. + _ratio = hit._ratio; + _originalSeg = hit._originalSeg; + _localSeg = hit._localSeg; + _nodePath = hit._nodePath; + _geode = hit._geode; + _geoset = hit._geoset; + _matrix = hit._matrix; + + _vecIndexList = hit._vecIndexList; + _primitiveIndex = hit._primitiveIndex; + _intersectPoint = hit._intersectPoint; + _intersectNormal = hit._intersectNormal; + + if (_matrix) _matrix->ref(); + if (_originalSeg) _originalSeg->ref(); + if (_localSeg) _localSeg->ref(); +} + + +Hit::~Hit() +{ + if (_matrix) _matrix->unref(); + if (_originalSeg) _originalSeg->unref(); + if (_localSeg) _localSeg->unref(); + _matrix = (osg::Matrix*)0xffffffff; + _localSeg = (osg::Seg*)0xffffffff; + _localSeg = (osg::Seg*)0xffffffff; + _geode = (osg::Geode*)0xffffffff; +} + +Hit& Hit::operator = (const Hit& hit) +{ + if (&hit==this) return *this; + + // free old memory. + if (_matrix!=hit._matrix) + { + if (_matrix) _matrix->unref(); + _matrix = hit._matrix; + if (_matrix) _matrix->ref(); + } + if (_originalSeg!=hit._originalSeg) + { + if (_originalSeg) _originalSeg->unref(); + _originalSeg = hit._originalSeg; + if (_originalSeg) _originalSeg->ref(); + } + if (_localSeg!=hit._localSeg) + { + if (_localSeg) _localSeg->unref(); + _localSeg = hit._localSeg; + if (_localSeg) _localSeg->ref(); + } + + // copy data across. + _ratio = hit._ratio; + _originalSeg = hit._originalSeg; + _localSeg = hit._localSeg; + _nodePath = hit._nodePath; + _geode = hit._geode; + _geoset = hit._geoset; + + _vecIndexList = hit._vecIndexList; + _primitiveIndex = hit._primitiveIndex; + _intersectPoint = hit._intersectPoint; + _intersectNormal = hit._intersectNormal; + + return *this; +} + +IntersectVisitor::IntersectVisitor() +{ + // overide the default node visitor mode. + setTraverseMode(NodeVisitor::TRAVERSE_ACTIVE_CHILDREN); + reset(); +} + +IntersectVisitor::~IntersectVisitor() +{ + std::for_each(_intersectStateStack.begin(),_intersectStateStack.end(),UnrefOp()); + _intersectStateStack.erase(_intersectStateStack.begin(),_intersectStateStack.end()); +} + +void IntersectVisitor::reset() +{ + + // + // first unref all referenced objects and then empty the containers. + // + std::for_each(_intersectStateStack.begin(),_intersectStateStack.end(),UnrefOp()); + _intersectStateStack.erase(_intersectStateStack.begin(),_intersectStateStack.end()); + + + // create a empty IntersectState on the the intersectStateStack. + IntersectState* nis = new IntersectState; + nis->_matrix = NULL; + nis->_inverse = NULL; + + _intersectStateStack.push_back(nis); + +} + + +bool IntersectVisitor::hits() +{ + for(SegHitListMap::iterator itr = _segHitList.begin(); + itr != _segHitList.end(); + ++itr) + { + if (!(itr->second.empty())) return true; + } + return false; +} + +void IntersectVisitor::addSeg(Seg* seg) +{ + // first check to see if segment has already been added. + for(SegHitListMap::iterator itr = _segHitList.begin(); + itr != _segHitList.end(); + ++itr) + { + if (itr->first == seg) return; + } + + // create a new segment transformed to local coordintes. + IntersectState* cis = _intersectStateStack.back(); + Seg* ns = new Seg; + if (cis->_inverse) ns->mult(*seg,*(cis->_inverse)); + else *ns = *seg; + cis->_segList.push_back(std::pair(seg,ns)); + seg->ref(); + ns->ref(); + +} + +void IntersectVisitor::pushMatrix(const Matrix& matrix) +{ + IntersectState* nis = new IntersectState; + nis->ref(); + + IntersectState* cis = _intersectStateStack.back(); + + if (cis->_matrix) + { + nis->_matrix = new Matrix; + nis->_matrix->mult(matrix,*(cis->_matrix)); + } + else + { + nis->_matrix = new Matrix(matrix); + } + nis->_matrix->ref(); + + Matrix* inverse_world = new Matrix; + inverse_world->ref(); + inverse_world->invert(*(nis->_matrix)); + nis->_inverse = inverse_world; + + IntersectState::SegmentMask segMaskIn = cis->_segmentMaskStack.back(); + IntersectState::SegmentMask mask = 0x00000001; + for(IntersectState::SegList::iterator sitr=cis->_segList.begin(); + sitr!=cis->_segList.end(); + ++sitr) + { + if ((segMaskIn & mask)) + { + Seg* seg = new Seg; + seg->mult(*(sitr->first),*inverse_world); + nis->_segList.push_back(std::pair(sitr->first,seg)); + seg->ref(); + sitr->first->ref(); + } + mask = mask << 1; + } + + _intersectStateStack.push_back(nis); + +// notify(INFO) << << "IntersectVisitor::pushMatrix()"<unref(); + _intersectStateStack.pop_back(); + } +// notify(INFO) << << "IntersectVisitor::popMatrix()"<isCulled(bs,sm)) return false; + cis->_segmentMaskStack.push_back(sm); + _nodePath.push_back(&node); + return true; + } + else + { + return false; + } +} + +void IntersectVisitor::leaveNode() +{ + IntersectState* cis = _intersectStateStack.back(); + cis->_segmentMaskStack.pop_back(); +} + +void IntersectVisitor::apply(Node& node) +{ + if (!enterNode(node)) return; + + traverse(node); + + leaveNode(); +} + +struct TriangleIntersect +{ + Seg _seg; + + Vec3 _s; + Vec3 _d; + float _length; + + int _index; + float _ratio; + bool _hit; + + typedef std::multimap > TriangleHitList; + TriangleHitList _thl; + + + TriangleIntersect(const Seg& seg,float ratio=FLT_MAX) + { + _seg=seg; + _hit=false; + _index = 0; + _ratio = ratio; + + _s = _seg.start(); + _d = _seg.end()-_seg.start(); + _length = _d.length(); + _d /= _length; + + } + +// void operator () (const Vec3& v1,const Vec3& v2,const Vec3& v3) +// { +// float r; +// if (_seg.intersect(v1,v2,v3,r)) +// { +// _thl.insert(std::pair(r,_index)); +// _hit = true; +// } +// ++_index; +// } + +// bool intersect(const Vec3& v1,const Vec3& v2,const Vec3& v3,float& r) + void operator () (const Vec3& v1,const Vec3& v2,const Vec3& v3) + { + ++_index; + + if (v1==v2 || v2==v3 || v1==v3) return; + + Vec3 v12 = v2-v1; + Vec3 n12 = v12^_d; + float ds12 = (_s-v1)*n12; + float d312 = (v3-v1)*n12; + if (d312>=0.0f) + { + if (ds12<0.0f) return; + if (ds12>d312) return; + } + else // d312 < 0 + { + if (ds12>0.0f) return; + if (ds12=0.0f) + { + if (ds23<0.0f) return; + if (ds23>d123) return; + } + else // d123 < 0 + { + if (ds23>0.0f) return; + if (ds23=0.0f) + { + if (ds31<0.0f) return; + if (ds31>d231) return; + } + else // d231 < 0 + { + if (ds31>0.0f) return; + if (ds31_length) return; + + osg::Vec3 normal = v12^v23; + normal.normalize(); + + float r = d/_length; + + _thl.insert(std::pair > + (r,std::pair(_index-1,normal))); + _hit = true; + + } + + +}; + +bool IntersectVisitor::intersect(GeoSet& gset) +{ + bool hitFlag = false; + + IntersectState* cis = _intersectStateStack.back(); + + const BoundingBox& bb = gset.getBound(); + + for(IntersectState::SegList::iterator sitr=cis->_segList.begin(); + sitr!=cis->_segList.end(); + ++sitr) + { + if (sitr->second->intersect(bb)) + { + TriangleIntersect ti(*sitr->second); + for_each_triangle(gset,ti); + if (ti._hit) + { + + for(TriangleIntersect::TriangleHitList::iterator thitr=ti._thl.begin(); + thitr!=ti._thl.end(); + ++thitr) + { + Hit hit; + hit._nodePath = _nodePath; + hit._matrix = cis->_matrix; + if (hit._matrix) hit._matrix->ref(); + hit._geoset = &gset; + if (_nodePath.empty()) hit._geode = NULL; + else hit._geode = dynamic_cast(_nodePath.back()); + + hit._ratio = thitr->first; + hit._primitiveIndex = thitr->second.first; + hit._originalSeg = sitr->first; + if (hit._originalSeg) hit._originalSeg->ref(); + hit._localSeg = sitr->second; + if (hit._localSeg) hit._localSeg->ref(); + + hit._intersectPoint = sitr->second->start()*(1.0f-hit._ratio)+ + sitr->second->end()*hit._ratio; + + hit._intersectNormal = thitr->second.second; + +// _segHitList[sitr->first].insert(hit); + _segHitList[sitr->first].push_back(hit); + std::sort(_segHitList[sitr->first].begin(),_segHitList[sitr->first].end()); + + hitFlag = true; + + } + } + } +// else notify(INFO) << << "no BB hit"<mult(local_mat,*(currMatrix)); +// } +// else +// { +// matrix = new Matrix(local_mat); +// } +// +// matrix->ref(); +// matrix->unref(); +// +// } + leaveNode(); +} + +void IntersectVisitor::apply(Group& node) +{ + if (!enterNode(node)) return; + + traverse(node); + + leaveNode(); +} + +void IntersectVisitor::apply(DCS& node) +{ + if (!enterNode(node)) return; + + pushMatrix(*node.getMatrix()); + + traverse(node); + + popMatrix(); + + leaveNode(); +} + + +void IntersectVisitor::apply(Switch& node) +{ + apply((Group&)node); +} + + +void IntersectVisitor::apply(LOD& node) +{ + apply((Group&)node); +} + + +void IntersectVisitor::apply(Scene& node) +{ + apply((Group&)node); +} diff --git a/src/osgUtil/Makedepend b/src/osgUtil/Makedepend new file mode 100644 index 000000000..e69de29bb diff --git a/src/osgUtil/Makefile b/src/osgUtil/Makefile new file mode 100644 index 000000000..197a78490 --- /dev/null +++ b/src/osgUtil/Makefile @@ -0,0 +1,43 @@ +#!smake +include ../../Make/makedefs + +C++FILES = \ + DisplayListVisitor.cpp\ + RenderVisitor.cpp\ + SceneView.cpp\ + IntersectVisitor.cpp\ + CameraManipulator.cpp\ + TrackballManipulator.cpp\ + FlightManipulator.cpp\ + DriveManipulator.cpp\ + Version.cpp\ + + +TARGET_BASENAME = osgUtil + + +LIBS = -ldl + +LIB = ../../lib/lib$(TARGET_BASENAME).so +#LIB = ../../lib/lib$(TARGET_BASENAME).a + +TARGET_LIB_FILES = lib$(TARGET_BASENAME).so +TARGET_INCLUDE_FILES = \ + osgUtil/CameraManipulator\ + osgUtil/DisplayListVisitor\ + osgUtil/DriveManipulator\ + osgUtil/Export\ + osgUtil/GUIActionAdapter\ + osgUtil/GUIEventAdapter\ + osgUtil/IntersectVisitor\ + osgUtil/RenderVisitor\ + osgUtil/SceneView\ + osgUtil/TrackballManipulator\ + osgUtil/FlightManipulator\ + osgUtil/Version\ + + +C++FLAGS += -I ../../include + +include ../../Make/makerules + diff --git a/src/osgUtil/RenderVisitor.cpp b/src/osgUtil/RenderVisitor.cpp new file mode 100644 index 000000000..1801738f1 --- /dev/null +++ b/src/osgUtil/RenderVisitor.cpp @@ -0,0 +1,799 @@ +#include "osgUtil/RenderVisitor" +#include "osg/DCS" +#include "osg/Geode" +#include "osg/LOD" +#include "osg/Billboard" +#include "osg/LightSource" +#include "osg/Notify" + +#include +#include + +#ifndef OSG_USE_IO_DOT_H +#include +using namespace std; +#endif + +using namespace osg; +using namespace osgUtil; + +static bool g_debugging = false; + +ViewState::ViewState() +{ + _matrix = NULL; + _inverse = NULL; + _ratio = 0.002f; + _viewFrustumCullingActive=true; + _smallFeatureCullingActive=true; +} + +ViewState::~ViewState() +{ + if (_matrix) _matrix->unref(); + if (_inverse) _inverse->unref(); +} + + +bool ViewState::isCulled(const BoundingSphere& sp) +{ + if (!sp.isValid()) return true; + + + Vec3 delta = sp._center-_eyePoint; + if (_smallFeatureCullingActive) + { + if (sp._radiussp._radius) + { + return true; + } + if (delta*_frustumBottomNormal>sp._radius) + { + return true; + } + if (delta*_frustumLeftNormal>sp._radius) + { + return true; + } + if (delta*_frustumRightNormal>sp._radius) + { + return true; + } + } + return false; +} + +bool ViewState::isCulled(const BoundingBox& bb) +{ + if (!bb.isValid()) return true; + + if (_viewFrustumCullingActive) + { + unsigned int c; + for(c=0;c<8;++c) + { + if ((bb.corner(c)-_eyePoint)*_frustumLeftNormal<=0.0f) break; + } + // if all corners have been checked, therefore all points are + // and the far side of the left clipping plane and hence should be culled. + if (c==8) return true; + + for(c=0;c<8;++c) + { + if ((bb.corner(c)-_eyePoint)*_frustumRightNormal<=0.0f) break; + } + // if all corners have been checked, therefore all points are + // and the far side of the right clipping plane and hence should be culled. + if (c==8) return true; + + for(c=0;c<8;++c) + { + if ((bb.corner(c)-_eyePoint)*_frustumTopNormal<=0.0f) break; + } + // if all corners have been checked, therefore all points are + // and the far side of the top clipping plane and hence should be culled. + if (c==8) return true; + + + for(c=0;c<8;++c) + { + if ((bb.corner(c)-_eyePoint)*_frustumBottomNormal<=0.0f) break; + } + // if all corners have been checked, therefore all points are + // and the far side of the bottom clipping plane and hence should be culled. + if (c==8) return true; + } + + return false; +} + +RenderVisitor::RenderVisitor() +{ + // overide the default node visitor mode. + setTraverseMode(NodeVisitor::TRAVERSE_ACTIVE_CHILDREN); + + _globalState=NULL; + _LODBias = 1.0f; + + _fovy=60.0f; + _aspect=1.0f; + _znear=1.0f; + _zfar=1000.0f; + + _tvs = new ViewState; + _tvs->_eyePoint.set(0.0f,0.0f,1.0f); + _tvs->_centerPoint.set(0.0f,0.0f,0.0f); + _tvs->_lookVector.set(0.0f,0.0f,-1.0f); + _tvs->_upVector.set(0.0f,1.0f,0.0f); + _tvs->ref(); + + _cvs = _tvs; + _cvs->ref(); + + _tsm = LOOK_VECTOR_DISTANCE; + _tsm = OBJECT_EYE_POINT_DISTANCE; + + _viewFrustumCullingActive=true; + _smallFeatureCullingActive=true; + + calculateClippingPlanes(); +} + +RenderVisitor::~RenderVisitor() +{ + reset(); + // if a global geostate is attached simply unref it. + if (_globalState) + { + _globalState->unref(); + _globalState = NULL; + } + if (_tvs) _tvs->unref(); + if (_cvs) _cvs->unref(); +} + +void RenderVisitor::reset() +{ + + // + // first unref all referenced objects and then empty the containers. + // + std::for_each(_viewStateStack.begin(),_viewStateStack.end(),UnrefOp()); + _viewStateStack.erase(_viewStateStack.begin(),_viewStateStack.end()); + if (_cvs!=_tvs) + { + if (_cvs) _cvs->unref(); + _cvs = _tvs; + _cvs->ref(); + } + + for(std::multimap::iterator titr= _transparentGeoSets.begin(); + titr!= _transparentGeoSets.end(); + ++titr) + { + if ((*titr).second.first) (*titr).second.first->unref(); + } + _transparentGeoSets.erase(_transparentGeoSets.begin(),_transparentGeoSets.end()); + + for(std::multimap::iterator oitr= _opaqueGeoSets.begin(); + oitr!= _opaqueGeoSets.end(); + ++oitr) + { + if ((*oitr).second.first) (*oitr).second.first->unref(); + } + _opaqueGeoSets.erase(_opaqueGeoSets.begin(),_opaqueGeoSets.end()); + + _lights.erase(_lights.begin(),_lights.end()); + +} + +void RenderVisitor::setGlobalState(GeoState* global) +{ + if (global==_globalState) return; + if (_globalState) _globalState->unref(); + _globalState = global; + _globalState->ref(); +} + + +void RenderVisitor::setPerspective(const osg::Camera& camera) +{ + _fovy=camera.getFieldOfViewY(); + _aspect=camera.getAspectRatio(); + _znear=camera.getNearPlane(); + _zfar=camera.getFarPlane(); + + calculateClippingPlanes(); +} + +void RenderVisitor::setPerspective(float fovy,float aspect,float znear,float zfar) +{ + _fovy=fovy; + _aspect=aspect; + _znear=znear; + _zfar=zfar; + + calculateClippingPlanes(); +} + +void RenderVisitor::setLookAt(const Camera& camera) +{ + setLookAt(camera.getEyePoint(),camera.getLookPoint(),camera.getUpVector()); +} + +void RenderVisitor::setLookAt(const Vec3& eye,const Vec3& center,const Vec3& upVector) +{ + _tvs->_eyePoint = eye; + + _tvs->_centerPoint = center; + + _tvs->_lookVector = center-eye; + _tvs->_lookVector.normalize(); + + _tvs->_upVector = upVector; + + calculateClippingPlanes(); +} + + +void RenderVisitor::setLookAt(double eyeX,double eyeY,double eyeZ, + double centerX,double centerY,double centerZ, + double upX,double upY,double upZ) +{ + _tvs->_eyePoint[0] = eyeX; + _tvs->_eyePoint[1] = eyeY; + _tvs->_eyePoint[2] = eyeZ; + + _tvs->_centerPoint[0] = centerX; + _tvs->_centerPoint[1] = centerY; + _tvs->_centerPoint[2] = centerZ; + + _tvs->_lookVector[0] = centerX-eyeX; + _tvs->_lookVector[1] = centerY-eyeY; + _tvs->_lookVector[2] = centerZ-eyeZ; + _tvs->_lookVector.normalize(); + + _tvs->_upVector[0] = upX; + _tvs->_upVector[1] = upY; + _tvs->_upVector[2] = upZ; + + calculateClippingPlanes(); +} + +void RenderVisitor::setCullingActive(CullingType ct,bool active) +{ + switch(ct) + { + case(VIEW_FRUSTUM_CULLING):_viewFrustumCullingActive=active;break; + case(SMALL_FEATURE_CULLING):_smallFeatureCullingActive=active;break; + } +} + +bool RenderVisitor::getCullingActive(CullingType ct) +{ + switch(ct) + { + case(VIEW_FRUSTUM_CULLING):return _viewFrustumCullingActive; + case(SMALL_FEATURE_CULLING):return _smallFeatureCullingActive; + } + return false; +} + +void RenderVisitor::calculateClippingPlanes() +{ + float half_fovy = _fovy*0.5f; + float s = sinf(half_fovy*M_PI/180.0f); + float c = cosf(half_fovy*M_PI/180.0f); + + Vec3 lv = _tvs->_lookVector; + Vec3 up = _tvs->_upVector; + Vec3 sv = lv ^ up; + sv.normalize(); + + _tvs->_frustumTopNormal = -lv*s + up*c; + _tvs->_frustumTopNormal.normalize(); + + _tvs->_frustumBottomNormal = -lv*s - up*c; + _tvs->_frustumBottomNormal.normalize(); + + _tvs->_frustumLeftNormal = -sv*c - lv*(s*_aspect); + _tvs->_frustumLeftNormal.normalize(); + + _tvs->_frustumRightNormal = sv*c - lv*(s*_aspect); + _tvs->_frustumRightNormal.normalize(); + +// notify(INFO) << "_frustumTopNormal = "<<_tvs->_frustumTopNormal[0]<<"\t"<<_tvs->_frustumTopNormal[1]<<"\t"<<_tvs->_frustumTopNormal[2]<_frustumBottomNormal[1]<<"\t"<<_tvs->_frustumBottomNormal[2]<_frustumLeftNormal[1]<<"\t"<<_tvs->_frustumLeftNormal[2]<_frustumRightNormal[1]<<"\t"<<_tvs->_frustumRightNormal[2]<ref(); + nvs->_viewFrustumCullingActive=_viewFrustumCullingActive; + nvs->_smallFeatureCullingActive=_smallFeatureCullingActive; + + if (_cvs && _cvs->_matrix) + { + nvs->_matrix = new Matrix; + nvs->_matrix->mult(matrix,*(_cvs->_matrix)); + } + else + { + nvs->_matrix = new Matrix(matrix); + } + nvs->_matrix->ref(); + + Matrix* inverse_world = new Matrix; + inverse_world->ref(); + inverse_world->invert(*(nvs->_matrix)); + nvs->_inverse = inverse_world; + + nvs->_eyePoint = _tvs->_eyePoint*(*inverse_world); + nvs->_centerPoint = _tvs->_centerPoint*(*inverse_world); + + nvs->_lookVector = nvs->_centerPoint - nvs->_eyePoint; + nvs->_lookVector.normalize(); + + nvs->_frustumTopNormal = (_tvs->_eyePoint + _tvs->_frustumTopNormal)*(*inverse_world)-nvs->_eyePoint; + nvs->_frustumTopNormal.normalize(); + + nvs->_frustumBottomNormal = (_tvs->_eyePoint + _tvs->_frustumBottomNormal)*(*inverse_world)-nvs->_eyePoint; + nvs->_frustumBottomNormal.normalize(); + + nvs->_frustumLeftNormal = (_tvs->_eyePoint + _tvs->_frustumLeftNormal)*(*inverse_world)-nvs->_eyePoint; + nvs->_frustumLeftNormal.normalize(); + + nvs->_frustumRightNormal = (_tvs->_eyePoint + _tvs->_frustumRightNormal)*(*inverse_world)-nvs->_eyePoint; + nvs->_frustumRightNormal.normalize(); + + if (_cvs) _cvs->unref(); + + _cvs = nvs; + + if (_cvs) _cvs->ref(); + _viewStateStack.push_back(nvs); +} + +void RenderVisitor::popMatrix() +{ + // pop the top of the view stack and unref it. + ViewState* pvs = _viewStateStack.back(); + _viewStateStack.pop_back(); + pvs->unref(); + + // unref previous cvs + if (_cvs) _cvs->unref(); + + // to new cvs and ref it. + if (_viewStateStack.empty()) + { + _cvs = _tvs; + if (_cvs) _cvs->ref(); + } + else + { + _cvs = _viewStateStack.back(); + if (_cvs) _cvs->ref(); + } + +} + +Matrix* RenderVisitor::getCurrentMatrix() +{ + return _cvs->_matrix; +} + +Matrix* RenderVisitor::getInverseCurrentMatrix() +{ + return _cvs->_inverse; +} + +const Vec3& RenderVisitor::getEyeLocal() +{ + return _cvs->_eyePoint; +} + +const Vec3& RenderVisitor::getCenterLocal() +{ + return _cvs->_centerPoint; +} + +const Vec3& RenderVisitor::getLookVectorLocal() +{ + return _cvs->_lookVector; +} + +bool RenderVisitor::isCulled(const BoundingSphere& sp) +{ + return _cvs->isCulled(sp); +} + +bool RenderVisitor::isCulled(const BoundingBox& bb) +{ + return _cvs->isCulled(bb); +} + +void RenderVisitor::apply(Node& node) +{ + if (isCulled(node.getBound())) return; + + traverse(node); +} + +void RenderVisitor::apply(Geode& node) +{ + if (isCulled(node.getBound())) return; + + Matrix* matrix = getCurrentMatrix(); + for(int i=0;igetBound())) continue; + + GeoState* gstate = gset->getGeoState(); + bool isTransparent = gstate && gstate->isTransparent(); + if (isTransparent) + { + + Vec3 center; + if (matrix) + { + center = (gset->getBound().center())*(*matrix); + } + else + { + center = gset->getBound().center(); + } + Vec3 delta_center = center-_tvs->_eyePoint; + + if (g_debugging) + { + notify(INFO) << "center ["<_lookVector.x()<<","<<_tvs->_lookVector.y()<<","<<_tvs->_lookVector.z()<<"]"<_lookVector*delta_center;break; + case(OBJECT_EYE_POINT_DISTANCE): + default: depth = delta_center.length2();break; + } + + if (matrix) matrix->ref(); + _transparentGeoSets.insert( + std::pair(depth,MatrixGeoSet(matrix,gset)) + ); + } + else + { + if (matrix) matrix->ref(); + _opaqueGeoSets.insert( + std::pair(gstate,MatrixGeoSet(matrix,gset)) + ); + } + } +} + +void RenderVisitor::apply(Billboard& node) +{ + if (isCulled(node.getBound())) return; + + Vec3 eye_local = getEyeLocal(); + + for(int i=0;igetBound())) continue; + + Matrix local_mat; + node.calcTransform(eye_local,pos,local_mat); + + Matrix* matrix = NULL; + if (_cvs->_matrix) + { + matrix = new Matrix(); + matrix->mult(local_mat,*(_cvs->_matrix)); + } + else + { + matrix = new Matrix(local_mat); + } + + GeoState* gstate = gset->getGeoState(); + bool isTransparent = gstate && gstate->isTransparent(); + if (isTransparent) + { + + Vec3 center; + if (matrix) + { + center = (gset->getBound().center())*(*matrix); + } + else + { + center = gset->getBound().center(); + } + Vec3 delta_center = center-_tvs->_eyePoint; + + if (g_debugging) + { + notify(INFO) << "center ["<_lookVector.x()<<","<<_tvs->_lookVector.y()<<","<<_tvs->_lookVector.z()<<"]"<_lookVector*delta_center;break; + case(OBJECT_EYE_POINT_DISTANCE): + default: depth = delta_center.length2();break; + } + + if (matrix) matrix->ref(); + _transparentGeoSets.insert( + std::pair(depth,MatrixGeoSet(matrix,gset)) + ); + } + else + { + if (matrix) matrix->ref(); + _opaqueGeoSets.insert( + std::pair(gstate,MatrixGeoSet(matrix,gset)) + ); + } + + } +} + +void RenderVisitor::apply(LightSource& node) +{ + Matrix* matrix = getCurrentMatrix(); + Light* light = node.getLight(); + if (light) + { + if (matrix) matrix->ref(); + _lights.insert(std::pair(matrix,light)); + } +} + +void RenderVisitor::apply(Group& node) +{ + if (isCulled(node.getBound())) return; + + traverse(node); +} + + +void RenderVisitor::apply(DCS& node) +{ + if (isCulled(node.getBound())) return; + + pushMatrix(*node.getMatrix()); + + traverse(node); + + popMatrix(); +} + + +void RenderVisitor::apply(Switch& node) +{ + apply((Group&)node); +} + + +void RenderVisitor::apply(LOD& node) +{ + if (isCulled(node.getBound())) return; + + int eval = node.evaluate(getEyeLocal(),_LODBias); + if (eval<0) + { + //notify(INFO) << "culled LOD"<accept(*this); + } + +} + + +void RenderVisitor::apply(Scene& node) +{ + apply((Group&)node); +} + + +bool RenderVisitor::calcNearFar(double& near_plane,double& far_plane) +{ + if (_opaqueGeoSets.empty() && _transparentGeoSets.empty()) return false; + + near_plane = FLT_MAX; + far_plane = -FLT_MAX; + + Vec3 eyePoint = getEyeLocal(); + Vec3 lookVector = getLookVectorLocal(); + + for(OpaqueList::iterator oitr = _opaqueGeoSets.begin(); + oitr != _opaqueGeoSets.end(); + ++oitr) + { + Matrix* matrix = (oitr->second).first; + GeoSet* gset = (oitr->second).second; + const BoundingBox& bb = gset->getBound(); + for(int c=0;c<8;++c) + { + float d; + if (matrix) d = ((bb.corner(c)*(*matrix))-eyePoint)*lookVector; + else d = (bb.corner(c)-eyePoint)*lookVector; + if (dfar_plane) far_plane = d; + } + } + + for(TransparentList::iterator titr = _transparentGeoSets.begin(); + titr != _transparentGeoSets.end(); + ++titr) + { + Matrix* matrix = (titr->second).first; + GeoSet* gset = (titr->second).second; + const BoundingBox& bb = gset->getBound(); + for(int c=0;c<8;++c) + { + float d; + if (matrix) d = ((bb.corner(c)*(*matrix))-eyePoint)*lookVector; + else d = (bb.corner(c)-eyePoint)*lookVector; + if (dfar_plane) far_plane = d; + } + } + + return true; +} + +void RenderVisitor::render() +{ + + Matrix* prevMatrix = NULL; + Matrix* currMatrix = NULL; + + GeoState* currGeoState = NULL; + GeoState* prevGeoState = NULL; + + if (g_debugging) notify(INFO) << "start of render"<apply(); + prevGeoState=_globalState; + } + + + // apply the lists. + for(LightList::iterator litr=_lights.begin(); + litr!=_lights.end(); + ++litr) + { + currMatrix = litr->first; + if (currMatrix!=prevMatrix) + { + if (prevMatrix) glPopMatrix(); + if (currMatrix) + { + glPushMatrix(); + glMultMatrixf( (GLfloat *)(currMatrix->_mat) ); + } + prevMatrix = currMatrix; + } + (litr->second)->apply(); + } + + // draw the opaque bin. + for(std::multimap::iterator oitr= _opaqueGeoSets.begin(); + oitr!= _opaqueGeoSets.end(); + ++oitr) + { + if (g_debugging) + { + notify(INFO) << " drawing opaque matrix["<<(*oitr).second.first<<"]" + << " geoset["<<(*oitr).second.second<<"]" + << " geostate["<<(*oitr).second.second->getGeoState()<<"]"<_mat) ); + } + prevMatrix = currMatrix; + } + + currGeoState = (*oitr).first; + if (currGeoState!=prevGeoState) + { + if (currGeoState) currGeoState->apply(_globalState,prevGeoState); + prevGeoState = currGeoState; + } + + (*oitr).second.second->draw(); + } + + +// glPushAttrib( GL_DEPTH_TEST ); +// glDisable( GL_DEPTH_TEST ); + + // render the transparent geoset in reverse order, so to render the + // deepest transparent objects, relative to the look vector, first. + for(std::multimap::reverse_iterator titr= _transparentGeoSets.rbegin(); + titr!= _transparentGeoSets.rend(); + ++titr) + { + if (g_debugging) + { + notify(INFO) << " drawing transparent matrix["<<(*titr).second.first<<"]" + << " geoset["<<(*titr).second.second<<"]" + << " geostate["<<(*titr).second.second->getGeoState()<<"]" + << " depth["<<(*titr).first<<"]"<_mat) ); + } + prevMatrix = currMatrix; + } + + currGeoState = (*titr).second.second->getGeoState(); + if (currGeoState!=prevGeoState) + { + if (currGeoState) currGeoState->apply(_globalState,prevGeoState); + prevGeoState = currGeoState; + } + + (*titr).second.second->draw(); + } + +// glPopAttrib(); + + + if (currMatrix) glPopMatrix(); + + if (g_debugging) + { + notify(INFO) << "end of render"<setGlobalDefaults(); + _globalState->setMode(osg::GeoState::LIGHTING, osg::GeoState::ON); + + _backgroundColor.set(0.2f, 0.2f, 0.4f, 1.0f); + +} + + +void SceneView::cull() +{ + if (!_renderVisitor) return; + if (!_sceneData) return; + + _camera->setAspectRatio((GLfloat)_view[2]/(GLfloat) _view[3]); + + _renderVisitor->reset(); + + _renderVisitor->setGlobalState(_globalState.get()); + _renderVisitor->setLODBias(_lodBias); +// _renderVisitor->setPerspective(60.0f, (GLfloat)_view[2]/(GLfloat) _view[3], _near_plane, _far_plane ); + _renderVisitor->setPerspective(*_camera); + _renderVisitor->setLookAt(*_camera); + + _sceneData->accept(*_renderVisitor); + + if (_calc_nearfar) + { + if (_renderVisitor->calcNearFar(_near_plane,_far_plane)) + { + // shift the far plane slight further away from the eye point. + // and shift the near plane slightly near the eye point, this + // will give a little space betwenn the near and far planes + // and the model, crucial when the naer and far planes are + // coincedent. + _far_plane *= 1.05; + _near_plane *= 0.95; + + // if required clamp the near plane to prevent negative or near zero + // near planes. + float min_near_plane = _far_plane*0.0005f; + if (_near_planesetNearPlane(_near_plane); + _camera->setFarPlane(_far_plane); + } +} + +void SceneView::draw() +{ + if (!_renderVisitor) return; + if (!_sceneData) return; + + glViewport( _view[0], _view[1], _view[2], _view[3] ); + + glEnable( GL_DEPTH_TEST ); + + glClearColor( _backgroundColor[0], _backgroundColor[1], _backgroundColor[2], _backgroundColor[3]); + + glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); + +// glMatrixMode( GL_PROJECTION ); +// glLoadIdentity(); +// gluPerspective( 60.0f, (GLfloat)_view[2]/(GLfloat) _view[3], _near_plane, _far_plane ); + + _camera->draw_PROJECTION(); + + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + + if (_lightingMode==HEADLIGHT) + { + _light->apply(); + } + + _camera->draw_MODELVIEW(); + +// gluLookAt( _camera->getEyePoint().x(), _camera->getEyePoint().y(), _camera->getEyePoint().z(), +// _camera->getLookPoint().x(), _camera->getLookPoint().y(), _camera->getLookPoint().z(), +// _camera->getUpVector().x(), _camera->getUpVector().y(), _camera->getUpVector().z()); + + if (_lightingMode==SKY_LIGHT) + { + _light->apply(); + } + + +// glLightModeli(GL_LIGHT_MODEL_TWO_SIDE,_two_sided_lighting); + + + glGetDoublev(GL_MODELVIEW_MATRIX,_model); + glGetDoublev(GL_PROJECTION_MATRIX,_proj); + + + _renderVisitor->render(); + + +} + +/** Calculate, via glUnProject, the object coordinates of a window point. + Note, current implementation requires that SceneView::draw() has been previously called + for projectWindowIntoObject to produce valid values. As per OpenGL + windows coordinates are calculated relative to the bottom left of the window.*/ +bool SceneView::projectWindowIntoObject(const osg::Vec3& window,osg::Vec3& object) const +{ + GLdouble sX,sY,sZ; + GLint result_start = gluUnProject((GLdouble)window[0],(GLdouble)window[1],(GLdouble)window[2], + _model,_proj,_view, + &sX,&sY,&sZ); + if (result_start) + { + object.set(sX,sY,sZ); + return true; + } + else + { + return false; + } +} + +/** Calculate, via glUnProject, the object coordinates of a window x,y + when projected onto the near and far planes. + Note, current implementation requires that SceneView::draw() has been previously called + for projectWindowIntoObject to produce valid values. As per OpenGL + windows coordinates are calculated relative to the bottom left of the window.*/ +bool SceneView::projectWindowXYIntoObject(int x,int y,osg::Vec3& near_point,osg::Vec3& far_point) const +{ + GLdouble nX,nY,nZ; + GLint result_near = gluUnProject((GLdouble)x,(GLdouble)y,(GLdouble)0.0, + _model,_proj,_view, + &nX,&nY,&nZ); + + + if (result_near==0) return false; + + GLdouble fX,fY,fZ; + GLint result_far = gluUnProject((GLdouble)x,(GLdouble)y,(GLdouble)1.0, + _model,_proj,_view, + &fX,&fY,&fZ); + + if (result_far==0) return false; + + near_point.set(nX,nY,nZ); + far_point.set(fX,fY,fZ); + + return true; +} + +/** Calculate, via glProject, the object coordinates of a window. + Note, current implementation requires that SceneView::draw() has been previously called + for projectWindowIntoObject to produce valid values. As per OpenGL + windows coordinates are calculated relative to the bottom left of the window.*/ +bool SceneView::projectObjectIntoWindow(const osg::Vec3& object,osg::Vec3& window) const +{ + GLdouble sX,sY,sZ; + GLint result_start = gluProject((GLdouble)object[0],(GLdouble)object[1],(GLdouble)object[2], + _model,_proj,_view, + &sX,&sY,&sZ); + if (result_start) + { + window.set(sX,sY,sZ); + return true; + } + else + { + return false; + } +} diff --git a/src/osgUtil/TrackballManipulator.cpp b/src/osgUtil/TrackballManipulator.cpp new file mode 100644 index 000000000..aabd23ca4 --- /dev/null +++ b/src/osgUtil/TrackballManipulator.cpp @@ -0,0 +1,348 @@ +#include "osgUtil/TrackballManipulator" +#include "osg/Notify" + +using namespace osg; +using namespace osgUtil; + +TrackballManipulator::TrackballManipulator() +{ + _modelScale = 0.01f; + _minimumZoomScale = 0.05f; + _thrown = false; +} + +TrackballManipulator::~TrackballManipulator() +{ +} + +void TrackballManipulator::setNode(osg::Node* node) +{ + _node = node; + if (_node.get()) + { + const osg::BoundingSphere& boundingSphere=_node->getBound(); + _modelScale = boundingSphere._radius; + } +} + +osg::Node* TrackballManipulator::getNode() const +{ + return _node.get(); +} + +void TrackballManipulator::home(GUIEventAdapter& /*ea*/,GUIActionAdapter& us) +{ + if(_node.get() && _camera.get()) + { + + const osg::BoundingSphere& boundingSphere=_node->getBound(); + + _camera->setView(boundingSphere._center+osg::Vec3( 0.0,-2.0f * boundingSphere._radius,0.0f), // eye + boundingSphere._center, // look + osg::Vec3(0.0f,0.0f,1.0f)); // up + + us.needRedraw(); + } + +} + +void TrackballManipulator::init(GUIEventAdapter& /*ea*/,GUIActionAdapter& /*us*/) +{ + flushMouseEventStack(); +} + +bool TrackballManipulator::update(GUIEventAdapter& ea,GUIActionAdapter& us) +{ + if(!_camera.get()) return false; + + switch(ea.getEventType()) + { + case(GUIEventAdapter::PUSH): + { + flushMouseEventStack(); + addMouseEvent(ea); + if (calcMovement()) us.needRedraw(); + us.needContinuousUpdate(false); + _thrown = false; + } + return true; + case(GUIEventAdapter::RELEASE): + { + if (ea.getButtonMask()==0) { + + if (isMouseMoving()) + { + if (calcMovement()) + { + us.needRedraw(); + us.needContinuousUpdate(true); + _thrown = true; + } + } + else + { + flushMouseEventStack(); + addMouseEvent(ea); + if (calcMovement()) us.needRedraw(); + us.needContinuousUpdate(false); + _thrown = false; + } + + } + else + { + flushMouseEventStack(); + addMouseEvent(ea); + if (calcMovement()) us.needRedraw(); + us.needContinuousUpdate(false); + _thrown = false; + } + } + return true; + case(GUIEventAdapter::DRAG): + { + addMouseEvent(ea); + if (calcMovement()) us.needRedraw(); + us.needContinuousUpdate(false); + _thrown = false; + } + return true; + case(GUIEventAdapter::MOVE): + { + } + return false; + case(GUIEventAdapter::KEYBOARD): + if (ea.getKey()==' ') + { + flushMouseEventStack(); + _thrown = false; + home(ea,us); + us.needRedraw(); + us.needContinuousUpdate(false); + return true; + } + return false; + case(GUIEventAdapter::FRAME): + if (_thrown) + { + if (calcMovement()) us.needRedraw(); + return true; + } + return false; + default: + return false; + } +} + +bool TrackballManipulator::isMouseMoving() +{ + if (_ga_t0.get()==NULL || _ga_t1.get()==NULL) return false; + + static const float velocity = 100.0f; + + float dx = _ga_t0->getX()-_ga_t1->getX(); + float dy = _ga_t0->getY()-_ga_t1->getY(); + float len = sqrtf(dx*dx+dy*dy); + float dt = _ga_t0->time()-_ga_t1->time(); + + return (len>dt*velocity); +} + +void TrackballManipulator::flushMouseEventStack() +{ + _ga_t1 = NULL; + _ga_t0 = NULL; +} + +void TrackballManipulator::addMouseEvent(GUIEventAdapter& ea) +{ + _ga_t1 = _ga_t0; + _ga_t0 = &ea; +} + +bool TrackballManipulator::calcMovement() +{ + // return if less then two events have been added. + if (_ga_t0.get()==NULL || _ga_t1.get()==NULL) return false; + + float dx = dx = _ga_t0->getX()-_ga_t1->getX(); + float dy = _ga_t0->getY()-_ga_t1->getY(); + + + // return if there is no movement. + if (dx==0 && dy==0) return false; + + unsigned int buttonMask = _ga_t1->getButtonMask(); + if (buttonMask==GUIEventAdapter::LEFT_BUTTON) + { + + // rotate camera. + + osg::Vec3 center = _camera->getLookPoint(); + osg::Vec3 axis; + float angle; + + float mx0 = (_ga_t0->getXmin()+_ga_t0->getXmax())/2.0f; + float rx0 = (_ga_t0->getXmax()-_ga_t0->getXmin())/2.0f; + + float my0 = (_ga_t0->getYmin()+_ga_t0->getYmax())/2.0f; + float ry0 = (_ga_t0->getYmax()-_ga_t0->getYmin())/2.0f; + + float mx1 = (_ga_t0->getXmin()+_ga_t1->getXmax())/2.0f; + float rx1 = (_ga_t0->getXmax()-_ga_t1->getXmin())/2.0f; + + float my1 = (_ga_t1->getYmin()+_ga_t1->getYmax())/2.0f; + float ry1 = (_ga_t1->getYmax()-_ga_t1->getYmin())/2.0f; + + float px0 = (_ga_t0->getX()-mx0)/rx0; + float py0 = (my0-_ga_t0->getY())/ry0; + + float px1 = (_ga_t1->getX()-mx1)/rx1; + float py1 = (my1-_ga_t1->getY())/ry1; + + trackball(axis,angle,px1,py1,px0,py0); + + osg::Matrix mat; + mat.makeTrans(-center.x(),-center.y(),-center.z()); + mat.postRot(angle,axis.x(),axis.y(),axis.z()); + mat.postTrans(center.x(),center.y(),center.z()); + + _camera->mult(*_camera,mat); + + return true; + + } + else if (buttonMask==GUIEventAdapter::MIDDLE_BUTTON || + buttonMask==(GUIEventAdapter::LEFT_BUTTON|GUIEventAdapter::RIGHT_BUTTON)) + { + + // pan model. + + float scale = 0.0015f*_camera->getFocalDistance(); + + osg::Vec3 uv = _camera->getUpVector(); + osg::Vec3 sv = _camera->getSideVector(); + osg::Vec3 dv = uv*(dy*scale)-sv*(dx*scale); + + osg::Matrix mat; + mat.makeTrans(dv.x(),dv.y(),dv.z()); + + _camera->mult(*_camera,mat); + + return true; + + } + else if (buttonMask==GUIEventAdapter::RIGHT_BUTTON) + { + + // zoom model. + + float fd = _camera->getFocalDistance(); + float scale = 1.0f-dy*0.001f; + if (fd*scale>_modelScale*_minimumZoomScale) + { + // zoom camera in. + osg::Vec3 center = _camera->getLookPoint(); + + osg::Matrix mat; + mat.makeTrans(-center.x(),-center.y(),-center.z()); + mat.postScale(scale,scale,scale); + mat.postTrans(center.x(),center.y(),center.z()); + + _camera->mult(*_camera,mat); + + } + else + { + +// notify(DEBUG) << "Pushing forward"<getLookVector()*(dy*scale); + + osg::Matrix mat; + mat.makeTrans(dv.x(),dv.y(),dv.z()); + + _camera->mult(*_camera,mat); + + } + + return true; + + } + + return false; +} + +/* + * This size should really be based on the distance from the center of + * rotation to the point on the object underneath the mouse. That + * point would then track the mouse as closely as possible. This is a + * simple example, though, so that is left as an Exercise for the + * Programmer. + */ +const float TRACKBALLSIZE = 0.8f; + +/* + * Ok, simulate a track-ball. Project the points onto the virtual + * trackball, then figure out the axis of rotation, which is the cross + * product of P1 P2 and O P1 (O is the center of the ball, 0,0,0) + * Note: This is a deformed trackball-- is a trackball in the center, + * but is deformed into a hyperbolic sheet of rotation away from the + * center. This particular function was chosen after trying out + * several variations. + * + * It is assumed that the arguments to this routine are in the range + * (-1.0 ... 1.0) + */ +void TrackballManipulator::trackball(osg::Vec3& axis,float& angle, float p1x, float p1y, float p2x, float p2y) +{ + /* + * First, figure out z-coordinates for projection of P1 and P2 to + * deformed sphere + */ + + osg::Vec3 uv = _camera->getUpVector(); + osg::Vec3 sv = _camera->getSideVector(); + osg::Vec3 lv = _camera->getLookVector(); + + osg::Vec3 p1 = sv*p1x+uv*p1y-lv*tb_project_to_sphere(TRACKBALLSIZE,p1x,p1y); + osg::Vec3 p2 = sv*p2x+uv*p2y-lv*tb_project_to_sphere(TRACKBALLSIZE,p2x,p2y); + + /* + * Now, we want the cross product of P1 and P2 + */ + axis = p1^p2; + axis.normalize(); + + /* + * Figure out how much to rotate around that axis. + */ + float t = (p2-p1).length() / (2.0*TRACKBALLSIZE); + + /* + * Avoid problems with out-of-control values... + */ + if (t > 1.0) t = 1.0; + if (t < -1.0) t = -1.0; + angle = asin(t) * 180.0f/M_PI; + +} + +/* + * Project an x,y pair onto a sphere of radius r OR a hyperbolic sheet + * if we are away from the center of the sphere. + */ +float TrackballManipulator::tb_project_to_sphere(float r, float x, float y) +{ + float d, t, z; + + d = sqrt(x*x + y*y); + if (d < r * 0.70710678118654752440) { /* Inside sphere */ + z = sqrt(r*r - d*d); + } else { /* On hyperbola */ + t = r / 1.41421356237309504880; + z = t*t / d; + } + return z; +} diff --git a/src/osgUtil/Version.cpp b/src/osgUtil/Version.cpp new file mode 100644 index 000000000..eec61a493 --- /dev/null +++ b/src/osgUtil/Version.cpp @@ -0,0 +1,12 @@ +#include "osgUtil/Version" + + +const char* osgUtilGetVersion() +{ + return "0.8.34"; +} + +const char* osgUtilGetLibraryName() +{ + return "Open Scene Graph Utility Library"; +}