Commit Graph

10691 Commits

Author SHA1 Message Date
Robert Osfield
fdfad4848b Added include<osg/Geode> to fix compile error 2010-09-26 11:02:03 +00:00
Robert Osfield
f6517d2f8b From Alexander Wiebel, "I did some spell checking in my spare time. Here come 20 files." 2010-09-24 14:53:10 +00:00
Robert Osfield
73a4e775c0 From Jean-Sebastien Guay, "Changeset 10833 renames discardAllDeletedGLObjects() to discardAllGLObjects() in src/osg/GLObjects.cpp, but the declaration of the function in include/osg/GLObjects remained. So an app using an old version of OSG that called this function would now fail with a linker error instead of a compile error as it should.
Removed the declaration. Also fixed a small typo in the following doxygen comment."
2010-09-24 14:40:56 +00:00
Robert Osfield
eb3d76f291 From Mikhail Izmestev, "This patch fixes operator >> used with std::istream without std::ios::skipws flag. This allow using boost::lexical_cast with osg vectors types, because boost's lexical_cast disable std::ios::skipws flag of std::istream before using operator >>.
"
2010-09-24 14:38:01 +00:00
Robert Osfield
1224836664 From Eric Wing, QTKit plugin for reading movies under OSX using QTKit + CoreVideo 2010-09-24 12:59:37 +00:00
Robert Osfield
c006c75615 Moved Style and Bevel classes out into their own include/osgText/Style header.
Introduced GlyphGeometry class for handling the geometry data for rendering 3D text
2010-09-24 12:57:55 +00:00
Robert Osfield
d9a133476a Refactored the handling of readImage/writeImage/readObject/writeObject to avoid double setting of unique ID's, fixing the problem in reading/writing files with images 2010-09-23 16:12:05 +00:00
Robert Osfield
915b38dc25 Added deprecated notices. 2010-09-22 09:50:07 +00:00
Robert Osfield
51391fc827 Updated ChangeLog and AUTHORS file for release 2010-09-21 11:40:50 +00:00
Robert Osfield
0d347352cf From David Guthrie, "The cocoa version of the window for Mac OS X doesn't implement the requestWarpPointer function, but it turns out that the code from the Carbon version of the window is the same because it uses the windowing interface, so it this version, based on 2.8.3 GraphicsWindowCocoa, I copied the function over. The trunk version it also missing the function and the code looks to be very similar, so I assume it will transfer simply enough.
"
2010-09-21 10:28:50 +00:00
Robert Osfield
7e8ca5ccdf From Per Fahlberg, "imageio was not spelled correctly when registering the plugin, attached is a fixed version of ReaderWriterImageIO.cpp." 2010-09-20 16:04:22 +00:00
Robert Osfield
5ecc2b9880 From Wang Rui, reverted changes to osgPartcile that caused problems with osgparticleeffects. 2010-09-20 11:50:24 +00:00
Robert Osfield
a8c8c70fb1 From Ulrich Hertlein, "attached is a fix that addresses these compiler warnings from the 64-bit OS X build:
/Users/uli/Projects/osg/OpenSceneGraph/src/osgPlugins/3ds/WriterNodeVisitor.cpp: In
function ?std::string getFileName(const std::string&)?:
/Users/uli/Projects/osg/OpenSceneGraph/src/osgPlugins/3ds/WriterNodeVisitor.cpp:88:
warning: comparison is always false due to limited range of data type

/Users/uli/Projects/osg/OpenSceneGraph/src/osgPlugins/3ds/WriterNodeVisitor.cpp: In
function ?bool is83(const std::string&)?:
/Users/uli/Projects/osg/OpenSceneGraph/src/osgPlugins/3ds/WriterNodeVisitor.cpp:102:
warning: comparison is always false due to limited range of data type

/Users/uli/Projects/osg/OpenSceneGraph/src/osgPlugins/3ds/WriterNodeVisitor.cpp: In
function ?bool is3DSpath(const std::string&, bool)?:
/Users/uli/Projects/osg/OpenSceneGraph/src/osgPlugins/3ds/WriterNodeVisitor.cpp:118:
warning: comparison is always false due to limited range of data type
/Users/uli/Projects/osg/OpenSceneGraph/src/osgPlugins/3ds/WriterNodeVisitor.cpp:121:
warning: comparison is always true due to limited range of data type

