Skip to content

Instantly share code, notes, and snippets.

@Hebali
Hebali / CacheManager.hpp
Last active June 25, 2017 19:36
Singleton Cache Manager Using Custom Smart Pointer Deleters
/*
CONCEPT SKETCH:
Singleton Cache Manager Using Custom Smart Pointer Deleters
by Patrick Hebron
*/
#include <iostream>
#include <memory>
#include <map>
@Hebali
Hebali / GlslPassthrough.vert
Created January 12, 2017 17:28
GLSL Vertex Shader: Default Passthrough
// Default Passthrough
// GLSL Vertex Shader
// Implementation by Patrick Hebron
void main()
{
gl_FrontColor = gl_Color;
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_Position = ftransform();
}
@Hebali
Hebali / GlslSobel.frag
Created January 12, 2017 17:25
GLSL Fragment Shader: Sobel Edge Detection
// Sobel Edge Detection Filter
// GLSL Fragment Shader
// Implementation by Patrick Hebron
uniform sampler2D texture;
uniform float width;
uniform float height;
void make_kernel(inout vec4 n[9], sampler2D tex, vec2 coord)
{
@Hebali
Hebali / PIMPL Idiom Example
Last active August 29, 2015 14:15
PIMPL Idiom in C++
// PIMPL Idiom
// Example by Patrick Hebron
#include <memory>
#include <string>
#include <iostream>
/** @brief templated pimpl wrapper */
template <typename Impl> class pimpl_t {
public:
@Hebali
Hebali / RTTI Type Traits Example
Last active August 29, 2015 14:15
RTTI type traits in C++
// RTTI Type Traits
// Example by Patrick Hebron
template <typename T> struct TypeTraits
{
static const char* name() { return "TYPE_NAME"; }
};
struct Base
{
@Hebali
Hebali / GLSL Image Filters
Last active July 7, 2021 12:59
Quick GLSL sketch heading towards a more generalized tool...
// GLSL Image Filters
// Curated by Patrick Hebron
// Influences:
// http://thndl.com
// https://gist.github.com/BlackBulletIV/4218802
// http://mouaif.wordpress.com/?p=94
uniform sampler2D tex;