G3D 正在参加 2021 年度 OSC 中国开源项目评选,请投票支持!
G3D 在 2021 年度 OSC 中国开源项目评选 中已获得 {{ projectVoteCount }} 票,请投票支持!
2021 年度 OSC 中国开源项目评选 正在火热进行中,快来投票支持你喜欢的开源项目!
2021 年度 OSC 中国开源项目评选 >>> 中场回顾
G3D 获得 2021 年度 OSC 中国开源项目评选「最佳人气项目」 !
授权协议 Apache 2.0
开发语言 JavaScript
操作系统 跨平台
软件类型 开源软件
开源组织 阿里巴巴
地区 国产
投 递 者 王练
适用人群 未知
收录时间 2018-03-02

软件简介

G3D 是阿里巴巴开源的一款基于 WebGL 的 javascript 3D 绘图引擎。与其他的 WebGL 3D 引擎相比,G3D 是更加「纯粹」的渲染引擎,也就是说,它完全不依赖任何 DOM API,而是仅仅依赖一个 canvas 对象(或者类 canvas 对象)。该特性使得 G3D 不仅能够运行在浏览器环境中,也能够运行在一些非浏览器的 js 终端环境下(hybrid 环境),比如 GCanvas 环境(基于 Weex 或 ReactNative)。

Try play with G3D

function run(G3D, canvas){

    // create 3d engine
    const engine = new G3D.Engine(canvas);    // create a scene
    const scene = new G3D.Scene(engine);    
    // create camera
    const camera = new G3D.ArcRotateCamera(scene);
    camera.alpha = 45;
    camera.beta = 30;
    camera.radius = 12;
    camera.fov = 60;    
    // create 3 lights
    const light1 = new G3D.DirectionalLight(scene);
    light1.direction.x = -1;
    light1.direction.y = 0;
    light1.direction.z = 1;    
    const light2 = new G3D.HemisphereLight(scene);    
    // create mesh
    const mesh = G3D.MeshBuilder.createCube(scene, 6);    
    Object.assign(mesh.materials.default.diffuseColor, {r: 200, g: 100, b: 100});    Object.assign(mesh.materials.default.specularColor, {r: 200, g: 100, b: 100});
    mesh.materials.default.glossiness = 10;    
    return function () {
        mesh.rotation.y +=1;
        scene.render();
    }
}
展开阅读全文

代码

的 Gitee 指数为
超过 的项目

评论

点击加入讨论🔥(6) 发布并加入讨论🔥
暂无内容
发表了博客
{{o.pubDate | formatDate}}

{{formatAllHtml(o.title)}}

{{parseInt(o.replyCount) | bigNumberTransform}}
{{parseInt(o.viewCount) | bigNumberTransform}}
没有更多内容
暂无内容
发表了问答
{{o.pubDate | formatDate}}

{{formatAllHtml(o.title)}}

{{parseInt(o.replyCount) | bigNumberTransform}}
{{parseInt(o.viewCount) | bigNumberTransform}}
没有更多内容
暂无内容
暂无内容
6 评论
75 收藏
分享
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部