The code was using 'unsigned int' in places where it should've used 'size_t' for correct
comparison with 'std::string::npos' (which is size_t).
"
2010-09-20 11:02:40 +00:00
Robert Osfield
c7fc64c2e8 From Mathieu Marache, "This modified version of FindCOLLADA finds it correctly when installed with macports
as in 'port install collada-dom'"
2010-09-17 15:41:55 +00:00
Robert Osfield
fc82c9cde8 Add clamping of the maximum number of particles per frame to avoid too many particles being introduced at once when the particle system comes back on screen. 2010-09-17 15:39:53 +00:00
Robert Osfield
4d31f983f3 Updated ChangeLog, AUTHORS for 2.9.9 dev release 2010-09-17 14:26:27 +00:00
Robert Osfield
4daad70d17 Build fixes for when OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION is disabled 2010-09-17 13:33:09 +00:00
Robert Osfield
b0db0382f5 Reverted changes from Vivien Delage as there were some regressions discovered. Will need to revist this code to deal with bugs that Vivien was tackling. 2010-09-17 13:09:23 +00:00
Robert Osfield
7cc2d90725 From Ulrich Hertlein, "I've added a command line switch '--testOcclusion' that enables display of other models in
front and behind the outlined object."
2010-09-17 11:20:11 +00:00
Robert Osfield
d74ffd57aa From Magnus Kessler, "Changes to the quicktime plugin to remove unused variables and an unused
static function."
2010-09-16 13:04:55 +00:00
Robert Osfield
93ad63405f From Alexander Wiebel, "I came across some functions in Vec* that I thought could benefit from some
doxygen documentation. Additionally, I made the comment on value_type more
meaningful (in my opinion)."
2010-09-16 10:33:51 +00:00
Robert Osfield
c6a1b7e97f From Magnus Kessler, "I'm resubmitting a slightly different version of the changes you left out for
osg/Camera. The ::glName issue masked the fact that the "(..)" isn't handled
well in doxygen and leads to "(." in the generated files.

I'm also submitting a minor documentation fix to osgGA/DriveManipulator to get
it out of my patch queue ;)"
2010-09-16 09:49:22 +00:00
Robert Osfield
b4fda3a6da From March Sciabica, "Here is the solution I coded up over the weekend. For improved
performance option, I added a flag to control whether the depth writing
pass is performed.

Since text is alpha-blended when rendering, it is placed in the
transparent bin and rendered back to front. Writing to the depth buffer
should therefore be unnecessary. Indeed, rendering something behind text
(or any blended object) after that object is drawn will give incorrect
results whether the depth buffer is written or not. I therefore think it
is safe to keep this option off by default. Users can turn it on for any
special needs they have.

I did not fix the existing backdrop implementations to work with the new
code since this new method of rendering intrinsically handles backdrops
correctly. Its results are more accurate than all of the existing
backdrop implementations. Its only downside is that it requires two
passes if depth buffer updates are desired, whereas DEPTH_RANGE and
POLYGON_OFFSET achieve their (less accurate) results in one pass. The
NO_DEPTH_BUFFER method also only uses one pass, but it disables depth
tests and not depth writes so will have serious problems if anything is
drawn in front of the text before OR after the text is drawn.

Given the better all-around behavior of the new method, I believe the
other backdrop implementations can be safely removed. Code that adjusts
the backdrop implementation will of course be broken if the member
functions are removed. For this reason I left them in, but set the new
rendering method as the default backdrop implementation. At the very
least I think the old backdrop implementations should be deprecated and
removed at a later date.
"

Note from Robert Osfield, testing this submission with osgtext I found that the
text would not render correctly when different text labels were overlapping
in deth and screen space.  I change _enableDepthWrites to default to true and
found the that which artifacts still occurred around the alpha blended edges
the artifacts where better than issue with occlusion of nearer pixels that was
happening with _enableDepthWrites set to false.I therefore set the
_enableDepthWrites to true as I feel it's the lesser of the two artefacts.
2010-09-16 09:09:43 +00:00
Robert Osfield
26a41004c2 From Mathias Fielder, "i found an issue with the serializer writing shared arrays. At OutputStream::writeArray(), if the currently latest array is shared the full array content will be written.
The following code snippet will reproduce this issue:


