mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-14 16:56:00 +02:00
wip
This commit is contained in:
@@ -293,6 +293,14 @@ export class RoomController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public updateRoomLightColor(color: [number, number, number]) {
|
||||||
|
if (this.worker != null) {
|
||||||
|
this.worker.postMessage({ type: 'updateRoomLightColor', color });
|
||||||
|
} else if (this.engine != null) {
|
||||||
|
this.engine.updateRoomLightColor(color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public beginSelectedInstalledObjectGrabbing() {
|
public beginSelectedInstalledObjectGrabbing() {
|
||||||
if (this.worker != null) {
|
if (this.worker != null) {
|
||||||
this.worker.postMessage({ type: 'beginSelectedInstalledObjectGrabbing' });
|
this.worker.postMessage({ type: 'beginSelectedInstalledObjectGrabbing' });
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ export type RoomState = {
|
|||||||
type: 'japanese';
|
type: 'japanese';
|
||||||
options: JapaneseHeyaOptions;
|
options: JapaneseHeyaOptions;
|
||||||
};
|
};
|
||||||
|
roomLightColor: [number, number, number];
|
||||||
installedObjects: RoomStateObject<any>[];
|
installedObjects: RoomStateObject<any>[];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -282,6 +283,7 @@ export class RoomEngine extends EventEmitter<RoomEngineEvents> {
|
|||||||
roomCollisionCube.position.y = cm(150);
|
roomCollisionCube.position.y = cm(150);
|
||||||
roomCollisionCube.scaling.x = -1; // flip normals
|
roomCollisionCube.scaling.x = -1; // flip normals
|
||||||
roomCollisionCube.isVisible = false;
|
roomCollisionCube.isVisible = false;
|
||||||
|
roomCollisionCube.isPickable = false;
|
||||||
roomCollisionCube.checkCollisions = true;
|
roomCollisionCube.checkCollisions = true;
|
||||||
|
|
||||||
this.scene.collisionsEnabled = true;
|
this.scene.collisionsEnabled = true;
|
||||||
@@ -331,7 +333,7 @@ export class RoomEngine extends EventEmitter<RoomEngineEvents> {
|
|||||||
//this.scene.activeCamera = this.camera;
|
//this.scene.activeCamera = this.camera;
|
||||||
|
|
||||||
this.roomLight = new BABYLON.SpotLight('roomLight', new BABYLON.Vector3(0, cm(249), 0), new BABYLON.Vector3(0, -1, 0), 16, 8, this.scene);
|
this.roomLight = new BABYLON.SpotLight('roomLight', new BABYLON.Vector3(0, cm(249), 0), new BABYLON.Vector3(0, -1, 0), 16, 8, this.scene);
|
||||||
this.roomLight.diffuse = new BABYLON.Color3(1.0, 0.9, 0.8);
|
this.roomLight.diffuse = roomState.roomLightColor != null ? new BABYLON.Color3(...roomState.roomLightColor) : new BABYLON.Color3(1.0, 0.9, 0.8);
|
||||||
this.roomLight.shadowMinZ = cm(10);
|
this.roomLight.shadowMinZ = cm(10);
|
||||||
this.roomLight.shadowMaxZ = cm(300);
|
this.roomLight.shadowMaxZ = cm(300);
|
||||||
this.roomLight.radius = cm(30);
|
this.roomLight.radius = cm(30);
|
||||||
@@ -446,14 +448,6 @@ export class RoomEngine extends EventEmitter<RoomEngineEvents> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public cameraJoystickMove(vector: { x: number; y: number; }) {
|
|
||||||
this.camera.inputs.attached.joystick.setJoystickMoveVector(vector);
|
|
||||||
}
|
|
||||||
|
|
||||||
public cameraJoystickRotate(vector: { x: number; y: number; }) {
|
|
||||||
this.camera.inputs.attached.joystick.setJoystickRotationVector(vector);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async init() {
|
public async init() {
|
||||||
await this.loadHeya();
|
await this.loadHeya();
|
||||||
if (RENDER_OUTDOOR_ENV) await this.loadEnvModel();
|
if (RENDER_OUTDOOR_ENV) await this.loadEnvModel();
|
||||||
@@ -611,6 +605,14 @@ export class RoomEngine extends EventEmitter<RoomEngineEvents> {
|
|||||||
this.startRenderLoop();
|
this.startRenderLoop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public cameraJoystickMove(vector: { x: number; y: number; }) {
|
||||||
|
(this.camera.inputs.attached.joystick as FreeCameraTouchVirtualJoystickInput).setJoystickMoveVector(vector);
|
||||||
|
}
|
||||||
|
|
||||||
|
public cameraJoystickRotate(vector: { x: number; y: number; }) {
|
||||||
|
(this.camera.inputs.attached.joystick as FreeCameraTouchVirtualJoystickInput).setJoystickRotationVector(vector);
|
||||||
|
}
|
||||||
|
|
||||||
public selectObject(objectId: string | null) {
|
public selectObject(objectId: string | null) {
|
||||||
if (SNAPSHOT_RENDERING) this.sr.disableSnapshotRendering(); // snapshot rendering中にbake/unbakeするとエラーになる。なおこのメソッドは参照カウント方式な点に留意
|
if (SNAPSHOT_RENDERING) this.sr.disableSnapshotRendering(); // snapshot rendering中にbake/unbakeするとエラーになる。なおこのメソッドは参照カウント方式な点に留意
|
||||||
|
|
||||||
@@ -1409,11 +1411,19 @@ export class RoomEngine extends EventEmitter<RoomEngineEvents> {
|
|||||||
this.fixedCamera.parent = null;
|
this.fixedCamera.parent = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public updateRoomLightColor(color: [number, number, number]) {
|
||||||
|
this.roomLight.diffuse = new BABYLON.Color3(...color);
|
||||||
|
this.roomState.roomLightColor = color;
|
||||||
|
this.emit('changeRoomState', { roomState: this.roomState });
|
||||||
|
}
|
||||||
|
|
||||||
private turnOnRoomLight(forInit = false) {
|
private turnOnRoomLight(forInit = false) {
|
||||||
if (!forInit && SNAPSHOT_RENDERING) this.sr.disableSnapshotRendering(); // このメソッドは参照カウント方式な点に留意
|
if (!forInit && SNAPSHOT_RENDERING) this.sr.disableSnapshotRendering(); // このメソッドは参照カウント方式な点に留意
|
||||||
this.roomLight.intensity = 18 * WORLD_SCALE * WORLD_SCALE;
|
this.roomLight.intensity = 18 * WORLD_SCALE * WORLD_SCALE;
|
||||||
this.envMapIndoor.level = 0.6;
|
this.envMapIndoor.level = 0.6;
|
||||||
if (!forInit && SNAPSHOT_RENDERING) {
|
if (!forInit && SNAPSHOT_RENDERING) {
|
||||||
|
// workerで実行される可能性がある
|
||||||
|
// eslint-disable-next-line no-restricted-globals
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.sr.enableSnapshotRendering(); // このメソッドは参照カウント方式な点に留意
|
this.sr.enableSnapshotRendering(); // このメソッドは参照カウント方式な点に留意
|
||||||
}, 10);
|
}, 10);
|
||||||
@@ -1424,6 +1434,8 @@ export class RoomEngine extends EventEmitter<RoomEngineEvents> {
|
|||||||
if (SNAPSHOT_RENDERING) this.sr.disableSnapshotRendering(); // このメソッドは参照カウント方式な点に留意
|
if (SNAPSHOT_RENDERING) this.sr.disableSnapshotRendering(); // このメソッドは参照カウント方式な点に留意
|
||||||
this.roomLight.intensity = 0;
|
this.roomLight.intensity = 0;
|
||||||
this.envMapIndoor.level = 0.025;
|
this.envMapIndoor.level = 0.025;
|
||||||
|
// workerで実行される可能性がある
|
||||||
|
// eslint-disable-next-line no-restricted-globals
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (SNAPSHOT_RENDERING) this.sr.enableSnapshotRendering(); // このメソッドは参照カウント方式な点に留意
|
if (SNAPSHOT_RENDERING) this.sr.enableSnapshotRendering(); // このメソッドは参照カウント方式な点に留意
|
||||||
}, 10);
|
}, 10);
|
||||||
|
|||||||
Reference in New Issue
Block a user