📄 sgyreader.cpp
字号:
// SgyReader.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include "segy.h"
#include <Inventor/Xt/SoXt.h>
#include <Inventor/Xt/viewers/SoXtExaminerViewer.h>
#include <Inventor/nodes/SoSeparator.h>
#include <VolumeViz/nodes/SoVolumeData.h>
#include <VolumeViz/nodes/SoVolumeRender.h>
#include <VolumeViz/nodes/SoTransferFunction.h>
#include <Inventor/nodes/SoMaterial.h>
int _tmain(int argc, _TCHAR* argv[])
{
// Create the window
Widget myWindow = SoXt::init(argv[0]);
if (!myWindow) return 0;
// Initialize of VolumeViz extension
SoVolumeRendering::init();
SegyDim3s thedim;
//float *data=SegyReader::getSegyDataAndChar(thedim,"f:/share/test1.sgy");
float *data=SegyReader::getSegyDataAndChar(thedim,"f:\\tang.sgy");
SoVolumeData* pVolData = new SoVolumeData();
//pVolData->setVolumeData( SbVec3s(thedim.XDIM, thedim.YDIM, thedim.ZDIM), data,SoVolumeData::UNSIGNED_SHORT);
pVolData->setVolumeData( SbVec3s(thedim.ZDIM,thedim.YDIM,thedim.XDIM), data,SoVolumeData::UNSIGNED_SHORT);
pVolData->setVolumeSize( SbBox3f(0, 0, 0,thedim.ZDIM ,thedim.YDIM,thedim.XDIM) );
// For machines where TEX3D is slow...
pVolData->storageHint = SoVolumeData::TEX2D;
// Use a predefined colorMap with the SoTransferFunction
SoTransferFunction* pTransFunc = new SoTransferFunction;
pTransFunc->predefColorMap = SoTransferFunction::SEISMIC;
// Node in charge of drawing the volume
SoVolumeRender *pVolRender = new SoVolumeRender;
// Assemble the scene graph
// Note: SoVolumeSkin must appear after the SoVolumeData node.
SoSeparator *root = new SoSeparator;
root->ref();
root->addChild( pVolData );
root->addChild( pTransFunc );
root->addChild( pVolRender );
// Set up viewer:
SoXtExaminerViewer *myViewer = new SoXtExaminerViewer(myWindow);
myViewer->setSceneGraph(root);
myViewer->setTitle("Volume Skin");
myViewer->show();
SoXt::show(myWindow);
SoXt::mainLoop();
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -