Commit Graph

69 Commits

Author SHA1 Message Date
Robert Osfield
1290f1584a Removed old Text::GlyphQuads array code paths 2017-02-28 17:02:02 +00:00
Robert Osfield
138af70bd8 Merged the Text::GlyphQuads cooordinate arrays 2017-02-28 16:34:33 +00:00
Robert Osfield
04d23659b3 Added the option for changing the type of the GlyphQuads::Coords 2017-02-22 12:07:43 +00:00
Robert Osfield
f197dd22cd Fixed possible divide by zero 2016-06-23 08:23:32 +01:00
Robert Osfield
12a81b656b Removed dead code 2016-06-23 08:20:27 +01:00
Robert Osfield
721e079211 Rewrote Window::setNextFocusable() to address a bug in the management of the search iterator. Covertiy reported bug "Undefined behavior may result; the program may crash or subtly misbehave.
In osgWidget::​Window::​setNextFocusable(): An invalid or past-the-end iterator is being used."
2016-06-09 12:08:47 +01:00
Robert Osfield
b19c879485 Fixed unused parameter warning. 2016-06-08 09:04:01 +01:00
Robert Osfield
dd996a3289 Introduced CMake option OSG_PROVIDE_READFILE option that defaults to ON, but when switched to OFF disables the building of the osgDB::read*File() methods,
forcing users to use osgDB::readRef*File() methods.  The later is preferable as it closes a potential threading bug when using paging databases in conjunction
with the osgDB::Registry Object Cache.  This threading bug occurs when one thread gets an object from the Cache via an osgDB::read*File() call where only
a pointer to the object is passed back, so taking a reference to the object is delayed till it gets reassigned to a ref_ptr<>, but at the same time another
thread calls a flush of the Object Cache deleting this object as it's referenceCount is now zero.  Using osgDB::readREf*File() makes sure the a ref_ptr<> is
passed back and the referenceCount never goes to zero.

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

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

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

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



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15164 16af8721-9629-0410-8352-f15c8da7e697
2015-10-22 13:42:19 +00:00
Robert Osfield
ba9dfb2ff6 From Albert Luaces, typo fixes.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14883 16af8721-9629-0410-8352-f15c8da7e697
2015-06-01 13:40:20 +00:00
Robert Osfield
47db2da8b4 From Andreas Henne, Support for GL3 core profile in osgText
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14717 16af8721-9629-0410-8352-f15c8da7e697
2015-02-25 18:56:29 +00:00
Robert Osfield
74f91037a7 Further work on Bound class/Node::getBound() and Drawable::getBound() and usage in OSG codebase 2014-05-14 16:01:40 +00:00
Robert Osfield
a64b412885 Reverted the usage of OSG_UNUSED and OT_UNUSED as in hindsight these should never have been merged. Adding code to quieten
inappropriate warnings is a bad programming practice and does not desrve a place in the OSG code base.
2013-07-01 08:21:13 +00:00
Robert Osfield
097aedf23c From David Callu, warning fixes and removal of spaces at end of lines. 2013-06-28 12:00:43 +00:00
Robert Osfield
8e65ab7e45 Replaced deprecated Geometry::set*Binding() usage 2013-06-26 18:06:09 +00:00
Robert Osfield
71874c2dc5 Added assigned of the InteractiveImageHandler as a cull callback to enable the interactive image to know when it's being actively used as part of rendering a frame. 2013-05-23 10:25:03 +00:00
Robert Osfield
668d351765 Introduced new scheme for handling mouse events with osgViewer. The new scheme enables robust event handling even when using distortion correction render to texture Cameras. 2013-05-03 19:26:27 +00:00
Robert Osfield
14a563dc9f Ran script to remove trailing spaces and tabs 2012-03-21 17:36:20 +00:00
Robert Osfield
4f5152152d Fixed Coverity reported issues.
WindowManager.cpp
CID 11841: Uninitialized pointer field (UNINIT_CTOR)
Non-static class member _lastEvent is not initialized in this constructor nor in any functions that it calls.
Non-static class member _lastPush is not initialized in this constructor nor in any functions that it calls.
Non-static class member _view is not initialized in this constructor nor in any functions that it calls.

Frame.cpp
CID 11840: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member _flags is not initialized in this constructor nor in any functions that it calls.

