OrbitEngine::Misc::Packer2D class

Pack 2D rectangles optimally.

Contents

Public static functions

static auto Pack(std::vector<Packeable2D*>& rects, int max_side, unsigned int& out_width, unsigned int& out_height, int discardStep = 1) -> bool
Pack rects using blackpawn's lightmap packing algorithm.

Function documentation

static bool OrbitEngine::Misc::Packer2D::Pack(std::vector<Packeable2D*>& rects, int max_side, unsigned int& out_width, unsigned int& out_height, int discardStep = 1)

Pack rects using blackpawn's lightmap packing algorithm.

Parameters
rects in The rects to pack, each must have width and height assigned
max_side in Maximum allowed size
out_width out Dimensions of the resulting map
out_height out Dimensions of the resulting map
discardStep
Returns Whether the algorithm succeeded to pack all the rects

You may not want to call this function actively during runtime as it can be expensive