Skip to content

Instantly share code, notes, and snippets.

View meshula's full-sized avatar
💭
Exploring liminal spaces

Nick Porcino meshula

💭
Exploring liminal spaces
View GitHub Profile
@meshula
meshula / voidnotvoid.h
Last active January 26, 2018 20:29
template trait to discover if a return value is void
#include <iostream>
#include <functional>
void f() {}
void g(int) {}
void h(int*,char&) {}
void i(float,bool) {}
void j(const char *const) {}
void k(void()) {}
int l() { return {}; }
@meshula
meshula / modelio.md
Last active August 10, 2024 09:25
Some projects using Model I/O
@meshula
meshula / ImguiMayaStyle.cpp
Created December 11, 2017 18:51 — forked from ongamex/ImguiMayaStyle.cpp
ImGui style that look like Maya
ImGuiStyle& style = ImGui::GetStyle();
style.ChildWindowRounding = 3.f;
style.GrabRounding = 0.f;
style.WindowRounding = 0.f;
style.ScrollbarRounding = 3.f;
style.FrameRounding = 3.f;
style.WindowTitleAlign = ImVec2(0.5f,0.5f);
style.Colors[ImGuiCol_Text] = ImVec4(0.73f, 0.73f, 0.73f, 1.00f);
@meshula
meshula / d_ggx.glsl
Created September 6, 2017 04:30 — forked from romainguy/d_ggx.glsl
D_GGX in mediump/half float
float D_GGX(float linearRoughness, float NoH, const vec3 h) {
// Walter et al. 2007, "Microfacet Models for Refraction through Rough Surfaces"
// In mediump, there are two problems computing 1.0 - NoH^2
// 1) 1.0 - NoH^2 suffers floating point cancellation when NoH^2 is close to 1 (highlights)
// 2) NoH doesn't have enough precision around 1.0
// Both problem can be fixed by computing 1-NoH^2 in highp and providing NoH in highp as well
// However, we can do better using Lagrange's identity:
// ||a x b||^2 = ||a||^2 ||b||^2 - (a . b)^2
@meshula
meshula / EntitySystem.cpp
Created July 20, 2014 20:53
Entity System sketch
#include <unordered_map>
using namespace std;
// EntityIds are globally unique and do not get recycled.
typedef int EntityId;
const EntityId null_entity = 0;
class EntitySubSystem {
#include "cinder/app/AppCocoaTouch.h"
#include "cinder/app/Renderer.h"
#include "cinder/Camera.h"
#include "cinder/CinderResources.h"
#include "cinder/ImageIo.h"
#include "cinder/gl/Texture.h"
#include <vector>
#include <map>
#include <list>