module voxel.svo.input

Code Map

module voxel.svo.input;


//! Select the default input buffer.
alias InputBuffer = LinearBuffer;

struct Input2Cubed
{
public:
	enum Pow;
	enum Size;
	enum ElementsNum;
	enum XStride;
	enum YStride;
	enum ZStride;
	enum FlagsNumBits;
	enum FlagsNum;


public:
	alias ElementsType = u32;
	alias FlagsType = u8;


public:
	union U
	{
	public:
		_pad: u32;
		flags: FlagsType[1];
	}


public:
	u: U;
	data: ElementsType[8];


public:
	fn getBit(index: u32) bool { }
	fn set(index: u32, d: u32) { }
	fn set(x: u32, y: u32, z: u32, d: u32) { }
	fn reset() { }
	fn dumpBits() { }


public:
	static fn indexOf(x: u32, y: u32, z: u32) u32 { }
}

struct Input4Cubed
{
public:
	enum Pow;
	enum Size;
	enum ElementsNum;
	enum XStride;
	enum YStride;
	enum ZStride;
	enum FlagsNumBits;
	enum FlagsNum;


public:
	alias ElementsType = u32;
	alias FlagsType = u8;


public:
	union U
	{
	public:
		_pad: u32;
		flags: FlagsType[8];
	}


public:
	u: U;
	data: ElementsType[64];


public:
	fn getBit(index: u32) bool { }
	fn set(index: u32, d: u32) { }
	fn set(x: u32, y: u32, z: u32, d: u32) { }
	fn reset() { }
	fn dumpBits() { }


public:
	static fn indexOf(x: u32, y: u32, z: u32) u32 { }
}

struct Input8Cubed
{
public:
	enum Pow;
	enum Size;
	enum ElementsNum;
	enum XStride;
	enum YStride;
	enum ZStride;
	enum FlagsNumBits;
	enum FlagsNum;


public:
	alias ElementsType = u32;
	alias FlagsType = u8;


public:
	union U
	{
	public:
		_pad: u32;
		flags: FlagsType[64];
	}


public:
	u: U;
	data: ElementsType[512];


public:
	fn getBit(index: u32) bool { }
	fn set(index: u32, d: u32) { }
	fn set(x: u32, y: u32, z: u32, d: u32) { }
	fn reset() { }
	fn dumpBits() { }


public:
	static fn indexOf(x: u32, y: u32, z: u32) u32 { }
}

struct LinearBuffer
{
public:
	enum BitsPerFlag;
	enum FlagsNum2;
	enum FlagsNum4;
	enum FlagsNum8;
	enum FlagsNum2And4;
	enum FlagsNum2And8;
	enum MaxNum2;
	enum MaxNum4;
	enum MaxNum2And4;
	enum MaxNum2And8;
	enum FlagsNum2Cubed;
	enum FlagsNum4Cubed;
	enum FlagsNum8Cubed;


public:
	base: Base;


public:
	fn setup(numReserved: u32) { }
	fn getData() void[] { }
	fn compressAndAdd(box2: Input2Cubed) u32 { }
	fn compressAndAdd(box4: Input4Cubed) u32 { }
	fn compressAndAdd(box2: Input2Cubed, box4: Input4Cubed) u32 { }
	fn compressAndAdd(box2: Input2Cubed, box8: Input8Cubed) u32 { }
}

struct BuddyBuffer
{
public:
	enum BitsPerFlag;
	enum FlagsNum2;
	enum FlagsNum4;
	enum FlagsNum8;
	enum FlagsNum2And4;
	enum FlagsNum2And8;
	enum MaxNum2;
	enum MaxNum4;
	enum MaxNum2And4;
	enum MaxNum2And8;
	enum FlagsNum2Cubed;
	enum FlagsNum4Cubed;
	enum FlagsNum8Cubed;


public:
	base: Base;


public:
	fn setup(numReserved: u32) { }
	fn getData() void[] { }
	fn compressAndAdd(box2: Input2Cubed) u32 { }
	fn compressAndAdd(box4: Input4Cubed) u32 { }
	fn compressAndAdd(box2: Input2Cubed, box4: Input4Cubed) u32 { }
	fn compressAndAdd(box2: Input2Cubed, box8: Input8Cubed) u32 { }
}

struct InputBuddy
{
public:
	enum MinOrder;
	enum MaxOrder;
	enum LargestOrder;
	enum NumLevels;
	enum NumBitsPerElm;
	enum NumBits;
	enum NumElems;


public:
	fn setup() { }
	fn reserveStart(n: size_t) { }
	fn canAlloc(order: size_t) bool { }
	fn alloc(order: size_t) size_t { }
	fn free(order: size_t, n: size_t) { }
}

//! Caching input buffer to build SVOs, is more designed for live updating
//! then space size, so wastes memory.
struct BuddyAdder
{
public:
	fn setup(numReserved: u32) { }
	//! Returns the entire data buffer as void array.
	fn takeMemory(count: u32) u32[] { }
	//! Small helper to add a single u32 value.
	fn add(v: u32) u32 { }
	//! Adds data into the buffer and returns the index to it.
	fn add(data: scope (const(scope (u32)[])) u32 { }
}
alias InputBuffer

Select the default input buffer.

struct BuddyAdder

Caching input buffer to build SVOs, is more designed for live updating then space size, so wastes memory.

fn takeMemory(count: u32) u32[]

Returns the entire data buffer as void array.

fn add(v: u32) u32

Small helper to add a single u32 value.

fn add(data: scope (const(scope (u32)[])) u32

Adds data into the buffer and returns the index to it.

If there is data inside of the buffer that matches the contents, it will point to it instead.