Commit Graph

10808 Commits

Author SHA1 Message Date
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
Robert Osfield
4fe88ee2e4 From Jean-Sebastien Guay, build fixes for Windows 2010-09-08 08:09:01 +00:00
Robert Osfield
d1ee7bca8d Removed files that have been moved into osgText. 2010-09-07 19:55:41 +00:00
Robert Osfield
234cb82867 Moved Glyph and Glyph3D out of Font header/source file into their own header/source file. 2010-09-07 18:20:03 +00:00
Robert Osfield
50be800787 Moved TextNode into osgText.
Cleaned up freetype plugin so it no longer does tesselation - instead Glyph and TextNode do this.
2010-09-07 18:18:35 +00:00
Robert Osfield
a6abbb545e Further work on new 3D text support 2010-09-06 15:43:59 +00:00
Robert Osfield
32db4d6a98 Added basic wiring up of TextTechnique to 3D glyph code 2010-09-03 15:03:42 +00:00
Robert Osfield
b4f3818949 Removed now redundent Font3D files 2010-09-03 09:10:27 +00:00
Robert Osfield
ba10f56f86 Refactored to use a typedef of Font to Font3D rather than have a separate Font3D class 2010-09-03 09:08:19 +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
d1e90b6878 Added to Text::resizeGLObjectBuffers(uint) the follow:
_textureObjectBuffer.resize(maxSize);
    _texParametersDirtyList.resize(maxSize);
2010-09-02 07:55:36 +00:00
Robert Osfield
a5d490c03f Implemented a greedy triangle associate technique to minimize the number of duplicate vertices required to produce crease angles. 2010-08-25 16:59:27 +00:00
Robert Osfield
0a429e97f7 Changed --flat to --flat-shaded to avoid conflict with oiginal --flat ratio control. 2010-08-25 14:34:08 +00:00
Robert Osfield
2ee999fb6e Cleaned up main and introduced --samples <num>, --flat, --smooth command line controls.
Add StatsHandler to viewer to enable review of different settings on number vertices/triangles.
2010-08-25 11:07:30 +00:00
Robert Osfield
fd1493e14b Added support for controlling the number of curves samples to generate on Glyph3D's. Set via Font3D::setNumberCurveSamples(num). 2010-08-25 11:06:10 +00:00
Robert Osfield
6049f67a48 Implemented the shell geometry code 2010-08-24 16:08:50 +00:00
Robert Osfield
610b3ec360 Added "SORT_BACK_TO_FRONT" and "SORT_FRONT_TO_BACK" RenderBin's to default prototype list 2010-08-24 16:06:31 +00:00
Robert Osfield
f3617062a0 Refactored 3d text geometry creation code so that the text is all placed in one osg::Geometry. 2010-08-24 14:22:58 +00:00
Robert Osfield
7eb172277f Fixed bug in handling large osg::Geometry. 2010-08-20 10:24:06 +00:00
Robert Osfield
e4d8e560b0 Implemented generation of front, back and bevel geometries to complete the 3d glyphs. 2010-08-19 16:24:08 +00:00
Robert Osfield
5f63f42b12 Improved the detection of problem vetices and associated triangles 2010-08-18 11:14:58 +00:00
Robert Osfield
06d2631a3d Fixed indentation 2010-08-17 19:48:19 +00:00
Robert Osfield
8755d8090b Implemented basic duplication of points that sit on sharp edges. 2010-08-17 19:48:07 +00:00
Michael PLATINGS
5b603191b3 From Donn Mielcarek:
The fbx plugin won't compile using gcc 4.3.2.  I made the following
minor changes:

1. WriterNodeVisitor.cpp needed limits.h added to the headers.

2. gcc does not allow structures to be defined inside of functions, so
  I moved the definition of PolygonRef out of the function to a global
  scope (right above the function readMesh).

  I also removed a bunch of embedded carriage returns
2010-08-17 13:25:46 +00:00
Robert Osfield
ac6e1b6555 Added support for RGTC1 and RGTC2 enums 2010-08-17 13:10:18 +00:00
Robert Osfield
4d1df397e2 From Guillaume Taze, "Here are some bugs fix :
- missing copy attribute _referenceFrame in ClipNode in copy constructor
- checked iterators against the end in osgText
- close codec context in ffmpeg plugin to avoid memory leak

"
2010-08-16 15:02:04 +00:00
Robert Osfield
4e967ef3c3 From Maria Ten, "Importing 3ds files with a texture for the diffuse component and other one for opacity does not work with the osg 3ds plugin. In the attached file, there is a fix to solve this issue but it does not support textures without alpha channel in the opacity component (like black and white textures used in 3ds max to achieve the transparency). There is attached a test 3ds file too.
"
2010-08-16 14:54:16 +00:00
Robert Osfield
6849bb8e3b From Wang Rui, "Attachment is the implementation of the writing operation of the TGA
format. I wrote it just for one of my client. At present it only
outputs uncompressed RGBA images, but the OSG community can go deeper
at any time."
2010-08-16 14:39:53 +00:00
Robert Osfield
a1ad09bba9 Added material setName. 2010-08-16 14:24:12 +00:00
Robert Osfield
024fc1dca3 Added support for USE_RGBT1_COMPRESSION and USE_RGBT2_COMPRESSION 2010-08-16 14:14:03 +00:00
Robert Osfield
a171c88cf1 From Lukasz Izdebski, "Texture: added support for GL_EXT_texture_compression_rgtc, I added support (read and write ) for BC4 BC5 Block Compression to dds file format." 2010-08-16 14:11:49 +00:00
Robert Osfield
fe6d590fc5 Changed setTransformation(eye, center, up) paramter ordering to match gluLookAt conventions. 2010-08-16 11:03:24 +00:00
Robert Osfield
2d291234c6 From Bradley Anderegg, "I fixed a problem with a stack overflow error in Particle.cpp. When the hexagon particle renders it does a glPushMatrix with no matching glPopMatrix, I simply added a glPopMatrix at the end of the rendering code." 2010-08-16 10:11:49 +00:00
Robert Osfield
5d48a68cba From Alexander Wiebel, "Documentation of PrimitiveSet" 2010-08-16 09:35:59 +00:00