Skip to content

Instantly share code, notes, and snippets.

@rkibria
rkibria / pygame_blit_from_bytearray.py
Created February 11, 2024 21:45
Fading effect in pygame using a blit from a surface based on a bytearray
"""
A fading effect created by manipulating a bytearray that underlies a Surface object
"""
import math, pygame
def main():
pygame.init()
size = width, height = 320, 240
screen = pygame.display.set_mode(size)
@rkibria
rkibria / demo_bvh_raytrace.py
Created October 18, 2023 22:50
BVH-accelerated ray tracing demo in pygame based on Ray Tracing in One Weekend series
"""
Ray tracing demo with BVH structure
Based on https://raytracing.github.io/books/RayTracingTheNextWeek.html
"""
from __future__ import annotations
import random
from timeit import default_timer as timer
@rkibria
rkibria / gospinningcube.go
Last active May 3, 2023 09:40
Generate a .gif showing a spinning 3d wireframe cube with hidden lines in Golang
package main
import (
"fmt"
"image"
"image/color"
"image/gif"
"math"
"os"
)