module voxel.svo.packer

Code for packing voxels into a oct-tree.

Code Map

//! Code for packing voxels into a oct-tree.
module voxel.svo.packer;


//! Packer to randomly add voxels to and then compact into a input buffer.
struct Packer
{
public:
	enum ArrNum;
	enum ArrMask;
	enum ArrLevels;
	enum ColorLevelStart;


public:
	alias ArrType = Input2Cubed;


public:
	fn setup(levels: u32) { }
	fn setup(levels: u32, arr: ArrType[]) { }
	fn add(x: u32, y: u32, z: u32, val: u32) { }
	fn add(morton: u64, value: u32) { }
	//! Compresses the SVO into the given InputBuffer, allows you to add extra
	//! levels.
	fn toBuffer(ib: InputBuffer, totalLevels: u32, repeat: bool) u32 { }
	//! Compresses the SVO into the given InputBuffer.
	fn toBuffer(ib: InputBuffer) u32 { }
}

struct MyPacker
{
public:
	enum TopNum;
	enum TopMask;
	enum TopLevels;
	enum BottomNum;
	enum BottomMask;
	enum BottomLevels;


public:
	alias NumLevels = totalLevels;
	alias TopType = TOP;
	alias BottomType = BOTTOM;


public:
	fn setup(levels: u32) { }
	fn add(x: u32, y: u32, z: u32, val: u32) { }
	fn add(morton: u32, value: u32) { }
	fn toBuffer(ib: InputBuffer) u32 { }
}

fn repackFrom(dst: Input4Cubed, arr: scope (scope (Input2Cubed)[]), start: u32) { }
fn repackFrom(dst: Input8Cubed, arr: scope (scope (Input2Cubed)[]), start: u32) { }
fn genMipmap(src: Input2Cubed) u32 { }
struct Packer

Packer to randomly add voxels to and then compact into a input buffer.

fn toBuffer(ib: InputBuffer, totalLevels: u32, repeat: bool) u32

Compresses the SVO into the given InputBuffer, allows you to add extra levels.

fn toBuffer(ib: InputBuffer) u32

Compresses the SVO into the given InputBuffer.