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 / 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 / NodeGraph.cpp
Created December 13, 2018 21:09 — forked from spacechase0/NodeGraph.cpp
ImGui node graph
#include <any>
#include <cmath>
#include <imgui.h>
#include <imgui_internal.h>
#include "NodeGraph.hpp"
namespace
{
#pragma once
/*
// Example use on Windows with links opening in a browser
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include "Shellapi.h"
inline void LinkCallback( const char* link_, uint32_t linkLength_ )
@meshula
meshula / install_tmux_macos_no_brew.sh
Created February 12, 2020 19:19 — forked from dxps/install_tmux_macos_no_brew.sh
Install TMUX on MacOS without Brew
#!/bin/sh
## setup _________________________________
TMUX_VER=2.9a
LIBEVENT_VER=2.1.11-stable
TEMP_COMPILE=~/tmux-temp-compile
COMMON_INSTALL_PREFIX=/opt
SYMLINK=/usr/local/bin/tmux
@meshula
meshula / install_tmux_macos_no_brew.sh
Created February 12, 2020 19:19 — forked from dxps/install_tmux_macos_no_brew.sh
Install TMUX on MacOS without Brew
#!/bin/sh
## setup _________________________________
TMUX_VER=2.9a
LIBEVENT_VER=2.1.11-stable
TEMP_COMPILE=~/tmux-temp-compile
COMMON_INSTALL_PREFIX=/opt
SYMLINK=/usr/local/bin/tmux
@meshula
meshula / clean_git_repository.bash
Created January 15, 2021 22:54 — forked from ymollard/clean_git_repository.bash
Clean a git repository by deleting history and data of old deleted files
#!/bin/bash
# This script, executed at the root of a git repository, deletes traces of every old file in this repository, index + blob on all branches
# It can take 10-30 minutes to run and will print regular warning stating than some references are unchanged
# time ./clear_git_repositor.bash >cleaning.log
# We need several passes to clean files renamed multiple times (git log --find-renames prevents its deletion for each renaming)
# MAXIMUM_PASSES should be more than the maximum number of renamings/movings for any file, if not then we might keep some traces of former files
MAXIMUM_PASSES=10 # Maximum number of passes
#include <iostream>
#include <assert.h>
#include <vector>
template<class T>
struct Func{};
// std::func replacement without dynamic memory allocation (captures are limited to 48 bytes)
// this could be extended to support captures >48 bytes... of course, with a bit more of logic
// and some state.
@meshula
meshula / dinput8_joystick.cpp
Created May 16, 2021 19:28 — forked from t-mat/dinput8_joystick.cpp
DirectInput Joystick class
#include <windows.h>
#include <stdio.h>
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
#pragma comment(lib, "dinput8.lib")
#pragma comment(lib, "dxguid.lib")
class DiJoyStick {
public: