work on sky editor and world data

This commit is contained in:
Tuomas Katajisto 2025-07-17 11:19:12 +03:00
parent 72b73f8c01
commit a2c632f722
10 changed files with 914 additions and 661 deletions

View File

@ -1,39 +1,35 @@
ascii_car : string = #string DONE ascii_car : string = #string DONE
▄▖ ▄▖ ▘ ▌ ▄▖ ▖▖ ▗ ▘▘ ▗ ▖ ▖ ▘▗ ▗ ▘ ▖ ▘ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⡤⢤⣶⣶⣶⣶⣶⣒⣒⣀⣺⣿⣿⠿⢶⣶⣶⣶⣦⣤⣤⣤⣄⣀⣀⣀⣀⡀⠀⠀
▌▌ ▌ ▀▌▛▛▌█▌ █▌▛▌▛▌▌▛▌█▌ ▛▌▌▌ ▐ ▌▌▛▌▛▛▌▀▌▛▘ ▙▘▀▌▜▘▀▌ ▌▌▛▘▜▘▛▌ ▌▞▖▌▛▘▌▜▘▜▘█▌▛▌ ▌▛▌ ▌▀▌▌ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⠴⠚⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠉⠛⠒⠲⠦⢤⣉⠙⣿⣿⣿⣟⢿⣿⠿⠿⠿⢿⣿
▛▌ ▙▌█▌▌▌▌▙▖ ▙▖▌▌▙▌▌▌▌▙▖ ▙▌▙▌ ▐ ▙▌▙▌▌▌▌█▌▄▌ ▌▌█▌▐▖█▌ ▌▌▄▌▐▖▙▌▗ ▛ ▝▌▌ ▌▐▖▐▖▙▖▌▌ ▌▌▌ ▙▌█▌▌ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣶⣷⡦⠞⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⡇⠀⠈⠛⢿⣿⡀⠀⠀⠀⠻
▄▌ ▄▌ ▙▌ ▘ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⣤⠤⢴⣿⣉⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⠇⠀⠀⠀⠀⠙⣿⣄⡀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣤⣤⡶⠞⠛⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠉⠓⠒⠒⠢⠤⠤⣄⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⠀⢠⠤⠤⠤⣤⣾⠀⠙⢦⡀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⡤⢤⣶⣶⣶⣶⣶⣒⣒⣀⣺⣿⣿⠿⢶⣶⣶⣶⣦⣤⣤⣤⣄⣀⣀⣀⣀⡀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⣠⠴⣾⣛⣩⢴⣿⠿⠶⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠙⠒⠒⠒⠤⠤⢤⣤⣾⢿⣴⢏⣀⣀⣤⡼⠻⡆⠀⠈⢷
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⠴⠚⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠉⠛⠒⠲⠦⢤⣉⠙⣿⣿⣿⣟⢿⣿⠿⠿⠿⢿⣿ ⠀⠀⠀⠀⠀⢀⣴⠋⠁⠀⠀⠀⠀⠙⠓⠲⠤⠬⠷⠀⠀⢀⣀⣀⣀⣀⣀⣀⣀⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⠤⠞⠉⠀⠀⠹⡟⠀⠀⠀⠀⠀⢱⠀⢠⣼
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣶⣷⡦⠞⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⡇⠀⠈⠛⢿⣿⡀⠀⠀⠀⠻ ⠀⠀⠀⣀⡴⠋⠈⢙⡞⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠛⠢⠤⢄⣀⣠⠴⠛⣋⣠⠴⠒⠉⠉⢉⣲⠶⠀⣀⡠⠤⠒⠊⠉⠁⠀⠀⠀⠀⠀⠀⠀⢹⠀⠀⠀⠀⠀⣼⢰⣿⣿
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⣤⠤⢴⣿⣉⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⠇⠀⠀⠀⠀⠙⣿⣄⡀⠀⠀ ⡀⣠⣼⠏⠀⠀⣰⠟⠦⢤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠓⠒⠒⠒⠋⣉⠤⠒⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⢀⣯⣼⣿⣿
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣤⣤⡶⠞⠛⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠉⠓⠒⠒⠢⠤⠤⣄⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⠀⢠⠤⠤⠤⣤⣾⠀⠙⢦⡀ ⡟⠋⠹⢤⣠⠞⠁⠀⠀⠀⠀⠈⠉⠐⠲⠤⢄⣀⡀⠀⠀⠀⠀⣀⠤⠤⠤⠤⠤⣄⣀⣀⠀⢀⡠⠖⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⡀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⢸⣿⣿⣿⣿
⠀⠀⠀⠀⠀⠀⠀⠀⣠⠴⣾⣛⣩⢴⣿⠿⠶⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠙⠒⠒⠒⠤⠤⢤⣤⣾⢿⣴⢏⣀⣀⣤⡼⠻⡆⠀⠈⢷ ⢻⣧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⢒⡶⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠉⠙⢦⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⡿⣿⡝⣆⠀⠀⠀⠀⢸⠀⠀⣠⣴⠿⣻⣿⣿⠈
⠀⠀⠀⠀⠀⢀⣴⠋⠁⠀⠀⠀⠀⠙⠓⠲⠤⠬⠷⠀⠀⢀⣀⣀⣀⣀⣀⣀⣀⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⠤⠞⠉⠀⠀⠹⡟⠀⠀⠀⠀⠀⢱⠀⢠⣼ ⢿⣿⣿⠶⢤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢨⠇⠀⠀⠀⠀⣀⣀⣤⣤⣾⣿⢿⡆⢸⣧⢹⠀⠀⣠⣴⣿⣴⠟⢋⣥⠴⢻⣿⠏⠀
⠀⠀⠀⣀⡴⠋⠈⢙⡞⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠛⠢⠤⢄⣀⣠⠴⠛⣋⣠⠴⠒⠉⠉⢉⣲⠶⠀⣀⡠⠤⠒⠊⠉⠁⠀⠀⠀⠀⠀⠀⠀⢹⠀⠀⠀⠀⠀⣼⢰⣿⣿ ⢸⣿⣿⡇⠀⠘⣿⣶⣦⣤⣀⡀⠀⠀⠀⠀⠀⠀⠈⠑⠲⠤⢤⣀⣀⡀⠀⠀⠀⠀⠀⠀⣀⣀⣞⣀⣠⣤⣾⣿⣿⣿⣿⣿⣿⢻⢸⣿⣾⣿⣾⣤⣾⣿⠿⢋⡡⠞⠉⠉⠉⠉⠀⠀⠀
⡀⣠⣼⠏⠀⠀⣰⠟⠦⢤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠓⠒⠒⠒⠋⣉⠤⠒⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⢀⣯⣼⣿⣿ ⣼⡟⣿⡇⠀⠀⢹⣄⠈⠙⠒⠯⣽⣶⢶⣤⣤⣄⣀⣀⠀⠀⠀⠀⠈⠙⠻⠿⠿⠿⠿⠿⠿⠛⠛⠛⢉⣉⣽⠶⣿⠟⣿⣿⣧⣿⣾⣿⣿⡇⢹⡿⠋⣡⠖⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀
⡟⠋⠹⢤⣠⠞⠁⠀⠀⠀⠀⠈⠉⠐⠲⠤⢄⣀⡀⠀⠀⠀⠀⣀⠤⠤⠤⠤⠤⣄⣀⣀⠀⢀⡠⠖⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⡀⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⢸⣿⣿⣿⣿ ⣇⠳⣼⣧⠴⠛⠉⠉⠉⠒⣦⣤⣀⡀⠀⠀⠉⠙⢦⠀⠉⠉⢙⣷⣶⠒⠒⠒⠶⡶⠶⠶⢶⣤⠖⠚⠉⠁⠀⣰⣷⠾⣿⢿⢥⣼⣾⣿⣿⠃⣸⣠⠞⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⢻⣧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⢒⡶⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠉⠙⢦⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⡿⣿⡝⣆⠀⠀⠀⠀⢸⠀⠀⣠⣴⠿⣻⣿⣿⠈ ⠈⠳⣌⣿⢦⣄⠀⢀⣴⣿⣿⣷⣿⡯⣗⠲⠤⣀⡈⣇⠀⠀⠻⡄⠈⣷⠀⠀⠀⡿⠒⠶⠾⢿⠀⠀⠀⢠⣾⡏⠁⣸⡇⢸⡸⢠⡌⢡⣿⠴⠿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⢿⣿⣿⠶⢤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢨⠇⠀⠀⠀⠀⣀⣀⣤⣤⣾⣿⢿⡆⢸⣧⢹⠀⠀⣠⣴⣿⣴⠟⢋⣥⠴⢻⣿⠏⠀ ⠀⠀⠈⠙⠳⢿⣙⠺⢽⣿⣮⣿⣿⠗⠋⠀⠀⠀⠉⡿⠀⠀⣀⣹⣿⣯⣤⣶⣚⣛⣒⣛⣓⣿⠀⠀⠀⢽⣿⣶⣶⡏⢧⣼⣷⡿⢁⣾⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⢸⣿⣿⡇⠀⠘⣿⣶⣦⣤⣀⡀⠀⠀⠀⠀⠀⠀⠈⠑⠲⠤⢤⣀⣀⡀⠀⠀⠀⠀⠀⠀⣀⣀⣞⣀⣠⣤⣾⣿⣿⣿⣿⣿⣿⢻⢸⣿⣾⣿⣾⣤⣾⣿⠿⢋⡡⠞⠉⠉⠉⠉⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠈⠙⠢⢬⣙⠛⠧⢤⣀⣀⠀⢀⣴⠃⠀⢀⣹⢦⣤⣉⣉⣯⣍⣹⣿⣿⣿⡃⣀⡤⠴⠛⠋⠁⠀⡇⠘⣜⣏⣠⣿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⣼⡟⣿⡇⠀⠀⢹⣄⠈⠙⠒⠯⣽⣶⢶⣤⣤⣄⣀⣀⠀⠀⠀⠀⠈⠙⠻⠿⠿⠿⠿⠿⠿⠛⠛⠛⢉⣉⣽⠶⣿⠟⣿⣿⣧⣿⣾⣿⣿⡇⢹⡿⠋⣡⠖⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠓⠦⢤⣈⡉⠉⠙⠛⠛⠛⠲⠤⠤⠤⠴⣶⣶⣿⣿⢿⡿⣯⠀⠀⠀⠀⠀⢀⣠⡟⠤⠿⠟⠛⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⣇⠳⣼⣧⠴⠛⠉⠉⠉⠒⣦⣤⣀⡀⠀⠀⠉⠙⢦⠀⠉⠉⢙⣷⣶⠒⠒⠒⠶⡶⠶⠶⢶⣤⠖⠚⠉⠁⠀⣰⣷⠾⣿⢿⢥⣼⣾⣿⣿⠃⣸⣠⠞⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠙⠒⠲⠤⢤⣄⣀⣀⣀⣤⣈⣤⣤⠤⣴⣿⣥⠤⠴⠒⠚⠋⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠈⠳⣌⣿⢦⣄⠀⢀⣴⣿⣿⣷⣿⡯⣗⠲⠤⣀⡈⣇⠀⠀⠻⡄⠈⣷⠀⠀⠀⡿⠒⠶⠾⢿⠀⠀⠀⢠⣾⡏⠁⣸⡇⢸⡸⢠⡌⢡⣿⠴⠿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠈⠙⠳⢿⣙⠺⢽⣿⣮⣿⣿⠗⠋⠀⠀⠀⠉⡿⠀⠀⣀⣹⣿⣯⣤⣶⣚⣛⣒⣛⣓⣿⠀⠀⠀⢽⣿⣶⣶⡏⢧⣼⣷⡿⢁⣾⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠈⠙⠢⢬⣙⠛⠧⢤⣀⣀⠀⢀⣴⠃⠀⢀⣹⢦⣤⣉⣉⣯⣍⣹⣿⣿⣿⡃⣀⡤⠴⠛⠋⠁⠀⡇⠘⣜⣏⣠⣿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠓⠦⢤⣈⡉⠉⠙⠛⠛⠛⠲⠤⠤⠤⠴⣶⣶⣿⣿⢿⡿⣯⠀⠀⠀⠀⠀⢀⣠⡟⠤⠿⠟⠛⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠙⠒⠲⠤⢤⣄⣀⣀⣀⣤⣈⣤⣤⠤⣴⣿⣥⠤⠴⠒⠚⠋⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
░██████████░█████████ ░██ ░██ ░██████████ ░███ ░██ ░██████
░██ ░██ ░██ ░██ ░██ ░██ ░████ ░██ ░██ ░██ ░██████████░█████████ ░██ ░██ ░██████████ ░███ ░██ ░██████
░██ ░██ ░██ ░██ ░██ ░██ ░██░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░████ ░██ ░██ ░██
░██ ░█████████ ░██ ░██ ░█████████ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██░██ ░██ ░██ ░██
░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██░██ ░██ ░██ ░██ ░█████████ ░██ ░██ ░█████████ ░██ ░██ ░██ ░██ ░██
░██ ░██ ░██ ░██ ░██ ░██ ░██ ░████ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██░██ ░██ ░██
░██ ░██ ░██ ░██████ ░██████████ ░██ ░███ ░██████ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░████ ░██ ░██
░██ ░██ ░██ ░██████ ░██████████ ░██ ░███ ░██████
DONE DONE

View File

@ -30,6 +30,8 @@ pointerHit : bool;
pointerX : s32; pointerX : s32;
pointerY : s32; pointerY : s32;
world : World;
Level_Editor_Tab :: enum { Level_Editor_Tab :: enum {
TACOMA; TACOMA;
TOOLS; TOOLS;

View File

@ -1,10 +1,5 @@
#run { #run {
tacomaString : string = #string DONE tacomaString : string = #string DONE
▖▖▄▖▖▖ ▄▖▄▖▄▖ ▄▖▄▖▖ ▖▄▖▄▖▖ ▄▖▖ ▖▄▖ ▖ ▖▄▖▄▖▖▖
▌▌▌▌▌▌ ▌▌▙▘▙▖ ▌ ▌▌▛▖▞▌▙▌▐ ▌ ▐ ▛▖▌▌ ▌▞▖▌▐ ▐ ▙▌
▐ ▙▌▙▌ ▛▌▌▌▙▖ ▙▖▙▌▌▝ ▌▌ ▟▖▙▖▟▖▌▝▌▙▌ ▛ ▝▌▟▖▐ ▌▌
___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___
/\ \ /\ \ /\ \ /\ \ /\__\ /\ \ /\ \ /\ \ /\ \ /\ \ /\__\ /\ \
\:\ \ /::\ \ /::\ \ /::\ \ /::| | /::\ \ \:\ \ /::\ \ /::\ \ /::\ \ /::| | /::\ \
@ -16,10 +11,6 @@
\/__/ /:/ / \:\ \ \:\/:/ / /:/ / /:/ / \/__/ /:/ / \:\ \ \:\/:/ / /:/ / /:/ /
/:/ / \:\__\ \::/ / /:/ / /:/ / /:/ / \:\__\ \::/ / /:/ / /:/ /
\/__/ \/__/ \/__/ \/__/ \/__/ \/__/ \/__/ \/__/ \/__/ \/__/
▄▖▖ ▖▄▖▄ ▖ ▄▖▄
▙▖▛▖▌▌▌▙▘▌ ▙▖▌▌
▙▖▌▝▌▛▌▙▘▙▖▙▖▙▘
DONE DONE
print("%\n", tacomaString); print("%\n", tacomaString);
} }

View File

@ -17,6 +17,7 @@ stbi :: #import "stb_image";
#load "load.jai"; #load "load.jai";
#load "camera.jai"; #load "camera.jai";
#load "ray.jai"; #load "ray.jai";
#load "world.jai";
last_frame_time : float64; last_frame_time : float64;
delta\ _time : float64; delta\ _time : float64;

View File

@ -1,9 +1,17 @@
draw_sky :: (cam: *Camera) { draw_sky :: (cam: *Camera) {
mvp := create_viewproj(cam); mvp := create_viewproj(cam);
vs_params : Sky_Vs_Params; vs_params : Sky_Vs_Params;
world_conf : Sky_World_Config;
wc : World_Config;
world_config_to_shader_type(wc, *world_conf);
vs_params.mvp = mvp.floats; vs_params.mvp = mvp.floats;
sg_apply_pipeline(gPipelines.sky.pipeline); sg_apply_pipeline(gPipelines.sky.pipeline);
sg_apply_bindings(*gPipelines.sky.bind); sg_apply_bindings(*gPipelines.sky.bind);
sg_apply_uniforms(UB_sky_vs_params, *(sg_range.{ ptr = *vs_params, size = size_of(type_of(vs_params)) })); sg_apply_uniforms(UB_sky_vs_params, *(sg_range.{ ptr = *vs_params, size = size_of(type_of(vs_params)) }));
sg_apply_uniforms(UB_sky_world_config, *(sg_range.{ptr = *world_conf, size = size_of(type_of(world_conf))}));
sg_draw(0, 36, 1); sg_draw(0, 36, 1);
} }

File diff suppressed because it is too large Load Diff

View File

@ -116,7 +116,7 @@ vs_trile_source_glsl430 := u8.[
{ {
break; break;
} }
pos_after_adjust -= (to_center * 0.004999999888241291046142578125); pos_after_adjust += (to_center * 0.100000001490116119384765625);
count++; count++;
} }
frag_color = vec4(trixel_material.xyz, 1.0); frag_color = vec4(trixel_material.xyz, 1.0);
@ -182,15 +182,14 @@ fs_trile_source_glsl430 := u8.[
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x62,0x72,0x65,0x61,0x6b,0x3b,0x0a,0x20, 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x62,0x72,0x65,0x61,0x6b,0x3b,0x0a,0x20,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20, 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x70,0x6f,0x73,0x5f,0x61,0x66,0x74,0x65,0x72,0x5f,0x61,0x64,0x6a,0x75,0x73, 0x20,0x70,0x6f,0x73,0x5f,0x61,0x66,0x74,0x65,0x72,0x5f,0x61,0x64,0x6a,0x75,0x73,
0x74,0x20,0x2d,0x3d,0x20,0x28,0x74,0x6f,0x5f,0x63,0x65,0x6e,0x74,0x65,0x72,0x20, 0x74,0x20,0x2b,0x3d,0x20,0x28,0x74,0x6f,0x5f,0x63,0x65,0x6e,0x74,0x65,0x72,0x20,
0x2a,0x20,0x30,0x2e,0x30,0x30,0x34,0x39,0x39,0x39,0x39,0x39,0x39,0x38,0x38,0x38, 0x2a,0x20,0x30,0x2e,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x34,0x39,0x30,
0x32,0x34,0x31,0x32,0x39,0x31,0x30,0x34,0x36,0x31,0x34,0x32,0x35,0x37,0x38,0x31, 0x31,0x31,0x36,0x31,0x31,0x39,0x33,0x38,0x34,0x37,0x36,0x35,0x36,0x32,0x35,0x29,
0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x63,0x6f,0x75, 0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x63,0x6f,0x75,0x6e,0x74,0x2b,
0x6e,0x74,0x2b,0x2b,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20, 0x2b,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,
0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63, 0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x74,
0x34,0x28,0x74,0x72,0x69,0x78,0x65,0x6c,0x5f,0x6d,0x61,0x74,0x65,0x72,0x69,0x61, 0x72,0x69,0x78,0x65,0x6c,0x5f,0x6d,0x61,0x74,0x65,0x72,0x69,0x61,0x6c,0x2e,0x78,
0x6c,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a, 0x79,0x7a,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
0x00,
]; ];
/* /*
#version 300 es #version 300 es
@ -268,7 +267,7 @@ vs_trile_source_glsl300es := u8.[
{ {
break; break;
} }
pos_after_adjust -= (to_center * 0.004999999888241291046142578125); pos_after_adjust += (to_center * 0.100000001490116119384765625);
count++; count++;
} }
frag_color = vec4(trixel_material.xyz, 1.0); frag_color = vec4(trixel_material.xyz, 1.0);
@ -334,15 +333,15 @@ fs_trile_source_glsl300es := u8.[
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20, 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x20,0x20,0x62,0x72,0x65,0x61,0x6b,0x3b,0x0a,0x20,0x20,0x20,0x20, 0x20,0x20,0x20,0x20,0x20,0x62,0x72,0x65,0x61,0x6b,0x3b,0x0a,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x6f, 0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x6f,
0x73,0x5f,0x61,0x66,0x74,0x65,0x72,0x5f,0x61,0x64,0x6a,0x75,0x73,0x74,0x20,0x2d, 0x73,0x5f,0x61,0x66,0x74,0x65,0x72,0x5f,0x61,0x64,0x6a,0x75,0x73,0x74,0x20,0x2b,
0x3d,0x20,0x28,0x74,0x6f,0x5f,0x63,0x65,0x6e,0x74,0x65,0x72,0x20,0x2a,0x20,0x30, 0x3d,0x20,0x28,0x74,0x6f,0x5f,0x63,0x65,0x6e,0x74,0x65,0x72,0x20,0x2a,0x20,0x30,
0x2e,0x30,0x30,0x34,0x39,0x39,0x39,0x39,0x39,0x39,0x38,0x38,0x38,0x32,0x34,0x31, 0x2e,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x34,0x39,0x30,0x31,0x31,0x36,
0x32,0x39,0x31,0x30,0x34,0x36,0x31,0x34,0x32,0x35,0x37,0x38,0x31,0x32,0x35,0x29, 0x31,0x31,0x39,0x33,0x38,0x34,0x37,0x36,0x35,0x36,0x32,0x35,0x29,0x3b,0x0a,0x20,
0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x63,0x6f,0x75,0x6e,0x74,0x2b, 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x63,0x6f,0x75,0x6e,0x74,0x2b,0x2b,0x3b,0x0a,
0x2b,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61, 0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x66,0x72,0x61,0x67,0x5f,0x63,
0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x74, 0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x76,0x65,0x63,0x34,0x28,0x74,0x72,0x69,0x78,
0x72,0x69,0x78,0x65,0x6c,0x5f,0x6d,0x61,0x74,0x65,0x72,0x69,0x61,0x6c,0x2e,0x78, 0x65,0x6c,0x5f,0x6d,0x61,0x74,0x65,0x72,0x69,0x61,0x6c,0x2e,0x78,0x79,0x7a,0x2c,
0x79,0x7a,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, 0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,0x7d,0x0a,0x0a,0x00,
]; ];
/* /*
#include <metal_stdlib> #include <metal_stdlib>
@ -461,7 +460,7 @@ vs_trile_source_metal_macos := u8.[
{ {
break; break;
} }
pos_after_adjust -= (in.to_center * 0.004999999888241291046142578125); pos_after_adjust += (in.to_center * 0.100000001490116119384765625);
count++; count++;
} }
out.frag_color = float4(trixel_material.xyz, 1.0); out.frag_color = float4(trixel_material.xyz, 1.0);
@ -539,17 +538,17 @@ fs_trile_source_metal_macos := u8.[
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20, 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x7b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x20,0x20,0x62,0x72,0x65,0x61,0x6b,0x3b,0x0a,0x20,0x20,0x20,0x20, 0x20,0x20,0x20,0x20,0x20,0x62,0x72,0x65,0x61,0x6b,0x3b,0x0a,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x6f, 0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x6f,
0x73,0x5f,0x61,0x66,0x74,0x65,0x72,0x5f,0x61,0x64,0x6a,0x75,0x73,0x74,0x20,0x2d, 0x73,0x5f,0x61,0x66,0x74,0x65,0x72,0x5f,0x61,0x64,0x6a,0x75,0x73,0x74,0x20,0x2b,
0x3d,0x20,0x28,0x69,0x6e,0x2e,0x74,0x6f,0x5f,0x63,0x65,0x6e,0x74,0x65,0x72,0x20, 0x3d,0x20,0x28,0x69,0x6e,0x2e,0x74,0x6f,0x5f,0x63,0x65,0x6e,0x74,0x65,0x72,0x20,
0x2a,0x20,0x30,0x2e,0x30,0x30,0x34,0x39,0x39,0x39,0x39,0x39,0x39,0x38,0x38,0x38, 0x2a,0x20,0x30,0x2e,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x31,0x34,0x39,0x30,
0x32,0x34,0x31,0x32,0x39,0x31,0x30,0x34,0x36,0x31,0x34,0x32,0x35,0x37,0x38,0x31, 0x31,0x31,0x36,0x31,0x31,0x39,0x33,0x38,0x34,0x37,0x36,0x35,0x36,0x32,0x35,0x29,
0x32,0x35,0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x63,0x6f,0x75, 0x3b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x63,0x6f,0x75,0x6e,0x74,0x2b,
0x6e,0x74,0x2b,0x2b,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20, 0x2b,0x3b,0x0a,0x20,0x20,0x20,0x20,0x7d,0x0a,0x20,0x20,0x20,0x20,0x6f,0x75,0x74,
0x6f,0x75,0x74,0x2e,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d, 0x2e,0x66,0x72,0x61,0x67,0x5f,0x63,0x6f,0x6c,0x6f,0x72,0x20,0x3d,0x20,0x66,0x6c,
0x20,0x66,0x6c,0x6f,0x61,0x74,0x34,0x28,0x74,0x72,0x69,0x78,0x65,0x6c,0x5f,0x6d, 0x6f,0x61,0x74,0x34,0x28,0x74,0x72,0x69,0x78,0x65,0x6c,0x5f,0x6d,0x61,0x74,0x65,
0x61,0x74,0x65,0x72,0x69,0x61,0x6c,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x31,0x2e,0x30, 0x72,0x69,0x61,0x6c,0x2e,0x78,0x79,0x7a,0x2c,0x20,0x31,0x2e,0x30,0x29,0x3b,0x0a,
0x29,0x3b,0x0a,0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75, 0x20,0x20,0x20,0x20,0x72,0x65,0x74,0x75,0x72,0x6e,0x20,0x6f,0x75,0x74,0x3b,0x0a,
0x74,0x3b,0x0a,0x7d,0x0a,0x0a,0x00, 0x7d,0x0a,0x0a,0x00,
]; ];
trile_shader_desc :: (backend: sg_backend) -> sg_shader_desc { trile_shader_desc :: (backend: sg_backend) -> sg_shader_desc {
desc: sg_shader_desc; desc: sg_shader_desc;

View File

@ -7,6 +7,7 @@ layout(binding=0) uniform sky_vs_params {
}; };
out vec4 pos; out vec4 pos;
void main() { void main() {
@ -16,6 +17,23 @@ void main() {
@end @end
@fs fs_sky @fs fs_sky
layout(binding=1) uniform sky_world_config {
vec3 skyBase;
vec3 skyTop;
vec3 sunDisk;
vec3 horizonHalo;
vec3 sunHalo;
vec3 sunLightColor;
vec3 sunPosition;
float sunIntensity;
int hasClouds;
int hasPlane;
float planeHeight;
int planeType;
};
in vec4 pos; in vec4 pos;
out vec4 frag_color; out vec4 frag_color;
@ -68,11 +86,6 @@ vec3 filmic_aces(vec3 v)
} }
vec3 sky(vec3 skypos, vec3 sunpos) { vec3 sky(vec3 skypos, vec3 sunpos) {
vec3 skyBase = vec3(0.3843, 0.8117, 0.9568);
vec3 skyTop = vec3(0.17, 0.4, 0.95);
vec3 sunDisk = vec3(1.0, 1.0, 1.0);
vec3 horizonHalo = vec3(1.0, 1.0, 1.0);
vec3 sunHalo = vec3(1.0, 1.0, 1.0);
vec3 sunCol = sunDisk.xyz; vec3 sunCol = sunDisk.xyz;
vec3 baseSky = skyBase.xyz; vec3 baseSky = skyBase.xyz;

View File

@ -44,7 +44,7 @@ void main() {
trixel_material = texelFetch(sampler2D(triletex, trilesmp), ivec2(xpos, ypos + zpos * 16), 0); trixel_material = texelFetch(sampler2D(triletex, trilesmp), ivec2(xpos, ypos + zpos * 16), 0);
if (length(trixel_material) > 0.01) break; // @ToDo: Replace with proper null trixel check. if (length(trixel_material) > 0.01) break; // @ToDo: Replace with proper null trixel check.
pos_after_adjust -= to_center * 0.005; pos_after_adjust += to_center * 0.1;
count++; count++;
} }
// frag_color = vec4(vec3(length(to_center)), 1.0); // frag_color = vec4(vec3(length(to_center)), 1.0);

46
src/world.jai Normal file
View File

@ -0,0 +1,46 @@
World_Config :: struct {
skyBase : Vector3 = .{0.5, 0.5, 1.0};
skyTop : Vector3 = .{0.8, 0.8, 1.0};
sunDisk : Vector3;
horizonHalo : Vector3;
sunHalo : Vector3;
sunLightColor : Vector3 = .{1.0, 1.0, 1.0};
sunPosition : Vector3 = #run normalize(Vector3.{0.5, 0.5, 0.5});
sunIntensity : float = 1.0;
hasClouds : int = 1;
hasPlane : int = 0;
planeHeight : float = 0.0;
planeType : int = 0;
}
world_config_to_shader_type :: (wc: World_Config, data: *$T) {
data.skyBase[0] = wc.skyBase.x;
data.skyBase[1] = wc.skyBase.y;
data.skyBase[2] = wc.skyBase.z;
data.skyTop[0] = wc.skyTop.x;
data.skyTop[1] = wc.skyTop.y;
data.skyTop[2] = wc.skyTop.z;
}
IVector3 :: struct {
x: s32;
y: s32;
z: s32;
}
ivec_comp :: (a: IVector3, b: IVector3) -> bool {
if a.x != b.x || a.y != b.y || a.z != b.z then return false;
return true;
}
ivec_hash :: (v: IVector3) -> u32 {
return sdbm_hash(*v, size_of(IVector3));
}
World :: struct {
conf : World_Config;
triles : Table(IVector3, string, ivec_hash, ivec_comp);
}