Skip to content

Instantly share code, notes, and snippets.

@DylanYasen
DylanYasen / FSpriteHolesShader.cs
Created October 4, 2015 15:57 — forked from jpsarda/FSpriteHolesShader.cs
Holes with futile, see usage.cs
public class FSpriteHolesShader : FShader
{
private Texture _hole0Texture=null;
private Vector4 _hole0LocalToUVParams;
private Vector4 _hole0MatrixABCD;
private Vector4 _hole0MatrixTxTy;
private Vector4 _hole0UVRect;
private FSprite _hole0Sprite=null;
static private Vector4 _screenParams;
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
glutInitWindowSize(400, 300);
glutCreateWindow("Hello World");
glutIdleFunc(&update_fade_factor);
glutDisplayFunc(&render);
<?php
class Model
{
public $data;
function __construct()
{
#
}
[
"AlchemistNPC",
"AmmoboxPlus",
"AsphaltPlatforms",
"AutoTrash",
"BannerBonanza",
"BossChecklist",
"Boxinator",
"CalamityMod",
"CheatSheet",
@DylanYasen
DylanYasen / EventManager.cs
Created December 15, 2019 04:30
TypeSafe/ThreadSafe Event Manager
using System;
using System.Collections.Concurrent;
using UnityEngine;
public class Event
{
public uint ID;
};
public delegate void EventDelegate<E>(E payload) where E : Event;
class AbilitySelectedEvent : Event
{
public uint abilityId;
public uint playerId;
}
// registering
EventManager eventManager;
eventManager.RegisterForEvent<AbilitySelectedEvent>(this, (AbilitySelectedEvent payload) =>
{
vec4 fragPosLightSpace = lightSpaceMatrix * worldPos;
float visibility = 1.0 - calcShadow(fragPosLightSpace);
vec3 rgb = emissive + (ambient + visibility * (diffuse + specular)) * color;
float calcShadow(vec4 fragPosLightSpace)
{
vec3 screenSpacePos = fragPosLightSpace.xyz / fragPosLightSpace.w;
float bias = 0.005;
float fragDepth = screenSpacePos.z - 0.005;