Commit Graph

361 Commits

Author SHA1 Message Date
Robert Osfield
cc471b1103 From Magnus Kessler, "Attached are a number of files where I have tried to fix up some of the
documentation. I have accumulated them over some time, but rebased onto the
subversion trunk."
2010-09-15 12:00:12 +00:00
Robert Osfield
687fd9362f From Jean-Sebastien Guay, "osgWidget::WindowManager did nothing in its keyUp event, and in particular didn't call any callbacks. Since I wanted to have callbacks on keyUp, I copied what it does on keyDown, which works for me. I could have just used keyDown and saved myself the trouble, but you know me... :-)
osgWidget::Input:

[Functional changes]
- Previously, the field would be filled with spaces up to its max length, and typing would just replace the spaces. Also, there was a _textLength variable that kept track of the real length of text in the field, since the osgText::Text's length just reflected the length of spaces+text entered. This was not great, as you could still select the spaces with the mouse and it just feels hacky. So I changed it to only contain the text entered, no spaces, and _textLength was removed since it's now redundant (the osgText::Text's length is used instead).
- Fixed the selection size which (visually only) showed one more character selected than what was really selected.
- Fixed selection by dragging the mouse, it would sometimes not select the last character of the string.
- Cursor will now accurately reflect whether insert mode is activated (block cursor) or we're in normal mode (line cursor) like in most editors.
- Implemented Ctrl-X (cut)
- Added a new clear() method that allows the field to be emptied correctly. Useful for a command line interface, for example (hint, hint).
- Mouse and keyboard event handler methods would always return false, which meant selecting with the mouse would also rotate the trackball, and typing an 's' would turn on stats.

[Code cleanup]
- Renamed the (local) _selectionMin and _selectionMax variables which are used in a lot of places, as the underscores would lead to think they were members. Either I called them selection{Min|Max} or delete{Min|Max} where it made more sense.
- Fixed some indenting which was at 3 spaces (inconsistently), I'm sure I didn't catch all the lines where this was the case though.
- Put spaces between variable, operator and value where missing, especially in for()s. Again I only did this where I made changes, there are probably others left.

The result is that delete, backspace, Ctrl-X, Ctrl-C, Ctrl-V, and typing behaviour should now be consistent with text editor conventions, whether insert mode is enabled or not. I hope. :-)

Note, there's a nasty const_cast in there. Why isn't osgText::Font::getGlyph() declared const?

Also, as a note, the current implementation of cut, copy and paste (in addition to being Windows only, yuck) gets and puts the data into an std::string, thus if the osgText::String in the field contains unicode characters I think it won't work correctly. Perhaps someone could implement a proper clipboard class that would be cross-platform and support osgText::String (more precisely other languages like Chinese) correctly? Cut, copy and paste are not critical to what I'm doing so I won't invest the time to do that, but I just thought I'd mention it.
"
2010-09-09 16:49:10 +00:00
Robert Osfield
b1aedf30e0 Aded option for doing a glFlush() after compiling texture objects, with a dedicated compile thread default to issuing the glFlush. 2010-08-09 16:19:50 +00:00
Robert Osfield
d3527f3830 Added timing code for helping detect deadlocks in the paging threads 2010-06-16 08:13:00 +00:00
Robert Osfield
0c84f2deff From Cedric Pinson, "Here a fix about a leak in InputStream::decompress
I changed
       _in->setStream( new std::stringstream(data) );
to
       _dataDecompress = new std::stringstream(data);
       _in->setStream( _dataDecompress );

