mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-28 14:44:44 +02:00
wip
This commit is contained in:
@@ -1616,30 +1616,15 @@ export class RoomObjectPreviewEngine {
|
|||||||
|
|
||||||
def.treatLoaderResult?.(loaderResult);
|
def.treatLoaderResult?.(loaderResult);
|
||||||
|
|
||||||
let hasCollisionMesh = false;
|
|
||||||
for (const mesh of loaderResult.meshes) {
|
|
||||||
if (mesh.name.includes('__COLLISION__')) {
|
|
||||||
hasCollisionMesh = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
root.addChild(subRoot);
|
root.addChild(subRoot);
|
||||||
|
|
||||||
const objectInstance = await def.createInstance({
|
const model = new ModelManager(subRoot, loaderResult.meshes.filter(m => m !== subRoot), (meshes) => {
|
||||||
room: null,
|
|
||||||
scene: this.scene,
|
|
||||||
root,
|
|
||||||
options: args.options,
|
|
||||||
model: new ModelManager(subRoot, loaderResult.meshes.filter(m => m !== subRoot), (meshes) => {
|
|
||||||
for (const m of meshes) {
|
for (const m of meshes) {
|
||||||
const mesh = m;
|
const mesh = m;
|
||||||
|
|
||||||
// シェイプキー(morph)を考慮してbounding boxを更新するために必要
|
// シェイプキー(morph)を考慮してbounding boxを更新するために必要
|
||||||
mesh.refreshBoundingInfo({ applyMorph: true });
|
mesh.refreshBoundingInfo({ applyMorph: true });
|
||||||
|
|
||||||
mesh.checkCollisions = !hasCollisionMesh;
|
|
||||||
|
|
||||||
if (mesh.name.includes('__COLLISION__')) {
|
if (mesh.name.includes('__COLLISION__')) {
|
||||||
mesh.receiveShadows = false;
|
mesh.receiveShadows = false;
|
||||||
mesh.isVisible = false;
|
mesh.isVisible = false;
|
||||||
@@ -1666,11 +1651,20 @@ export class RoomObjectPreviewEngine {
|
|||||||
|
|
||||||
if (!this.scene.meshes.includes(mesh)) this.scene.addMesh(mesh);
|
if (!this.scene.meshes.includes(mesh)) this.scene.addMesh(mesh);
|
||||||
}
|
}
|
||||||
}),
|
});
|
||||||
|
|
||||||
|
const objectInstance = await def.createInstance({
|
||||||
|
room: null,
|
||||||
|
scene: this.scene,
|
||||||
|
root,
|
||||||
|
options: args.options,
|
||||||
|
model,
|
||||||
});
|
});
|
||||||
|
|
||||||
objectInstance.onInited?.();
|
objectInstance.onInited?.();
|
||||||
|
|
||||||
|
model.bakeMesh();
|
||||||
|
|
||||||
this.objectInstance = objectInstance;
|
this.objectInstance = objectInstance;
|
||||||
this.objectMesh = root;
|
this.objectMesh = root;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ export const beamLamp = defineObject({
|
|||||||
createInstance: ({ room, root, scene }) => {
|
createInstance: ({ room, root, scene }) => {
|
||||||
return {
|
return {
|
||||||
onInited: () => {
|
onInited: () => {
|
||||||
const light = new BABYLON.PointLight('beamLampLight', new BABYLON.Vector3(0, 10/*cm*/, 0), scene, true);
|
const light = new BABYLON.PointLight('beamLampLight', new BABYLON.Vector3(0, 10/*cm*/, 0), scene, room?.lightContainer != null);
|
||||||
light.parent = root;
|
light.parent = root;
|
||||||
light.diffuse = new BABYLON.Color3(1.0, 0.5, 0.2);
|
light.diffuse = new BABYLON.Color3(1.0, 0.5, 0.2);
|
||||||
light.intensity = 300;
|
light.intensity = 300;
|
||||||
light.range = 100/*cm*/;
|
light.range = 100/*cm*/;
|
||||||
room.lightContainer.addLight(light);
|
if (room?.lightContainer != null) room.lightContainer.addLight(light);
|
||||||
},
|
},
|
||||||
interactions: {},
|
interactions: {},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -16,12 +16,12 @@ export const lavaLamp = defineObject({
|
|||||||
createInstance: ({ room, scene, root }) => {
|
createInstance: ({ room, scene, root }) => {
|
||||||
return {
|
return {
|
||||||
onInited: () => {
|
onInited: () => {
|
||||||
const light = new BABYLON.PointLight('lavaLampLight', new BABYLON.Vector3(0, 11/*cm*/, 0), scene, true);
|
const light = new BABYLON.PointLight('lavaLampLight', new BABYLON.Vector3(0, 11/*cm*/, 0), scene, room?.lightContainer != null);
|
||||||
light.parent = root;
|
light.parent = root;
|
||||||
light.diffuse = new BABYLON.Color3(1.0, 0.5, 0.2);
|
light.diffuse = new BABYLON.Color3(1.0, 0.5, 0.2);
|
||||||
light.intensity = 300;
|
light.intensity = 300;
|
||||||
light.range = 100/*cm*/;
|
light.range = 100/*cm*/;
|
||||||
room.lightContainer.addLight(light);
|
if (room?.lightContainer != null) room.lightContainer.addLight(light);
|
||||||
|
|
||||||
const sphere = BABYLON.MeshBuilder.CreateSphere('lavaLampLightSphere', { diameter: 4/*cm*/ }, scene);
|
const sphere = BABYLON.MeshBuilder.CreateSphere('lavaLampLightSphere', { diameter: 4/*cm*/ }, scene);
|
||||||
sphere.parent = root;
|
sphere.parent = root;
|
||||||
|
|||||||
@@ -47,12 +47,12 @@ export const woodRingFloorLamp = defineObject({
|
|||||||
|
|
||||||
const lamps = model.findMeshes('__X_LAMP__');
|
const lamps = model.findMeshes('__X_LAMP__');
|
||||||
for (const lamp of lamps) {
|
for (const lamp of lamps) {
|
||||||
const light = new BABYLON.SpotLight('', new BABYLON.Vector3(0/*cm*/, 0/*cm*/, 0), new BABYLON.Vector3(0, -1, 0), Math.PI / 1, 2, scene, true);
|
const light = new BABYLON.SpotLight('', new BABYLON.Vector3(0/*cm*/, 0/*cm*/, 0), new BABYLON.Vector3(0, -1, 0), Math.PI / 1, 2, scene, room?.lightContainer != null);
|
||||||
light.parent = lamp;
|
light.parent = lamp;
|
||||||
light.diffuse = new BABYLON.Color3(1.0, 0.5, 0.2);
|
light.diffuse = new BABYLON.Color3(1.0, 0.5, 0.2);
|
||||||
light.intensity = 5000;
|
light.intensity = 5000;
|
||||||
light.range = 150/*cm*/;
|
light.range = 150/*cm*/;
|
||||||
room.lightContainer.addLight(light);
|
if (room?.lightContainer != null) room.lightContainer.addLight(light);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user