VoxelInstancer
Spawns items on top of voxel surfaces.
Spawns items on top of voxel surfaces.
Add-on to voxel nodes, allowing to spawn static elements on the surface. These elements are rendered with hardware instancing, can have collisions, and also be persistent. It must be child of a voxel node.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
VoxelInstancerConstructor
public VoxelInstancer();Properties6
CollisionUpdateBudgetMicrosecondsProperty
public int CollisionUpdateBudgetMicroseconds { get; set; }Hints the maximum time that should be spent updating collisions that are based on distance (see VoxelInstanceLibraryMultiMeshItem.CollisionDistance). This time can still be exceeded if an operation takes longer, but then no further processing will occur until next frame.
FadingDurationProperty
public float FadingDuration { get; set; }How long it takes for fading to complete, in seconds (same for fading in and out). Used when VoxelInstancer.FadingEnabled is active.
FadingEnabledProperty
public bool FadingEnabled { get; set; }When enabled, a per-instance shader parameter will be updated when instances load in and out, so it can be used to apply a fading effect.
The material used by instances must have a shader that has a instance uniform vec2 u_lod_fade; property. X will animate from 0 to 1 during fade in and fade out. Y will be 1 when fading in, and 0 when fading out.
LibraryProperty
public VoxelInstanceLibrary Library { get; set; }Library from which instances to spawn will be taken from.
MeshLodUpdateBudgetMicrosecondsProperty
public int MeshLodUpdateBudgetMicroseconds { get; set; }Hints the maximum time that should be spent updating mesh LODs (see "mesh LOD" properties on VoxelInstanceLibraryMultiMeshItem). This time can still be exceeded if an operation takes longer, but then no further processing will occur until next frame.
UpModeProperty
public VoxelInstancer.UpModeEnum UpMode { get; set; }Where to consider the "up" direction is on the terrain when generating instances. See also VoxelInstanceGenerator.
Methods21
DebugDumpAsScenevoid
public void DebugDumpAsScene(string fpath);| Name | Type | Default |
|---|---|---|
fpath | string | — |
DebugGetBlockCountint
public int DebugGetBlockCount();intDebugGetBlockInfosReckfell.Collections.Dictionary
public Reckfell.Collections.Dictionary DebugGetBlockInfos(Vector3 worldPosition, int itemId);| Name | Type | Default |
|---|---|---|
worldPosition | Vector3 | — |
itemId | int | — |
Reckfell.Collections.DictionaryDebugGetDrawFlagbool
public bool DebugGetDrawFlag(VoxelInstancer.DebugDrawFlag flag);| Name | Type | Default |
|---|---|---|
flag | VoxelInstancer.DebugDrawFlag | — |
boolDebugGetInstanceCountsReckfell.Collections.Dictionary
public Reckfell.Collections.Dictionary DebugGetInstanceCounts();Reckfell.Collections.DictionaryDebugIsDrawEnabledbool
public bool DebugIsDrawEnabled();boolDebugSetDrawEnabledvoid
public void DebugSetDrawEnabled(bool enabled);| Name | Type | Default |
|---|---|---|
enabled | bool | — |
DebugSetDrawFlagvoid
public void DebugSetDrawFlag(VoxelInstancer.DebugDrawFlag flag, bool enabled);| Name | Type | Default |
|---|---|---|
flag | VoxelInstancer.DebugDrawFlag | — |
enabled | bool | — |
GetCollisionUpdateBudgetMicrosecondsint
public int GetCollisionUpdateBudgetMicroseconds();intGetFadingDurationfloat
public float GetFadingDuration();floatGetFadingEnabledbool
public bool GetFadingEnabled();boolGetLibraryVoxelInstanceLibrary
public VoxelInstanceLibrary GetLibrary();VoxelInstanceLibraryGetMeshLodUpdateBudgetMicrosecondsint
public int GetMeshLodUpdateBudgetMicroseconds();intGetUpModeVoxelInstancer.UpModeEnum
public VoxelInstancer.UpModeEnum GetUpMode();VoxelInstancer.UpModeEnumRemoveInstancesInSpherevoid
public void RemoveInstancesInSphere(Vector3 center, float radius);Removes all instances having their origin inside the given sphere. Coordinates are local to the instancer.
| Name | Type | Default |
|---|---|---|
center | Vector3 | — |
radius | float | — |
SetCollisionUpdateBudgetMicrosecondsvoid
public void SetCollisionUpdateBudgetMicroseconds(int micros);| Name | Type | Default |
|---|---|---|
micros | int | — |
SetFadingDurationvoid
public void SetFadingDuration(float duration);| Name | Type | Default |
|---|---|---|
duration | float | — |
SetFadingEnabledvoid
public void SetFadingEnabled(bool enabled);| Name | Type | Default |
|---|---|---|
enabled | bool | — |
SetLibraryvoid
public void SetLibrary(VoxelInstanceLibrary library);| Name | Type | Default |
|---|---|---|
library | VoxelInstanceLibrary | — |
SetMeshLodUpdateBudgetMicrosecondsvoid
public void SetMeshLodUpdateBudgetMicroseconds(int micros);| Name | Type | Default |
|---|---|---|
micros | int | — |
SetUpModevoid
public void SetUpMode(VoxelInstancer.UpModeEnum mode);| Name | Type | Default |
|---|---|---|
mode | VoxelInstancer.UpModeEnum | — |
Fields and constants1
MaxLodField
public const long MaxLod = 8;VoxelInstancer.DebugDrawFlag
| Value | Description |
|---|---|
AllBlocks = 0 | |
EditedBlocks = 1 | |
FlagsCount = 2 |
VoxelInstancer.UpModeEnum
| Value | Description |
|---|---|
PositiveY = 0 | Up is towards the positive Y axis. This is the default assumption in Reckfell. |
Sphere = 1 | Up is opposite from the direction where the terrain's origin is. May be used if your terrain is a planet for example. |