Then when the destructor is of InputStream is called I delete the
dataDecompress stringstream.
"
2010-06-15 10:02:34 +00:00
Robert Osfield
d555e727ef From Wang Rui, "Henry and Brendan just found a small bug of the ListSerializer which
will cause the writing of osg::Switch incorrectly. The original thread
was posted on osg-users. I would like to follow the suggestion of
Brendan and add a std::endl before the END_BRACKET in
ListSerializer::write().
"
2010-06-09 10:01:25 +00:00
Robert Osfield
1d401f2333 Added size() and swap() methods to provide a thread safe way to keep track of size of a RequestQueue/ReadQueue. 2010-06-07 11:28:25 +00:00
Robert Osfield
bcebc9a23f Added removeNodes method to prune any nodes that are going to be deleted from the PagedLODLists. 2010-06-07 09:05:58 +00:00
Robert Osfield
768f466365 Fixed double registeration bug. 2010-06-03 16:24:25 +00:00
Robert Osfield
2ea6aa050e Refactored the PagedLODList implementation so that it's now done via a base class that enables different implementations to be easily tried. Initial concrete PagedLODList is the SetBasedPagedLODList. 2010-06-03 14:14:40 +00:00
Robert Osfield
554adfc8e6 Refactored Observer/ObserverNodePath and DatabasePager to improve their robustness. 2010-05-14 12:24:13 +00:00
Robert Osfield
42527fe859 From Wang Rui, "I'd like to submit my inbuilt schema data support of
the OutputStream/InputStream implementations, which was just finished
last weekend with a few tests on Windows and Ubuntu. Hope it could
work and get more feedbacks soon.

I've added a new option "SchemaData" to the osg2 plugin. Developers
may test the new feature with the command line:

# osgconv cow.osg cow.osgb -O SchemaData

It will record all serializer properties used in the scene graph, at
the beginning of the generated file. And when osgviewer and user
applications is going to read the osgb file, the inbuilt data will be
automatically read and applied first, to keep backwards compatibility
partly. This will not affect osgb files generated with older versions.
"
2010-05-12 20:02:31 +00:00
Robert Osfield
400aa8ebcd Added proper support for writing out Xml graph 2010-04-30 19:41:56 +00:00
Robert Osfield
a8c4fd8761 From Wang Rui, "The new osgShadow and osgFX serializers are attached, and some
modifications of the osgShadow header naming styles as well. The
osgDB::Serializer header is also changed to add new Vec2 serializer
macros because of the needs of osgShadow classes. It should compile
fine on both Windows and Linux. But I have only done a few tests to
generate .osgb, .osgt and .osgx formats with these new wrappers."
2010-04-20 10:29:04 +00:00
Robert Osfield
a8332528f4 From Martins Innus,"Here's a fix to allow the serializer to compile on the Mac 10.4 SDK. The definition of GLint seems to be different accross the SDKs. Its defined as "long" in 10.4. I have no idea if this is the correct way to go about this, but it compiles on my end." 2010-04-19 12:09:21 +00:00
Robert Osfield
488eac94f7 From Wang Rui, "Attached is the osgAnimation wrappers for serialize IO operations. A
few headers and the osgAnimation sources are also modified to make
everything goes well, including:

A new REGISTER_OBJECT_WRAPPER2 macro to wrap classes like
Skeleton::UpdateSkeleton.
A bug fix in the Seralizer header which avoids setting default values
to objects.
Naming style fixes in osgAnimation headers and sources, also in the
deprecated dotosg wrappers.
A bug fix for the XML support, to write char values correctly.
A small change in the osg::Geometry wrapper to ignore the
InternalGeometry property, which is used by the MorphGeometry and
should not be set by user applications.

The avatar.osg, nathan.osg and robot.osg data files all work fine with
serializers, with some 'unsupported wrapper' warnings when converting.
I'm thinking of removing these warnings by disabling related property
serializers (ComputeBoundingBoxCallback and Drawable::UpdateCallback),
which are seldom recorded by users.

By the way, I still wonder how would we handle the C4121 problem,
discussed some days before. The /Zp compile option is set to 16 in the
attached cmake script file. And is there a better solution now?"
2010-04-19 10:35:18 +00:00
Robert Osfield
88f1b8f19a From Michael Platings with tweaks from Robert Osfield, added Options::s/getPrecisionHint(..) to allow apps to hint to plugins about how to handle double precision geometry data. 2010-04-13 13:06:27 +00:00
Robert Osfield
51924431cd Fixed warnings 2010-04-13 09:42:53 +00:00
Robert Osfield
1319e270f6 Refactored the way that the RequestQueue's are pruned and highest prioty items taken from them so the operation is
now O(n) rather than O(nlogn) where n is the number of requests.  The refactoring also cleans up the access of the
request lists so that the code is more readable/maintainable.
2010-03-24 14:27:00 +00:00
Robert Osfield
d5aea9c0f2 Updated various serialization support for .osg, .osgt/b/x and .ive. 2010-03-16 18:44:27 +00:00
Robert Osfield
950d282f55 From Vincent Bourdier, addition of out of memory read result. 2010-03-10 14:28:18 +00:00
Robert Osfield
e082b01f26 From Wang Rui, "I've initially added the XML support of the new native osg format,
using osgDB::XmlParser. The extension for XML-formatted scenes is
.osgx, corresponding to .osgb for binary and .osgt for ascii. It could
either be rendered in osgviewer or edited by common web browsers and
xml editors because of a range of changes to fit the XML syntax. For
example, the recorded class names are slight modified, from
'osg::Geode' to 'osg--Geode'.

