查看: 1843|回复: 5

OSG_Examples_Terrain 使用 成功

[复制链接]

该用户从未签到

发表于 2010-6-2 19:50:48 | 显示全部楼层 |阅读模式
#include <osg/AlphaFunc>
#include <osg/Billboard>
#include <osg/BlendFunc>
#include <osg/Depth>
#include <osg/Geode>
#include <osg/Geometry>
#include <osg/Material>
#include <osg/Math>
#include <osg/MatrixTransform>
#include <osg/PolygonOffset>
#include <osg/Projection>
#include <osg/ShapeDrawable>
#include <osg/StateSet>
#include <osg/Switch>
#include <osg/Texture2D>
#include <osg/TexEnv>
#include <osgDB/ReadFile>
#include <osgDB/FileUtils>
#include <osgUtil/LineSegmentIntersector>
#include <osgUtil/IntersectionVisitor>
#include <osgUtil/SmoothingVisitor>
#include <osgText/Text>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgGA/StateSetManipulator>
#include <iostream>

#include <osgDB/FileUtils>
#include <osgDB/fstream>
#include <osgDB/ReadFile>
#include <osgUtil/GLObjectsVisitor>
#include <osgText/FadeText>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgGA/TrackballManipulator>
#include <osgGA/FlightManipulator>
#include <osgGA/DriveManipulator>
#include <osgGA/KeySwitchMatrixManipulator>
#include <osgGA/StateSetManipulator>
#include <osgGA/AnimationPathManipulator>
#include <osgGA/TerrainManipulator>
#include <osgTerrain/TerrainTile>
#include <osgTerrain/GeometryTechnique>
#include <osgTerrain/Layer>
#include <iostream>

#pragma comment(lib, "osgd.lib")
#pragma comment(lib, "osgDBd.lib")
#pragma comment(lib, "OpenThreadsd.lib")
#pragma comment(lib, "osgAnimationd.lib")
#pragma comment(lib, "osgFXd.lib")
#pragma comment(lib, "osgGAd.lib")
#pragma comment(lib, "osgManipulatord.lib")
#pragma comment(lib, "osgParticled.lib")
#pragma comment(lib, "osgShadowd.lib")
#pragma comment(lib, "osgSimd.lib")
#pragma comment(lib, "osgTerraind.lib")
#pragma comment(lib, "osgTextd.lib")
#pragma comment(lib, "osgUtild.lib")
#pragma comment(lib, "osgViewerd.lib")
#pragma comment(lib, "osgVolumed.lib")
#pragma comment(lib, "osgWidgetd.lib")





class FilterHandler : public osgGA::GUIEventHandler
{
public:
FilterHandler(osgTerrain::GeometryTechnique* gt):
   _gt(gt) {}
   bool handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa)
   {
    if (!_gt) return false;
    switch(ea.getEventType())
    {
    case(osgGA::GUIEventAdapter::KEYDOWN):
     {
      if (ea.getKey() == 'g')
      {
       osg::notify(osg::NOTICE)<<"Gaussian"<<std::endl;
       _gt->setFilterMatrixAs(osgTerrain::GeometryTechnique::GAUSSIAN);
       return true;
      }
      else if (ea.getKey() == 's')
      {
       osg::notify(osg::NOTICE)<<"Smooth"<<std::endl;
       _gt->setFilterMatrixAs(osgTerrain::GeometryTechnique::SMOOTH);
       return true;
      }
      else if (ea.getKey() == 'S')
      {
       osg::notify(osg::NOTICE)<<"Sharpen"<<std::endl;
       _gt->setFilterMatrixAs(osgTerrain::GeometryTechnique::SHARPEN);
       return true;
      }
      else if (ea.getKey() == '+')
      {
       _gt->setFilterWidth(_gt->getFilterWidth()*1.1);
       osg::notify(osg::NOTICE)<<"Filter width = "<<_gt->getFilterWidth()<<std::endl;
       return true;
      }
      else if (ea.getKey() == '-')
      {
       _gt->setFilterWidth(_gt->getFilterWidth()/1.1);
       osg::notify(osg::NOTICE)<<"Filter width = "<<_gt->getFilterWidth()<<std::endl;
       return true;
      }
      else if (ea.getKey() == '>')
      {
       _gt->setFilterBias(_gt->getFilterBias()+0.1);
       osg::notify(osg::NOTICE)<<"Filter bias = "<<_gt->getFilterBias()<<std::endl;
       return true;
      }
      else if (ea.getKey() == '<')
      {
       _gt->setFilterBias(_gt->getFilterBias()-0.1);
       osg::notify(osg::NOTICE)<<"Filter bias = "<<_gt->getFilterBias()<<std::endl;
       return true;
      }
      break;
     }
    default:
     break;
    }
    return false;
   }
