Mathias Fröhlich | 30 Jun 08:20 2015
Picon
Picon

ClipControl

 

Hi Robert,

 

Attached a new state attribute implementing the glClipControl that appeared with GL4.5.

The change is based on rev 14924 on trunk.

 

Please review and apply

Thanks!

 

Mathias

Attachment (ClipControl.zip): application/zip, 35 KiB
_______________________________________________
osg-submissions mailing list
osg-submissions@...
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
Christian Kehl | 22 Jun 23:22 2015
Picon

Change of Vec2f, adding a set-operation (starting poitn 3.3.8) to extend osgAndroid for TexCoords

Hi Robert,

I am actively working on extending Rafa's and Jan's work on osgAndroid, 
extending the wrappers and the Android link. When constructing the 
geometry on the phone, I saw I need Vec2 for the texture coords. While 
Vec3 and Vec4 already had a "void set( const Vec<T>f& rhs)" operation, 
that was missing for Vec2f. Hence, I added that setter (line 62-65). Ask 
for inclusion in future versions, so osgAndroid can be extended.

Kind Regards,

Christian
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
 *
 * This library is open source and may be redistributed and/or modified under
 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
 * (at your option) any later version.  The full license is in LICENSE file
 * included with this distribution, and on the openscenegraph.org website.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * OpenSceneGraph Public License for more details.
*/

#ifndef OSG_VEC2F
#define OSG_VEC2F 1

#include <osg/Math>

namespace osg {

/** General purpose float pair. Uses include representation of
  * texture coordinates.
  * No support yet added for float * Vec2f - is it necessary?
  * Need to define a non-member non-friend operator* etc.
  * BTW: Vec2f * float is okay
*/

class Vec2f
{
    public:

        /** Data type of vector components.*/
        typedef float value_type;

        /** Number of vector components. */
        enum { num_components = 2 };

        /** Vec member variable. */
        value_type _v[2];

        /** Constructor that sets all components of the vector to zero */
        Vec2f() {_v[0]=0.0; _v[1]=0.0;}
        Vec2f(value_type x,value_type y) { _v[0]=x; _v[1]=y; }

        inline bool operator == (const Vec2f& v) const { return _v[0]==v._v[0] && _v[1]==v._v[1]; }

        inline bool operator != (const Vec2f& v) const { return _v[0]!=v._v[0] || _v[1]!=v._v[1]; }

        inline bool operator <  (const Vec2f& v) const
        {
            if (_v[0]<v._v[0]) return true;
            else if (_v[0]>v._v[0]) return false;
            else return (_v[1]<v._v[1]);
        }

        inline value_type * ptr() { return _v; }
        inline const value_type * ptr() const { return _v; }

        inline void set( value_type x, value_type y ) { _v[0]=x; _v[1]=y; }
        inline void set( const Vec2f& rhs)
        {
            _v[0]=rhs._v[0]; _v[1]=rhs._v[1];
        }

        inline value_type & operator [] (int i) { return _v[i]; }
        inline value_type operator [] (int i) const { return _v[i]; }

        inline value_type & x() { return _v[0]; }
        inline value_type & y() { return _v[1]; }

        inline value_type x() const { return _v[0]; }
        inline value_type y() const { return _v[1]; }

        /** Returns true if all components have values that are not NaN. */
        inline bool valid() const { return !isNaN(); }
        /** Returns true if at least one component has value NaN. */
        inline bool isNaN() const { return osg::isNaN(_v[0]) || osg::isNaN(_v[1]); }

        /** Dot product. */
        inline value_type operator * (const Vec2f& rhs) const
        {
            return _v[0]*rhs._v[0]+_v[1]*rhs._v[1];
        }

        /** Multiply by scalar. */
        inline const Vec2f operator * (value_type rhs) const
        {
            return Vec2f(_v[0]*rhs, _v[1]*rhs);
        }

        /** Unary multiply by scalar. */
        inline Vec2f& operator *= (value_type rhs)
        {
            _v[0]*=rhs;
            _v[1]*=rhs;
            return *this;
        }

        /** Divide by scalar. */
        inline const Vec2f operator / (value_type rhs) const
        {
            return Vec2f(_v[0]/rhs, _v[1]/rhs);
        }

        /** Unary divide by scalar. */
        inline Vec2f& operator /= (value_type rhs)
        {
            _v[0]/=rhs;
            _v[1]/=rhs;
            return *this;
        }

