Skip to content

Instantly share code, notes, and snippets.

View nobnak's full-sized avatar

Nakata Nobuyuki (仲田将之) nobnak

  • teamLab
  • Tokyo, Japan
View GitHub Profile
#ifndef NOISE_SIMPLEX_FUNC
#define NOISE_SIMPLEX_FUNC
/*
Description:
Array- and textureless CgFx/HLSL 2D, 3D and 4D simplex noise functions.
a.k.a. simplified and optimized Perlin noise.
The functions have very good performance
and no dependencies on external data.
@nobnak
nobnak / file0.cs
Created November 30, 2018 07:18
Unity - "NativeArray<T> where T:struct" の要素を "T[] where T:struct" へ高速にコピーする ref: https://qiita.com/nobnak/items/a55385e22758731f4532
public static class Kern32 {
[DllImport("kernel32.dll", EntryPoint = "CopyMemory", SetLastError = false)]
public static extern void CopyMemory(System.IntPtr dest, System.IntPtr src, uint count);
}
@nobnak
nobnak / file0.cs
Last active December 3, 2018 09:19
[Unity] AsyncGPUReadback を利用して、非 Color 形式の Texture からデータを取り出す ref: https://qiita.com/nobnak/items/1a98dcb27e4e58e31979
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
public class AsyncCPUTexture<T> where T:struct {
protected bool active = false;
protected AsyncGPUReadbackRequest req;
protected Vector2Int size;