日期:2014-05-18  浏览次数:20940 次

如何把下面的C++代码写成C#代码?
C/C++ code

#include "stdafx.h"

#include <Inventor\Win\SoWin.h>

#include <Inventor\Win\viewers\SoWinExaminerViewer.h>

#include <Inventor\nodes\SoCube.h>

#include <Inventor\nodes\SoDirectionalLight.h>

#include <Inventor\nodes\SoMaterial.h>

#include <Inventor\nodes\SoPerspectiveCamera.h>

#include <Inventor\nodes\SoSeparator.h>

int main(int argc, char **argv)

{

         HWND myWindow = SoWin::init(argv[0]);

         if (myWindow == NULL)    exit(1);

        

         SoSeparator *root = new SoSeparator;

         root->ref();

         SoMaterial *myMaterial = new SoMaterial;

         myMaterial->diffuseColor.setValue(1.0, 0.0, 0.0);

         root->addChild(myMaterial);

         root->addChild(new SoCube);

        

         SoWinExaminerViewer *myViewer = new SoWinExaminerViewer(myWindow);

         myViewer->setSceneGraph(root);

         myViewer->setTitle("Examiner Viewer");

         myViewer->show();

        

         SoWin::show(myWindow);

         SoWin::mainLoop();

        

         return 0;

}



------解决方案--------------------
那么多头文件谁知道做啥用的
------解决方案--------------------
太扯了,很多都是非标准的东西,人家自定义的,你怎么翻译,你这代码 差的东西多了
------解决方案--------------------
Open Inventor 貌似也支持 .net
------解决方案--------------------
C# code

using OIV.Inventor.Win;
using OIV.Inventor.Win.Viewers;
using OIV.Inventor.Nodes;

class program{
   static void main(string[] args){

------解决方案--------------------
得自己写命名空间啊?
还不如,把include的东西都作为成员函数