简体   繁体   中英

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).

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. I had done this using delphi and directX. You can implement it using c# also.

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.

render them
For rendering, there is a method DrawPrimitive of IDirect3DDevice9, using which you can render point, line or triangle.

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. You need to know C++. Heres an initialization file for random pixels:

You can get the library from allegro.cc and use visual studio to compile it.

EDIT: Heres an allegroGL example. Its allegro combined with openGL. 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).

There's Blender, but I suspect it's far too complex to find the code you want.

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:

Programming a 3D Editor

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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