To quickly get an XML file:
# ./osgconv cow.osg cow.osgx

The StreamOperator header, InputStreram and OutputStream classes are
modified to be more portable for triple ascii/binary/XML formats. I
also fixed a bug in readImage()/writeImage() to share image objects if
needed.

The ReaderWriterOSG2 class now supports all three formats and
reading/writing scene objects (not nodes or images), thanks to
Torben's advice before.
"
2010-03-10 13:48:41 +00:00
Robert Osfield
6ae2f4c6c6 From Sukender, "Here is my proposal. I fixed what Paul said, added some doxygen comments, added the function I told about, and removed the two "find('/')"-like calls to use only one." 2010-03-10 11:40:17 +00:00
Robert Osfield
9f8a4be2cd Refactored DatabasePager so that it nolonger takes ref_ptr<PagedLOD>, but instead uses a custom version of observer_ptr<>.
This change should make it possible to delete PagedLOD's independantly from the DatabasePager, and also prevent issues of
consistency of the pager when subgraphs when are cached elsewhere in the application such as in the Registry filecache.
2010-03-03 16:40:19 +00:00
Robert Osfield
56c54958a3 Added spaces between < > template parts of macros to prevent compile problems when templates as use as macro parameters 2010-02-26 15:54:37 +00:00
Robert Osfield
605ad76691 From Wang Rui, "Attached is the osgTerrain wrappers, based on the latest SVN version
of OSG. I modified the osgDB::InputStream and OutputStream and the
PagedLOD wrapper as well. Now all seems to work fine with paged
scenes. I've tested with the puget terrain data and the osgdem
application from VPB:
# osgdem --xx 10 --yy 10 -t ps_texture_4k.tif --xx 10 --yy 10 -d
ps_height_4k.tif -l 8 -v 0.1 -o puget.osgb

