Skip to content

Instantly share code, notes, and snippets.

docker run -it verybadsoldier/springrts-build:latest dev -b BAR105-winres2 -p linux-64
./engine/105.1.1-739-ga241485\ bar/spring --isolation --write-dir /home/ak/Documents/Beyond\ All\ Reason --menu="rapid://byar-chobby:test"
@lhog
lhog / COZ profiler by pako
Created January 30, 2022 23:59
COZ profiler by pako
1st add: find_package(coz-profiler), add library dl, include coz.h and COZ_PROGRESS; in gameFrame()
2nd: compile with clang RelwithDebug or maybe gcc with some correct -gdwarf-4 settings
3rd: run: "coz run --- ./spring ./demos/2022xxx.sdfz"
4th: use /skip 10000 to profile synced code and maybe pause to profile drawing
From a6cfcbd9141146a5c84c38182a4cd6086608947e Mon Sep 17 00:00:00 2001
From: You Name <your@example.com>
function widget:GetInfo()
return {
name = "CUS GL4",
author = "ivand",
layer = 0,
enabled = true,
}
end
--inputs
@lhog
lhog / glsl_noise_rand
Last active August 9, 2022 13:26
Some GLSL Random and Noise functions
const float M_PI = 3.1415926535897932384626433832795;
float rand(float p)
{
return fract(sin(p) * 43758.5453123);
}
/*
float rand(vec2 p)
{
return fract(sin(dot(p, vec2(12.9898, 4.1414))) * 43758.5453);
@lhog
lhog / GLSL
Last active January 11, 2024 22:18
UV coordinates of a quad from its 2D coordinate
float cross2d(vec2 v1, vec2 v2) {
return v1.x * v2.y - v1.y * v2.x;
}
// https://www.uio.no/studier/emner/matnat/ifi/nedlagte-emner/INF4360/h10/undervisningsmateriale/bc_lecture.pdf
bool GetQuadUV(vec2 p00, vec2 p10, vec2 p01, vec2 p11, vec2 p, out vec2 uv) {
vec2 a = p00 - p;
vec2 b = p10 - p00;
vec2 c = p01 - p00;
vec2 d = p00 - p10 - p01 + p11;