Code:

osg::Vec2 vec(0.f, 0.f);
osg::Array* sharedArray = new osg::Vec2Array(1, & vec);

// create 2 geometries sharing same array
osg::Geometry* geom0 = new osg::Geometry;
osg::Geometry* geom1 = new osg::Geometry;
geom0->setVertexArray(sharedArray);
geom1->setVertexArray(sharedArray);

osg::ref_ptr<osg::Geode> geode = new osg::Geode;
geode->addDrawable(geom0);
geode->addDrawable(geom1);

std::stringstream buffer;

// write node
osg::ref_ptr<osgDB::Options> options = new osgDB::Options("Ascii");
osgDB::ReaderWriter* rw = osgDB::Registry::instance()->getReaderWriterForExtension("osgt");
osgDB::ReaderWriter::WriteResult wr = rw->writeNode(*geode, buffer, options.get());

// print result; array will be written twice with full content, though with same ID
std::cout << buffer.str() << std::endl;

// trying to read back node will print warnings about unmatched properties
osgDB::ReaderWriter::ReadResult rr = rw->readNode(buffer, options.get());




To fix this i made a change in OutputStream::writeArray().
I think the same issue applies to OutputStream::writeObject(). So i made the same change there.
"
2010-09-16 08:46:38 +00:00
Robert Osfield
94c86d495c From Paul de Repentigny, Commented out section of code that didn't work properly 2010-09-15 13:24:37 +00:00
Robert Osfield
d606bf0ba2 Fixed warning 2010-09-15 13:04:35 +00:00
Robert Osfield
5abd9ed562 From Magnus Kessler, "Fix a small typo in present3D usage string" 2010-09-15 12:50:16 +00:00
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
65e49cf9db From Laura Cerritelli, "I modified TXPPagedLOD::traverse to prevent the terrain from inappropriately unloading the higher level of detail tiles. It wasn?t updating the frame number of the tile or the range it was traversing, causing PagedLOD::removeExpiredChildren to always consider the range expired." 2010-09-15 11:36:45 +00:00
Robert Osfield
6ac8b63419 From Wang Rui, "I've fixed some pen-slips in SharedStateManager.cpp, which writing the
last few examples for my to-be-finished book. I also do a minor fix to
the share() method to make it work for geodes, too."
2010-09-15 11:32:51 +00:00
Robert Osfield
df7df0739a From Lukasz Izdebski, "I made some changes in OcclusionQueryNode file.
I move declaration of classes TestResult, QueryGeometry from cpp to header file and made a void createSupportNodes() a virtual method.

Now is possible to inherit from class OcclusionQueryNode."
2010-09-15 11:27:31 +00:00
Robert Osfield
d6fe337728 Renamed file3ds and options member variables to _file3ds and _options to avoid confusion and keep the code consistent with the rest of the class/OSG.
Added _option parameter to writeImageFile(..) call.
2010-09-15 11:10:10 +00:00
Robert Osfield
7a6a226ddd From Todd Furlong, "I made a couple of changes to the osgFX::Outline class (SVN patch attached). I had a couple of issues with it that I was trying to resolve:
1. When an outline object was occluded by another object, the backfacing wireframe was exposed.  To fix that, I removed the disabling of GL_DEPTH_TEST.

2. In some cases, the outline color was the same color as the geometry being drawn instead of the specified color.  I'm not sure I have completely fixed this issue, but I did make some changes to match up to how we do a scribe effect."
2010-09-15 10:50:24 +00:00
Robert Osfield
d96e57c0c3 Added https, ftp and ftps to list of supported server protocols, and add ability for curl plugin to ignore the need for a server address when .curl extension is used. 2010-09-15 10:24:59 +00:00
Robert Osfield
d044d135f5 From Jan Peciva, "please, find attached improved Stencil and StencilTwoSided classes.
Goals:
- to handle INCR_WRAP values nicely if not supported by OpenGL (old hardware)
- to support two side stenciling of OpenGL 2.0. Current implementation does not work on ATI as it uses Nvidia extension.

Ready for commit:
- Stencil and Stencil.cpp - please, review them

Ready with "hack":
- StencilTwoSided.cpp: please, see the line 113 in apply():

      glEnable(GL_STENCIL_TEST_TWO_SIDE);

This line used to be in getModeUsage() as

      usage.usesMode(GL_STENCIL_TEST_TWO_SIDE);

but it produces OpenGL errors on ATI as it is unknown value there (it is Nvidia extension).
Problems with my "glEnable" solution:
- it enables two side stenciling forever, and it will disturb any other single-side stenciling in the scene graph.
"
2010-09-15 09:56:16 +00:00
Robert Osfield
0259a340fd From Wang Rui, "I've changed it back to _alive, _current_size and _current_alpha, and placed them one by one for setTexCoordPointer() to use.
All size() methods are now renamed to volume(). At present only the CompositePlacer will use it for randomly choose a place according to the volumes of all children.
 "
2010-09-15 09:24:45 +00:00
Robert Osfield
b4789863ac Form Wang Rui, "An initial GLSL shader support of rendering particles. Only the POINT
type is supported at present. The attached osgparticleshader.cpp will
show how it works. It can also be placed in the examples folder. But I
just wonder how this example co-exists with another two (osgparticle
and osgparticleeffect)?

Member variables in Particle, including _alive, _current_size and
_current_alpha, are now merged into one Vec3 variable. Then we can
make use of the set...Pointer() methods to treat them as vertex
attribtues in GLSL. User interfaces are not changed.

Additional methods of ParticleSystem are introduced, including
setDefaultAttributesUsingShaders(), setSortMode() and
setVisibilityDistance(). You can see how they work in
osgparticleshader.cpp.

Additional user-defined particle type is introduced. Set the particle
type to USER and attach a drawable to the template. Be careful because
of possible huge memory consumption. It is highly suggested to use
display lists here.

The ParticleSystemUpdater can accepts ParticleSystem objects as child
drawables now. I myself think it is a little simpler in structure,
than creating a new geode for each particle system. Of course, the
latter is still compatible, and can be used to transform entire
particles in the world.

New particle operators: bounce, sink, damping, orbit and explosion.
The bounce and sink opeartors both use a concept of domains, and can
simulate a very basic collision of particles and objects.

New composite placer. It contains a set of placers and emit particles
from them randomly. The added virtual method size() of each placer
will help determine the probability of generating.

New virtual method operateParticles() for the Operator class. It
actually calls operate() for each particle, but can be overrode to use
speedup techniques like SSE, or even shaders in the future.

Partly fix a floating error of 'delta time' in emitter, program and
updaters. Previously they keep the _t0 variable seperately and compute
different copies of dt by themseleves, which makes some operators,
especially the BounceOperator, work incorrectly (because the dt in
operators and updaters are slightly different). Now a getDeltaTime()
method is maintained in ParticleSystem, and will return the unique dt
value (passing by reference) for use. This makes thing better, but
still very few unexpected behavours at present...

All dotosg and serialzier wrappers for functionalities above are provided.

...

According to some simple tests, the new shader support is slightly
efficient than ordinary glBegin()/end(). That means, I haven't got a
big improvement at present. I think the bottlenack here seems to be
the cull traversal time. Because operators go through the particle
list again and again (for example, the fountain in the shader example
requires 4 operators working all the time).

A really ideal solution here is to implement the particle operators in
shaders, too, and copy the results back to particle attributes. The
concept of GPGPU is good for implementing this. But in my opinion, the
Camera class seems to be too heavy for realizing such functionality in
a particle system. Myabe a light-weight ComputeDrawable class is
enough for receiving data as textures and outputting the results to
the FBO render buffer. What do you think then?

The floating error of emitters
(http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2009-May/028435.html)
is not solved this time. But what I think is worth testing is that we
could directly compute the node path from the emitter to the particle
system rather than multiplying the worldToLocal and LocalToWorld
matrices. I'll try this idea later.
"
2010-09-14 15:47:29 +00:00
Robert Osfield
551d2b6479 From Ulrich Hertlein, "not sure how severe this is but I believe there's a bug in
Texture.cpp:applyTexImage2D_subload:

<code>
unsigned char* data = = (unsigned char*)image->data();
if (needImageRescale) {
 // allocates rescale buffer
 data = new unsigned char[newTotalSize];

 // calls gluScaleImage into the data buffer
}

const unsigned char* dataPtr = image->data();
// subloads 'dataPtr'

