简体   繁体   English

简单的3D编辑器/查看器

[英]Simple 3D Editor/Viewer

I'm looking for an application, which could be able to load bunch of points in space, render them and be able to simple 3D operations (select such point, rotate & move viewport). 我正在寻找一个应用程序,该应用程序可以在空间中加载一堆点,渲染它们并能够进行简单的3D操作(选择此类点,旋转和移动视口)。

The source has to be available, as I want to use it as basis for my own application. 源必须可用,因为我想将其用作我自己的应用程序的基础。

这里有http://Clara.io ,该源不可用,但它是免费的,您可以轻松编写插件以自定义格式导入/导出,还可以在场景中添加自己的对象。

You can use directX to solve this problem. 您可以使用DirectX解决此问题。 I had done this using delphi and directX. 我已经使用delphi和directX做到了。 You can implement it using c# also. 您也可以使用c#来实现它。

which could be able to load bunch of points in space 这可能能够在空间中加载一堆点
You can do this by reading a textfile or binary file as you like and store it in buffer. 您可以根据需要读取文本文件或二进制文件并将其存储在缓冲区中,以实现此目的。

TD3DXVector3 temppt = D3DXVector3(X,Y,Z);

Here, TD3DXVector3 is type in directX. 在这里,TD3DXVector3是directX的类型。

render them 渲染它们
For rendering, there is a method DrawPrimitive of IDirect3DDevice9, using which you can render point, line or triangle. 对于渲染,有一种IDirect3DDevice9的DrawPrimitive方法,可以使用该方法渲染点,线或三角形。

g_pd3dDevice.DrawPrimitive(D3DPT_TRIANGLELIST,0,count);

Here, Count is the number of triangles you want to draw. 在这里,计数是您要绘制的三角形的数量。

select such point, rotate & move viewport 选择该点,旋转和移动视口
For rotation and moving viewport you can use transformation matrices for Projection transformation, View Transformation and world Transformation. 对于旋转和移动视口,可以将变换矩阵用于投影变换,视图变换和世界变换。

Allegro library is easier to use except its only 2d, there might be a 3d interface to DirectX though. Allegro库只有2d易于使用,不过DirectX可能有3d接口。 You need to know C++. 您需要了解C ++。 Heres an initialization file for random pixels: 这是随机像素的初始化文件:

You can get the library from allegro.cc and use visual studio to compile it. 您可以从allegro.cc获取库并使用Visual Studio对其进行编译。

EDIT: Heres an allegroGL example. 编辑:这是一个allegroGL示例。 Its allegro combined with openGL. 它的快板与openGL相结合。 http://www.allegro.cc/forums/thread/589211 http://www.allegro.cc/forums/thread/589211

#include <conio.h>
#include <stdlib.h>
#include "allegro.h"
int main()
{
    int x,y,x1,y1,x2,y2;
    int red, green, blue, color;

    allegro_init();

    install_keyboard();

    srand(time(NULL));

    int ret = set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640,480,0,0);
    if (ret != 0)
    {
        allegro_message(allegro_error);
        return 0;
    }

//textprintf(screen, font, 0,0,15,"Pixels program - %dx%d - press esc to quit", SCREEN_W, SCREEN_H);

    while(!key[KEY_ESC])
    {
        x = 10+rand()%(SCREEN_W - 20);
        y = 10+rand()%(SCREEN_H - 20);

        red = rand() % 255;
        green = rand() % 255;
        blue = rand() % 255;
        color = makecol(red,green,blue);
        putpixel(screen,x,y,color);
      }
      allegro_exit();
}
END_OF_MAIN();

There are several open source 3D editors, but you'll find that most of them are associated with a particular 3D engine (ie irrEdit => Irrlicht). 有几种开源3D编辑器,但是您会发现其中大多数都与特定的3D引擎关联(即irrEdit => Irrlicht)。

There's Blender, but I suspect it's far too complex to find the code you want. 有Blender,但是我怀疑它太复杂了,找不到您想要的代码。

In a few minutes of Googling, I haven't been able to find a simple example of a 3D editor with source code included, but I have found this, which may be useful: 在Google搜寻的几分钟内,我找不到包含源代码的3D编辑器的简单示例,但是我发现了这一点,这可能会很有用:

Programming a 3D Editor 编程3D编辑器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM