This commit is contained in:
Binary file not shown.
@@ -4,12 +4,10 @@
|
|||||||
"version":"2.0"
|
"version":"2.0"
|
||||||
},
|
},
|
||||||
"extensionsUsed":[
|
"extensionsUsed":[
|
||||||
"KHR_draco_mesh_compression",
|
|
||||||
"KHR_materials_specular",
|
"KHR_materials_specular",
|
||||||
"EXT_texture_webp"
|
"EXT_texture_webp"
|
||||||
],
|
],
|
||||||
"extensionsRequired":[
|
"extensionsRequired":[
|
||||||
"KHR_draco_mesh_compression",
|
|
||||||
"EXT_texture_webp"
|
"EXT_texture_webp"
|
||||||
],
|
],
|
||||||
"scene":0,
|
"scene":0,
|
||||||
@@ -27,22 +25,41 @@
|
|||||||
],
|
],
|
||||||
"nodes":[
|
"nodes":[
|
||||||
{
|
{
|
||||||
|
"extras":{
|
||||||
|
"io.maxDistance":30,
|
||||||
|
"re.renderOrder":-550
|
||||||
|
},
|
||||||
"mesh":0,
|
"mesh":0,
|
||||||
"name":"floor"
|
"name":"floor"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"extras":{
|
||||||
|
"re.renderOrder":0,
|
||||||
|
"io.maxDistance":30
|
||||||
|
},
|
||||||
"mesh":1,
|
"mesh":1,
|
||||||
"name":"tunnel"
|
"name":"tunnel"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"extras":{
|
||||||
|
"io.maxDistance":30,
|
||||||
|
"re.renderOrder":-500
|
||||||
|
},
|
||||||
"mesh":2,
|
"mesh":2,
|
||||||
"name":"door"
|
"name":"door"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"extras":{
|
||||||
|
"re.renderOrder":-600
|
||||||
|
},
|
||||||
"mesh":3,
|
"mesh":3,
|
||||||
"name":"surface"
|
"name":"surface"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"extras":{
|
||||||
|
"io.maxDistance":30,
|
||||||
|
"re.renderOrder":-500
|
||||||
|
},
|
||||||
"mesh":4,
|
"mesh":4,
|
||||||
"name":"wall"
|
"name":"wall"
|
||||||
}
|
}
|
||||||
@@ -123,23 +140,15 @@
|
|||||||
"NORMAL":1,
|
"NORMAL":1,
|
||||||
"TEXCOORD_0":2
|
"TEXCOORD_0":2
|
||||||
},
|
},
|
||||||
"extensions":{
|
|
||||||
"KHR_draco_mesh_compression":{
|
|
||||||
"bufferView":0,
|
|
||||||
"attributes":{
|
|
||||||
"POSITION":0,
|
|
||||||
"NORMAL":1,
|
|
||||||
"TEXCOORD_0":2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"indices":3,
|
"indices":3,
|
||||||
"material":0,
|
"material":0
|
||||||
"mode":4
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"extras":{
|
||||||
|
"prop":1.0
|
||||||
|
},
|
||||||
"name":"Sphere.001",
|
"name":"Sphere.001",
|
||||||
"primitives":[
|
"primitives":[
|
||||||
{
|
{
|
||||||
@@ -148,19 +157,8 @@
|
|||||||
"NORMAL":5,
|
"NORMAL":5,
|
||||||
"TEXCOORD_0":6
|
"TEXCOORD_0":6
|
||||||
},
|
},
|
||||||
"extensions":{
|
|
||||||
"KHR_draco_mesh_compression":{
|
|
||||||
"bufferView":1,
|
|
||||||
"attributes":{
|
|
||||||
"POSITION":0,
|
|
||||||
"NORMAL":1,
|
|
||||||
"TEXCOORD_0":2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"indices":7,
|
"indices":7,
|
||||||
"material":1,
|
"material":1
|
||||||
"mode":4
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"attributes":{
|
"attributes":{
|
||||||
@@ -168,19 +166,8 @@
|
|||||||
"NORMAL":9,
|
"NORMAL":9,
|
||||||
"TEXCOORD_0":10
|
"TEXCOORD_0":10
|
||||||
},
|
},
|
||||||
"extensions":{
|
|
||||||
"KHR_draco_mesh_compression":{
|
|
||||||
"bufferView":2,
|
|
||||||
"attributes":{
|
|
||||||
"POSITION":0,
|
|
||||||
"NORMAL":1,
|
|
||||||
"TEXCOORD_0":2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"indices":11,
|
"indices":11,
|
||||||
"material":2,
|
"material":2
|
||||||
"mode":4
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -193,19 +180,8 @@
|
|||||||
"NORMAL":13,
|
"NORMAL":13,
|
||||||
"TEXCOORD_0":14
|
"TEXCOORD_0":14
|
||||||
},
|
},
|
||||||
"extensions":{
|
|
||||||
"KHR_draco_mesh_compression":{
|
|
||||||
"bufferView":3,
|
|
||||||
"attributes":{
|
|
||||||
"POSITION":0,
|
|
||||||
"NORMAL":1,
|
|
||||||
"TEXCOORD_0":2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"indices":11,
|
"indices":11,
|
||||||
"material":2,
|
"material":2
|
||||||
"mode":4
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -218,19 +194,8 @@
|
|||||||
"NORMAL":16,
|
"NORMAL":16,
|
||||||
"TEXCOORD_0":17
|
"TEXCOORD_0":17
|
||||||
},
|
},
|
||||||
"extensions":{
|
|
||||||
"KHR_draco_mesh_compression":{
|
|
||||||
"bufferView":4,
|
|
||||||
"attributes":{
|
|
||||||
"POSITION":0,
|
|
||||||
"NORMAL":1,
|
|
||||||
"TEXCOORD_0":2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"indices":18,
|
"indices":18,
|
||||||
"material":3,
|
"material":3
|
||||||
"mode":4
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -243,19 +208,8 @@
|
|||||||
"NORMAL":20,
|
"NORMAL":20,
|
||||||
"TEXCOORD_0":21
|
"TEXCOORD_0":21
|
||||||
},
|
},
|
||||||
"extensions":{
|
|
||||||
"KHR_draco_mesh_compression":{
|
|
||||||
"bufferView":5,
|
|
||||||
"attributes":{
|
|
||||||
"POSITION":0,
|
|
||||||
"NORMAL":1,
|
|
||||||
"TEXCOORD_0":2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"indices":22,
|
"indices":22,
|
||||||
"material":1,
|
"material":1
|
||||||
"mode":4
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -344,6 +298,7 @@
|
|||||||
],
|
],
|
||||||
"accessors":[
|
"accessors":[
|
||||||
{
|
{
|
||||||
|
"bufferView":0,
|
||||||
"componentType":5126,
|
"componentType":5126,
|
||||||
"count":272,
|
"count":272,
|
||||||
"max":[
|
"max":[
|
||||||
@@ -359,21 +314,25 @@
|
|||||||
"type":"VEC3"
|
"type":"VEC3"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"bufferView":1,
|
||||||
"componentType":5126,
|
"componentType":5126,
|
||||||
"count":272,
|
"count":272,
|
||||||
"type":"VEC3"
|
"type":"VEC3"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"bufferView":2,
|
||||||
"componentType":5126,
|
"componentType":5126,
|
||||||
"count":272,
|
"count":272,
|
||||||
"type":"VEC2"
|
"type":"VEC2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"bufferView":3,
|
||||||
"componentType":5123,
|
"componentType":5123,
|
||||||
"count":288,
|
"count":288,
|
||||||
"type":"SCALAR"
|
"type":"SCALAR"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"bufferView":4,
|
||||||
"componentType":5126,
|
"componentType":5126,
|
||||||
"count":368,
|
"count":368,
|
||||||
"max":[
|
"max":[
|
||||||
@@ -389,21 +348,25 @@
|
|||||||
"type":"VEC3"
|
"type":"VEC3"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"bufferView":5,
|
||||||
"componentType":5126,
|
"componentType":5126,
|
||||||
"count":368,
|
"count":368,
|
||||||
"type":"VEC3"
|
"type":"VEC3"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"bufferView":6,
|
||||||
"componentType":5126,
|
"componentType":5126,
|
||||||
"count":368,
|
"count":368,
|
||||||
"type":"VEC2"
|
"type":"VEC2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"bufferView":7,
|
||||||
"componentType":5123,
|
"componentType":5123,
|
||||||
"count":990,
|
"count":990,
|
||||||
"type":"SCALAR"
|
"type":"SCALAR"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"bufferView":8,
|
||||||
"componentType":5126,
|
"componentType":5126,
|
||||||
"count":4,
|
"count":4,
|
||||||
"max":[
|
"max":[
|
||||||
@@ -419,21 +382,25 @@
|
|||||||
"type":"VEC3"
|
"type":"VEC3"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"bufferView":9,
|
||||||
"componentType":5126,
|
"componentType":5126,
|
||||||
"count":4,
|
"count":4,
|
||||||
"type":"VEC3"
|
"type":"VEC3"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"bufferView":10,
|
||||||
"componentType":5126,
|
"componentType":5126,
|
||||||
"count":4,
|
"count":4,
|
||||||
"type":"VEC2"
|
"type":"VEC2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"bufferView":11,
|
||||||
"componentType":5123,
|
"componentType":5123,
|
||||||
"count":6,
|
"count":6,
|
||||||
"type":"SCALAR"
|
"type":"SCALAR"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"bufferView":12,
|
||||||
"componentType":5126,
|
"componentType":5126,
|
||||||
"count":4,
|
"count":4,
|
||||||
"max":[
|
"max":[
|
||||||
@@ -449,16 +416,19 @@
|
|||||||
"type":"VEC3"
|
"type":"VEC3"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"bufferView":13,
|
||||||
"componentType":5126,
|
"componentType":5126,
|
||||||
"count":4,
|
"count":4,
|
||||||
"type":"VEC3"
|
"type":"VEC3"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"bufferView":14,
|
||||||
"componentType":5126,
|
"componentType":5126,
|
||||||
"count":4,
|
"count":4,
|
||||||
"type":"VEC2"
|
"type":"VEC2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"bufferView":15,
|
||||||
"componentType":5126,
|
"componentType":5126,
|
||||||
"count":4,
|
"count":4,
|
||||||
"max":[
|
"max":[
|
||||||
@@ -474,21 +444,25 @@
|
|||||||
"type":"VEC3"
|
"type":"VEC3"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"bufferView":16,
|
||||||
"componentType":5126,
|
"componentType":5126,
|
||||||
"count":4,
|
"count":4,
|
||||||
"type":"VEC3"
|
"type":"VEC3"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"bufferView":17,
|
||||||
"componentType":5126,
|
"componentType":5126,
|
||||||
"count":4,
|
"count":4,
|
||||||
"type":"VEC2"
|
"type":"VEC2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"bufferView":18,
|
||||||
"componentType":5123,
|
"componentType":5123,
|
||||||
"count":6,
|
"count":6,
|
||||||
"type":"SCALAR"
|
"type":"SCALAR"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"bufferView":19,
|
||||||
"componentType":5126,
|
"componentType":5126,
|
||||||
"count":36,
|
"count":36,
|
||||||
"max":[
|
"max":[
|
||||||
@@ -504,16 +478,19 @@
|
|||||||
"type":"VEC3"
|
"type":"VEC3"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"bufferView":20,
|
||||||
"componentType":5126,
|
"componentType":5126,
|
||||||
"count":36,
|
"count":36,
|
||||||
"type":"VEC3"
|
"type":"VEC3"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"bufferView":21,
|
||||||
"componentType":5126,
|
"componentType":5126,
|
||||||
"count":36,
|
"count":36,
|
||||||
"type":"VEC2"
|
"type":"VEC2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"bufferView":22,
|
||||||
"componentType":5123,
|
"componentType":5123,
|
||||||
"count":54,
|
"count":54,
|
||||||
"type":"SCALAR"
|
"type":"SCALAR"
|
||||||
@@ -522,33 +499,141 @@
|
|||||||
"bufferViews":[
|
"bufferViews":[
|
||||||
{
|
{
|
||||||
"buffer":0,
|
"buffer":0,
|
||||||
"byteLength":2376,
|
"byteLength":3264,
|
||||||
"byteOffset":0
|
"byteOffset":0,
|
||||||
|
"target":34962
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"buffer":0,
|
"buffer":0,
|
||||||
"byteLength":3883,
|
"byteLength":3264,
|
||||||
"byteOffset":2376
|
"byteOffset":3264,
|
||||||
|
"target":34962
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"buffer":0,
|
"buffer":0,
|
||||||
"byteLength":166,
|
"byteLength":2176,
|
||||||
"byteOffset":6260
|
"byteOffset":6528,
|
||||||
|
"target":34962
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"buffer":0,
|
"buffer":0,
|
||||||
"byteLength":166,
|
"byteLength":576,
|
||||||
"byteOffset":6428
|
"byteOffset":8704,
|
||||||
|
"target":34963
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"buffer":0,
|
"buffer":0,
|
||||||
"byteLength":167,
|
"byteLength":4416,
|
||||||
"byteOffset":6596
|
"byteOffset":9280,
|
||||||
|
"target":34962
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"buffer":0,
|
"buffer":0,
|
||||||
"byteLength":561,
|
"byteLength":4416,
|
||||||
"byteOffset":6764
|
"byteOffset":13696,
|
||||||
|
"target":34962
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"buffer":0,
|
||||||
|
"byteLength":2944,
|
||||||
|
"byteOffset":18112,
|
||||||
|
"target":34962
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"buffer":0,
|
||||||
|
"byteLength":1980,
|
||||||
|
"byteOffset":21056,
|
||||||
|
"target":34963
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"buffer":0,
|
||||||
|
"byteLength":48,
|
||||||
|
"byteOffset":23036,
|
||||||
|
"target":34962
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"buffer":0,
|
||||||
|
"byteLength":48,
|
||||||
|
"byteOffset":23084,
|
||||||
|
"target":34962
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"buffer":0,
|
||||||
|
"byteLength":32,
|
||||||
|
"byteOffset":23132,
|
||||||
|
"target":34962
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"buffer":0,
|
||||||
|
"byteLength":12,
|
||||||
|
"byteOffset":23164,
|
||||||
|
"target":34963
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"buffer":0,
|
||||||
|
"byteLength":48,
|
||||||
|
"byteOffset":23176,
|
||||||
|
"target":34962
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"buffer":0,
|
||||||
|
"byteLength":48,
|
||||||
|
"byteOffset":23224,
|
||||||
|
"target":34962
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"buffer":0,
|
||||||
|
"byteLength":32,
|
||||||
|
"byteOffset":23272,
|
||||||
|
"target":34962
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"buffer":0,
|
||||||
|
"byteLength":48,
|
||||||
|
"byteOffset":23304,
|
||||||
|
"target":34962
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"buffer":0,
|
||||||
|
"byteLength":48,
|
||||||
|
"byteOffset":23352,
|
||||||
|
"target":34962
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"buffer":0,
|
||||||
|
"byteLength":32,
|
||||||
|
"byteOffset":23400,
|
||||||
|
"target":34962
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"buffer":0,
|
||||||
|
"byteLength":12,
|
||||||
|
"byteOffset":23432,
|
||||||
|
"target":34963
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"buffer":0,
|
||||||
|
"byteLength":432,
|
||||||
|
"byteOffset":23444,
|
||||||
|
"target":34962
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"buffer":0,
|
||||||
|
"byteLength":432,
|
||||||
|
"byteOffset":23876,
|
||||||
|
"target":34962
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"buffer":0,
|
||||||
|
"byteLength":288,
|
||||||
|
"byteOffset":24308,
|
||||||
|
"target":34962
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"buffer":0,
|
||||||
|
"byteLength":108,
|
||||||
|
"byteOffset":24596,
|
||||||
|
"target":34963
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"samplers":[
|
"samplers":[
|
||||||
@@ -559,7 +644,7 @@
|
|||||||
],
|
],
|
||||||
"buffers":[
|
"buffers":[
|
||||||
{
|
{
|
||||||
"byteLength":7328,
|
"byteLength":24704,
|
||||||
"uri":"quiz.bin"
|
"uri":"quiz.bin"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -91,19 +91,20 @@ class InteractiveObject extends EventManager{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (obj.distance) {
|
if (obj.distance) {
|
||||||
const o = this.object;
|
engine.hideIfFar(this.object, obj.distance)
|
||||||
let dstm = obj.distance;
|
// const o = this.object;
|
||||||
let v = new Vector3();
|
// let dstm = obj.distance;
|
||||||
o.visible = false;
|
// let v = new Vector3();
|
||||||
engine.addEventListener('beforeRender', function () {
|
// o.visible = false;
|
||||||
o.getWorldPosition(v);
|
// engine.addEventListener('beforeRender', function () {
|
||||||
var dst = engine.cameraWorld.position.distanceTo(v);
|
// o.getWorldPosition(v);
|
||||||
if (dst <= dstm && !o.visible) {
|
// var dst = engine.cameraWorld.position.distanceTo(v);
|
||||||
o.visible = true;
|
// if (dst <= dstm && !o.visible) {
|
||||||
}else if (dst > dstm && o.visible){
|
// o.visible = true;
|
||||||
o.visible = false;
|
// }else if (dst > dstm && o.visible){
|
||||||
}
|
// o.visible = false;
|
||||||
});
|
// }
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
resolve(this);
|
resolve(this);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Group, Vector3, Matrix4, Mesh, Quaternion, PlaneGeometry, MeshStandardMaterial, DoubleSide, RepeatWrapping, Vector2} from 'three';
|
import { Group, Vector3, Matrix4, Quaternion, RepeatWrapping, Vector2} from 'three';
|
||||||
import { InteractiveObject } from '../InteractiveObject';
|
import { InteractiveObject } from '../InteractiveObject';
|
||||||
import { getBoundingBox, getBoundingBoxSize } from '@/lib/MeshUtils';
|
import { getBoundingBox, getBoundingBoxSize } from '@/lib/MeshUtils';
|
||||||
|
|
||||||
@@ -79,6 +79,9 @@ class MazeObject {
|
|||||||
bbox.l = Math.min(g.position.x, bbox.l)
|
bbox.l = Math.min(g.position.x, bbox.l)
|
||||||
bbox.r = Math.max(g.position.x, bbox.r)
|
bbox.r = Math.max(g.position.x, bbox.r)
|
||||||
bbox.f = Math.max(g.position.z, bbox.f)
|
bbox.f = Math.max(g.position.z, bbox.f)
|
||||||
|
if (g.userData?.['io.maxDistance']){
|
||||||
|
engine.hideIfFar(g, g.userData?.['io.maxDistance']);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//the floor:
|
//the floor:
|
||||||
@@ -101,6 +104,9 @@ class MazeObject {
|
|||||||
let t = o.tunnel.clone();
|
let t = o.tunnel.clone();
|
||||||
t.position.set(0, 0, i * tubeSize);
|
t.position.set(0, 0, i * tubeSize);
|
||||||
def.matrix && t.applyMatrix4(def.matrix);
|
def.matrix && t.applyMatrix4(def.matrix);
|
||||||
|
if (t.userData?.['io.maxDistance']){
|
||||||
|
engine.hideIfFar(t, t.userData?.['io.maxDistance']);
|
||||||
|
}
|
||||||
root.add(t);
|
root.add(t);
|
||||||
}
|
}
|
||||||
offsetZ = def.len * tubeSize;
|
offsetZ = def.len * tubeSize;
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ class DashBoard extends EventManager {
|
|||||||
hud.add(hudTarget)
|
hud.add(hudTarget)
|
||||||
hudTarget.position.set(0,0,0.52);
|
hudTarget.position.set(0,0,0.52);
|
||||||
dash.visible = false;
|
dash.visible = false;
|
||||||
|
dash.renderOrder = 1000;
|
||||||
const k = 3.11;
|
const k = 3.11;
|
||||||
const dashWidth = engine.aspect * k, dashHeight = k;
|
const dashWidth = engine.aspect * k, dashHeight = k;
|
||||||
const dashDistance = 1.77;
|
const dashDistance = 1.77;
|
||||||
@@ -76,7 +77,8 @@ class DashBoard extends EventManager {
|
|||||||
new MeshBasicMaterial({
|
new MeshBasicMaterial({
|
||||||
map,
|
map,
|
||||||
opacity: 0.52,
|
opacity: 0.52,
|
||||||
transparent:true
|
transparent:true,
|
||||||
|
depthTest: false,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
textPlane.position.z = -0.002;
|
textPlane.position.z = -0.002;
|
||||||
@@ -84,7 +86,7 @@ class DashBoard extends EventManager {
|
|||||||
textPlane.visible = false;
|
textPlane.visible = false;
|
||||||
dash.add(textPlane)
|
dash.add(textPlane)
|
||||||
// fix #44
|
// fix #44
|
||||||
textPlane.material.depthTest = false;
|
//textPlane.material.depthTest = false;
|
||||||
//hudPlane.material.depthTest = false;
|
//hudPlane.material.depthTest = false;
|
||||||
this.sceneHeader = sceneHeader = await new SceneHeader(engine, {dashWidth, dashHeight});
|
this.sceneHeader = sceneHeader = await new SceneHeader(engine, {dashWidth, dashHeight});
|
||||||
dash.add(sceneHeader.object);
|
dash.add(sceneHeader.object);
|
||||||
|
|||||||
+29
-1
@@ -100,7 +100,7 @@ class GameEngine extends EventManager{
|
|||||||
renderer.setSize(this.w, this.h);
|
renderer.setSize(this.w, this.h);
|
||||||
renderer.setViewport(0, 0, this.w, this.h);
|
renderer.setViewport(0, 0, this.w, this.h);
|
||||||
renderer.autoClear = true;
|
renderer.autoClear = true;
|
||||||
renderer.alpha = true
|
//renderer.alpha = true
|
||||||
this.renderer = renderer;
|
this.renderer = renderer;
|
||||||
|
|
||||||
this.anaglyph = new AnaglyphEffect(renderer);
|
this.anaglyph = new AnaglyphEffect(renderer);
|
||||||
@@ -163,6 +163,7 @@ class GameEngine extends EventManager{
|
|||||||
gameEngine.hero?.update(delta);
|
gameEngine.hero?.update(delta);
|
||||||
gameEngine.mixers.forEach(m => m.update(delta));
|
gameEngine.mixers.forEach(m => m.update(delta));
|
||||||
gameEngine.dispatchEvent({type: 'beforeRender'})
|
gameEngine.dispatchEvent({type: 'beforeRender'})
|
||||||
|
gameEngine.processHideIfFar();
|
||||||
this.motionQueue.update(delta);
|
this.motionQueue.update(delta);
|
||||||
|
|
||||||
gameEngine.render(scene, gameEngine.camera);
|
gameEngine.render(scene, gameEngine.camera);
|
||||||
@@ -454,6 +455,13 @@ class GameEngine extends EventManager{
|
|||||||
if (object.material.map) {
|
if (object.material.map) {
|
||||||
object.material.map.colorSpace = THREE.SRGBColorSpace;
|
object.material.map.colorSpace = THREE.SRGBColorSpace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (object.userData){
|
||||||
|
if (object.userData['re.renderOrder'] !== undefined){
|
||||||
|
object.renderOrder = object.userData['re.renderOrder'];
|
||||||
|
//object.material.alphaTest = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
object.frustumCulled = false;
|
object.frustumCulled = false;
|
||||||
object.castShadow = true;
|
object.castShadow = true;
|
||||||
@@ -604,6 +612,26 @@ class GameEngine extends EventManager{
|
|||||||
this.stats?.update()
|
this.stats?.update()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
farArray = [];
|
||||||
|
|
||||||
|
hideIfFar(object, distance){
|
||||||
|
object.visible = false;
|
||||||
|
this.farArray.push({object, distance})
|
||||||
|
}
|
||||||
|
|
||||||
|
processHideIfFar(){
|
||||||
|
let v = new THREE.Vector3();
|
||||||
|
this.farArray.forEach(e=>{
|
||||||
|
e.object.getWorldPosition(v);
|
||||||
|
let dst = this.cameraWorld.position.distanceTo(v);
|
||||||
|
if (dst <= e.distance && !e.object.visible) {
|
||||||
|
e.object.visible = true;
|
||||||
|
}else if (dst > e.distance && e.object.visible){
|
||||||
|
e.object.visible = false;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
clearScene(){
|
clearScene(){
|
||||||
this.hero?.destroy();
|
this.hero?.destroy();
|
||||||
this.dashboard?.reset();
|
this.dashboard?.reset();
|
||||||
|
|||||||
Reference in New Issue
Block a user