// deletes 'data'
</code>

In effect, the scaled data would never be used.

I've also replaced bits of duplicate code in Texture1D/2D/2DArray/3D/Cubemap/Rectangle
that checks if the texture image can/should be unref'd with common functionality in
Texture.cpp.

"
2010-09-14 13:19:55 +00:00
Robert Osfield
d55ada3790 Moved GL_RED and associated GL defines that aren't defined by GLES into the include/osg/Image to aid portability. 2010-09-14 13:19: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
78cb15fdf8 From Torben Dannhauer, "I extended the attached CMAKE module to search for the collada libraries of my VS2008 3rdParty package if no other library is found.
No CMAKE should recognize all libraries of the VS2008 3rdParty Package."
2010-09-09 10:44:11 +00:00
Robert Osfield
2f14255dd7 From Joachim Pouderoux, "Please find attached a very small fix for the DXF reader. The bug made OSG
crash with some files.
Actually, itr was incremented into the loop and after the test with
nlist.end().
Then, the unreferencing of itr when nlist is equals to nlist.end() caused
the crash."
2010-09-09 10:17:55 +00:00
Robert Osfield
a5a7bcf165 From Joachim Pouderoux, "I have added the support for wkbMultiPolygon & wkbMultiPolygon25D in the OGR
plugin (it was mysteriously missing and no prevent warning messages was
print)."
2010-09-09 10:14:54 +00:00
Robert Osfield
fa94700e5c From Tassilo Glander, "I want to submit a fix for the plugin to load .x model files (Direct X).
The current version crashes when encountering global materials, as also reported in the forum by the author of the plugin.

The problem in mesh.cpp (app. ln 247) is, that references to global materials that are given in curly brackets {} are not supported by the reader. However, curly brackets seem to be common, according to Bourke. Unfortunately, I found no specification. However, also the DirectX model viewer that comes with the DirectX-SDK (August 2009) expects curly brackets and refuses models without them.

My fix checks 2 more cases ("{ aMaterial }" -> 3 tokens and "{aMaterial}" -> 1 token), and extracts the material name for the lookup. I don't know if this is the most elegant solution, but the tokenizer seems to split based on white spaces.

You can reproduce the bug with the attached model (box.x), which loads fine in other tools, such as 3DSmax, DeepExploration or the DirectX model viewer. When I remove the curly brackets at the reference of "myGlobalMaterial", it loads in osgviewer, but is not standard conform.
"
2010-09-09 10:09:31 +00:00
Robert Osfield
cbc43841e1 From Roland Smeenk, "this submission adds a "Fast Drawable" line to the camera scene statistics.
It shows the total number of sorted and unsorted drawables that use the fastpath for rendering."
2010-09-09 10:03:58 +00:00
Robert Osfield
77c35eabde From Jean-Sebastien Guay, "I've added a second ctor where no argument is optional, and documented that it's meant to be used when the InteractiveImage is going to be used in a fullscreen HUD.
"
2010-09-09 09:47:31 +00:00
Robert Osfield
60942d8e72 Added version check for av_lockmgr_register support. 2010-09-09 09:05:33 +00:00
Robert Osfield
6f08e25c05 From Nathan Monteleone and Robert Osfield,
submission email from Nathan: "I discovered a problem with POINT_ROT_EYE billboards in IntersectionVisitor: because we pass in just the model matrix to Billboard::computeBillboardMatrix, the billboard gets the wrong up vector.  It really needs to take the view matrix into account to get the correct up vector.

This version of IntersectionVisitor.cpp is made against today's SVN.  It corrects the problem by computing the billboard matrix using the complete modelview, and then multiplies by the inverse of the view matrix before pushing onto IntersectionVisitor's model stack.  The only code I changed is in apply(Billboard&)."

notes from Robert, refactored the matrix multiplication code and the use of RefMatrix to make Nathan's changes more efficient.
2010-09-09 08:47:12 +00:00
Robert Osfield
6f49d85f88 Cleaned up debug info, and changed Text3D across to using GL_NORMALIZE instead of GL_RESCALE_NORMAL. 2010-09-08 11:02:39 +00:00
Robert Osfield
c9bd91cc6a Added support for honouring PrimitiveSet names in new smoothing algorithm 2010-09-08 10:46:49 +00:00