Skip to content

Instantly share code, notes, and snippets.

@shelllee
shelllee / CustomUnityRender.cs
Created August 31, 2023 03:32 — forked from Slaynash/CustomUnityRender.cs
Custom Unity render loop, drawing a magenta quad at 0,0 of 400x400px (hardcoded offsets for Unity 2018.4.23f1)
private delegate void PerformMainLoop(/* HWND__* */ IntPtr param_1, uint param_2, uint param_3, ulong param_4); // These parameters may be inaccurate
private delegate GfxDevice GetGfxDevice();
private delegate IntPtr GetIVRDevice();
private delegate void SetupPixelCorrectCoordinates(bool _0);
private static IntPtr GetFunctionPointerFromMethod(string methodName) =>
typeof(CustomUnityRender).GetMethod(methodName, BindingFlags.NonPublic | BindingFlags.Static).MethodHandle.GetFunctionPointer();
internal static void Init()
{
@shelllee
shelllee / PieMenu.cpp
Created February 17, 2023 05:32 — forked from thennequin/PieMenu.cpp
PieMenuAdv
struct PieMenuContext
{
static const int c_iMaxPieMenuStack = 8;
static const int c_iMaxPieItemCount = 12;
static const int c_iRadiusEmpty = 30;
static const int c_iRadiusMin = 30;
static const int c_iMinItemCount = 3;
static const int c_iMinItemCountPerLevel = 3;
struct PieMenu
@shelllee
shelllee / MinRepo.hlsl
Created January 10, 2023 16:02 — forked from iondune/MinRepo.hlsl
Short HLSL shader that causes an internal compiler error
int solve(float x)
{
if (x < 0)
{
return 0;
}
// 1>MinRepo.hlsl(7,2): warning X4000: use of potentially uninitialized variable (solve)
// 1>error X8000 : D3D11 Internal Compiler error : Invalid Bytecode: Negate modifier not allowed for operand #4 of opcode #6 (counts are 1-based).
// ==UserScript==
// @name ucas-course-console-helper
// @namespace https://les1ie.com/
// @version 0.2
// @description 去除中国科学院大学课程网站对进入控制台的限制
// @author Les1ie
// @match https://course.ucas.ac.cn/portal/*
// @grant none
// ==/UserScript==
using UnityEngine;
using UnityEngine.Rendering;
using Unity.Mathematics;
[RequireComponent(typeof(Camera))]
public class Draw : MonoBehaviour
{
[SerializeField] public Mesh Mesh;
[SerializeField] public Material Material;
private Camera mainCamera;
/*============================================================================
NVIDIA FXAA 3.11 by TIMOTHY LOTTES
------------------------------------------------------------------------------
COPYRIGHT (C) 2010, 2011 NVIDIA CORPORATION. ALL RIGHTS RESERVED.
------------------------------------------------------------------------------
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED
@shelllee
shelllee / github.css
Created February 2, 2018 11:18 — forked from theconektd/github.css
Github Markdown CSS - for Markdown Editor Preview
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
@shelllee
shelllee / .gitattributes
Created January 3, 2018 08:41 — forked from nemotoo/.gitattributes
.gitattributes for Unity3D with git-lfs
## Unity ##
*.cs diff=csharp text
*.cginc text
*.shader text
*.mat merge=unityyamlmerge eol=lf
*.anim merge=unityyamlmerge eol=lf
*.unity merge=unityyamlmerge eol=lf
*.prefab merge=unityyamlmerge eol=lf
@shelllee
shelllee / SpiralBlurCustomDepth
Created November 14, 2017 11:20 — forked from tomlooman/SpiralBlurCustomDepth
Spiral Blur modified to sample Custom depth buffer for soft object outlines.
float3 CurColor=0;
float2 NewUV = UV;
int i=0;
float StepSize = Distance / (int) DistanceSteps;
float CurDistance=0;
float2 CurOffset=0;
float SubOffset = 0;
float TwoPi = 6.283185;
float accumdist=0;
@shelllee
shelllee / ASMutator_WeaponReplacement.cpp
Created November 14, 2017 10:01 — forked from tomlooman/ASMutator_WeaponReplacement.cpp
Test Gist: ASMutator_WeaponReplacement
bool ASMutator_WeaponReplacement::CheckRelevance_Implementation(AActor* Other)
{
ASWeaponPickup* WeaponPickup = Cast<ASWeaponPickup>(Other);
if (WeaponPickup)
{
for (int32 i = 0; i < WeaponsToReplace.Num(); i++)
{
const FReplacementInfo& Info = WeaponsToReplace[i];
if (Info.FromWeapon == WeaponPickup->WeaponClass)