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

发布于 2024-08-31 04:10:28 字数 104 浏览 1 评论 0原文

我正在寻找一个应用程序,它能够加载空间中的一堆点,渲染它们并能够进行简单的 3D 操作(选择这样的点,旋转和移动视口)。

源代码必须可用,因为我想将其用作我自己的应用程序的基础。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

灼疼热情 2024-09-07 04:10:28

有多种开源 3D 编辑器,但您会发现它们中的大多数都与特定的 3D 引擎相关(即 irrEdit => Irrlicht)。

有 Blender,但我怀疑它太复杂,无法找到您想要的代码。

在谷歌搜索几分钟后,我还没有找到包含源代码的 3D 编辑器的简单示例,但我找到了这个,这可能很有用:

对 3D 编辑器进行编程

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

时间你老了 2024-09-07 04:10:28

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

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.

无法言说的痛 2024-09-07 04:10:28

可以使用directX来解决这个问题。我使用 delphi 和 directX 完成了这个工作。
您也可以使用 c# 来实现它。

它可以加载空间中的一堆点
您可以根据需要读取文本文件或二进制文件并将其存储在缓冲区中来完成此操作。

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

这里,TD3DXVector3 是 directX 中的类型。

渲染它们
对于渲染,IDirect3DDevice9 有一个方法DrawPrimitive,使用它可以渲染点、线或三角形。

g_pd3dDevice.DrawPrimitive(D3DPT_TRIANGLELIST,0,count);

这里,Count是你想要绘制的三角形的数量。

选择这样的点,旋转并旋转移动视口
对于旋转和移动视口,您可以使用变换矩阵进行投影变换、视图变换和世界变换。

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.

煮酒 2024-09-07 04:10:28

Allegro 库更容易使用,除了它只有 2d 之外,不过可能有一个 DirectX 的 3d 接口。您需要了解 C++。这是随机像素的初始化文件:

您可以从 allegro.cc 获取该库并使用 Visual Studio 编译它。

编辑:
这是一个 allegroGL 示例。其allegro与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();

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();
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文