[OpenWalnut-Dev] [OWci] r6726: [FIX #297] needed to remove several functions which use per-primitive-binding as this kind of binding is no longer supported in OSG. Several function still use this ... to be continued

Alexander Wiebel wiebel_openwalnut at dergrosse.de
Tue Dec 10 21:59:53 CET 2013


Sorry for positing in German. I did not mean to send this to the list.
Alex

On 12/10/2013 09:52 PM, Alexander Wiebel wrote:
> Hallo Sebastian,
> ich beziehe mich hier nen etwas älteren Commit, aber hast du Ahnung
> warum OSG per primitive binding der Normalen nicht mehr unterstützt?
> 
> Gruß Alex
> 
> 
> On 08/08/2013 02:49 PM, Sebastian Eichelbaum wrote:
>> *Branch default*
>> [FIX #297] needed to remove several functions which use per-primitive-binding as this kind of binding is no longer supported in OSG. Several function still use this ... to be continued
>>
>> changeset 6726:be8c00844980 in /srv/hg/ow (Thu Aug 08 13:18:04 2013 +0200):
>>
>> http://www.openwalnut.org/projects/openwalnut/repository/revisions/6726
>>
>> diffstat:
>>
>>  src/core/graphicsEngine/WGEGeodeUtils.cpp         |  172 ++-------------------
>>  src/core/graphicsEngine/WGEGeodeUtils.h           |   92 -----------
>>  src/core/graphicsEngine/WROIArbitrary.cpp         |    2 +-
>>  src/core/graphicsEngine/WROIBox.cpp               |    2 +-
>>  src/core/graphicsEngine/test/WGEGeodeUtils_test.h |   96 ------------
>>  5 files changed, 24 insertions(+), 340 deletions(-)
>>
>> diffs (491 lines):
>>
>> diff -r 99d0a2bf8c94 -r be8c00844980 src/core/graphicsEngine/WGEGeodeUtils.cpp
>> --- a/src/core/graphicsEngine/WGEGeodeUtils.cpp	Thu Aug 08 13:02:31 2013 +0200
>> +++ b/src/core/graphicsEngine/WGEGeodeUtils.cpp	Thu Aug 08 13:18:04 2013 +0200
>> @@ -103,12 +103,18 @@
>>      osg::ref_ptr< osg::Vec3Array > normals = osg::ref_ptr< osg::Vec3Array >( new osg::Vec3Array );
>>      osg::ref_ptr< osg::Vec4Array > colors = osg::ref_ptr< osg::Vec4Array >( new osg::Vec4Array );
>>  
>> +    // NOTE: as the OSG 3.2 does not allow binding normals/colors and other arrays on a per-primitive basis, we bind the normals per vertex
>> +    // This means we add four normals per face
>> +
>>      // front face
>>      vertices->push_back( osg::Vec3( 0.0, 0.0, 0.0 ) );
>>      vertices->push_back( osg::Vec3( 1.0, 0.0, 0.0 ) );
>>      vertices->push_back( osg::Vec3( 1.0, 1.0, 0.0 ) );
>>      vertices->push_back( osg::Vec3( 0.0, 1.0, 0.0 ) );
>>      normals->push_back( osg::Vec3( 0.0, 0.0, -1.0 ) );
>> +    normals->push_back( osg::Vec3( 0.0, 0.0, -1.0 ) );
>> +    normals->push_back( osg::Vec3( 0.0, 0.0, -1.0 ) );
>> +    normals->push_back( osg::Vec3( 0.0, 0.0, -1.0 ) );
>>  
>>      // back face
>>      vertices->push_back( osg::Vec3( 0.0, 0.0, 1.0 ) );
>> @@ -116,6 +122,9 @@
>>      vertices->push_back( osg::Vec3( 1.0, 1.0, 1.0 ) );
>>      vertices->push_back( osg::Vec3( 0.0, 1.0, 1.0 ) );
>>      normals->push_back( osg::Vec3( 0.0, 0.0, 1.0 ) );
>> +    normals->push_back( osg::Vec3( 0.0, 0.0, 1.0 ) );
>> +    normals->push_back( osg::Vec3( 0.0, 0.0, 1.0 ) );
>> +    normals->push_back( osg::Vec3( 0.0, 0.0, 1.0 ) );
>>  
>>      // left
>>      vertices->push_back( osg::Vec3( 0.0, 0.0, 0.0 ) );
>> @@ -123,6 +132,9 @@
>>      vertices->push_back( osg::Vec3( 0.0, 1.0, 1.0 ) );
>>      vertices->push_back( osg::Vec3( 0.0, 0.0, 1.0 ) );
>>      normals->push_back( osg::Vec3( -1.0, 0.0, 0.0 ) );
>> +    normals->push_back( osg::Vec3( -1.0, 0.0, 0.0 ) );
>> +    normals->push_back( osg::Vec3( -1.0, 0.0, 0.0 ) );
>> +    normals->push_back( osg::Vec3( -1.0, 0.0, 0.0 ) );
>>  
>>      // right
>>      vertices->push_back( osg::Vec3( 1.0, 0.0, 0.0 ) );
>> @@ -130,6 +142,9 @@
>>      vertices->push_back( osg::Vec3( 1.0, 1.0, 1.0 ) );
>>      vertices->push_back( osg::Vec3( 1.0, 0.0, 1.0 ) );
>>      normals->push_back( osg::Vec3( 1.0, 0.0, 0.0 ) );
>> +    normals->push_back( osg::Vec3( 1.0, 0.0, 0.0 ) );
>> +    normals->push_back( osg::Vec3( 1.0, 0.0, 0.0 ) );
>> +    normals->push_back( osg::Vec3( 1.0, 0.0, 0.0 ) );
>>  
>>      // bottom
>>      vertices->push_back( osg::Vec3( 0.0, 0.0, 0.0 ) );
>> @@ -137,6 +152,9 @@
>>      vertices->push_back( osg::Vec3( 1.0, 0.0, 1.0 ) );
>>      vertices->push_back( osg::Vec3( 0.0, 0.0, 1.0 ) );
>>      normals->push_back( osg::Vec3( 0.0, -1.0, 0.0 ) );
>> +    normals->push_back( osg::Vec3( 0.0, -1.0, 0.0 ) );
>> +    normals->push_back( osg::Vec3( 0.0, -1.0, 0.0 ) );
>> +    normals->push_back( osg::Vec3( 0.0, -1.0, 0.0 ) );
>>  
>>      // top
>>      vertices->push_back( osg::Vec3( 0.0, 1.0, 0.0 ) );
>> @@ -144,6 +162,9 @@
>>      vertices->push_back( osg::Vec3( 1.0, 1.0, 1.0 ) );
>>      vertices->push_back( osg::Vec3( 0.0, 1.0, 1.0 ) );
>>      normals->push_back( osg::Vec3( 0.0, 1.0, 0.0 ) );
>> +    normals->push_back( osg::Vec3( 0.0, 1.0, 0.0 ) );
>> +    normals->push_back( osg::Vec3( 0.0, 1.0, 0.0 ) );
>> +    normals->push_back( osg::Vec3( 0.0, 1.0, 0.0 ) );
>>  
>>      // set it up and set arrays
>>      cube->addPrimitiveSet( new osg::DrawArrays( osg::PrimitiveSet::QUADS, 0, vertices->size() ) );
>> @@ -154,7 +175,7 @@
>>  
>>      // set normals
>>      cube->setNormalArray( normals );
>> -    cube->setNormalBinding( osg::Geometry::BIND_PER_PRIMITIVE );
>> +    cube->setNormalBinding( osg::Geometry::BIND_PER_VERTEX );
>>  
>>      // finally, the colors
>>      colors->push_back( color );
>> @@ -340,62 +361,6 @@
>>      return geometry;
>>  }
>>  
>> -osg::ref_ptr< osg::Geometry > wge::convertMeshToOsgGeometryFlat( WTriangleMesh::SPtr mesh,
>> -                                                                 const WColor& color )
>> -{
>> -    osg::ref_ptr< osg::Geometry> geometry( new osg::Geometry );
>> -    geometry->setVertexArray( mesh->getVertexArray() );
>> -
>> -    osg::DrawElementsUInt* surfaceElement;
>> -
>> -    surfaceElement = new osg::DrawElementsUInt( osg::PrimitiveSet::TRIANGLES, 0 );
>> -
>> -    std::vector< size_t > tris = mesh->getTriangles();
>> -    surfaceElement->reserve( tris.size() );
>> -
>> -    for( unsigned int vertId = 0; vertId < tris.size(); ++vertId )
>> -    {
>> -        surfaceElement->push_back( tris[vertId] );
>> -    }
>> -    geometry->addPrimitiveSet( surfaceElement );
>> -
>> -    {
>> -        osg::ref_ptr< osg::Vec4Array > colors = osg::ref_ptr< osg::Vec4Array >( new osg::Vec4Array );
>> -        colors->push_back( color );
>> -        geometry->setColorArray( colors );
>> -        geometry->setColorBinding( osg::Geometry::BIND_OVERALL );
>> -    }
>> -
>> -    // ------------------------------------------------
>> -    // normals
>> -    {
>> -        geometry->setNormalArray( mesh->getTriangleNormalArray() );
>> -        geometry->setNormalBinding( osg::Geometry::BIND_PER_PRIMITIVE );
>> -
>> -        // if normals are specified, we also setup a default lighting.
>> -        osg::StateSet* state = geometry->getOrCreateStateSet();
>> -        osg::ref_ptr<osg::LightModel> lightModel = new osg::LightModel();
>> -        lightModel->setTwoSided( true );
>> -        state->setAttributeAndModes( lightModel.get(), osg::StateAttribute::ON );
>> -        state->setMode( GL_BLEND, osg::StateAttribute::ON  );
>> -        {
>> -            osg::ref_ptr< osg::Material > material = new osg::Material();
>> -            material->setDiffuse(   osg::Material::FRONT, osg::Vec4( 1.0, 1.0, 1.0, 1.0 ) );
>> -            material->setSpecular(  osg::Material::FRONT, osg::Vec4( 0.0, 0.0, 0.0, 1.0 ) );
>> -            material->setAmbient(   osg::Material::FRONT, osg::Vec4( 0.1, 0.1, 0.1, 1.0 ) );
>> -            material->setEmission(  osg::Material::FRONT, osg::Vec4( 0.0, 0.0, 0.0, 1.0 ) );
>> -            material->setShininess( osg::Material::FRONT, 0.0 );
>> -            state->setAttribute( material );
>> -        }
>> -    }
>> -
>> -    // enable VBO
>> -    geometry->setUseDisplayList( false );
>> -    geometry->setUseVertexBufferObjects( true );
>> -
>> -    return geometry;
>> -}
>> -
>>  osg::ref_ptr< osg::Geometry > wge::convertToOsgGeometryLines( WTriangleMesh::SPtr mesh,
>>                                                                const WColor& defaultColor,
>>                                                                bool useMeshColor )
>> @@ -441,47 +406,6 @@
>>      return geometry;
>>  }
>>  
>> -osg::ref_ptr< osg::Geode > wge::generateLineStripGeode( const WLine& line, const float thickness, const WColor& color )
>> -{
>> -    using osg::ref_ptr;
>> -    ref_ptr< osg::Vec3Array > vertices = ref_ptr< osg::Vec3Array >( new osg::Vec3Array );
>> -    ref_ptr< osg::Vec4Array > colors   = ref_ptr< osg::Vec4Array >( new osg::Vec4Array );
>> -    ref_ptr< osg::Geometry >  geometry = ref_ptr< osg::Geometry >( new osg::Geometry );
>> -
>> -    for( size_t i = 1; i < line.size(); ++i )
>> -    {
>> -        vertices->push_back( osg::Vec3( line[i-1][0], line[i-1][1], line[i-1][2] ) );
>> -        colors->push_back( wge::getRGBAColorFromDirection( line[i-1], line[i] ) );
>> -    }
>> -    vertices->push_back( osg::Vec3( line.back()[0], line.back()[1], line.back()[2] ) );
>> -    colors->push_back( colors->back() );
>> -
>> -    geometry->addPrimitiveSet( new osg::DrawArrays( osg::PrimitiveSet::LINE_STRIP, 0, line.size() ) );
>> -    geometry->setVertexArray( vertices );
>> -
>> -    if( color != WColor( 0, 0, 0, 0 ) )
>> -    {
>> -        colors->clear();
>> -        colors->push_back( color );
>> -        geometry->setColorArray( colors );
>> -        geometry->setColorBinding( osg::Geometry::BIND_OVERALL );
>> -    }
>> -    else
>> -    {
>> -        geometry->setColorArray( colors );
>> -        geometry->setColorBinding( osg::Geometry::BIND_PER_VERTEX );
>> -    }
>> -
>> -    // line width
>> -    osg::StateSet* stateset = geometry->getOrCreateStateSet();
>> -    stateset->setAttributeAndModes( new osg::LineWidth( thickness ), osg::StateAttribute::ON );
>> -    stateset->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
>> -
>> -    osg::ref_ptr< osg::Geode > geode = osg::ref_ptr< osg::Geode >( new osg::Geode );
>> -    geode->addDrawable( geometry );
>> -    return geode;
>> -}
>> -
>>  osg::ref_ptr< osg::PositionAttitudeTransform > wge::addLabel( osg::Vec3 position, std::string text )
>>  {
>>      osg::ref_ptr< osgText::Text > label = osg::ref_ptr< osgText::Text >( new osgText::Text() );
>> @@ -603,58 +527,6 @@
>>      return geode;
>>  }
>>  
>> -osg::ref_ptr< WGESubdividedPlane > wge::genUnitSubdividedPlane( size_t resX, size_t resY, double spacing )
>> -{
>> -    WAssert( resX > 0 && resY > 0, "A Plane with no quad is not supported, use another datatype for that!" );
>> -    double dx = ( resX > 1 ? 1.0 / ( resX - 1 ) : 1.0 );
>> -    double dy = ( resY > 1 ? 1.0 / ( resY - 1 ) : 1.0 );
>> -
>> -    size_t numQuads = resX * resY;
>> -
>> -    using osg::ref_ptr;
>> -    ref_ptr< osg::Vec3Array > vertices = ref_ptr< osg::Vec3Array >( new osg::Vec3Array( numQuads * 4 ) );
>> -    ref_ptr< osg::Vec3Array > centers = ref_ptr< osg::Vec3Array >( new osg::Vec3Array( numQuads ) );
>> -    ref_ptr< osg::Vec4Array > colors   = ref_ptr< osg::Vec4Array >( new osg::Vec4Array( numQuads ) );
>> -
>> -    for( size_t yQuad = 0; yQuad < resY; ++yQuad )
>> -    {
>> -        for( size_t xQuad = 0; xQuad < resX; ++xQuad )
>> -        {
>> -            size_t qIndex = yQuad * resX + xQuad;
>> -            size_t vIndex = qIndex * 4; // since there are 4 corners
>> -            vertices->at( vIndex     ) = osg::Vec3( xQuad * dx + spacing,      yQuad * dy + spacing,      0.0 );
>> -            vertices->at( vIndex + 1 ) = osg::Vec3( xQuad * dx + dx - spacing, yQuad * dy + spacing,      0.0 );
>> -            vertices->at( vIndex + 2 ) = osg::Vec3( xQuad * dx + dx - spacing, yQuad * dy + dy - spacing, 0.0 );
>> -            vertices->at( vIndex + 3 ) = osg::Vec3( xQuad * dx + spacing,      yQuad * dy + dy - spacing, 0.0 );
>> -            centers->at( qIndex ) = osg::Vec3( xQuad * dx + dx / 2.0, yQuad * dy + dy / 2.0, 0.0 );
>> -            colors->at( qIndex ) = osg::Vec4( 0.1 +  static_cast< double >( qIndex ) / numQuads * 0.6,
>> -                                              0.1 +  static_cast< double >( qIndex ) / numQuads * 0.6,
>> -                                              1.0, 1.0 );
>> -        }
>> -    }
>> -
>> -    ref_ptr< osg::Geometry >  geometry = ref_ptr< osg::Geometry >( new osg::Geometry );
>> -    geometry->addPrimitiveSet( new osg::DrawArrays( osg::PrimitiveSet::QUADS, 0, vertices->size() ) );
>> -    geometry->setVertexArray( vertices );
>> -    geometry->setColorArray( colors );
>> -    geometry->setColorBinding( osg::Geometry::BIND_PER_PRIMITIVE );
>> -
>> -    ref_ptr< osg::Vec3Array > normals = ref_ptr< osg::Vec3Array >( new osg::Vec3Array );
>> -    normals->push_back( osg::Vec3( 0.0, 0.0, 1.0 ) );
>> -    geometry->setNormalArray( normals );
>> -    geometry->setNormalBinding( osg::Geometry::BIND_OVERALL );
>> -    osg::ref_ptr< WGESubdividedPlane > geode = osg::ref_ptr< WGESubdividedPlane >( new WGESubdividedPlane );
>> -    geode->addDrawable( geometry );
>> -    geode->setCenterArray( centers );
>> -
>> -    // we need to disable light, since the order of the vertices may be wrong and with lighting you won't see anything but black surfaces
>> -    osg::StateSet* state = geode->getOrCreateStateSet();
>> -    state->setMode( GL_BLEND, osg::StateAttribute::ON );
>> -    state->setMode( GL_LIGHTING, osg::StateAttribute::OFF | osg::StateAttribute::PROTECTED );
>> -
>> -    return geode;
>> -}
>> -
>>  osg::ref_ptr< osg::Group > wge::creatCoordinateSystem(
>>      osg::Vec3 middle,
>>      double sizeX,
>> diff -r 99d0a2bf8c94 -r be8c00844980 src/core/graphicsEngine/WGEGeodeUtils.h
>> --- a/src/core/graphicsEngine/WGEGeodeUtils.h	Thu Aug 08 13:02:31 2013 +0200
>> +++ b/src/core/graphicsEngine/WGEGeodeUtils.h	Thu Aug 08 13:18:04 2013 +0200
>> @@ -129,18 +129,6 @@
>>                                                                     );
>>  
>>      /**
>> -     * Extract the vertices and triangles from a WTriangleMesh and save them
>> -     * into an osg::Geometry. It uses per triangle normals.
>> -     *
>> -     * \param mesh the WTriangleMesh used as input
>> -     * \param color This color is used for all vertices
>> -     * \return an osg::Geometry containing the mesh
>> -     * \note mesh cannot be const since osg::Geometry needs non-const pointers to the contained arrays
>> -     */
>> -    osg::ref_ptr< osg::Geometry > convertMeshToOsgGeometryFlat( WTriangleMesh::SPtr mesh,
>> -                                                                const WColor& color = WColor( 1.0, 1.0, 1.0, 1.0 ) );
>> -
>> -    /**
>>       * Convert triangle mesh to lines representing it. Draws lines twice (ATM).
>>       *
>>       * \param mesh The WTriangleMesh used as input.
>> @@ -153,20 +141,6 @@
>>                                                               const WColor& defaultColor = WColor( 1.0, 1.0, 1.0, 1.0 ),
>>                                                               bool useMeshColor = true );
>>  
>> -
>> -    /**
>> -     * Generates a line geode with thickness and color as parameters.
>> -     *
>> -     * \param line sequence of points
>> -     * \param thickness How thick the line strip should be
>> -     * \param color If present this color is used for the whole line, otherwise local coloring is used
>> -     *
>> -     * \return The new assembled geode for this line
>> -     */
>> -    osg::ref_ptr< osg::Geode > generateLineStripGeode( const WLine& line,
>> -                                                                  const float thickness = 3.0f,
>> -                                                                  const WColor& color = WColor( 0, 0, 0, 0 ) );
>> -
>>      /**
>>       * helper function to add a label somewhere
>>       *
>> @@ -229,72 +203,6 @@
>>       * \return the geode
>>       */
>>      osg::ref_ptr< osg::Geode > genFinitePlane( osg::Vec3 const& base, osg::Vec3 const& a, osg::Vec3 const& b );
>> -
>> -    /**
>> -     * Generates a plane subdivided into quads.
>> -     *
>> -     * \param resX How many quads in x-direction
>> -     * \param resY How many quads in y-direction
>> -     * \param spacing Not implement yet
>> -     *
>> -     * \return The new uncolored plane geode
>> -     */
>> -    osg::ref_ptr< WGESubdividedPlane > genUnitSubdividedPlane( size_t resX, size_t resY, double spacing = 0.01 );
>> -
>> -    /**
>> -     * For each points in the STL container generate small cubes.
>> -     *
>> -     * \param points Center point of the cubes
>> -     * \param size The size of the cubes
>> -     * \param color The color of the cubes
>> -     * \tparam An STL container with WPositions as elements ( don't try it with different than vector, set, list or queue )
>> -     *
>> -     * \return Geode with as many cubes as points in the container where each cube is around a certain position.
>> -     */
>> -    template< class Container > osg::ref_ptr< osg::Geode > genPointBlobs( boost::shared_ptr< Container > points,
>> -                                                                          double size,
>> -                                                                          const WColor& color = WColor( 1.0, 0.0, 0.0, 1.0 ) );
>>  } // end of namespace wge
>>  
>> -template< class Container > inline osg::ref_ptr< osg::Geode > wge::genPointBlobs( boost::shared_ptr< Container > points,
>> -                                                                                  double size,
>> -                                                                                  const WColor& color )
>> -{
>> -    osg::ref_ptr< osg::Vec3Array > vertices = osg::ref_ptr< osg::Vec3Array >( new osg::Vec3Array );
>> -    osg::ref_ptr< osg::Vec4Array > colors   = osg::ref_ptr< osg::Vec4Array >( new osg::Vec4Array );
>> -    osg::ref_ptr< osg::Geometry >  geometry = osg::ref_ptr< osg::Geometry >( new osg::Geometry );
>> -    osg::ref_ptr< osg::Vec3Array > normals  = osg::ref_ptr< osg::Vec3Array >( new osg::Vec3Array );
>> -
>> -    for( typename Container::const_iterator point = points->begin(); point != points->end(); ++point )
>> -    {
>> -        const WPosition& pos = *point;
>> -        std::vector< WPosition > corners;
>> -        corners.reserve( 8 );
>> -        double halfSize = size / 2.0;
>> -        corners.push_back( WPosition( pos[0] - halfSize, pos[1] - halfSize, pos[2] - halfSize ) );
>> -        corners.push_back( WPosition( pos[0] + halfSize, pos[1] - halfSize, pos[2] - halfSize ) );
>> -        corners.push_back( WPosition( pos[0] + halfSize, pos[1] - halfSize, pos[2] + halfSize ) );
>> -        corners.push_back( WPosition( pos[0] - halfSize, pos[1] - halfSize, pos[2] + halfSize ) );
>> -        corners.push_back( WPosition( pos[0] - halfSize, pos[1] + halfSize, pos[2] - halfSize ) );
>> -        corners.push_back( WPosition( pos[0] + halfSize, pos[1] + halfSize, pos[2] - halfSize ) );
>> -        corners.push_back( WPosition( pos[0] + halfSize, pos[1] + halfSize, pos[2] + halfSize ) );
>> -        corners.push_back( WPosition( pos[0] - halfSize, pos[1] + halfSize, pos[2] + halfSize ) );
>> -
>> -        osg::ref_ptr< osg::Vec3Array > ver = generateCuboidQuads( corners );
>> -        vertices->insert( vertices->end(), ver->begin(), ver->end() );
>> -        osg::ref_ptr< osg::Vec3Array > nor = generateCuboidQuadNormals( corners );
>> -        normals->insert( normals->end(), nor->begin(), nor->end() );
>> -        geometry->addPrimitiveSet( new osg::DrawArrays( osg::PrimitiveSet::QUADS, vertices->size() - ver->size(), ver->size() ) );
>> -    }
>> -
>> -    geometry->setVertexArray( vertices );
>> -    colors->push_back( color );
>> -    geometry->setColorArray( colors );
>> -    geometry->setColorBinding( osg::Geometry::BIND_OVERALL );
>> -    geometry->setNormalArray( normals );
>> -    geometry->setNormalBinding( osg::Geometry::BIND_PER_PRIMITIVE );
>> -    osg::ref_ptr< osg::Geode > geode = osg::ref_ptr< osg::Geode >( new osg::Geode );
>> -    geode->addDrawable( geometry );
>> -    return geode;
>> -}
>>  #endif  // WGEGEODEUTILS_H
>> diff -r 99d0a2bf8c94 -r be8c00844980 src/core/graphicsEngine/WROIArbitrary.cpp
>> --- a/src/core/graphicsEngine/WROIArbitrary.cpp	Thu Aug 08 13:02:31 2013 +0200
>> +++ b/src/core/graphicsEngine/WROIArbitrary.cpp	Thu Aug 08 13:18:04 2013 +0200
>> @@ -163,7 +163,7 @@
>>          // ------------------------------------------------
>>          // normals
>>          surfaceGeometry->setNormalArray( m_triMesh->getTriangleNormalArray() );
>> -        surfaceGeometry->setNormalBinding( osg::Geometry::BIND_PER_PRIMITIVE );
>> +        // surfaceGeometry->setNormalBinding( osg::Geometry::BIND_PER_PRIMITIVE );
>>  
>>          // ------------------------------------------------
>>          // colors
>> diff -r 99d0a2bf8c94 -r be8c00844980 src/core/graphicsEngine/WROIBox.cpp
>> --- a/src/core/graphicsEngine/WROIBox.cpp	Thu Aug 08 13:02:31 2013 +0200
>> +++ b/src/core/graphicsEngine/WROIBox.cpp	Thu Aug 08 13:18:04 2013 +0200
>> @@ -199,7 +199,7 @@
>>      osg::ref_ptr<osg::Vec3Array> normals = osg::ref_ptr<osg::Vec3Array>( new osg::Vec3Array );
>>      setNormals( normals );
>>      m_surfaceGeometry->setNormalArray( normals );
>> -    m_surfaceGeometry->setNormalBinding( osg::Geometry::BIND_PER_PRIMITIVE );
>> +    // m_surfaceGeometry->setNormalBinding( osg::Geometry::BIND_PER_PRIMITIVE );
>>  
>>      m_not->set( false );
>>  
>> diff -r 99d0a2bf8c94 -r be8c00844980 src/core/graphicsEngine/test/WGEGeodeUtils_test.h
>> --- a/src/core/graphicsEngine/test/WGEGeodeUtils_test.h	Thu Aug 08 13:02:31 2013 +0200
>> +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
>> @@ -1,96 +0,0 @@
>> -//---------------------------------------------------------------------------
>> -//
>> -// Project: OpenWalnut ( http://www.openwalnut.org )
>> -//
>> -// Copyright 2009 OpenWalnut Community, BSV at Uni-Leipzig and CNCF at MPI-CBS
>> -// For more information see http://www.openwalnut.org/copying
>> -//
>> -// This file is part of OpenWalnut.
>> -//
>> -// OpenWalnut is free software: you can redistribute it and/or modify
>> -// it under the terms of the GNU Lesser General Public License as published by
>> -// the Free Software Foundation, either version 3 of the License, or
>> -// (at your option) any later version.
>> -//
>> -// OpenWalnut 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
>> -// GNU Lesser General Public License for more details.
>> -//
>> -// You should have received a copy of the GNU Lesser General Public License
>> -// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
>> -//
>> -//---------------------------------------------------------------------------
>> -
>> -#ifndef WGEGEODEUTILS_TEST_H
>> -#define WGEGEODEUTILS_TEST_H
>> -
>> -#include <cxxtest/ValueTraits.h>
>> -#include <cxxtest/TestSuite.h>
>> -
>> -#include <osg/io_utils>
>> -
>> -#include "../../common/WStringUtils.h"
>> -#include "WVec3Traits.h"
>> -#include "../WGEGeodeUtils.h"
>> -
>> -/**
>> - * Testsuite for the WGEGeode utils.
>> - */
>> -class WGEGeodeUtilsTest : public CxxTest::TestSuite
>> -{
>> -public:
>> -    /**
>> -     * A unit subdivided plane with resolution width_x_height has width*height many quads.
>> -     */
>> -    void testNumQuadsAndTheirVerticesWithoutSpacing( void )
>> -    {
>> -        double spacing = 0.0;
>> -        osg::ref_ptr< WGESubdividedPlane > g = wge::genUnitSubdividedPlane( 2, 2, spacing );
>> -        osg::Geometry *geo = dynamic_cast< osg::Geometry* >( g->getDrawable( 0 ) );
>> -        if( !geo )
>> -        {
>> -            TS_FAIL( "The drawable inside the WGESubdividedPlane geode is not a geometry" );
>> -        }
>> -        TS_ASSERT( geo );
>> -        osg::Vec3Array* verts =  dynamic_cast< osg::Vec3Array* >( geo->getVertexArray() );
>> -        if( !verts )
>> -        {
>> -            TS_FAIL( "The vertex array inside is not a osg::Vec3Array" );
>> -        }
>> -        osg::ref_ptr< osg::Vec3Array > expected = osg::ref_ptr< osg::Vec3Array >( new osg::Vec3Array );
>> -        expected->push_back( osg::Vec3( 0.0, 0.0, 0.0 ) );
>> -        expected->push_back( osg::Vec3( 1.0, 0.0, 0.0 ) );
>> -        expected->push_back( osg::Vec3( 1.0, 1.0, 0.0 ) );
>> -        expected->push_back( osg::Vec3( 0.0, 1.0, 0.0 ) );
>> -        expected->push_back( osg::Vec3( 1.0, 0.0, 0.0 ) );
>> -        expected->push_back( osg::Vec3( 2.0, 0.0, 0.0 ) );
>> -        expected->push_back( osg::Vec3( 2.0, 1.0, 0.0 ) );
>> -        expected->push_back( osg::Vec3( 1.0, 1.0, 0.0 ) );
>> -        expected->push_back( osg::Vec3( 0.0, 1.0, 0.0 ) );
>> -        expected->push_back( osg::Vec3( 1.0, 1.0, 0.0 ) );
>> -        expected->push_back( osg::Vec3( 1.0, 2.0, 0.0 ) );
>> -        expected->push_back( osg::Vec3( 0.0, 2.0, 0.0 ) );
>> -        expected->push_back( osg::Vec3( 1.0, 1.0, 0.0 ) );
>> -        expected->push_back( osg::Vec3( 2.0, 1.0, 0.0 ) );
>> -        expected->push_back( osg::Vec3( 2.0, 2.0, 0.0 ) );
>> -        expected->push_back( osg::Vec3( 1.0, 2.0, 0.0 ) );
>> -        TS_ASSERT_EQUALS( verts->asVector(), expected->asVector() );
>> -    }
>> -
>> -    /**
>> -     * For each quad there is a center point defined in the center point array.
>> -     */
>> -    void testCenterPoints( void )
>> -    {
>> -        osg::ref_ptr< WGESubdividedPlane > g = wge::genUnitSubdividedPlane( 2, 2 );
>> -        osg::ref_ptr< osg::Vec3Array > expected = osg::ref_ptr< osg::Vec3Array >( new osg::Vec3Array );
>> -        expected->push_back( osg::Vec3( 0.5, 0.5, 0.0 ) );
>> -        expected->push_back( osg::Vec3( 1.5, 0.5, 0.0 ) );
>> -        expected->push_back( osg::Vec3( 0.5, 1.5, 0.0 ) );
>> -        expected->push_back( osg::Vec3( 1.5, 1.5, 0.0 ) );
>> -        TS_ASSERT_EQUALS( g->getCenterArray()->asVector(), expected->asVector() );
>> -    }
>> -};
>> -
>> -#endif  // WGEGEODEUTILS_TEST_H
>> _______________________________________________
>> All-openwalnut-commits mailing list
>> All-openwalnut-commits at lists.informatik.uni-leipzig.de
>> http://lists.informatik.uni-leipzig.de/mailman/listinfo/all-openwalnut-commits
>>
> 
> _______________________________________________
> OpenWalnut-Dev mailing list
> OpenWalnut-Dev at lists.informatik.uni-leipzig.de
> http://lists.informatik.uni-leipzig.de/mailman/listinfo/openwalnut-dev
> 
> Archive: http://lists.informatik.uni-leipzig.de/pipermail/openwalnut-dev/
> 



More information about the OpenWalnut-Dev mailing list