Commit Graph

10525 Commits

Author SHA1 Message Date
Robert Osfield
6cbce93aa4 From Jean-Sebastien Guay, "I've been working in the last few days
to get QWidgetImage to a point where it can fill a need we have: to be
able to use Qt to make HUDs and to display widgets over / inside an OSG
scene.

---------------
Current results
---------------
I've attached what I have at this point. The modified QWidgetImage +
QGraphicsViewAdapter classes can be rendered fullscreen (i.e. the Qt
QGraphicsView's size follows the size of the OSG window) or on a quad in
the scene as before. It will let events go through to OSG if no widget
is under the mouse when they happen (useful when used as a HUD with
transparent parts - a click-focus scheme could be added later too). It
also supercedes Martin Scheffler's submission because it adds a
getter/setter for the QGraphicsViewAdapter's background color (and the
user can set their widget to be transparent using
widget->setAttribute(Qt::WA_TranslucentBackground) themselves).

The included osgQtBrowser example has been modified to serve as a test
bed for these changes. It has lots more command line arguments than
before, some of which can be removed eventually (once things are
tested). Note that it may be interesting to change its name or split it
into two examples. Though if things go well, the specific QWebViewImage
class can be removed completely and we can consolidate to using
QWidgetImage everywhere, and then a single example to demonstrate it
would make more sense, albeit not named osgQtBrowser... You can try this
path by using the --useWidgetImage --useBrowser command line arguments -
this results in an equivalent setup to QWebViewImage, but using
QWidgetImage, and doesn't work completely yet for some unknown reason,
see below.

----------------
Remaining issues
----------------
There are a few issues left to fix, and for these I request the
community's assistance. They are not blockers for me, and with my
limited Qt experience I don't feel like I'm getting any closer to fixing
them, so if someone else could pitch in and see what they can find, it
would be appreciated. It would be really nice to get them fixed, that
way we'd really have a first-class integration of Qt widgets in an OSG
scene. The issues are noted in the osgQtBrowser.cpp source file, but
here they are too:

-------------------------------------------------------------------
  QWidgetImage still has some issues, some examples are:

  1. Editing in the QTextEdit doesn't work. Also when started with
     --useBrowser, editing in the search field on YouTube doesn't
     work. But that same search field when using QWebViewImage
     works... And editing in the text field in the pop-up getInteger
     dialog works too. All these cases use QGraphicsViewAdapter
     under the hood, so why do some work and others don't?

     a) osgQtBrowser --useWidgetImage [--fullscreen] (optional)
     b) Try to click in the QTextEdit and type, or to select text
        and drag-and-drop it somewhere else in the QTextEdit. These
        don't work.
     c) osgQtBrowser --useWidgetImage --sanityCheck
     d) Try the operations in b), they all work.
     e) osgQtBrowser --useWidgetImage --useBrowser [--fullscreen]
     f) Try to click in the search field and type, it doesn't work.
     g) osgQtBrowser
     h) Try the operation in f), it works.

  2. Operations on floating windows (--numFloatingWindows 1 or more).
     Moving by dragging the titlebar, clicking the close button,
     resizing them, none of these work. I wonder if it's because the
     OS manages those functions (they're functions of the window
     decorations) so we need to do something special for that? But
     in --sanityCheck mode they work.

     a) osgQtBrowser --useWidgetImage --numFloatingWindows 1
                     [--fullscreen]
     b) Try to drag the floating window, click the close button, or
        drag its sides to resize it. None of these work.
     c) osgQtBrowser --useWidgetImage --numFloatingWindows 1
                     --sanityCheck
     d) Try the operations in b), all they work.
     e) osgQtBrowser --useWidgetImage [--fullscreen]
     f) Click the button so that the getInteger() dialog is
        displayed, then try to move that dialog or close it with the
        close button, these don't work.
     g) osgQtBrowser --useWidgetImage --sanityCheck
     h) Try the operation in f), it works.

  3. (Minor) The QGraphicsView's scrollbars don't appear when
     using QWidgetImage or QWebViewImage. QGraphicsView is a
     QAbstractScrollArea and it should display scrollbars as soon as
     the scene is too large to fit the view.

     a) osgQtBrowser --useWidgetImage --fullscreen
     b) Resize the OSG window so it's smaller than the QTextEdit.
        Scrollbars should appear but don't.
     c) osgQtBrowser --useWidgetImage --sanityCheck
     d) Try the operation in b), scrollbars appear. Even if you have
        floating windows (by clicking the button or by adding
        --numFloatingWindows 1) and move them outside the view,
        scrollbars appear too. You can't test that case in OSG for
        now because of problem 2 above, but that's pretty cool.

  4. (Minor) In sanity check mode, the widget added to the
     QGraphicsView is centered. With QGraphicsViewAdapter, it is not.

     a) osgQtBrowser --useWidgetImage [--fullscreen]
     b) The QTextEdit and button are not in the center of the image
        generated by the QGraphicsViewAdapter.
     c) osgQtBrowser --useWidgetImage --sanityCheck
     d) The QTextEdit and button are in the center of the
        QGraphicsView.