        /** Binary vector add. */
        inline const Vec2f operator + (const Vec2f& rhs) const
        {
            return Vec2f(_v[0]+rhs._v[0], _v[1]+rhs._v[1]);
        }

        /** Unary vector add. Slightly more efficient because no temporary
          * intermediate object.
        */
        inline Vec2f& operator += (const Vec2f& rhs)
        {
            _v[0] += rhs._v[0];
            _v[1] += rhs._v[1];
            return *this;
        }

        /** Binary vector subtract. */
        inline const Vec2f operator - (const Vec2f& rhs) const
        {
            return Vec2f(_v[0]-rhs._v[0], _v[1]-rhs._v[1]);
        }

        /** Unary vector subtract. */
        inline Vec2f& operator -= (const Vec2f& rhs)
        {
            _v[0]-=rhs._v[0];
            _v[1]-=rhs._v[1];
            return *this;
        }

        /** Negation operator. Returns the negative of the Vec2f. */
        inline const Vec2f operator - () const
        {
            return Vec2f (-_v[0], -_v[1]);
        }

        /** Length of the vector = sqrt( vec . vec ) */
        inline value_type length() const
        {
            return sqrtf( _v[0]*_v[0] + _v[1]*_v[1] );
        }

        /** Length squared of the vector = vec . vec */
        inline value_type length2( void ) const
        {
            return _v[0]*_v[0] + _v[1]*_v[1];
        }

        /** Normalize the vector so that it has length unity.
          * Returns the previous length of the vector.
        */
        inline value_type normalize()
        {
            value_type norm = Vec2f::length();
            if (norm>0.0)
            {
                value_type inv = 1.0f/norm;
                _v[0] *= inv;
                _v[1] *= inv;
            }
            return( norm );
        }

};    // end of class Vec2f

/** multiply by vector components. */
inline Vec2f componentMultiply(const Vec2f& lhs, const Vec2f& rhs)
{
    return Vec2f(lhs[0]*rhs[0], lhs[1]*rhs[1]);
}

/** divide rhs components by rhs vector components. */
inline Vec2f componentDivide(const Vec2f& lhs, const Vec2f& rhs)
{
    return Vec2f(lhs[0]/rhs[0], lhs[1]/rhs[1]);
}

}    // end of namespace osg
#endif

_______________________________________________
osg-submissions mailing list
osg-submissions@...
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
Jannik Heller | 12 Jun 22:00 2015
Picon

osgQt version check

Hi Robert,

I've added the check for Qt version mismatches into osgQt as suggested in http://forum.openscenegraph.org/viewtopic.php?t=14999.

When an application is built with Qt4, but osgQt was built with Qt5 (or vice versa), upon #includeing osgQt
users will receive an #error aborting the build.

This at least provides a proper error message rather than a crash, while we are working on better fixes for
the problem.

Cheers,
Jannik

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=64080#64080

_______________________________________________
osg-submissions mailing list
osg-submissions@...
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
Farshid Lashkari | 11 Jun 20:18 2015
Picon

Minor osgText optimization

Hi Robert,

I've modified some setter methods of TextBase to avoid unnecessary calls to computeGlyphRepresentation() if the value has not changed.

Cheers,
Farshid
Attachment (TextBase.zip): application/zip, 4652 bytes
_______________________________________________
osg-submissions mailing list
osg-submissions@...
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
Colin McDonald | 10 Jun 13:35 2015
Picon

Generate mipmap regression

Hi Robert,

An earlier fix in OSG 3.2 has been inadvertently lost in 3.3.x. The glGenerateMipMap function is part of the GL_EXT_framebuffer_object extension. Just checking if the function is present before using it for texture mipmaps is not sufficient, as on remote X-windows displays the client side capability may be different from the display server.  This can lead to mipmapped textures failing to render.  I've restored a fbo extension check.  I've also tided up the GL version checking a little.

Regards

Colin McDonald

Attachment (generate_mipmap2.zip): application/zip, 37 KiB
_______________________________________________
osg-submissions mailing list
osg-submissions@...
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
Jannik Heller | 10 Jun 01:37 2015
Picon

Multiple camera frame break improvement

Hi Robert,

I have a sizable performance improvement for the "multiple cameras, one draw thread" use case.

To see the improvement, you need a scene with no dynamic Drawables or StateSets, and a Viewer with at least
two slave Cameras using the same draw thread.

