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
@arielm
arielm / manip1App.cpp
Created June 11, 2011 17:38
Adaptation of "3D manipulation techniques for multitouch displays" to the iPad
#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>
/*
* Copyright 2013, Blender Foundation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
@timshen91
timshen91 / Kahn_algorithm.cc
Last active July 20, 2018 22:19
Kahn's algorithm for topological sort
template<typename NodeRef>
class Graph {
public:
std::vector<NodeRef> allNodes() const;
std::vector<NodeRef> getChildren(NodeRef) const;
};
template<typename NodeRef>
std::vector<NodeRef> TopologicalSort(const Graph<NodeRef>& G) {
std::map<NodeRef, unsigned> RefCount;
@codelynx
codelynx / MTLTexture+Z.swift
Created December 28, 2016 14:58
Piece of Utility code to make CGImage from MTLTexture under (BGRA8Unorm)
//
// MTLTexture+Z.swift
// ZKit
//
// The MIT License (MIT)
//
// Copyright (c) 2016 Electricwoods LLC, Kaz Yoshikawa.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@jcowles
jcowles / FullScreenQuad.shader
Last active January 23, 2023 03:58
Make a standard Unity Quad full-screen, purely in the shader
//
// 1. Add a Quad in Unity
// 2. Parent the quad under camera, to prevent frustum culling.
// 3. Attach this shader.
//
Shader "Quad/Fullscreen"
{
Properties
{
}
@romainguy
romainguy / d_ggx.glsl
Last active October 26, 2023 06:18
D_GGX in mediump/half float
// From https://github.com/google/filament
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:
@dougbinks
dougbinks / ImGuiUtils.h
Created November 18, 2017 13:53
ImGuiUtils.h with TextURL
#pragma once
#include "RuntimeImGui.h"
#include "RuntimeInclude.h"
RUNTIME_MODIFIABLE_INCLUDE;
#include "IconsFontAwesome.h" // from https://github.com/juliettef/IconFontCppHeaders
#include "PlatformUtils.h"
namespace ImGui
@mbinna
mbinna / effective_modern_cmake.md
Last active June 20, 2024 17:15
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@warrenm
warrenm / ARQLThumbnailGenerator.swift
Created June 12, 2018 06:31
Generating thumbnail images of 3D model files for use with AR QuickLook
import Foundation
import SceneKit
class ARQLThumbnailGenerator {
private let device = MTLCreateSystemDefaultDevice()!
/// Create a thumbnail image of the asset with the specified URL at the specified
/// animation time. Supports loading of .scn, .usd, .usdz, .obj, and .abc files,
/// and other formats supported by ModelIO.