protected:
osg:bserver_ptr<osgTerrain::GeometryTechnique> _gt;
};

class LayerHandler : public osgGA::GUIEventHandler
{
public:
LayerHandler(osgTerrain:ayer* layer):
   _layer(layer) {}
   bool handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa)
   {
    if (!_layer) return false;
    float scale = 1.2;
    switch(ea.getEventType())
    {
    case(osgGA::GUIEventAdapter::KEYDOWN):
     {
      if (ea.getKey() == 'q')
      {
       _layer->transform(0.0, scale);
       return true;
      }
      else if (ea.getKey() == 'a')
      {
       _layer->transform(0.0, 1.0f/scale);
       return true;
      }
      break;
     }
    default:
     break;
    }
    return false;
   }
protected:
osg::observer_ptr<osgTerrain::Layer> _layer;
};
int main(int argc, char** argv)
{
osg::ArgumentParser arguments(&argc, argv);
osg::ref_ptr<osg::Group> scene = new osg::Group;
// construct the viewer.
osgViewer::Viewer viewer(arguments);
// set up the camera manipulators.
{
  osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> keyswitchManipulator = new osgGA::KeySwitchMatrixManipulator;
  keyswitchManipulator->addMatrixManipulator( '1', "Trackball", new osgGA::TrackballManipulator() );
  keyswitchManipulator->addMatrixManipulator( '2', "Flight", new osgGA::FlightManipulator() );
  keyswitchManipulator->addMatrixManipulator( '3', "Drive", new osgGA:riveManipulator() );
  keyswitchManipulator->addMatrixManipulator( '4', "Terrain", new osgGA::TerrainManipulator() );
  viewer.setCameraManipulator( keyswitchManipulator.get() );
}

// add the state manipulator
viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );
// add the stats handler
viewer.addEventHandler(new osgViewer::StatsHandler);
// add the record camera path handler
viewer.addEventHandler(new osgViewer::RecordCameraPathHandler);
osg::ref_ptr<osgTerrain::TerrainTile> terrainTile = new osgTerrain::TerrainTile;
osg::ref_ptr<osgTerrain::Locator> locator = new osgTerrain::Locator;
osg::ref_ptr<osgTerrain::ValidDataOperator> validDataOperator = new osgTerrain::NoDataValue(0.0);
osg::ref_ptr<osgTerrain::Layer> lastAppliedLayer;
locator->setCoordinateSystemType(osgTerrain::Locator::GEOCENTRIC);
locator->setTransformAsExtents(-osg:I, -osg::PI*0.5, osg::PI, osg::PI*0.5);
unsigned int layerNum = 0;
std::string filterName;
osg::Texture::FilterMode filter = osg::Texture::LINEAR;
bool readParameter = false;
float minValue, maxValue;
float scale = 1.0f;
float offset = 0.0f;
terrainTile->setTreatBoundariesToValidDataAsDefaultValue(true);
//////////////////////////////
unsigned int numColumns = 38;
unsigned int numRows = 39;
unsigned int r;
unsigned int c;
// compute z range of z values of grid data so we can scale it.
float min_z = FLT_MAX;
float max_z = -FLT_MAX;
for(r=0;r<numRows;++r)
{
for(c=0;c<numColumns;++c)
{
  min_z = osg::minimum(min_z,vertex[r+c*numRows][2]);
  max_z = osg::maximum(max_z,vertex[r+c*numRows][2]);
}
}
osg::Vec3 size(1000.0, 1000.0, 1000.0);
float scale_z = size.z()/(max_z-min_z);
osg::ref_ptr<osg::HeightField> grid = new osg::HeightField;
grid->allocate(numColumns,numRows);
grid->setOrigin(osg::Vec3(0.0, 0.0, 0.0));
grid->setXInterval(size.x()/(float)(numColumns-1));
grid->setYInterval(size.y()/(float)(numRows-1));
for(r=0;r<numRows;++r)
{
  for(c=0;c<numColumns;++c)
  {
   grid->setHeight(c,r,(vertex[r+c*numRows][2]-min_z)*scale_z);
  }
}
/////////////////////////////////////////////////////////////////////////
if (grid.valid())
   {
    osg::ref_ptr<osgTerrain::HeightFieldLayer> hfl = new osgTerrain::HeightFieldLayer;
    hfl->setHeightField(grid.get());
    hfl->setLocator(locator.get());
    hfl->setValidDataOperator(validDataOperator.get());
    hfl->setMagFilter(filter);
    if (offset!=0.0f || scale!=1.0f)
    {
     hfl->transform(offset,scale);
    }
    terrainTile->setElevationLayer(hfl.get());
    lastAppliedLayer = hfl.get();
    osg::notify(osg::NOTICE)<<"created osgTerrain::HeightFieldLayer"<<std::endl;
   }
   else
   {
    osg::notify(osg::NOTICE)<<"failed to create osgTerrain::HeightFieldLayer"<<std::endl;
   }
  
