Toast Engine
Loading...
Searching...
No Matches
toast::VoxelNode Class Reference

#include <voxel_node.hpp>

Inheritance diagram for toast::VoxelNode:
Collaboration diagram for toast::VoxelNode:

Classes

struct  ActiveContact
struct  PendingEvents

Public Member Functions

 VoxelNode ()=default
 VoxelNode (assets::Handle< assets::VoxelModel > model)
auto getModel () const -> const assets::Handle< assets::VoxelModel > &
auto getModel () -> assets::Handle< assets::VoxelModel > &
void setModel (assets::Handle< assets::VoxelModel > model)
auto getPalette () const -> const assets::Handle< assets::VoxelPalette > &
void setPalette (assets::Handle< assets::VoxelPalette > palette)
auto paletteUid () const -> uint64_t
auto resolvedModel () const -> const assets::VoxelModel *
auto resolvedPalette () -> const voxel::Palette *
auto resolvedMaterialLibrary () -> const voxel::MaterialLibrary *
auto getVoxel (glm::vec3 pos) -> int
auto getSize () -> glm::vec3
auto getBounds () -> std::vector< glm::vec3 >
auto getVoxelCount () -> int
auto worldToVoxel (glm::vec3 pos) -> glm::vec3
auto voxelToWorld (glm::vec3 pos) -> glm::vec3
void setVoxel (glm::vec3 pos, int id)
void removeVoxel (glm::vec3 pos)
void fillBox (glm::vec3 min, glm::vec3 max, int id, voxel::WriteMode mode=voxel::WriteMode::replace, int match_id=0)
void fillSphere (glm::vec3 center, float radius, int id, voxel::WriteMode mode=voxel::WriteMode::replace, int match_id=0)
void fillCylinder (glm::vec3 a, glm::vec3 b, float radius, int id, voxel::WriteMode mode=voxel::WriteMode::replace, int match_id=0)
void fillLine (glm::vec3 a, glm::vec3 b, float radius, int id, voxel::WriteMode mode=voxel::WriteMode::replace, int match_id=0)
void carveBox (glm::vec3 min, glm::vec3 max)
void carveSphere (glm::vec3 center, float radius)
void setLayers (int included_layers, int excluded_layers)
void includeLayer (int layer, bool value=true)
void excludeLayer (int layer, bool value=true)
void carveCylinder (glm::vec3 a, glm::vec3 b, float radius)
void carveLine (glm::vec3 a, glm::vec3 b, float radius)
void paintBox (glm::vec3 min, glm::vec3 max, int id)
void paintSphere (glm::vec3 center, float radius, int id)
void replaceId (int from, int to)
void slice (glm::vec3 point, glm::vec3 normal, int side)
void extrudeFace (glm::vec3 pos, glm::vec3 normal, int distance)
void stamp (const assets::Handle< assets::VoxelModel > &asset, glm::vec3 pos, glm::quat rotation=glm::quat(1.0f, 0.0f, 0.0f, 0.0f), voxel::WriteMode mode=voxel::WriteMode::replace, int match_id=0)
auto copy (glm::vec3 min, glm::vec3 max) -> int
void paste (int region, glm::vec3 pos, voxel::WriteMode mode=voxel::WriteMode::replace, int match_id=0)
void clearRegions ()
void sleep ()
void wake ()
void editVoxel ()
auto volume () -> voxel::Volume *
auto revision () const noexcept -> uint32_t
auto voxelOrigin () const noexcept -> glm::ivec3
auto volumeLocalTransform () const -> glm::mat4
auto localBoundingSphere () const -> glm::vec4
auto latticePlacement () const -> std::optional< voxel::LatticePlacement >
auto renderOnly () const noexcept -> bool
Public Member Functions inherited from toast::Node3D
auto raycast (glm::vec3 dir, glm::vec3 offset=glm::vec3(0.0f), float max_distance=-1.0f, bool ignore_self=true, const std::vector< int > &layers=std::vector< int > {}) const -> std::optional< physics::RayHit >
 The nearest thing a ray from this node hits.
auto raymulticast (glm::vec3 dir, glm::vec3 offset=glm::vec3(0.0f), float max_distance=-1.0f, int max_hits=-1, bool ignore_self=true, const std::vector< int > &layers=std::vector< int > {}) const -> std::vector< physics::RayHit >
 Up to max_hits things collisions.
auto linecast (glm::vec3 from, glm::vec3 to, int max_hits=-1, bool ignore_self=true, const std::vector< int > &layers=std::vector< int > {}) const -> std::vector< physics::RayHit >
 Everything on the line between two points, nearest to from first.
