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
using UnityEngine; | |
using UnityEditor; | |
using System.Reflection; | |
using Type = System.Type; | |
public class InlineCurveEditor | |
{ | |
private object curveEditor; | |
private Type curveType; |
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
#name emoji | |
#subs default | |
#hidden nsfw | |
#class add emoji | |
> +1 #0x1f44d | |
> -1 #0x1f44e | |
> 100 #0x1f4af | |
> 1234 #0x1f522 | |
> 8ball #0x1f3b1 |
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
--math | |
local function length(x, y, z) return sqrt(x*x + y*y + z*z) end | |
local function norm(x, y, z) local l = length(x,y,z) return x/l, y/l, z/l end | |
local function dot(xa, ya, za, xb, yb, zb) return xa*xb + ya*yb + za*zb end | |
--globals | |
local ex, ey, ez = 0, 1, -1.5 --camera position | |
local fov = 90 --camera FOV | |
local tmin, tmax = .1, 100 --minimum and maximum distance from camera | |
local maxSteps = 45 --maximum number of steps to take |
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
shadowMapShader = require('shadowMapShader') | |
lightShader = require('lightShader') | |
light = {x = 256, y = 256, size = 512} | |
local g = love.graphics | |
function love.load() | |
love.window.setMode(512, 512) | |
Wwidth, Wheight = love.window.getDimensions() | |
Xcenter, Ycenter = Wwidth/2, Wheight/2 |
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
extern number testDepth; | |
extern Image depthMap; | |
vec4 effect(vec4 color, Image texture, vec2 tc, vec2 sc) { | |
sc = sc / vec2(1024, 512); // Size of my canvas | |
sc.y = 1 - sc.y; // Flip the y axis | |
vec4 d = Texel(depthMap, sc); | |
// If the sprite's depth is less than the static depth map then hide it | |
if (testDepth < d.r * 256 + d.g * 256 * 256) { |
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
local function deafultSort(a, b) return a > b end | |
function table.insertSort(tbl, func) | |
func = func or deafultSort | |
local len = #tbl | |
for j = 2, len do | |
local key, i = tbl[j], j - 1 | |
while i > 0 and not func(tbl[i], key) do | |
tbl[i + 1] = tbl[i] | |
i = i - 1 | |
end |
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
-- So shaders in love only are applied to drawables, which means you can apply | |
-- diffrent shaders to diffrent sprites, which is nice. Although if you want to | |
-- apply a shader to a whole scene at once, for example a bloom shader, then you | |
-- will have to draw all your sprites to a canvas or image, and then draw that | |
-- composite with the shader. | |
-- Creates a shader with the given vertex and fragment shader source code. I'll | |
-- explain that in more detail later. You want to be caching this shader somewhere | |
-- because it's expensive to create. |
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
template `?.`(a, b): expr = | |
if a != nil: a.b else: nil | |
template `??`(a, b): expr = | |
if a != nil: a else: b |