Commit Graph

116 Commits

Author SHA1 Message Date
Capostrophic
066c272f7a Override default behavior for linear vector interpolations 2019-03-15 21:29:13 +03:00
Robert Osfield
749dc86dd3 Fixed typo 2019-01-23 08:52:11 +00:00
Robert Osfield
1c65815f4e Fixed crash on exit issues with osgFX, osgParticle, osgSim and the osgforest example 2019-01-07 17:46:02 +00:00
Sebastian Messerschmidt
fce55993bc FIX: <osgParticle> removed unimplemented functions from header 2018-04-30 11:16:02 +02:00
Robert Osfield
a6069c3226 Introduced Drawable::CreateVertexArrayStateCallback to enable customization of how VertexArrayState objects.
Added public accessors to the Drawable::VertexArrayStateList.
2017-11-29 14:22:31 +00:00
luzpaz
2cd31f65e4 misc. typo fixes
mostly non-user-facing but some doxy.
2017-08-15 12:23:49 -04:00
Robert Osfield
0ee65c9d2f Removed unneccessary parameter 2016-10-11 11:29:29 +01:00
Robert Osfield
a471973eab Added missing export 2016-10-11 11:29:29 +01:00
Robert Osfield
5a4754deef Refactored osgParticle so that it natives support vertex arrays, vertex buffer objects and vertex array objects 2016-10-11 11:29:29 +01:00
Robert Osfield
886b922596 Beginings of refactoring ParticleSystem so that it does uses vertex arrays rather than GLBeginEndAdapter 2016-10-11 11:29:29 +01:00
Robert Osfield
56ed225f17 Removed Particle::Shape support for QUAD_TRIANGLESTRIP, HEXAGON, USER as these are unlikely to be used as their implementation prevents refactoring to use vertex array code paths 2016-10-11 11:29:29 +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
4174d72a52 2014-05-14 10:19:43 +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
64b0e1afd0 From Vladimir Chebaev, "I worked with osg::Particle and see that this class has setter osgParticle::setTextureTileRange and has no getters for startTile and endTile. This can be very uncomfortable.
I attached file with two getters."
2013-06-20 12:15:57 +00:00
Robert Osfield
14a563dc9f Ran script to remove trailing spaces and tabs 2012-03-21 17:36:20 +00:00
Robert Osfield
4a3aa2680d Fixed Coverity reported issues.
CID 11843: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member _inexp is not initialized in this constructor nor in any functions that it calls.
Non-static class member _outexp is not initialized in this constructor nor in any functions that it calls.

CID 11842: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member _inexp is not initialized in this constructor nor in any functions that it calls.
Non-static class member _outexp is not initialized in this constructor nor in any functions that it calls.
2011-05-06 10:30:23 +00:00
Robert Osfield
d3d0859b4c From Piotr Gwiazdowski, "So there's config setting OSG_DISABLE_MSVC_WARNINGS which should
disable pragmas that turn off specific warnings for MSVC.
Unfortunately it's presence is only checked in osg/Export header,
making other Export headers disable warnings no matter what, which is
kind of incoherent.

My fix adds #include <osg/Config> to every Export header. I've also
unified checking whether to disable warnings to current osg/Export
way:
#if defined(_MSC_VER) && defined(OSG_DISABLE_MSVC_WARNINGS).

Attachment contains all changed Export files in their original locations."
2011-03-09 14:15:04 +00:00
Robert Osfield
410b4fd109 Converted FrameStamp::g/setFrameNumber from int to uint 2010-12-22 20:11:05 +00:00
Robert Osfield
04b6a0888b Build fixes for building OSG with OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION set to OFF 2010-11-22 19:38:18 +00:00
Robert Osfield
8f1284d8bc From Sukender, "I replaced std::min() with osg::minimum() in RandomRateCounter, to avoid including the STL header (Or else it doesn't compile under MSVC 10)." 2010-11-04 11:39:47 +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
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
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
a71877bf2f Changed emit() to emitParticles() to avoid collision with Qt. 2010-07-30 16:06:22 +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
a3adc3d07c From Martin Scheffler, "osgParticle: method to set start and end tile for particle texture (for animated particles). I also updated examples/osgParticle to show the feature.
The texture in data/Images should be copied to osg-data. I created the texture myself with the help of an explosion generator, so no license issues there.
"
2009-11-24 15:00:11 +00:00
Robert Osfield
5e6415696f Removed remaining glBegin/glEnd usage 2009-10-21 16:40:45 +00:00
Robert Osfield
79b0060703 From Tom Jolly, "A new compiler and a new warning.
Enclosed is include/osgParticle/Particle.  I removed the const from the
return type of getSTexCoord.  I also changed the name on the next
function to getTTexCoord so it is consistent with getSTexCoord.  If you
prefer to change getSTexCoord to getSCoord you will need to change it in
ConnectedParticleSystem.cpp."
2009-06-19 13:09:31 +00:00
Robert Osfield
27cf68b22d Replaced frame delta computation that was originally based on a local static variable, replacing it with member variable to tracking the previous frame time. This fixes a bug in the wind computation when multiple PrecipitaionEffects are in the scene. 2009-06-11 14:56:54 +00:00
Robert Osfield
0adcfda07a Merged from OSG-2.8 branch changes to the use of ReadWriteMutex to Mutex in osgParticle::ParticleSystem.
svn command:

   svn merge -r 9725:9726 http://www.openscenegraph.org/svn/osg/OpenSceneGraph/branches/OpenSceneGraph-2.8
