CREATORJD commited on
Commit
be48ff4
·
verified ·
1 Parent(s): e36d5eb

1.33.11 worldbuilding: skylines, mountains, terrain detail

Browse files
Files changed (1) hide show
  1. src/ui/render3d.js +23 -10
src/ui/render3d.js CHANGED
@@ -103,7 +103,7 @@ function drawShadows(S){
103
  cast shadow. */
104
  for(const R of relics){
105
  if(!R.alive||!vis(R.x,R.y,Math.max(R.w,R.h)+110)||!fogPointVisible(R.x,R.y))continue;
106
- const hgt=R.kind===0?118:R.kind===2?58:R.kind===3?42:R.kind===4?66:52;
107
  put(R.x,R.y,Math.max(R.w,R.h)*.57,hgt,Math.min(R.w,R.h)*.55);
108
  }
109
  /* At strategic range a regiment's individual contact shadows occupy fewer
@@ -205,12 +205,12 @@ function selectCinematicLights(nA){
205
  still visible when a source is not promoted; only the strongest nearby
206
  districts spend fragment lighting work. */
207
  for(const R of relics){
208
- if(!R.alive||!fogPointVisible(R.x,R.y)||(R.kind!==4&&R.kind!==2&&R.kind!==3))continue;
209
  const dx=R.x-cam.x,dy=R.y-cam.y,d2=dx*dx+dy*dy;
210
  if(d2>orthoSpan*orthoSpan*.54)continue;
211
- const civic=R.kind===4,c=_lin(civic?[.15,.68,1.0]:[1.0,.24,.035]);
212
- const range=civic?78:58,intensity=(civic?.23:.16)+night*(civic?.42:.31);
213
- sceneLightPush(R.x,R.y,terrainH(R.x,R.y)+(civic?24:18),range,c[0],c[1],c[2],intensity,
214
  (civic?1.05:.72)*range*range/(d2+range*range));
215
  }
216
  /* The commander and a few nearby vehicles participate in actual material
@@ -747,18 +747,31 @@ function render(dtDraw){
747
  /* Each ruin mesh is authored at a reference footprint; the instance scale
748
  maps the planned plot size onto it. Tower blocks are the tall ones, so
749
  they get the tightest divisor or they overwhelm the skyline. */
750
- const sc=Math.max(R.w,R.h)/ (R.kind===2?104 : R.kind===0?46 : R.kind===3?52 : R.kind===4?46 : 44);
751
  /* Kind 4 is the intact civic block. Falling back to the low block if its
752
  mesh is missing is not paranoia: models-civic.js has to be registered in
753
  BOTH boot.js and assets/data/manifest.json, and a file that is listed in
754
  only one silently does not load — which would otherwise turn every civic
755
- plot into a null dereference in the hot render loop. */
 
 
 
 
756
  const mesh=R.kind===2?FX.cityH : R.kind===3?FX.cityK : R.kind===0?FX.cityT
757
- : R.kind===4?(FX.cityC||FX.cityD) : FX.cityD;
 
 
758
  /* V2 and legacy are deliberately separate instance streams. Until all
759
  three maps have decoded (or on LOW quality), the old mesh draws instead
760
- of leaving an empty lot. */
761
- if(!worldV2||!mfWorldV2Queue(R,sc,gh(R.x,R.y),rLod))
 
 
 
 
 
 
 
762
  mesh.add(R.x,R.y,gh(R.x,R.y),sc*(R.kind===0?0.9:1),R.a+(R.lean||0),tint,tint-6,tint-16,255);
763
  if(FX.decal) FX.decal.add(R.x,R.y,gh(R.x,R.y)+0.2,sc*1.05,R.a,12,18,28,130);
764
  }
 
103
  cast shadow. */
104
  for(const R of relics){
105
  if(!R.alive||!vis(R.x,R.y,Math.max(R.w,R.h)+110)||!fogPointVisible(R.x,R.y))continue;
106
+ const hgt=R.kind===0?118:R.kind===2?58:R.kind===3?42:R.kind===4?66:R.kind===5?290:52;
107
  put(R.x,R.y,Math.max(R.w,R.h)*.57,hgt,Math.min(R.w,R.h)*.55);
108
  }