////////////////////////////////
    osg::ref_ptr<osg::Image> image = osgDB::readImageFile("Images\\land_shallow_topo_2048.jpg");
   if (image.valid())
   {
    osg::ref_ptr<osgTerrain::ImageLayer> imageLayer = new osgTerrain::ImageLayer;
    imageLayer->setImage(image.get());
    imageLayer->setLocator(locator.get());
    imageLayer->setValidDataOperator(validDataOperator.get());
    imageLayer->setMagFilter(filter);
    if (offset!=0.0f || scale!=1.0f)
    {
     imageLayer->transform(offset,scale);
    }
    terrainTile->setElevationLayer(imageLayer.get());
    lastAppliedLayer = imageLayer.get();
    osg::notify(osg::NOTICE)<<"created Elevation osgTerrain::ImageLayer"<<std::endl;
   }

/////////////////////////////////////////////////
   if (image.valid())
   {
    osg::ref_ptr<osgTerrain::ImageLayer> imageLayer = new osgTerrain::ImageLayer;
    imageLayer->setImage(image.get());
    imageLayer->setLocator(locator.get());
    imageLayer->setValidDataOperator(validDataOperator.get());
    imageLayer->setMagFilter(filter);
    if (offset!=0.0f || scale!=1.0f)
    {
     imageLayer->transform(offset,scale);
    }
    terrainTile->setColorLayer(layerNum, imageLayer.get());
    lastAppliedLayer = imageLayer.get();
    osg::notify(osg::NOTICE)<<"created Color osgTerrain::ImageLayer"<<std::endl;
   }
////////////////////////////  
   osg::ref_ptr<osg::TransferFunction1D> tf = new osg::TransferFunction1D;
    maxValue = 6;
    minValue = 2;
   unsigned int numCells = 6;
   float delta = (maxValue-minValue)/float(numCells-1);
   float v = minValue;
   tf->allocate(6);
   tf->setColor(v, osg::Vec4(1.0,1.0,1.0,1.0)); v += delta;
   tf->setColor(v, osg::Vec4(1.0,0.0,1.0,1.0)); v += delta;
   tf->setColor(v, osg::Vec4(1.0,0.0,0.0,1.0)); v += delta;
   tf->setColor(v, osg::Vec4(1.0,1.0,0.0,1.0)); v += delta;
   tf->setColor(v, osg::Vec4(0.0,1.0,1.0,1.0)); v += delta;
   tf->setColor(v, osg::Vec4(0.0,1.0,0.0,1.0));
   osg::notify(osg::NOTICE)<<"--tf "<<minValue<<" "<<maxValue<<std::endl;
   terrainTile->setColorLayer(1, new osgTerrain::ContourLayer(tf.get()));


