dup dim>> second iota [ draw-vertex-buffer-row ] with each
] with-gl-buffer ;
-USE: tools.time
: <grid-mesh> ( dim -- grid-mesh )
- [
[ ] [ vertex-array >vertex-buffer ] [ first 1 + 2 * ] tri
- grid-mesh boa
- ] time ;
+ grid-mesh boa ;
M: grid-mesh dispose
[ [ delete-gl-buffer ] when* f ] change-buffer
USING: tools.deploy.config ;
H{
+ { deploy-name "Terrain" }
{ deploy-ui? t }
- { deploy-reflection 1 }
+ { deploy-c-types? f }
{ deploy-unicode? f }
- { deploy-math? t }
{ deploy-io 2 }
- { deploy-c-types? f }
- { deploy-name "Terrain" }
- { deploy-word-props? f }
- { deploy-word-defs? f }
+ { deploy-reflection 2 }
{ "stop-after-last-window?" t }
+ { deploy-word-props? f }
+ { deploy-math? t }
{ deploy-threads? t }
+ { deploy-word-defs? f }
}
USING: accessors alien.data.map arrays byte-arrays combinators
combinators.smart fry grouping images kernel math
math.matrices.simd math.order math.vectors noise random
-sequences math.vectors.simd ;
+sequences math.vectors.simd typed ;
FROM: alien.c-types => float uchar ;
SIMDS: float uchar ;
IN: terrain.generation
CONSTANT: terrain-segment-size { 512 512 }
-CONSTANT: terrain-segment-size-vector { 512.0 512.0 1.0 1.0 }
+CONSTANT: terrain-segment-size-vector float-4{ 512.0 512.0 1.0 1.0 }
CONSTANT: terrain-big-noise-scale float-4{ 0.002 0.002 0.002 0.002 }
CONSTANT: terrain-small-noise-scale float-4{ 0.05 0.05 0.05 0.05 }
ubyte-components >>component-type
terrain-segment-size >>dim ;
-: terrain-segment ( terrain at -- image )
+TYPED: terrain-segment ( terrain: terrain at: float-4 -- image )
{
[ big-noise-segment ]
[ small-noise-segment ]