This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { PlaneGeometry, DoubleSide, MeshBasicMaterial, Mesh, TextureLoader } from 'three'; | |
const MAPBOX_TOKEN = 'Your token'; | |
async function tileToMesh(x: number, y: number, z: number) { | |
const url = `https://api.mapbox.com/v4/mapbox.terrain-rgb/${z}/${x}/${y}.pngraw?access_token=${MAPBOX_TOKEN}`; | |
const pixels = await this.getPixels(url); | |
const planeSize = Math.sqrt(pixels.length / 4); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys,os | |
import curses | |
def draw_menu(stdscr): | |
k = 0 | |
cursor_x = 0 | |
cursor_y = 0 | |
# Clear and refresh the screen for a blank canvas | |
stdscr.clear() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If Windows getch() available, use that. If not, use a | |
# Unix version. | |
try: | |
import msvcrt | |
getch = msvcrt.getch | |
except: | |
import sys, tty, termios | |
def _unix_getch(): | |
"""Get a single character from stdin, Unix version""" |