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 poin开发者_运维百科t, rotate & move viewport).
The source has to be available, as I want to use it as basis for my own application.
There are several open source 3D editors, but you'll find that most of them are associated with a particular 3D engine (i.e. 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
There is http://Clara.io, the source isn't available but it is free and you can easily write plugins to import/export in a custom format and also add your own objects in the scene.
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();
精彩评论