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
#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>
@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 {
@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 / 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 / modelio.md
Last active December 24, 2021 13:13
Some projects using Model I/O
@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 / cpp14.cpp
Created March 26, 2018 20:30
C++14 & greater
// Convert a timepoint to seconds
MyTimePoint tp = whatever();
double x = std::chrono::time_point_cast<std::chrono::duration<double>>(tp).time_since_epoch().count();
@meshula
meshula / .minttyrc
Created April 17, 2018 22:50
git bash shell colors that are actually visible. put .minttyrc in the bash shell home directory
BoldBlack=128,128,128
Red=255,64,40
BoldRed=255,128,64
Green=64,200,64
BoldGreen=64,255,64
Yellow=190,190,0
BoldYellow=255,255,64
Blue=0,128,255
BoldBlue=128,160,255
Magenta=200,64,255
@meshula
meshula / 3d-formats.md
Last active March 30, 2022 18:45
3d file formats, last mile vs. interchange
@meshula
meshula / file.cmake
Last active January 8, 2019 01:08
cmake namespaced import libraries
# iOS tool chain. there is an android one as well
# https://github.com/SFML/SFML/blob/master/cmake/toolchains/iOS.toolchain.cmake
if(FANCY_FOUND)
add_library(Fancy::Base STATIC IMPORTED)
set_target_properties(Fancy::Base PROPERTIES IMPORTED_CONFIGURATIONS "Debug;Release")
set_target_properties(Fancy::Base PROPERTIES IMPORTED_LOCATION_RELEASE ${Fancy_LIBRARIES})
set_target_properties(Fancy::Base PROPERTIES IMPORTED_LOCATION_DEBUG ${Fancy_DEBUG_LIBRARIES})