Skip to content

Commit 5544faf

Browse files
author
PARTLYDECENT
committed
Refine industrial aesthetics, optimize hive spawning, and enhance performance with GPU-based animations
1 parent 10c5361 commit 5544faf

8 files changed

Lines changed: 708 additions & 549 deletions

File tree

beta1/projectescapism.html/CampaignMap.js

Lines changed: 335 additions & 335 deletions
Large diffs are not rendered by default.

beta1/projectescapism.html/Pistol.js

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,29 @@ class Pistol extends THREE.Group {
1919
this.tracers = [];
2020

2121
// Materials
22-
this.polyMat = new THREE.MeshStandardMaterial({ color: 0x1e293b, roughness: 0.8, metalness: 0.2 });
23-
this.metalMat = new THREE.MeshStandardMaterial({ color: 0x334155, roughness: 0.4, metalness: 0.7 });
22+
const loader = new THREE.TextureLoader();
23+
const gunTex = loader.load('./assets/tactical_texture.png');
24+
gunTex.wrapS = gunTex.wrapT = THREE.RepeatWrapping;
25+
gunTex.repeat.set(2, 2);
26+
27+
this.polyMat = new THREE.MeshStandardMaterial({
28+
color: 0x1e293b,
29+
map: gunTex,
30+
roughness: 0.6,
31+
metalness: 0.4,
32+
emissive: 0xff0000,
33+
emissiveMap: gunTex,
34+
emissiveIntensity: 0.4
35+
});
36+
this.metalMat = new THREE.MeshStandardMaterial({
37+
color: 0x334155,
38+
map: gunTex,
39+
roughness: 0.3,
40+
metalness: 0.85,
41+
emissive: 0xff0000,
42+
emissiveMap: gunTex,
43+
emissiveIntensity: 0.7
44+
});
2445
this.barrelMat = new THREE.MeshStandardMaterial({ color: 0x475569, roughness: 0.3, metalness: 0.9 });
2546
this.brassMat = new THREE.MeshStandardMaterial({ color: 0xb5943b, metalness: 0.8, roughness: 0.2 });
2647
this.dotMat = new THREE.MeshBasicMaterial({ color: 0x00ff00 });
@@ -33,16 +54,16 @@ class Pistol extends THREE.Group {
3354
const frameGroup = new THREE.Group();
3455
this.add(frameGroup);
3556

36-
const gripGeo = new THREE.BoxGeometry(0.3, 1.2, 0.5);
57+
const gripGeo = new THREE.BoxGeometry(0.18, 1.2, 0.5);
3758
const grip = new THREE.Mesh(gripGeo, this.polyMat);
3859
grip.position.set(0, -0.6, 0.2);
3960
grip.rotation.x = Math.PI * 0.1;
4061
grip.castShadow = true;
4162
frameGroup.add(grip);
4263

43-
const receiverGeo = new THREE.BoxGeometry(0.32, 0.25, 1.6);
64+
const receiverGeo = new THREE.BoxGeometry(0.2, 0.25, 1.7);
4465
const receiver = new THREE.Mesh(receiverGeo, this.polyMat);
45-
receiver.position.set(0, 0.1, -0.2);
66+
receiver.position.set(0, 0.1, -0.25);
4667
receiver.castShadow = true;
4768
frameGroup.add(receiver);
4869

@@ -56,30 +77,30 @@ class Pistol extends THREE.Group {
5677
this.triggerMesh.position.set(0, -0.1, -0.35);
5778
frameGroup.add(this.triggerMesh);
5879

59-
const barrelGeo = new THREE.CylinderGeometry(0.08, 0.08, 1.6, 16);
80+
const barrelGeo = new THREE.CylinderGeometry(0.05, 0.05, 1.7, 16);
6081
const barrel = new THREE.Mesh(barrelGeo, this.barrelMat);
6182
barrel.rotation.x = Math.PI / 2;
62-
barrel.position.set(0, 0.35, -0.2);
83+
barrel.position.set(0, 0.35, -0.25);
6384
frameGroup.add(barrel);
6485

6586
// --- B. Upper Slide (Blowback) ---
6687
this.slideGroup = new THREE.Group();
6788
this.add(this.slideGroup);
6889

69-
const slideTop = new THREE.Mesh(new THREE.BoxGeometry(0.34, 0.08, 1.6), this.metalMat);
70-
slideTop.position.set(0, 0.5, -0.2);
90+
const slideTop = new THREE.Mesh(new THREE.BoxGeometry(0.22, 0.08, 1.7), this.metalMat);
91+
slideTop.position.set(0, 0.5, -0.25);
7192
this.slideGroup.add(slideTop);
7293

73-
const slideLeft = new THREE.Mesh(new THREE.BoxGeometry(0.05, 0.25, 1.6), this.metalMat);
74-
slideLeft.position.set(-0.145, 0.35, -0.2);
94+
const slideLeft = new THREE.Mesh(new THREE.BoxGeometry(0.03, 0.25, 1.7), this.metalMat);
95+
slideLeft.position.set(-0.095, 0.35, -0.25);
7596
this.slideGroup.add(slideLeft);
7697

77-
const slideRightFront = new THREE.Mesh(new THREE.BoxGeometry(0.05, 0.25, 0.8), this.metalMat);
78-
slideRightFront.position.set(0.145, 0.35, -0.6);
98+
const slideRightFront = new THREE.Mesh(new THREE.BoxGeometry(0.03, 0.25, 0.9), this.metalMat);
99+
slideRightFront.position.set(0.095, 0.35, -0.65);
79100
this.slideGroup.add(slideRightFront);
80101

81-
const slideRightBack = new THREE.Mesh(new THREE.BoxGeometry(0.05, 0.25, 0.5), this.metalMat);
82-
slideRightBack.position.set(0.145, 0.35, 0.35);
102+
const slideRightBack = new THREE.Mesh(new THREE.BoxGeometry(0.03, 0.25, 0.5), this.metalMat);
103+
slideRightBack.position.set(0.095, 0.35, 0.35);
83104
this.slideGroup.add(slideRightBack);
84105

85106
// Lights / Sights
@@ -99,7 +120,7 @@ class Pistol extends THREE.Group {
99120
new THREE.BoxGeometry(0.01, 0.08, 0.04),
100121
this.polyMat
101122
);
102-
ridge.position.set(0.16 * side, -0.35 - i * 0.09, 0.2);
123+
ridge.position.set(0.1 * side, -0.35 - i * 0.09, 0.2);
103124
ridge.rotation.x = Math.PI * 0.1;
104125
frameGroup.add(ridge);
105126
}
@@ -128,7 +149,7 @@ class Pistol extends THREE.Group {
128149
new THREE.BoxGeometry(0.04, 0.06, 0.04),
129150
this.metalMat
130151
);
131-
magRelease.position.set(0.16, -0.15, 0.05);
152+
magRelease.position.set(0.1, -0.15, 0.05);
132153
frameGroup.add(magRelease);
133154

134155
// === ACCESSORY RAIL (Under barrel) ===
1.16 MB
Loading

beta1/projectescapism.html/facilities.js

Lines changed: 64 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ const FacilityGen = {
55
wallGeo: null, wallMat: null,
66
floorGeo: null, floorMat: null,
77
pillarGeo: null, pillarMat: null,
8-
9-
init: function(config) {
8+
9+
init: function (config) {
1010
// High-Tech Cyberpunk Walls
1111
this.wallGeo = new THREE.BoxGeometry(config.cellSize, config.cellSize * 1.5, config.cellSize);
1212
this.wallMat = new THREE.MeshStandardMaterial({ color: 0x1e293b, roughness: 0.6, metalness: 0.8, emissive: 0x00ffff, emissiveIntensity: 0.0 });
@@ -54,7 +54,7 @@ const FacilityGen = {
5454
`
5555
);
5656
};
57-
57+
5858
// High-Tech Hex Floor
5959
this.floorGeo = new THREE.PlaneGeometry(config.cellSize, config.cellSize);
6060
this.floorGeo.rotateX(-Math.PI / 2);
@@ -111,46 +111,93 @@ const FacilityGen = {
111111
`
112112
);
113113
};
114-
115114
// Pillars for corners and supports
116115
this.pillarGeo = new THREE.CylinderGeometry(config.cellSize * 0.25, config.cellSize * 0.35, config.cellSize * 1.8, 8);
117116
this.pillarGeo.translate(0, config.cellSize * 0.9, 0); // anchor to bottom
118117
this.pillarMat = new THREE.MeshStandardMaterial({ color: 0x0f172a, roughness: 0.5, metalness: 0.9, emissive: 0xff8800, emissiveIntensity: 0.0 });
119118
this.pillarMat.onBeforeCompile = (shader) => {
120-
shader.uniforms.uTime = { value: 0 };
121-
this.pillarMat.userData.shader = shader;
122-
shader.vertexShader = `
119+
shader.uniforms.uTime = { value: 0 };
120+
this.pillarMat.userData.shader = shader;
121+
shader.vertexShader = `
123122
varying vec3 vLocalPosOut;
124123
` + shader.vertexShader;
125-
shader.vertexShader = shader.vertexShader.replace(
124+
shader.vertexShader = shader.vertexShader.replace(
126125
`#include <begin_vertex>`,
127126
`#include <begin_vertex>
128127
vLocalPosOut = position;
129128
`
130-
);
131-
shader.fragmentShader = `
129+
);
130+
shader.fragmentShader = `
132131
uniform float uTime;
133132
varying vec3 vLocalPosOut;
134133
` + shader.fragmentShader;
135-
shader.fragmentShader = shader.fragmentShader.replace(
134+
shader.fragmentShader = shader.fragmentShader.replace(
136135
`#include <emissivemap_fragment>`,
137136
`#include <emissivemap_fragment>
138137
float orangePulse = 0.0; // Static for performance
139138
totalEmissiveRadiance = vec3(1.0, 0.5, 0.0) * orangePulse * 3.0;
140139
`
141-
);
140+
);
142141
};
142+
143+
// Industrial Pipes
144+
this.pipeGeo = new THREE.CylinderGeometry(0.12, 0.12, 1.0, 8);
145+
this.pipeMat = new THREE.MeshStandardMaterial({ color: 0x334155, roughness: 0.4, metalness: 0.85 });
146+
this.pipeMat.onBeforeCompile = (shader) => {
147+
shader.vertexShader = `varying vec3 vWorldPos;` + shader.vertexShader;
148+
shader.vertexShader = shader.vertexShader.replace(`#include <worldpos_vertex>`, `#include <worldpos_vertex>\nvWorldPos = worldPosition.xyz;`);
149+
shader.fragmentShader = `varying vec3 vWorldPos;` + shader.fragmentShader;
150+
shader.fragmentShader = shader.fragmentShader.replace(`#include <color_fragment>`, `#include <color_fragment>\nfloat stripe = step(0.9, fract(vWorldPos.x * 2.0 + vWorldPos.z * 2.0 + vWorldPos.y * 2.0));\ndiffuseColor.rgb = mix(diffuseColor.rgb, vec3(0.1, 0.12, 0.15), stripe * 0.5);`);
151+
};
152+
153+
// Steam Vents
154+
this.steamGeo = new THREE.CylinderGeometry(0.02, 0.6, 2.5, 8, 4, true);
155+
this.steamGeo.translate(0, 1.25, 0);
156+
this.steamMat = new THREE.ShaderMaterial({
157+
uniforms: { uTime: { value: 0 } },
158+
vertexShader: `
159+
varying vec2 vUv;
160+
varying float vY;
161+
uniform float uTime;
162+
void main() {
163+
vUv = uv;
164+
vY = position.y;
165+
vec3 pos = position;
166+
float offset = sin(uTime * 3.0 + vY * 2.0) * 0.15 * (vY / 2.5);
167+
pos.x += offset;
168+
pos.z += cos(uTime * 2.5 + vY * 1.5) * 0.1 * (vY / 2.5);
169+
gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);
170+
}
171+
`,
172+
fragmentShader: `
173+
varying vec2 vUv;
174+
varying float vY;
175+
uniform float uTime;
176+
float noise(vec2 p) { return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453); }
177+
void main() {
178+
float fade = smoothstep(0.0, 0.8, vY) * smoothstep(2.5, 1.2, vY);
179+
float n = noise(vUv * 5.0 + vec2(0.0, uTime * 1.2));
180+
gl_FragColor = vec4(0.9, 0.95, 1.0, fade * (0.2 + n * 0.3));
181+
}
182+
`,
183+
transparent: true,
184+
depthWrite: false,
185+
side: THREE.DoubleSide
186+
});
143187
},
144-
145-
update: function(delta) {
146-
if(this.wallMat && this.wallMat.userData && this.wallMat.userData.shader && this.wallMat.userData.shader.uniforms.uTime) {
188+
189+
update: function (delta) {
190+
if (this.wallMat && this.wallMat.userData && this.wallMat.userData.shader) {
147191
this.wallMat.userData.shader.uniforms.uTime.value += delta;
148192
}
149-
if(this.floorMat && this.floorMat.userData && this.floorMat.userData.shader && this.floorMat.userData.shader.uniforms.uTime) {
193+
if (this.floorMat && this.floorMat.userData && this.floorMat.userData.shader) {
150194
this.floorMat.userData.shader.uniforms.uTime.value += delta;
151195
}
152-
if(this.pillarMat && this.pillarMat.userData && this.pillarMat.userData.shader && this.pillarMat.userData.shader.uniforms.uTime) {
196+
if (this.pillarMat && this.pillarMat.userData && this.pillarMat.userData.shader) {
153197
this.pillarMat.userData.shader.uniforms.uTime.value += delta;
154198
}
199+
if (this.steamMat) {
200+
this.steamMat.uniforms.uTime.value += delta;
201+
}
155202
}
156203
};

0 commit comments

Comments
 (0)