mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-20 21:05:28 +02:00
wip
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -41,7 +41,9 @@ export class WorldEngine extends EventEmitter<WorldEngineEvents> {
|
|||||||
public lightContainer: BABYLON.ClusteredLightContainer;
|
public lightContainer: BABYLON.ClusteredLightContainer;
|
||||||
public sr: BABYLON.SnapshotRenderingHelper;
|
public sr: BABYLON.SnapshotRenderingHelper;
|
||||||
private gl: BABYLON.GlowLayer | null = null;
|
private gl: BABYLON.GlowLayer | null = null;
|
||||||
public textMaterial: BABYLON.StandardMaterial;
|
private textMaterial: BABYLON.StandardMaterial;
|
||||||
|
private translucentTextMaterial: BABYLON.StandardMaterial;
|
||||||
|
private reflectionProbe: BABYLON.ReflectionProbe;
|
||||||
|
|
||||||
public isSitting = false;
|
public isSitting = false;
|
||||||
private fps: number | null = null;
|
private fps: number | null = null;
|
||||||
@@ -93,7 +95,7 @@ export class WorldEngine extends EventEmitter<WorldEngineEvents> {
|
|||||||
this.scene.ambientColor = new BABYLON.Color3(0.9, 0.9, 0.9);
|
this.scene.ambientColor = new BABYLON.Color3(0.9, 0.9, 0.9);
|
||||||
|
|
||||||
this.envMap = BABYLON.CubeTexture.CreateFromPrefilteredData(this.time === 2 ? '/client-assets/room/outdoor-night.env' : '/client-assets/room/outdoor-day.env', this.scene);
|
this.envMap = BABYLON.CubeTexture.CreateFromPrefilteredData(this.time === 2 ? '/client-assets/room/outdoor-night.env' : '/client-assets/room/outdoor-day.env', this.scene);
|
||||||
//this.envMap.level = 0.3;
|
//this.envMap.level = 1;
|
||||||
this.envMap.level = 0;
|
this.envMap.level = 0;
|
||||||
|
|
||||||
this.scene.collisionsEnabled = true;
|
this.scene.collisionsEnabled = true;
|
||||||
@@ -112,6 +114,14 @@ export class WorldEngine extends EventEmitter<WorldEngineEvents> {
|
|||||||
|
|
||||||
//this.scene.activeCamera = this.camera;
|
//this.scene.activeCamera = this.camera;
|
||||||
|
|
||||||
|
//this.reflectionProbe = new BABYLON.ReflectionProbe('rp', 512, this.scene, true, true, false);
|
||||||
|
//this.reflectionProbe.refreshRate = 60;
|
||||||
|
|
||||||
|
//const mainLight = new BABYLON.PointLight('mainLight', new BABYLON.Vector3(0, cm(300), 0), this.scene);
|
||||||
|
//mainLight.intensity = 10000000;
|
||||||
|
//mainLight.radius = cm(1000);
|
||||||
|
//mainLight.diffuse = new BABYLON.Color3(1, 1, 1);
|
||||||
|
|
||||||
const ambientLight1 = new BABYLON.HemisphericLight('ambientLight1', new BABYLON.Vector3(0, 1, 0), this.scene);
|
const ambientLight1 = new BABYLON.HemisphericLight('ambientLight1', new BABYLON.Vector3(0, 1, 0), this.scene);
|
||||||
ambientLight1.diffuse = new BABYLON.Color3(1.0, 0.9, 0.8);
|
ambientLight1.diffuse = new BABYLON.Color3(1.0, 0.9, 0.8);
|
||||||
ambientLight1.intensity = 1;
|
ambientLight1.intensity = 1;
|
||||||
@@ -221,7 +231,10 @@ export class WorldEngine extends EventEmitter<WorldEngineEvents> {
|
|||||||
for (const mesh of envObj.meshes) {
|
for (const mesh of envObj.meshes) {
|
||||||
if (mesh.name === '__root__') continue;
|
if (mesh.name === '__root__') continue;
|
||||||
mesh.checkCollisions = true;
|
mesh.checkCollisions = true;
|
||||||
if (mesh.material) (mesh.material as BABYLON.PBRMaterial).reflectionTexture = this.envMap;
|
if (this.reflectionProbe != null) {
|
||||||
|
if (mesh.material) (mesh.material as BABYLON.PBRMaterial).reflectionTexture = this.reflectionProbe.cubeTexture;
|
||||||
|
if (mesh.material) (mesh.material as BABYLON.PBRMaterial).realTimeFiltering = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.textMaterial = new BABYLON.StandardMaterial('textMaterial', this.scene);
|
this.textMaterial = new BABYLON.StandardMaterial('textMaterial', this.scene);
|
||||||
@@ -232,6 +245,9 @@ export class WorldEngine extends EventEmitter<WorldEngineEvents> {
|
|||||||
this.textMaterial.useAlphaFromDiffuseTexture = true;
|
this.textMaterial.useAlphaFromDiffuseTexture = true;
|
||||||
this.textMaterial.freeze();
|
this.textMaterial.freeze();
|
||||||
|
|
||||||
|
this.translucentTextMaterial = this.textMaterial.clone('translucentTextMaterial');
|
||||||
|
this.translucentTextMaterial.alpha = 0.25;
|
||||||
|
|
||||||
{
|
{
|
||||||
const objet = envObj.meshes.find(m => m.name.includes('__OBJET__'));
|
const objet = envObj.meshes.find(m => m.name.includes('__OBJET__'));
|
||||||
objet.rotation = objet.rotationQuaternion.toEulerAngles();
|
objet.rotation = objet.rotationQuaternion.toEulerAngles();
|
||||||
@@ -310,7 +326,7 @@ export class WorldEngine extends EventEmitter<WorldEngineEvents> {
|
|||||||
messageRing.rotationQuaternion = null;
|
messageRing.rotationQuaternion = null;
|
||||||
const text = new RecyvlingTextGrid(messageRing, 256, {
|
const text = new RecyvlingTextGrid(messageRing, 256, {
|
||||||
meshFlipped: true,
|
meshFlipped: true,
|
||||||
material: this.textMaterial,
|
material: this.translucentTextMaterial,
|
||||||
repeatSeparator: ' ',
|
repeatSeparator: ' ',
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -412,6 +428,8 @@ export class WorldEngine extends EventEmitter<WorldEngineEvents> {
|
|||||||
]);
|
]);
|
||||||
sphereRoot.animations = [anim];
|
sphereRoot.animations = [anim];
|
||||||
this.scene.beginAnimation(sphereRoot, 0, speed, true);
|
this.scene.beginAnimation(sphereRoot, 0, speed, true);
|
||||||
|
|
||||||
|
if (this.reflectionProbe != null) this.reflectionProbe.renderList.push(sphere);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i < 64; i++) {
|
for (let i = 0; i < 64; i++) {
|
||||||
@@ -437,6 +455,8 @@ export class WorldEngine extends EventEmitter<WorldEngineEvents> {
|
|||||||
]);
|
]);
|
||||||
sphereRoot.animations = [anim];
|
sphereRoot.animations = [anim];
|
||||||
this.scene.beginAnimation(sphereRoot, 0, speed, true);
|
this.scene.beginAnimation(sphereRoot, 0, speed, true);
|
||||||
|
|
||||||
|
if (this.reflectionProbe != null) this.reflectionProbe.renderList.push(sphere);
|
||||||
}
|
}
|
||||||
|
|
||||||
//const sphere = BABYLON.MeshBuilder.CreateSphere('', { diameter: cm(10) }, this.scene);
|
//const sphere = BABYLON.MeshBuilder.CreateSphere('', { diameter: cm(10) }, this.scene);
|
||||||
@@ -471,6 +491,12 @@ export class WorldEngine extends EventEmitter<WorldEngineEvents> {
|
|||||||
const worldRingH = envObj.meshes.find(m => m.name.includes('__WORLD_RING_H__'));
|
const worldRingH = envObj.meshes.find(m => m.name.includes('__WORLD_RING_H__'));
|
||||||
const worldRingM = envObj.meshes.find(m => m.name.includes('__WORLD_RING_M__'));
|
const worldRingM = envObj.meshes.find(m => m.name.includes('__WORLD_RING_M__'));
|
||||||
|
|
||||||
|
worldRingH.material.reflectionTexture = null;
|
||||||
|
worldRingM.material.reflectionTexture = null;
|
||||||
|
|
||||||
|
if (this.reflectionProbe != null) this.reflectionProbe.renderList.push(worldRingH);
|
||||||
|
if (this.reflectionProbe != null) this.reflectionProbe.renderList.push(worldRingM);
|
||||||
|
|
||||||
worldRingH.rotation = worldRingH.rotationQuaternion.toEulerAngles();
|
worldRingH.rotation = worldRingH.rotationQuaternion.toEulerAngles();
|
||||||
worldRingM.rotation = worldRingM.rotationQuaternion.toEulerAngles();
|
worldRingM.rotation = worldRingM.rotationQuaternion.toEulerAngles();
|
||||||
worldRingH.rotationQuaternion = null;
|
worldRingH.rotationQuaternion = null;
|
||||||
|
|||||||
@@ -646,12 +646,12 @@ export class RecyvlingTextGrid {
|
|||||||
const prev = this.currentText;
|
const prev = this.currentText;
|
||||||
for (let i = 0; i <= prev.length; i++) {
|
for (let i = 0; i <= prev.length; i++) {
|
||||||
this.write(prev.substring(0, prev.length - (i + 1)).padEnd(prev.length, ' '));
|
this.write(prev.substring(0, prev.length - (i + 1)).padEnd(prev.length, ' '));
|
||||||
await sleep(30);
|
await sleep(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0; i <= text.length; i++) {
|
for (let i = 0; i <= text.length; i++) {
|
||||||
this.write(text.substring(0, i + 1).padEnd(text.length, ' '));
|
this.write(text.substring(0, i + 1).padEnd(text.length, ' '));
|
||||||
await sleep(30);
|
await sleep(20);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user