Skip to content

Instantly share code, notes, and snippets.

@mfbulut
mfbulut / .readme.md
Created July 8, 2024 20:19 — forked from d7samurai/.readme.md
Minimal D3D11 sprite renderer NEO

sponsored by SuperNeo copy 4

Minimal D3D11 sprite renderer NEO

Ultra-compact sprite rendering code with example frame animation logic. This release contains tech bits from the upcoming SuperNeo™ 2D game engine and includes rotation, anchor/pivot point, color filtering, alpha blending and built-in antialiased point sampling. As usual: complete, runnable single-function app. ~150 LOC. No modern C++, OOP or (other) obscuring cruft.

Minimal D3D11 sprite renderer NEO 1337

Sprites are rendered back-to-front (AKA "painter's algorithm") in the order they are submitted, as one draw call. The provided setup employs a single texture atlas containing all the sprite graphics.

The renderer is "im

void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec2 uv = fragCoord/iResolution.yy;
vec3 col;
float iter = 10.;
float step = 1./iter;
for (float i=1.; i<=iter; i++)
{
@mfbulut
mfbulut / murkan.rs
Created July 25, 2022 17:01
murkan rust implemention
use std::io;
pub fn closest_factors(n: i32) -> (i32, i32) {
let (mut a, mut b, mut c, mut d): (i32, i32, i32, i32);
a = (n as f64).sqrt() as i32;
b = a;
c = n - a * a;
if a != 0 {
d = c / a;
b += d;