void lookAt (glm::vec3 target, glm::vec3 up={0.0f, 0.0f, 1.0f})
 Orients the node so its forward axis points at a world-space target.
void lookAtZ (glm::vec3 target)
 lookAt() constrained to the XY plane; the node faces the target with no roll
auto up () const -> glm::vec3
auto forward () const -> glm::vec3
void syncTransform () const
void syncWorldTransform () const
void refreshTransformParent ()
auto getTransform () const noexcept -> const glm::mat4 &
auto getWorldTransform () const noexcept -> const glm::mat4 &
Public Member Functions inherited from toast::Node
auto uid () const noexcept -> const UID &
 Stable unique identifier, assigned at construction or deserialization. Never changes.
auto rid () const noexcept -> std::uintptr_t
 Runtime identifier for this node, guaranteed to be unique but changes every time.
auto name () const noexcept -> std::string_view
 Display name. Siblings may share one - this is not an identifier.
void name (std::string_view name) noexcept
 Sets the display name.
auto enabled () const noexcept -> bool
 Whether this node is currently active.
auto participatesIn (NodeOwnerParticipation use) const noexcept -> bool
auto owner () const noexcept -> INodeOwner *
 The World or Workspace this node belongs to.
void enabled (bool value) noexcept
 Sets the local enabled flag and propagates the change to all children.
auto box () const noexcept -> Box< Node >
 Returns an owning handle to this node.
auto info () const -> const NodeInfo *
 Reflection metadata registered by the code generator.
auto sourcePrefab () const noexcept -> const assets::Handle< assets::Prefab > &
 The prefab this node was instantiated from.
auto isInstanceRoot () const noexcept -> bool
 Whether this node is the root of a prefab instance.
auto root () const noexcept -> Box< Node >
 The topmost ancestor that is not the world root.
auto state () const noexcept -> NodeState
auto type () const noexcept -> NodeType
auto listener () noexcept -> event::Listener &
 The event Listener owned by this node. Lazy-allocated, freed only with the node.
auto parent () noexcept -> Box< Node >
 The immediate parent of this node.
auto children () const noexcept -> const std::vector< Box< Node > > &
 The ordered list of direct children.
auto childrenSnapshot () const -> std::vector< Box< Node > >
auto create (std::string_view type="toast::Node") noexcept -> Box< Node >
 Creates a new child node of the given type and attaches it to this node.
auto spawn (UID uid) noexcept -> Box< Node >
 Asynchronously instantiates a prefab as a child of this node.
auto spawn (std::string_view uri) noexcept -> Box< Node >
 Asynchronously instantiates a prefab as a child of this node.
auto find (std::string_view query) -> Box< Node >
 Depth-first search for a single descendant.
auto find (const UID &uid) -> Box< Node >
 Looks up a node by UID within this node's local root.
auto search (std::string_view query) -> std::vector< Box< Node > >
 Depth-first search for all matching descendants.
auto childrenOfType (const NodeInfo *type) const -> std::vector< Box< Node > >
auto searchType (const NodeInfo *type) const -> std::vector< Box< Node > >
void addDependsOn (Node &other)
void removeDependsOn (Node &other)
void interactsWith (Node &other)
 Declares that the scripts of this node and of other call each other.
auto scriptRuntime () noexcept -> scripting::ScriptRuntime *
auto hasTickFunction (TickFunctionList mask) const noexcept -> bool
auto scriptVm (TickFunctionList func) const noexcept -> std::optional< size_t >
 The interpreter this node runs Lua on while it executes func, empty when it runs none.
auto scriptVmAny () const noexcept -> std::optional< size_t >
 The interpreter the scripts of this node live on whatever phase they define.
auto hasCallable (std::string_view name) const noexcept -> bool
void reloadScripts () noexcept
 Rebuilds the script runtime after a script asset changed (hot reload or attach).
auto scripts () const noexcept -> const std::vector< assets::Handle< assets::Script > > &
void setScripts (std::vector< assets::Handle< assets::Script > > scripts) noexcept
void addScript (const assets::Handle< assets::Script > &script) noexcept
template<typename R = void, typename... Args>
auto call (std::string_view name, Args &&... args) -> R
 Invokes all C++ reflected implementations of name (base→derived) and all same-named Lua functions across every attached script, forwarding args.
template<typename T>
auto get (std::string_view name) const -> T
 Reads a named value: reflected C++ field first, then the first matching Lua instance variable.
