Skip to content

Instantly share code, notes, and snippets.

View RednibCoding's full-sized avatar

Michael Binder RednibCoding

View GitHub Profile
/**
* Simple assert function that throws an error if the test is false
*/
export function assert(condition: unknown, msg?: string): asserts condition {
if (condition === false) throw new AssertionError(msg);
}
@RednibCoding
RednibCoding / SMD_Format_Documentation.md
Last active January 5, 2025 11:49
StudioModel Data (SMD) Format Documentation

SMD 3D Model Format Documentation

Overview

SMD (StudioModel Data) is a plain-text file format used for 3D models, primarily in Valve's Source and GoldSrc engines. SMD is also known to be used by Sauerbraten and third party tools for The Sims and Mount & Blade. It stores geometry, skeletal animations, and optionally vertex animations in a simple, easy-to-parse structure.

Key Features

  • Reference Models: Default pose with geometry and bone hierarchy.
@RednibCoding
RednibCoding / LPM_3D_Format_Documentation.md
Last active January 6, 2025 15:45
LPM (Low Poly Model) Format Documentation

LPM (Low Poly Model) 3D Format Documentation

Overview

The LPM format is a lightweight, human-readable format designed to store low-polygon 3D models. It supports vertices, normals, UVs, faces, and skeletal animations. Its simplicity makes it easy to parse and implement in custom tools.

Features

  • Single texture per model
  • Comments supported (lines starting with #)
  • Compact and straightforward structure
  • Skeletal animations support (optional)
@RednibCoding
RednibCoding / rc_tga.h
Last active January 15, 2025 23:01
Single header c library for loading and writing tga image files
/*
* TGA File Handling Library
* by Michael Binder (RednibCoding)
*
* This library provides functionality to load and save TGA (Targa) image files, including support for uncompressed
* and RLE-compressed (32-bit RGBA and 24-bit RGB) images. The library is simple and self-contained, designed for
* easy integration into projects requiring TGA image manipulation.
*
* Key Features:
* - TGA Loading from Memory and Files:
@RednibCoding
RednibCoding / CamSwitcher.py
Created March 3, 2025 11:54
Cave CamSwitcher script
import cave # type: ignore
# Private module-level variables (not accessible outside this script)
_cam_switcher_data = {
"targetOneName": "",
"targetTwoName": ""
}
# Add this to the first entity that the camera can switch to (it must have a CameraComponent)
class CamSwitcherTargetOne(cave.Component):
@RednibCoding
RednibCoding / Gui.bmx
Last active April 30, 2025 12:21
BlitzMax immediate mode gui
' === GUI STATE SETUP ===
Type TGuiState
Field winWidth:Int, winHeight:int
Field mouseX:Int, mouseY:Int
Field guiMouseOver:Int
Field mouseWheelDelta:Int
Field mouseDown:Int, lastMouseDown:Int
Field spacing:Int = 4
Field widgetHeight:Int = 24
@RednibCoding
RednibCoding / main.bmx
Created April 20, 2025 19:44
BlitzMax Resizable Window
SuperStrict
Framework Brl.StandardIO
Import SDL.SDLRenderMax2D
Import Brl.pngloader ' If you need to load PNGs
Import Brl.Retro
Import Brl.Map
Global windowWidth:Int = 800
Global windowHeight:Int = 600