float rand(float n){return fract(sin(n) * 43758.5453123);}
float noise(float p){
float fl = floor(p);
float fc = fract(p);
return mix(rand(fl), rand(fl + 1.0), fc);
}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private enum Color { Red; Black; } | |
private enum TreeT<T> { | |
Leaf; | |
Node(color: Color, left: TreeT<T>, label: T, right: TreeT<T>); | |
} | |
private class TreeF { | |
private function new() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private enum Color { Red; Black; } | |
private enum TreeT<T> { | |
Leaf; | |
Node(color: Color, left: TreeT<T>, label: T, right: TreeT<T>); | |
} | |
private class TreeF { | |
private function new() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vec4 pack (float depth) | |
{ | |
const vec4 bitSh = vec4(256 * 256 * 256, | |
256 * 256, | |
256, | |
1.0); | |
const vec4 bitMsk = vec4(0, | |
1.0 / 256.0, | |
1.0 / 256.0, | |
1.0 / 256.0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
These are the helper functions to store and to restore a 2D vector with a custom 16 floating point precision in a texture. | |
The 16 bit are used as follows: 1 bit is for the sign, 4 bits are used for the exponent, the remaining 11 bit are for the mantissa. | |
The exponent bias is asymmetric so that the maximum representable number is 2047 (and bigger numbers will be cut) | |
the accuracy from 1024 - 2047 is one integer | |
512-1023 it's 1/2 int | |
256-511 it's 1/4 int and so forth... | |
between 0 and 1/16 the accuracy is the highest with 1/2048 (which makes 1/32768 the minimum representable number) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//============================================================ | |
// | |
// testkey.c - A small utility to analyze SDL keycodes | |
// | |
// Copyright (c) 1996-2010, Nicola Salmoria and the MAME Team. | |
// Visit http://mamedev.org for licensing and usage restrictions. | |
// | |
// SDLMAME by Olivier Galibert and R. Belmont | |
// testkeys by couriersud | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Forward declaration | |
int getWebKeyFromSDLKey(SDLKey key); | |
/// | |
/// Inject an SDL Key Event into a given WebView | |
/// | |
void handleSDLKeyEvent(Awesomium::WebView* webView, const SDL_Event& event) { | |
if (!(event.type == SDL_KEYDOWN || event.type == SDL_KEYUP)) | |
return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System; | |
using System.Text; | |
using System.Collections; | |
using System.Collections.Generic; | |
public class LSystemGenerator : MonoBehaviour | |
{ | |
[Serializable] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Unlit/Transparent Color Gradient" { | |
Properties{ | |
_MainTex("Base (RGB) Trans (A)", 2D) = "white" { } | |
_Color("Color1", Color) = (1.000000,1.000000,1.000000,1.000000) | |
_Color2("Color2", Color) = (1.000000,1.000000,1.000000,1.000000) | |
} | |
SubShader{ | |
LOD 100 | |
Tags{ "QUEUE" = "Transparent" "IGNOREPROJECTOR" = "true" "RenderType" = "Transparent" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Uniform array of 4 vec3 for SH environment lighting | |
// Computed from "Ditch River" (http://www.hdrlabs.com/sibl/archive.html) | |
static const vec3 sphericalHarmonics[4] = { | |
{ 0.754554516862612, 0.748542953903366, 0.790921515418539 }, | |
{ -0.083856548007422, 0.092533500963210, 0.322764661032516 }, | |
{ 0.308152705331738, 0.366796330467391, 0.466698181299906 }, | |
{ -0.188884931542396, -0.277402551592231, -0.377844212327557 } | |
}; | |
// Fragment shader, "n" is the normal at the shading point |
OlderNewer