Skip to content

Instantly share code, notes, and snippets.

View phamtanlong's full-sized avatar

Pham Tan Long phamtanlong

View GitHub Profile
@phamtanlong
phamtanlong / SSE_Download_Handler.md
Created October 22, 2024 14:35 — forked from prodigga/SSE_Download_Handler.md
SSE's (Server-Sent Events) Download Handler

Whats this?

This is a custom UnityWebRequest Download Handler to support SSE's (Server-Sent Events) in Unity!

How to use it

Simply inhert SseDownloadHandlerBase and supply your own logic (Deserialise incoming lines, expose events, etc).

Then set the download handler to be an instance of your class.

webRequest.downloadHandler = new LogSseExampleDownloadHandler();
@phamtanlong
phamtanlong / BlendModes.c
Created August 19, 2019 03:49 — forked from elringus/BlendModes.c
Popular blend modes algorithms implemented in Cg.
fixed G (fixed4 c) { return .299 * c.r + .587 * c.g + .114 * c.b; }
fixed4 Darken (fixed4 a, fixed4 b)
{
fixed4 r = min(a, b);
r.a = b.a;
return r;
}
fixed4 Multiply (fixed4 a, fixed4 b)