Chunks
Moddable voxel sandbox for room-scale VR.
Public Member Functions | Properties | Events | List of all members
Chunks.Geometry.IWorld Interface Reference

Interface for types that implement a voxel world. More...

Inherited by Chunks.Geometry.IWorldInternal.

Public Member Functions

void UpdateConfig (WorldConfig config)
 
IntVector GetBlockPosition (Vector position)
 Converts a position from world space to world block space. More...
 
bool Set (IntVector min, IntVector max, [NotNull] Block value, bool replace=true)
 Sets an axis aligned box of blocks within this world to the given value, using a minimum and maximum position in world block space to define the region to set. More...
 
Block Get (IntVector pos)
 Gets the value of a single block inside this world from a given position in world block space. Null is returned if the chunk corresponding to the given position hasn't been loaded. More...
 
bool Raycast (Ray ray, float maxDist, out WorldRaycastHit hitInfo)
 
bool Raycast (Ray ray, float maxDist, out EntityRaycastHit hitInfo, Predicate< IRaycastable > predicate=null)
 
bool RaycastWorld (Ray ray, float maxDist, out WorldRaycastHit hitInfo)
 Projects a point along a line, testing to see if it hits any blocks inside the world. Returns true if it hits a block, outputting information about the collision. More...
 
bool RaycastEntities (Ray ray, float maxDist, out EntityRaycastHit hitInfo, Predicate< IRaycastable > predicate=null)
 
bool RaycastAll (Ray ray, float maxDist, out RaycastHit hitInfo, Predicate< IRaycastable > entityPredicate=null)
 
bool Sweep (SweptAABB toSweep, float maxDist, out WorldSweepHit hitInfo)
 Projects an axis aligned bounding box, testing to see if it hits any blocks inside the world. Returns true if it hits a block, outputting information about the collision. More...
 
IEnumerable< EntityGetRootEntities (bool includeDisabled=false)
 Gets all entities that don't have parents. More...
 
IEnumerable< EntityGetAllEntities (bool includeDisabled=false)
 Gets all entities. More...
 
IEnumerable< TComponent > GetRootComponents< TComponent > (bool includeDisabled=false)
 Gets components of the given type from all entities that don't have parents. More...
 
IEnumerable< TComponent > GetAllComponents< TComponent > (bool includeDisabled=false)
 Gets components of the given type from all entities. More...
 
void EnableRaycastable (IRaycastable raycastable)
 
void DisableRaycastable (IRaycastable raycastable)
 
Entity CreateEntity ()
 Creates a new empty entity in the world. More...
 
void InvalidateChunk (IChunk chunk)
 
void Regenerate (int seed=0)
 Clears all chunks and regenerates the world. Can optionally set a new seed. More...
 

Properties

int ChunkSize [get]
 The size of each chunk of blocks in the world. Block space is then defined by world space scaled by ChunkSize. More...
 
int ChunkResolution [get]
 
WorldProperties Properties [get]
 
GameMode GameMode [get]
 The current scripted game mode. More...
 
CameraRig CameraRig [get]
 The player's camera rig. More...
 
Graphics.Camera SpectatorCamera [get]
 
float Time [get]
 The time since the game started when the last Update began. More...
 
float PhysicsTime [get]
 The time since the game started when the last PhyicsUpdate began. More...
 
float DeltaTime [get]
 The time between the previous Update and this one. More...
 
float PhysicsDeltaTime [get]
 The fixed time step between PhyicsUpdate calls. More...
 
LightingSettings Lighting [get]
 

Events

ChunkLoadedEventHandler ChunkLoaded
 Invoked when a chunk is loaded or generated. More...
 

Detailed Description

Interface for types that implement a voxel world.

Member Function Documentation

Entity Chunks.Geometry.IWorld.CreateEntity ( )

Creates a new empty entity in the world.

void Chunks.Geometry.IWorld.DisableRaycastable ( IRaycastable  raycastable)
void Chunks.Geometry.IWorld.EnableRaycastable ( IRaycastable  raycastable)
Block Chunks.Geometry.IWorld.Get ( IntVector  pos)

Gets the value of a single block inside this world from a given position in world block space. Null is returned if the chunk corresponding to the given position hasn't been loaded.

Parameters
posPosition in world block space
IEnumerable<TComponent> Chunks.Geometry.IWorld.GetAllComponents< TComponent > ( bool  includeDisabled = false)

Gets components of the given type from all entities.