The change concerns the firing of the _dynamicObjectRenderingCompleted callback. The callback needs to
be fired for each camera before the next frame can commence. Previously, the callback was fired when
Renderer::draw begins. Since cameras on the same graphics context can only draw one after another, this
effectively means we can commence frame as soon as the last camera started drawing.

If we change the callback to fire in Renderer::cull instead, we can commence the next frame as soon as all
cameras have finished culling, which is obviously *before* the last camera starts drawing, so should be a
non-controversial improvement.

I have also attached a change to the example osgsidebyside.cpp you can use to see the improvement in action.
Launch it with:
./osgsidebyside cessna.osg

My results were:

DrawThreadPerContext, before change: 96 FPS
DrawThreadPerContext, after change: 102 FPS

CullThreadPerCameraDrawThreadPerContext, before change: 95 FPS
CullThreadPerCameraDrawThreadPerContext, after change: 128 FPS

Lastly, I noticed that Renderer::cull_draw does *not* call the _dynamicObjectRenderingCompleted when
there are 0 dynamic objects (as opposed to Renderer::draw which *does* call it). Is this a bug?

Thank you!

Cheers,
Jannik

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=64021#64021

_______________________________________________
osg-submissions mailing list
osg-submissions@...
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
philippe renon | 9 Jun 22:22 2015
Picon

Fixed potential divide by zero in NodeTrackerManipulator


The divide by zero happens when throwing a NodeTrackerManipulator.
The infinite result trickles down and later causes NaN in culling.

The fix was to use getThrowScale() as done everywhere else.

Philippe.

PS : throwing gesture, at least in Qt, seems harder to achieve after upfrading from 3.2.1 to latest.
No clue why...


_______________________________________________
osg-submissions mailing list
osg-submissions@...
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
Mike Connell | 8 Jun 09:47 2015
Picon

Give ReadFileCallback access to parent location

Hi Robert

These small changes to the database pager allow user code in the ReadFileCallback to safely determine where the file being loaded is destined to be inserted into the scenegraph.

Files are from current svn trunk.

best wishes,

Mike
Attachment (Options): application/octet-stream, 17 KiB
Attachment (DatabasePager.cpp): text/x-c++src, 87 KiB
Attachment (Options.cpp): text/x-c++src, 3019 bytes
_______________________________________________
osg-submissions mailing list
osg-submissions@...
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
Jannik Heller | 5 Jun 19:33 2015
Picon

Fix slave camera race condition

Hi Robert,

I found a race condition in the OSG when using slave cameras and CullThreadPerCamera threading model.

In the Renderer constructor, we have:

    osg::Camera* masterCamera = _camera->getView() ? _camera->getView()->getCamera() : camera;

    osg::StateSet* global_stateset = 0;
    osg::StateSet* secondary_stateset = 0;
    if (_camera != masterCamera)
    {
        global_stateset = masterCamera->getOrCreateStateSet();
        secondary_stateset = _camera->getStateSet();
    }
    else
    {
        global_stateset = _camera->getOrCreateStateSet();
    }

meaning, the master camera and the slave camera get the same _globalStateSet assigned.

Later, in each Camera's culling thread, SceneView::inheritCullSettings will call
SceneView::setLightingMode, which modifies _globalStateSet without locking. A crash ensues.

I fixed the crash by changing the assignments to:

    if (_camera != masterCamera)
    {
        secondary_stateset = masterCamera->getOrCreateStateSet();
    }
    global_stateset = _camera->getOrCreateStateSet();

That makes more sense, the global_stateset is the one we can safely modify, i.e. belonging to our Camera,
and secondary_stateset is the one we just push through to the CullVisitor without further changes.

Thanks,
Jannik

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=63961#63961

_______________________________________________
osg-submissions mailing list
osg-submissions@...
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
Jannik Heller | 4 Jun 02:54 2015
Picon

Re: Transform::computeBound optimization

Hi Robert,

sorry to bump the topic, but I was just wondering if you had a chance to look at this yet. In my mind it's an
unproblematic change that results in a speedup for everyone with no further side effects.

Thanks,
Jannik

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=63941#63941
Jannik Heller | 4 Jun 02:53 2015
Picon

Build fix

Hi Robert,

In the attachment you will find a build fix for the latest trunk. osgAnimation failed to compile when using
OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION=OFF .

Thanks
Jannik

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=63940#63940

_______________________________________________
osg-submissions mailing list
osg-submissions@...
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Gmane