Ignore:
Timestamp:
Mar 20, 2011, 1:14:16 PM (13 years ago)
Author:
Torben Dannhauer
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • experimental/TerrainTest/myTerrainTechnique.cpp

    r255 r275  
    3232        h->setHeight( 0,0, 1000);
    3333
     34         /*
    3435         ImageLayer* il = dynamic_cast<ImageLayer*>( getTerrainTile()->getColorLayer(0) );
    3536         osg::Image* img = il->getImage();
    3637         //img->setInternalTextureFormat( GL_RGBA );
    3738
    38         /* if( img->getPixelFormat() == GL_RGBA )
     39          if( img->getPixelFormat() == GL_RGBA )
    3940                 OSG_ALWAYS << "Format ist RGBA" << std::endl;
    40          if( img->getPixelFormat() == GL_RGB )
     41          if( img->getPixelFormat() == GL_RGB )
    4142                 OSG_ALWAYS << "Format ist RGB" << std::endl;
    4243          if( img->getPixelFormat() == GL_COMPRESSED_RGB_S3TC_DXT1_EXT )
     
    4445
    4546         
    46 
    47          //osg::ref_ptr<osg::Image> img2 = new osg::Image();
    48          //img2->setInternalTextureFormat( GL_RGBA );
    49          //OSG_ALWAYS << "test: " << std::hex << img->getPixelFormat() << std::endl;
    50 
    5147    GeometryTechnique::init(dirtyMask, assumeMultiThreaded);
    5248
    53         //getTerrainTile()->getLocator()->
    54 
    55         OpenThreads::Thread::microSleep( 50000 );
     49        //OpenThreads::Thread::microSleep( 50000 );     / To simulate some complex tile modification.
    5650}
    57 
    58 void myTerrainTechnique::ConvertImage(osg::ref_ptr<osg::Image> a_toImage, osg::ref_ptr<osg::Image> a_fromImage, GLenum a_pixelFormat, GLenum a_dataType)
    59 {
    60         GLenum dataType = a_fromImage -> getDataType();
    61 
    62         //setInternalTextureFormat( 0); // tmp
    63         a_toImage -> allocateImage(
    64                 a_fromImage -> s(),
    65                 a_fromImage -> t(),
    66                 a_fromImage -> r(),
    67                 a_pixelFormat, a_dataType, a_fromImage -> getPacking());
    68 
    69         //// Wenn Quelle und Ziel RGBA sind
    70         //if( a_toImage -> getPixelFormat() == GL_RGBA && a_fromImage -> getPixelFormat() == GL_RGBA)
    71         //{
    72         //      unsigned nr = a_fromImage->t();
    73         //      unsigned nc = a_fromImage->s();
    74         //      for (unsigned r = 0; r < nr; ++r)
    75         //      {
    76         //              for (unsigned c = 0; c < nc; ++c)
    77         //              {
    78         //                      unsigned char * fromPixelData = a_fromImage -> data(c, nr-r-1);
    79         //                      unsigned char *   toPixelData =   a_toImage -> data(c, nr-r-1);
    80 
    81         //                      // Copy r, g, b, a.
    82         //                      for( int component = 0; component < 4; ++ component)
    83         //                      {
    84         //                              My_OSG_Library::OSG_PixelComponent pixelComponent( a_fromImage -> getDataType(), fromPixelData, component /* r, g, b, a */);
    85         //                              pixelComponent.Store( a_toImage -> getDataType(), toPixelData, component);
    86         //                      }
    87         //              }
    88         //      }
    89         //}
    90         //else
    91         // Wenn Quelle RGB ist und Ziel RGBA
    92         //if( a_toImage -> getPixelFormat() == GL_RGBA && a_fromImage -> getPixelFormat() == GL_RGB)
    93         //{
    94         //      unsigned nr = a_fromImage -> t();
    95         //      unsigned nc = a_fromImage -> s();
    96         //      for (unsigned r = 0; r < nr; ++r)
    97         //      {
    98         //              for (unsigned c = 0; c < nc; ++c)
    99         //              {
    100         //                      unsigned char * fromPixelData = a_fromImage -> data(c, nr-r-1);
    101         //                      unsigned char *   toPixelData =   a_toImage -> data(c, nr-r-1);
    102 
    103         //                      // Copy r, g, b.
    104         //                      for( int component = 0; component < 3; ++ component)
    105         //                      {
    106         //                              My_OSG_Library::OSG_PixelComponent pixelComponent( a_fromImage -> getDataType(), fromPixelData, component /* r, g, b */);
    107         //                              pixelComponent.Store( a_toImage -> getDataType(), toPixelData, component);
    108         //                      }
    109 
    110         //                      // Initialize alpha to opaque.
    111         //                      My_OSG_Library::OSG_PixelComponent::One().Store( a_toImage -> getDataType(), toPixelData, 3);
    112         //              }
    113         //      }
    114         //}
    115 }
Note: See TracChangeset for help on using the changeset viewer.