Changeset 339


Ignore:
Timestamp:
Mar 23, 2012, 10:56:17 PM (13 years ago)
Author:
Torben Dannhauer
Message:

Mesh can now be triangle_strip or quad_strip

-> important to fix vertex selector working :)

Location:
experimental/distortionNG
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • experimental/distortionNG/distortionNG.cpp

    r332 r339  
    112112                                closestVertexIndex = result.indexList[i];
    113113                        }
    114                         OSG_NOTIFY(osg::ALWAYS)<<"maxRatio="<<maxRatio<<std::endl;
    115                         OSG_NOTIFY(osg::ALWAYS)<<"closestVertexIndex="<<closestVertexIndex<<std::endl;
     114                //      OSG_NOTIFY(osg::ALWAYS)<<"maxRatio="<<maxRatio<<std::endl;
     115                //      OSG_NOTIFY(osg::ALWAYS)<<"closestVertexIndex="<<closestVertexIndex<<std::endl;
    116116                }
    117117                OSG_NOTIFY(osg::ALWAYS)<<"nearest vertex: X="<<(*vertices)[closestVertexIndex].x()<<" Y="<<(*vertices)[closestVertexIndex].y()<<" Z="<<(*vertices)[closestVertexIndex].z()<<std::endl;
  • experimental/distortionNG/extViewer.cpp

    r338 r339  
    4444                        osg::Texture2D* texture = new osg::Texture2D;
    4545            texture->setImage(image);
    46             //texture->setFilter(osg::Texture2D::MIN_FILTER, osg::Texture2D::NEAREST);
    47             //texture->setFilter(osg::Texture2D::MAG_FILTER, osg::Texture2D::NEAREST);
    48             //texture->setWrap(osg::Texture2D::WRAP_S, osg::Texture2D::CLAMP_TO_EDGE);
    49             //texture->setWrap(osg::Texture2D::WRAP_T, osg::Texture2D::CLAMP_TO_EDGE);
    5046                        texture->setFilter(osg::Texture::MIN_FILTER,osg::Texture::LINEAR);
    5147                        texture->setFilter(osg::Texture::MAG_FILTER,osg::Texture::LINEAR);
     
    152148                geom->setTexCoordArray(1,texcoords1);
    153149
    154 
     150        //// Quads grid
     151        //for ( unsigned int row=0; row<rows-1; row++ ) // each strip consists of two affected vertex rows, so we need only row-1 strips.
     152        //{
     153        //      osg::ref_ptr<osg::DrawElementsUInt> de = new osg::DrawElementsUInt(GL_QUAD_STRIP, columns*2);   // columns*2 = number of involved vertices for this strip.
     154        //      for ( unsigned int col=0; col<columns; col++ )
     155        //      {
     156        //              (*de)[col*2 + 0] = row*columns + col;
     157        //              (*de)[col*2 + 1] = (row+1)*columns + col;
     158        //      }
     159        //      geom->addPrimitiveSet( de.get() );
     160        //}
     161
     162        // Triangle grid
    155163        for ( unsigned int row=0; row<rows-1; row++ )   // each strip consists of two affected vertex rows, so we need only row-1 strips.
    156164        {
    157                 osg::ref_ptr<osg::DrawElementsUInt> de = new osg::DrawElementsUInt(GL_QUAD_STRIP, columns*2);   // columns*2 = number of involved vertices for this strip.
     165                osg::ref_ptr<osg::DrawElementsUInt> de = new osg::DrawElementsUInt(osg::PrimitiveSet::TRIANGLE_STRIP, columns * 2 );   
    158166                for ( unsigned int col=0; col<columns; col++ )
    159167                {
Note: See TracChangeset for help on using the changeset viewer.