As the ive plugin does, The PagedLOD wrapper now automatically add the
latest file path to PagedLODs' databasePath member, to help them find
correct child positions. I also changed the image storage strategy of
the OutputStream class, to store them inline by default. The osgt
extension should also work, in case the image files are also written
to the disk.
"
2010-02-25 17:53:51 +00:00
Robert Osfield
590bf9070d From Michael Platings, "There is a function, convertStringFromCurrentCodePageToUTF8() that would be useful outside the FBX plugin so it belongs in osgDB. I've attached ConvertUTF and ConvertUTF.cpp with the function added for you to commit at your convenience.
"
2010-02-25 17:07:34 +00:00
Robert Osfield
dc728aa184 Removed no longer defined methods and updated wrappers 2010-02-19 14:05:49 +00:00
Robert Osfield
bff9b565df Completed usage of ObserverNodePath to fix longstanding crash that occurred when nodes in parental chain of a newly loaded node had been deleted. 2010-02-18 21:21:59 +00:00
Robert Osfield
9404abfef5 Added className() implementation to help wiht debugging. 2010-02-16 17:38:49 +00:00
Robert Osfield
5b1ca779e4 Added OutputStream::writeSize and InputStream::readSize methods to help out with ensure that 32bit and 64bit builds all
use the same 32bit type for sizes.
2010-02-10 17:03:09 +00:00
Robert Osfield
f3ee7fa6ba Fixed automatic loading of plugins 2010-02-10 16:23:27 +00:00
Robert Osfield
6ab51c7c47 Added pruning of requests that haven't been reissued since the last frame. 2010-02-10 11:21:45 +00:00
Robert Osfield
7103707815 From Wang Rui, "I also did a small fix to the ObjectWrapper header, to add a
OSGDB_EXPORT macro to RegisterCompressorProxy, and modified the
findCompressor() method to look for custom compressors in libraries
such like osgdb_compressor_name.so, which was described in the wiki
page chapter 2.4."
2010-02-04 10:20:17 +00:00
Robert Osfield
380fb17fa9 Build fixes for build without ref_ptr<> automatic type conversion 2010-01-31 18:24:01 +00:00
Robert Osfield
2af633352b Fom Sukender, "Added copyFile() and comments in FileUtils."
From Robert Osfield, build fix for linux/gcc and reformating to keep coding style consistent with rest of OSG
2010-01-28 10:45:40 +00:00
Robert Osfield
0a9263d50e From Wang Rui, "Changes:
1. Rewrite the reading/writing exception handlers to work like the ive
plugin exceptions.
2. Write a header writing/checking function in ReaderWriterOSG2.cpp,
which may help decide if the stream is ascii or binary. The
readInputIterator() function will return null pointer if the input
file is nither osgb nor osgt format, which indicates that the old .osg
format could be used here, in case we've merged the two plugins
together.
3. Add a new ForceReadingImage option in the InputStream, which will
allocate an empty image object with the filename if specifed external
image file is missed. It may be useful for format converting in some
cases.
4. Add new osgParticle wrappers, as well as some modification to the
osgParticle headers, for instance, change isEnabled() to getEnabled().
5. Some fixes to the osg serialization wrappers."
2010-01-27 17:09:05 +00:00
Robert Osfield
6a30b04dd9 From Tony Horrobin, "This fix just makes a couple of calls to ref_ptr<>::get() to satisfy the compiler.
The changes make the build successful under Windows 7/VC2005 and Ubuntu 9.10 with OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION set to OFF.
"
2010-01-26 16:30:48 +00:00
Robert Osfield
5f223bec89 Changed doxygen comments to signal deprecation of this old IO classes 2010-01-26 10:37:38 +00:00
Robert Osfield
d90523e904 Removed inapprorpiate OSGDB_EXPORT 2010-01-25 18:08:15 +00:00
Robert Osfield
27c99ff0c8 Refactored the DotOsgWrapper support in osgDB::Registry so it's now provided by the osgDB::DeprecatedDotOsgWrapperManager. 2010-01-25 17:07:25 +00:00
Robert Osfield
65127f5b34 Moved the declaration of osgDB::Field, FieldReader and FieldReaderIterator into include/osg/Input to centralise all the deprecated .osg parsing code into one place. 2010-01-25 15:24:47 +00:00
Robert Osfield
e17ba0a68f Added back in StreamOperation with executation bit disabled 2010-01-25 11:40:18 +00:00
Robert Osfield
9214241fba Temporily removed StreamOperation as it had execution bit enable for it. 2010-01-25 11:39:42 +00:00
Robert Osfield
a520e8b6bd From Wang Rui, refactored the InputStream/OutputStream operations so that the binar/ascii foramts are implemented via subclasses. 2010-01-25 11:03:21 +00:00
Robert Osfield
f8fc4f66a8 Added RequestQueue destructor and DatabaseRequest::invalidate() and valid() methods to allow the
destruction of RequestQueue to remove any pointers held in DatabaseRequest attached to the scene graph, and to
prevent their subsequent use in cases where the scene graph is attached to a new DatabasePager.
2010-01-22 20:47:39 +00:00
Robert Osfield
7ab759c97f Renamed ObjectRegistry to ObjectWrapperManager, and replaced it's instance() method usage with assigning a ObjectWrapperManager
to the osgDB::Registry.  Added a osgDB::Registry::getObjectWrapperManager() for access of this object wrapper manager.  This
change centralises the singleton management in osgDB.

Merged the osgDB::GlobalLookUpTable functionality into ObjectWrapperManger to keep down the number of singletons in use.
2010-01-22 15:16:22 +00:00
Robert Osfield
8839736818 Added extra export for windows build 2010-01-21 16:26:48 +00:00
Robert Osfield
f1bd2eaf04 From Wang Rui, added exports for windows build 2010-01-21 09:25:45 +00:00
Robert Osfield
219696f1ee From Wang Rui, new native binary/ascii format infrastructure and wrappers.
From Robert Osfield, refactor of Wang Rui's original osg2 into 3 parts - parts placed into osgDB, the ReaderWriter placed into src/osg/Plugin/osg and wrappers into src/osgWrappers/serializers/osg
2010-01-20 20:13:33 +00:00