template<typename T>
void set (std::string_view name, const T &value)
 Writes a named value: reflected C++ field if present and every Lua instance variable of that name that already exists.
auto isRecursivePrefab () const noexcept -> bool

Public Attributes

signals::Signal rebuilt_shape
 Sent after a rebuild once editShape is done.
signals::Signal< int, glm::vec3 > damaged
 Sent when hits remove voxels with how many and where in the world.
signals::Signal< int > broke_apart
 Sent when a piece breaks off with how many voxels it took.
signals::Signal emptied
 Sent when the last voxel is gone.
signals::Signal< toast::Box< toast::Node > > contact_begin
 Sent when it starts touching another body.
signals::Signal< toast::Box< toast::Node > > contact_end
 Sent when it stops touching another body.
signals::Signal went_to_sleep
 Sent when the body falls asleep.
signals::Signal woke_up
 Sent when the body wakes up.
Public Attributes inherited from toast::Node3D
glm::vec3 position = glm::vec3(0.0f)
glm::quat rotation = glm::quat(1.0f, 0.0f, 0.0f, 0.0f)
glm::vec3 scale = glm::vec3(1.0f)
glm::vec3 world_position = glm::vec3(0.0f)
glm::quat world_rotation = glm::quat(1.0f, 0.0f, 0.0f, 0.0f)
glm::vec3 world_scale = glm::vec3(1.0f)
Public Attributes inherited from toast::Node
signals::Signal< Box< Node > > on_enable
signals::Signal< Box< Node > > on_disable
signals::Signal< Box< Node > > on_begin
signals::Signal< Box< Node > > on_end

Protected Member Functions

virtual void buildShape ()
virtual auto shapeKey () -> uint64_t
void requestRebuild () noexcept
virtual auto buildsAsync () -> bool
virtual void tickAsyncBuild ()
void finishShape ()
void init ()
void begin ()
void end ()
void destroy ()
void onEnable ()
void onDisable ()
void editorTick ()
void earlyTick ()
void postPhysics ()
void onReflectedFieldChanged (std::string_view field_name) override
void onScriptsReloaded () override
void updateInspectorMessages () override
void onEditorTransformChanged () override
virtual void drawDebug ()
void refreshVolume ()
void releaseVolume ()
void retireVolume ()
void recordDamage (uint32_t count, glm::vec3 index_sum)
auto ensureContains (const voxel::EditBounds &bounds) -> voxel::Volume *
auto replaceVolume (const voxel::EditBounds &bounds) -> voxel::Volume *
template<typename Kernel>
void edit (const voxel::EditBounds &local_bounds, bool grows, std::string_view operation, Kernel &&kernel)
void commitEdit (const voxel::EditResult &result, std::string_view operation)
auto toIndex (glm::ivec3 local) const noexcept -> glm::ivec3
auto toIndex (glm::vec3 local) const noexcept -> glm::vec3
auto toIndex (const voxel::EditBounds &local) const noexcept -> voxel::EditBounds
auto physicsBound () const noexcept -> bool
void assignBody (physics::BodyID body) noexcept
void assignShape (physics::ShapeID shape) noexcept
auto bodyID () const noexcept -> physics::BodyID
auto shapeID () const noexcept -> physics::ShapeID
void handleContactBegin (const physics::BroadPhasePair &pair)
void handleContactEnd (const physics::BroadPhasePair &pair)
void applyPhysicsTransform (const glm::vec3 &position, const glm::quat &rotation)
void publishPhysicsState (bool is_awake, const glm::vec3 &current_linear_velocity, const glm::vec3 &current_angular_velocity)
Protected Member Functions inherited from toast::Node3D
void init ()
 X axis.
Protected Member Functions inherited from toast::Node
virtual void onScriptsReloading ()
virtual auto luaAffinity () const noexcept -> std::optional< size_t >
virtual void onScriptVarChanged (std::string_view path)
void addInspectorMessage (const NodeMessage &message)
void removeInspectorMessage (const NodeMessage &message)

Protected Attributes

assets::Handle< assets::VoxelModel > m_model
assets::Handle< assets::VoxelPalette > m_palette
SimulationType simulation_type = SimulationType::dynamic
float mass = 0.0f
bool render_only = false
 Read when the game starts.
