diff --git a/src/jlmap3d/lesson3d/lesson3dplayer.js b/src/jlmap3d/lesson3d/lesson3dplayer.js new file mode 100644 index 000000000..5273dd56d --- /dev/null +++ b/src/jlmap3d/lesson3d/lesson3dplayer.js @@ -0,0 +1,88 @@ +import store from '@/store/index'; +// import { Loading } from 'element-ui'; +import {Stats} from '@/jlmap3d/main/lib/stats.min.js'; +//静态资源文件路径 +import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js'; +//loader +import { FBXLoader } from '@/jlmap3d/main/loaders/FBXLoader'; +//轨道视角控制 +import { OrbitControls } from '@/jlmap3d/main/control/OrbitControls'; +//骨骼动画模型辅助工具 +import { SkeletonUtils } from '@/jlmap3d/main/utils/SkeletonUtils.js'; + +import { AssetModelManager } from '@/jlmap3d/lesson3d/manager/assetmodelmanager.js'; + +import { ControlManager } from '@/jlmap3d/lesson3d/manager/controlmanager.js'; + +// import { AnimationManager } from '@/jlmap3d/lesson3d/manager/assetmodelmanager.js'; + + +//动画播放相关 +let clock = new THREE.Clock(); +let delta; + +let scene; + +export function Lesson3dPlayer(dom,lessonData,lessonIndex) { + + // let stats = new Stats(); + // dom.appendChild( stats.dom ); + + let scope = this; + this.dom = dom; + + //定义相机 + + + //定义场景(渲染容器) + scene = new THREE.Scene(); + scene.background = new THREE.Color(0xa0a0a0); + + //定义全局光 + let ambientLight = new THREE.AmbientLight(0xffffff, 1.3); + scene.add(ambientLight); + var light = new THREE.HemisphereLight( 0xffffff, 0x444444 ); + light.position.set( 0, 4000, 0 ); + scene.add( light ); + + let controlManager = new ControlManager( dom,scene,lessonData,lessonIndex); + + let assetModelManager = new AssetModelManager(scene,controlManager); + assetModelManager.lessonAssetsLoader(lessonData.assetList,lessonData.modelList).then((result) => { + controlManager.initOctree(assetModelManager.loadAsset['default1'].mesh); + + animate(); + console.log(lessonData.lessonProgress[lessonIndex]); + if(lessonData.lessonProgress[lessonIndex].action.length>0){ + controlManager.initNewEvent(lessonData.lessonProgress[lessonIndex].action,assetModelManager.lessonTriggerList); + } + resolve("loadeend"); //['成功了', 'success'] + }).catch((error) => { + //console.log(error); + });; + + + + this.actionRemove = function(actionModel){ + assetModelManager.otherModel.remove(actionModel); + } + + + + //循环渲染函数 + function animate() { + + if(controlManager.controlMode == "free"){ + controlManager.updateOrbitControl(); + } + if(controlManager.controlMode == "fps"){ + controlManager.updateFpsControl(); + } + // delta = clock.getDelta(); + requestAnimationFrame(animate); + + } + + this.attachModel = function(selectModel){ + } +} diff --git a/src/jlmap3d/lesson3d/manager/assetmodelmanager.js b/src/jlmap3d/lesson3d/manager/assetmodelmanager.js new file mode 100644 index 000000000..81012032f --- /dev/null +++ b/src/jlmap3d/lesson3d/manager/assetmodelmanager.js @@ -0,0 +1,160 @@ +import { BASE_ASSET_API } from '@/api/jlmap3d/assets3d.js'; + +export function AssetModelManager(scene) { + let scope = this; + + + this.assetList = []; + + this.otherModel = new THREE.Group(); + + scene.add(this.otherModel); + + this.loadAsset = []; + + this.loadAsset['default1'] = { + modelId:'default1', + packageName:"车站", + url:"/MODEL/2021-04-06/1381-54584.FBX", + mesh:"", + assetType:'default', + isUse:true, + resourceType:"三维课程", + }; + + //场景中可触发事件模型 + this.lessonTriggerList = []; + + //加载课程资源 + this.lessonAssetsLoader = function(assetList,modelList){ + let initlist = []; + if(assetList){ + for(let i = 0;i { + + initTriggerList(); + for(let i=0;i { + //console.log(error); + }); + + }); + resolve("loaderassets"); + + } + + + + // + // + // + // + // + //FT 扶梯 + //FTAN 扶梯按钮(急停) + //FTD 扶梯灯 + //FTKG 扶梯开关(钥匙孔) + //FTTJ 扶梯台阶 + function initTriggerList(){ + + scope.loadAsset['default1'].mesh.getObjectByName("FTAN").showType = "default"; + scope.loadAsset['default1'].mesh.getObjectByName("FTAN").label = "扶梯急停按钮"; + scope.lessonTriggerList.push(scope.loadAsset['default1'].mesh.getObjectByName("FTAN")); + + scope.loadAsset['default1'].mesh.getObjectByName("FTKG").showType = "default"; + scope.loadAsset['default1'].mesh.getObjectByName("FTKG").label = "扶梯钥匙孔"; + scope.lessonTriggerList.push(scope.loadAsset['default1'].mesh.getObjectByName("FTKG")); + + + // console.log(scope.loadAsset['default1'].mesh.getObjectByName("FTKG")); + } + + //动态加载资源 + this.lessonAssetsNewLoader = function(assetData,pos){ + let isLoaded = false; + + if(scope.loadAsset[assetData.id]){ + let newModelTrigger = scope.loadAsset[assetData.id].mesh.clone(true); + newModelTrigger.modelId = assetData.id; + newModelTrigger.showType = "loadModel"; + newModelTrigger.label = assetData.packageName; + newModelTrigger.position.copy(pos); + scope.otherModel.add(newModelTrigger); + scope.lessonTriggerList.push(newModelTrigger); + updateTriggerList(scope.lessonTriggerList); + }else{ + scope.loadAsset[assetData.id] = { + modelId:assetData.id, + packageName:assetData.packageName, + url:assetData.url, + mesh:"", + assetType:'loadModel', + isUse:true, + resourceType:"三维课程", + }; + + fbxpromise(scope.loadAsset[assetData.id]).then(function(object){ + + let newModelTrigger = scope.loadAsset[assetData.id].mesh.clone(true); + newModelTrigger.showType = "loadModel"; + newModelTrigger.modelId = assetData.id; + newModelTrigger.label = assetData.packageName; + newModelTrigger.position.copy(pos); + scope.otherModel.add(newModelTrigger); + scope.lessonTriggerList.push(newModelTrigger); + + updateTriggerList(scope.lessonTriggerList); + // resolve("loadednew"); + }); + } + } + + + //fbx模型加载 + function fbxpromise(asset){ + return new Promise(function(resolve, reject){ + var loader = new THREE.FBXLoader(); + loader.load( BASE_ASSET_API+asset.url, function ( object ) { + + if(asset.assetType == "default"){ + scene.add(object); + }else if(asset.assetType == 'loadModel'){ + + } + object.label = asset.packageName; + asset.mesh = object; + resolve(); + } ); + + }); + } + +} diff --git a/src/jlmap3d/lesson3d/manager/controlmanager.js b/src/jlmap3d/lesson3d/manager/controlmanager.js new file mode 100644 index 000000000..e306df16b --- /dev/null +++ b/src/jlmap3d/lesson3d/manager/controlmanager.js @@ -0,0 +1,403 @@ + +import { Capsule } from '@/jlmap3d/lesson3d/math/Capsule.js'; + +import { Octree } from '@/jlmap3d/lesson3d/math/Octree.js'; + +export function ControlManager(dom,scene,lessonData,lessonIndex) { + + let scope = this; + this.controlMode = ""; + this.controls = {}; + this.nowCamera = null; + this.eventHitMode = false; + + let eventBoxs = []; + + + + let renderer = new THREE.WebGLRenderer({ antialias: true }); + renderer.setClearColor(new THREE.Color(0x000000)); + renderer.setViewport( 0, 0, dom.offsetWidth, dom.offsetHeight); + renderer.setScissor( 0, 0, dom.offsetWidth, dom.offsetHeight); + renderer.setScissorTest( false ); + renderer.setSize(dom.offsetWidth, dom.offsetHeight); + renderer.sortObjects = true; + dom.appendChild(renderer.domElement); + + let orbitCamera = new THREE.PerspectiveCamera(70, dom.offsetWidth / dom.offsetHeight, 0.01, 1000); + orbitCamera.position.set(0, 80, 40); + orbitCamera.aspect = dom.offsetWidth / dom.offsetHeight; + orbitCamera.updateProjectionMatrix(); + + let oribitControl = new THREE.OrbitControls(orbitCamera,dom); + oribitControl.maxPolarAngle = Math.PI / 2; + oribitControl.minPolarangle = Math.PI / 5; + oribitControl.maxDistance = 800; + oribitControl.screenSpacePanning = true; + oribitControl.update(); + + + let fpsCamera = new THREE.PerspectiveCamera( 75,dom.offsetWidth / dom.offsetHeight, 0.1, 1000 ); + fpsCamera.aspect = dom.offsetWidth / dom.offsetHeight; + fpsCamera.rotation.order = 'YXZ'; + + let attachBox = new THREE.Mesh( + new THREE.BoxGeometry(1, 5, 1), + new THREE.MeshBasicMaterial({color: 0xff00000})//RED box + ); + let hitBox = new THREE.Box3(new THREE.Vector3(), new THREE.Vector3()); + hitBox.setFromObject(attachBox); + scene.add(attachBox); + + //fps control + const GRAVITY = 30; + + const NUM_SPHERES = 20; + const SPHERE_RADIUS = 0.2; + + const sphereGeometry = new THREE.SphereGeometry( SPHERE_RADIUS, 32, 32 ); + const sphereMaterial = new THREE.MeshStandardMaterial( { color: 0x888855, roughness: 0.8, metalness: 0.5 } ); + + const spheres = []; + let sphereIdx = 0; + + for ( let i = 0; i < NUM_SPHERES; i ++ ) { + + const sphere = new THREE.Mesh( sphereGeometry, sphereMaterial ); + + + scene.add( sphere ); + + spheres.push( { mesh: sphere, collider: new THREE.Sphere( new THREE.Vector3( 0, - 100, 0 ), SPHERE_RADIUS ), velocity: new THREE.Vector3() } ); + + } + + scope.controlMode = lessonData.lessonProgress[lessonIndex].controlMode; + // scope.controls = oribitControl; + if(scope.controlMode == "free"){ + scope.nowCamera = orbitCamera; + scope.controls.enabled = true; + }else if(scope.controlMode == "fps"){ + scope.nowCamera = fpsCamera; + scope.controls.enabled = false; + } + + + + const worldOctree = new Octree(); + + const playerCollider = new Capsule( new THREE.Vector3( 0, 10, 0 ), new THREE.Vector3( 0, 11.9, 0 ), 1 ); + playerCollider.set( + new THREE.Vector3( + lessonData.lessonProgress[lessonIndex].cameraPosition.x, + lessonData.lessonProgress[lessonIndex].cameraPosition.y, + lessonData.lessonProgress[lessonIndex].cameraPosition.z), + new THREE.Vector3( + lessonData.lessonProgress[lessonIndex].cameraPosition.x, + lessonData.lessonProgress[lessonIndex].cameraPosition.y+1.5, + lessonData.lessonProgress[lessonIndex].cameraPosition.z ), 1); + attachBox.position.x = lessonData.lessonProgress[lessonIndex].cameraPosition.x; + attachBox.position.y = lessonData.lessonProgress[lessonIndex].cameraPosition.y ; + attachBox.position.z = lessonData.lessonProgress[lessonIndex].cameraPosition.z; + + + + + const playerVelocity = new THREE.Vector3(); + const playerDirection = new THREE.Vector3(); + + let playerOnFloor = false; + + const keyStates = {}; + let clock = new THREE.Clock(); + + this.updateOrbitControl = function(){ + oribitControl.update(); + }; + + this.updateFpsControl = function(){ + const deltaTime = Math.min( 0.1, clock.getDelta() ); + + controls( deltaTime ); + + updatePlayer( deltaTime ); + + updateSpheres( deltaTime ); + + if(scope.eventHitMode == true){ + if(eventBoxs.length>0){ + + attachBox.position.copy(fpsCamera.position); + for(let i=0;i { + + keyStates[ event.code ] = true; + + } ); + + document.addEventListener( 'keyup', ( event ) => { + + keyStates[ event.code ] = false; + + } ); + let fpsMouseStatus = false; + document.addEventListener( 'mousedown', () => { + fpsMouseStatus = true; + // document.body.requestPointerLock(); + } ); + + document.body.addEventListener( 'mousemove', ( event ) => { + if(fpsMouseStatus == true){ + fpsCamera.rotation.y -= event.movementX / 500; + fpsCamera.rotation.x -= event.movementY / 500; + } + // if ( document.pointerLockElement === document.body ) { + // } + } ); + + document.addEventListener( 'mouseup', () => { + fpsMouseStatus = false; + } ); + + + function playerCollitions() { + + const result = worldOctree.capsuleIntersect( playerCollider ); + + playerOnFloor = false; + + if ( result ) { + + playerOnFloor = result.normal.y > 0; + + if ( ! playerOnFloor ) { + + playerVelocity.addScaledVector( result.normal, - result.normal.dot( playerVelocity ) ); + + } + + playerCollider.translate( result.normal.multiplyScalar( result.depth ) ); + + } + + } + + function updatePlayer( deltaTime ) { + + if ( playerOnFloor ) { + + const damping = Math.exp( - 3 * deltaTime ) - 1; + playerVelocity.addScaledVector( playerVelocity, damping ); + + } else { + + playerVelocity.y -= GRAVITY * deltaTime; + + } + + const deltaPosition = playerVelocity.clone().multiplyScalar( deltaTime ); + playerCollider.translate( deltaPosition ); + + playerCollitions(); + + fpsCamera.position.copy( playerCollider.end ); + + } + + function spheresCollisions() { + + for ( let i = 0; i < spheres.length; i ++ ) { + + const s1 = spheres[ i ]; + + for ( let j = i + 1; j < spheres.length; j ++ ) { + + const s2 = spheres[ j ]; + + const d2 = s1.collider.center.distanceToSquared( s2.collider.center ); + const r = s1.collider.radius + s2.collider.radius; + const r2 = r * r; + + if ( d2 < r2 ) { + + const normal = s1.collider.clone().center.sub( s2.collider.center ).normalize(); + const v1 = normal.clone().multiplyScalar( normal.dot( s1.velocity ) ); + const v2 = normal.clone().multiplyScalar( normal.dot( s2.velocity ) ); + s1.velocity.add( v2 ).sub( v1 ); + s2.velocity.add( v1 ).sub( v2 ); + + const d = ( r - Math.sqrt( d2 ) ) / 2; + + s1.collider.center.addScaledVector( normal, d ); + s2.collider.center.addScaledVector( normal, - d ); + + } + + } + + } + + } + + function updateSpheres( deltaTime ) { + + spheres.forEach( sphere =>{ + + sphere.collider.center.addScaledVector( sphere.velocity, deltaTime ); + + const result = worldOctree.sphereIntersect( sphere.collider ); + + if ( result ) { + + sphere.velocity.addScaledVector( result.normal, - result.normal.dot( sphere.velocity ) * 1.5 ); + sphere.collider.center.add( result.normal.multiplyScalar( result.depth ) ); + + } else { + + sphere.velocity.y -= GRAVITY * deltaTime; + + } + + const damping = Math.exp( - 1.5 * deltaTime ) - 1; + sphere.velocity.addScaledVector( sphere.velocity, damping ); + + spheresCollisions(); + + sphere.mesh.position.copy( sphere.collider.center ); + + } ); + + } + + function getForwardVector() { + + fpsCamera.getWorldDirection( playerDirection ); + playerDirection.y = 0; + playerDirection.normalize(); + + return playerDirection; + + } + + function getSideVector() { + + fpsCamera.getWorldDirection( playerDirection ); + playerDirection.y = 0; + playerDirection.normalize(); + playerDirection.cross( fpsCamera.up ); + + return playerDirection; + + } + + function controls( deltaTime ) { + + const speed = 25; + + if ( playerOnFloor ) { + + if ( keyStates[ 'KeyW' ] ) { + + playerVelocity.add( getForwardVector().multiplyScalar( speed * deltaTime ) ); + + } + + if ( keyStates[ 'KeyS' ] ) { + + playerVelocity.add( getForwardVector().multiplyScalar( - speed * deltaTime ) ); + + } + + if ( keyStates[ 'KeyA' ] ) { + + playerVelocity.add( getSideVector().multiplyScalar( - speed * deltaTime ) ); + + } + + if ( keyStates[ 'KeyD' ] ) { + + playerVelocity.add( getSideVector().multiplyScalar( speed * deltaTime ) ); + + } + + + + } + + } + + function render(){ + + if(scope.nowCamera){ + renderer.render( scene, scope.nowCamera ); + } + } + window.onresize = function () { + renderer.setSize(dom.offsetWidth,dom.offsetHeight); + } + + this.initNewEvent = function(actions,lessonTriggerList){ + console.log(actions); + console.log(lessonTriggerList); + eventBoxs = []; + for(let i=0;i 8 && level < 16 ) { + + subTrees[ i ].split( level + 1 ); + + } + + if ( len != 0 ) { + + this.subTrees.push( subTrees[ i ] ); + + } + + } + + return this; + + }, + + build: function () { + + this.calcBox(); + this.split( 0 ); + + return this; + + }, + + getRayTriangles: function ( ray, triangles ) { + + for ( var i = 0; i < this.subTrees.length; i ++ ) { + + var subTree = this.subTrees[ i ]; + if ( ! ray.intersectsBox( subTree.box ) ) continue; + + if ( subTree.triangles.length > 0 ) { + + for ( var j = 0; j < subTree.triangles.length; j ++ ) { + + if ( triangles.indexOf( subTree.triangles[ j ] ) === - 1 ) triangles.push( subTree.triangles[ j ] ); + + } + + } else { + + subTree.getRayTriangles( ray, triangles ); + + } + + } + + return triangles; + + }, + + triangleCapsuleIntersect: function ( capsule, triangle ) { + + var point1, point2, line1, line2; + + triangle.getPlane( _plane ); + + var d1 = _plane.distanceToPoint( capsule.start ) - capsule.radius; + var d2 = _plane.distanceToPoint( capsule.end ) - capsule.radius; + + if ( ( d1 > 0 && d2 > 0 ) || ( d1 < - capsule.radius && d2 < - capsule.radius ) ) { + + return false; + + } + + var delta = Math.abs( d1 / ( Math.abs( d1 ) + Math.abs( d2 ) ) ); + var intersectPoint = _v1.copy( capsule.start ).lerp( capsule.end, delta ); + + if ( triangle.containsPoint( intersectPoint ) ) { + + return { normal: _plane.normal.clone(), point: intersectPoint.clone(), depth: Math.abs( Math.min( d1, d2 ) ) }; + + } + + var r2 = capsule.radius * capsule.radius; + + line1 = _line1.set( capsule.start, capsule.end ); + + var lines = [ + [ triangle.a, triangle.b ], + [ triangle.b, triangle.c ], + [ triangle.c, triangle.a ] + ]; + + for ( var i = 0; i < lines.length; i ++ ) { + + line2 = _line2.set( lines[ i ][ 0 ], lines[ i ][ 1 ] ); + + [ point1, point2 ] = capsule.lineLineMinimumPoints( line1, line2 ); + + if ( point1.distanceToSquared( point2 ) < r2 ) { + + return { normal: point1.clone().sub( point2 ).normalize(), point: point2.clone(), depth: capsule.radius - point1.distanceTo( point2 ) }; + + } + + } + + return false; + + }, + + triangleSphereIntersect: function ( sphere, triangle ) { + + triangle.getPlane( _plane ); + + if ( ! sphere.intersectsPlane( _plane ) ) return false; + + var depth = Math.abs( _plane.distanceToSphere( sphere ) ); + var r2 = sphere.radius * sphere.radius - depth * depth; + + var plainPoint = _plane.projectPoint( sphere.center, _v1 ); + + if ( triangle.containsPoint( sphere.center ) ) { + + return { normal: _plane.normal.clone(), point: plainPoint.clone(), depth: Math.abs( _plane.distanceToSphere( sphere ) ) }; + + } + + var lines = [ + [ triangle.a, triangle.b ], + [ triangle.b, triangle.c ], + [ triangle.c, triangle.a ] + ]; + + for ( var i = 0; i < lines.length; i ++ ) { + + _line1.set( lines[ i ][ 0 ], lines[ i ][ 1 ] ); + _line1.closestPointToPoint( plainPoint, true, _v2 ); + + var d = _v2.distanceToSquared( sphere.center ); + + if ( d < r2 ) { + + return { normal: sphere.center.clone().sub( _v2 ).normalize(), point: _v2.clone(), depth: sphere.radius - Math.sqrt( d ) }; + + } + + } + + return false; + + }, + + getSphereTriangles: function ( sphere, triangles ) { + + for ( var i = 0; i < this.subTrees.length; i ++ ) { + + var subTree = this.subTrees[ i ]; + + if ( ! sphere.intersectsBox( subTree.box ) ) continue; + + if ( subTree.triangles.length > 0 ) { + + for ( var j = 0; j < subTree.triangles.length; j ++ ) { + + if ( triangles.indexOf( subTree.triangles[ j ] ) === - 1 ) triangles.push( subTree.triangles[ j ] ); + + } + + } else { + + subTree.getSphereTriangles( sphere, triangles ); + + } + + } + + }, + + getCapsuleTriangles: function ( capsule, triangles ) { + + for ( var i = 0; i < this.subTrees.length; i ++ ) { + + var subTree = this.subTrees[ i ]; + + if ( ! capsule.intersectsBox( subTree.box ) ) continue; + + if ( subTree.triangles.length > 0 ) { + + for ( var j = 0; j < subTree.triangles.length; j ++ ) { + + if ( triangles.indexOf( subTree.triangles[ j ] ) === - 1 ) triangles.push( subTree.triangles[ j ] ); + + } + + } else { + + subTree.getCapsuleTriangles( capsule, triangles ); + + } + + } + + }, + + sphereIntersect( sphere ) { + + _sphere.copy( sphere ); + + var triangles = [], result, hit = false; + + this.getSphereTriangles( sphere, triangles ); + + for ( var i = 0; i < triangles.length; i ++ ) { + + if ( result = this.triangleSphereIntersect( _sphere, triangles[ i ] ) ) { + + hit = true; + + _sphere.center.add( result.normal.multiplyScalar( result.depth ) ); + + } + + } + + if ( hit ) { + + var collisionVector = _sphere.center.clone().sub( sphere.center ); + var depth = collisionVector.length(); + + return { normal: collisionVector.normalize(), depth: depth }; + + } + + return false; + + }, + + capsuleIntersect: function ( capsule ) { + + _capsule.copy( capsule ); + + var triangles = [], result, hit = false; + + this.getCapsuleTriangles( _capsule, triangles ); + + for ( var i = 0; i < triangles.length; i ++ ) { + + if ( result = this.triangleCapsuleIntersect( _capsule, triangles[ i ] ) ) { + + hit = true; + + _capsule.translate( result.normal.multiplyScalar( result.depth ) ); + + } + + } + + if ( hit ) { + + var collisionVector = _capsule.getCenter( new THREE.Vector3() ).sub( capsule.getCenter( _v1 ) ); + var depth = collisionVector.length(); + + return { normal: collisionVector.normalize(), depth: depth }; + + } + + return false; + + }, + + rayIntersect: function ( ray ) { + + if ( ray.direction.length() === 0 ) return; + + var triangles = [], triangle, position, + distance = 1e100, + result; + + this.getRayTriangles( ray, triangles ); + + for ( var i = 0; i < triangles.length; i ++ ) { + + result = ray.intersectTriangle( triangles[ i ].a, triangles[ i ].b, triangles[ i ].c, true, _v1 ); + + if ( result ) { + + var newdistance = result.sub( ray.origin ).length(); + + if ( distance > newdistance ) { + + position = result.clone().add( ray.origin ); + distance = newdistance; + triangle = triangles[ i ]; + + } + + } + + } + + return distance < 1e100 ? { distance: distance, triangle: triangle, position: position } : false; + + }, + + fromGraphNode: function ( group ) { + + group.traverse( ( obj ) => { + + if ( obj.type === 'Mesh' ) { + + obj.updateMatrix(); + obj.updateWorldMatrix(); + + var geometry, isTemp = false; + + if ( obj.geometry.index ) { + + isTemp = true; + geometry = obj.geometry.clone().toNonIndexed(); + + } else { + + geometry = obj.geometry; + + } + + var positions = geometry.attributes.position.array; + var transform = obj.matrixWorld; + + for ( var i = 0; i < positions.length; i += 9 ) { + + var v1 = new THREE.Vector3( positions[ i ], positions[ i + 1 ], positions[ i + 2 ] ); + var v2 = new THREE.Vector3( positions[ i + 3 ], positions[ i + 4 ], positions[ i + 5 ] ); + var v3 = new THREE.Vector3( positions[ i + 6 ], positions[ i + 7 ], positions[ i + 8 ] ); + + v1.applyMatrix4( transform ); + v2.applyMatrix4( transform ); + v3.applyMatrix4( transform ); + + this.addTriangle( new THREE.Triangle( v1, v2, v3 ) ); + + } + + if ( isTemp ) { + + geometry.dispose(); + + } + + } + + } ); + + this.build(); + + return this; + + } + + } ); + + return Octree; + +} )(); + +export { Octree }; diff --git a/src/jlmap3d/lesson3d/model/lessondata.js b/src/jlmap3d/lesson3d/model/lessondata.js new file mode 100644 index 000000000..96cc06a5b --- /dev/null +++ b/src/jlmap3d/lesson3d/model/lessondata.js @@ -0,0 +1,177 @@ + +export function LessonData() { + let scope = this; + + this.lessonId = ""; + this.lessonName = ""; + this.lessonType = ""; + this.lessonStatus = ""; + this.lessonData = { + //资源列表 + assetList:[], + //场景交互物体列表 + modelList:[], + //课程组件启用状态 + lessonTools:[], + dataType:"", + toolJobPane:[], + //课程内容 + lessonProgress:[ + + ] + }; + + this.initLessonProgress = function(){ + let newLessonProgress = { + id:generateUUID(), + progressName:"命名", + roleName:"", + roleUse:true, + + progressScene:"", + nextCode:"", + nextNode:"", + triggerType:"", + triggerMode:"", + triggerTime:"", + triggerModel:"", + controlMode:"", + cameraMode:"", + changeCamera:false, + cameraPosition:{ + x:0, + y:0, + z:0 + }, + cameraTarget:{ + x:0, + y:0, + z:0 + }, + assetId:scope.lessonData.lessonProgress.length, + assetPos:"", + assetRot:"", + assetType:"", + index:"", + stepTipsData:{ + tittle:"标题", + text:"内容", + }, + explainPane:{ + tittle:"标题", + picurl:"url", + text:"内容", + }, + action:[], + }; + + scope.lessonData.lessonProgress.push(newLessonProgress); + + } + + this.loadLessonProgress = function(loadData){ + console.log(loadData); + for(let i=0;i - - -
- {{ '['+data.map.name+']'+($t('global.trainingHasStart').replace('{name}', data.creator.nickname)) }} - 进入 -
-
-
+
+
+ {{ '['+training.map.name+']'+($t('global.trainingHasStart').replace('{name}', training.creator.nickname)) }} + 进入 +
+
- diff --git a/src/views/demonstration/deomonTopic/index.vue b/src/views/demonstration/deomonTopic/index.vue index 958d70eec..05eb09278 100644 --- a/src/views/demonstration/deomonTopic/index.vue +++ b/src/views/demonstration/deomonTopic/index.vue @@ -4,6 +4,7 @@ :title="$t('global.synthesisTrainingTitle')" :visible.sync="dialogShow" width="600px" + class="inviteRoom" :before-close="doClose" :z-index="2000" :modal="false" @@ -63,20 +64,7 @@ export default { }; - diff --git a/src/views/demonstration/detail/index.vue b/src/views/demonstration/detail/index.vue index ad6972615..e5fe7bf3d 100644 --- a/src/views/demonstration/detail/index.vue +++ b/src/views/demonstration/detail/index.vue @@ -1,5 +1,5 @@