(function($) { (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i y) !== (yj > y)) && (x < (xj - xi) * (y - yi) / (yj - yi) + xi); if (intersect) inside = !inside; } return inside; }; },{}],2:[function(require,module,exports){ var pointInPolygonFlat = require('./flat.js') var pointInPolygonNested = require('./nested.js') module.exports = function pointInPolygon (point, vs, start, end) { if (vs.length > 0 && Array.isArray(vs[0])) { return pointInPolygonNested(point, vs, start, end); } else { return pointInPolygonFlat(point, vs, start, end); } } module.exports.nested = pointInPolygonNested module.exports.flat = pointInPolygonFlat },{"./flat.js":1,"./nested.js":3}],3:[function(require,module,exports){ // ray-casting algorithm based on // https://wrf.ecse.rpi.edu/Research/Short_Notes/pnpoly.html module.exports = function pointInPolygonNested (point, vs, start, end) { var x = point[0], y = point[1]; var inside = false; if (start === undefined) start = 0; if (end === undefined) end = vs.length; var len = end - start; for (var i = 0, j = len - 1; i < len; j = i++) { var xi = vs[i+start][0], yi = vs[i+start][1]; var xj = vs[j+start][0], yj = vs[j+start][1]; var intersect = ((yi > y) !== (yj > y)) && (x < (xj - xi) * (y - yi) / (yj - yi) + xi); if (intersect) inside = !inside; } return inside; }; },{}],4:[function(require,module,exports){ var caveaudioplay = false var pointInPolygon = require('./node_modules/point-in-polygon'); var polygon = [ [-6.5663963828448235,-6.236726290296747], [-7.241555990786743,-8.11373440565598], [-5.730182869191872,-7.911446458427765], [-3.0119492889179824,-8.914101654780398], [-1.2088075678353232,-7.743127729498082], [0,-7.199999999999982], [1.4053171012634778,-3.628435847306213], [3.7071768248818375,-1.3463588349753564], [2.9510224140069177,4.173038975440403], [0.8320888745579305,4.778687145165999], [2.0963931194047083,5.252160460935861], [5.284276842465817,5.888809778925059], [4.426373516572164,6.1584037509154195], [-2.6109752140097644,8.530851639707103], [-3.8442994539471247,9.505934231909858], [-5.421658803579976,9.379104952199796], [-5.683677891901029,7.245130726170972], [-5.44945476762852,6.061602757640291], [-5.323535471964005,1.8100647628777025], [-5.461810229889112,-2.0452358107155253], [-5.575042724941683,-3.977407516499846] ] var key_pressed = false var phase2_tf = false var phase3_tf = false var phase4_tf = false $(document).ready(function(){ $('.button.button_1.room_2').append('Phase2') $('body').click(function(){ console.log(phase3_tf) if(phase2_tf){ $('#caveaudio')[0].pause() $('#phase2').show() $('.phase2close').show() $('.phase2close').attr('style', 'display: block !important'); $('#phase2')[0].play() $('.phase2close').click(function(){ $('#caveaudio')[0].play() $('.phase2close').attr('style', 'display: none !important'); $('#phase2').get(0).pause(); $('#phase2').hide() $('#phase2').get(0).currentTime = 0; $('.phase3close').attr('style', 'display: none !important'); $('#phase3').attr('style', 'display: none'); $('#phase3').hide() $('#phase3').get(0).pause(); $('#phase3').get(0).currentTime = 0; $('.vid_infoclick').hide() }) var timeout = setTimeout(function(){ $('.vid_infoclick').show() },441000) } if(phase3_tf){ $('#caveaudio')[0].pause() $('#phase3').show() $('.phase3close').show() $('.phase3close').attr('style', 'display: block !important'); $('#phase3')[0].play() $('.phase3close').click(function(){ $('#caveaudio')[0].play() setTimeout(function(){ console.log('1111') $('.phase3close').attr('style', 'display: none !important'); $('#phase3').attr('style', 'display: none'); $('#phase3').hide() $('#phase3').get(0).pause(); $('#phase3').get(0).currentTime = 0; $('.phase2close').attr('style', 'display: none !important'); $('#phase2').get(0).pause(); $('#phase2').hide() $('#phase2').get(0).currentTime = 0; $('.phase3close').attr('style', 'display: none !important'); $('#phase3').attr('style', 'display: none'); $('#phase3').hide() $('#phase3').get(0).pause(); $('#phase3').get(0).currentTime = 0; $('.vid_infoclick').hide() },50) }) var timeout = setTimeout(function(){ $('.vid_infoclick').show() },441000) } if(phase4_tf){ $('#phase4').show() $('.phase4close').show() $('.phase4close').attr('style', 'display: block !important'); $('.phase4close').click(function(){ setTimeout(function(){ $('.phase4close').attr('style', 'display: none !important'); $('#phase4').hide() $('.phase2close').attr('style', 'display: none !important'); $('#phase2').get(0).pause(); $('#phase2').hide() $('#phase2').get(0).currentTime = 0; $('.phase3close').attr('style', 'display: none !important'); $('#phase3').attr('style', 'display: none'); $('#phase3').hide() $('#phase3').get(0).pause(); $('#phase3').get(0).currentTime = 0; $('.vid_infoclick').hide() },50) }) var timeout = setTimeout(function(){ $('.vid_infoclick').show() },441000) } }) const backgroundColor = 0x000000; const mouse = new THREE.Vector2(); var mouse_x,mouse_y = 0 const raycaster = new THREE.Raycaster(); var cave var plate var cz = 0 var bz = 0 var cx = 0 var bx = 0 var cy = 0 var by = 0 var ran_x = 0 var ran_y = 0 var cur_x = 0 var cur_y = 0 var counter = 0 var wandering_counter = -10 var init=true window.addEventListener( 'mousemove', onMouseMove, false ); function onMouseMove( event ) { mouse.x = ( event.clientX / window.innerWidth ) * 2 - 1; mouse.y = - ( event.clientY / window.innerHeight ) * 2 + 1; mouse_x = event.clientX mouse_y = event.clientY } function easeOutCubic(x){ return x < 0.5 ? 8 * x * x * x * x : 1 - Math.pow(-2 * x + 2, 4) / 2; } /*////////////////////////////////////////*/ var scene = new THREE.Scene(); var camera = new THREE.PerspectiveCamera( 100, window.innerWidth / window.innerHeight, 0.1, 800 ); scene.add(camera) camera.position.set(0,0,0); var canvas = document.getElementById("cavecan"); var renderer = new THREE.WebGLRenderer( { antialias: true,alpha: true,canvas: canvas } ); renderer.setPixelRatio( window.devicePixelRatio ); renderer.setSize( window.innerWidth, window.innerHeight ); renderer.setClearColor( backgroundColor );//0x ); renderer.toneMapping = THREE.LinearToneMapping; renderer.toneMappingExposure = Math.pow( 0.94, 5.0 ); renderer.shadowMap.enabled = true; renderer.shadowMap.type = THREE.PCFShadowMap; window.addEventListener( 'resize', function () { camera.aspect = window.innerWidth / window.innerHeight; camera.updateProjectionMatrix(); renderer.setSize( window.innerWidth, window.innerHeight ); }, false ); function renderScene(){ renderer.render( scene, camera ); } // renderCalls.push(renderScene); var renderCalls = []; function render () { requestAnimationFrame( render ); renderer.render( scene, camera ); onUpdate(); } render(); var light2 = new THREE.AmbientLight( 0x20202A, 2, 100 ); light2.position.set( 30, -10, 30 ); scene.add( light2 ); const geometry = new THREE.BoxGeometry( 1, 1, 1 ); const material = new THREE.MeshBasicMaterial( {color: 0x00ff00} ); // var button_group = new THREE.Group() // const c_texture = new THREE.TextureLoader().load( "light.png" ); // c_texture.wrapS = THREE.RepeatWrapping; // c_texture.wrapT = THREE.RepeatWrapping; // c_texture.repeat.set( 1, 1 ); // const button = new THREE.Mesh( new THREE.CircleGeometry( 0.15, 32 ), new THREE.MeshBasicMaterial( { map:c_texture,transparent : true } ) ); // scene.add( button_group ); // button_group.add( button ); // button.position.set( 0, 0, -1 ); // button_group.position.set(0,0,0) // button_group.rotation.set(0,0,0) var loader = new THREE.GLTFLoader(); loader.crossOrigin = true; loader.load( 'https://ru4real.de/wp-content/themes/areyouforreal/cave.gltf', function ( data ) { cave = data.scene; cave.position.set(0, 0, 0); // cave.scale.set(0.01, 0.01, 0.01); scene.add( cave ); cave.position.x = 35.5 cave.position.y = -4.5 cave.position.z = 4 cave.children[0].add(new THREE.PointLight( 0xffffff, 4, 20 )) cave.children[0].add(new THREE.Mesh( geometry, material )) cave.children[0].rotation.set(0,0,0) cave.children[2].add(new THREE.PointLight( 0xffffff, 4, 20 )) cave.children[2].add(new THREE.Mesh( geometry, material )) cave.children[2].rotation.set(0,0,0) cave.children[3].add(new THREE.PointLight( 0xffffff, 4, 20 )) cave.children[3].add(new THREE.Mesh( geometry, material )) cave.children[3].rotation.set(0,0,0) cave.children[3].position.set(-40.83202362060547,2.595951795578003,23.14133071899414) console.log(cave) cave.children[1].castShadow = true; //default is false cave.children[1].receiveShadow = false; //default }); loader.load( 'https://ru4real.de/wp-content/themes/areyouforreal/BatLantauMap.glb', function ( data ) { map = data.scene; map.position.set(0, 0, 0); // scene.add( map ); map.position.x = 35.5 map.position.y = -3.5 map.position.z = 4 // map.traverse( function ( child ) { // if ( child instanceof THREE.Object3D ) { // child.name = 'map' // map.children[3].children[0].children[0].name = 'map_white' // plates.push(child) // } // if ( child instanceof THREE.Object3D ) { // plates.push(child) // if ( child instanceof THREE.Mesh ) { // if(child.name === 'map_white'){ // child.material.emissive = {r: 1, g: 1, b: 1} // }else{ // child.material.emissive = {r: map_range(176,0,255,0,1), g: map_range(176,0,255,0,1), b: map_range(255,0,255,0,1)} // } // console.log(child.material.emissive) // } // } // } ); }); loader.load( 'https://ru4real.de/wp-content/themes/areyouforreal/BatLantauMap_sm.glb', function ( data ) { survey = data.scene; survey.position.set(0, 0, 0); // cave.scale.set(0.01, 0.01, 0.01); // scene.add( survey ); // console.log( survey ) // survey.rotation.z = degrees_to_radians(-90) // survey.rotation.x = degrees_to_radians(-180) //survey.position.x = -3.5 //survey.position.y = 1 //survey.position.z = -4.5 // //survey.scale.x = 0.1 //survey.scale.y = 0.1 //survey.scale.z = 0.1 var surveychildren_counter = 0 const texture = new THREE.TextureLoader().load( 'https://ru4real.de/wp-content/themes/areyouforreal/tax.png' ); // immediately use the texture for material creation survey.traverse( function ( child ) { if ( child instanceof THREE.Mesh ) { surveychildren_counter++ console.log('----') if(surveychildren_counter == 4){child.name = 'survay_marker_1' plates.push(child) child.material.emissive = {r: map_range(251,0,255,0,1), g: map_range(100,0,255,0,1), b: map_range(255,0,255,0,1)} console.log(map_range(251,0,255,0,1)) } if(surveychildren_counter == 3){child.name = 'survay_marker_2' plates.push(child) child.material.emissive = {r: map_range(251,0,255,0,1), g: map_range(100,0,255,0,1), b: map_range(255,0,255,0,1)} console.log(map_range(251,0,255,0,1)) } if(surveychildren_counter == 2){child.name = 'survay_marker_3' plates.push(child) child.material.emissive = {r: map_range(251,0,255,0,1), g: map_range(100,0,255,0,1), b: map_range(255,0,255,0,1)} console.log(map_range(251,0,255,0,1)) } if(surveychildren_counter == 1){child.name = 'survay_marker_4' plates.push(child) child.material.emissive = {r: map_range(251,0,255,0,1), g: map_range(100,0,255,0,1), b: map_range(255,0,255,0,1)} console.log(map_range(251,0,255,0,1)) } if(surveychildren_counter == 5){ child.material = new THREE.MeshBasicMaterial( { map: texture } ); // child.visible = false } } } ); console.log(scene) }); var plates=[] var plates_pos=[] loader.load( 'https://ru4real.de/wp-content/themes/areyouforreal/plate.gltf', function ( data ) { plate = data.scene; scene.add( plate ); plate.position.x = 35.5 plate.position.y = -4.5 plate.position.z = 4 for (var i = plate.children.length - 1; i >= 0; i--) { plate.children[i].children[0].children[0].material = new THREE.MeshBasicMaterial( {color: 0x00ff00, transparent: true, opacity: 0, side: THREE.DoubleSide} ); plates.push(plate.children[i].children[0].children[0]) plates_pos.push(plate.children[i].position) plate.children[i].children[0].children[0].name = 'plate_'+i } }); camera.position.set(0, 0, 0); var video1 = $('