uint32_t included = 1
uint32_t excluded = 0
bool allow_sleep = true
bool awake = true
float gravity_scale = 1.0f
bool auto_mass_center = true
glm::vec3 center_of_mass = {}
glm::vec3 inertia = {}
float linear_damping = 0.0f
float angular_damping = 0.0f
float drag_scale = 1.0f
glm::vec3 linear_velocity = {}
glm::vec3 angular_velocity = {}
glm::vec3 constant_force = {}
glm::vec3 constant_torque = {}
bool lock_pos_x = false
bool lock_pos_y = false
bool lock_pos_z = false
bool lock_rot_x = false
bool lock_rot_y = false
bool lock_rot_z = false
bool show_aabb = false
glm::vec4 aabb_color = glm::vec4(1.0f, 0.75f, 0.15f, 0.6f)
bool aabb_fill = false
std::unique_ptr< voxel::Volume > m_volume
std::vector< std::unique_ptr< voxel::Volume > > m_retired_volumes
glm::ivec3 m_voxel_origin {0}
uint32_t m_revision = 0
const assets::VoxelModel * m_instanced_from = nullptr
assets::Handle< assets::VoxelPalette > m_model_palette
std::vector< std::optional< voxel::Region > > m_regions
bool m_volume_stale = false
bool m_rebuild_requested = false
bool m_edit_shape_pending = false
bool m_split_pending = false
bool m_building_shape = false
PendingEvents m_pending_events
physics::BodyID m_body
physics::ShapeID m_shape
std::vector< ActiveContact > m_active_contacts
bool m_registration_requested = false
bool m_registered_proxy = false
bool m_debug_visible = false
uint64_t m_shape_key = 0
uint64_t m_reported_wrong_model = 0
uint64_t m_reported_wrong_palette = 0
Protected Attributes inherited from toast::Node
INodeOwner * m_owner = nullptr

Friends

class physics::Simulator

Additional Inherited Members

Static Public Attributes inherited from toast::Node3D
static const glm::vec3 world_up = {0.0f, 0.0f, 1.0f}
static const glm::vec3 world_forward = {0.0f, 1.0f, 0.0f}
 Z axis.
static const glm::vec3 world_right = {1.0f, 0.0f, 0.0f}
 Y axis.

Detailed Description

A shape made of voxels that renders and collides

It can start from a voxel model or from nothing

editShape runs every time the shape is rebuilt and can change it however it wants so it is the perfect function for modifying or creating voxels from code

Positions are in voxels relative to the node and each voxel is 10 cm

Ids are palette colors with 0 meaning the voxel is empty

Constructor & Destructor Documentation

◆ VoxelNode() [1/2]

toast::VoxelNode::VoxelNode ( )
default

Makes an empty shape

◆ VoxelNode() [2/2]

toast::VoxelNode::VoxelNode ( assets::Handle< assets::VoxelModel > model)
inline

Makes a shape from a voxel model

Member Function Documentation

◆ buildsAsync()

virtual auto toast::VoxelNode::buildsAsync ( ) -> bool
inlinenodiscardprotectedvirtual

True when the subclass builds its shape on other threads and applies it itself

Note
Then the editor tick hands over to tickAsyncBuild and a rebuild only asks for one

Reimplemented in toast::ProceduralVoxel.

Here is the caller graph for this function:

◆ buildShape()

virtual void toast::VoxelNode::buildShape ( )
inlineprotectedvirtual

Runs right before editShape on every rebuild, subclasses build their shape here

Reimplemented in toast::ProceduralVoxel.

◆ carveBox()

void toast::VoxelNode::carveBox ( glm::vec3 min,
glm::vec3 max )

Empties the box from min to max

◆ carveCylinder()

void toast::VoxelNode::carveCylinder ( glm::vec3 a,
glm::vec3 b,
float radius )

Empties a flat ended cylinder from a to b

◆ carveLine()

void toast::VoxelNode::carveLine ( glm::vec3 a,
glm::vec3 b,
float radius )

Empties a round ended tube from a to b

◆ carveSphere()

void toast::VoxelNode::carveSphere ( glm::vec3 center,
float radius )

Empties a ball around center

◆ clearRegions()

void toast::VoxelNode::clearRegions ( )

Forgets every copied region

◆ commitEdit()

void toast::VoxelNode::commitEdit ( const voxel::EditResult & result,
std::string_view operation )
protected

Tells physics and the renderer the shape changed

Here is the caller graph for this function:

◆ copy()

auto toast::VoxelNode::copy ( glm::vec3 min,
glm::vec3 max ) -> int

Copies the voxels from min to max

Returns
a region number for paste

◆ drawDebug()