-------------------------------------------------------------------

As you can see I've put specific repro steps there too, so it's clear
what I mean by a given problem. The --sanityCheck mode is useful to see
what should happen in a "normal" Qt app that demonstrates the same
situation, so hopefully we can get to a point where it behaves the same
with --sanityCheck and without."
2010-06-15 13:57:44 +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
d9bd6c977e From Michael Platings, "Hi Bob, thanks for the CMake fixes. I'm not sure what the purpose of the capitalisation changes was so I've reverted that (a) to make diff-ing easier and (b) because all-caps is consistent with all the other OSG CMake files. Aside from that the changes seem fine.
I don't understand the changes to ReaderWriterFBX.cpp - (i) strings.h isn't a standard header, (ii) the ISO-conformant form is _strnicmp (with the underscore). Does the existing code not compile for you? If not we'll have to do some #ifdef nastiness."
2010-06-15 09:14:20 +00:00
Michael PLATINGS
0c7a4fdedc Changed _strnicmp to strncasecmp for non-Windows builds 2010-06-15 09:09:38 +00:00
Robert Osfield
d58d417159 From Tan Dunning and Jan Peciva, Jan's email : "I created a new submission, based on Tan's two changes, including further naming functionality that includes:
- geode and geometry naming
- shaders and osg::Program name

as these nodes did not receive names before. Some code cleaning included as well."
2010-06-14 16:41:32 +00:00
Robert Osfield
1f2d381299 From Luc Frauciel, added extra test case accessible via -t 7. 2010-06-14 16:30:43 +00:00
Robert Osfield
6fe084df3b Introduced the use of atan2 in place of asin/acos for reliability and simplicity 2010-06-14 16:27:35 +00:00
Robert Osfield
f5f6821120 From Laurens Voerman, "while debugging a file loader I noticed a missed check here." 2010-06-14 15:58:26 +00:00
Robert Osfield
205edcf297 From Jean-Sebastien Guay, "Currently, if a GraphicsWindowWin32 is created with traits->useCursor = false, it still shows the cursor. An app must call gw->useCursor(false) after having created the context as a workaround, but I think what we ask for in the traits should be honored... Attached is a simple fix for this.
I have no idea when this stopped working. It worked before in our 2.6.0-based apps but after the upgrade to 2.8.3 it doesn't anymore.
"
2010-06-14 15:28:58 +00:00
Robert Osfield
e601bb9cc3 From Wang Rui, "For a long time, the osgviewerMFC example uses addSlave() to setup the
graphics context and link it with a slave camera. I don't know the
reason we perform like that, which will cause a problem that the
GUIEventHandler may not obtain correct window coordinates because the
main camera will use a default input range to receive events from the
slave camera's graphics context. It is also weird to see the
addSlave() used in non-cluster applications, which beginners will be
confused with.

I've make a slightly modification to the osgviewerMFC example to make
it work without setting slave cameras. I've tested with the MDI
framework and everything seems fine."
2010-06-14 15:25:05 +00:00
Robert Osfield
f2f085bc3f From Stephan Huber, "the IncrementalCompileOperation-class throws away compiled compile-sets,
when no compileCompletedCallback is set. Attached you'll find a simple
fix for this bug."
2010-06-14 15:22:35 +00:00
Robert Osfield
d1a3350af0 From Jan Peciva, change information about failed shader compilation/linking/validation to OSG_WARN. 2010-06-14 15:21:50 +00:00
Robert Osfield
da60a3c615 From Jan Peciva, additional comments, and standarisation of throw and handling of mouse wheel. 2010-06-14 15:20:47 +00:00
Robert Osfield
7f7cc83f3f Updated wrappers 2010-06-11 09:39:03 +00:00
Robert Osfield
8828d31c2e Removed debug messages 2010-06-09 15:05:34 +00:00
Robert Osfield
ae88d9467c Fixed reading of wrapped strings that contain multiple " within the string 2010-06-09 13:54:08 +00:00
Cedric Pinson
4354c0180c From Michael Platings, The attached file fixes 2 issues:
1) some time values were passed as floats, reducing accuracy.
2) comparisons done between doubles and floats gave different results so time < endtime evaluated to false the first time it was checked (with doubles), and true the second time it was checked (with time having been converted to a float). This consequently resulted in an array-out-of-bounds crash
2010-06-09 13:09:40 +00:00
Cedric Pinson
50979d2447 From Michael Platings
I attach a simple fix that makes osgAnimation animations loop correctly when their duration is different from the original duration.
2010-06-09 13:08:49 +00:00
Robert Osfield
9262015d11 Added missing loadWrappers 2010-06-09 11:24:22 +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
Michael PLATINGS
5ea4a8c0f3 From Alessandro Terenzi: previously the plugin ignored UV scaling values eventually stored in the FBX file, now they are read and set for each supported texture map (not considering reflection maps).
From Michael Platings: fixed UVs for files that don't explicitly reference the name of a UV channel.
2010-06-09 09:12:20 +00:00
Michael PLATINGS
82ea9597e5 Added support for Euler angles and step/linear/cubic-bezier interpolation. 2010-06-08 17:32:36 +00:00
Robert Osfield
b81b167131 Added ref_ptr<> to avoid memory leak 2010-06-08 11:53:28 +00:00
Robert Osfield
86a0aaf7f3 Added insertion of children found by the CountPagedLODsVisitor into the childrenRemoved list to make sure that they are caught
and then removed correctly from the PagedLODLists.
2010-06-07 17:08:53 +00:00
Michael PLATINGS
4e42d9e89a Added more NURBS types to triangulate. 2010-06-07 15:25:18 +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
Stephan Maximilian HUBER
cf08031080 From Stephan Huber: updated XCode project 2010-06-07 08:36:08 +00:00
Michael PLATINGS
359b6b480d From Alessandro Terenzi: modifications for supporting opacity, reflective and emissive maps beyond the already supported diffuse map in the FBX plugin.
A problem with transparency has also been fixed: objects were transparent wrt themselves but were opaque wrt to other objects.
Finally I added the support for "mixing factors" of diffuse, reflective and opacity textures/values.