Window.cpp
CID 11839: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member _index is not initialized in this constructor nor in any functions that it calls.
2011-05-06 10:29:47 +00:00
Robert Osfield
f0baf6abba Removed unncessary references to FREETYPE 2011-05-04 09:53:11 +00:00
Robert Osfield
8c7068fdb6 From Piotr Gwiazdowski, "Recently I've been having some trouble with osgWidget::StyleManager
(I'll omit osgWidget namespace from now on). It seems to me that there
are some inconsistency in the code. In Style there are multiple
applyStyle method overloads, applying style for different
widgets/windows built-in in osgWidget. Plus you can do overrides. It's
good so far.

The problem lies in StyleManager::_applyStyleToObject (which calls
_coearceAndApply, which calls _applySpecificStyle, which calls
Style::applyStyle). With current implementation Style::applyStyle
variants for Input, Window, Frame::Corner, Frame::Border,
Window::EmbeddedWindow are never called, because their classes' names
are omitted in methods' if/else if block, making it impossible to use
styles with most than half of built-in widget/window types.

My fix simply adds couple else if blocks, making each
Style::applyStyle variant callable. By the way, I think that next
update should add Style::applyStyle overload for Table class and add
proper className overloads for Input and Window."
2011-03-09 12:29:14 +00:00
Robert Osfield
42b709a9f4 From Rafa Gaitan, "I have added the macro SETUP_LIBRARY, similar to SETUP_PLUGIN or
SETUP_EXE, in order to have a unique entry point to build the
libraries. With this changes the android integration will be less
painful (currently is a big IF(ANDROID) for each CMakeLists.txt) and
more maintainable in the future. I hope next submissions will be for
supporting android from my colleague Jorge.
"
2011-03-08 13:51:13 +00:00
Robert Osfield
2a18c8b02a From Eric Buehler, "I believe that the osgWidget::Window::HA_CENTER alignment should be center aligned rather than by the origin, as the osgWidget::Window::VA_TOP causes.
The current setAnchorHorizontal() command doesn't center the center of the object, it just center's the object's origin.  The following change to osgWidget::Window::update() will correct that behavior so that it is consistent with setAnchorVertical() behavior.
"
2011-01-27 17:14:28 +00:00
Robert Osfield
25ef1a9e58 Added iterator include 2010-12-24 19:47:31 +00:00
Robert Osfield
65aee287e7 From Mathias Froehlich, "Attached are most of the fixes that are required to build osg on solaris and
hpux. I have skipped irix this time as irix is too dead to keep osg building
there.

As usual, solaris does not like member templates in stl containers.
Some headers missing and link problems due to missing libraries."
2010-12-02 14:13:54 +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
8c3e3055e7 Refactored osgText::Font so that it now supports both 2D and 3D glyphs.
Added TextNode.h and TextNode.cpp to examples/osgtext3D in prep for introducing the new node to osgText library
2010-09-03 08:26:46 +00:00
Robert Osfield
3a4a0457cd Converted osg::notify to OSG_INFO 2010-05-28 16:07:34 +00:00
Robert Osfield
d746f11650 Renamed osgGA::MatrixManipualtor to osgGA::CameraManipulator so its name better reflects it's function 2010-05-27 15:54:37 +00:00
Robert Osfield
7db099a9d1 Fixed warning 2010-03-05 16:07:12 +00:00
Robert Osfield
c16d55fa9b From Trajce Nicklov, fixes to warnings 2010-02-22 09:50:37 +00:00
Robert Osfield
ff5d1fc195 From Trajce Nikolov, bug fixes 2010-01-29 14:55:52 +00:00
Robert Osfield
00c17c6cff From Trajce Nikolov, improvements to osgWidget::Input including selection support 2010-01-27 16:31:34 +00:00
Robert Osfield
bad5a4d43a From Trajce Nikolov, various improvements of the workings of osgWidget::Input. 2010-01-26 16:59:17 +00:00
Robert Osfield
28723e6fef From Jean-Sebastien Guay, "was testing an osgWidget-based test app I have and noticed that I couldn't move the windows/frames around on the screen anymore. Turns out that the virtual methods' interface changed in the EventInterface base class, the third argument to mouseDrag() is now const, but it was not changed in the derived classes, so it still compiled but the derived-class version was not being called because its arguments differed.
Here are the changes that fix it.
"
2010-01-08 11:40:43 +00:00
Robert Osfield
370deba546 <iterator>, <stdlib.h> and <ctype.h> includes required for QNX compiler 2009-11-17 14:06:07 +00:00
Robert Osfield
3fce07e5e5 From Cesar L.B. Silveira, "I have written these few lines of code which allow setting the label
of an osgWidget::Label with an osgText::String. I had to do this on a
project I'm working on, because I needed UTF-8 strings on my labels,
and using setLabel with std::string was not working.
"
2009-10-10 11:06:30 +00:00
Robert Osfield
0aed782a47 From Jean-Sebastien Guay, "osgWidget::Window::setWindow() calls parented() (which does an addChild()) on the new window, but it does not call unparented() (which does a removeChild()) on the old window before. So it works fine if there was no window previously, but if an app creates new windows and calls setWindow() to replace the previous one, they will all add up instead and be on top of each other...
This is fixed in the file attached."
2009-10-10 09:26:06 +00:00
Robert Osfield
9d04b4d566 From Stephan Lamoliatte, "The vertical anchor is inverted in the osgWidget::Window::update function.
Here is a small patch to fix that."
2009-07-16 12:04:35 +00:00
Robert Osfield
bdaead21bf From Fajran Iman Rusadi, fixed error in window index management when children add insert or removed. 2009-05-12 10:45:44 +00:00
Robert Osfield
39cecd2a72 From Philip Lowman, "Here's the promised cleanup of the OSG's CMakeLists.txt files for the src/ folder. I'll submit the others separately.
Also, there was also a small bug in osgDB's CMakeLists.txt that was causing an error when I tested with CMake 2.4.4.

IF(${OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX} STREQUAL "quicktime")
was changed to
IF(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX STREQUAL "quicktime")
"
2009-03-23 16:01:02 +00:00
Robert Osfield
a0a06c8b2a Completed support for automatic detection of plugin features.
Cleaned up debug out of various plugins to ensure a clean osgconv --formats.
2009-03-10 17:27:39 +00:00
Robert Osfield
f3166c2d96 From Sherman Wilcox, added VS versioning information into libs 2009-02-05 14:55:17 +00:00
Robert Osfield
b51adc6f24 Fixed warning 2009-02-03 11:07:13 +00:00
Robert Osfield
f9855c35ec Removed comments. 2009-01-28 16:44:46 +00:00
Robert Osfield
d85759c61c Fixed of warnings 2009-01-28 12:45:05 +00:00
Robert Osfield
f0a044ee77 From Mathias Froehlich, "I have today built svn trunk on HP-UX and Solaris8.
I had to do two small changes to src/osgWidget/Input.cpp and
src/osgAnimation/Animation.cpp mainly because of name lookup problems.
"
2009-01-28 11:59:06 +00:00
Robert Osfield
fa499dc55f From Andy Skinner, fixes for Solaris build 2009-01-09 12:17:40 +00:00
Robert Osfield
ec457e34c3 From Sergey Leontyev, "Some minor(but important) bug fixes for osgWidget:
1. In WindowManager.cpp childRemoved method the second parameter "end" is misleading and

should be named "numChildren" instead. It represents how many children to remove.  As a result, the method was implemented incorrectly and failed to remove UI objects. So I fixed it.

 

replaced this:

 

void WindowManager::childRemoved(unsigned int start, unsigned int end) {
    while(start < end) {
        Window* window = getByIndex(start);

        if(!window) continue;

        if(_remove(window)) {
            window->_index = -1;

            window->unmanaged(this);
        }

        start++;
    }
}

 

with this:

void WindowManager::childRemoved(unsigned int start, unsigned int numChildren) {
 for (unsigned int i = start; i < start+numChildren; i++)
 {
  Window* window = getByIndex(i);

  if(!window) continue;

  if(_remove(window)) {
   window->_index = -1;

   window->unmanaged(this);
  }
 }
}

 

2. in Input.cpp

 

The cursor in Input did not get positioned correctly, probably as a left over from the TOP LEFT origin system which is now BOTTOM LEFT.

in method positioned()

replaced this:

    _cursor->setOrigin(x + xoffset + 1.0f, y - _cursor->getHeight() + 1.0f);

 

with this:

    _cursor->setOrigin(x + xoffset + 1.0f, y + 1.0f);

 

Now it is placed correctly.

 "
2009-01-06 16:16:03 +00:00
Robert Osfield
c85437e967 Fixed warnings 2008-12-17 15:32:35 +00:00
Robert Osfield
9a554f7eec Fixed cull callback usage to ensure that the lazy updating of the browser image functions automatically. 2008-12-09 14:07:59 +00:00