mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-20 11:45:30 +02:00
wip
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
Binary file not shown.
Binary file not shown.
@@ -1612,9 +1612,9 @@ export class RoomEngine extends EventEmitter<RoomEngineEvents> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.sr.disableSnapshotRendering();
|
this.sr.disableSnapshotRendering();
|
||||||
if (this.gl != null) {
|
//if (this.gl != null) {
|
||||||
this.gl.isEnabled = false; // 重いので切る
|
// this.gl.isEnabled = false; // 重いので切る
|
||||||
}
|
//}
|
||||||
|
|
||||||
if (this.gridPlane.material == null) {
|
if (this.gridPlane.material == null) {
|
||||||
import('@babylonjs/materials').then(m => {
|
import('@babylonjs/materials').then(m => {
|
||||||
@@ -1639,9 +1639,9 @@ export class RoomEngine extends EventEmitter<RoomEngineEvents> {
|
|||||||
await this.bake();
|
await this.bake();
|
||||||
|
|
||||||
this.sr.enableSnapshotRendering();
|
this.sr.enableSnapshotRendering();
|
||||||
if (this.gl != null) {
|
//if (this.gl != null) {
|
||||||
this.gl.isEnabled = true;
|
// this.gl.isEnabled = true;
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async bake() {
|
public async bake() {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export const electronicDisplayBoard = defineObject({
|
|||||||
},
|
},
|
||||||
default: {
|
default: {
|
||||||
text: 'Hello, Misskey!',
|
text: 'Hello, Misskey!',
|
||||||
frameColor: [0.2, 0.2, 0.2],
|
frameColor: [0.05, 0.05, 0.05],
|
||||||
ledColor: [1, 1, 1],
|
ledColor: [1, 1, 1],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -44,6 +44,7 @@ export const electronicDisplayBoard = defineObject({
|
|||||||
const texLoading = Promise.withResolvers<void>();
|
const texLoading = Promise.withResolvers<void>();
|
||||||
|
|
||||||
const tex = new BABYLON.Texture('/client-assets/room/textures/dot-matrix-chars.png', scene, false, false, undefined, () => {
|
const tex = new BABYLON.Texture('/client-assets/room/textures/dot-matrix-chars.png', scene, false, false, undefined, () => {
|
||||||
|
tex.level = 2;
|
||||||
textMaterial.emissiveTexture = tex;
|
textMaterial.emissiveTexture = tex;
|
||||||
textMaterial.albedoTexture = tex;
|
textMaterial.albedoTexture = tex;
|
||||||
textMaterial.disableLighting = true;
|
textMaterial.disableLighting = true;
|
||||||
@@ -68,6 +69,7 @@ export const electronicDisplayBoard = defineObject({
|
|||||||
const textManager = new RecyvlingTextGrid(displayMesh, maxChars, {
|
const textManager = new RecyvlingTextGrid(displayMesh, maxChars, {
|
||||||
meshFlipped: true,
|
meshFlipped: true,
|
||||||
material: textMaterial,
|
material: textMaterial,
|
||||||
|
charUScale: 1.15,
|
||||||
});
|
});
|
||||||
|
|
||||||
model.bakeExcludeMeshes = [displayMesh];
|
model.bakeExcludeMeshes = [displayMesh];
|
||||||
|
|||||||
@@ -392,6 +392,7 @@ export class RecyvlingTextGrid {
|
|||||||
private currentText = '';
|
private currentText = '';
|
||||||
private meshFlipped: boolean;
|
private meshFlipped: boolean;
|
||||||
private repeatSeparator: string;
|
private repeatSeparator: string;
|
||||||
|
private charUScale: number;
|
||||||
|
|
||||||
/* (non-flipped)
|
/* (non-flipped)
|
||||||
a d--e
|
a d--e
|
||||||
@@ -416,6 +417,7 @@ export class RecyvlingTextGrid {
|
|||||||
meshFlipped: boolean;
|
meshFlipped: boolean;
|
||||||
material: BABYLON.StandardMaterial;
|
material: BABYLON.StandardMaterial;
|
||||||
repeatSeparator?: string;
|
repeatSeparator?: string;
|
||||||
|
charUScale?: number;
|
||||||
}) {
|
}) {
|
||||||
this.mesh = mesh;
|
this.mesh = mesh;
|
||||||
this.mesh.material = options.material;
|
this.mesh.material = options.material;
|
||||||
@@ -426,6 +428,7 @@ export class RecyvlingTextGrid {
|
|||||||
this.uvs = mesh.getVerticesData(BABYLON.VertexBuffer.UVKind)!;
|
this.uvs = mesh.getVerticesData(BABYLON.VertexBuffer.UVKind)!;
|
||||||
this.meshFlipped = options.meshFlipped;
|
this.meshFlipped = options.meshFlipped;
|
||||||
this.repeatSeparator = options.repeatSeparator ?? ' ■ ';
|
this.repeatSeparator = options.repeatSeparator ?? ' ■ ';
|
||||||
|
this.charUScale = options.charUScale ?? 1;
|
||||||
|
|
||||||
for (let j = 0; j < (this.verticesCountPerFace * 2); j += 2) {
|
for (let j = 0; j < (this.verticesCountPerFace * 2); j += 2) {
|
||||||
const x = this.uvs[j];
|
const x = this.uvs[j];
|
||||||
@@ -515,14 +518,14 @@ export class RecyvlingTextGrid {
|
|||||||
const uvIndex = i * (this.verticesCountPerFace * 2); // uvは(x,y)の2要素なので*2
|
const uvIndex = i * (this.verticesCountPerFace * 2); // uvは(x,y)の2要素なので*2
|
||||||
|
|
||||||
if (this.meshFlipped) {
|
if (this.meshFlipped) {
|
||||||
this.uvs[uvIndex + this.aIndex + 0] = this.uvs[uvIndex + this.cIndex + 0] = this.uvs[uvIndex + this.eIndex + 0] = (charX + 0) / TEXT_TEXTURE_CHAR_COLS;
|
this.uvs[uvIndex + this.aIndex + 0] = this.uvs[uvIndex + this.cIndex + 0] = this.uvs[uvIndex + this.eIndex + 0] = ((charX + 0) / TEXT_TEXTURE_CHAR_COLS) - ((1 / TEXT_TEXTURE_CHAR_COLS) * (1 - this.charUScale));
|
||||||
this.uvs[uvIndex + this.aIndex + 1] = this.uvs[uvIndex + this.bIndex + 1] = this.uvs[uvIndex + this.dIndex + 1] = (charY + 0) / TEXT_TEXTURE_CHAR_ROWS;
|
this.uvs[uvIndex + this.aIndex + 1] = this.uvs[uvIndex + this.bIndex + 1] = this.uvs[uvIndex + this.dIndex + 1] = (charY + 0) / TEXT_TEXTURE_CHAR_ROWS;
|
||||||
this.uvs[uvIndex + this.bIndex + 0] = this.uvs[uvIndex + this.dIndex + 0] = this.uvs[uvIndex + this.fIndex + 0] = (charX + 1) / TEXT_TEXTURE_CHAR_COLS;
|
this.uvs[uvIndex + this.bIndex + 0] = this.uvs[uvIndex + this.dIndex + 0] = this.uvs[uvIndex + this.fIndex + 0] = ((charX + 1) / TEXT_TEXTURE_CHAR_COLS) + ((1 / TEXT_TEXTURE_CHAR_COLS) * (1 - this.charUScale));
|
||||||
this.uvs[uvIndex + this.cIndex + 1] = this.uvs[uvIndex + this.eIndex + 1] = this.uvs[uvIndex + this.fIndex + 1] = (charY + 1) / TEXT_TEXTURE_CHAR_ROWS;
|
this.uvs[uvIndex + this.cIndex + 1] = this.uvs[uvIndex + this.eIndex + 1] = this.uvs[uvIndex + this.fIndex + 1] = (charY + 1) / TEXT_TEXTURE_CHAR_ROWS;
|
||||||
} else {
|
} else {
|
||||||
this.uvs[uvIndex + this.aIndex + 0] = this.uvs[uvIndex + this.dIndex + 0] = this.uvs[uvIndex + this.bIndex + 0] = (charX + 0) / TEXT_TEXTURE_CHAR_COLS;
|
this.uvs[uvIndex + this.aIndex + 0] = this.uvs[uvIndex + this.dIndex + 0] = this.uvs[uvIndex + this.bIndex + 0] = ((charX + 0) / TEXT_TEXTURE_CHAR_COLS) - ((1 / TEXT_TEXTURE_CHAR_COLS) * (1 - this.charUScale));
|
||||||
this.uvs[uvIndex + this.aIndex + 1] = this.uvs[uvIndex + this.dIndex + 1] = this.uvs[uvIndex + this.eIndex + 1] = (charY + 0) / TEXT_TEXTURE_CHAR_ROWS;
|
this.uvs[uvIndex + this.aIndex + 1] = this.uvs[uvIndex + this.dIndex + 1] = this.uvs[uvIndex + this.eIndex + 1] = (charY + 0) / TEXT_TEXTURE_CHAR_ROWS;
|
||||||
this.uvs[uvIndex + this.eIndex + 0] = this.uvs[uvIndex + this.fIndex + 0] = this.uvs[uvIndex + this.cIndex + 0] = (charX + 1) / TEXT_TEXTURE_CHAR_COLS;
|
this.uvs[uvIndex + this.eIndex + 0] = this.uvs[uvIndex + this.fIndex + 0] = this.uvs[uvIndex + this.cIndex + 0] = ((charX + 1) / TEXT_TEXTURE_CHAR_COLS) + ((1 / TEXT_TEXTURE_CHAR_COLS) * (1 - this.charUScale));
|
||||||
this.uvs[uvIndex + this.bIndex + 1] = this.uvs[uvIndex + this.cIndex + 1] = this.uvs[uvIndex + this.fIndex + 1] = (charY + 1) / TEXT_TEXTURE_CHAR_ROWS;
|
this.uvs[uvIndex + this.bIndex + 1] = this.uvs[uvIndex + this.cIndex + 1] = this.uvs[uvIndex + this.fIndex + 1] = (charY + 1) / TEXT_TEXTURE_CHAR_ROWS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user