Explorar el Código

3dModeling pulic.js 韩正义 commit at 2021-01-26

韩正义 hace 4 años
padre
commit
95f410805f
Se han modificado 1 ficheros con 55 adiciones y 0 borrados
  1. 55 0
      3dModeling/sgec112/pulic.js

+ 55 - 0
3dModeling/sgec112/pulic.js

@@ -0,0 +1,55 @@
+/**
+ * 说明:检测菜单项是否已打开
+ */
+function checkBtnActives(arr) {
+    for (let i = 0; i < arr.length; i++) {
+        let temp = arr[i];
+        if ($(temp).hasClass('active')) {
+            $(temp).removeClass('active');
+            $(temp).find('.control-menu').removeClass('actives');
+        }
+    }
+}
+/**
+ * 说明:判断是否全屏
+ */
+function checkFull() {
+    var isFull =
+        document.fullscreenElement ||
+        document.mozFullScreenElement ||
+        document.webkitFullscreenElement;
+    //to fix : false || undefined == undefined
+    if (isFull === undefined) isFull = false;
+    return isFull;
+}
+/**
+ * 说明:创建胶囊
+ */
+function createBox() {
+    if (box == null) {
+        box = app.create({
+            type: 'Thing',
+            url: 'https://model.3dmomoda.com/models/9CD08ED91F5C4E0ABB6B0833C86F2942/0/gltf/',
+            position: [0, 0, 0],
+            angle: 180,
+            scale: [1.7, 1.7, 1.7],
+            style: {
+                color: '#FF0000'
+            }
+        });
+    }
+}
+/**
+ * 说明:第一人称行走
+ */
+function enterFps(pos) {
+    if (fpsCtrl == null) {
+        app.pauseEvent(THING.EventType.Pick, '*', THING.EventTag.LevelPickOperation);
+        app.pauseEvent(THING.EventType.KeyUp, null, '空格键切换视角');
+        app.camera.position = pos;  // 起始位置为鼠标点击时的位置
+        // 添加第一人称行走控件
+        fpsCtrl = app.addControl(
+            new THING.WalkControl({  // 参数可以动态修改
+                walkSpeed: 0.02,  // 行走速度
+                turnSpeed: 0.25,  // 右键旋转速度
+                gravity: 26,  // 物体重量