Skip to content

Instantly share code, notes, and snippets.

View TrentSterling's full-sized avatar
:octocat:
wew

Trent TrentSterling

:octocat:
wew
View GitHub Profile
@TrentSterling
TrentSterling / OptimalSpatialHashing.cs
Created October 6, 2024 19:03 — forked from adammyhre/OptimalSpatialHashing.cs
Unity Spatial Hashing with Jobs and Burst
using System;
using Unity.Burst;
using Unity.Collections;
using Unity.Jobs;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class OptimalSpatialHashing : MonoBehaviour {
@TrentSterling
TrentSterling / greedyvoxelmeshing
Created September 5, 2024 20:29 — forked from Vercidium/greedyvoxelmeshing
Greedy Voxel Meshing ported to C#
// Code ported from https://0fps.net/2012/06/30/meshing-in-a-minecraft-game/
// Note this implementation does not support different block types or block normals
// The original author describes how to do this here: https://0fps.net/2012/07/07/meshing-minecraft-part-2/
const int CHUNK_SIZE = 32;
// These variables store the location of the chunk in the world, e.g. (0,0,0), (32,0,0), (64,0,0)
@TrentSterling
TrentSterling / DoomGlow.cs
Created November 11, 2022 07:37 — forked from TiliSleepStealer/DoomGlow.cs
Doom glow - fake volumetric light glow effect in Unity by Tili_us
// This file is in the public domain. Where
// a public domain declaration is not recognized, you are granted
// a license to freely use, modify, and redistribute this file in
// any way you choose.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// Unity remake of a fake volumetric light glow effect
/*
A simple little editor extension to copy and paste all components
Help from http://answers.unity3d.com/questions/541045/copy-all-components-from-one-character-to-another.html
license: WTFPL (http://www.wtfpl.net/)
author: aeroson
advise: ChessMax
editor: frekons
*/
#if UNITY_EDITOR
@TrentSterling
TrentSterling / StandardSurfaceShaderWithVertexColor.shader
Created September 13, 2022 06:43 — forked from phest/StandardSurfaceShaderWithVertexColor.shader
unity standard shader modified to display vertex colors
Shader "Custom/StandardSurfaceShaderWithVertexColor" {
Properties {
_MainTint("Global Color Tint", Color) = (1,1,1,1)
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Lambert vertex:vert
@TrentSterling
TrentSterling / AnimMath.cs
Created August 9, 2022 20:11 — forked from nickworks/AnimMath.cs
A set of low-level functions for procedural animation.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// A set of easy-to-implement animation functions. Compiled by Nick Pattison.
/// </summary>
public static class AnimMath {
/// <summary>
/// A function for lerping between 2 values. Yes, Unity has this Mathf.Lerp() and Vector3.Lerp(),
@TrentSterling
TrentSterling / QuaternionUtil.cs
Created May 27, 2022 01:37 — forked from maxattack/QuaternionUtil.cs
Some Helper Methods for Quaternions in Unity3D
using UnityEngine;
/*
Copyright 2016 Max Kaufmann ([email protected])
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// Made with Amplify Shader Editor
// Available at the Unity Asset Store - http://u3d.as/y3X
Shader "Unlit/Directional Tint"
{
Properties
{
_MainTex("MainTex", 2D) = "white" {}
_Color("Color", Color) = (1,1,1,1)
_ColorA("ColorA", Color) = (1,1,1,1)
_ColorB("ColorB", Color) = (1,1,1,1)
@TrentSterling
TrentSterling / KdTree.cs
Created October 26, 2021 06:57 — forked from ditzel/KdTree.cs
k-d Tree
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Profiling;
public class KdTree<T> : IEnumerable<T>, IEnumerable where T : Component
{
protected KdNode _root;
protected KdNode _last;
@TrentSterling
TrentSterling / quest-capture-fix.sh
Created October 14, 2021 18:04 — forked from d12/quest-capture-fix.sh
Widen Oculus Quest recording capture size
set -e
adb shell setprop debug.oculus.capture.width 1280
adb shell setprop debug.oculus.textureWidth 1280
adb shell setprop debug.oculus.capture.height 720
adb shell setprop debug.oculus.capture.bitrate 10000000
adb shell setprop debug.oculus.foveation.level 0
adb shell setprop debug.oculus.capture.fps 60