if (terrainTile.valid() && (terrainTile->getElevationLayer() || terrainTile->getColorLayer(0)))
{
  osg::notify(osg::NOTICE)<<"Terrain created"<<std::endl;
  scene->addChild(terrainTile.get());
  osg::ref_ptr<osgTerrain::GeometryTechnique> geometryTechnique = new osgTerrain::GeometryTechnique;
  terrainTile->setTerrainTechnique(geometryTechnique.get());
  viewer.addEventHandler(new FilterHandler(geometryTechnique.get()));
  viewer.addEventHandler(new LayerHandler(lastAppliedLayer.get()));
}
viewer.setSceneData(scene.get());
// realize the graphics windows.
viewer.realize();
// run the viewers main loop
return viewer.run();
}

该用户从未签到

 楼主| 发表于 2010-6-2 19:53:31 | 显示全部楼层
static float vertex[][3] = {
{ 5998.7998, 41456.1016,   1.7800 },
{ 5998.7998, 41456.3984,   1.8200 },
{ 5998.7998, 41456.6992,   1.8600 },
{ 5998.7998, 41457.0000,   1.8800 },
{ 5998.7998, 41457.3008,   1.9000 },
{ 5998.7998, 41457.6016,   1.9000 },
{ 5998.7998, 41457.8984,   1.8900 },
{ 5998.7998, 41458.1992,   1.8800 },
{ 5998.7998, 41458.5000,   1.8600 },
{ 5998.7998, 41458.8008,   1.8500 },
{ 5998.7998, 41459.1016,   1.8300 },
{ 5998.7998, 41459.3984,   1.8100 },
{ 5998.7998, 41459.6992,   1.7800 },
{ 5998.7998, 41460.0000,   1.7500 },
{ 5998.7998, 41460.3008,   1.7300 },
{ 5998.7998, 41460.6016,   1.7100 },
{ 5998.7998, 41460.8984,   1.7000 },
{ 5998.7998, 41461.1992,   1.6900 },
{ 5998.7998, 41461.5000,   1.7000 },
{ 5998.7998, 41461.8008,   1.7400 },
{ 5998.7998, 41462.1016,   1.7900 },
{ 5998.7998, 41462.3984,   1.8600 },
{ 5998.7998, 41462.6992,   1.9400 },
{ 5998.7998, 41463.0000,   1.9900 },
{ 5998.7998, 41463.3008,   2.0200 },
{ 5998.7998, 41463.6016,   2.0300 },
{ 5998.7998, 41463.8984,   2.0300 },
{ 5998.7998, 41464.1992,   2.0200 },
{ 5998.7998, 41464.5000,   2.0100 },
{ 5998.7998, 41464.8008,   1.9900 },
{ 5998.7998, 41465.1016,   1.9700 },
{ 5998.7998, 41465.3984,   1.9600 },
{ 5998.7998, 41465.6992,   1.9500 },
{ 5998.7998, 41466.0000,   1.9500 },
{ 5998.7998, 41466.3008,   1.9500 },
{ 5998.7998, 41466.6016,   1.9500 },
{ 5998.7998, 41466.8984,   1.9400 },
{ 5998.7998, 41467.1992,   1.9300 },
{ 5998.7998, 41467.5000,   1.9200 },
{ 5999.1001, 41456.1016,   1.8600 },
{ 5999.1001, 41456.3984,   1.9100 },
{ 5999.1001, 41456.6992,   1.9600 },
{ 5999.1001, 41457.0000,   1.9900 },
{ 5999.1001, 41457.3008,   2.0100 },
{ 5999.1001, 41457.6016,   2.0000 },
{ 5999.1001, 41457.8984,   1.9700 },
{ 5999.1001, 41458.1992,   1.9400 },
{ 5999.1001, 41458.5000,   1.9100 },
{ 5999.1001, 41458.8008,   1.8700 },
{ 5999.1001, 41459.1016,   1.8400 },
{ 5999.1001, 41459.3984,   1.8000 },
{ 5999.1001, 41459.6992,   1.7700 },
{ 5999.1001, 41460.0000,   1.7400 },
{ 5999.1001, 41460.3008,   1.7300 },
{ 5999.1001, 41460.6016,   1.7200 },
{ 5999.1001, 41460.8984,   1.7200 },
{ 5999.1001, 41461.1992,   1.7300 },
{ 5999.1001, 41461.5000,   1.7600 },
{ 5999.1001, 41461.8008,   1.7900 },
{ 5999.1001, 41462.1016,   1.8300 },
{ 5999.1001, 41462.3984,   1.8700 },
{ 5999.1001, 41462.6992,   1.9100 },
{ 5999.1001, 41463.0000,   1.9400 },
{ 5999.1001, 41463.3008,   1.9700 },
{ 5999.1001, 41463.6016,   1.9900 },
{ 5999.1001, 41463.8984,   2.0100 },
{ 5999.1001, 41464.1992,   2.0200 },
{ 5999.1001, 41464.5000,   2.0100 },
{ 5999.1001, 41464.8008,   1.9900 },
{ 5999.1001, 41465.1016,   1.9700 },
{ 5999.1001, 41465.3984,   1.9600 },
{ 5999.1001, 41465.6992,   1.9600 },
{ 5999.1001, 41466.0000,   1.9600 },
{ 5999.1001, 41466.3008,   1.9600 },
{ 5999.1001, 41466.6016,   1.9600 },
{ 5999.1001, 41466.8984,   1.9600 },
{ 5999.1001, 41467.1992,   1.9600 },
{ 5999.1001, 41467.5000,   1.9600 },
{ 5999.3999, 41456.1016,   1.9200 },
{ 5999.3999, 41456.3984,   1.9800 },
{ 5999.3999, 41456.6992,   2.0300 },
{ 5999.3999, 41457.0000,   2.0600 },
{ 5999.3999, 41457.3008,   2.0700 },
{ 5999.3999, 41457.6016,   2.0500 },
{ 5999.3999, 41457.8984,   2.0100 },
{ 5999.3999, 41458.1992,   1.9700 },
{ 5999.3999, 41458.5000,   1.9200 },
{ 5999.3999, 41458.8008,   1.8700 },
{ 5999.3999, 41459.1016,   1.8300 },
{ 5999.3999, 41459.3984,   1.7900 },
{ 5999.3999, 41459.6992,   1.7500 },
{ 5999.3999, 41460.0000,   1.7300 },
{ 5999.3999, 41460.3008,   1.7200 },
{ 5999.3999, 41460.6016,   1.7200 },
{ 5999.3999, 41460.8984,   1.7400 },
{ 5999.3999, 41461.1992,   1.7700 },
{ 5999.3999, 41461.5000,   1.8100 },
{ 5999.3999, 41461.8008,   1.8400 },
{ 5999.3999, 41462.1016,   1.8700 },
{ 5999.3999, 41462.3984,   1.8900 },
{ 5999.3999, 41462.6992,   1.9100 },
{ 5999.3999, 41463.0000,   1.9200 },
{ 5999.3999, 41463.3008,   1.9400 },
{ 5999.3999, 41463.6016,   1.9700 },
{ 5999.3999, 41463.8984,   2.0000 },
{ 5999.3999, 41464.1992,   2.0100 },
{ 5999.3999, 41464.5000,   2.0100 },
{ 5999.3999, 41464.8008,   2.0000 },
{ 5999.3999, 41465.1016,   1.9800 },
{ 5999.3999, 41465.3984,   1.9700 },
{ 5999.3999, 41465.6992,   1.9700 },
{ 5999.3999, 41466.0000,   1.9700 },
{ 5999.3999, 41466.3008,   1.9800 },
{ 5999.3999, 41466.6016,   1.9800 },
{ 5999.3999, 41466.8984,   1.9900 },
{ 5999.3999, 41467.1992,   1.9900 },
{ 5999.3999, 41467.5000,   2.0100 },
{ 5999.7002, 41456.1016,   1.9800 },
{ 5999.7002, 41456.3984,   2.0300 },
{ 5999.7002, 41456.6992,   2.0700 },
{ 5999.7002, 41457.0000,   2.0900 },
{ 5999.7002, 41457.3008,   2.0800 },
{ 5999.7002, 41457.6016,   2.0500 },
{ 5999.7002, 41457.8984,   2.0000 },
{ 5999.7002, 41458.1992,   1.9500 },
{ 5999.7002, 41458.5000,   1.9000 },
{ 5999.7002, 41458.8008,   1.8400 },
{ 5999.7002, 41459.1016,   1.8000 },
{ 5999.7002, 41459.3984,   1.7600 },
{ 5999.7002, 41459.6992,   1.7200 },
{ 5999.7002, 41460.0000,   1.7100 },
{ 5999.7002, 41460.3008,   1.7100 },
{ 5999.7002, 41460.6016,   1.7200 },
{ 5999.7002, 41460.8984,   1.7500 },
{ 5999.7002, 41461.1992,   1.8000 },
{ 5999.7002, 41461.5000,   1.8600 },
{ 5999.7002, 41461.8008,   1.9000 },
{ 5999.7002, 41462.1016,   1.9300 },
{ 5999.7002, 41462.3984,   1.9400 },
{ 5999.7002, 41462.6992,   1.9400 },
{ 5999.7002, 41463.0000,   1.9500 },
{ 5999.7002, 41463.3008,   1.9600 },
{ 5999.7002, 41463.6016,   1.9800 },
{ 5999.7002, 41463.8984,   2.0000 },
{ 5999.7002, 41464.1992,   2.0100 },
{ 5999.7002, 41464.5000,   2.0100 },
{ 5999.7002, 41464.8008,   2.0000 },
{ 5999.7002, 41465.1016,   1.9900 },
{ 5999.7002, 41465.3984,   1.9800 },
{ 5999.7002, 41465.6992,   1.9800 },
{ 5999.7002, 41466.0000,   1.9900 },
{ 5999.7002, 41466.3008,   2.0000 },
{ 5999.7002, 41466.6016,   2.0100 },
{ 5999.7002, 41466.8984,   2.0200 },
{ 5999.7002, 41467.1992,   2.0400 },
{ 5999.7002, 41467.5000,   2.0600 },
{ 6000.0000, 41456.1016,   2.0200 },
{ 6000.0000, 41456.3984,   2.0400 },
{ 6000.0000, 41456.6992,   2.0600 },
{ 6000.0000, 41457.0000,   2.0600 },
{ 6000.0000, 41457.3008,   2.0400 },
{ 6000.0000, 41457.6016,   2.0000 },
{ 6000.0000, 41457.8984,   1.9500 },
{ 6000.0000, 41458.1992,   1.9000 },
{ 6000.0000, 41458.5000,   1.8400 },
{ 6000.0000, 41458.8008,   1.7900 },
{ 6000.0000, 41459.1016,   1.7500 },
{ 6000.0000, 41459.3984,   1.7100 },
{ 6000.0000, 41459.6992,   1.6900 },
{ 6000.0000, 41460.0000,   1.6800 },
{ 6000.0000, 41460.3008,   1.6900 },
{ 6000.0000, 41460.6016,   1.7200 },
{ 6000.0000, 41460.8984,   1.7600 },
{ 6000.0000, 41461.1992,   1.8200 },
{ 6000.0000, 41461.5000,   1.8800 },
{ 6000.0000, 41461.8008,   1.9300 },
{ 6000.0000, 41462.1016,   1.9600 },
{ 6000.0000, 41462.3984,   1.9600 },
{ 6000.0000, 41462.6992,   1.9600 },
{ 6000.0000, 41463.0000,   1.9600 },
{ 6000.0000, 41463.3008,   1.9700 },
{ 6000.0000, 41463.6016,   1.9900 },
{ 6000.0000, 41463.8984,   2.0100 },
{ 6000.0000, 41464.1992,   2.0200 },
{ 6000.0000, 41464.5000,   2.0200 },
{ 6000.0000, 41464.8008,   2.0100 },
{ 6000.0000, 41465.1016,   1.9900 },
{ 6000.0000, 41465.3984,   1.9900 },
{ 6000.0000, 41465.6992,   1.9900 },
{ 6000.0000, 41466.0000,   2.0000 },
{ 6000.0000, 41466.3008,   2.0200 },
{ 6000.0000, 41466.6016,   2.0400 },
{ 6000.0000, 41466.8984,   2.0600 },
{ 6000.0000, 41467.1992,   2.0800 },
{ 6000.0000, 41467.5000,   2.1000 },
{ 6000.2998, 41456.1016,   2.0600 },
{ 6000.2998, 41456.3984,   2.0700 },
{ 6000.2998, 41456.6992,   2.0700 },
{ 6000.2998, 41457.0000,   2.0500 },
{ 6000.2998, 41457.3008,   2.0200 },
{ 6000.2998, 41457.6016,   1.9700 },
{ 6000.2998, 41457.8984,   1.9000 },
{ 6000.2998, 41458.1992,   1.8400 },
{ 6000.2998, 41458.5000,   1.7800 },
{ 6000.2998, 41458.8008,   1.7400 },
{ 6000.2998, 41459.1016,   1.7000 },
{ 6000.2998, 41459.3984,   1.6800 },
{ 6000.2998, 41459.6992,   1.6700 },
{ 6000.2998, 41460.0000,   1.6700 },
{ 6000.2998, 41460.3008,   1.6800 },
{ 6000.2998, 41460.6016,   1.7100 },
{ 6000.2998, 41460.8984,   1.7400 },
{ 6000.2998, 41461.1992,   1.7800 },
{ 6000.2998, 41461.5000,   1.8300 },
{ 6000.2998, 41461.8008,   1.8700 },
{ 6000.2998, 41462.1016,   1.8900 },
{ 6000.2998, 41462.3984,   1.9000 },
{ 6000.2998, 41462.6992,   1.9000 },
{ 6000.2998, 41463.0000,   1.9100 },
{ 6000.2998, 41463.3008,   1.9300 },
{ 6000.2998, 41463.6016,   1.9500 },
{ 6000.2998, 41463.8984,   1.9800 },
{ 6000.2998, 41464.1992,   2.0000 },
{ 6000.2998, 41464.5000,   2.0100 },
{ 6000.2998, 41464.8008,   2.0100 },
{ 6000.2998, 41465.1016,   2.0000 },
{ 6000.2998, 41465.3984,   2.0000 },
{ 6000.2998, 41465.6992,   2.0000 },
{ 6000.2998, 41466.0000,   2.0200 },
{ 6000.2998, 41466.3008,   2.0400 },
{ 6000.2998, 41466.6016,   2.0600 },
{ 6000.2998, 41466.8984,   2.0800 },
{ 6000.2998, 41467.1992,   2.1100 },
{ 6000.2998, 41467.5000,   2.1300 },
{ 6000.6001, 41456.1016,   2.1000 },
{ 6000.6001, 41456.3984,   2.1100 },
{ 6000.6001, 41456.6992,   2.1000 },
{ 6000.6001, 41457.0000,   2.0700 },
{ 6000.6001, 41457.3008,   2.0200 },
{ 6000.6001, 41457.6016,   1.9500 },
{ 6000.6001, 41457.8984,   1.8700 },
{ 6000.6001, 41458.1992,   1.8000 },
{ 6000.6001, 41458.5000,   1.7400 },
{ 6000.6001, 41458.8008,   1.7000 },
{ 6000.6001, 41459.1016,   1.6800 },
{ 6000.6001, 41459.3984,   1.6600 },
{ 6000.6001, 41459.6992,   1.6600 },
{ 6000.6001, 41460.0000,   1.6700 },
{ 6000.6001, 41460.3008,   1.6800 },
{ 6000.6001, 41460.6016,   1.7000 },
{ 6000.6001, 41460.8984,   1.7200 },
{ 6000.6001, 41461.1992,   1.7400 },
{ 6000.6001, 41461.5000,   1.7700 },
{ 6000.6001, 41461.8008,   1.7900 },
{ 6000.6001, 41462.1016,   1.8100 },
{ 6000.6001, 41462.3984,   1.8200 },
{ 6000.6001, 41462.6992,   1.8200 },
{ 6000.6001, 41463.0000,   1.8400 },
{ 6000.6001, 41463.3008,   1.8600 },
{ 6000.6001, 41463.6016,   1.9000 },
{ 6000.6001, 41463.8984,   1.9400 },
{ 6000.6001, 41464.1992,   1.9600 },
{ 6000.6001, 41464.5000,   1.9800 },
{ 6000.6001, 41464.8008,   1.9900 },
{ 6000.6001, 41465.1016,   2.0000 },
{ 6000.6001, 41465.3984,   2.0100 },
{ 6000.6001, 41465.6992,   2.0200 },
{ 6000.6001, 41466.0000,   2.0400 },
{ 6000.6001, 41466.3008,   2.0600 },
{ 6000.6001, 41466.6016,   2.0900 },
{ 6000.6001, 41466.8984,   2.1100 },
{ 6000.6001, 41467.1992,   2.1300 },
{ 6000.6001, 41467.5000,   2.1600 },
{ 6000.8999, 41456.1016,   2.1000 },
{ 6000.8999, 41456.3984,   2.1000 },
{ 6000.8999, 41456.6992,   2.0800 },
{ 6000.8999, 41457.0000,   2.0500 },
{ 6000.8999, 41457.3008,   2.0000 },
{ 6000.8999, 41457.6016,   1.9200 },
{ 6000.8999, 41457.8984,   1.8400 },
{ 6000.8999, 41458.1992,   1.7800 },
{ 6000.8999, 41458.5000,   1.7200 },
{ 6000.8999, 41458.8008,   1.6900 },
{ 6000.8999, 41459.1016,   1.6700 },
{ 6000.8999, 41459.3984,   1.6600 },
{ 6000.8999, 41459.6992,   1.6600 },
{ 6000.8999, 41460.0000,   1.6700 },
{ 6000.8999, 41460.3008,   1.6800 },
{ 6000.8999, 41460.6016,   1.6900 },
{ 6000.8999, 41460.8984,   1.7100 },
{ 6000.8999, 41461.1992,   1.7200 },
{ 6000.8999, 41461.5000,   1.7300 },
{ 6000.8999, 41461.8008,   1.7400 },
{ 6000.8999, 41462.1016,   1.7500 },
{ 6000.8999, 41462.3984,   1.7600 },
{ 6000.8999, 41462.6992,   1.7700 },
{ 6000.8999, 41463.0000,   1.7900 },




};

