master
Marc Gilleron 2021-01-21 20:04:53 +00:00
parent 4ef4da180c
commit ce198c2670
42 changed files with 81 additions and 53 deletions

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VoxelNode" inherits="Spatial" version="3.2">
<brief_description>
Base class for voxel volumes.
</brief_description>
<description>
</description>
@ -10,10 +11,13 @@
</methods>
<members>
<member name="generator" type="VoxelGenerator" setter="set_generator" getter="get_generator">
Procedural generator used to load voxel blocks when not present in the stream.
</member>
<member name="mesher" type="VoxelMesher" setter="set_mesher" getter="get_mesher">
Defines how voxels are transformed into visible meshes.
</member>
<member name="stream" type="VoxelStream" setter="set_stream" getter="get_stream">
Primary source of persistent voxel data. If left unassigned, the whole volume will use the generator.
</member>
</members>
<constants>

View File

@ -11,8 +11,10 @@
</methods>
<members>
<member name="position" type="Vector3" setter="" getter="get_position" default="Vector3( 0, 0, 0 )">
Integer position of the voxel that was hit.
</member>
<member name="previous_position" type="Vector3" setter="" getter="get_previous_position" default="Vector3( 0, 0, 0 )">
Integer position of the previous voxel along the ray before the final hit.
</member>
</members>
<constants>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VoxelStream" inherits="Resource" version="3.2">
<brief_description>
Implements loading and saving voxel blocks, mainly using files.
</brief_description>
<description>
</description>
@ -45,15 +46,19 @@
</method>
</methods>
<members>
<member name="save_generator_output" type="bool" setter="set_save_generator_output" getter="get_save_generator_output" default="true">
<member name="save_generator_output" type="bool" setter="set_save_generator_output" getter="get_save_generator_output" default="false">
When this is enabled, if a block cannot be found in the stream and it gets generated, then the generated block will immediately be saved into the stream. This can be used if the generator is too expensive to run on the fly (like Minecraft does), but it will require more disk space and eventual network traffic. If this setting is off, only modified blocks will be saved.
</member>
</members>
<constants>
<constant name="RESULT_ERROR" value="0" enum="Result">
An error occurred when loading the block. The request will be aborted.
</constant>
<constant name="RESULT_BLOCK_FOUND" value="2" enum="Result">
The block was found.
</constant>
<constant name="RESULT_BLOCK_NOT_FOUND" value="1" enum="Result">
The block was not found. The requester may fallback on using the generator, if any.
</constant>
</constants>
</class>

View File

@ -1,8 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VoxelStreamBlockFiles" inherits="VoxelStreamFile" version="3.2">
<brief_description>
Loads and saves blocks as individual files under a directory.
</brief_description>
<description>
Loads and saves blocks to the filesystem, under a directory. Each block gets its own file, which may produce a lot of them. This is a naive implementation and may be very slow in practice. At the very least it serves as proof of concept, but will probably be removed in the future.
</description>
<tutorials>
</tutorials>
@ -10,6 +12,7 @@
</methods>
<members>
<member name="directory" type="String" setter="set_directory" getter="get_directory" default="&quot;&quot;">
Directory under which the data is saved.
</member>
</members>
<constants>

View File

