Skip to content

Instantly share code, notes, and snippets.

View ctzcs's full-sized avatar
🎯
Focusing

tianwen ctzcs

🎯
Focusing
View GitHub Profile
@ctzcs
ctzcs / Shaders.md
Created April 29, 2025 09:03 — forked from wolfired/Shaders.md
Unity Shader

HLSL

在Unity中,你使用 HLSL 编程语言编写 shader program

本节只包含 HLSL 的Unity特有用法。更通用的 HLSL 用法请查阅 Microsoft’s HLSL documentation

注意:Unity最初使用 CG 语言,因此一些Unity关键字(如: CGPROGRAM )和文件扩展名(如: .cginc )包含 cg/CG 。当前Unity已不再使用 CG ,但这些命名依然保留。

HLSL 有两种语法:

@ctzcs
ctzcs / 80-ECS__Component-NewComponent.cs.txt
Last active September 10, 2025 08:50
Unity DragonEcs Template
using DCFApixels.DragonECS;
#if ENABLE_IL2CPP
using Unity.IL2CPP.CompilerServices;
[Il2CppSetOption(Option.NullChecks, false)]
[Il2CppSetOption(Option.ArrayBoundsChecks, false)]
#endif
[System.Serializable]
public struct #SCRIPTNAME#:IEcsComponent
{
}
@ctzcs
ctzcs / ComponentTemplate.cs
Last active June 13, 2024 17:32
DragonEcs Template
class $COMPONENT$Template:ComponentTemplate<$COMPONENT$>{}
import taichi as ti
ti.init(arch=ti.gpu)
n = 320
pixels = ti.field(dtype=float, shape=(n * 2, n))
@ti.func
def complex_sqr(z):
return ti.Vector([z[0]**2 - z[1]**2, z[1] * z[0] * 2])