mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-06-25 17:10:43 +00:00
wip
This commit is contained in:
parent
2942234778
commit
7546bf7dc2
12 changed files with 31 additions and 85 deletions
|
|
@ -11,13 +11,13 @@ export const bed = defineObject({
|
|||
name: 'Bed',
|
||||
options: {
|
||||
schema: {
|
||||
mat: {
|
||||
frameMat: {
|
||||
type: 'material',
|
||||
label: 'Material',
|
||||
label: 'Frame material',
|
||||
},
|
||||
},
|
||||
default: {
|
||||
mat: { color: [0.2, 0.1, 0.02], roughness: -1, metallic: -1 },
|
||||
frameMat: { color: [0.2, 0.1, 0.02], roughness: 0.5, metallic: 0 },
|
||||
},
|
||||
},
|
||||
placement: 'floor',
|
||||
|
|
@ -26,19 +26,20 @@ export const bed = defineObject({
|
|||
createInstance: ({ options, model }) => {
|
||||
const bodyMesh = model.findMesh('__X_BODY__');
|
||||
const bodyMaterial = bodyMesh.material as BABYLON.PBRMaterial;
|
||||
console.log('bed', bodyMaterial.roughness, bodyMaterial.metallic);
|
||||
|
||||
const applyMat = () => {
|
||||
bodyMaterial.albedoColor = new BABYLON.Color3(options.mat.color[0], options.mat.color[1], options.mat.color[2]);
|
||||
bodyMaterial.roughness = options.mat.roughness;
|
||||
bodyMaterial.metallic = options.mat.metallic;
|
||||
const applyFrameMat = () => {
|
||||
bodyMaterial.albedoColor = new BABYLON.Color3(options.frameMat.color[0], options.frameMat.color[1], options.frameMat.color[2]);
|
||||
bodyMaterial.roughness = options.frameMat.roughness;
|
||||
bodyMaterial.metallic = options.frameMat.metallic;
|
||||
};
|
||||
|
||||
applyMat();
|
||||
applyFrameMat();
|
||||
|
||||
return {
|
||||
onOptionsUpdated: ([k, v]) => {
|
||||
applyMat();
|
||||
switch (k) {
|
||||
case 'frameMat': applyFrameMat(); break;
|
||||
}
|
||||
},
|
||||
interactions: {},
|
||||
dispose: () => {},
|
||||
|
|
|
|||
|
|
@ -33,14 +33,13 @@ export const hangingDuctRail = defineObject({
|
|||
default: {
|
||||
width: 0.2,
|
||||
height: 0.2,
|
||||
bodyMat: { color: [0.05, 0.05, 0.05], roughness: -1, metallic: -1 },
|
||||
bodyMat: { color: [0.05, 0.05, 0.05], roughness: 0.5, metallic: 0.3 },
|
||||
},
|
||||
},
|
||||
placement: 'ceiling',
|
||||
hasCollisions: false,
|
||||
createInstance: async ({ options, model, id }) => {
|
||||
createInstance: async ({ options, model }) => {
|
||||
const bodyMaterial = model.findMaterial('__X_BODY__');
|
||||
console.log(id, bodyMaterial.roughness, bodyMaterial.metallic);
|
||||
|
||||
const applySize = () => {
|
||||
for (const mesh of model.root.getChildMeshes()) {
|
||||
|
|
|
|||
|
|
@ -24,15 +24,14 @@ export const lowPartitionBar = defineObject({
|
|||
},
|
||||
},
|
||||
default: {
|
||||
bodyMat: { color: [0.8, 0.8, 0.8], roughness: -1, metallic: -1 },
|
||||
bodyMat: { color: [0.8, 0.8, 0.8], roughness: 0.1, metallic: 1 },
|
||||
width: 0.5,
|
||||
},
|
||||
},
|
||||
placement: 'top',
|
||||
//hasCollisions: true,
|
||||
createInstance: ({ options, model, id }) => {
|
||||
createInstance: ({ options, model }) => {
|
||||
const bodyMaterial = model.findMaterial('__X_BODY__');
|
||||
console.log(id, bodyMaterial.roughness, bodyMaterial.metallic);
|
||||
|
||||
const applyBodyMat = () => {
|
||||
bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);
|
||||
|
|
|
|||
|
|
@ -1,45 +0,0 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import * as BABYLON from '@babylonjs/core';
|
||||
import { defineObject } from '../object.js';
|
||||
|
||||
export const pc = defineObject({
|
||||
id: 'pc',
|
||||
name: 'PC',
|
||||
options: {
|
||||
schema: {
|
||||
mat: {
|
||||
type: 'material',
|
||||
label: 'Material',
|
||||
},
|
||||
},
|
||||
default: {
|
||||
mat: { color: [0, 0, 0], roughness: -1, metallic: -1 },
|
||||
},
|
||||
},
|
||||
placement: 'top',
|
||||
createInstance: ({ options, root, id }) => {
|
||||
const bodyMesh = root.getChildMeshes().find(m => m.name.includes('__X_BODY__')) as BABYLON.Mesh;
|
||||
const bodyMaterial = bodyMesh.material as BABYLON.PBRMaterial;
|
||||
console.log(id, bodyMaterial.roughness, bodyMaterial.metallic);
|
||||
|
||||
const applyMat = () => {
|
||||
bodyMaterial.albedoColor = new BABYLON.Color3(options.mat.color[0], options.mat.color[1], options.mat.color[2]);
|
||||
bodyMaterial.roughness = options.mat.roughness;
|
||||
bodyMaterial.metallic = options.mat.metallic;
|
||||
};
|
||||
|
||||
applyMat();
|
||||
|
||||
return {
|
||||
onOptionsUpdated: ([k, v]) => {
|
||||
applyMat();
|
||||
},
|
||||
interactions: {},
|
||||
dispose: () => {},
|
||||
};
|
||||
},
|
||||
});
|
||||
|
|
@ -17,15 +17,14 @@ export const piano = defineObject({
|
|||
},
|
||||
},
|
||||
default: {
|
||||
bodyMat: { color: [0, 0, 0], roughness: -1, metallic: -1 },
|
||||
bodyMat: { color: [0, 0, 0], roughness: 0.5, metallic: 0 },
|
||||
},
|
||||
},
|
||||
placement: 'floor',
|
||||
hasCollisions: true,
|
||||
canPreMeshesMerging: true,
|
||||
createInstance: ({ options, model, id }) => {
|
||||
createInstance: ({ options, model }) => {
|
||||
const bodyMaterial = model.findMaterial('__X_BODY__');
|
||||
console.log(id, bodyMaterial.roughness, bodyMaterial.metallic);
|
||||
|
||||
const applyBodyMat = () => {
|
||||
bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);
|
||||
|
|
|
|||
|
|
@ -17,16 +17,15 @@ export const sofa = defineObject({
|
|||
},
|
||||
},
|
||||
default: {
|
||||
bodyMat: { color: [0.4, 0.4, 0.4], roughness: -1, metallic: -1 },
|
||||
bodyMat: { color: [0.4, 0.4, 0.4], roughness: 0.5, metallic: 0 },
|
||||
},
|
||||
},
|
||||
placement: 'floor',
|
||||
hasCollisions: true,
|
||||
canPreMeshesMerging: true,
|
||||
hasTexture: false,
|
||||
createInstance: ({ options, model, id }) => {
|
||||
createInstance: ({ options, model }) => {
|
||||
const bodyMaterial = model.findMaterial('__X_BODY__');
|
||||
console.log(id, bodyMaterial.roughness, bodyMaterial.metallic);
|
||||
|
||||
const applyBodyMat = () => {
|
||||
bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);
|
||||
|
|
|
|||
|
|
@ -24,16 +24,15 @@ export const speakerStand = defineObject({
|
|||
},
|
||||
},
|
||||
default: {
|
||||
bodyMat: { color: [0.2, 0.2, 0.2], roughness: -1, metallic: -1 },
|
||||
bodyMat: { color: [0.2, 0.2, 0.2], roughness: 0.5, metallic: 0.8 },
|
||||
height: 0.1,
|
||||
},
|
||||
},
|
||||
placement: 'top',
|
||||
hasCollisions: false,
|
||||
hasTexture: false,
|
||||
createInstance: ({ options, model, id }) => {
|
||||
createInstance: ({ options, model }) => {
|
||||
const bodyMaterial = model.findMaterial('__X_BODY__');
|
||||
console.log(id, bodyMaterial.roughness, bodyMaterial.metallic);
|
||||
|
||||
const applyBodyMat = () => {
|
||||
bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ export const spotLight = defineObject({
|
|||
},
|
||||
},
|
||||
default: {
|
||||
bodyMat: { color: [0.05, 0.05, 0.05], roughness: -1, metallic: -1 },
|
||||
bodyMat: { color: [0.05, 0.05, 0.05], roughness: 0.5, metallic: 0.3 },
|
||||
light: {
|
||||
color: [1, 0.5, 0.2],
|
||||
brightness: 0.2,
|
||||
|
|
@ -48,9 +48,8 @@ export const spotLight = defineObject({
|
|||
},
|
||||
placement: 'bottom',
|
||||
hasCollisions: false,
|
||||
createInstance: ({ lc, scene, options, model, graphicsQuality, id }) => {
|
||||
createInstance: ({ lc, scene, options, model, graphicsQuality }) => {
|
||||
const bodyMaterial = model.findMaterial('__X_BODY__');
|
||||
console.log(id, bodyMaterial.roughness, bodyMaterial.metallic);
|
||||
|
||||
const applyBodyMat = () => {
|
||||
bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);
|
||||
|
|
|
|||
|
|
@ -21,16 +21,15 @@ export const stanchionPole = defineObject({
|
|||
},
|
||||
},
|
||||
default: {
|
||||
bodyMat: { color: [0.8, 0.39, 0.1], roughness: -1, metallic: -1 },
|
||||
ropeMat: { color: [0.21, 0.0, 0.0], roughness: -1, metallic: -1 },
|
||||
bodyMat: { color: [0.8, 0.39, 0.1], roughness: 0.2, metallic: 1 },
|
||||
ropeMat: { color: [0.21, 0.0, 0.0], roughness: 0.7, metallic: 0 },
|
||||
},
|
||||
},
|
||||
placement: 'floor',
|
||||
hasCollisions: true,
|
||||
hasTexture: false,
|
||||
createInstance: ({ options, model, id }) => {
|
||||
createInstance: ({ options, model }) => {
|
||||
const bodyMaterial = model.findMaterial('__X_BODY__');
|
||||
console.log(id, bodyMaterial.roughness, bodyMaterial.metallic);
|
||||
|
||||
const applyBodyMat = () => {
|
||||
bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);
|
||||
|
|
@ -41,7 +40,6 @@ export const stanchionPole = defineObject({
|
|||
applyBodyMat();
|
||||
|
||||
const ropeMaterial = model.findMaterial('__X_ROPE__');
|
||||
console.log(id, ropeMaterial.roughness, ropeMaterial.metallic);
|
||||
|
||||
const applyRopeMat = () => {
|
||||
ropeMaterial.albedoColor = new BABYLON.Color3(options.ropeMat.color[0], options.ropeMat.color[1], options.ropeMat.color[2]);
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ export const wallMountSpotLight = defineObject({
|
|||
},
|
||||
},
|
||||
default: {
|
||||
bodyMat: { color: [0.05, 0.05, 0.05], roughness: 0.5, metallic: 0 },
|
||||
bodyMat: { color: [0.05, 0.05, 0.05], roughness: 0.5, metallic: 0.3 },
|
||||
light: {
|
||||
color: [1, 0.5, 0.2],
|
||||
brightness: 0.5,
|
||||
|
|
|
|||
|
|
@ -17,16 +17,15 @@ export const wireBasket = defineObject({
|
|||
},
|
||||
},
|
||||
default: {
|
||||
bodyMat: { color: [0.03, 0.03, 0.03], roughness: -1, metallic: -1 },
|
||||
bodyMat: { color: [0.03, 0.03, 0.03], roughness: 0.5, metallic: 0.5 },
|
||||
},
|
||||
},
|
||||
placement: 'side',
|
||||
hasCollisions: false,
|
||||
canPreMeshesMerging: true,
|
||||
hasTexture: false,
|
||||
createInstance: ({ options, model, id }) => {
|
||||
createInstance: ({ options, model }) => {
|
||||
const bodyMaterial = model.findMaterial('__X_BODY__');
|
||||
console.log(id, bodyMaterial.roughness, bodyMaterial.metallic);
|
||||
|
||||
const applyBodyMat = () => {
|
||||
bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);
|
||||
|
|
|
|||
|
|
@ -17,16 +17,15 @@ export const wireNet = defineObject({
|
|||
},
|
||||
},
|
||||
default: {
|
||||
bodyMat: { color: [0.03, 0.03, 0.03], roughness: -1, metallic: -1 },
|
||||
bodyMat: { color: [0.03, 0.03, 0.03], roughness: 0.5, metallic: 0.5 },
|
||||
},
|
||||
},
|
||||
placement: 'side',
|
||||
hasCollisions: false,
|
||||
canPreMeshesMerging: true,
|
||||
hasTexture: false,
|
||||
createInstance: ({ options, model, id }) => {
|
||||
createInstance: ({ options, model }) => {
|
||||
const bodyMaterial = model.findMaterial('__X_BODY__');
|
||||
console.log(id, bodyMaterial.roughness, bodyMaterial.metallic);
|
||||
|
||||
const applyBodyMat = () => {
|
||||
bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue