百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
T

THREE

> 编程语言
开源

Three.js 的 c# 端口

200 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

Three.js 的 c# 端口

THREE

C# port of Three.js three.js is a very powerful, simple and useful OpenGL Graphics library. I always want to express my deep appreciation to the team that created this library.(https://github.com/mrdoob/three.js). There was a time when I wanted to show how to use these 3D geometry and mathematical theories with OpenGL libraries. In that case, the examples of three.js was a very good.

However, someone who are familiar with structural languages such as C++, Java, C#, etc find it difficult to understand how three.js works. So I decided to port three.js to C++, C#. However, it seemed that it would take too much time to port the massive examples of three.js Fortunately, I found very simple and key examples in Learning Three.js written by Jos Dirksen(https://github.com/josdirksen/learning-threejs) Most of three.js core have been completed, but some code have not yet been done because I am lazy. I don't know if I can afford it, the rest will be completed as soon as time permits.

There is C++ port of Three.js (https://github.com/hjoykim/ThreeCpp)

Example code

    public override void Load(GLControl glControl)
    {
        base.Load(glControl);

        InitRenderer();

        InitCamera();

        InitCameraController();

        scene.Background = Color.Hex(0xffffff);

        var axes = new AxesHelper(20);

        scene.Add(axes);

        var planeGeometry = new PlaneGeometry(60, 20);
        var planeMaterial = new MeshBasicMaterial() { Color = Color.Hex(0xcccccc) };
        var plane = new Mesh(planeGeometry, planeMaterial);

        plane.Rotation.X = (float)(-0.5 * Math.PI);
        plane.Position.Set(15, 0, 0);

        scene.Add(plane);

        // create a cube
        var cubeGeometry = new BoxGeometry(4, 4, 4);
        var cubeMaterial = new MeshBasicMaterial(){ Color=Color.Hex(0xff0000), Wireframe= true};
        var cube = new Mesh(cubeGeometry, cubeMaterial);

        // position the cube
        cube.Position.Set(-4, 3, 0);

        // add the cube to the scene
    
	    scene.Add(cube);

  //      // create a sphere
        var sphereGeometry = new SphereGeometry(4, 20, 20);
        var sphereMaterial = new MeshBasicMaterial() { Color = Color.Hex(0x7777ff), Wireframe = true };
        var sphere = new Mesh(sphereGeometry, sphereMaterial);

  //      // position the sphere
        sphere.Position.Set(20, 4, 2);

  //      // add the sphere to the scene
        scene.Add(sphere);

    }
    public override void Render()
    {
        controls.Update();
        this.renderer.Render(scene, camera);
    }

Example Screen Capture

All examples have a trackball controller.

Rotation : Move mouse while mouse left button pressed

Move : Move mouse while mouse middle button pressed

Zoom : Mouse scroll

Chapter01 - First Scene

Chapter02 - Geometries

Chapter03 - Lensflares Light

Chapter04 -MeshPhysicalMaterial

some examples are include DataLoader like as .obj

Chapter05-Basic-3D-Geometries-Polyhedron

Chapter06 Text Geometry, Binary Operation

Cahpter07 -All the examples have been completed, but they have not been committed yet

Chapter08 - Load Obj file with MTL

Chapter09 - Trackball controls

Chapter10 env map

Chapter11 SimplePass1

Issues· 14 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C#csharpdetnetopenglopentk

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言