Skip to content

Instantly share code, notes, and snippets.

View plasticarm's full-sized avatar
🏠
Working from home

Glen Johnson plasticarm

🏠
Working from home
View GitHub Profile
@jarble
jarble / generic_example.frag
Last active January 11, 2023 21:41
Generic programming in GLSL (parametric polymorphism, template metaprogramming) https://www.reddit.com/r/glsl/comments/mmxves/generic_programming_parametric_polymorphism/
//I wish there were a better way to do this!
#define func(type,name,param1,param2,body) type name(type param1,type param2) {body}
#define generic(name,param1,param2,body) func(float,name,param1,param2,body) func(vec2,name,param1,param2,body) func(vec3,name,param1,param2,body) func(vec4,name,param1,param2,body)
//define two "generic" functions using this macro
generic(add,a,b,
return a + b;
)
generic(sub,a,b,
@Domiii
Domiii / RealWorldTerrainRoblox.lua
Last active November 19, 2021 00:10
Import real world terrain into Roblox
--[[
Steps:
1. Download heightmap Bitmap
e.g. from terrain.party: http://terrain.party/api/export?name=guarda&box=10.186055,46.850130,10.080975,46.778264)
e.g. from earthe
Data Sets: NASA LPDAAC Collections -> NASA SRTM (SRTM 3) Collections
2. Use this site to convert BMP to Lua: https://codepen.io/Domiii/pen/oMJvoJ?editors=0010
3. Copy the final Lua code to workspace.TerrainPixels (ModuleScript)
4. Run this script!