Skip to content

Instantly share code, notes, and snippets.

@shakesoda
shakesoda / blur.glsl
Last active January 19, 2017 01:57
noise blur experiment based on https://www.shadertoy.com/view/XtGGzz
#define SPREAD 10.0
#define OFFSET 1.0
vec2 hash23(vec3 p3) {
p3 = fract(p3 * vec3(443.897, 441.423, 437.195));
p3 += dot(p3, p3.yzx+19.19);
return fract(vec2((p3.x + p3.y)*p3.z, (p3.x+p3.z)*p3.y))*2.0-1.0;
}
vec4 sample(vec2 uv, float offset, float n, bool dancing) {
#if VERTEX
$input a_position, a_texcoord0
$output v_texcoord0
#include "common.glsl"
void main() {
v_texcoord0 = a_texcoord0;
gl_Position = mul(u_modelViewProj, vec4(a_position, 1.0));
}
local l3d = require "love3d"
local cpml = require "cpml"
-- ...
function love.draw()
l3d.set_depth_test "less"
love.graphics.setShader(shader)
local w, h = love.graphics.getDimensions()
varying vec3 f_normal;
#ifdef VERTEX
attribute vec3 VertexNormal;
uniform mat4 u_view, u_model, u_projection;
vec4 position(mat4 mvp, vec4 v_position) {
f_normal = (u_model * vec4(VertexNormal, 1.0)).xyz;
return u_projection * u_view * u_model * v_position;
#include "geometry.hpp"
//#include "math.hpp"
namespace math {
inline uint32_t float4_to_rgba8(const float *in_color) {
uint32_t color = 0;
color |= uint32_t(uint8_t(in_color[0] * 255) << 0);
color |= uint32_t(uint8_t(in_color[1] * 255) << 8);
color |= uint32_t(uint8_t(in_color[2] * 255) << 16);
color |= uint32_t(uint8_t(in_color[3] * 255) << 24);
return color;
@shakesoda
shakesoda / vrdata.diff
Created October 7, 2016 19:47
bgfx: expose ovrSession as platform data
diff --git a/include/bgfx/bgfxplatform.h b/include/bgfx/bgfxplatform.h
index f44bb82..497a109 100644
--- a/include/bgfx/bgfxplatform.h
+++ b/include/bgfx/bgfxplatform.h
@@ -82,6 +82,12 @@ namespace bgfx
///
const InternalData* getInternalData();
+ struct VRData
+ {
#include <map>
#include <SDL2/SDL_assert.h>
#include <bx/allocator.h>
#include <iqm.h>
#include "myon.hpp"
#include "mesh.hpp"
#include "fs.hpp"
@shakesoda
shakesoda / anchor.lua
Created August 20, 2015 22:42
Anchor - utilities for screen positioning (with overscan support and centering adjustment)
-- Helper utilities for positioning things relative to screen anchor points and
-- dealing with overscan.
--
-- Use the default instance or make a new one with anchor.new(params) or using
-- anchor(params). You can control X and Y offset and padding for all 4 edges.
--
-- This library does not retain state for screen dimensions, so resizing should
-- be perfectly fine.
local anchor = {}
@shakesoda
shakesoda / en.lua
Last active August 29, 2015 14:27
Some translation utilities for LD33. Uses memoize module if available (I use this: https://github.com/airstruck/knife/blob/master/knife/memoize.lua)
return {
locale = "en",
base = "assets/audio/en",
quotes = { "\"", "\"" },
strings = {
welcome = { text = "Sup" }
hello = { text = "Hello!", audio = "hello.ogg" }
}
}
@shakesoda
shakesoda / banner_wheel.md
Last active August 29, 2015 14:25
some early work in progress stepmania docs for the wiki

Creating a banner wheel

The wheel transform is up to you, buddy.

Files

  • Graphics/MusicWheelItem SectionCollapsed NormalPart
  • Graphics/MusicWheelItem SectionExpanded NormalPart
  • Graphics/MusicWheelItem Song NormalPart
  • Graphics/MusicWheelItem Portal NormalPart
  • Graphics/MusicWheelItem Random NormalPart