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
// read the PDF about this if you precompute it! it's got helpful info! | |
// can be optimized into lut (compute can gen it) | |
float GTTonemap(float x) { | |
float m = 0.22; // linear section start | |
float a = 1.0; // contrast | |
float c = 1.33; // black brightness | |
float P = 1.0; // maximum brightness | |
float l = 0.4; // linear section length | |
float l0 = ((P-m)*l) / a; // 0.312 |
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
#version 330 | |
in vec2 uv; | |
in vec3 diffuse; | |
in vec3 specular; | |
in vec2 color_mixes; // x=diffuse mix, y=specular mix | |
out vec4 outColor; | |
uniform sampler2D texture0; |
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
// cofactor matrix. drop-in replacement for the traditional transpose(inverse(m)) normal matrix calculation. | |
// this is a substantial performance improvement. | |
// short form found via shadertoy: https://www.shadertoy.com/view/3s33z | |
mat3 cofactor(mat4 m) { | |
return mat3( | |
cross(m[1].xyz, m[2].xyz), | |
cross(m[2].xyz, m[0].xyz), | |
cross(m[0].xyz, m[1].xyz) | |
); | |
} |
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
local start_time = love.filesystem.getLastModified("main.lua") | |
function love.update(dt) | |
if (love.filesystem.getLastModified("main.lua") > start_time) then | |
love.event.quit("restart") | |
end | |
end | |
local function round(value, precision) | |
if precision then return round(value / precision) * precision end |
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
#include <imgui/imgui.h> | |
#include <SDL2/SDL_syswm.h> | |
#include "myon/imgui.hpp" | |
#include "myon/window.hpp" | |
#include "myon/timer.hpp" | |
#include "myon/cache.hpp" | |
#include "math/matrix.hpp" | |
#include <bgfx/bgfx.h> | |
#include <imgui/imgui_demo.cpp> | |
#include <imgui/imgui_lua_bindings.cpp> |
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
#ifndef KAGUYA_LUABINDING_HPP_INCLUDED | |
#define KAGUYA_LUABINDING_HPP_INCLUDED | |
// Copyright satoren | |
// Distributed under the Boost Software License, Version 1.0. (See | |
// accompanying file LICENSE_1_0.txt or copy at | |
// http://www.boost.org/LICENSE_1_0.txt) | |
// Copyright satoren | |
// Distributed under the Boost Software License, Version 1.0. (See |
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
#include <lua.hpp> | |
#include "kaguya.hpp" | |
#include "pecs.hpp" | |
using namespace pecs; | |
using namespace std; | |
enum { | |
// NB: component 0 can't be used. | |
COMPONENT_NONE = ~0, |
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
#include <lua.hpp> | |
#include <cstdint> | |
#include <vector> | |
#include "kaguya.hpp" | |
#include "pecs.hpp" | |
using namespace std; | |
using namespace pecs; | |
#define GENERATE_COMPONENT(ENUM, TYPE, NAME) \ |
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
-- Basic ring buffer utility, to spare the hassle. | |
local ringbuffer = {} | |
local ringbuffer_mt = {} | |
local function new(_items) | |
local t = { | |
items = _items or {}, | |
current = 1 | |
} | |
return setmetatable(t, ringbuffer_mt) |
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
--- ...snip... | |
if not headless then | |
require "love.system" | |
require "love.window" | |
end | |
local flags = { | |
width = 1280, | |
height = 720, | |
highdpi = true, |
NewerOlder