From c328fba5d919ac9bd8a22ab8e9d6a543bedf2a64 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@63.com>
Date: 星期三, 06 四月 2022 13:40:29 +0800
Subject: [PATCH] #
---
static/js/common.js | 98 ++++++++++++++++++++++++-------------------------
1 files changed, 48 insertions(+), 50 deletions(-)
diff --git a/static/js/common.js b/static/js/common.js
index 12c1943..36f535e 100644
--- a/static/js/common.js
+++ b/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;
--
Gitblit v1.9.1