分享
查看: 18786|回复: 0

[分享] 不用threejs,好用的三维可视化开发平台还有啥

[复制链接]

不用threejs,好用的三维可视化开发平台还有啥

发表于 2019-12-20 17:47:58 来自 分享 阅读模式 倒序浏览
zzv_icon18786 zzr_icon0 查看全部

三维可视化开发平台似乎也就那么几家做得好的,如果不用threejs,的确,threejs虽然是3D开发的鼻祖,但是对开发人员的要求也高呀,thingjs是封装的threejs,可通过快捷代码、代码框架来快速开发,只要前端工程师懂js,了解webgl就可以。建议大家一试哦~

/**

* 说明:在 canvas 中利用图片做背景进行绘制,模拟指标面板的应用场景

* 操作:点击按钮

* 难度:★★★★☆

*/

var app = new THING.App({

    url: 'https://www.thingjs.com/static/models/storehouse'    // 场景地址

});

// 计时器

var timer;

app.on('load', function () {

    // 设置摄像机位置和目标点

    app.camera.position = [24.036125586913663, 2.654545333744903, 15.118547603300897];

    app.camera.target = [18.887027584951163, 1.4664667942992755, 2.077588743688154];

    new THING.widget.Button('图片+canvas画图', function () {

        var plane = app.query('#myPlane01')[0];

        if (plane) return;

        var car = app.query('car01')[0];

        var imgUrl = 'https://www.thingjs.com/static/images/monitorPanel3.png';

        var imgWidth = 512;

        var imgHeight = 329;

        var img = new Image(imgWidth, imgHeight);

        img.crossOrigin = "Anonymous";

        img.src = imgUrl;

        img.onload = function () {

            var canvas = createCanvas({ image: img, text: 10, imgWidth, imgHeight });

            var newImg = new Image(canvas.width, canvas.height);

            newImg.src = canvas.toDataURL("image/png");

            var plane = app.create({

                type: 'Plane',

                id: 'myPlane01',

                width: imgWidth * 0.004,

                height: imgHeight * 0.004,

                parent: car,

                localPosition: [0, 3, 0],

                style: {

                    image: newImg,

                    opacity: 0.9,

                    color: '#ffffff'

                }

            });

            // 存储原始图片 用于重绘

            plane['origialImg'] = img;

            // 存储 canvas 用于重绘

            plane['myCanvas'] = canvas;

        };

    })

    new THING.widget.Button('更新温度值', function () {

        var plane = app.query('#myPlane01')[0];

        if (plane) {

            updateImage(plane)

        }

    });

    new THING.widget.Button('停止更新', function () {

        if (timer) {

            clearInterval(timer);

            timer = null;

        }

    })

})

function createCanvas(param) {

    var canvas = param.canvas;

    var image = param.image;

    var text = param.text;

    if (!param.canvas) {

        canvas = document.createElement("canvas");

        canvas.width = param.imgWidth;

不用, 好用, 三维, 可视, 可视化

avatar
游客~
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

130700ppkpl8x3t7tt1b1t