@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VoxelStreamRegionFiles" inherits="VoxelStreamFile" version="3.2">
<brief_description>
Loads and saves blocks to region files indexed by world position, under a directory.
</brief_description>
<description>
Loads and saves blocks to the filesystem, in multiple region files indexed by world position, under a directory. Regions pack many blocks together, so it reduces file switching and improves performance. Inspired by [url=https://www.seedofandromeda.com/blogs/1-creating-a-region-file-system-for-a-voxel-game]Seed of Andromeda[/url] and Minecraft.
Region files are not thread-safe. Because of this, internal mutexing may often constrain the use by one thread only.
</description>
<tutorials>
</tutorials>
@ -32,6 +35,7 @@
<member name="block_size_po2" type="int" setter="set_block_size_po2" getter="get_region_size_po2" default="4">
</member>
<member name="directory" type="String" setter="set_directory" getter="get_directory" default="&quot;&quot;">
Directory under which the data is saved.
</member>
<member name="lod_count" type="int" setter="set_lod_count" getter="get_lod_count" default="1">
</member>

View File

@ -141,4 +141,4 @@ enum **CellularReturnType**:
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -71,4 +71,4 @@ enum **RotationType3D**:
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_seed"></span> **seed** = 0
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -104,4 +104,4 @@ Name that can be used for convenience, when looking up a specific [Voxel](Voxel.
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -52,4 +52,4 @@ Reads the data of a [VoxelBuffer](VoxelBuffer.md) from a [StreamPeer](https://do
Stores the data of a [VoxelBuffer](VoxelBuffer.md) into a [StreamPeer](https://docs.godotengine.org/en/stable/classes/class_streampeer.html). To be able to read it back, you should use the
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -42,4 +42,4 @@ Given a motion vector, returns a modified vector telling you by how much to move
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -227,4 +227,4 @@ If this [VoxelBuffer](VoxelBuffer.md) is saved, this metadata will also be saved
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -41,4 +41,4 @@ Return | Sign
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -21,4 +21,4 @@ Return | Signature
Generates a block of voxels within the specified world area.
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -26,4 +26,4 @@ Type | Name | Default
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_voxel_type"></span> **voxel_type** = 1
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -189,4 +189,4 @@ enum **NodeTypeID**:
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -30,4 +30,4 @@ Type | Name | Default
- [float](https://docs.godotengine.org/en/stable/classes/class_float.html)<span id="i_iso_scale"></span> **iso_scale** = 0.1
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -22,4 +22,4 @@ Type | Name | Default
- [Image](https://docs.godotengine.org/en/stable/classes/class_image.html)<span id="i_image"></span> **image**
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -30,4 +30,4 @@ Type | Name | Default
- [OpenSimplexNoise](https://docs.godotengine.org/en/stable/classes/class_opensimplexnoise.html)<span id="i_noise"></span> **noise**
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -22,4 +22,4 @@ Type | Name | Default
- [OpenSimplexNoise](https://docs.godotengine.org/en/stable/classes/class_opensimplexnoise.html)<span id="i_noise"></span> **noise**
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -24,4 +24,4 @@ Return | Signatur
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -26,4 +26,4 @@ Type | Name | Default
- [Vector2](https://docs.godotengine.org/en/stable/classes/class_vector2.html)<span id="i_pattern_size"></span> **pattern_size** = Vector2( 30, 30 )
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -60,4 +60,4 @@ Return | Signatur
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -156,4 +156,4 @@ The returned dictionary has the following structure:
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -33,4 +33,4 @@ Gets by how much voxels must be padded before their lower corner in order for th
Gets by how much voxels must be padded after their upper corner in order for the mesher to work.
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -30,4 +30,4 @@ Type | Name | Default
- [bool](https://docs.godotengine.org/en/stable/classes/class_bool.html)<span id="i_occlusion_enabled"></span> **occlusion_enabled** = true
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -41,4 +41,4 @@ enum **ColorMode**:
- [VoxelColorPalette](VoxelColorPalette.md)<span id="i_palette"></span> **palette**
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -75,4 +75,4 @@ enum **SeamMode**:
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -19,4 +19,4 @@ Return
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -3,7 +3,7 @@
Inherits: [Spatial](https://docs.godotengine.org/en/stable/classes/class_spatial.html)
Base class for voxel volumes.
## Properties:
@ -18,12 +18,12 @@ Type | Name | Default
## Property Descriptions
- [VoxelGenerator](VoxelGenerator.md)<span id="i_generator"></span> **generator**
Procedural generator used to load voxel blocks when not present in the stream.
- [VoxelMesher](VoxelMesher.md)<span id="i_mesher"></span> **mesher**
Defines how voxels are transformed into visible meshes.
- [VoxelStream](VoxelStream.md)<span id="i_stream"></span> **stream**
Primary source of persistent voxel data. If left unassigned, the whole volume will use the generator.
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -17,9 +17,9 @@ Type | Name | Default
## Property Descriptions
- [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html)<span id="i_position"></span> **position** = Vector3( 0, 0, 0 )
Integer position of the voxel that was hit.
- [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html)<span id="i_previous_position"></span> **previous_position** = Vector3( 0, 0, 0 )
Integer position of the previous voxel along the ray before the final hit.
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -37,4 +37,4 @@ The returned dictionary has the following structure:
```
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -3,14 +3,14 @@
Inherits: [Resource](https://docs.godotengine.org/en/stable/classes/class_resource.html)
Implements loading and saving voxel blocks, mainly using files.
## Properties:
Type | Name | Default
------- | -------------------------------------------------- | --------
`bool` | [save_generator_output](#i_save_generator_output) | true
`bool` | [save_generator_output](#i_save_generator_output) | false
<p></p>
## Methods:
@ -28,15 +28,15 @@ Return |
enum **Result**:
- **RESULT_ERROR** = **0**
- **RESULT_BLOCK_FOUND** = **2**
- **RESULT_BLOCK_NOT_FOUND** = **1**
- **RESULT_ERROR** = **0** --- An error occurred when loading the block. The request will be aborted.
- **RESULT_BLOCK_FOUND** = **2** --- The block was found.
- **RESULT_BLOCK_NOT_FOUND** = **1** --- The block was not found. The requester may fallback on using the generator, if any.
## Property Descriptions
- [bool](https://docs.godotengine.org/en/stable/classes/class_bool.html)<span id="i_save_generator_output"></span> **save_generator_output** = true
- [bool](https://docs.godotengine.org/en/stable/classes/class_bool.html)<span id="i_save_generator_output"></span> **save_generator_output** = false
When this is enabled, if a block cannot be found in the stream and it gets generated, then the generated block will immediately be saved into the stream. This can be used if the generator is too expensive to run on the fly (like Minecraft does), but it will require more disk space and eventual network traffic. If this setting is off, only modified blocks will be saved.
## Method Descriptions
@ -56,4 +56,4 @@ enum **Result**:
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -3,7 +3,11 @@
Inherits: [VoxelStreamFile](VoxelStreamFile.md)
Loads and saves blocks as individual files under a directory.
## Description:
Loads and saves blocks to the filesystem, under a directory. Each block gets its own file, which may produce a lot of them. This is a naive implementation and may be very slow in practice. At the very least it serves as proof of concept, but will probably be removed in the future.
## Properties:
@ -16,6 +20,6 @@ Type | Name | Default
## Property Descriptions
- [String](https://docs.godotengine.org/en/stable/classes/class_string.html)<span id="i_directory"></span> **directory** = ""
Directory under which the data is saved.
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -5,4 +5,4 @@ Inherits: [VoxelStream](VoxelStream.md)
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -3,7 +3,13 @@
Inherits: [VoxelStreamFile](VoxelStreamFile.md)
Loads and saves blocks to region files indexed by world position, under a directory.
## Description:
Loads and saves blocks to the filesystem, in multiple region files indexed by world position, under a directory. Regions pack many blocks together, so it reduces file switching and improves performance. Inspired by [url=https://www.seedofandromeda.com/blogs/1-creating-a-region-file-system-for-a-voxel-game](https://docs.godotengine.org/en/stable/classes/class_url=https://www.seedofandromeda.com/blogs/1-creating-a-region-file-system-for-a-voxel-game.html)Seed of Andromeda[/url](https://docs.godotengine.org/en/stable/classes/class_/url.html) and Minecraft.
Region files are not thread-safe. Because of this, internal mutexing may often constrain the use by one thread only.
## Properties:
@ -33,7 +39,7 @@ Return |
- [String](https://docs.godotengine.org/en/stable/classes/class_string.html)<span id="i_directory"></span> **directory** = ""
Directory under which the data is saved.
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_lod_count"></span> **lod_count** = 1
@ -58,4 +64,4 @@ Return |
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -29,4 +29,4 @@ Return | Signatur
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -130,4 +130,4 @@ Note 3: saving is asynchronous and won't block the game. the save may complete o
Converts voxel coordinates into block coordinates.
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -108,4 +108,4 @@ Operate on a rectangular cuboid section of the terrain. `begin` and `end` are in
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -5,4 +5,4 @@ Inherits: [VoxelTool](VoxelTool.md)
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -19,4 +19,4 @@ Return | Signature
Picks random voxels within the specified area and executes a function on them. This only works for terrains using [VoxelMesherBlocky](VoxelMesherBlocky.md). Only voxels where member Voxel.random_tickable is `true` will be picked.
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -32,4 +32,4 @@ If set to `true`, the engine will generate meshes around this viewer. This may b
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_view_distance"></span> **view_distance** = 128
How far should voxels generate around this viewer.
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_

View File

@ -19,4 +19,4 @@ Return | Signatur
_Generated on Jan 20, 2021_
_Generated on Jan 21, 2021_