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 obj | |
import "core:fmt" | |
import "core:math/linalg" | |
import "core:os" | |
import "core:strconv" | |
import "core:strings" | |
// https://en.wikipedia.org/wiki/Wavefront_.obj_file |
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 qmap | |
import "core:fmt" | |
import "core:os" | |
import "core:strconv" | |
import "core:strings" | |
// https://developer.valvesoftware.com/wiki/MAP_(file_format) | |
File :: struct { |
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 curves | |
Curve_Kind :: enum u8 { | |
Linear, | |
Bezier, | |
Hermite, | |
Catmull_Rom, | |
B_Spline, | |
} |
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 curve_test | |
import "core:math/linalg" | |
import rl "vendor:raylib" | |
main :: proc() { | |
rl.SetConfigFlags({.MSAA_4X_HINT, .VSYNC_HINT}) | |
rl.InitWindow(900, 600, "Curves") | |
defer rl.CloseWindow() |
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 an example usage of vendor:fontstash with sokol_gfx. | |
// By Jakub Tomšů | |
// | |
// https://gist.github.com/jakubtomsu/5ee4fdfee23df893f6f61b4692dcf895 | |
// | |
// This won't compile on it's own, but it contains all of the interesting parts. | |
// It should be pretty obvious how to modify it to your needs, if not let me know. | |
// | |
// The genral per-frame work is this: | |
// - renderer_draw_text appends quads to a cpu-side buffer |
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
// Port of some collision functions to Odin by Jakub Tomšů. | |
// | |
// from Real-Time Collision Detection by Christer Ericson, published by Morgan Kaufmann Publishers, © 2005 Elsevier Inc | |
// | |
// This should serve as an reference implementation for common collision queries for games. | |
// The goal is good numerical robustness, handling edge cases and optimized math equations. | |
// The code isn't necessarily very optimized. | |
// | |
// There are a few cases you don't want to use the procedures below directly, but instead manually inline the math and adapt it to your needs. | |
// In my experience this method is clearer when writing complex level queries where I need to handle edge cases differently etc. |
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/ |
NewerOlder