该用户从未签到

 楼主| 发表于 2010-6-2 19:55:29 | 显示全部楼层
上面的vertex 在 OSG_Examples_Forest中有,考一下放在上面的代码中就可以运行了

该用户从未签到

发表于 2010-7-26 18:13:51 | 显示全部楼层
学习了

该用户从未签到

发表于 2010-12-3 10:22:27 | 显示全部楼层
高手,新手请教下面几句话的意思:
1 setTransformAsExtents
2 setTreatBoundariesToValidDataAsDefaultValue
3 setOrigin(osg::Vec3(0.0, 0.0, 0.0));
4 setXInterval
5 setFilterMatrixAs(osgTerrain::GeometryTechnique::GAUSSIAN);

该用户从未签到

发表于 2010-12-3 10:23:12 | 显示全部楼层
高手,新手请教下面几句话的意思:
1 setTransformAsExtents
2 setTreatBoundariesToValidDataAsDefaultValue
3 setOrigin(osg::Vec3(0.0, 0.0, 0.0));
4 setXInterval
5 setFilterMatrixAs(osgTerrain::GeometryTechnique::GAUSSIAN);
您需要登录后才可以回帖 登录 | 注册

本版积分规则

OSG中国官方论坛-有您OSG在中国才更好

网站简介:osgChina是国内首个三维相关技术开源社区,旨在为国内更多的技术开发人员提供最前沿的技术资讯,为更多的三维从业者提供一个学习、交流的技术平台。

联系我们

  • 工作时间:09:00--18:00
  • 反馈邮箱:1315785073@qq.com
快速回复 返回顶部 返回列表