This file contains 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
package vlsm | |
import "core:fmt" | |
import "core:intrinsics" | |
import "core:net" | |
import "core:slice" | |
Subnet :: struct { | |
prefix: u8, | |
num_hosts: u32, |
This file contains 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
Renderer_Frustum :: struct { | |
planes: [6]Vec4, | |
} | |
renderer_frustum_from_projection_mat4 :: proc(m: Mat4) -> (result: Renderer_Frustum) { | |
// https://iquilezles.org/articles/frustum/ | |
result.planes = { | |
{m[0, 3] - m[0, 0], m[1, 3] - m[1, 0], m[2, 3] - m[2, 0], m[3, 3] - m[3, 0]}, | |
{m[0, 3] + m[0, 0], m[1, 3] + m[1, 0], m[2, 3] + m[2, 0], m[3, 3] + m[3, 0]}, | |
{m[0, 3] + m[0, 1], m[1, 3] + m[1, 1], m[2, 3] + m[2, 1], m[3, 3] + m[3, 1]}, |
This file contains 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
package main | |
import "core:fmt" | |
import "core:mem" | |
import "core:os" | |
import "core:runtime" | |
import "core:strconv" | |
import "core:sys/windows" | |
import "core:time" |
This file contains 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
// Octahedral mapping visualization in Odin and Raylib | |
// by Jakub Tomšů (@jakubtomsu_) | |
// | |
// Build and run with 'odin run octsphere.odin -file'. | |
// No additional dependencies required. | |
// | |
// Sources: | |
// https://gpuopen.com/learn/fetching-from-cubes-and-octahedrons/ | |
// https://knarkowicz.wordpress.com/2014/04/16/octahedron-normal-vector-encoding/ |
This file contains 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
// D3D12 single-function triangle sample. | |
// | |
// Usage: | |
// - copy SDL2.dll from Odin/vendor/sdl2 to your project directory | |
// - odin run . | |
// | |
// Contributors: | |
// - Jakub Tomšů (updated to newest Odin version) | |
// - Karl Zylinski <karl@zylinski.se> (Initial port) | |
// |
This file contains 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
// pachchan | |
// A simple command line utility for packing channels from multiple textures into one image. | |
// The implementation is kind of a hack :P | |
package packchan | |
import "core:os" | |
import "core:fmt" | |
import "core:strings" | |
import "core:strconv" | |
import "core:path/filepath" |
This file contains 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
package main | |
import "core:fmt" | |
import "core:math" | |
import "core:math/linalg" | |
import rl "vendor:raylib" | |
main :: proc() { | |
rl.SetConfigFlags({.VSYNC_HINT, .WINDOW_RESIZABLE, .MSAA_4X_HINT}) | |
rl.InitWindow(800, 600, "collision") |
This file contains 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
// This is a small program to print a number of known paths in Windows. | |
// Savegame files should be in FOLDERID_SavedGames! | |
// SHGetKnownFolderPath should probably be used only for compatibility. | |
// | |
// Compile with `cl pathtest.c` | |
// | |
// Day created: 02.08.2023 | |
// Version: Windows 10 pro 22H2 | |
// | |
// Output on my machine: |
This file contains 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
package ldtk | |
import "core:encoding/json" | |
import "core:os" | |
import "core:fmt" | |
load_from_file :: proc(filename: string, allocator := context.allocator) -> Maybe(Project) { | |
data, ok := os.read_entire_file(filename, allocator) | |
if !ok { | |
return nil |
This file contains 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
package ease | |
// Adapted from functions here: https://github.com/warrenm/AHEasing/blob/master/AHEasing/easing.c | |
// For previews go here: https://easings.net/ | |
import "core:math" | |
Mode :: enum { | |
linear = 0, | |
quad_in, |
NewerOlder