This commit is contained in:
syuilo 2026-05-25 10:21:57 +09:00
commit 540e20864c
50 changed files with 686 additions and 611 deletions

View file

@ -11,13 +11,13 @@ export const a4Case = defineObject({
name: 'A4 Case',
options: {
schema: {
color: {
type: 'color',
label: 'Color',
mat: {
type: 'material',
label: 'Material',
},
},
default: {
color: [0.9, 0.9, 0.9],
mat: { color: [0.9, 0.9, 0.9], roughness: 0.3, metallic: 0 },
},
},
placement: 'top',
@ -26,16 +26,17 @@ export const a4Case = defineObject({
const bodyMesh = model.findMesh('__X_BODY__');
const bodyMaterial = bodyMesh.material as BABYLON.PBRMaterial;
const applyColor = () => {
const [r, g, b] = options.color;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
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;
};
applyColor();
applyMat();
return {
onOptionsUpdated: ([k, v]) => {
applyColor();
onOptionsUpdated: ([k, _v]) => {
applyMat();
},
interactions: {},
dispose: () => {},

View file

@ -13,13 +13,13 @@ export const allInOnePc = defineObject({
name: 'All-in-One PC',
options: {
schema: {
bodyColor: {
type: 'color',
label: 'Body color',
bodyMat: {
type: 'material',
label: 'Body material',
},
bezelColor: {
type: 'color',
label: 'Bezel color',
bezelMat: {
type: 'material',
label: 'Bezel material',
},
screenBrightness: {
type: 'range',
@ -38,8 +38,8 @@ export const allInOnePc = defineObject({
},
},
default: {
bodyColor: [1, 1, 1],
bezelColor: [0, 0, 0],
bodyMat: { color: [1, 1, 1], roughness: 0.5, metallic: 1 },
bezelMat: { color: [0, 0, 0], roughness: 0, metallic: 0 },
screenBrightness: 0.5,
image: {
type: null,
@ -96,24 +96,26 @@ export const allInOnePc = defineObject({
await applyImage();
const applyBodyColor = () => {
const [r, g, b] = options.bodyColor;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyBodyMat = () => {
bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);
bodyMaterial.roughness = options.bodyMat.roughness;
bodyMaterial.metallic = options.bodyMat.metallic;
};
const applyBezelColor = () => {
const [r, g, b] = options.bezelColor;
bezelMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyBezelMat = () => {
bezelMaterial.albedoColor = new BABYLON.Color3(options.bezelMat.color[0], options.bezelMat.color[1], options.bezelMat.color[2]);
bezelMaterial.roughness = options.bezelMat.roughness;
bezelMaterial.metallic = options.bezelMat.metallic;
};
applyBodyColor();
applyBezelColor();
applyBodyMat();
applyBezelMat();
return {
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'bodyColor': applyBodyColor(); break;
case 'bezelColor': applyBezelColor(); break;
case 'bodyMat': applyBodyMat(); break;
case 'bezelMat': applyBezelMat(); break;
case 'screenBrightness': applyScreenBrightness(); break;
case 'image': applyImage(); break;
}

View file

@ -11,18 +11,18 @@ export const aromaReedDiffuser = defineObject({
name: 'Aroma Reed Diffuser',
options: {
schema: {
bottleColor: {
type: 'color',
label: 'Bottle Color',
bottleMat: {
type: 'material',
label: 'Bottle Material',
},
oilColor: {
type: 'color',
label: 'Oil Color',
oilMat: {
type: 'material',
label: 'Oil Material',
},
},
default: {
bottleColor: [1, 0.83, 0.48],
oilColor: [1, 0.4, 0],
bottleMat: { color: [1, 0.83, 0.48], roughness: 0, metallic: 0.7 },
oilMat: { color: [1, 0.4, 0], roughness: 0, metallic: 1 },
},
},
placement: 'top',
@ -33,23 +33,25 @@ export const aromaReedDiffuser = defineObject({
const bottleMaterial = model.findMaterial('__X_BOTTLE__');
const oilMaterial = model.findMaterial('__X_OIL__');
const applyBottleColor = () => {
const [r, g, b] = options.bottleColor;
bottleMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyBottleMat = () => {
bottleMaterial.albedoColor = new BABYLON.Color3(options.bottleMat.color[0], options.bottleMat.color[1], options.bottleMat.color[2]);
bottleMaterial.roughness = options.bottleMat.roughness;
bottleMaterial.metallic = options.bottleMat.metallic;
};
const applyOilColor = () => {
const [r, g, b] = options.oilColor;
oilMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyOilMat = () => {
oilMaterial.albedoColor = new BABYLON.Color3(options.oilMat.color[0], options.oilMat.color[1], options.oilMat.color[2]);
oilMaterial.roughness = options.oilMat.roughness;
oilMaterial.metallic = options.oilMat.metallic;
};
applyBottleColor();
applyOilColor();
applyBottleMat();
applyOilMat();
return {
onOptionsUpdated: ([k, v]) => {
applyBottleColor();
applyOilColor();
applyBottleMat();
applyOilMat();
},
interactions: {},
dispose: () => {},

View file

@ -11,13 +11,13 @@ export const bed = defineObject({
name: 'Bed',
options: {
schema: {
color: {
type: 'color',
label: 'Color',
mat: {
type: 'material',
label: 'Material',
},
},
default: {
color: [0.2, 0.1, 0.02],
mat: { color: [0.2, 0.1, 0.02], roughness: -1, metallic: -1 },
},
},
placement: 'floor',
@ -26,17 +26,19 @@ 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 applyColor = () => {
const [r, g, b] = options.color;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
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;
};
applyColor();
applyMat();
return {
onOptionsUpdated: ([k, v]) => {
applyColor();
applyMat();
},
interactions: {},
dispose: () => {},

View file

@ -25,9 +25,9 @@ export const boxWallShelf = defineObject({
max: 1,
step: 0.01,
},
bodyColor: {
type: 'color',
label: 'Body color',
bodyMat: {
type: 'material',
label: 'Body material',
},
withBack: {
type: 'boolean',
@ -37,7 +37,7 @@ export const boxWallShelf = defineObject({
default: {
width: 0.1,
height: 0.1,
bodyColor: [0.6, 0.35, 0.15],
bodyMat: { color: [0.6, 0.35, 0.15], roughness: 0.5, metallic: 0 },
withBack: true,
},
},
@ -62,12 +62,13 @@ export const boxWallShelf = defineObject({
applySize();
const applyBodyColor = () => {
const [r, g, b] = options.bodyColor;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyBodyMat = () => {
bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);
bodyMaterial.roughness = options.bodyMat.roughness;
bodyMaterial.metallic = options.bodyMat.metallic;
};
applyBodyColor();
applyBodyMat();
const applyWithBack = () => {
backMesh.isVisible = options.withBack;
@ -86,8 +87,8 @@ export const boxWallShelf = defineObject({
case 'height':
applySize();
break;
case 'bodyColor':
applyBodyColor();
case 'bodyMat':
applyBodyMat();
break;
case 'withBack':
applyWithBack();

View file

@ -11,13 +11,13 @@ export const cactusS = defineObject({
name: 'Cactus S',
options: {
schema: {
potColor: {
type: 'color',
label: 'Pot color',
potMat: {
type: 'material',
label: 'Pot material',
},
},
default: {
potColor: [0.45, 0.45, 0.45],
potMat: { color: [0.45, 0.45, 0.45], roughness: 0.5, metallic: 0 },
},
},
placement: 'top',
@ -27,16 +27,17 @@ export const cactusS = defineObject({
createInstance: ({ options, model }) => {
const potMaterial = model.findMaterial('__X_POT__');
const applyPotColor = () => {
const [r, g, b] = options.potColor;
potMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyPotMat = () => {
potMaterial.albedoColor = new BABYLON.Color3(options.potMat.color[0], options.potMat.color[1], options.potMat.color[2]);
potMaterial.roughness = options.potMat.roughness;
potMaterial.metallic = options.potMat.metallic;
};
applyPotColor();
applyPotMat();
return {
onOptionsUpdated: ([k, v]) => {
applyPotColor();
applyPotMat();
},
interactions: {},
dispose: () => {},

View file

@ -11,13 +11,13 @@ export const ceilingFanLight = defineObject({
name: 'Ceiling Fan Light',
options: {
schema: {
shadeColor: {
type: 'color',
label: 'Shade color',
shadeMat: {
type: 'material',
label: 'Shade material',
},
},
default: {
shadeColor: [0.8, 0.19, 0],
shadeMat: { color: [0.8, 0.19, 0], roughness: 0.5, metallic: 0 },
},
},
placement: 'ceiling',
@ -27,12 +27,13 @@ export const ceilingFanLight = defineObject({
createInstance: ({ options, sr, scene, model }) => {
const shadeMaterial = model.findMaterial('__X_SHADE__');
const applyShadeColor = () => {
const [r, g, b] = options.shadeColor;
shadeMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyShadeMat = () => {
shadeMaterial.albedoColor = new BABYLON.Color3(options.shadeMat.color[0], options.shadeMat.color[1], options.shadeMat.color[2]);
shadeMaterial.roughness = options.shadeMat.roughness;
shadeMaterial.metallic = options.shadeMat.metallic;
};
applyShadeColor();
applyShadeMat();
const rotor = model.findMesh('Rotor');
model.bakeExcludeMeshes = [rotor, ...rotor.getChildMeshes()];
@ -55,7 +56,7 @@ export const ceilingFanLight = defineObject({
},
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'shadeColor': applyShadeColor(); break;
case 'shadeMat': applyShadeMat(); break;
}
},
interactions: {},

View file

@ -11,18 +11,18 @@ export const chair = defineObject({
name: 'Chair',
options: {
schema: {
primaryColor: {
type: 'color',
label: 'Primay Color',
primaryMat: {
type: 'material',
label: 'Primay Material',
},
secondaryColor: {
type: 'color',
label: 'Secondary Color',
secondaryMat: {
type: 'material',
label: 'Secondary Material',
},
},
default: {
primaryColor: [0.44, 0.6, 0],
secondaryColor: [0, 0, 0],
primaryMat: { color: [0.44, 0.6, 0], roughness: 1, metallic: 0 },
secondaryMat: { color: [0, 0, 0], roughness: 0.5, metallic: 0 },
},
},
placement: 'floor',
@ -33,23 +33,25 @@ export const chair = defineObject({
const primaryMaterial = model.findMaterial('__X_PRIMARY__');
const secondaryMaterial = model.findMaterial('__X_SECONDARY__');
const applyPrimaryColor = () => {
const [r, g, b] = options.primaryColor;
primaryMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyPrimaryMat = () => {
primaryMaterial.albedoColor = new BABYLON.Color3(options.primaryMat.color[0], options.primaryMat.color[1], options.primaryMat.color[2]);
primaryMaterial.roughness = options.primaryMat.roughness;
primaryMaterial.metallic = options.primaryMat.metallic;
};
const applySecondaryColor = () => {
const [r, g, b] = options.secondaryColor;
secondaryMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applySecondaryMat = () => {
secondaryMaterial.albedoColor = new BABYLON.Color3(options.secondaryMat.color[0], options.secondaryMat.color[1], options.secondaryMat.color[2]);
secondaryMaterial.roughness = options.secondaryMat.roughness;
secondaryMaterial.metallic = options.secondaryMat.metallic;
};
applyPrimaryColor();
applySecondaryColor();
applyPrimaryMat();
applySecondaryMat();
return {
onOptionsUpdated: ([k, v]) => {
applyPrimaryColor();
applySecondaryColor();
applyPrimaryMat();
applySecondaryMat();
},
interactions: {
sit: {

View file

@ -11,13 +11,13 @@ export const colorBox = defineObject({
name: 'Color Box',
options: {
schema: {
color: {
type: 'color',
label: 'Color',
mat: {
type: 'material',
label: 'Material',
},
},
default: {
color: [0.6, 0.35, 0.15],
mat: { color: [0.6, 0.35, 0.15], roughness: 0.5, metallic: 0 },
},
},
placement: 'floor',
@ -27,16 +27,17 @@ export const colorBox = defineObject({
createInstance: ({ options, model }) => {
const bodyMaterial = model.findMaterial('__X_BODY__');
const applyColor = () => {
const [r, g, b] = options.color;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
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;
};
applyColor();
applyMat();
return {
onOptionsUpdated: ([k, v]) => {
applyColor();
applyMat();
},
interactions: {},
dispose: () => {},

View file

@ -32,16 +32,16 @@ export const cuboid = defineObject({
max: 1,
step: 0.01,
},
color: {
type: 'color',
label: 'Color',
mat: {
type: 'material',
label: 'Material',
},
},
default: {
x: 0.01,
y: 0.01,
z: 0.01,
color: [1, 1, 1],
mat: { color: [1, 1, 1], roughness: 0, metallic: 0 },
},
},
placement: 'top',
@ -58,12 +58,13 @@ export const cuboid = defineObject({
applySize();
const applyColor = () => {
const [r, g, b] = options.color;
mat.albedoColor = new BABYLON.Color3(r, g, b);
const applyMat = () => {
mat.albedoColor = new BABYLON.Color3(options.mat.color[0], options.mat.color[1], options.mat.color[2]);
mat.roughness = options.mat.roughness;
mat.metallic = options.mat.metallic;
};
applyColor();
applyMat();
return {
onInited: () => {
@ -71,8 +72,8 @@ export const cuboid = defineObject({
},
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'color':
applyColor();
case 'mat':
applyMat();
break;
case 'x':
case 'y':

View file

@ -11,13 +11,13 @@ export const desk = defineObject({
name: 'Desk',
options: {
schema: {
frameColor: {
type: 'color',
label: 'Frame color',
frameMat: {
type: 'material',
label: 'Frame material',
},
boardColor: {
type: 'color',
label: 'Board color',
boardMat: {
type: 'material',
label: 'Board material',
},
width: {
type: 'range',
@ -35,8 +35,8 @@ export const desk = defineObject({
},
},
default: {
frameColor: [0.8, 0.8, 0.8],
boardColor: [0.8, 0.4, 0.1],
frameMat: { color: [0.8, 0.8, 0.8], roughness: 0.3, metallic: 1 },
boardMat: { color: [0.8, 0.4, 0.1], roughness: 0.5, metallic: 0 },
width: 0.28,
depth: 0.26,
},
@ -47,19 +47,21 @@ export const desk = defineObject({
const frameMaterial = model.findMaterial('__X_FRAME__');
const boardMaterial = model.findMaterial('__X_BOARD__');
const applyFrameColor = () => {
const [r, g, b] = options.frameColor;
frameMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyFrameMat = () => {
frameMaterial.albedoColor = new BABYLON.Color3(options.frameMat.color[0], options.frameMat.color[1], options.frameMat.color[2]);
frameMaterial.roughness = options.frameMat.roughness;
frameMaterial.metallic = options.frameMat.metallic;
};
applyFrameColor();
applyFrameMat();
const applyBoardColor = () => {
const [r, g, b] = options.boardColor;
boardMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyBoardMat = () => {
boardMaterial.albedoColor = new BABYLON.Color3(options.boardMat.color[0], options.boardMat.color[1], options.boardMat.color[2]);
boardMaterial.roughness = options.boardMat.roughness;
boardMaterial.metallic = options.boardMat.metallic;
};
applyBoardColor();
applyBoardMat();
const applySize = () => {
for (const mesh of model.root.getChildMeshes()) {
@ -78,8 +80,8 @@ export const desk = defineObject({
return {
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'frameColor': applyFrameColor(); break;
case 'boardColor': applyBoardColor(); break;
case 'frameMat': applyFrameMat(); break;
case 'boardMat': applyBoardMat(); break;
case 'width': applySize(); break;
case 'depth': applySize(); break;
}

View file

@ -13,25 +13,25 @@ export const desktopPc = defineObject({
name: 'Desktop PC',
options: {
schema: {
bodyColor: {
type: 'color',
label: 'Body color',
bodyMat: {
type: 'material',
label: 'Body material',
},
coverColor: {
type: 'color',
label: 'Cover color',
coverMat: {
type: 'material',
label: 'Cover material',
},
inner1Color: {
type: 'color',
label: 'Inner color 1',
inner1Mat: {
type: 'material',
label: 'Inner material 1',
},
inner2Color: {
type: 'color',
label: 'Inner color 2',
inner2Mat: {
type: 'material',
label: 'Inner material 2',
},
inner3Color: {
type: 'color',
label: 'Inner color 3',
inner3Mat: {
type: 'material',
label: 'Inner material 3',
},
ledColor: {
type: 'color',
@ -39,11 +39,11 @@ export const desktopPc = defineObject({
},
},
default: {
bodyColor: [0.05, 0.05, 0.05],
coverColor: [0.85, 0.85, 0.85],
inner1Color: [1, 1, 1],
inner2Color: [1, 1, 1],
inner3Color: [0.1, 0.1, 0.1],
bodyMat: { color: [0.05, 0.05, 0.05], roughness: 0.5, metallic: 0.25 },
coverMat: { color: [0.85, 0.85, 0.85], roughness: 0.2, metallic: 0 },
inner1Mat: { color: [1, 1, 1], roughness: 0.2, metallic: 0 },
inner2Mat: { color: [1, 1, 1], roughness: 0.2, metallic: 0 },
inner3Mat: { color: [0.1, 0.1, 0.1], roughness: 0.4, metallic: 0.7 },
ledColor: [0.5, 0.9, 0],
},
},
@ -73,40 +73,45 @@ export const desktopPc = defineObject({
ledMaterial.emissiveIntensity = 1;
const applyBodyColor = () => {
const [r, g, b] = options.bodyColor;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyBodyMat = () => {
bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);
bodyMaterial.roughness = options.bodyMat.roughness;
bodyMaterial.metallic = options.bodyMat.metallic;
};
applyBodyColor();
applyBodyMat();
const applyCoverColor = () => {
const [r, g, b] = options.coverColor;
coverMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyCoverMat = () => {
coverMaterial.albedoColor = new BABYLON.Color3(options.coverMat.color[0], options.coverMat.color[1], options.coverMat.color[2]);
coverMaterial.roughness = options.coverMat.roughness;
coverMaterial.metallic = options.coverMat.metallic;
};
applyCoverColor();
applyCoverMat();
const applyInner1Color = () => {
const [r, g, b] = options.inner1Color;
inner1Material.albedoColor = new BABYLON.Color3(r, g, b);
const applyInner1Mat = () => {
inner1Material.albedoColor = new BABYLON.Color3(options.inner1Mat.color[0], options.inner1Mat.color[1], options.inner1Mat.color[2]);
inner1Material.roughness = options.inner1Mat.roughness;
inner1Material.metallic = options.inner1Mat.metallic;
};
applyInner1Color();
applyInner1Mat();
const applyInner2Color = () => {
const [r, g, b] = options.inner2Color;
inner2Material.albedoColor = new BABYLON.Color3(r, g, b);
const applyInner2Mat = () => {
inner2Material.albedoColor = new BABYLON.Color3(options.inner2Mat.color[0], options.inner2Mat.color[1], options.inner2Mat.color[2]);
inner2Material.roughness = options.inner2Mat.roughness;
inner2Material.metallic = options.inner2Mat.metallic;
};
applyInner2Color();
applyInner2Mat();
const applyInner3Color = () => {
const [r, g, b] = options.inner3Color;
inner3Material.albedoColor = new BABYLON.Color3(r, g, b);
const applyInner3Mat = () => {
inner3Material.albedoColor = new BABYLON.Color3(options.inner3Mat.color[0], options.inner3Mat.color[1], options.inner3Mat.color[2]);
inner3Material.roughness = options.inner3Mat.roughness;
inner3Material.metallic = options.inner3Mat.metallic;
};
applyInner3Color();
applyInner3Mat();
const applyLedColor = () => {
const [r, g, b] = options.ledColor;
@ -119,11 +124,11 @@ export const desktopPc = defineObject({
return {
onOptionsUpdated: ([k, v]) => {
applyBodyColor();
applyCoverColor();
applyInner1Color();
applyInner2Color();
applyInner3Color();
applyBodyMat();
applyCoverMat();
applyInner1Mat();
applyInner2Mat();
applyInner3Mat();
applyLedColor();
},
interactions: {},

View file

@ -13,9 +13,9 @@ export const ductRailSpotLights = defineObject({
name: 'ductRailSpotLights',
options: {
schema: {
bodyColor: {
type: 'color',
label: 'Body color',
bodyMat: {
type: 'material',
label: 'Body material',
},
light: {
type: 'light',
@ -37,7 +37,7 @@ export const ductRailSpotLights = defineObject({
},
},
default: {
bodyColor: [0.05, 0.05, 0.05],
bodyMat: { color: [0.05, 0.05, 0.05], roughness: 0.5, metallic: 0.3 },
light: {
color: [1, 0.5, 0.2],
brightness: 0.2,
@ -51,12 +51,13 @@ export const ductRailSpotLights = defineObject({
createInstance: ({ lc, scene, options, model, graphicsQuality }) => {
const bodyMaterial = model.findMaterial('__X_BODY__');
const applyBodyColor = () => {
const [r, g, b] = options.bodyColor;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyBodyMat = () => {
bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);
bodyMaterial.roughness = options.bodyMat.roughness;
bodyMaterial.metallic = options.bodyMat.metallic;
};
applyBodyColor();
applyBodyMat();
const lamps = model.findMeshes('__X_LAMP__');
const lights: BABYLON.SpotLight[] = [];
@ -101,7 +102,7 @@ export const ductRailSpotLights = defineObject({
return {
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'bodyColor': applyBodyColor(); break;
case 'bodyMat': applyBodyMat(); break;
case 'light': applyLight(); break;
case 'angleV':
case 'angleH':

View file

@ -16,9 +16,9 @@ export const electronicDisplayBoard = defineObject({
type: 'string',
label: 'Text',
},
frameColor: {
type: 'color',
label: 'Frame color',
frameMat: {
type: 'material',
label: 'Frame material',
},
ledColor: {
type: 'color',
@ -32,11 +32,9 @@ export const electronicDisplayBoard = defineObject({
step: 0.01,
},
},
defaults: {
},
default: {
text: 'Hello, Misskey!',
frameColor: [0.05, 0.05, 0.05],
frameMat: { color: [0.05, 0.05, 0.05], roughness: 0.2, metallic: 0 },
ledColor: [1, 1, 1],
ledBrightness: 0.5,
},
@ -85,12 +83,13 @@ export const electronicDisplayBoard = defineObject({
model.bakeExcludeMeshes = [displayMesh];
const applyFrameColor = () => {
const [r, g, b] = options.frameColor;
frameMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyFrameMat = () => {
frameMaterial.albedoColor = new BABYLON.Color3(options.frameMat.color[0], options.frameMat.color[1], options.frameMat.color[2]);
frameMaterial.roughness = options.frameMat.roughness;
frameMaterial.metallic = options.frameMat.metallic;
};
applyFrameColor();
applyFrameMat();
const applyLedColor = () => {
const [r, g, b] = options.ledColor;
@ -131,7 +130,7 @@ export const electronicDisplayBoard = defineObject({
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'text': applyText(); break;
case 'frameColor': applyFrameColor(); break;
case 'frameMat': applyFrameMat(); break;
case 'ledColor': applyLedColor(); break;
case 'ledBrightness': applyLedBrightness(); break;
}

View file

@ -13,9 +13,9 @@ export const handheldGameConsole = defineObject({
name: 'handheldGameConsole',
options: {
schema: {
bodyColor: {
type: 'color',
label: 'Body color',
bodyMat: {
type: 'material',
label: 'Body material',
},
screenBrightness: {
type: 'range',
@ -31,7 +31,7 @@ export const handheldGameConsole = defineObject({
},
},
default: {
bodyColor: [1, 1, 1],
bodyMat: { color: [1, 1, 1], roughness: 0.5, metallic: 0 },
screenBrightness: 0.5,
image: { type: null },
},
@ -39,7 +39,7 @@ export const handheldGameConsole = defineObject({
placement: 'top',
hasCollisions: false,
hasTexture: true,
createInstance: async ({ scene, options, model, graphicsQuality }) => {
createInstance: async ({ scene, options, model }) => {
const screenMesh = model.findMesh('__X_SCREEN__');
const bodyMaterial = model.findMaterial('__X_BODY__');
@ -70,17 +70,18 @@ export const handheldGameConsole = defineObject({
await applyImage();
const applyBodyColor = () => {
const [r, g, b] = options.bodyColor;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyBodyMat = () => {
bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);
bodyMaterial.roughness = options.bodyMat.roughness;
bodyMaterial.metallic = options.bodyMat.metallic;
};
applyBodyColor();
applyBodyMat();
return {
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'bodyColor': applyBodyColor(); break;
case 'bodyMat': applyBodyMat(); break;
case 'screenBrightness': applyScreenBrightness(); break;
case 'image': applyImage(); break;
}

View file

@ -25,21 +25,22 @@ export const hangingDuctRail = defineObject({
max: 1,
step: 0.01,
},
bodyColor: {
type: 'color',
label: 'body color',
bodyMat: {
type: 'material',
label: 'body material',
},
},
default: {
width: 0.2,
height: 0.2,
bodyColor: [0.05, 0.05, 0.05],
bodyMat: { color: [0.05, 0.05, 0.05], roughness: -1, metallic: -1 },
},
},
placement: 'ceiling',
hasCollisions: false,
createInstance: async ({ options, model }) => {
createInstance: async ({ options, model, id }) => {
const bodyMaterial = model.findMaterial('__X_BODY__');
console.log(id, bodyMaterial.roughness, bodyMaterial.metallic);
const applySize = () => {
for (const mesh of model.root.getChildMeshes()) {
@ -55,11 +56,13 @@ export const hangingDuctRail = defineObject({
applySize();
const applyBodyColor = () => {
bodyMaterial.albedoColor = new BABYLON.Color3(...options.bodyColor);
const applyBodyMat = () => {
bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);
bodyMaterial.roughness = options.bodyMat.roughness;
bodyMaterial.metallic = options.bodyMat.metallic;
};
applyBodyColor();
applyBodyMat();
return {
onInited: () => {
@ -71,8 +74,8 @@ export const hangingDuctRail = defineObject({
case 'height':
applySize();
break;
case 'bodyColor':
applyBodyColor();
case 'bodyMat':
applyBodyMat();
break;
}
},

View file

@ -9,13 +9,13 @@ import { defineObject, defineObjectClass } from '../object.js';
const base = defineObjectClass({
options: {
schema: {
frameColor: {
type: 'color',
label: 'Frame color',
frameMat: {
type: 'material',
label: 'Frame material',
},
boardColor: {
type: 'color',
label: 'Board color',
boardMat: {
type: 'material',
label: 'Board material',
},
width: {
type: 'range',
@ -26,8 +26,8 @@ const base = defineObjectClass({
},
},
default: {
frameColor: [0.2, 0.2, 0.2],
boardColor: [0.8, 0.4, 0.1],
frameMat: { color: [0.2, 0.2, 0.2], roughness: 0.4, metallic: 1 },
boardMat: { color: [0.8, 0.4, 0.1], roughness: 0.7, metallic: 0 },
width: 0.2,
},
},
@ -37,19 +37,21 @@ const base = defineObjectClass({
const frameMaterial = model.findMaterial('__X_FRAME__');
const boardMaterial = model.findMaterial('__X_BOARD__');
const applyFrameColor = () => {
const [r, g, b] = options.frameColor;
frameMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyFrameMat = () => {
frameMaterial.albedoColor = new BABYLON.Color3(options.frameMat.color[0], options.frameMat.color[1], options.frameMat.color[2]);
frameMaterial.roughness = options.frameMat.roughness;
frameMaterial.metallic = options.frameMat.metallic;
};
applyFrameColor();
applyFrameMat();
const applyBoardColor = () => {
const [r, g, b] = options.boardColor;
boardMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyBoardMat = () => {
boardMaterial.albedoColor = new BABYLON.Color3(options.boardMat.color[0], options.boardMat.color[1], options.boardMat.color[2]);
boardMaterial.roughness = options.boardMat.roughness;
boardMaterial.metallic = options.boardMat.metallic;
};
applyBoardColor();
applyBoardMat();
const applySize = () => {
for (const mesh of model.root.getChildMeshes()) {
@ -65,8 +67,8 @@ const base = defineObjectClass({
return {
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'frameColor': applyFrameColor(); break;
case 'boardColor': applyBoardColor(); break;
case 'frameMat': applyFrameMat(); break;
case 'boardMat': applyBoardMat(); break;
case 'width': applySize(); break;
}
},

View file

@ -11,13 +11,13 @@ export const ironFrameTable = defineObject({
name: 'ironFrameTable',
options: {
schema: {
frameColor: {
type: 'color',
label: 'Frame color',
frameMat: {
type: 'material',
label: 'Frame material',
},
boardColor: {
type: 'color',
label: 'Board color',
boardMat: {
type: 'material',
label: 'Board material',
},
width: {
type: 'range',
@ -42,8 +42,8 @@ export const ironFrameTable = defineObject({
},
},
default: {
frameColor: [0.8, 0.8, 0.8],
boardColor: [0.8, 0.4, 0.1],
frameMat: { color: [0.8, 0.8, 0.8], roughness: 0.3, metallic: 1 },
boardMat: { color: [0.8, 0.4, 0.1], roughness: 0.6, metallic: 0 },
width: 0.28,
depth: 0.25,
height: 0.35,
@ -55,19 +55,21 @@ export const ironFrameTable = defineObject({
const frameMaterial = model.findMaterial('__X_FRAME__');
const boardMaterial = model.findMaterial('__X_BOARD__');
const applyFrameColor = () => {
const [r, g, b] = options.frameColor;
frameMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyFrameMat = () => {
frameMaterial.albedoColor = new BABYLON.Color3(options.frameMat.color[0], options.frameMat.color[1], options.frameMat.color[2]);
frameMaterial.roughness = options.frameMat.roughness;
frameMaterial.metallic = options.frameMat.metallic;
};
applyFrameColor();
applyFrameMat();
const applyBoardColor = () => {
const [r, g, b] = options.boardColor;
boardMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyBoardMat = () => {
boardMaterial.albedoColor = new BABYLON.Color3(options.boardMat.color[0], options.boardMat.color[1], options.boardMat.color[2]);
boardMaterial.roughness = options.boardMat.roughness;
boardMaterial.metallic = options.boardMat.metallic;
};
applyBoardColor();
applyBoardMat();
const topMesh = model.findMesh('__TOP__');
@ -91,8 +93,8 @@ export const ironFrameTable = defineObject({
return {
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'frameColor': applyFrameColor(); break;
case 'boardColor': applyBoardColor(); break;
case 'frameMat': applyFrameMat(); break;
case 'boardMat': applyBoardMat(); break;
case 'width': applySize(); stickyMarkerMeshUpdated?.(topMesh); break;
case 'depth': applySize(); stickyMarkerMeshUpdated?.(topMesh); break;
case 'height': applySize(); stickyMarkerMeshUpdated?.(topMesh); break;

View file

@ -11,18 +11,18 @@ export const keyboard = defineObject({
name: 'Keyboard',
options: {
schema: {
bodyColor: {
type: 'color',
label: 'Body color',
bodyMat: {
type: 'material',
label: 'Body material',
},
keyColor: {
type: 'color',
label: 'key color',
keyMat: {
type: 'material',
label: 'key material',
},
},
default: {
bodyColor: [0.3, 0.3, 0.3],
keyColor: [0.2, 0.2, 0.2],
bodyMat: { color: [0.3, 0.3, 0.3], roughness: 0.6, metallic: 0 },
keyMat: { color: [0.2, 0.2, 0.2], roughness: 0.5, metallic: 0 },
},
},
placement: 'top',
@ -32,25 +32,27 @@ export const keyboard = defineObject({
const bodyMaterial = model.findMaterial('__X_BODY__');
const keyMaterial = model.findMaterial('__X_KEY__');
const applyBodyColor = () => {
const [r, g, b] = options.bodyColor;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyBodyMat = () => {
bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);
bodyMaterial.roughness = options.bodyMat.roughness;
bodyMaterial.metallic = options.bodyMat.metallic;
};
applyBodyColor();
applyBodyMat();
const applyKeyColor = () => {
const [r, g, b] = options.keyColor;
keyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyKeyMat = () => {
keyMaterial.albedoColor = new BABYLON.Color3(options.keyMat.color[0], options.keyMat.color[1], options.keyMat.color[2]);
keyMaterial.roughness = options.keyMat.roughness;
keyMaterial.metallic = options.keyMat.metallic;
};
applyKeyColor();
applyKeyMat();
return {
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'bodyColor': applyBodyColor(); break;
case 'keyColor': applyKeyColor(); break;
case 'bodyMat': applyBodyMat(); break;
case 'keyMat': applyKeyMat(); break;
}
},
interactions: {},

View file

@ -13,13 +13,13 @@ export const laptopPc = defineObject({
name: 'Laptop PC',
options: {
schema: {
bodyColor: {
type: 'color',
label: 'Body color',
bodyMat: {
type: 'material',
label: 'Body material',
},
bezelColor: {
type: 'color',
label: 'Bezel color',
bezelMat: {
type: 'material',
label: 'Bezel material',
},
screenBrightness: {
type: 'range',
@ -42,8 +42,8 @@ export const laptopPc = defineObject({
},
},
default: {
bodyColor: [1, 1, 1],
bezelColor: [0, 0, 0],
bodyMat: { color: [1, 1, 1], roughness: 0.5, metallic: 1 },
bezelMat: { color: [0, 0, 0], roughness: 0, metallic: 0 },
screenBrightness: 0.5,
image: { type: null },
openAngle: 0,
@ -98,18 +98,20 @@ export const laptopPc = defineObject({
await applyImage();
const applyBodyColor = () => {
const [r, g, b] = options.bodyColor;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyBodyMat = () => {
bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);
bodyMaterial.roughness = options.bodyMat.roughness;
bodyMaterial.metallic = options.bodyMat.metallic;
};
const applyBezelColor = () => {
const [r, g, b] = options.bezelColor;
bezelMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyBezelMat = () => {
bezelMaterial.albedoColor = new BABYLON.Color3(options.bezelMat.color[0], options.bezelMat.color[1], options.bezelMat.color[2]);
bezelMaterial.roughness = options.bezelMat.roughness;
bezelMaterial.metallic = options.bezelMat.metallic;
};
applyBodyColor();
applyBezelColor();
applyBodyMat();
applyBezelMat();
const applyOpenAngle = () => {
const angle = options.openAngle;
@ -128,8 +130,8 @@ export const laptopPc = defineObject({
return {
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'bodyColor': applyBodyColor(); break;
case 'bezelColor': applyBezelColor(); break;
case 'bodyMat': applyBodyMat(); break;
case 'bezelMat': applyBezelMat(); break;
case 'screenBrightness': applyScreenBrightness(); break;
case 'image': applyImage(); break;
case 'openAngle': applyOpenAngle(); break;

View file

@ -12,13 +12,13 @@ export const lavaLamp = defineObject({
name: 'Lava Lamp',
options: {
schema: {
bodyColor: {
type: 'color',
label: 'Body color',
bodyMat: {
type: 'material',
label: 'Body material',
},
glassColor: {
type: 'color',
label: 'Glass color',
glassMat: {
type: 'material',
label: 'Glass material',
},
lightColor: {
type: 'color',
@ -30,8 +30,8 @@ export const lavaLamp = defineObject({
},
},
default: {
bodyColor: [0.8, 0.8, 0.8],
glassColor: [0.8, 0, 0.1],
bodyMat: { color: [0.8, 0.8, 0.8], roughness: 0.5, metallic: 0.7 },
glassMat: { color: [0.8, 0, 0.1], roughness: 0, metallic: 0 },
lightColor: [1, 0.175, 0.175],
lavaColor: [1, 0.5, 0.2],
},
@ -44,19 +44,21 @@ export const lavaLamp = defineObject({
const glassMaterial = model.findMaterial('__X_GLASS__');
const lightMaterial = model.findMaterial('__X_LIGHT__');
const applyBodyColor = () => {
const [r, g, b] = options.bodyColor;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyBodyMat = () => {
bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);
bodyMaterial.roughness = options.bodyMat.roughness;
bodyMaterial.metallic = options.bodyMat.metallic;
};
applyBodyColor();
applyBodyMat();
const applyGlassColor = () => {
const [r, g, b] = options.glassColor;
glassMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyGlassMat = () => {
glassMaterial.albedoColor = new BABYLON.Color3(options.glassMat.color[0], options.glassMat.color[1], options.glassMat.color[2]);
glassMaterial.roughness = options.glassMat.roughness;
glassMaterial.metallic = options.glassMat.metallic;
};
applyGlassColor();
applyGlassMat();
// TODO: graphicsQualityがLOWならそもそも追加しない
const light = new BABYLON.PointLight('lavaLampLight', new BABYLON.Vector3(0, cm(11), 0), scene, lc != null);
@ -148,8 +150,8 @@ export const lavaLamp = defineObject({
interactions: {},
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'bodyColor': applyBodyColor(); break;
case 'glassColor': applyGlassColor(); break;
case 'bodyMat': applyBodyMat(); break;
case 'glassMat': applyGlassMat(); break;
case 'lightColor': applyLightColor(); break;
case 'lavaColor': applyLavaColor(); break;
}

View file

@ -11,9 +11,9 @@ export const lowPartitionBar = defineObject({
name: 'lowPartitionBar',
options: {
schema: {
bodyColor: {
type: 'color',
label: 'Body color',
bodyMat: {
type: 'material',
label: 'Body material',
},
width: {
type: 'range',
@ -24,21 +24,23 @@ export const lowPartitionBar = defineObject({
},
},
default: {
bodyColor: [0.8, 0.8, 0.8],
bodyMat: { color: [0.8, 0.8, 0.8], roughness: -1, metallic: -1 },
width: 0.5,
},
},
placement: 'top',
//hasCollisions: true,
createInstance: ({ options, model }) => {
createInstance: ({ options, model, id }) => {
const bodyMaterial = model.findMaterial('__X_BODY__');
console.log(id, bodyMaterial.roughness, bodyMaterial.metallic);
const applyBodyColor = () => {
const [r, g, b] = options.bodyColor;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyBodyMat = () => {
bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);
bodyMaterial.roughness = options.bodyMat.roughness;
bodyMaterial.metallic = options.bodyMat.metallic;
};
applyBodyColor();
applyBodyMat();
const applySize = () => {
for (const mesh of model.root.getChildMeshes()) {
@ -54,7 +56,7 @@ export const lowPartitionBar = defineObject({
return {
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'bodyColor': applyBodyColor(); break;
case 'bodyMat': applyBodyMat(); break;
case 'width': applySize(); break;
}
},

View file

@ -13,9 +13,9 @@ export const monitor = defineObject({
name: 'Monitor',
options: {
schema: {
bodyColor: {
type: 'color',
label: 'Body color',
bodyMat: {
type: 'material',
label: 'Body material',
},
screenBrightness: {
type: 'range',
@ -31,7 +31,7 @@ export const monitor = defineObject({
},
},
default: {
bodyColor: [0.1, 0.1, 0.1],
bodyMat: { color: [0.1, 0.1, 0.1], roughness: 0.5, metallic: 0 },
screenBrightness: 0.5,
image: { type: null },
},
@ -84,17 +84,18 @@ export const monitor = defineObject({
await applyImage();
const applyBodyColor = () => {
const [r, g, b] = options.bodyColor;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyBodyMat = () => {
bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);
bodyMaterial.roughness = options.bodyMat.roughness;
bodyMaterial.metallic = options.bodyMat.metallic;
};
applyBodyColor();
applyBodyMat();
return {
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'bodyColor': applyBodyColor(); break;
case 'bodyMat': applyBodyMat(); break;
case 'screenBrightness': applyScreenBrightness(); break;
case 'image': applyImage(); break;
}

View file

@ -11,13 +11,13 @@ export const monitorSpeaker = defineObject({
name: 'Monitor Speaker',
options: {
schema: {
color: {
type: 'color',
label: 'Color',
mat: {
type: 'material',
label: 'Material',
},
},
default: {
color: [0, 0, 0],
mat: { color: [0, 0, 0], roughness: 0.5, metallic: 0.5 },
},
},
placement: 'top',
@ -26,16 +26,17 @@ export const monitorSpeaker = defineObject({
createInstance: ({ options, model }) => {
const bodyMaterial = model.findMaterial('__X_BODY__');
const applyColor = () => {
const [r, g, b] = options.color;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
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;
};
applyColor();
applyMat();
return {
onOptionsUpdated: ([k, v]) => {
applyColor();
applyMat();
},
interactions: {},
dispose: () => {},

View file

@ -11,13 +11,13 @@ export const monstera = defineObject({
name: 'Monstera',
options: {
schema: {
potColor: {
type: 'color',
label: 'potColor',
potMat: {
type: 'material',
label: 'potMaterial',
},
},
default: {
potColor: [0.5, 0.5, 0.5],
potMat: { color: [0.5, 0.5, 0.5], roughness: 0.7, metallic: 0 },
},
},
placement: 'top',
@ -27,17 +27,18 @@ export const monstera = defineObject({
createInstance: ({ options, model }) => {
const potMaterial = model.findMaterial('__X_POT__');
const applyPotColor = () => {
const [r, g, b] = options.potColor;
potMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyPotMat = () => {
potMaterial.albedoColor = new BABYLON.Color3(options.potMat.color[0], options.potMat.color[1], options.potMat.color[2]);
potMaterial.roughness = options.potMat.roughness;
potMaterial.metallic = options.potMat.metallic;
};
applyPotColor();
applyPotMat();
return {
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'potColor': applyPotColor(); break;
case 'potMat': applyPotMat(); break;
}
},
interactions: {},

View file

@ -11,13 +11,13 @@ export const newtonsCradle = defineObject({
name: 'newtonsCradle',
options: {
schema: {
frameColor: {
type: 'color',
label: 'Frame color',
frameMat: {
type: 'material',
label: 'Frame material',
},
},
default: {
frameColor: [0.15, 0.15, 0.15],
frameMat: { color: [0.15, 0.15, 0.15], roughness: 0.4, metallic: 0.8 },
},
},
placement: 'top',
@ -26,17 +26,18 @@ export const newtonsCradle = defineObject({
createInstance: ({ options, model }) => {
const frameMaterial = model.findMaterial('__X_FRAME__');
const applyFrameColor = () => {
const [r, g, b] = options.frameColor;
frameMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyFrameMat = () => {
frameMaterial.albedoColor = new BABYLON.Color3(options.frameMat.color[0], options.frameMat.color[1], options.frameMat.color[2]);
frameMaterial.roughness = options.frameMat.roughness;
frameMaterial.metallic = options.frameMat.metallic;
};
applyFrameColor();
applyFrameMat();
return {
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'frameColor': applyFrameColor(); break;
case 'frameMat': applyFrameMat(); break;
}
},
interactions: {},

View file

@ -11,13 +11,13 @@ export const pachira = defineObject({
name: 'Pachira',
options: {
schema: {
potColor: {
type: 'color',
label: 'potColor',
potMat: {
type: 'material',
label: 'potMaterial',
},
},
default: {
potColor: [0.8, 0.8, 0.8],
potMat: { color: [0.8, 0.8, 0.8], roughness: 0.2, metallic: 0 },
},
},
placement: 'top',
@ -27,17 +27,18 @@ export const pachira = defineObject({
createInstance: ({ options, model }) => {
const potMaterial = model.findMaterial('__X_POT__');
const applyPotColor = () => {
const [r, g, b] = options.potColor;
potMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyPotMat = () => {
potMaterial.albedoColor = new BABYLON.Color3(options.potMat.color[0], options.potMat.color[1], options.potMat.color[2]);
potMaterial.roughness = options.potMat.roughness;
potMaterial.metallic = options.potMat.metallic;
};
applyPotColor();
applyPotMat();
return {
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'potColor': applyPotColor(); break;
case 'potMat': applyPotMat(); break;
}
},
interactions: {},

View file

@ -11,30 +11,32 @@ export const pc = defineObject({
name: 'PC',
options: {
schema: {
color: {
type: 'color',
label: 'Color',
mat: {
type: 'material',
label: 'Material',
},
},
default: {
color: [0, 0, 0],
mat: { color: [0, 0, 0], roughness: -1, metallic: -1 },
},
},
placement: 'top',
createInstance: ({ options, root }) => {
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 applyColor = () => {
const [r, g, b] = options.color;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
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;
};
applyColor();
applyMat();
return {
onOptionsUpdated: ([k, v]) => {
applyColor();
applyMat();
},
interactions: {},
dispose: () => {},

View file

@ -11,31 +11,33 @@ export const piano = defineObject({
name: 'Piano',
options: {
schema: {
bodyColor: {
type: 'color',
label: 'bodyColor',
bodyMat: {
type: 'material',
label: 'bodyMaterial',
},
},
default: {
bodyColor: [0, 0, 0],
bodyMat: { color: [0, 0, 0], roughness: -1, metallic: -1 },
},
},
placement: 'floor',
hasCollisions: true,
canPreMeshesMerging: true,
createInstance: ({ options, model }) => {
createInstance: ({ options, model, id }) => {
const bodyMaterial = model.findMaterial('__X_BODY__');
console.log(id, bodyMaterial.roughness, bodyMaterial.metallic);
const applyBodyColor = () => {
const [r, g, b] = options.bodyColor;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyBodyMat = () => {
bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);
bodyMaterial.roughness = options.bodyMat.roughness;
bodyMaterial.metallic = options.bodyMat.metallic;
};
applyBodyColor();
applyBodyMat();
return {
onOptionsUpdated: ([k, v]) => {
applyBodyColor();
applyBodyMat();
},
interactions: {},
dispose: () => {},

View file

@ -14,9 +14,9 @@ export const pictureFrame = defineObject({
name: 'Simple picture frame',
options: {
schema: {
frameColor: {
type: 'color',
label: 'Frame color',
frameMat: {
type: 'material',
label: 'Frame material',
},
width: {
type: 'range',
@ -71,7 +71,7 @@ export const pictureFrame = defineObject({
},
},
default: {
frameColor: [0.71, 0.58, 0.39],
frameMat: { color: [0.71, 0.58, 0.39], roughness: 0.5, metallic: 0 },
width: 0.15,
height: 0.15,
frameThickness: 0.3,
@ -169,12 +169,13 @@ export const pictureFrame = defineObject({
const frameMaterial = model.findMaterial('__X_FRAME__');
const applyFrameColor = () => {
const [r, g, b] = options.frameColor;
frameMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyFrameMat = () => {
frameMaterial.albedoColor = new BABYLON.Color3(options.frameMat.color[0], options.frameMat.color[1], options.frameMat.color[2]);
frameMaterial.roughness = options.frameMat.roughness;
frameMaterial.metallic = options.frameMat.metallic;
};
applyFrameColor();
applyFrameMat();
return {
onInited: () => {
@ -182,7 +183,7 @@ export const pictureFrame = defineObject({
},
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'frameColor': applyFrameColor(); break;
case 'frameMat': applyFrameMat(); break;
case 'width':
case 'height': applySize(); break;
case 'frameThickness': applyFrameThickness(); break;

View file

@ -11,13 +11,13 @@ export const snakeplant = defineObject({
name: 'Snake Plant',
options: {
schema: {
potColor: {
type: 'color',
label: 'potColor',
potMat: {
type: 'material',
label: 'potMaterial',
},
},
default: {
potColor: [0.7, 0.7, 0.7],
potMat: { color: [0.7, 0.7, 0.7], roughness: 1, metallic: 0 },
},
},
placement: 'top',
@ -27,17 +27,18 @@ export const snakeplant = defineObject({
createInstance: ({ options, model }) => {
const potMaterial = model.findMaterial('__X_POT__');
const applyPotColor = () => {
const [r, g, b] = options.potColor;
potMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyPotMat = () => {
potMaterial.albedoColor = new BABYLON.Color3(options.potMat.color[0], options.potMat.color[1], options.potMat.color[2]);
potMaterial.roughness = options.potMat.roughness;
potMaterial.metallic = options.potMat.metallic;
};
applyPotColor();
applyPotMat();
return {
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'potColor': applyPotColor(); break;
case 'potMat': applyPotMat(); break;
}
},
interactions: {},

View file

@ -11,32 +11,34 @@ export const sofa = defineObject({
name: 'Sofa',
options: {
schema: {
bodyColor: {
type: 'color',
label: 'bodyColor',
bodyMat: {
type: 'material',
label: 'bodyMaterial',
},
},
default: {
bodyColor: [0.4, 0.4, 0.4],
bodyMat: { color: [0.4, 0.4, 0.4], roughness: -1, metallic: -1 },
},
},
placement: 'floor',
hasCollisions: true,
canPreMeshesMerging: true,
hasTexture: false,
createInstance: ({ options, model }) => {
createInstance: ({ options, model, id }) => {
const bodyMaterial = model.findMaterial('__X_BODY__');
console.log(id, bodyMaterial.roughness, bodyMaterial.metallic);
const applyBodyColor = () => {
const [r, g, b] = options.bodyColor;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyBodyMat = () => {
bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);
bodyMaterial.roughness = options.bodyMat.roughness;
bodyMaterial.metallic = options.bodyMat.metallic;
};
applyBodyColor();
applyBodyMat();
return {
onOptionsUpdated: ([k, v]) => {
applyBodyColor();
applyBodyMat();
},
interactions: {},
dispose: () => {},

View file

@ -11,18 +11,18 @@ export const speaker = defineObject({
name: 'Speaker',
options: {
schema: {
outerColor: {
type: 'color',
label: 'Outer Color',
outerMat: {
type: 'material',
label: 'Outer Material',
},
innerColor: {
type: 'color',
label: 'Inner Color',
innerMat: {
type: 'material',
label: 'Inner Material',
},
},
default: {
outerColor: [0.45, 0.8, 0],
innerColor: [0, 0, 0],
outerMat: { color: [0.45, 0.8, 0], roughness: 0.1, metallic: 0 },
innerMat: { color: [0, 0, 0], roughness: 0.5, metallic: 0.5 },
},
},
placement: 'top',
@ -33,23 +33,25 @@ export const speaker = defineObject({
const outerMaterial = model.findMaterial('__X_COVER__');
const innerMaterial = model.findMaterial('__X_BODY__');
const applyOuterColor = () => {
const [r, g, b] = options.outerColor;
outerMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyOuterMat = () => {
outerMaterial.albedoColor = new BABYLON.Color3(options.outerMat.color[0], options.outerMat.color[1], options.outerMat.color[2]);
outerMaterial.roughness = options.outerMat.roughness;
outerMaterial.metallic = options.outerMat.metallic;
};
const applyInnerColor = () => {
const [r, g, b] = options.innerColor;
innerMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyInnerMat = () => {
innerMaterial.albedoColor = new BABYLON.Color3(options.innerMat.color[0], options.innerMat.color[1], options.innerMat.color[2]);
innerMaterial.roughness = options.innerMat.roughness;
innerMaterial.metallic = options.innerMat.metallic;
};
applyOuterColor();
applyInnerColor();
applyOuterMat();
applyInnerMat();
return {
onOptionsUpdated: ([k, v]) => {
applyOuterColor();
applyInnerColor();
applyOuterMat();
applyInnerMat();
},
interactions: {},
dispose: () => {},

View file

@ -11,9 +11,9 @@ export const speakerStand = defineObject({
name: 'speakerStand',
options: {
schema: {
bodyColor: {
type: 'color',
label: 'Body color',
bodyMat: {
type: 'material',
label: 'Body material',
},
height: {
type: 'range',
@ -24,22 +24,24 @@ export const speakerStand = defineObject({
},
},
default: {
bodyColor: [0.2, 0.2, 0.2],
bodyMat: { color: [0.2, 0.2, 0.2], roughness: -1, metallic: -1 },
height: 0.1,
},
},
placement: 'top',
hasCollisions: false,
hasTexture: false,
createInstance: ({ options, model }) => {
createInstance: ({ options, model, id }) => {
const bodyMaterial = model.findMaterial('__X_BODY__');
console.log(id, bodyMaterial.roughness, bodyMaterial.metallic);
const applyBodyColor = () => {
const [r, g, b] = options.bodyColor;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyBodyMat = () => {
bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);
bodyMaterial.roughness = options.bodyMat.roughness;
bodyMaterial.metallic = options.bodyMat.metallic;
};
applyBodyColor();
applyBodyMat();
const applySize = () => {
for (const mesh of model.root.getChildMeshes()) {
@ -55,7 +57,7 @@ export const speakerStand = defineObject({
return {
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'bodyColor': applyBodyColor(); break;
case 'bodyMat': applyBodyMat(); break;
case 'height': applySize(); break;
}
},

View file

@ -13,9 +13,9 @@ export const spotLight = defineObject({
name: 'spotLight',
options: {
schema: {
bodyColor: {
type: 'color',
label: 'Body color',
bodyMat: {
type: 'material',
label: 'Body material',
},
light: {
type: 'light',
@ -37,7 +37,7 @@ export const spotLight = defineObject({
},
},
default: {
bodyColor: [0.05, 0.05, 0.05],
bodyMat: { color: [0.05, 0.05, 0.05], roughness: -1, metallic: -1 },
light: {
color: [1, 0.5, 0.2],
brightness: 0.2,
@ -48,15 +48,17 @@ export const spotLight = defineObject({
},
placement: 'bottom',
hasCollisions: false,
createInstance: ({ lc, scene, options, model, graphicsQuality }) => {
createInstance: ({ lc, scene, options, model, graphicsQuality, id }) => {
const bodyMaterial = model.findMaterial('__X_BODY__');
console.log(id, bodyMaterial.roughness, bodyMaterial.metallic);
const applyBodyColor = () => {
const [r, g, b] = options.bodyColor;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyBodyMat = () => {
bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);
bodyMaterial.roughness = options.bodyMat.roughness;
bodyMaterial.metallic = options.bodyMat.metallic;
};
applyBodyColor();
applyBodyMat();
const lamp = model.findMesh('__X_LAMP__');
const light = new BABYLON.SpotLight('', new BABYLON.Vector3(cm(0), cm(0), 0), new BABYLON.Vector3(0, -1, 0), Math.PI / 1, 2, scene, lc != null);
@ -91,7 +93,7 @@ export const spotLight = defineObject({
return {
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'bodyColor': applyBodyColor(); break;
case 'bodyMat': applyBodyMat(); break;
case 'light': applyLight(); break;
case 'angleV':
case 'angleH':

View file

@ -11,47 +11,51 @@ export const stanchionPole = defineObject({
name: 'stanchionPole',
options: {
schema: {
bodyColor: {
type: 'color',
label: 'Body color',
bodyMat: {
type: 'material',
label: 'Body material',
},
ropeColor: {
type: 'color',
label: 'Rope color',
ropeMat: {
type: 'material',
label: 'Rope material',
},
},
default: {
bodyColor: [0.8, 0.39, 0.1],
ropeColor: [0.21, 0.0, 0.0],
bodyMat: { color: [0.8, 0.39, 0.1], roughness: -1, metallic: -1 },
ropeMat: { color: [0.21, 0.0, 0.0], roughness: -1, metallic: -1 },
},
},
placement: 'floor',
hasCollisions: true,
hasTexture: false,
createInstance: ({ options, model }) => {
createInstance: ({ options, model, id }) => {
const bodyMaterial = model.findMaterial('__X_BODY__');
console.log(id, bodyMaterial.roughness, bodyMaterial.metallic);
const applyBodyColor = () => {
const [r, g, b] = options.bodyColor;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyBodyMat = () => {
bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);
bodyMaterial.roughness = options.bodyMat.roughness;
bodyMaterial.metallic = options.bodyMat.metallic;
};
applyBodyColor();
applyBodyMat();
const ropeMaterial = model.findMaterial('__X_ROPE__');
console.log(id, ropeMaterial.roughness, ropeMaterial.metallic);
const applyRopeColor = () => {
const [r, g, b] = options.ropeColor;
ropeMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyRopeMat = () => {
ropeMaterial.albedoColor = new BABYLON.Color3(options.ropeMat.color[0], options.ropeMat.color[1], options.ropeMat.color[2]);
ropeMaterial.roughness = options.ropeMat.roughness;
ropeMaterial.metallic = options.ropeMat.metallic;
};
applyRopeColor();
applyRopeMat();
return {
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'bodyColor': applyBodyColor(); break;
case 'ropeColor': applyRopeColor(); break;
case 'bodyMat': applyBodyMat(); break;
case 'ropeMat': applyRopeMat(); break;
}
},
interactions: {},

View file

@ -12,13 +12,13 @@ export const steelRack = defineObject({
name: 'steelRack',
options: {
schema: {
shelfColor: {
type: 'color',
label: 'Shelf color',
shelfMat: {
type: 'material',
label: 'Shelf material',
},
poleColor: {
type: 'color',
label: 'Pole color',
poleMat: {
type: 'material',
label: 'Pole material',
},
widthAndDepthVariation: {
type: 'enum',
@ -117,8 +117,8 @@ export const steelRack = defineObject({
},
},
default: {
shelfColor: [0.8, 0.8, 0.8],
poleColor: [0.8, 0.8, 0.8],
shelfMat: { color: [0.8, 0.8, 0.8], roughness: 0.25, metallic: 0.9 },
poleMat: { color: [0.8, 0.8, 0.8], roughness: 0.25, metallic: 0.9 },
widthAndDepthVariation: '60-35',
height: 5,
numberOfShelfs: 5,
@ -204,24 +204,26 @@ export const steelRack = defineObject({
const shelfMaterial = model.findMaterial('__X_SHELF__');
const poleMaterial = model.findMaterial('__X_POLE__');
const applyShelfColor = () => {
const [r, g, b] = options.shelfColor;
shelfMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyShelfMat = () => {
shelfMaterial.albedoColor = new BABYLON.Color3(options.shelfMat.color[0], options.shelfMat.color[1], options.shelfMat.color[2]);
shelfMaterial.roughness = options.shelfMat.roughness;
shelfMaterial.metallic = options.shelfMat.metallic;
};
const applyPoleColor = () => {
const [r, g, b] = options.poleColor;
poleMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyPoleMat = () => {
poleMaterial.albedoColor = new BABYLON.Color3(options.poleMat.color[0], options.poleMat.color[1], options.poleMat.color[2]);
poleMaterial.roughness = options.poleMat.roughness;
poleMaterial.metallic = options.poleMat.metallic;
};
applyShelfColor();
applyPoleColor();
applyShelfMat();
applyPoleMat();
return {
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'shelfColor': applyShelfColor(); break;
case 'poleColor': applyPoleColor(); break;
case 'shelfMat': applyShelfMat(); break;
case 'poleMat': applyPoleMat(); break;
case 'widthAndDepthVariation': reloadModel(); break;
case 'height': applyHeight(); break;
case 'numberOfShelfs': applyNumberOfShelfs(); break;

View file

@ -12,9 +12,9 @@ export const tabletopDigitalClock = defineObject({
name: 'Tabletop Digital Clock',
options: {
schema: {
bodyColor: {
type: 'color',
label: 'Body Color',
bodyMat: {
type: 'material',
label: 'Body Material',
},
lcdColor: {
type: 'color',
@ -22,7 +22,7 @@ export const tabletopDigitalClock = defineObject({
},
},
default: {
bodyColor: [0.45, 0.8, 0],
bodyMat: { color: [0.45, 0.8, 0], roughness: 0.2, metallic: 0 },
lcdColor: [1, 1, 1],
},
},
@ -80,9 +80,10 @@ export const tabletopDigitalClock = defineObject({
const bodyMesh = model.findMesh('__X_BODY__');
const bodyMaterial = bodyMesh.material as BABYLON.PBRMaterial;
const applyBodyColor = () => {
const [r, g, b] = options.bodyColor;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyBodyMat = () => {
bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);
bodyMaterial.roughness = options.bodyMat.roughness;
bodyMaterial.metallic = options.bodyMat.metallic;
};
const applyLcdColor = () => {
@ -94,7 +95,7 @@ export const tabletopDigitalClock = defineObject({
return {
onInited: () => {
applyBodyColor();
applyBodyMat();
applyLcdColor();
// TODO: 家具が撤去された後も呼ばれ続けるのをどうにかする
@ -118,7 +119,7 @@ export const tabletopDigitalClock = defineObject({
},
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'bodyColor': applyBodyColor(); break;
case 'bodyMat': applyBodyMat(); break;
case 'lcdColor': applyLcdColor(); break;
}
},

View file

@ -11,13 +11,13 @@ export const tabletopIronFrameStand = defineObject({
name: 'tabletopIronFrameStand',
options: {
schema: {
frameColor: {
type: 'color',
label: 'Frame color',
frameMat: {
type: 'material',
label: 'Frame material',
},
boardColor: {
type: 'color',
label: 'Board color',
boardMat: {
type: 'material',
label: 'Board material',
},
width: {
type: 'range',
@ -42,8 +42,8 @@ export const tabletopIronFrameStand = defineObject({
},
},
default: {
frameColor: [0.8, 0.8, 0.8],
boardColor: [0.8, 0.4, 0.1],
frameMat: { color: [0.8, 0.8, 0.8], roughness: 0.3, metallic: 1 },
boardMat: { color: [0.8, 0.4, 0.1], roughness: 0.6, metallic: 0 },
width: 0.2,
depth: 0.1,
height: 0.05,
@ -55,19 +55,21 @@ export const tabletopIronFrameStand = defineObject({
const frameMaterial = model.findMaterial('__X_FRAME__');
const boardMaterial = model.findMaterial('__X_BOARD__');
const applyFrameColor = () => {
const [r, g, b] = options.frameColor;
frameMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyFrameMat = () => {
frameMaterial.albedoColor = new BABYLON.Color3(options.frameMat.color[0], options.frameMat.color[1], options.frameMat.color[2]);
frameMaterial.roughness = options.frameMat.roughness;
frameMaterial.metallic = options.frameMat.metallic;
};
applyFrameColor();
applyFrameMat();
const applyBoardColor = () => {
const [r, g, b] = options.boardColor;
boardMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyBoardMat = () => {
boardMaterial.albedoColor = new BABYLON.Color3(options.boardMat.color[0], options.boardMat.color[1], options.boardMat.color[2]);
boardMaterial.roughness = options.boardMat.roughness;
boardMaterial.metallic = options.boardMat.metallic;
};
applyBoardColor();
applyBoardMat();
const applySize = () => {
for (const mesh of model.root.getChildMeshes()) {
@ -89,8 +91,8 @@ export const tabletopIronFrameStand = defineObject({
return {
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'frameColor': applyFrameColor(); break;
case 'boardColor': applyBoardColor(); break;
case 'frameMat': applyFrameMat(); break;
case 'boardMat': applyBoardMat(); break;
case 'width': applySize(); break;
case 'depth': applySize(); break;
case 'height': applySize(); break;

View file

@ -12,9 +12,9 @@ export const tabletopLcdButtonsController = defineObject({
name: 'tabletopLcdButtonsController',
options: {
schema: {
bodyColor: {
type: 'color',
label: 'Body color',
bodyMat: {
type: 'material',
label: 'Body material',
},
screenBrightness: {
type: 'range',
@ -30,7 +30,7 @@ export const tabletopLcdButtonsController = defineObject({
},
},
default: {
bodyColor: [0.05, 0.05, 0.05],
bodyMat: { color: [0.05, 0.05, 0.05], roughness: 0.5, metallic: 0.3 },
screenBrightness: 0.5,
image: { type: null },
},
@ -48,12 +48,13 @@ export const tabletopLcdButtonsController = defineObject({
const textureManager = createTextureManager(screenMesh, () => 9.5 / 5.55, scene);
const applyBodyColor = () => {
const [r, g, b] = options.bodyColor;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyBodyMat = () => {
bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);
bodyMaterial.roughness = options.bodyMat.roughness;
bodyMaterial.metallic = options.bodyMat.metallic;
};
applyBodyColor();
applyBodyMat();
const applyImage = () => {
screenMaterial.unfreeze();
@ -78,7 +79,7 @@ export const tabletopLcdButtonsController = defineObject({
return {
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'bodyColor': applyBodyColor(); break;
case 'bodyMat': applyBodyMat(); break;
case 'screenBrightness': applyScreenBrightness(); break;
case 'image': applyImage(); break;
}

View file

@ -14,9 +14,9 @@ export const tabletopPictureFrame = defineObject({
name: 'Tabletop simple picture frame',
options: {
schema: {
frameColor: {
type: 'color',
label: 'Frame color',
frameMat: {
type: 'material',
label: 'Frame material',
},
width: {
type: 'range',
@ -67,7 +67,7 @@ export const tabletopPictureFrame = defineObject({
},
},
default: {
frameColor: [0.71, 0.58, 0.39],
frameMat: { color: [0.71, 0.58, 0.39], roughness: 0.5, metallic: 0 },
width: 0.07,
height: 0.07,
frameThickness: 0.1,
@ -162,12 +162,13 @@ export const tabletopPictureFrame = defineObject({
const frameMaterial = model.findMaterial('__X_FRAME__');
const applyFrameColor = () => {
const [r, g, b] = options.frameColor;
frameMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyFrameMat = () => {
frameMaterial.albedoColor = new BABYLON.Color3(options.frameMat.color[0], options.frameMat.color[1], options.frameMat.color[2]);
frameMaterial.roughness = options.frameMat.roughness;
frameMaterial.metallic = options.frameMat.metallic;
};
applyFrameColor();
applyFrameMat();
return {
onInited: () => {
@ -175,7 +176,7 @@ export const tabletopPictureFrame = defineObject({
},
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'frameColor': applyFrameColor(); break;
case 'frameMat': applyFrameMat(); break;
case 'width':
case 'height': applySize(); break;
case 'frameThickness': applyFrameThickness(); break;

View file

@ -13,9 +13,9 @@ export const tv = defineObject({
name: 'TV',
options: {
schema: {
bodyColor: {
type: 'color',
label: 'Body color',
bodyMat: {
type: 'material',
label: 'Body material',
},
screenBrightness: {
type: 'range',
@ -26,7 +26,7 @@ export const tv = defineObject({
},
},
default: {
bodyColor: [0, 0, 0],
bodyMat: { color: [0, 0, 0], roughness: 0.3, metallic: 0.5 },
screenBrightness: 0.5,
},
},
@ -81,17 +81,18 @@ export const tv = defineObject({
const bodyMaterial = model.findMaterial('__X_BODY__');
const applyBodyColor = () => {
const [r, g, b] = options.bodyColor;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyBodyMat = () => {
bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);
bodyMaterial.roughness = options.bodyMat.roughness;
bodyMaterial.metallic = options.bodyMat.metallic;
};
applyBodyColor();
applyBodyMat();
return {
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'bodyColor': applyBodyColor(); break;
case 'bodyMat': applyBodyMat(); break;
case 'screenBrightness': applyScreenBrightness(); break;
}
},

View file

@ -11,13 +11,13 @@ export const wallClock = defineObject({
name: 'Wall Clock',
options: {
schema: {
frameColor: {
type: 'color',
label: 'Frame color',
frameMat: {
type: 'material',
label: 'Frame material',
},
},
default: {
frameColor: [0.71, 0.58, 0.39],
frameMat: { color: [0.71, 0.58, 0.39], roughness: 0.75, metallic: 0 },
},
},
placement: 'side',
@ -28,12 +28,13 @@ export const wallClock = defineObject({
const frameMaterial = model.findMaterial('__X_FRAME__');
const applyFrameColor = () => {
const [r, g, b] = options.frameColor;
frameMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyFrameMat = () => {
frameMaterial.albedoColor = new BABYLON.Color3(options.frameMat.color[0], options.frameMat.color[1], options.frameMat.color[2]);
frameMaterial.roughness = options.frameMat.roughness;
frameMaterial.metallic = options.frameMat.metallic;
};
applyFrameColor();
applyFrameMat();
model.bakeExcludeMeshes = [hourHand, minuteHand];
@ -52,7 +53,7 @@ export const wallClock = defineObject({
}, 1000);
},
onOptionsUpdated: ([k, v]) => {
applyFrameColor();
applyFrameMat();
},
interactions: {},
dispose: () => {},

View file

@ -32,16 +32,16 @@ export const wallMirror = defineObject({
max: 1,
step: 0.01,
},
frameColor: {
type: 'color',
label: 'Frame color',
frameMat: {
type: 'material',
label: 'Frame material',
},
},
default: {
width: 0.2,
height: 0.2,
frameThickness: 0.1,
frameColor: [0.8, 0.28, 0.06],
frameMat: { color: [0.8, 0.28, 0.06], roughness: 0.5, metallic: 0 },
},
},
placement: 'side',
@ -62,11 +62,13 @@ export const wallMirror = defineObject({
applySize();
const applyFrameColor = () => {
frameMaterial.albedoColor = new BABYLON.Color3(...options.frameColor);
const applyFrameMat = () => {
frameMaterial.albedoColor = new BABYLON.Color3(options.frameMat.color[0], options.frameMat.color[1], options.frameMat.color[2]);
frameMaterial.roughness = options.frameMat.roughness;
frameMaterial.metallic = options.frameMat.metallic;
};
applyFrameColor();
applyFrameMat();
return {
onInited: () => {
@ -79,8 +81,8 @@ export const wallMirror = defineObject({
case 'frameThickness':
applySize();
break;
case 'frameColor':
applyFrameColor();
case 'frameMat':
applyFrameMat();
break;
}
},

View file

@ -13,9 +13,9 @@ export const wallMountSpotLight = defineObject({
name: 'wallMountSpotLight',
options: {
schema: {
bodyColor: {
type: 'color',
label: 'Body color',
bodyMat: {
type: 'material',
label: 'Body material',
},
light: {
type: 'light',
@ -37,7 +37,7 @@ export const wallMountSpotLight = defineObject({
},
},
default: {
bodyColor: [0.05, 0.05, 0.05],
bodyMat: { color: [0.05, 0.05, 0.05], roughness: 0.5, metallic: 0 },
light: {
color: [1, 0.5, 0.2],
brightness: 0.5,
@ -54,12 +54,13 @@ export const wallMountSpotLight = defineObject({
const bodyMesh = model.findMesh('__X_BODY__');
const bodyMaterial = model.findMaterial('__X_BODY__');
const applyBodyColor = () => {
const [r, g, b] = options.bodyColor;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyBodyMat = () => {
bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);
bodyMaterial.roughness = options.bodyMat.roughness;
bodyMaterial.metallic = options.bodyMat.metallic;
};
applyBodyColor();
applyBodyMat();
const lamp = model.findMesh('__X_LAMP__');
const light = new BABYLON.SpotLight('', new BABYLON.Vector3(cm(0), cm(0), 0), new BABYLON.Vector3(0, -1, 0), Math.PI / 1, 2, scene, lc != null);
@ -92,7 +93,7 @@ export const wallMountSpotLight = defineObject({
return {
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'bodyColor': applyBodyColor(); break;
case 'bodyMat': applyBodyMat(); break;
case 'light': applyLight(); break;
case 'angleV':
case 'angleH':

View file

@ -39,15 +39,15 @@ export const wallShelf = defineObject({
value: 'color',
}],
},
boardColor: {
type: 'color',
label: 'Board color',
boardMat: {
type: 'material',
label: 'Board material',
},
},
default: {
style: 'A',
boardStyle: 'wood',
boardColor: [1, 1, 1],
boardMat: { color: [1, 1, 1], roughness: 0.5, metallic: 0 },
},
},
placement: 'side',
@ -80,9 +80,10 @@ export const wallShelf = defineObject({
const bodyMaterial = bodyMesh.material as BABYLON.PBRMaterial;
const bodyTexture = bodyMaterial.albedoTexture as BABYLON.Texture;
const applyBoardColor = () => {
const [r, g, b] = options.boardColor;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyBoardMat = () => {
bodyMaterial.albedoColor = new BABYLON.Color3(options.boardMat.color[0], options.boardMat.color[1], options.boardMat.color[2]);
bodyMaterial.roughness = options.boardMat.roughness;
bodyMaterial.metallic = options.boardMat.metallic;
if (options.boardStyle === 'color') {
bodyMaterial.albedoTexture = null;
@ -91,14 +92,14 @@ export const wallShelf = defineObject({
}
};
applyBoardColor();
applyBoardMat();
return {
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'style': applyStyle(); break;
case 'boardStyle':
case 'boardColor': applyBoardColor(); break;
case 'boardMat': applyBoardMat(); break;
}
},
interactions: {},

View file

@ -11,32 +11,34 @@ export const wireBasket = defineObject({
name: 'wireBasket',
options: {
schema: {
bodyColor: {
type: 'color',
label: 'bodyColor',
bodyMat: {
type: 'material',
label: 'bodyMaterial',
},
},
default: {
bodyColor: [0.03, 0.03, 0.03],
bodyMat: { color: [0.03, 0.03, 0.03], roughness: -1, metallic: -1 },
},
},
placement: 'side',
hasCollisions: false,
canPreMeshesMerging: true,
hasTexture: false,
createInstance: ({ options, model }) => {
createInstance: ({ options, model, id }) => {
const bodyMaterial = model.findMaterial('__X_BODY__');
console.log(id, bodyMaterial.roughness, bodyMaterial.metallic);
const applyBodyColor = () => {
const [r, g, b] = options.bodyColor;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyBodyMat = () => {
bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);
bodyMaterial.roughness = options.bodyMat.roughness;
bodyMaterial.metallic = options.bodyMat.metallic;
};
applyBodyColor();
applyBodyMat();
return {
onOptionsUpdated: ([k, v]) => {
applyBodyColor();
applyBodyMat();
},
interactions: {},
dispose: () => {},

View file

@ -11,32 +11,34 @@ export const wireNet = defineObject({
name: 'wireNet',
options: {
schema: {
bodyColor: {
type: 'color',
label: 'bodyColor',
bodyMat: {
type: 'material',
label: 'bodyMaterial',
},
},
default: {
bodyColor: [0.03, 0.03, 0.03],
bodyMat: { color: [0.03, 0.03, 0.03], roughness: -1, metallic: -1 },
},
},
placement: 'side',
hasCollisions: false,
canPreMeshesMerging: true,
hasTexture: false,
createInstance: ({ options, model }) => {
createInstance: ({ options, model, id }) => {
const bodyMaterial = model.findMaterial('__X_BODY__');
console.log(id, bodyMaterial.roughness, bodyMaterial.metallic);
const applyBodyColor = () => {
const [r, g, b] = options.bodyColor;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
const applyBodyMat = () => {
bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);
bodyMaterial.roughness = options.bodyMat.roughness;
bodyMaterial.metallic = options.bodyMat.metallic;
};
applyBodyColor();
applyBodyMat();
return {
onOptionsUpdated: ([k, v]) => {
applyBodyColor();
applyBodyMat();
},
interactions: {},
dispose: () => {},

View file

@ -41,23 +41,23 @@ export const woodRingFloorLamp = defineObject({
createInstance: ({ lc, scene, options, model, graphicsQuality }) => {
const shadeMaterial = model.findMaterial('__X_SHADE__');
const applyShadeColor = () => {
const applyShadeMat = () => {
shadeMaterial.albedoColor = new BABYLON.Color3(options.shadeMat.color[0], options.shadeMat.color[1], options.shadeMat.color[2]);
shadeMaterial.metallic = options.shadeMat.metallic;
shadeMaterial.roughness = options.shadeMat.roughness;
};
applyShadeColor();
applyShadeMat();
const bodyMaterial = model.findMaterial('__X_BODY__');
const applyBodyColor = () => {
const applyBodyMat = () => {
bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);
bodyMaterial.metallic = options.bodyMat.metallic;
bodyMaterial.roughness = options.bodyMat.roughness;
};
applyBodyColor();
applyBodyMat();
const lamps = model.findMeshes('__X_LAMP__');
const lights: BABYLON.SpotLight[] = [];
@ -86,8 +86,8 @@ export const woodRingFloorLamp = defineObject({
return {
onOptionsUpdated: ([k, v]) => {
switch (k) {
case 'shadeMat': applyShadeColor(); break;
case 'bodyMat': applyBodyColor(); break;
case 'shadeMat': applyShadeMat(); break;
case 'bodyMat': applyBodyMat(); break;
case 'light': applyLight(); break;
}
},

View file

@ -34,8 +34,8 @@ export const woodRingsPendantLight = defineObject({
},
},
default: {
shadeMat: { color: [0.21, 0.04, 0], roughness: -1, metallic: -1 },
bodyMat: { color: [0.05, 0.05, 0.05], roughness: -1, metallic: -1 },
shadeMat: { color: [0.21, 0.04, 0], roughness: 0.5, metallic: 0 },
bodyMat: { color: [0.05, 0.05, 0.05], roughness: 0.5, metallic: 1 },
light: {
color: [1, 0.5, 0.2],
brightness: 0.5,
@ -47,7 +47,6 @@ export const woodRingsPendantLight = defineObject({
hasCollisions: false,
createInstance: ({ lc, scene, options, model, graphicsQuality }) => {
const shadeMaterial = model.findMaterial('__X_SHADE__');
console.log('woodRingsPendantLight', shadeMaterial.roughness, shadeMaterial.metallic);
const applyShadeMat = () => {
shadeMaterial.albedoColor = new BABYLON.Color3(options.shadeMat.color[0], options.shadeMat.color[1], options.shadeMat.color[2]);
@ -58,7 +57,6 @@ export const woodRingsPendantLight = defineObject({
applyShadeMat();
const bodyMaterial = model.findMaterial('__X_BODY__');
console.log('woodRingsPendantLight', bodyMaterial.roughness, bodyMaterial.metallic);
const applyBodyMat = () => {
bodyMaterial.albedoColor = new BABYLON.Color3(options.bodyMat.color[0], options.bodyMat.color[1], options.bodyMat.color[2]);