Verse Library verse

Voxel Grid

verse-source/SampleVerse/ProceduralBuilding/Lib/voxel_grid.verse

using { /Verse.org/Simulation }
using { /Verse.org/Simulation/Tags }
using { /Verse.org/Assets }
using { /Verse.org/Colors }
using { /Verse.org/Random }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Devices }

# Category of voxel in our build grid
build_category<public> := enum:
    Building1
    Park
    Null

# Enum to string util for debug logging
ToString(Category:build_category)<computes>:string=
    case(Category):
        build_category.Building1 => "Building"
        build_category.Park => "Park"
        build_category.Null => "Null"

# Returns if category is 'surface only', can only sit on top of another category, and does not block raycasts
CategoryIsSurfaceOnly(Category:build_category)<transacts><decides>:void=
    Category = build_category.Park

# Get 'solidity' of a category, used for meshing. First value is horizontal, second is vertical
GetSolidityOfCategory(Category:build_category)<computes>:tuple(logic,logic)=
    case(Category):

Sign in free to read the full source 🌴

This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.

Sign in with Discord

Comments

    Sign in to vote, comment, or suggest an edit. Sign in