Skip to content

Instantly share code, notes, and snippets.

View alaingalvan's full-sized avatar
Resident Latte Graphics Engineer. 👍

Alain Galvan alaingalvan

Resident Latte Graphics Engineer. 👍
View GitHub Profile
@pixelsnafu
pixelsnafu / CloudsResources.md
Last active May 2, 2024 13:46
Useful Resources for Rendering Volumetric Clouds

Volumetric Clouds Resources List

  1. A. Schneider, "Real-Time Volumetric Cloudscapes," in GPU Pro 7: Advanced Rendering Techniques, 2016, pp. 97-127. (Follow up presentations here, and here.)

  2. S. Hillaire, "Physically Based Sky, Atmosphere and Cloud Rendering in Frostbite" in Physically Based Shading in Theory and Practice course, SIGGRAPH 2016. [video] [course notes] [scatter integral shadertoy]

  3. [R. Högfeldt, "Convincing Cloud Rendering – An Implementation of Real-Time Dynamic Volumetric Clouds in Frostbite"](https://odr.chalmers.se/hand

@cecilemuller
cecilemuller / marmoset-material-fields.md
Last active January 2, 2022 04:08
Marmoset Toolbag: Shader subroutine fields
@shafik
shafik / WhatIsStrictAliasingAndWhyDoWeCare.md
Last active May 2, 2024 15:08
What is Strict Aliasing and Why do we Care?

What is the Strict Aliasing Rule and Why do we care?

(OR Type Punning, Undefined Behavior and Alignment, Oh My!)

What is strict aliasing? First we will describe what is aliasing and then we can learn what being strict about it means.

In C and C++ aliasing has to do with what expression types we are allowed to access stored values through. In both C and C++ the standard specifies which expression types are allowed to alias which types. The compiler and optimizer are allowed to assume we follow the aliasing rules strictly, hence the term strict aliasing rule. If we attempt to access a value using a type not allowed it is classified as undefined behavior(UB). Once we have undefined behavior all bets are off, the results of our program are no longer reliable.

Unfortunately with strict aliasing violations, we will often obtain the results we expect, leaving the possibility the a future version of a compiler with a new optimization will break code we th

@twoscomplement
twoscomplement / TransientFunction.h
Last active August 19, 2023 08:32
TransientFunction: A light-weight alternative to std::function [C++11]
// TransientFuction: A light-weight alternative to std::function [C++11]
// Pass any callback - including capturing lambdas - cheaply and quickly as a
// function argument
//
// Based on:
// https://deplinenoise.wordpress.com/2014/02/23/using-c11-capturing-lambdas-w-vanilla-c-api-functions/
//
// - No instantiation of called function at each call site
// - Simple to use - use TransientFunction<> as the function argument
// - Low cost: cheap setup, one indirect function call to invoke
@mbinna
mbinna / effective_modern_cmake.md
Last active May 3, 2024 15:44
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

tracked npm

@tracked is a decorator for Preact that makes working with state values no different than properties on your component instance.

It's one 300 byte function that creates a getter/setter alias into state/setState() for a given key, with an optional initial value. The "magic" here is simply that it works as a property decorator rather than a function, so it appears to integrate directly into the language.

tracked has no dependencies and works with any component implementation that uses this.state and this.setState().

Installation

// routes.js
const routes = [
{
path: '/',
component: Home,
exact: true
},
{
path: '/gists',
component: Gists
@mdo
mdo / 00-intro.md
Last active March 24, 2024 08:04
Instructions for how to affix an Ikea Gerton table top to the Ikea Bekant sit-stand desk frame.

Ikea Bekant standing desk with Gerton table top

@eonist
eonist / TranslucentWin.swift
Created January 27, 2016 14:09
Translucent NSWindow Example
class TranslucentWin:NSWindow, NSApplicationDelegate, NSWindowDelegate{
/**
*
*/
override init(contentRect: NSRect, styleMask aStyle: Int, backing bufferingType: NSBackingStoreType, `defer` flag: Bool) {
super.init(contentRect: Win.sizeRect, styleMask: NSTitledWindowMask|NSResizableWindowMask|NSMiniaturizableWindowMask|NSClosableWindowMask|NSFullSizeContentViewWindowMask, backing: NSBackingStoreType.Buffered, `defer`: false)
self.contentView!.wantsLayer = true;/*this can and is set in the view*/
self.backgroundColor = NSColor.greenColor().alpha(0.2)
self.opaque = false
self.makeKeyAndOrderFront(nil)//moves the window to the front
@maisano
maisano / RouteTransition.jsx
Last active September 15, 2023 07:29
Using react-motion with react-router
import React, { PropTypes } from 'react';
import { TransitionMotion, spring } from 'react-motion';
/**
* One example of using react-motion (0.3.0) within react-router (v1.0.0-rc3).
*
* Usage is simple, and really only requires two things–both of which are
* injected into your app via react-router–pathname and children:
*
* <RouteTransition pathname={this.props.pathname}>