class final
#include <engine/voxels/model.hpp>
VoxelModel Holds the data loaded from voxel model files, such as Qubicle models.
Constructors, destructors, conversion operators
- VoxelModel() defaulted
- Constructs an empty VoxelModel.
Public functions
- auto gridCount() const -> std::size_t
- Returns the number of grids in the model.
- auto palette() const -> const VoxelPalette&
- Returns the palette of the model.
- auto palette() -> VoxelPalette&
- Returns the palette of the model.
- auto grid(std::size_t index) const -> const VoxelGrid&
- Returns the grid at the given index.
- auto grid(std::size_t index) -> VoxelGrid&
- Returns the grid at the given index.
- auto gridPosition(std::size_t index) const -> glm::ivec3
- Returns the position of the grid at the given index.
- void gridPosition(std::size_t index, glm::ivec3 position)
- Sets the position of the grid at the given index.
-
auto loadFrom(core::
memory:: Stream& stream) -> bool - Loads the voxel model data from the given stream.
-
auto writeTo(core::
memory:: Stream& stream) const -> bool - Writes the VoxelModel's data to the given stream.
Function documentation
std::size_t cubos:: engine:: VoxelModel:: gridCount() const
Returns the number of grids in the model.
Returns | Number of grids. |
---|
const VoxelPalette& cubos:: engine:: VoxelModel:: palette() const
Returns the palette of the model.
Returns | Palette of the model. |
---|
VoxelPalette& cubos:: engine:: VoxelModel:: palette()
Returns the palette of the model.
Returns | Palette of the model. |
---|
glm::ivec3 cubos:: engine:: VoxelModel:: gridPosition(std::size_t index) const
Returns the position of the grid at the given index.
Parameters | |
---|---|
index | Index of the grid. |
Returns | Position of the grid at the given index. |
void cubos:: engine:: VoxelModel:: gridPosition(std::size_t index,
glm::ivec3 position)
Sets the position of the grid at the given index.
Parameters | |
---|---|
index | Index of the grid. |
position | Position to set. |
bool cubos:: engine:: VoxelModel:: loadFrom(core:: memory:: Stream& stream)
Loads the voxel model data from the given stream.
Parameters | |
---|---|
stream | Stream to read from. |
Returns | Whether the stream contained valid data. |
This method reads the voxel model data from a stream in a format compatible with Qubicle files. The method assumes the following structure in the stream: https:/
bool cubos:: engine:: VoxelModel:: writeTo(core:: memory:: Stream& stream) const
Writes the VoxelModel's data to the given stream.
Parameters | |
---|---|
stream | Stream to write to. |
Returns | Whether the write was successful. |
Writes in the format specified in loadFrom.