From 18bd54d17c3d09e48b14fcb0cc0fc74758a920b2 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@63.com> Date: 星期四, 30 六月 2022 16:51:43 +0800 Subject: [PATCH] # --- static/js/common.js | 100 +++++++++++++++++++++++++------------------------- 1 files changed, 50 insertions(+), 50 deletions(-) diff --git a/static/js/common.js b/static/js/common.js index 0ccdfe5..384d544 100644 --- a/static/js/common.js +++ b/static/js/common.js @@ -1,67 +1,67 @@ +// var baseUrl = "http://localhost:9090/jkwcs" +var baseUrl = "http://183.247.194.12:63200/jkwcs" + 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; -- Gitblit v1.9.1