#
luxiaotao1123
2021-12-22 656503685a93be51b12e5cb9c6a880eae6dcf7b4
#
4个文件已修改
1个文件已添加
1个文件已删除
657 ■■■■ 已修改文件
static/js/ThreeBSP.js 519 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
static/js/app.js 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
static/js/common.js 98 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
static/js/data/BuildingData.js 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
static/js/object/CrnTask.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
views/index.html 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
static/js/ThreeBSP.js
File was deleted
static/js/app.js
@@ -46,6 +46,8 @@
            this.initReSize(this);
            this.initPointLockControl(this);
            this.initFloor();
            this.initBuilding();
            this.initTransporter(this);
        }
        this.animate = function () {
            requestAnimationFrame(this.animate.bind(this));
@@ -324,6 +326,20 @@
            // this.addObject(new Floor({position: {}}))
        }
        this.initBuilding = function () {
            let buildingData = buildingObjects.objects;
            for (let i = 0; i < buildingData.length; i++) {
                let objectOption = buildingData[i];
                switch (objectOption.objectType) {
                    case "cube":
                        let cube = new Cube(objectOption);
                        this.addObject(cube);
                        break;
                }
            }
        }
        this.initTransporter = function (object) {
        }
        this.initStoreObjects = function (object) {
            if (this.firstTime === 1) {
                if (Store3DData !== undefined && Store3DData !== null) {
static/js/common.js
@@ -1,68 +1,66 @@
function CommonFunction() {
}
/**
 * 判断当前对象是否为空对象
 */
CommonFunction.hasObj = function (obj) {
    if (obj != null && typeof (obj) != "undefined") {
        return true;
    } else {
        return false;
    }
},
    /**
     * 创建材质
     * length:材质的长
     * width:材质宽度
     * style:材质特性
     */
    CommonFunction.createMaterial = function (length, width, style) {
        var color = 0xFF0000;//材质的颜色
        var image = null;//才是是否有贴图
        var texture = null;
        var allowRepeat = 0;//贴图是否设置重复显示
        var transparent = 0;//材质是否透明
        var opacity = 0;//材质透明度
        var depthTest = 1;//材质深度测试
        if (CommonFunction.hasObj(style)) {
            color = style.color || 0xFF0000;
            image = style.image || null;
            allowRepeat = style.allowRepeat || 0;
            transparent = style.transparent || 0;
            opacity = style.opacity || 0;
            depthTest = style.depthTest;
        }
        let material = new THREE.MeshPhongMaterial({map: texture, color: color});
        if (image != null) {
            texture = new THREE.TextureLoader().load(image);
            if (allowRepeat == 1) {
                texture.repeat.x = length / 128;
                texture.repeat.y = width / 128;
                texture.repeat.y = 5;
                texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
    return obj != null && typeof (obj) != "undefined";
}
            }
            material = new THREE.MeshPhongMaterial({map: texture});
        }
        if (transparent == 1) {
            material.transparent = true;
        }
        if (depthTest == 0) {
            material.depthTest = false;
        }
        material.opacity = opacity;
        return material;
/**
 * 创建材质
 * length:材质的长
 * width:材质宽度
 * style:材质特性
 */
CommonFunction.createMaterial = function (length, width, style) {
    var color = 0xFF0000;//材质的颜色
    var image = null;//才是是否有贴图
    var texture = null;
    var allowRepeat = 0;//贴图是否设置重复显示
    var transparent = 0;//材质是否透明
    var opacity = 0;//材质透明度
    var depthTest = 1;//材质深度测试
    if (CommonFunction.hasObj(style)) {
        color = style.color || 0xFF0000;
        image = style.image || null;
        allowRepeat = style.allowRepeat || 0;
        transparent = style.transparent || 0;
        opacity = style.opacity || 0;
        depthTest = style.depthTest;
    }
    let material = new THREE.MeshPhongMaterial({map: texture, color: color});
    if (image != null) {
        texture = new THREE.TextureLoader().load(image);
        if (allowRepeat === 1) {
            texture.repeat.x = length / 128;
            texture.repeat.y = width / 128;
            texture.repeat.y = 5;
            texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
        }
        material = new THREE.MeshPhongMaterial({map: texture});
    }
    if (transparent === 1) {
        material.transparent = true;
    }
    if (depthTest === 0) {
        material.depthTest = false;
    }
    material.opacity = opacity;
    return material;
}
/**
 * 转换坐标
 * positionOri:原始坐标
 * positionTrans:转换坐标
 */
CommonFunction.transPosition=function(positionOri,positionTrans)
{
CommonFunction.transPosition=function(positionOri,positionTrans) {
    positionOri.X = positionOri.X + positionTrans.X;
    positionOri.Y = positionOri.Y + positionTrans.Y;
static/js/data/BuildingData.js
New file
@@ -0,0 +1,19 @@
let buildingObjects = {
    objects: [
        {
            objectName: 'floor',
            objectType: 'cube',
            length: 1400,
            width: 1200,
            height: 1,
            position: {
                x: 700,
                y: 600,
                z: 0
            },
            style:{
                color: 0x5F7480,
            }
        }
    ]
}
static/js/object/CrnTask.js
@@ -54,7 +54,7 @@
        that.crnLoad = getArrVal(object.objects, "name", that.crnNo + "-load");
        that.crnFork = getArrVal(object.objects, "name", that.crnNo + "-fork");
        if (that.crnBody===null || that.crnLoad===null || that.crnFork==null) {
            console.log(that.crnNo + "号堆垛机没有初始化");
            // console.log(that.crnNo + "号堆垛机没有初始化");
        }
    };
    init();
@@ -163,7 +163,7 @@
        }
        curves.map((value, index) => {
            console.log(value.part + " --> " + JSON.stringify(value.route.points))
            // console.log(value.part + " --> " + JSON.stringify(value.route.points))
        });
        curves[0].start = true;
views/index.html
@@ -13,6 +13,7 @@
    <script type="text/javascript" src="../static/js/utils.js"></script>
    <script type="text/javascript" src="../static/js/common.js"></script>
    <script type="text/javascript" src="../static/js/data/Asrs.js"></script>
    <script type="text/javascript" src="../static/js/data/BuildingData.js"></script>
    <script type="text/javascript" src="../static/js/object/Cube.js"></script>
    <script type="text/javascript" src="../static/js/object/StoreArea.js"></script>
    <script type="text/javascript" src="../static/js/object/Store.js"></script>