2009-02-09 21:38:06 +00:00
Robert Osfield
344908faad Made the ParticleSystemUpdate::addParticleSystem, removeParticleSystem, replaceParticleSystem and setParticleSystem methods all virtual to allow them to be overriden. 2008-11-21 12:30:12 +00:00
Robert Osfield
6f6f56c795 Improved the doxygen docs over the various namespaces 2008-08-05 19:17:09 +00:00
Robert Osfield
ae1c047deb Added doxygen docs 2008-03-17 12:11:39 +00:00
Robert Osfield
00f161ca35 Introduce osgParticle::ParticleSystem::s/getParticleScaleReferenceFrame() to
help manage the scaling of particles, whether they should be relative to the
local coordiante frame of the particle system, or be in world coordinates.
2008-03-17 12:09:05 +00:00
Robert Osfield
b467fdeb6c From Alberto Luaces, "it seems that include/osgParticle/BoxPlacer was created from the SectorPlacer
file. The code works well but the SectorPlacer comments stayed in the new
file. I have altered those comments so they now contain valid information for
the BoxPlacer class and the doxygen generated documentation is correct.

"
2007-12-11 11:37:03 +00:00
Robert Osfield
b20d542317 From David Callu, improved consistency of Version strings and add version support
for osgIntrospection and osgManipulator.
2007-09-05 17:12:24 +00:00
Robert Osfield
691a49d0fa From Paul Melis, fixes to spelling mistakes/typos. 2007-07-11 15:51:17 +00:00
Robert Osfield
44c07b9fad Separated OperationsThread out from the GraphicsThread header and introduced
new OperationQueue class.
2007-07-09 19:04:36 +00:00
Robert Osfield
eac3dc1963 From Paul Melis, "Here is a list of fixes to misspelled APIs. Unfortunately, more than one
of these are public APIs and therefore will break linkage to existing
shared libraries."

Note from Robert Osfield, updated wrappers.
2007-06-27 20:36:16 +00:00
Robert Osfield
7fc714ada1 Removed deprecated drawImplementation(State&) method from Drawable and Drawable::DrawCallback 2007-03-28 11:30:38 +00:00
Robert Osfield
ad3cac84e9 Moved Block, ReentrantMutex and ReadWriteMutex into OpenThreads. 2007-02-23 16:31:34 +00:00
Robert Osfield
b992451586 Added explicit to ParticleEffect constructors 2007-01-12 22:01:56 +00:00
Robert Osfield
007cc9f4ac From Tom Jolley, "There was some unnecessary creation and deletion of Particle objects in
include/osgParticle/ParticleSystem.  I replaced

   Particle(ptemplate? *ptemplate: _def_ptemp)

with

   ptemplate? *ptemplate: _def_ptemp

in a couple of places.  This should make particle creation and reuse go
a little faster without all that memory allocation and copying."
2007-01-12 21:44:28 +00:00
Robert Osfield
11fef2d75e Tweaks from using a ReadWriteMutex& to a ReadWriteMutex* parameter to avoid
problems with osgIntrospection generation.
2006-12-27 23:19:17 +00:00
Robert Osfield
30cb8735d3 Added an osgDB::ReadWriteMutex to help manage the ability to have serialize
write to objects but allow multiple threads to read at once in a read only way.
2006-12-27 16:40:34 +00:00
Robert Osfield
401f3bcd43 Added mutexes to ParticleProcessor and ParticleSystemUpdater to improve the thread safety of osgParticle 2006-12-22 21:52:53 +00:00
Robert Osfield
d0cc014f1b Further migration to using RenderInfo 2006-11-14 12:51:31 +00:00