Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 4 additions & 28 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"screenfull": "^6.0.2",
"sveltekit-superforms": "^2.25.0",
"three": "^0.176.0",
"three-custom-shader-material": "^5.4.0",
"three-custom-shader-material": "^6.3.7",
"ua-parser-js": "1.0.40",
"zod": "^3.25.20"
},
Expand Down
34 changes: 21 additions & 13 deletions src/lib/assets/shaders/building/building.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9,50 +9,58 @@ varying vec4 vPosition;
varying vec2 vUv;

void main() {
vec4 color = texture2D(lutTexture, vec2(vUv.x, 1.0 - vUv.y));
vec4 color = vec4(1.0, 1.0, 1.0, 1.0);
vec4 layerColor = vec4(vec3(vPosition.y * 0.3 + 0.15), 1.0);
int xIndex = int(vUv.x * 16.0);
int yIndex = int(vUv.y * 16.0);

// Accent (orange)
if (xIndex == 1) {
if(xIndex == 1) {
color = vec4(accentColor, 1.0);
}
// Emissive
if (xIndex == 2) {
if (yIndex == 1) {
color = vec4(emissive1Color,1.0);
if(xIndex == 2) {
if(yIndex == 1) {
color = vec4(emissive1Color, 1.0);
}
if (yIndex == 2) {
color = vec4(emissive2Color,1.0);
if(yIndex == 2) {
color = vec4(emissive2Color, 1.0);
}
// csm_Emissive = color.xyz;
}
// Metal brushed
if (xIndex == 3) {
if(xIndex == 3) {
csm_Roughness = 0.5;
csm_Metalness = 0.5;
}
// Metal noise
if (xIndex == 4) {
if(xIndex == 4) {
csm_Roughness = 0.5;
csm_Metalness = 0.5;
}
// Metal coated
if (xIndex == 5) {
if(xIndex == 5) {
if(yIndex == 6) {
color = vec4(0.2, 0.2, 0.2, 1.0);
}
if(yIndex == 13) {
color = vec4(0.1,0.6,0.3,1.0);
}

csm_Roughness = 0.7;
csm_Metalness = 0.9;
}
// Plastic
if (xIndex == 6) {
if (yIndex ==1) {
if(xIndex == 6) {
if(yIndex == 12) {
color = layerColor;
}

csm_Roughness = 0.3;
csm_Metalness = 0.2;
}
// Belt Rubber
if (xIndex == 7) {
if(xIndex == 7) {
color = layerColor;
}

Expand Down
15 changes: 6 additions & 9 deletions src/lib/components/blueprint/BlueprintBuilding.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,11 @@
baseMaterial: MeshStandardMaterial,
vertexShader: BUILDING_VERTEXSHADER,
fragmentShader: BUILDING_FRAGMENTSHADER,
uniforms: UniformsUtils.merge([
{
accentColor: { value: new Color(0xff9421) },
emissive1Color: { value: new Color(0xf3b026) },
emissive2Color: { value: new Color(0x576fd4) },
},
]),
silent: true,
uniforms: {
accentColor: { value: new Color(0xff9421) },
emissive1Color: { value: new Color(0xf3b026) },
emissive2Color: { value: new Color(0x576fd4) },
},
});
const BUILDING_MATERIAL_GLASS = new MeshStandardMaterial({
color: 0xdddddd,
Expand Down Expand Up @@ -132,7 +129,7 @@
if (array.length > 8) {
const scale = (1 / array.length) * 8;
letter.translateX(index * scale * LETTER_SPACING * -1);
letter.scale.set(scale, scale, 1);
letter.scale.set(scale, 1, scale);
} else {
letter.translateX(index * LETTER_SPACING * -1);
}
Expand Down