Template Parameters
TComponentType of component to find
Type Constraints
TComponent :Component 
IEnumerable<Entity> Chunks.Geometry.IWorld.GetAllEntities ( bool  includeDisabled = false)

Gets all entities.

IntVector Chunks.Geometry.IWorld.GetBlockPosition ( Vector  position)

Converts a position from world space to world block space.

Parameters
positionPosition to get the world block space position for
IEnumerable<TComponent> Chunks.Geometry.IWorld.GetRootComponents< TComponent > ( bool  includeDisabled = false)

Gets components of the given type from all entities that don't have parents.

Template Parameters
TComponentType of component to find
Type Constraints
TComponent :Component 
IEnumerable<Entity> Chunks.Geometry.IWorld.GetRootEntities ( bool  includeDisabled = false)

Gets all entities that don't have parents.

void Chunks.Geometry.IWorld.InvalidateChunk ( IChunk  chunk)
bool Chunks.Geometry.IWorld.Raycast ( Ray  ray,
float  maxDist,
out WorldRaycastHit  hitInfo 
)
bool Chunks.Geometry.IWorld.Raycast ( Ray  ray,
float  maxDist,
out EntityRaycastHit  hitInfo,
Predicate< IRaycastable predicate = null 
)
bool Chunks.Geometry.IWorld.RaycastAll ( Ray  ray,
float  maxDist,
out RaycastHit  hitInfo,
Predicate< IRaycastable entityPredicate = null 
)
bool Chunks.Geometry.IWorld.RaycastEntities ( Ray  ray,
float  maxDist,
out EntityRaycastHit  hitInfo,
Predicate< IRaycastable predicate = null 
)
bool Chunks.Geometry.IWorld.RaycastWorld ( Ray  ray,
float  maxDist,
out WorldRaycastHit  hitInfo 
)

Projects a point along a line, testing to see if it hits any blocks inside the world. Returns true if it hits a block, outputting information about the collision.

Parameters
rayA ray describing the starting point in world space and direction to cast
maxDistMaximum distance to cast
hitInfoIf true is returned, contains hit information
void Chunks.Geometry.IWorld.Regenerate ( int  seed = 0)

Clears all chunks and regenerates the world. Can optionally set a new seed.

Parameters
seedThe new seed to use, if 0 the old seed is used.
bool Chunks.Geometry.IWorld.Set ( IntVector  min,
IntVector  max,
[NotNull] Block  value,
bool  replace = true 
)

Sets an axis aligned box of blocks within this world to the given value, using a minimum and maximum position in world block space to define the region to set.

Parameters
minMinimum bounds position within the world
maxMaximum bounds position wihtin the world
valueBlock value to set
bool Chunks.Geometry.IWorld.Sweep ( SweptAABB  toSweep,
float  maxDist,
out WorldSweepHit  hitInfo 
)

Projects an axis aligned bounding box, testing to see if it hits any blocks inside the world. Returns true if it hits a block, outputting information about the collision.

Parameters
toSweepAxis aligned bounding box to sweep, and the direction to sweep it in
maxDistMaximum distance to sweep the bounding box
hitInfoIf true is returned, contains hit information
void Chunks.Geometry.IWorld.UpdateConfig ( WorldConfig  config)

Property Documentation

CameraRig Chunks.Geometry.IWorld.CameraRig
get

The player's camera rig.

int Chunks.Geometry.IWorld.ChunkResolution
get
int Chunks.Geometry.IWorld.ChunkSize
get

The size of each chunk of blocks in the world. Block space is then defined by world space scaled by ChunkSize.

float Chunks.Geometry.IWorld.DeltaTime
get

The time between the previous Update and this one.

GameMode Chunks.Geometry.IWorld.GameMode
get

The current scripted game mode.

LightingSettings Chunks.Geometry.IWorld.Lighting
get
float Chunks.Geometry.IWorld.PhysicsDeltaTime
get

The fixed time step between PhyicsUpdate calls.

float Chunks.Geometry.IWorld.PhysicsTime
get

The time since the game started when the last PhyicsUpdate began.

TODO: Use a TimeSpan

WorldProperties Chunks.Geometry.IWorld.Properties
get
Graphics.Camera Chunks.Geometry.IWorld.SpectatorCamera
get
float Chunks.Geometry.IWorld.Time
get

The time since the game started when the last Update began.

TODO: Use a TimeSpan

Event Documentation

ChunkLoadedEventHandler Chunks.Geometry.IWorld.ChunkLoaded

Invoked when a chunk is loaded or generated.


The documentation for this interface was generated from the following file: