Skip to content

Instantly share code, notes, and snippets.

View gamemachine's full-sized avatar

Chris Ochs gamemachine

View GitHub Profile
void ClipBounds(float4 bounds, float2 pos) {
float2 min = bounds.xy;
float2 max = bounds.zw;
float a = step(min.x, pos.x);
float b = step(pos.x, max.x);
float c = step(min.y, pos.y);
float d = step(pos.y, max.y);
clip(3.0f - a - b - c - d);
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace Crest
{
public class BakedOceanDepthCache : MonoBehaviour
{
[SerializeField]
using Unity.Mathematics;
using UnityEngine;
namespace AiGame.Terrains
{
public struct SplatWeights
{
public float Splat0;
public float Splat1;
public float Splat2;
using System;
using Unity.Collections;
using Unity.Mathematics;
namespace AiGame.UnityPhysics
{
public class UnityPhysicsMods
{
public static void AddCommonTypes(RuntimeTypeModel model)
{
model.Add(typeof(float4), false)
.Add(1, "x")
.Add(2, "y")
.Add(3, "z")
.Add(4, "w");
model.Add(typeof(float3), false)
.Add(1, "x")
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
namespace GameCommon.Pooling
{
public class ByteArrayPool
{
private const int MaxArrayLength = 512;
private const int MaxRentTime = 1000; // in milliseconds
using JacksonDunstan.NativeCollections;
using System;
using System.Threading;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
namespace AiGame.Containers
{
public struct NativeMPMCQueue<T> where T : struct
{
public static string GetSerializationPath(string name)
{
return string.Format("{0}/{1}.bin", Application.streamingAssetsPath, name);
}
public static unsafe BlobAssetReference<Collider> DeserializeCollider(string filename, int bytes)
{
string path = GetSerializationPath(filename);
using (StreamBinaryReader reader = new StreamBinaryReader(path, bytes))
using System;
using System.Collections.Generic;
using System.Reflection;
#if !ENABLE_IL2CPP && !NET_STANDARD_2_0
using System.Reflection.Emit;
#endif
namespace AwesomeTechnologies.Utility
using Unity.Collections;
using Unity.Mathematics;
namespace AiGame
{
public struct NativeSpatialGrid
{
private const float Goffset = 10000f;
public int Id;