open inventor 映射实例

xiaoxiao2021-03-01  7

#include <Inventor/nodes/SoMaterial.h>#include <Inventor/nodes/SoSeparator.h>#include <Inventor/nodes/SoTexture2.h>#include <Inventor/nodes/SoTexture2Transform.h>#include <Inventor/nodes/SoTextureCoordinatePlane.h>#include <Inventor/nodes/SoTranslation.h>#include <Inventor/nodes/SoCube.h>#include <Inventor/nodes/SoTextureCoordinateEnvironment.h>#include <Inventor/nodes/SoComplexity.h>#include <Inventor/nodes/SoMaterial.h>#include <Inventor/Win/SoWin.h>#include <Inventor/Win/viewers/SoWinExaminerViewer.h>int main(int, char **argv){ HWND myWindow = SoWin::init(argv[0]); if(myWindow == NULL) exit(1); SoSeparator *root = new SoSeparator; root->ref(); //选择作为纹理的图片 SoTexture2 *faceTexture = new SoTexture2; root->addChild(faceTexture); faceTexture->filename.setValue("me.rgb"); SoMaterial *myMaterial = new SoMaterial; myMaterial->diffuseColor.setValue(0.95f, 0.95f, 0.95f); myMaterial->specularColor.setValue(1.0f/3, 1.0f/3, 1.0f/3); myMaterial->shininess.setValue(0.9f); root->addChild(myMaterial); SoComplexity *com = new SoComplexity; com->value.setValue(1.0f); com->textureQuality.setValue(1.0f); root->addChild(com); SoTexture2Transform *tran = new SoTexture2Transform; tran->scaleFactor.setValue(SbVec2f(4.0f, 4.0f)); tran->translation.setValue(0.1f, 0.1f); root->addChild(tran);

SoTextureCoordinateEnvironment *texPlane1 = new SoTextureCoordinateEnvironment; root->addChild(texPlane1); root->addChild(new SoCube);

SoTranslation *trans = new SoTranslation; trans->translation.setValue(2.5f, 0.0f, 0.0f); root->addChild(trans); SoWinExaminerViewer *myViewer = new SoWinExaminerViewer(myWindow); myViewer->setSceneGraph(root); myViewer->setBackgroundColor(SbColor(0.92f, 0.92f, 0.92f)); myViewer->setTitle("texture coordinate plane"); myViewer->show(); SoWin::show(myWindow); SoWin::mainLoop();

return 0;}

http://blog.163.com/zhangmwen@126/blog/static/113437502201023193711255/

相关资源:VC与Labview、Matlab编程论文资料[3].rar
转载请注明原文地址: https://www.6miu.com/read-3650360.html

最新回复(0)