109
  /* At strategic range a regiment's individual contact shadows occupy fewer
 
205
  still visible when a source is not promoted; only the strongest nearby
206
  districts spend fragment lighting work. */
207
  for(const R of relics){
208
+ if(!R.alive||!fogPointVisible(R.x,R.y)||(R.kind!==4&&R.kind!==2&&R.kind!==3&&R.kind!==5))continue;
209
  const dx=R.x-cam.x,dy=R.y-cam.y,d2=dx*dx+dy*dy;
210
  if(d2>orthoSpan*orthoSpan*.54)continue;
211
+ const civic=R.kind===4||R.kind===5,c=_lin(civic?[.15,.68,1.0]:[1.0,.24,.035]);
212
+ const range=R.kind===5?128:civic?78:58,intensity=(R.kind===5?.30:civic?.23:.16)+night*(R.kind===5?.55:civic?.42:.31);
213
+ sceneLightPush(R.x,R.y,terrainH(R.x,R.y)+(R.kind===5?96:civic?24:18),range,c[0],c[1],c[2],intensity,
214
  (civic?1.05:.72)*range*range/(d2+range*range));
215
  }
216
  /* The commander and a few nearby vehicles participate in actual material
 
747
  /* Each ruin mesh is authored at a reference footprint; the instance scale
748
  maps the planned plot size onto it. Tower blocks are the tall ones, so
749
  they get the tightest divisor or they overwhelm the skyline. */
750
+ const sc=Math.max(R.w,R.h)/ (R.kind===2?104 : R.kind===0?46 : R.kind===3?52 : R.kind===4?46 : R.kind===5?44 : 44);
751
  /* Kind 4 is the intact civic block. Falling back to the low block if its
752
  mesh is missing is not paranoia: models-civic.js has to be registered in
753
  BOTH boot.js and assets/data/manifest.json, and a file that is listed in
754
  only one silently does not load — which would otherwise turn every civic
755
+ plot into a null dereference in the hot render loop.
756
+ Kind 5 is the skyline anchor: the alien crystalline monolith on the
757
+ foreign worlds, otherwise the two skyscrapers alternated by position
758
+ hash so twin districts don't clone. */
759
+ const alien5=curTheme==='vespera'||curTheme==='ashland';
760
  const mesh=R.kind===2?FX.cityH : R.kind===3?FX.cityK : R.kind===0?FX.cityT
761
+ : R.kind===4?(FX.cityC||FX.cityD)
762
+ : R.kind===5?((alien5?FX.skyA:(((R.x*7+R.y*13)|0)%2?FX.sky2:FX.sky1))||FX.cityT)
763
+ : FX.cityD;
764
  /* V2 and legacy are deliberately separate instance streams. Until all
765
  three maps have decoded (or on LOW quality), the old mesh draws instead
766
+ of leaving an empty lot. Skyline anchors have no V2 stream — they are
767
+ authored geometry and always draw through their own mesh. */
768
+ if(R.kind===5){
769
+ const vt=curTheme==='vespera';
770
+ mesh.add(R.x,R.y,gh(R.x,R.y),sc,R.a+(R.lean||0),
771
+ vt?226:(curTheme==='ashland'?255:tint),
772
+ vt?205:(curTheme==='ashland'?214:tint-6),
773
+ vt?244:(curTheme==='ashland'?196:tint-16),255);
774
+ } else if(!worldV2||!mfWorldV2Queue(R,sc,gh(R.x,R.y),rLod))
775
  mesh.add(R.x,R.y,gh(R.x,R.y),sc*(R.kind===0?0.9:1),R.a+(R.lean||0),tint,tint-6,tint-16,255);
776
  if(FX.decal) FX.decal.add(R.x,R.y,gh(R.x,R.y)+0.2,sc*1.05,R.a,12,18,28,130);
777
  }