Skip to content

Instantly share code, notes, and snippets.

@shelllee
shelllee / imgui_node_graph_test.cpp
Created April 12, 2016 09:50 — forked from ocornut/imgui_node_graph_test.cpp
Node graph editor basic demo for ImGui
// Creating a node graph editor for ImGui
// Quick demo, not production code! This is more of a demo of how to use ImGui to create custom stuff.
// Better version by @daniel_collin here https://gist.github.com/emoon/b8ff4b4ce4f1b43e79f2
// See https://github.com/ocornut/imgui/issues/306
// v0.02
// Animated gif: https://cloud.githubusercontent.com/assets/8225057/9472357/c0263c04-4b4c-11e5-9fdf-2cd4f33f6582.gif
// NB: You can use math functions/operators on ImVec2 if you #define IMGUI_DEFINE_MATH_OPERATORS and #include "imgui_internal.h"
// Here we only declare simple +/- operators so others don't leak into the demo code.
static inline ImVec2 operator+(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x+rhs.x, lhs.y+rhs.y); }
@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)
@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 / trim
Created December 6, 2017 04:05
trim for std::string c++11
// https://stackoverflow.com/questions/216823/whats-the-best-way-to-trim-stdstring
#include <algorithm>
#include <cctype>
#include <locale>
// trim from start (in place)
static inline void ltrim(std::string &s) {
s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](int ch) {
return !std::isspace(ch);
@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 / github.css
Created February 2, 2018 11:18 — forked from andyferra/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 {
/*============================================================================
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
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;
// ==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==
@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).