mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-30 07:34:07 +02:00
wip
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
// TODO: 近くのオブジェクトの端にスナップオプション
|
// TODO: 近くのオブジェクトの端にスナップオプション
|
||||||
// TODO: 近くのオブジェクトの原点に軸を揃えるオプション
|
// TODO: 近くのオブジェクトの原点に軸を揃えるオプション
|
||||||
// TODO: glbを事前に最適化(なるべくメッシュをマージするなど)するツールもしくはMisskeyビルド時処理。ついでにカタログ用スクショも自動生成したい
|
// TODO: glbを事前に最適化(なるべくメッシュをマージするなど)するツールもしくはMisskeyビルド時処理。ついでにカタログ用スクショも自動生成したい
|
||||||
|
// TODO: テクスチャ置き換え時、元のテクスチャをちゃんとdispose
|
||||||
|
|
||||||
import * as BABYLON from '@babylonjs/core';
|
import * as BABYLON from '@babylonjs/core';
|
||||||
import { AxesViewer } from '@babylonjs/core/Debug/axesViewer';
|
import { AxesViewer } from '@babylonjs/core/Debug/axesViewer';
|
||||||
@@ -453,6 +454,7 @@ export class RoomEngine extends EventEmitter<RoomEngineEvents> {
|
|||||||
}).then(() => {
|
}).then(() => {
|
||||||
loadedCount++;
|
loadedCount++;
|
||||||
this.emit('loadingProgress', { progress: loadedCount / objects.length });
|
this.emit('loadingProgress', { progress: loadedCount / objects.length });
|
||||||
|
console.log(`Loaded object ${o.id} (${o.type})`);
|
||||||
})));
|
})));
|
||||||
|
|
||||||
// 不具合のもと
|
// 不具合のもと
|
||||||
|
|||||||
@@ -85,25 +85,20 @@ export const allInOnePc = defineObject({
|
|||||||
applyFit();
|
applyFit();
|
||||||
|
|
||||||
const applyCustomPicture = () => new Promise<void>((resolve) => {
|
const applyCustomPicture = () => new Promise<void>((resolve) => {
|
||||||
// テクスチャの読み込みに失敗したときの救済
|
|
||||||
// TODO: 丁寧な実装に直す
|
|
||||||
setTimeout(() => {
|
|
||||||
resolve();
|
|
||||||
}, 10000);
|
|
||||||
|
|
||||||
if (options.customPicture != null) {
|
if (options.customPicture != null) {
|
||||||
const tex = new BABYLON.Texture(options.customPicture, scene, false, false);
|
|
||||||
tex.wrapU = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
|
||||||
tex.wrapV = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
|
||||||
tex.level = 0.5;
|
|
||||||
|
|
||||||
screenMaterial.unfreeze();
|
screenMaterial.unfreeze();
|
||||||
screenMaterial.emissiveTexture = tex;
|
const tex = new BABYLON.Texture(options.customPicture, scene, false, false, undefined, () => {
|
||||||
|
screenMaterial.emissiveColor = new BABYLON.Color3(1, 1, 1);
|
||||||
tex.onLoadObservable.addOnce(() => {
|
screenMaterial.emissiveTexture = tex;
|
||||||
applyFit();
|
applyFit();
|
||||||
resolve();
|
resolve();
|
||||||
|
}, (message, exception) => {
|
||||||
|
console.warn('Failed to load texture:', message, exception);
|
||||||
|
screenMaterial.emissiveColor = new BABYLON.Color3(0, 1, 0);
|
||||||
|
screenMaterial.emissiveTexture = null;
|
||||||
|
resolve();
|
||||||
});
|
});
|
||||||
|
tex.level = 0.5;
|
||||||
} else {
|
} else {
|
||||||
screenMaterial.emissiveTexture = null;
|
screenMaterial.emissiveTexture = null;
|
||||||
resolve();
|
resolve();
|
||||||
|
|||||||
@@ -61,25 +61,20 @@ export const djPlayer = defineObject({
|
|||||||
applyFit();
|
applyFit();
|
||||||
|
|
||||||
const applyCustomPicture = () => new Promise<void>((resolve) => {
|
const applyCustomPicture = () => new Promise<void>((resolve) => {
|
||||||
// テクスチャの読み込みに失敗したときの救済
|
|
||||||
// TODO: 丁寧な実装に直す
|
|
||||||
setTimeout(() => {
|
|
||||||
resolve();
|
|
||||||
}, 10000);
|
|
||||||
|
|
||||||
if (options.customPicture != null && options.customPicture !== '') {
|
if (options.customPicture != null && options.customPicture !== '') {
|
||||||
const tex = new BABYLON.Texture(options.customPicture, scene, false, false);
|
|
||||||
tex.wrapU = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
|
||||||
tex.wrapV = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
|
||||||
tex.level = 0.5;
|
|
||||||
|
|
||||||
screenMaterial.unfreeze();
|
screenMaterial.unfreeze();
|
||||||
screenMaterial.emissiveTexture = tex;
|
const tex = new BABYLON.Texture(options.customPicture, scene, false, false, undefined, () => {
|
||||||
|
screenMaterial.emissiveColor = new BABYLON.Color3(1, 1, 1);
|
||||||
tex.onLoadObservable.addOnce(() => {
|
screenMaterial.emissiveTexture = tex;
|
||||||
applyFit();
|
applyFit();
|
||||||
resolve();
|
resolve();
|
||||||
|
}, (message, exception) => {
|
||||||
|
console.warn('Failed to load texture:', message, exception);
|
||||||
|
screenMaterial.emissiveColor = new BABYLON.Color3(0, 1, 0);
|
||||||
|
screenMaterial.emissiveTexture = null;
|
||||||
|
resolve();
|
||||||
});
|
});
|
||||||
|
tex.level = 0.5;
|
||||||
} else {
|
} else {
|
||||||
screenMaterial.emissiveTexture = defaultScreenTexture;
|
screenMaterial.emissiveTexture = defaultScreenTexture;
|
||||||
applyFit();
|
applyFit();
|
||||||
|
|||||||
@@ -95,25 +95,20 @@ export const laptopPc = defineObject({
|
|||||||
applyFit();
|
applyFit();
|
||||||
|
|
||||||
const applyCustomPicture = () => new Promise<void>((resolve) => {
|
const applyCustomPicture = () => new Promise<void>((resolve) => {
|
||||||
// テクスチャの読み込みに失敗したときの救済
|
|
||||||
// TODO: 丁寧な実装に直す
|
|
||||||
setTimeout(() => {
|
|
||||||
resolve();
|
|
||||||
}, 10000);
|
|
||||||
|
|
||||||
if (options.customPicture != null) {
|
if (options.customPicture != null) {
|
||||||
const tex = new BABYLON.Texture(options.customPicture, scene, false, false);
|
|
||||||
tex.wrapU = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
|
||||||
tex.wrapV = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
|
||||||
tex.level = 0.5;
|
|
||||||
|
|
||||||
screenMaterial.unfreeze();
|
screenMaterial.unfreeze();
|
||||||
screenMaterial.emissiveTexture = tex;
|
const tex = new BABYLON.Texture(options.customPicture, scene, false, false, undefined, () => {
|
||||||
|
screenMaterial.emissiveColor = new BABYLON.Color3(1, 1, 1);
|
||||||
tex.onLoadObservable.addOnce(() => {
|
screenMaterial.emissiveTexture = tex;
|
||||||
applyFit();
|
applyFit();
|
||||||
resolve();
|
resolve();
|
||||||
|
}, (message, exception) => {
|
||||||
|
console.warn('Failed to load texture:', message, exception);
|
||||||
|
screenMaterial.emissiveColor = new BABYLON.Color3(0, 1, 0);
|
||||||
|
screenMaterial.emissiveTexture = null;
|
||||||
|
resolve();
|
||||||
});
|
});
|
||||||
|
tex.level = 0.5;
|
||||||
} else {
|
} else {
|
||||||
screenMaterial.emissiveTexture = null;
|
screenMaterial.emissiveTexture = null;
|
||||||
resolve();
|
resolve();
|
||||||
|
|||||||
@@ -161,25 +161,21 @@ export const pictureFrame = defineObject({
|
|||||||
applyDepth();
|
applyDepth();
|
||||||
|
|
||||||
const applyCustomPicture = () => new Promise<void>((resolve) => {
|
const applyCustomPicture = () => new Promise<void>((resolve) => {
|
||||||
// テクスチャの読み込みに失敗したときの救済
|
|
||||||
// TODO: 丁寧な実装に直す
|
|
||||||
setTimeout(() => {
|
|
||||||
resolve();
|
|
||||||
}, 10000);
|
|
||||||
|
|
||||||
if (options.customPicture != null) {
|
if (options.customPicture != null) {
|
||||||
const tex = new BABYLON.Texture(options.customPicture, scene, false, false);
|
|
||||||
tex.wrapU = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
|
||||||
tex.wrapV = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
|
||||||
|
|
||||||
pictureMaterial.unfreeze();
|
pictureMaterial.unfreeze();
|
||||||
pictureMaterial.albedoColor = new BABYLON.Color3(1, 1, 1);
|
const tex = new BABYLON.Texture(options.customPicture, scene, false, false, undefined, () => {
|
||||||
pictureMaterial.albedoTexture = tex;
|
pictureMaterial.albedoColor = new BABYLON.Color3(1, 1, 1);
|
||||||
|
pictureMaterial.albedoTexture = tex;
|
||||||
tex.onLoadObservable.addOnce(() => {
|
|
||||||
applyFit();
|
applyFit();
|
||||||
resolve();
|
resolve();
|
||||||
|
}, (message, exception) => {
|
||||||
|
console.warn('Failed to load texture:', message, exception);
|
||||||
|
pictureMaterial.albedoColor = new BABYLON.Color3(0, 1, 0);
|
||||||
|
pictureMaterial.albedoTexture = null;
|
||||||
|
resolve();
|
||||||
});
|
});
|
||||||
|
tex.wrapU = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
||||||
|
tex.wrapV = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
||||||
} else {
|
} else {
|
||||||
pictureMaterial.albedoColor = new BABYLON.Color3(0.5, 0.5, 0.5);
|
pictureMaterial.albedoColor = new BABYLON.Color3(0.5, 0.5, 0.5);
|
||||||
pictureMaterial.albedoTexture = null;
|
pictureMaterial.albedoTexture = null;
|
||||||
|
|||||||
@@ -93,25 +93,21 @@ export const poster = defineObject({
|
|||||||
applySize();
|
applySize();
|
||||||
|
|
||||||
const applyCustomPicture = () => new Promise<void>((resolve) => {
|
const applyCustomPicture = () => new Promise<void>((resolve) => {
|
||||||
// テクスチャの読み込みに失敗したときの救済
|
|
||||||
// TODO: 丁寧な実装に直す
|
|
||||||
setTimeout(() => {
|
|
||||||
resolve();
|
|
||||||
}, 10000);
|
|
||||||
|
|
||||||
if (options.customPicture != null) {
|
if (options.customPicture != null) {
|
||||||
const tex = new BABYLON.Texture(options.customPicture, scene, false, false);
|
|
||||||
tex.wrapU = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
|
||||||
tex.wrapV = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
|
||||||
|
|
||||||
pictureMaterial.unfreeze();
|
pictureMaterial.unfreeze();
|
||||||
pictureMaterial.albedoColor = new BABYLON.Color3(1, 1, 1);
|
const tex = new BABYLON.Texture(options.customPicture, scene, false, false, undefined, () => {
|
||||||
pictureMaterial.albedoTexture = tex;
|
pictureMaterial.albedoColor = new BABYLON.Color3(1, 1, 1);
|
||||||
|
pictureMaterial.albedoTexture = tex;
|
||||||
tex.onLoadObservable.addOnce(() => {
|
|
||||||
applyFit();
|
applyFit();
|
||||||
resolve();
|
resolve();
|
||||||
|
}, (message, exception) => {
|
||||||
|
console.warn('Failed to load texture:', message, exception);
|
||||||
|
pictureMaterial.albedoColor = new BABYLON.Color3(0, 1, 0);
|
||||||
|
pictureMaterial.albedoTexture = null;
|
||||||
|
resolve();
|
||||||
});
|
});
|
||||||
|
tex.wrapU = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
||||||
|
tex.wrapV = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
||||||
} else {
|
} else {
|
||||||
pictureMaterial.albedoColor = new BABYLON.Color3(0.5, 0.5, 0.5);
|
pictureMaterial.albedoColor = new BABYLON.Color3(0.5, 0.5, 0.5);
|
||||||
pictureMaterial.albedoTexture = null;
|
pictureMaterial.albedoTexture = null;
|
||||||
|
|||||||
@@ -52,25 +52,21 @@ export const tabletopFlag = defineObject({
|
|||||||
applyFit();
|
applyFit();
|
||||||
|
|
||||||
const applyCustomPicture = () => new Promise<void>((resolve) => {
|
const applyCustomPicture = () => new Promise<void>((resolve) => {
|
||||||
// テクスチャの読み込みに失敗したときの救済
|
|
||||||
// TODO: 丁寧な実装に直す
|
|
||||||
setTimeout(() => {
|
|
||||||
resolve();
|
|
||||||
}, 10000);
|
|
||||||
|
|
||||||
if (options.customPicture != null) {
|
if (options.customPicture != null) {
|
||||||
const tex = new BABYLON.Texture(options.customPicture, scene, false, false);
|
|
||||||
tex.wrapU = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
|
||||||
tex.wrapV = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
|
||||||
|
|
||||||
flagMaterial.unfreeze();
|
flagMaterial.unfreeze();
|
||||||
flagMaterial.albedoColor = new BABYLON.Color3(1, 1, 1);
|
const tex = new BABYLON.Texture(options.customPicture, scene, false, false, undefined, () => {
|
||||||
flagMaterial.albedoTexture = tex;
|
flagMaterial.albedoColor = new BABYLON.Color3(1, 1, 1);
|
||||||
|
flagMaterial.albedoTexture = tex;
|
||||||
tex.onLoadObservable.addOnce(() => {
|
|
||||||
applyFit();
|
applyFit();
|
||||||
resolve();
|
resolve();
|
||||||
|
}, (message, exception) => {
|
||||||
|
console.warn('Failed to load texture:', message, exception);
|
||||||
|
flagMaterial.albedoColor = new BABYLON.Color3(0, 1, 0);
|
||||||
|
flagMaterial.albedoTexture = null;
|
||||||
|
resolve();
|
||||||
});
|
});
|
||||||
|
tex.wrapU = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
||||||
|
tex.wrapV = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
||||||
} else {
|
} else {
|
||||||
flagMaterial.albedoColor = new BABYLON.Color3(0.5, 0.5, 0.5);
|
flagMaterial.albedoColor = new BABYLON.Color3(0.5, 0.5, 0.5);
|
||||||
flagMaterial.albedoTexture = null;
|
flagMaterial.albedoTexture = null;
|
||||||
|
|||||||
@@ -93,25 +93,21 @@ export const tabletopGlassPictureFrame = defineObject({
|
|||||||
applySize();
|
applySize();
|
||||||
|
|
||||||
const applyCustomPicture = () => new Promise<void>((resolve) => {
|
const applyCustomPicture = () => new Promise<void>((resolve) => {
|
||||||
// テクスチャの読み込みに失敗したときの救済
|
|
||||||
// TODO: 丁寧な実装に直す
|
|
||||||
setTimeout(() => {
|
|
||||||
resolve();
|
|
||||||
}, 10000);
|
|
||||||
|
|
||||||
if (options.customPicture != null) {
|
if (options.customPicture != null) {
|
||||||
const tex = new BABYLON.Texture(options.customPicture, scene, false, false);
|
|
||||||
tex.wrapU = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
|
||||||
tex.wrapV = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
|
||||||
|
|
||||||
pictureMaterial.unfreeze();
|
pictureMaterial.unfreeze();
|
||||||
pictureMaterial.albedoColor = new BABYLON.Color3(1, 1, 1);
|
const tex = new BABYLON.Texture(options.customPicture, scene, false, false, undefined, () => {
|
||||||
pictureMaterial.albedoTexture = tex;
|
pictureMaterial.albedoColor = new BABYLON.Color3(1, 1, 1);
|
||||||
|
pictureMaterial.albedoTexture = tex;
|
||||||
tex.onLoadObservable.addOnce(() => {
|
|
||||||
applyFit();
|
applyFit();
|
||||||
resolve();
|
resolve();
|
||||||
|
}, (message, exception) => {
|
||||||
|
console.warn('Failed to load texture:', message, exception);
|
||||||
|
pictureMaterial.albedoColor = new BABYLON.Color3(0, 1, 0);
|
||||||
|
pictureMaterial.albedoTexture = null;
|
||||||
|
resolve();
|
||||||
});
|
});
|
||||||
|
tex.wrapU = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
||||||
|
tex.wrapV = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
||||||
} else {
|
} else {
|
||||||
pictureMaterial.albedoColor = new BABYLON.Color3(0.5, 0.5, 0.5);
|
pictureMaterial.albedoColor = new BABYLON.Color3(0.5, 0.5, 0.5);
|
||||||
pictureMaterial.albedoTexture = null;
|
pictureMaterial.albedoTexture = null;
|
||||||
|
|||||||
@@ -74,26 +74,20 @@ export const tabletopLcdButtonsController = defineObject({
|
|||||||
applyFit();
|
applyFit();
|
||||||
|
|
||||||
const applyCustomPicture = () => new Promise<void>((resolve) => {
|
const applyCustomPicture = () => new Promise<void>((resolve) => {
|
||||||
// テクスチャの読み込みに失敗したときの救済
|
|
||||||
// TODO: 丁寧な実装に直す
|
|
||||||
setTimeout(() => {
|
|
||||||
resolve();
|
|
||||||
}, 10000);
|
|
||||||
|
|
||||||
if (options.customPicture != null && options.customPicture !== '') {
|
if (options.customPicture != null && options.customPicture !== '') {
|
||||||
const tex = new BABYLON.Texture(options.customPicture, scene, false, false);
|
|
||||||
tex.wrapU = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
|
||||||
tex.wrapV = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
|
||||||
tex.level = 0.5;
|
|
||||||
|
|
||||||
screenMaterial.unfreeze();
|
screenMaterial.unfreeze();
|
||||||
screenMaterial.emissiveTexture = tex;
|
const tex = new BABYLON.Texture(options.customPicture, scene, false, false, undefined, () => {
|
||||||
screenMaterial.emissiveTexture.level = 2;
|
screenMaterial.emissiveTexture = tex;
|
||||||
|
screenMaterial.emissiveTexture.level = 2;
|
||||||
tex.onLoadObservable.addOnce(() => {
|
|
||||||
applyFit();
|
applyFit();
|
||||||
resolve();
|
resolve();
|
||||||
|
}, (message, exception) => {
|
||||||
|
console.warn('Failed to load texture:', message, exception);
|
||||||
|
screenMaterial.emissiveColor = new BABYLON.Color3(0, 1, 0);
|
||||||
|
screenMaterial.emissiveTexture = null;
|
||||||
|
resolve();
|
||||||
});
|
});
|
||||||
|
tex.level = 0.5;
|
||||||
} else {
|
} else {
|
||||||
screenMaterial.emissiveTexture = defaultScreenTexture;
|
screenMaterial.emissiveTexture = defaultScreenTexture;
|
||||||
screenMaterial.emissiveTexture.level = 2;
|
screenMaterial.emissiveTexture.level = 2;
|
||||||
|
|||||||
@@ -166,25 +166,21 @@ export const tabletopPictureFrame = defineObject({
|
|||||||
applyDepth();
|
applyDepth();
|
||||||
|
|
||||||
const applyCustomPicture = () => new Promise<void>((resolve) => {
|
const applyCustomPicture = () => new Promise<void>((resolve) => {
|
||||||
// テクスチャの読み込みに失敗したときの救済
|
|
||||||
// TODO: 丁寧な実装に直す
|
|
||||||
setTimeout(() => {
|
|
||||||
resolve();
|
|
||||||
}, 10000);
|
|
||||||
|
|
||||||
if (options.customPicture != null) {
|
if (options.customPicture != null) {
|
||||||
const tex = new BABYLON.Texture(options.customPicture, scene, false, false);
|
|
||||||
tex.wrapU = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
|
||||||
tex.wrapV = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
|
||||||
|
|
||||||
pictureMaterial.unfreeze();
|
pictureMaterial.unfreeze();
|
||||||
pictureMaterial.albedoColor = new BABYLON.Color3(1, 1, 1);
|
const tex = new BABYLON.Texture(options.customPicture, scene, false, false, undefined, () => {
|
||||||
pictureMaterial.albedoTexture = tex;
|
pictureMaterial.albedoColor = new BABYLON.Color3(1, 1, 1);
|
||||||
|
pictureMaterial.albedoTexture = tex;
|
||||||
tex.onLoadObservable.addOnce(() => {
|
|
||||||
applyFit();
|
applyFit();
|
||||||
resolve();
|
resolve();
|
||||||
|
}, (message, exception) => {
|
||||||
|
console.warn('Failed to load texture:', message, exception);
|
||||||
|
pictureMaterial.albedoColor = new BABYLON.Color3(0, 1, 0);
|
||||||
|
pictureMaterial.albedoTexture = null;
|
||||||
|
resolve();
|
||||||
});
|
});
|
||||||
|
tex.wrapU = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
||||||
|
tex.wrapV = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
||||||
} else {
|
} else {
|
||||||
pictureMaterial.albedoColor = new BABYLON.Color3(0.5, 0.5, 0.5);
|
pictureMaterial.albedoColor = new BABYLON.Color3(0.5, 0.5, 0.5);
|
||||||
pictureMaterial.albedoTexture = null;
|
pictureMaterial.albedoTexture = null;
|
||||||
|
|||||||
@@ -97,25 +97,21 @@ export const tapestry = defineObject({
|
|||||||
applySize();
|
applySize();
|
||||||
|
|
||||||
const applyCustomPicture = () => new Promise<void>((resolve) => {
|
const applyCustomPicture = () => new Promise<void>((resolve) => {
|
||||||
// テクスチャの読み込みに失敗したときの救済
|
|
||||||
// TODO: 丁寧な実装に直す
|
|
||||||
setTimeout(() => {
|
|
||||||
resolve();
|
|
||||||
}, 10000);
|
|
||||||
|
|
||||||
if (options.customPicture != null) {
|
if (options.customPicture != null) {
|
||||||
const tex = new BABYLON.Texture(options.customPicture, scene, false, false);
|
|
||||||
tex.wrapU = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
|
||||||
tex.wrapV = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
|
||||||
|
|
||||||
pictureMaterial.unfreeze();
|
pictureMaterial.unfreeze();
|
||||||
pictureMaterial.albedoColor = new BABYLON.Color3(1, 1, 1);
|
const tex = new BABYLON.Texture(options.customPicture, scene, false, false, undefined, () => {
|
||||||
pictureMaterial.albedoTexture = tex;
|
pictureMaterial.albedoColor = new BABYLON.Color3(1, 1, 1);
|
||||||
|
pictureMaterial.albedoTexture = tex;
|
||||||
tex.onLoadObservable.addOnce(() => {
|
|
||||||
applyFit();
|
applyFit();
|
||||||
resolve();
|
resolve();
|
||||||
|
}, (message, exception) => {
|
||||||
|
console.warn('Failed to load texture:', message, exception);
|
||||||
|
pictureMaterial.albedoColor = new BABYLON.Color3(0, 1, 0);
|
||||||
|
pictureMaterial.albedoTexture = null;
|
||||||
|
resolve();
|
||||||
});
|
});
|
||||||
|
tex.wrapU = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
||||||
|
tex.wrapV = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
||||||
} else {
|
} else {
|
||||||
pictureMaterial.albedoColor = new BABYLON.Color3(0.5, 0.5, 0.5);
|
pictureMaterial.albedoColor = new BABYLON.Color3(0.5, 0.5, 0.5);
|
||||||
pictureMaterial.albedoTexture = null;
|
pictureMaterial.albedoTexture = null;
|
||||||
|
|||||||
@@ -83,25 +83,21 @@ export const wallCanvas = defineObject({
|
|||||||
applySize();
|
applySize();
|
||||||
|
|
||||||
const applyCustomPicture = () => new Promise<void>((resolve) => {
|
const applyCustomPicture = () => new Promise<void>((resolve) => {
|
||||||
// テクスチャの読み込みに失敗したときの救済
|
|
||||||
// TODO: 丁寧な実装に直す
|
|
||||||
setTimeout(() => {
|
|
||||||
resolve();
|
|
||||||
}, 10000);
|
|
||||||
|
|
||||||
if (options.customPicture != null) {
|
if (options.customPicture != null) {
|
||||||
const tex = new BABYLON.Texture(options.customPicture, scene, false, false);
|
|
||||||
tex.wrapU = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
|
||||||
tex.wrapV = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
|
||||||
|
|
||||||
canvasMaterial.unfreeze();
|
canvasMaterial.unfreeze();
|
||||||
canvasMaterial.albedoColor = new BABYLON.Color3(1, 1, 1);
|
const tex = new BABYLON.Texture(options.customPicture, scene, false, false, undefined, () => {
|
||||||
canvasMaterial.albedoTexture = tex;
|
canvasMaterial.albedoColor = new BABYLON.Color3(1, 1, 1);
|
||||||
|
canvasMaterial.albedoTexture = tex;
|
||||||
tex.onLoadObservable.addOnce(() => {
|
|
||||||
applyFit();
|
applyFit();
|
||||||
resolve();
|
resolve();
|
||||||
|
}, (message, exception) => {
|
||||||
|
console.warn('Failed to load texture:', message, exception);
|
||||||
|
canvasMaterial.albedoColor = new BABYLON.Color3(0, 1, 0);
|
||||||
|
canvasMaterial.albedoTexture = null;
|
||||||
|
resolve();
|
||||||
});
|
});
|
||||||
|
tex.wrapU = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
||||||
|
tex.wrapV = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
||||||
} else {
|
} else {
|
||||||
canvasMaterial.albedoColor = new BABYLON.Color3(0.5, 0.5, 0.5);
|
canvasMaterial.albedoColor = new BABYLON.Color3(0.5, 0.5, 0.5);
|
||||||
canvasMaterial.albedoTexture = null;
|
canvasMaterial.albedoTexture = null;
|
||||||
|
|||||||
@@ -93,25 +93,21 @@ export const wallGlassPictureFrame = defineObject({
|
|||||||
applySize();
|
applySize();
|
||||||
|
|
||||||
const applyCustomPicture = () => new Promise<void>((resolve) => {
|
const applyCustomPicture = () => new Promise<void>((resolve) => {
|
||||||
// テクスチャの読み込みに失敗したときの救済
|
|
||||||
// TODO: 丁寧な実装に直す
|
|
||||||
setTimeout(() => {
|
|
||||||
resolve();
|
|
||||||
}, 10000);
|
|
||||||
|
|
||||||
if (options.customPicture != null) {
|
if (options.customPicture != null) {
|
||||||
const tex = new BABYLON.Texture(options.customPicture, scene, false, false);
|
|
||||||
tex.wrapU = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
|
||||||
tex.wrapV = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
|
||||||
|
|
||||||
pictureMaterial.unfreeze();
|
pictureMaterial.unfreeze();
|
||||||
pictureMaterial.albedoColor = new BABYLON.Color3(1, 1, 1);
|
const tex = new BABYLON.Texture(options.customPicture, scene, false, false, undefined, () => {
|
||||||
pictureMaterial.albedoTexture = tex;
|
pictureMaterial.albedoColor = new BABYLON.Color3(1, 1, 1);
|
||||||
|
pictureMaterial.albedoTexture = tex;
|
||||||
tex.onLoadObservable.addOnce(() => {
|
|
||||||
applyFit();
|
applyFit();
|
||||||
resolve();
|
resolve();
|
||||||
|
}, (message, exception) => {
|
||||||
|
console.warn('Failed to load texture:', message, exception);
|
||||||
|
pictureMaterial.albedoColor = new BABYLON.Color3(0, 1, 0);
|
||||||
|
pictureMaterial.albedoTexture = null;
|
||||||
|
resolve();
|
||||||
});
|
});
|
||||||
|
tex.wrapU = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
||||||
|
tex.wrapV = BABYLON.Texture.MIRROR_ADDRESSMODE;
|
||||||
} else {
|
} else {
|
||||||
pictureMaterial.albedoColor = new BABYLON.Color3(0.5, 0.5, 0.5);
|
pictureMaterial.albedoColor = new BABYLON.Color3(0.5, 0.5, 0.5);
|
||||||
pictureMaterial.albedoTexture = null;
|
pictureMaterial.albedoTexture = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user