void toast::VoxelNode::drawDebug ( )
protectedvirtual

Reimplemented in toast::ProceduralVoxel.

◆ edit()

template<typename Kernel>
void toast::VoxelNode::edit ( const voxel::EditBounds & local_bounds,
bool grows,
std::string_view operation,
Kernel && kernel )
protected

Grows for local_bounds when asked and then runs kernel on the volume

Here is the caller graph for this function:

◆ editVoxel()

void toast::VoxelNode::editVoxel ( )
inline

Opens the VoxelEditor

Here is the caller graph for this function:

◆ ensureContains()

auto toast::VoxelNode::ensureContains ( const voxel::EditBounds & bounds) -> voxel::Volume *
protected

Grows the volume until bounds fit

Returns
null when there is no volume and nothing to add or it would get too big
Here is the caller graph for this function:

◆ extrudeFace()

void toast::VoxelNode::extrudeFace ( glm::vec3 pos,
glm::vec3 normal,
int distance )

Pulls the flat face at pos out along normal

Parameters
distancehow many voxels to move it and negative pushes it in

◆ fillBox()

void toast::VoxelNode::fillBox ( glm::vec3 min,
glm::vec3 max,
int id,
voxel::WriteMode mode = voxel::WriteMode::replace,
int match_id = 0 )

Fills the box from min to max with id

Parameters
modewhat it is allowed to overwrite
match_idthe only id that Match overwrites
Here is the caller graph for this function:

◆ fillCylinder()

void toast::VoxelNode::fillCylinder ( glm::vec3 a,
glm::vec3 b,
float radius,
int id,
voxel::WriteMode mode = voxel::WriteMode::replace,
int match_id = 0 )

Fills a flat ended cylinder from a to b with id

Here is the caller graph for this function:

◆ fillLine()

void toast::VoxelNode::fillLine ( glm::vec3 a,
glm::vec3 b,
float radius,
int id,
voxel::WriteMode mode = voxel::WriteMode::replace,
int match_id = 0 )

Fills a round ended tube from a to b with id

Here is the caller graph for this function:

◆ fillSphere()

void toast::VoxelNode::fillSphere ( glm::vec3 center,
float radius,
int id,
voxel::WriteMode mode = voxel::WriteMode::replace,
int match_id = 0 )

Fills a ball around center with id

Here is the caller graph for this function:

◆ getBounds()

auto toast::VoxelNode::getBounds ( ) -> std::vector< glm::vec3 >

The lowest and highest solid voxel

Returns
an empty list when there are no voxels

◆ getModel() [1/2]

auto toast::VoxelNode::getModel ( ) -> assets::Handle< assets::VoxelModel > &
nodiscard
Returns
The voxel asset

◆ getModel() [2/2]

auto toast::VoxelNode::getModel ( ) const -> const assets::Handle< assets::VoxelModel > &
nodiscard
Returns
The voxel asset

◆ getPalette()

auto toast::VoxelNode::getPalette ( ) const -> const assets::Handle< assets::VoxelPalette > &
nodiscard

The palette that replaces the model colors

◆ getSize()

auto toast::VoxelNode::getSize ( ) -> glm::vec3
Returns
the size of the shape in voxels

◆ getVoxel()

auto toast::VoxelNode::getVoxel ( glm::vec3 pos) -> int

@function editShape() Runs every time the shape is rebuilt so build it here

Note
Rebuilds happen on init and when the model or the scripts change
Override it in C++ or write it in the Lua script
Returns
the palette ID at a given position (or 0 if it is empty)

◆ getVoxelCount()

auto toast::VoxelNode::getVoxelCount ( ) -> int
Returns
how many solid voxels there are

◆ onEditorTransformChanged()

void toast::VoxelNode::onEditorTransformChanged ( )
overrideprotectedvirtual

Reimplemented from toast::Node3D.

◆ onReflectedFieldChanged()

void toast::VoxelNode::onReflectedFieldChanged ( std::string_view field_name)
overrideprotectedvirtual

Reimplemented from toast::Node.

◆ onScriptsReloaded()

void toast::VoxelNode::onScriptsReloaded ( )
overrideprotectedvirtual

Reimplemented from toast::Node.

◆ paintBox()

void toast::VoxelNode::paintBox ( glm::vec3 min,
glm::vec3 max,
int id )

Recolors the solid voxels from min to max

◆ paintSphere()

void toast::VoxelNode::paintSphere ( glm::vec3 center,
float radius,
int id )

Recolors the solid voxels in a ball

◆ paletteUid()

auto toast::VoxelNode::paletteUid ( ) const -> uint64_t
nodiscard

The palette in use as a uid

Returns
the override first, then the model palette, then 0
Here is the caller graph for this function:

◆ paste()

void toast::VoxelNode::paste ( int region,
glm::vec3 pos,
voxel::WriteMode mode = voxel::WriteMode::replace,
int match_id = 0 )

Pastes a copied region with its corner at pos

Note
Empty cells are skipped so it never erases

◆ removeVoxel()

void toast::VoxelNode::removeVoxel ( glm::vec3 pos)

Empties the voxel at pos

◆ replaceId()

void toast::VoxelNode::replaceId ( int from,
int to )

Turns every voxel of one id into another

◆ replaceVolume()

auto toast::VoxelNode::replaceVolume ( const voxel::EditBounds & bounds) -> voxel::Volume *
protected

Swaps the volume for an empty one that covers exactly bounds, rounded out to bricks

Returns
null when it would get too big, the volume is left alone then

◆ requestRebuild()

void toast::VoxelNode::requestRebuild ( )
inlineprotectednoexcept

Rebuilds the shape the next time it refreshes

Here is the caller graph for this function:

◆ resolvedMaterialLibrary()

auto toast::VoxelNode::resolvedMaterialLibrary ( ) -> const voxel::MaterialLibrary *
nodiscard

The raw physical materials of the palette in use

◆ resolvedModel()

auto toast::VoxelNode::resolvedModel ( ) const -> const assets::VoxelModel *
nodiscard

The raw loaded model

Here is the caller graph for this function:

◆ resolvedPalette()

auto toast::VoxelNode::resolvedPalette ( ) -> const voxel::Palette *
nodiscard

The raw loaded palette in use

Here is the caller graph for this function:

◆ setModel()

void toast::VoxelNode::setModel ( assets::Handle< assets::VoxelModel > model)

Swaps the model and rebuilds the shape

◆ setPalette()

void toast::VoxelNode::setPalette ( assets::Handle< assets::VoxelPalette > palette)

Replaces the colors the model came with

◆ setVoxel()

void toast::VoxelNode::setVoxel ( glm::vec3 pos,
int id )

Sets the voxel at pos to id

Here is the caller graph for this function:

◆ shapeKey()

virtual auto toast::VoxelNode::shapeKey ( ) -> uint64_t
inlinenodiscardprotectedvirtual

A hash of everything the shape is built from besides the model

Reimplemented in toast::ProceduralVoxel.

◆ sleep()

void toast::VoxelNode::sleep ( )

Puts the physics body to sleep

◆ slice()

void toast::VoxelNode::slice ( glm::vec3 point,
glm::vec3 normal,
int side )

Cuts off everything on one side of a plane

Parameters
side1 cuts where normal points and minus 1 cuts the other side

◆ stamp()

void toast::VoxelNode::stamp ( const assets::Handle< assets::VoxelModel > & asset,
glm::vec3 pos,
glm::quat rotation = glm::quat(1.0f, 0.0f, 0.0f, 0.0f),
voxel::WriteMode mode = voxel::WriteMode::replace,
int match_id = 0 )

Drops a voxel model into the shape at pos

Parameters
rotationsnaps to the closest right angle
Note
Colors get matched to this palette

◆ updateInspectorMessages()

void toast::VoxelNode::updateInspectorMessages ( )
overrideprotectedvirtual

Reimplemented from toast::Node.

◆ voxelToWorld()

auto toast::VoxelNode::voxelToWorld ( glm::vec3 pos) -> glm::vec3

Turns a voxel position into a world position

◆ wake()

void toast::VoxelNode::wake ( )

Wakes the physics body up

◆ worldToVoxel()

auto toast::VoxelNode::worldToVoxel ( glm::vec3 pos) -> glm::vec3

Turns a world position into a voxel position

Member Data Documentation

◆ aabb_fill

bool toast::VoxelNode::aabb_fill = false
protected

Draws the box filled instead of as lines

◆ auto_mass_center

bool toast::VoxelNode::auto_mass_center = true
protected

Works out the center of mass and inertia from the voxels

◆ simulation_type

SimulationType toast::VoxelNode::simulation_type = SimulationType::dynamic
protected

How the body is simulated

Note
Whether voxels can break is up to their destruction material

The documentation for this class was generated from the following files:
  • engine/src/toast/voxel/nodes/voxel_node.hpp
  • engine/src/toast/voxel/nodes/voxel_node.cpp