Skip to content

Instantly share code, notes, and snippets.

// 64-bit popcount helper
uint CountBits(uint64_t x)
{
return countbits(uint(x)) + countbits(uint(x >> 32));
}
class TreeNode64
{
uint64_t childMask; // 64 bits: one bit per possible child (0-63)
MODES
{
Default();
}
CS
{
#include "common.fxc"
#include "postprocess/shared.hlsl"
using System;
using Sandbox;
using Sandbox.Utility;
/// <summary>
/// Procedurally builds a 3‑dimensional Perlin noise volume texture for use in materials and shaders.
/// </summary>
public sealed class PerlinVolumeTexture
{
/// <summary>Width of the 3D texture in voxels.</summary>
struct VitaminMeshHeader_t
{
uint magic; // 'VMSH'
byte version; // 0x01
uint nVertexFlags; // VERTEX_POSITION, VERTEX_NORMAL, etc
uint nVertexSize; // size of each vertex in bytes
byte nNumLods;
}
struct VitaminLodMeshHeader_t