From Michael Platings: added "LightmapTextures" plugin option that changes the way textures are interpreted so Alessandro's models appear correctly. Also refactored to put many functions in one class to avoid passing around too many arguments to functions.
2010-06-04 19:50:32 +00:00
Stephan Maximilian HUBER
af3bc7903e From Stephan Huber: updated XCode project 2010-06-04 11:04:15 +00:00
Robert Osfield
768f466365 Fixed double registeration bug. 2010-06-03 16:24:25 +00:00
Robert Osfield
634e55eee3 Fixed permissions 2010-06-03 16:02:01 +00:00
Robert Osfield
bca82dffcd Fixed permissions 2010-06-03 16:01:25 +00:00
Robert Osfield
c3bc3e5394 Removed redundent makefiles 2010-06-03 16:00:28 +00:00
Robert Osfield
980078f534 Fixed permissions 2010-06-03 15:09:06 +00:00
Robert Osfield
3cc90b8fd3 Fixed permissions 2010-06-03 15:07:21 +00:00
Robert Osfield
c32da14d60 Fixed permissions 2010-06-03 15:04:58 +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
363736303e Added #include <QtWebKit/QtWebKit> 2010-06-02 18:09:34 +00:00
Robert Osfield
bac4cfe3d5 Added check for presence of extension. 2010-06-02 15:07:27 +00:00
Robert Osfield
2846f31c50 Removed glFramebufferTexture from list of required extension function 2010-06-02 13:29:42 +00:00
Robert Osfield
da0ddc35e6 Updated wrappers to handle the new ref_ptr<T>::ref_ptr(observer_ptr<T>&> constructor. 2010-06-02 12:14:10 +00:00
Robert Osfield
7f7f1f7d0e Changed types from unsigned int to int's to address warnings, and changed the extension requirements so the GLES2 builds with FBO's where supported 2010-06-01 18:20:38 +00:00
Robert Osfield
32e8f6adc3 From Michael Platings, "MorphGeometry fix: this fixes a crash found by Alessandro Terenzi" 2010-06-01 15:20:30 +00:00
Robert Osfield
656a1b6da5 From Frederic Bouvier, "here is my proposal. It is supposed to be used like this :
osg::Camera* c = createCamera();
   c->attach( osg::Camera::COLOR_BUFFER0, texture3d, 0,
osg::Camera::FACE_CONTROLLED_BY_GEOMETRY_SHADER );

it works also for cubemap textures and 2d texture arrays
"
2010-06-01 14:12:03 +00:00
Robert Osfield
4a047f2a82 From Michael Platings, introduced osg::State::applyModelViewMaitrx(const osg::Matrix& matrix) method and associated osg::State::_modelViewCache to enable osgText::Text3D to be refactored in away that avoids creating/destroying matrices 2010-06-01 13:33:58 +00:00
Robert Osfield
0cb839280f Added newline to fix warnings 2010-06-01 13:32:12 +00:00
Robert Osfield
c05330089d From Mathias Froehlich, "While tracking some valgrind problems in flightgear, I found a remaining off by
one error in the rgb loader.

Previously we limited the current line to the image with + 1. With that change
it is correctly limited to the width of the image.
Also flightgear seems to run nice with that change.
"
2010-06-01 11:51:37 +00:00
Robert Osfield
054d5606fb From Tim Moore, "This is a patch that allows a ref_ptr to be constructed using an observer_ptr argument, which is locked. This is shorthand for declaring the ref_ptr and then passing it to observer_ptr::lock().
"
2010-06-01 11:28:04 +00:00
Robert Osfield
0c6739b6dc Removed unneccessary QWebKit includes 2010-06-01 11:23:04 +00:00