This file contains hidden or 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
/// <summary> | |
///Returns a random object from the array with probabilities | |
///</summary> | |
/// <param name="prob">the probability of being chosen for each value in the array, their sum must be <= 1</param> | |
public static T ChooseWithProbabilities<T>(float[] prob,params T[] array) | |
{ | |
float rn = RNG.Randf(); | |
int len = array.Length; | |
float[][] intervals = new float[len][]; | |
if (len != prob.Length || len == 0) |
This file contains hidden or 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_type canvas_item; | |
uniform vec2 texelsPerPixel = vec2(1.5,1.5); | |
void fragment() | |
{ | |
vec2 uv = SCREEN_UV/SCREEN_PIXEL_SIZE; | |
vec2 locationWithinTexel = fract(uv); | |
vec2 interpolationAmount = clamp(locationWithinTexel/texelsPerPixel ,0 , 0.5) | |
+ clamp( (locationWithinTexel - 1.0) / (texelsPerPixel + .5), 0, 0.5); |