Merge branch 'master' into master

master
Marc 2021-01-21 23:50:59 +00:00 committed by GitHub
commit f61758b476
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
313 changed files with 24566 additions and 6440 deletions

View File

@ -78,3 +78,69 @@ jobs:
with:
name: godot.windows.opt.tools.64.exe
path: bin/godot.windows.opt.tools.64.exe
windows-template:
# Windows 10 with latest image
runs-on: "windows-latest"
name: Release
steps:
# Clone Godot
- uses: actions/checkout@v2
with:
repository: godotengine/godot
ref: 3.2
# Clone our module under the correct directory
- uses: actions/checkout@v2
with:
path: modules/voxel
# Upload cache on completion and check it out now
# Editing this is pretty dangerous for Windows since it can break and needs to be properly tested with a fresh cache.
- name: Load .scons_cache directory
id: windows-editor-cache
uses: RevoluPowered/cache@v2.1
with:
path: /.scons_cache/
key: ${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
restore-keys: |
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
${{github.job}}-${{env.GODOT_BASE_BRANCH}}
# Use python 3.x release (works cross platform; best to keep self contained in it's own step)
- name: Set up Python 3.x
uses: actions/setup-python@v2
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
# Optional - x64 or x86 architecture, defaults to x64
architecture: 'x64'
# Setup scons, print python version and scons version info, so if anything is broken it won't run the build.
- name: Configuring Python packages
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons pywin32
python --version
scons --version
# We should always be explicit with our flags usage here since it's gonna be sure to always set those flags
- name: Compilation
env:
SCONS_CACHE: /.scons_cache/
run: |
scons -j2 verbose=yes warnings=all werror=yes platform=windows tools=no tests=no target=release
# TODO Such tests are able to run from Godot 4.0 only
# Execute unit tests for the editor
#- name: Unit Tests
# run: |
# ./bin/godot.windows.opt.tools.64.exe --test
# Make build available
- uses: actions/upload-artifact@v2
with:
name: godot.windows.opt.64.exe
path: bin/godot.windows.opt.64.exe

1
.gitignore vendored
View File

@ -4,3 +4,4 @@
*.autosave
*.bc
*.d
*.log

10
.readthedocs.yml Normal file
View File

@ -0,0 +1,10 @@
version: 2
mkdocs:
configuration: doc/mkdocs.yml
python:
install:
# Added this to fix an MkDocs error about `site_dir`
# https://github.com/readthedocs/readthedocs.org/issues/4974#issuecomment-735320443
- requirements: doc/requirements.txt

View File

@ -1,63 +0,0 @@
Code guidelines
=====================
For the most part, follow Godot conventions.
Syntax
--------
- Class and struct names `PascalCase`
- Constants, enums and macros `CAPSLOCK_CASE`
- Other names `snake_case`
- Globals prefixed with `g_`
- Parameters prefixed with `p_`, but not really enforced so far. Matters for big functions.
- Private and protected fields prefixed with `_`
- Some private functions start with `_`, either to mimic Godot API, or if it's a re-used function that performs no checks
- Enums prefixed by their name. Example: `enum Type { TYPE_ONE, TYPE_TWO }`
- Open braces at the end of line, close them next line
- Never omit braces
- Space between binary operators and control flow: `if (a + b == 42)`
- Indent with tabs
- Use Clang-format to automate most of these rules (the one included in Godot should do it)
- Constructors and destructors go on top
- Bindings go at the bottom. Private wrapper functions start with `_b_`.
- Avoid long lines. Preferred ruler is 100 characters.
C++ features
-------------
- Don't use `auto` unless the type is impossible to express or a horrible template (like STL ones). IDEs aren't granted (Github reviews and diffs)
- STL is ok if it measurably performs better than Godot alternatives.
- Initialize variables next to declaration
- Avoid using macros to define logic or constants. Prefer `static const`, `constexpr` and `inline` functions.
- Prefer adding `const` to variables that won't change after being initialized
- Don't exploit booleanization. Example: use `if (a == nullptr)` instead of `if (a)`
Error handling
---------------
- No exceptions
- Check invariants, fail early. Use `CRASH_COND` to make sure states are as expected even if they don't cause immediate harm.
- Crashes aren't nice to users, so in those cases use `ERR_FAIL_COND` macros for code that can recover from error
Performance
-------------
In performance-critical areas:
- Avoid allocations. Re-use memory either with `ObjectPool`, fixed-size arrays or use `std::vector` capacity.
- Avoid `virtual`, `Ref<T>`, `String`
- Don't resize `PoolVectors` or `Vector<T>`, or do it in one go if needed
- Careful about what is thread-safe and what isn't. Some major areas of this module work within threads.
- Reduce mutex locking to a minimum
- Use data structures that are fit to the most frequent use over time (will often be either array, vector or hash map)
- Consider statistics if their impact is negligible. It helps monitoring how well the module performs even in release builds.
- Profile your code, in release mode. This module is Tracy-friendly, see `util/profiling.hpp`.
Godot API
----------
- Use the most direct APIs for the job. Especially, don't use nodes. See `VisualServer` and `PhysicsServer`.
- Always use `Read` and `Write` when modifying `PoolVector`.
- Only expose a function if it is safe to use and guaranteed to remain present for a while
- use `memnew`, `memdelete`, `memalloc` and `memfree` so memory usage is counted within Godot monitors

View File

@ -1,7 +1,7 @@
Voxel Tools for Godot Engine
--------------------------------
Copyright (c) 2016 Marc Gilleron
Copyright (c) 2016-2020 Marc Gilleron
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

View File

@ -3,9 +3,9 @@ Voxel Tools for Godot
A C++ module for creating volumetric worlds in Godot Engine.
<img src="doc/images/blocky_screenshot.png" width="800" />
<img src="doc/images/smooth_screenshot.png" width="800" />
<img src="doc/images/textured-terrain.jpg" width="800" />
![Blocky screenshot](doc/docs/images/blocky_screenshot.png)
![Smooth screenshot](doc/docs/images/smooth_screenshot.png)
![Textured screenshot](doc/docs/images/textured-terrain.jpg)
Features
---------------------------
@ -17,7 +17,7 @@ Features
- Minecraft-style blocky voxel terrain, with multiple materials and baked ambient occlusion
- Smooth terrain using Transvoxel
- Levels of detail for smooth terrain
- Voxel storage using 8-bit channels for any general purpose
- Voxel storage using 8-bit or 16-bit channels for any general purpose
What This Module Doesn't Provide
@ -50,12 +50,13 @@ Ready-to-use versions of Godot including the module exist, though they might not
### Compiling
Compiling the source yourself is the best way to get your own version and export template.
Please see the [Getting Started Guide](doc/01_get-started.md) for instructions.
Please see the [documentation](https://voxel-tools.readthedocs.io/en/latest/getting_the_module/) for instructions.
### Examples
### Documentation
- [Main documentation](https://voxel-tools.readthedocs.io/en/latest/)
- Documentation: [Getting Started Guide](doc/01_get-started.md)
- Zylann's demos: [Zylann's demos](https://github.com/Zylann/voxelgame)
- TinmanJuggernaut's demos: [TinmanJuggernaut's demo](https://github.com/tinmanjuggernaut/voxelgame)
@ -65,8 +66,29 @@ Roadmap
These are some ideas that may or may not be implemented in the future:
* Instancing for foliage and rocks
* Texturing on smooth terrain
* Editor preview and authoring
* Improving LOD performance
* Other meshing algorithms (e.g. dual contouring)
* GPU offloading (Maybe when Godot 4+ supports compute shaders)
Supporters
-----------
This module is a non-profit project developped by voluntary contributors. The following is the list of the current donors.
Thanks for your support :)
### Supporters
```
wacyym
Sergey Lapin (slapin)
Jonas (NoFr1ends)
lenis0012
Phyronnaz
RonanZe
furtherorbit
```

142
SCsub
View File

@ -1,10 +1,14 @@
Import('env')
Import('env_modules')
# TODO Support is turned off for now because Godot 3 doesn't compile with C++17.
# FastNoise2 use C++17 features and STL in its headers as well.
# SIMD noise support would have to wait for Godot 4...
FAST_NOISE_2 = False
env_voxel = env_modules.Clone()
# TODO Exclude editor stuff when building an export template?
files = [
voxel_files = [
"*.cpp",
"meshers/blocky/*.cpp",
"meshers/transvoxel/*.cpp",
@ -15,23 +19,145 @@ files = [
"storage/*.cpp",
"generators/*.cpp",
"generators/graph/*.cpp",
"generators/simple/*.cpp",
"util/*.cpp",
#"util/noise/*.cpp",
"util/noise/fast_noise_lite.cpp",
"util/noise/fast_noise_lite_gradient.cpp",
"terrain/*.cpp",
"server/*.cpp",
"math/*.cpp",
"edition/*.cpp",
"editor/*.cpp",
"editor/graph/*.cpp",
"editor/terrain/*.cpp",
"thirdparty/lz4/*.c"
]
for f in files:
if env["tools"]:
# Editor-only stuff
voxel_editor_files = [
"editor/*.cpp",
"editor/graph/*.cpp",
"editor/terrain/*.cpp",
"editor/fast_noise_lite/*.cpp",
]
voxel_files += voxel_editor_files
for f in voxel_files:
env_voxel.add_source_files(env.modules_sources, f)
if FAST_NOISE_2:
if env["use_lto"]:
# TODO Auburn warned about issues with LTO and static builds of FastNoise2
# Need to either produce an error, fallback on Scalar, or turn off support entirely?
pass
env_voxel.Append(CPPPATH=["thirdparty/fast_noise_2/include"])
#env_voxel.Append(CPPDEFINES=["VOXEL_SUPPORT_FAST_NOISE_2"])
fn2_sources_common = [
"thirdparty/fast_noise_2/src/FastNoise/FastNoiseMetadata.cpp"
"thirdparty/fast_noise_2/src/FastSIMD/FastSIMD.cpp"
]
fn2_sources_scalar = [
"thirdparty/fast_noise_2/src/FastSIMD/FastSIMD_Level_Scalar.cpp"
]
fn2_sources_sse3 = [
"thirdparty/fast_noise_2/src/FastSIMD/FastSIMD_Level_SSE3.cpp"
]
fn2_sources_ssse3 = [
"thirdparty/fast_noise_2/src/FastSIMD/FastSIMD_Level_SSSE3.cpp"
]
fn2_sources_sse2 = [
"thirdparty/fast_noise_2/src/FastSIMD/FastSIMD_Level_SSE2.cpp"
]
fn2_sources_sse41 = [
"thirdparty/fast_noise_2/src/FastSIMD/FastSIMD_Level_SSE41.cpp"
]
fn2_sources_sse42 = [
"thirdparty/fast_noise_2/src/FastSIMD/FastSIMD_Level_SSE42.cpp"
]
fn2_sources_avx2 = [
"thirdparty/fast_noise_2/src/FastSIMD/FastSIMD_Level_AVX2.cpp"
]
fn2_sources_avx512 = [
"thirdparty/fast_noise_2/src/FastSIMD/FastSIMD_Level_AVX512.cpp"
]
fn2_sources_arm = [
"thirdparty/fast_noise_2/src/FastSIMD/FastSIMD_Level_NEON.cpp"
]
env_fn2 = env_voxel.Clone()
# In case we need common options for FastNoise2 we can add them here
env_fn2_scalar = env_fn2.Clone()
env_fn2_sse2 = env_fn2.Clone()
env_fn2_sse3 = env_fn2.Clone()
env_fn2_ssse3 = env_fn2.Clone()
env_fn2_sse41 = env_fn2.Clone()
env_fn2_sse42 = env_fn2.Clone()
env_fn2_avx2 = env_fn2.Clone()
env_fn2_avx512 = env_fn2.Clone()
env_fn2_arm = env_fn2.Clone()
if env.msvc:
if env["bits"] == "32":
# MSVC/64 warns:
# ignoring unknown option "/arch:SSE2" as 64 bit already has SSE2 built in
env_fn2_scalar.Append(CCFLAGS=["/arch:SSE"])
env_fn2_sse2.Append(CCFLAGS=["/arch:SSE2"])
env_fn2_sse3.Append(CCFLAGS=["/arch:SSE2"])
env_fn2_ssse3.Append(CCFLAGS=["/arch:SSE2"])
env_fn2_sse41.Append(CCFLAGS=["/arch:SSE2"])
env_fn2_sse42.Append(CCFLAGS=["/arch:SSE2"])
env_fn2_avx2.Append(CCFLAGS=["/arch:AVX2"])
env_fn2_avx512.Append(CCFLAGS=["/arch:AVX512"])
else: # Clang, GCC, AppleClang
# TODO The Cmake build script still has a big `if(MSVC)` in that section.
# what does it mean?
if env["bits"] == "32":
env_fn2_scalar.Append(CCFLAGS=["-msse"])
env_fn2_sse2.Append(CCFLAGS=["-msse2"])
env_fn2_sse3.Append(CCFLAGS=["-msse3"])
env_fn2_ssse3.Append(CCFLAGS=["-mssse3"])
env_fn2_sse41.Append(CCFLAGS=["-msse4.1"])
env_fn2_sse42.Append(CCFLAGS=["-msse4.2"])
env_fn2_avx2.Append(CCFLAGS=["-mavx2", "-mfma"])
env_fn2_avx512.Append(CCFLAGS=["-mavx512f", "-mavx512dq", "-mfma"])
# TODO This was in the old FastNoiseSIMD repo from Tinmanjuggernaut. Is it still needed?
# if (env["target"] == "release"):
# # gcc 9.2.1 won"t compile x64 with -O3
# env_thirdparty_avx512.Append(CCFLAGS=["-mavx512f", "-O2"])
# else:
# env_thirdparty_avx512.Append(CCFLAGS=["-mavx512f"])
env_fn2.add_source_files(env.modules_sources, fn2_sources_common)
env_fn2_scalar.add_source_files(env.modules_sources, fn2_sources_scalar)
env_fn2_sse2.add_source_files(env.modules_sources, fn2_sources_sse2)
env_fn2_sse3.add_source_files(env.modules_sources, fn2_sources_sse3)
env_fn2_ssse3.add_source_files(env.modules_sources, fn2_sources_ssse3)
env_fn2_sse41.add_source_files(env.modules_sources, fn2_sources_sse41)
env_fn2_sse42.add_source_files(env.modules_sources, fn2_sources_sse42)
if env["platform"] == "android":
# Both Android and IOS have ARM chips, but only android build tools have necessary headers
env_fn2_arm.add_source_files(env.modules_sources, fn2_sources_arm)
elif env["platform"] in ["windows", "x11", "osx"]:
# AVX is supported on desktop only
env_fn2_avx2.add_source_files(env.modules_sources, fn2_sources_avx2)
env_fn2_avx512.add_source_files(env.modules_sources, fn2_sources_avx512)
# TODO Check webassembly builds (`env["platform"] == "javascript"`)
# Ignored clang warnings because Godot's codebase is old and isn't using override yet
if env['platform'] == 'osx' or env['platform'] == 'android':
env_voxel.Append(CXXFLAGS=['-Wno-inconsistent-missing-override'])
if env['platform'] in ['osx', 'android']:
env_voxel.Append(CXXFLAGS=['-Wno-inconsistent-missing-override'])
# Doesn't work, because reasons
#if env.msvc:

View File

@ -14,41 +14,48 @@ def get_doc_classes():
return [
"VoxelServer",
"VoxelBuffer",
"VoxelMap",
"Voxel",
"VoxelLibrary",
"VoxelColorPalette",
"VoxelBuffer",
"VoxelNode",
"VoxelTerrain",
"VoxelLodTerrain",
"VoxelViewer",
"VoxelStream",
"VoxelStreamScript",
"VoxelStreamFile",
"VoxelStreamBlockFiles",
"VoxelStreamRegionFiles",
"VoxelStreamScript",
"VoxelGenerator",
"VoxelGeneratorFlat",
"VoxelGeneratorWaves",
"VoxelGeneratorHeightmap",
"VoxelGeneratorImage",
"VoxelGeneratorNoise",
"VoxelGeneratorNoise2D",
"VoxelGeneratorTest",
"VoxelGeneratorNoise",
"VoxelGeneratorGraph",
"VoxelGeneratorScript",
"VoxelBoxMover",
"VoxelRaycastResult",
"VoxelTool",
"VoxelToolTerrain",
"VoxelRaycastResult",
"VoxelToolBuffer",
"VoxelBlockSerializer",
"VoxelVoxLoader",
"FastNoiseLite",
"FastNoiseLiteGradient",
"VoxelMesher",
"VoxelMesherBlocky",
"VoxelMesherTransvoxel",
"VoxelMesherDMC"
"VoxelMesherDMC",
"VoxelMesherCubes"
]

View File

@ -1,28 +0,0 @@
# Getting Started With Voxel Tools For Godot
Voxel Tools for Godot is a C++ module that must be compiled into the engine. It requires version 3.1+. The following guide will give you a build of Godot that supports Voxel Tools and show you how to use it.
[Prebuilt binaries](http://tokisan.com/godot-binaries) are also available.
## Tutorials
* [Building Godot With Voxel Tools](02_build-voxel-tools.md)
* [Creating A Voxel Terrain](03_create-terrain.md)
* [Texturing & Materials](04_materials.md)
* [Collision](05_collision.md)
* [Custom Data Generators](06_custom-generator.md)
* [Performance Tips](07_performance-tips.md)
## API
* [Overview](08_api-overview.md)
* [API Class List](api/Class_List.md)
* [Region files specification](specs/region_format_v3.md)
## External Reference
Find more information about related topics here.
* [Custom C++ modules in Godot](https://godot.readthedocs.io/en/latest/development/cpp/custom_modules_in_cpp.html)
* [Dual Marching Cubes algorithm](https://www.volume-gfx.com/volume-rendering/dual-marching-cubes/)
* [Transvoxel algorithm](https://transvoxel.org/)

View File

@ -1,39 +0,0 @@
# Building Godot With Voxel Tools
These steps will walk you through creating a custom build of Godot with the Voxel Tools module compiled into it.
## Build Godot From Source
1. Download and compile the [Godot source](https://github.com/godotengine/godot) by following [the official guide](https://docs.godotengine.org/en/latest/development/compiling/index.html). If you want to regularly update your build (recommended), clone the repository with Git instead of downloading a zip file.
1. Make sure to select the appropriate branches. Generally the master branch of Voxel Tools will build with the master branch and other recent branches of Godot. If there is a versioned Voxel Tools branch (e.g. 3.1), that is intended to match the corresponding version of Godot.
1. Build Godot before adding this or any other modules and make sure it produces an executable.
1. Run the newly built executable found in `godot/bin`. Look under Help/About and confirm that the version string indicates you are running a development version (e.g. 3.2dev.custom_build.ee5ba3e).
## Add Voxel Tools
1. Download or clone the repository for [Voxel Tools](https://github.com/Zylann/godot_voxel). Use Git to clone the repository if you want to make it easy to update your builds (recommended).
1. Make sure to select the branch that corresponds with Godot's branch.
1. Place the Voxel Tools directory inside your Godot source tree, in the `godot/modules` directory.
1. Rename the Voxel Tools folder to `voxel`. When correct, the files (e.g. README.md) will be located in `godot/modules/voxel`. **This is important!**
1. Rebuild Godot and make sure it produces an executable.
1. Test that your build has Voxel support:
1. Run your new Godot build.
1. Create a new project.
1. Create a new 3D scene.
1. Add a new node, search for "Voxel" and see if "VoxelTerrain" appears. If so, you have a successful build. If not, review these instructions and your build logs to see if you missed a step or something failed along the way.
## Updating Your Build
If you cloned Godot and Voxel Tools, you can use git to update your local code.
1. Go to your local Godot source directory `godot` and run `git pull`. It will download all updates from the repository and merge them into your local source.
1. Go to `godot/modules/voxel` and run `git pull`. Git will update Voxel Tools.
1. Rebuild Godot.
**Note:**
Since you are pulling from two development branches, it's probable that on occasion your build won't compile, your project won't open, or your Voxel Tools won't work properly or even crash Godot. To minimize downtime, save your successful builds. Move them out of the build folder and rename them with the version number (e.g. godot-3.2+ee5ba3e.exe). This way, you can continue to use previously working builds until the Godot or Voxel developers fix whatever is broken. It is generally desired by all that code published to repositories will at least build, but stuff happens.
---
* [Next Page](03_create-terrain.md)
* [Doc Index](01_get-started.md)

View File

@ -1,88 +0,0 @@
# Creating A Voxel Terrain
Now that your Godot Engine has voxel support built in, you can either download one of the demos ([Zylann's demos](https://github.com/Zylann/voxelgame) or [TinmanJuggernaut's fps_demo](https://github.com/tinmanjuggernaut/voxelgame)) and start playing with them, or start creating your own terrain.
Watch this 20 minute video tutorial, or work through the text tutorial below for quick answers.
[![How To Make Voxel Terrains In Godot](http://i3.ytimg.com/vi/zfzmcbR1H_0/maxresdefault.jpg)](https://www.youtube.com/watch?v=zfzmcbR1H_0)
## Create A Terrain In The Editor: VoxelTerrain + Heightmap
1. Create a new project and a new 3D scene, with a Spatial type root node.
1. Add a Camera and elevate it by setting the transform: Translation Y = 75 and Rotation X = -25. The terrain starts generating around (0,0,0), but creates high hills, and may be invisible from underneath. We will be looking down from above.
1. Import a black and white heightmap texture such as [this one](https://github.com/Zylann/voxelgame/blob/master/project/blocky_terrain/noise_distorted.png) from the demo. Make sure that the file is imported as an Image and NOT a Texture on the Import panel. You'll likely have to re-import and restart.
1. Add a `VoxelTerrain` node and adjust the following settings:
1. Stream: New VoxelGeneratorImage. Then click VoxelGeneratorImage again.
1. Select the type of terrain you want:
* Blocky: Set Channel = "Type".
* Smooth: Set Channel = "SDF".
1. Image: Load. Select your imported noise image.
1. Set the Viewer Path, Assign, select your camera or player (the parent of your camera).
1. Play your scene and you should see a terrain.
<img src="images/default-terrain.jpg" width="800" />
## Create A Terrain In The Editor: VoxelLODTerrain + 3D Noise
Here we'll look at `VoxelLODTerrain` with a noise data generator.
1. Create a new project and a new 3D scene, with a Spatial type root node.
1. Add a Camera and adjust the following settings:
1. Transform: Translation Y = 200.
1. Rotation X = -25.
1. Far: 2048 (or up to the maximum of 8192, which I use).
1. Add a `VoxelLODTerrain` node and adjust the following settings:
1. Stream: New VoxelGeneratorNoise. Then click VoxelGeneratorNoise again.
1. Noise: New OpenSimplexNoise. Then click OpenSimplexNoise again. Leave the settings at the default, but here's where they are.
1. Set the Viewer Path, Assign, select your camera or player (the parent of your camera).
1. Play your scene and you should see a terrain.
<img src="images/noise-terrain-default.jpg" width="800" />
### Experiment With Noise
Now try playing with the numbers. For instance, these settings will reach the horizon and give a noise terrain with a greater distance between the highest and lowest points:
1. Camera
1. Far: 8192
1. Translate: Y = 240 (Make sure Y is near or above Height Start + Height Range below).
1. VoxelLODTerrain
1. Adjust the noise values as desired or leave at the defaults.
1. Noise: Height Start: -200
1. Noise: Height Range: 600 (This will kill your performance if set too high. However I've experimented with 10,000 on a GTX1060.)
1. View Distance: 4096
1. LOD Count: 8
<img src="images/noise-terrain-far.jpg" width="800" />
### Additional Notes
* We will add materials on the next page.
* Heightmaps, 3D Noise, and custom streams all work with either `VoxelTerrain` or `VoxelLODTerrain`.
## Create A Terrain With Code
Add your own camera and environment as desired, or from above. Then drop this into a script:
```
const HEIGHT_MAP = preload("res://blocky_terrain/noise_distorted.png")
var terrain = VoxelTerrain.new()
func _ready():
terrain.stream = VoxelGeneratorImage.new()
terrain.stream.image = HEIGHT_MAP
terrain.view_distance = 256
terrain.viewer_path = "/root/Spatial/Player" # Change to the path of your camera or player node
add_child(terrain) # Add the terrain to the tree so Godot will render it
```
For a full example, see my [demo code](https://github.com/tinmanjuggernaut/voxelgame/blob/master/project/fps_demo/scripts/CodeTerrain.gd).
---
* [Next Page](04_materials.md)
* [Doc Index](01_get-started.md)

View File

@ -1,84 +0,0 @@
# Materials
The terrain can be textured simply by adding a material to channel 0 in the material section.
Here are some notes for better results.
## Recommended Reading
* [SpatialMaterial](https://docs.godotengine.org/en/latest/tutorials/3d/spatial_material.html) - demonstrates many of the shader options available in Godot.
* [Shading Index](https://docs.godotengine.org/en/latest/tutorials/shading/index.html) - tutorials and the shader language API
* Shader API Reference - some of the most frequently accessed references
* [Shading Language](https://docs.godotengine.org/en/latest/tutorials/shading/shading_reference/shading_language.html)
* [SpatialShader](https://docs.godotengine.org/en/latest/tutorials/shading/shading_reference/spatial_shader.html)
## Triplanar Mapping
Projecting a flat, 2D image texture onto a rounded terrain is like wrapping a piece of paper wrapped around a sphere. It often warps the texture in undesirable ways. Triplanar mapping is a wrapping method that provides a reasonable result for spheres and terrains.
The method involves projecting the texture on to the part of object that directly faces the X-axis. Then projecting it on the sides that directly face the Y-axis. Then again for the Z-axis. The edges of these projections are then blended together with a specified sharpness.
Look at how the brick textures are blended together on the top right sphere.
![Triplanar mapping image](https://docs.godotengine.org/en/3.1/_images/spatial_material25.png)
Read about [triplanar mapping in Godot](https://docs.godotengine.org/en/latest/tutorials/3d/spatial_material.html?highlight=triplanar%20#triplanar-mapping).
The algorithm to implement this is a little complicated, which gets far worse if you also wish to add normal maps and others. However there is a very easy way to do this in the section below.
## Creating A Material
Rather than writing your own shader from scratch, especially with triplanar mapping code, the recommended process is to create a SpatialMaterial, then optionally convert it to a ShaderMaterial.
1. Create a new SpatialMaterial.
1. Add an albedo texture, and if desired, normal map, ambient occlusion, etc.
1. Under UV1, turn on triplanar mapping and adjust triplanar sharpness as desired.
1. Scale and style the material as desired.
1. Optionally [convert the material to a shader](#convert-to-shader-code).
If you want to start without a texture and just want to use a color, try turning down roughness, or adding some metalic to give the surface some reflectivity. This will allow light to reflect off of the curves of the terrain in the distance. Otherwise you'll just see an undifferentiated mass of color.
## Enable Built-In Ambient Occlusion
VoxelTerrain adds Ambient Occlusion to the vertex colors on blocky terrains. You can add this to your material by enabling the `Vertex Color/Use As Albedo` flag in your material. Below is what that looks like on an otherwise plain white material. AO can also be added to any terrain using the AO feature built in to materials.
<img src="https://github.com/tinmanjuggernaut/voxelgame/raw/master/screenshots/blocky-vertex-color.jpg" width="800" />
## How To View Live Changes To Materials Or When Placing Objects
You can't view the terrain in the editor, so there are two options to view your material live while making changes:
* Add a sphere or cube with the same material, then adjust the material in the editor. This option is OK, but the UV scale is usually different than the terrain, so it's not ideal.
* Run your scene, focus the camera on the terrain, reduce the game window and move it to the side, then move the editor window to the other side. With both the editor and game displayed simultaneously, you can adjust the material in the inspector panel and it will update live.
All edits to a SpatialMaterial or the shader parameters of your ShaderMaterial will update live. Editing your shader code will not update live. (Though it may be possible to trigger the engine to recompile your shader code.) You can also use this method to place objects.
## Convert To Shader Code
The SpatialMaterial is a very good base, but can only go so far. If you need further customization, you'll want to convert it to shader code.
1. Add the material to any object.
1. In the inspector for that object, click the down arrow next to the material.
1. Click convert to ShaderMaterial.
Your material now has shader code that produces the same material your SpatialMaterial did, including code for triplanar albedo and normal maps!
Note, you can't edit the shader code and see live changes. You must stop and restart your scene. However you can change shader parameters live.
## Advanced Shading
One of the best ways to learn about shaders is to pick apart and experiment with other's shader code.
Here's a shader that supports two materials, such as grass on the top and rock on the sides, each with triplanar mapped albedo, normal and AO maps, then blended together based on if their normal faces the upward direction or the sides.
You can find a working example in the [fps demo](https://github.com/tinmanjuggernaut/voxelgame), or see the [shader](https://github.com/tinmanjuggernaut/voxelgame/blob/master/project/fps_demo/materials/triplanar.shader) itself.
In the shader parameters, add your two albedo maps, and optionally normal, and AO maps. Then play with the `AB Mix 1` and `AB Mix 2` sliders to adjust how the top and sides blend together. The other settings should be self explanatory. The screenshot below also has a little bit of fog and far DOF added.
<img src="images/textured-terrain.jpg" width="800" />
---
* [Next Page](05_collision.md)
* [Doc Index](01_get-started.md)

View File

@ -1,67 +0,0 @@
# Collision
Physics based collision is enabled by default. It provides both raycasting and collision detection.
You can turn it on or off by setting the `generate_collisions` option on any of the terrain nodes. Or you can enable or disable it in code.
The collision is built along with the mesh. So any blocks that have already been built will not be affected by this setting unless they are regenerated.
## Debugging
You can also turn on the collision wire mesh for debugging. In the editor, look under the Debug menu for `Visible Collision Shapes`.
<img src="images/debug-collision-shapes.gif" />
# Alternatives To Physics Based Collision
Though physics based collision is recommended, there might be times when alternative methods are desired.
## Axis Aligned Bounding Box (Blocky only)
VoxelBoxMover has a function that can test AABB collision. The code below shows how to use it, but see the [blocky demo](https://github.com/Zylann/voxelgame/tree/master/project/blocky_terrain) for the full code.
Example:
```
var box_mover = VoxelBoxMover.new()
var aabb = AABB(Vector3(-0.4, -0.9, -0.4), Vector3(0.8, 1.8, 0.8))
var terrain = get_node("VoxelTerrain")
func _physics_process(delta):
/* Input commands that set velocity go here. */
var motion = velocity * delta
motion = box_mover.get_motion(get_translation(), motion, aabb, terrain)
global_translate(motion)
velocity = motion / delta
```
## Raycasting
You may want to use raycasts when collision has not been enabled. For instance picking the terrain with the mouse cursor. `VoxelTerrain` supports a rudimentary raycast. `VoxelLODTerrain` does not.
Returned values are blocky, integer grid positions, while physics based raycasting will return fine-grained floating point positions.
The usage is simple: `terrain.raycast(start_postion, direction, max_distance)`
Upon success, it returns a dictionary with the following values:
```
hit["position"] - Vector3 integer position where the ray hit
hit["prev_position"] - Previous Vector3 integer position the ray occupied before it hit
```
On failure, it will return an empty dictionary:`Variant()`. You can logically test this result:
```
if terrain.raycast(...):
do something
```
---
* [Next Page](06_custom-generator.md)
* [Doc Index](01_get-started.md)

View File

@ -1,47 +0,0 @@
# Generate Your Own Voxel Data
You can provide your own voxel generator by extending VoxelGenerator in either GDScript or C++.
Note: Your generator must be thread safe.
Create MyStream.gd with the following contents:
```
extends VoxelGenerator
export var channel:int = VoxelBuffer.CHANNEL_TYPE
func get_used_channels_mask () -> int:
return 1<<channel
func generate_block(buffer:VoxelBuffer, origin:Vector3, lod:int) -> void:
if lod != 0: return
if origin.y < 0: buffer.fill(1, channel)
if origin.x==origin.z and origin.y < 1: buffer.fill(1,channel)
```
In your terrain generation script, add this:
```
const MyStream = preload ("MyStream.gd")
var terrain = VoxelTerrain.new()
func _ready():
terrain.stream = MyStream.new()
terrain.view_distance = 256
terrain.viewer_path = "/root/Spatial/Player" # Set this path to your player/camera
add_child(terrain)
```
<img src="images/custom-stream.jpg" width="800" />
Though `VoxelBuffer.fill()` is probably not what you want to use, the above is a quick example. Generate_block generally gives you a block of 16x16x16 cubes to fill all at once, so you'll want to use `VoxelBuffer.set_voxel()` to specify each one. You can change the channel to `VoxelBuffer.CHANNEL_SDF` to get smooth voxels.
In the fps_demo, there is a [custom gdscript stream](https://github.com/tinmanjuggernaut/voxelgame/blob/master/project/fps_demo/scripts/MyStream.gd) that makes a sine wave. This was copied from the [C++ version](../generators/voxel_generator_waves.cpp), which runs a lot faster.
<img src="images/custom-stream-sine.jpg" width="800" />
---
* [Next Page](07_performance-tips.md)
* [Doc Index](01_get-started.md)

View File

@ -1,20 +0,0 @@
# Performance Tips
* Disable VSync and set threading to `Single Safe` in the project settings. Terrain building and editing performs significnatly faster with these settings.
* Excessive noise height will kill your performance, use with care. A height range of 300 can run at 300-400fps on a GTX1060, but a range of 6-10,000 might run at 30-40fps. Hopefully this will be addressed when occlusion culling and other features are available in Godot 4.
* Lower shadow distance on your directional light. I might use 200-400 on a GTX1060, but maybe 20 or disable shadows altogether on an integrated card.
* Use only one directional light. A second cost me a 12% performance hit.
* VoxelLodTerrain has a `collision_lod_count` that limits the creation of collision shapes for distant LODs. Try setting it to 2-3 or higher.
* Optimize and simplify your shaders. In the fps_demo, there are two grass-rock shaders. The second version randomizes the tiling of texture maps so there is no obvious repeating pattern. It only requires two extra texture lookups, but it pretty much halves my frame rate from around 300 to 150 or less.
* Use Linux. On my system, my demo runs with a 30-100% higher frame rate under linux.
---
* [Next Page](08_api-overview.md)
* [Doc Index](01_get-started.md)

View File

@ -1,193 +0,0 @@
# Voxel Tools API Overview
The Voxel Tools API is under development and has not yet settled. This document contains the following:
1. GDScript API reference
1. Terminology used throughout the codebase
1. A description of classes exposed to GDScript
# API Reference
You can refer to the API that is exposed to GDScript in two places:
* You'll find class definitions in the [docs/api](api/Class_List.md) directory.
* Within the Godot editor, access the definitions in the help:
1. Click *Search Help* in the GDScript editor.
1. Type "Voxel".
1. Browse through the classes, methods, and properties exposed to GDScript.
# Terminology Used Throughout The Codebase
**Voxel** - A 3D pixel in a Euclidean world where the coordinates (X, Y, Z) are restricted to integers. That is, space is a 3D grid where each point in space can only be an integer (...-3, -2, -1, 0, 1, 2, 3...) and there is no infinite space between points. As an example, from (0,0,0), the next point in space along the X axis is (1,0,0). There is no (0.5, 0, 0) or (0.25, 0, 0). Each point in space is a cube.
In Minecraft type games, building blocks are cubes. However, they do not have to be full cubes. Minecraft has half-cubes, etc. They can also be smoother shapes, as described below under Smooth [Terrain].
Note that the engine and your graphics card do not work with voxels. They are converted and drawn as triangles like all other meshes at render time. This means you can use voxels and polygonal meshes simultaneously.
**Block** - While a voxel is a single unit of space, a block refers to an N\*N\*N voxel chunk of terrain, where N is 8, 16(default), or 32. Blocks of voxels are paged in and out by the terrain, depending their distance to the viewer. Blocks are therefore much larger than voxels, and the project maintains two grids: voxel space and block space. The latter is 8/16/32 times larger.
**Voxel Data** - This refers to a high resolution source of data, often coming from the real world or an analog source. Imagine an airplane with it's smooth, aerodynamic curves. If we 3D scanned this plane, that would be high resolution voxel data. If we built that airplane out of Legos, that would be a low resolution, blocky representation of the source voxel data. See Blocky below.
**Blocky [Terrain]** - An algorithm that uses full cubes to approximate Voxel data. This is Minecraft, building an airplane out of Legos, or representing a bell curve with a bar chart. It is better suited for man-made shapes with hard corners.
**Smooth [Terrain]** - One of many isosurface extraction algorithms that attempts to represent voxel data with smoother surfaces and is a better fit for organic shapes. Rather than using a full cube to describe the surface, a cube with one or more planes at potentially any angle is used to provide a far more accurate representation of the source data. As an example if you took a Lego block and sanded down the sharp corners to better represent the airplane curves, or sanded down the tops of the bar chart to better represent the bell curve. However you can only sand down to flat planes, no curves within the cubes.
Voxel Tools supports Dual Marching Cubes, Transvoxel, and is structured to support other algorithms in the future. Various algorithms are faster, use less memory, provide manifold (cleaner) meshes, allow for sharp edges, and/or provide more accurate representations of the voxel data.
**LOD - Level of Detail** - As the camera gets further away, detail decreases to improve performance.
# Description of Classes
What follows are notes and descriptions about each of the classes that have been exposed to GDScript.
## Scene Node Classes
These nodes can be added to your scene.
Note: Terrains use their VoxelStream and VoxelMeshers from multiple threads. Access is granted in the editor because I turned off terrain generation specifically here, but at runtime some things (like getting the stream from the terrain and asking it to generate a block) are prone to undefined behavior. I still need to add locks here to suspend threads while configurations are changed.
### VoxelTerrain
An infinite, paged terrain made of voxel blocks, all with the same level of detail. Voxels are polygonized around the viewer by distance in a large cubic space.
* Voxel data is streamed using a VoxelGenerator (e.g. noise image, 3D noise texture, etc).
* Stores a terrain in a VoxelMap.
* Supports blocky and smooth terrains.
* Handles the main Godot \_process() call to update the terrain, load and unload voxel blocks, and generate the mesh and collision.
* Provides raycasts (for manual collision and click detection) in addition to physics collision based raycasts.
### VoxelLodTerrain
An infinite, paged terrain made of voxel blocks with a variable level of detail. Designed for high view distances. Voxels are polygonized around the viewer by distance in a very large sphere.
* Data is streamed using a VoxelGenerator, which must support LOD.
* Stores a terrain in a VoxelMap.
* Handles the main Godot \_process() call to update the terrain, load and unload voxel blocks, and generate the mesh and collision.
* Supports only smooth terrains.
* Supports raycasts via physics based collision.
* Manages Levels of detail (LOD).
## Voxel Data Provider Classes
These classes provide the source voxel data.
### VoxelGenerator
Base class to provide infinite, paged voxel data as blocks. Doesn't provide data itself, but can be extended with GDScript.
If you choose to implement your own generator that does not offer LOD, it is recommended to `assert(lod == 0)`. It will be executed in a separate thread, so access the main thread with care.
The classes below provide voxel data.
### VoxelGeneratorFlat
Generates a flat world.
### VoxelGeneratorWaves
Generates regular waves.
### VoxelGeneratorImage
Creates a heightmap based on a user provided, black and white image.
This class expects the image to be imported as an Image. By default, image files are imported as a Texture, which are stored in video RAM and are not accessible to the engine. On the Import tab, you need to change the import method of your image to Image and may need to restart Godot before VoxelStreamImage will recognize your file.
For smooth terrain, it is recommended to use more than 8-bit precision images, using either EXR or HDR formats. Formats loaded as 8-bit such as PNG or JPG are supported but will look blocky at close range.
### VoxelGeneratorNoise
Generates organic-looking terrain using a 3D noise algorithm. This one can have caves and overhangs but loads slower.
### VoxelGeneratorNoise2D
Generates organic-looking terrain using a 3D noise algorithm. This one doesn't have overhangs but loads faster.
## Mesher Classes
These classes use full cubes or an isosurface extraction algorithm to represent the source voxel data. They polygonize arbitrary-sized chunks of voxels.
Note: Their initial use case was for terrains, so the input data must be padded by a certain amount of voxels to work (get_minimum_padding() gives you that number. It's usually 1 or 2).
### VoxelMesher
Abstract base class to build a polygonal terrain mesh from a given VoxelBuffer. Unlike VoxelGenerator, this class cannot be implemented with a script. You must extend it with a C++ class to implement another meshing algorithm.
### VoxelMesherBlocky
Builds a mesh using full cubes only. Looks like Minecraft.
* The fastest mesher.
* No LOD support currently.
* Offers baked ambient occlusion around edges.
* Has the capability to support any kind of shape inside the block, (e.g. half-cubes, grass shapes, etc), but this API is not yet tested or exposed very well or at all.
### VoxelMesherDMC
Builds a smooth mesh using the Dual Marching Cubes algorithm.
* Supports LOD by simply scaling up the result.
* Uses marching squares skirts to hide the cracks between sections with a different LOD.
### VoxelMesherTransvoxel
Builds a smooth mesh using the Transvoxel algorithm.
* This is now the default smooth mesher.
## Storage Classes
### VoxelMap
Where Terrains store their voxels, as an infinite, 3D, sparse grid. It can be thought of as the infinite equivalent of VoxelBuffer.
* Stores a 3D grid in a HashMap containing integer vector3s as keys, and VoxelBlocks as values. i.e. key:Vector3int => value:VoxelBlock pairs.
* Provides functions to convert between the voxel grid coordinates and block grid coordinates, which is 8/16/32 times larger.
* The default grid size is 16 and while some support is there for 8 and 32, this setting is not yet adjustable.
Note: There are two grid coordinate systems. One addresses voxels individually, the other addresses blocks. It was initially required to allow streaming of the world, because loading voxels individually would have been very expensive. So instead I load chunks (like Minecraft), and those chunks lie in a grid having a step 16 times larger (because each block contains 16\*16\*16 voxels). When LOD is considered, there are even multiple block grids, but each having a scale higher by powers of two.
### VoxelBlock (not exposed)
Internal structure for holding a reference to mesh visuals, collision, and a block of voxel data. Not available to GDScript, but supports both the above and below classes.
* Stores 3D grid position and LOD index.
* Creates StaticBody and Shapes to enable collision, and CollisionShapes to support the editor `Debug\Visual Collsion Shapes` feature.
* References a VoxelBuffer and a Mesh.
### VoxelBuffer
The underlying storage for voxels. Also used to pass voxels between functions.
* Stores an arbitrary number of voxels (Vector3int specifying how many in each direction).
* Stores up to 8 channels of arbitrary data per voxel. Each channel is allocated only upon use. (e.g. R,G,B,A, game play types (type, state, light), etc).
## Supporting Classes
### VoxelTool
Provides functions to add or remove smooth terrain. The interface provides for points, lines, circles, spheres, boxes, and custom shapes, though not all are implemented.
* You can generate a 2D heightmap and ask the tool to "rasterize" that portion of the world in a VoxelBuffer, which is what you will have to fill when implementing a custom VoxelGenerator.
* Since Godot does not support 3D textures, a custom shape could be added using an existing VoxelBuffer as input. This is not yet implemented.
### VoxelBoxMover (blocky)
Provides Axis Aligned Bounding Box based collision.
### Voxel (blocky)
A basic voxel unit. Creating Voxels with VoxelLibrary is recommended.
* Stores ID, name, material, transparency and type
### VoxelLibrary (blocky)
A collection of voxel types, which is used for blocky only, similar to Minecraft or GridMap.
---
* [API Class List](api/Class_List.md)
* [Doc Index](01_get-started.md)

View File

@ -1,32 +0,0 @@
# Voxel Tools Class List
These classes are exposed to GDScript. This information is also available within the Godot script editor by searching help.
* [Voxel.md](Voxel.md)
* [VoxelBoxMover.md](VoxelBoxMover.md)
* [VoxelBuffer.md](VoxelBuffer.md)
* [VoxelGenerator.md](VoxelGenerator.md)
* [VoxelGeneratorGraph.md](VoxelGeneratorGraph.md)
* [VoxelGeneratorHeightmap.md](VoxelGeneratorHeightmap.md)
* [VoxelGeneratorImage.md](VoxelGeneratorImage.md)
* [VoxelGeneratorNoise.md](VoxelGeneratorNoise.md)
* [VoxelGeneratorNoise2D.md](VoxelGeneratorNoise2D.md)
* [VoxelLibrary.md](VoxelLibrary.md)
* [VoxelLodTerrain.md](VoxelLodTerrain.md)
* [VoxelMap.md](VoxelMap.md)
* [VoxelMesher.md](VoxelMesher.md)
* [VoxelMesherBlocky.md](VoxelMesherBlocky.md)
* [VoxelMesherDMC.md](VoxelMesherDMC.md)
* [VoxelMesherTransvoxel.md](VoxelMesherTransvoxel.md)
* [VoxelRaycastResult.md](VoxelRaycastResult.md)
* [VoxelStream.md](VoxelStream.md)
* [VoxelStreamBlockFiles.md](VoxelStreamBlockFiles.md)
* [VoxelStreamFile.md](VoxelStreamFile.md)
* [VoxelStreamRegionFiles.md](VoxelStreamRegionFiles.md)
* [VoxelTerrain.md](VoxelTerrain.md)
* [VoxelTool.md](VoxelTool.md)
* [VoxelToolTerrain.md](VoxelToolTerrain.md)
---
* [Doc Index](../01_get-started.md)
_Generated on Aug 10, 2020_

View File

@ -1,152 +0,0 @@
# Class: Voxel
Inherits: Resource
_Godot version: 3.2_
## Class Description:
Represents a model to be used for voxels of a specific TYPE value. Such models must be contained within a `VoxelLibrary` to be used with `VoxelTerrain` or directly with a `VoxelMesherBlocky`.
Some other various properties also exist to make it easier to implements games based on this technique (such as Minecraft).
## Online Tutorials:
## Constants:
#### » GeometryType.GEOMETRY_NONE = 0
#### » GeometryType.GEOMETRY_CUBE = 1
#### » GeometryType.GEOMETRY_CUSTOM_MESH = 2
#### » GeometryType.GEOMETRY_MAX = 3
#### » Side.SIDE_NEGATIVE_X = 1
#### » Side.SIDE_POSITIVE_X = 0
#### » Side.SIDE_NEGATIVE_Y = 2
#### » Side.SIDE_POSITIVE_Y = 3
#### » Side.SIDE_NEGATIVE_Z = 4
#### » Side.SIDE_POSITIVE_Z = 5
#### » Side.SIDE_COUNT = 6
## Properties:
#### » Array collision_aabbs
`set_collision_aabbs (value)` setter
`get_collision_aabbs ()` getter
#### » int collision_mask
`set_collision_mask (value)` setter
`get_collision_mask ()` getter
#### » Color color
`set_color (value)` setter
`get_color ()` getter
#### » Mesh custom_mesh
`set_custom_mesh (value)` setter
`get_custom_mesh ()` getter
#### » int Voxel.GeometryType.geometry_type
`set_geometry_type (value)` setter
`get_geometry_type ()` getter
#### » int material_id
`set_material_id (value)` setter
`get_material_id ()` getter
#### » bool random_tickable
`set_random_tickable (value)` setter
`is_random_tickable ()` getter
#### » bool transparent
`set_transparent (value)` setter
`is_transparent ()` getter
#### » String voxel_name
`set_voxel_name (value)` setter
`get_voxel_name ()` getter
## Methods:
#### » int get_id ( ) const
#### » bool is_empty() ( ) const
#### » Voxel set_color ( Color color )
#### » Voxel set_id ( int id )
#### » Voxel set_material_id ( int id )
#### » Voxel set_transparent ( bool transparent )
#### » Voxel set_voxel_name ( String name )
## Signals:
---
* [Class List](Class_List.md)
* [Doc Index](../01_get-started.md)
_Generated on Aug 10, 2020_

View File

@ -1,37 +0,0 @@
# Class: VoxelBoxMover
Inherits: Reference
_Godot version: 3.2_
## Online Tutorials:
## Constants:
## Properties:
## Methods:
#### » int get_collision_mask ( ) const
#### » Vector3 get_motion ( Vector3 pos, Vector3 motion, AABB aabb, Node terrain )
#### » void set_collision_mask ( int mask )
## Signals:
---
* [Class List](Class_List.md)
* [Doc Index](../01_get-started.md)
_Generated on Aug 10, 2020_

View File

@ -1,180 +0,0 @@
# Class: VoxelBuffer
Inherits: Reference
_Godot version: 3.2_
## Class Description:
Dense voxels data storage. Works like a normal 3D grid. Organized in channels of configurable bit depth. Values can be interpreted either as unsigned integers or normalized floats. Arbitrary metadata can also be stored, at higher cost.
## Online Tutorials:
## Constants:
#### » ChannelId.CHANNEL_TYPE = 0
#### » ChannelId.CHANNEL_SDF = 1
#### » ChannelId.CHANNEL_DATA2 = 2
#### » ChannelId.CHANNEL_DATA3 = 3
#### » ChannelId.CHANNEL_DATA4 = 4
#### » ChannelId.CHANNEL_DATA5 = 5
#### » ChannelId.CHANNEL_DATA6 = 6
#### » ChannelId.CHANNEL_DATA7 = 7
#### » ChannelId.MAX_CHANNELS = 8
#### » Depth.DEPTH_8_BIT = 0
#### » Depth.DEPTH_16_BIT = 1
#### » Depth.DEPTH_32_BIT = 2
#### » Depth.DEPTH_64_BIT = 3
#### » Depth.DEPTH_COUNT = 4
#### » Compression.COMPRESSION_NONE = 0
#### » Compression.COMPRESSION_UNIFORM = 1
#### » Compression.COMPRESSION_COUNT = 2
## Properties:
## Methods:
#### » void clear ( )
#### » void clear_voxel_metadata ( )
#### » void clear_voxel_metadata_in_area ( Vector3 min_pos, Vector3 max_pos )
#### » void copy_channel_from ( VoxelBuffer other, int channel )
#### » void copy_channel_from_area ( VoxelBuffer other, Vector3 src_min, Vector3 src_max, Vector3 dst_min, int channel )
#### » void copy_voxel_metadata_in_area ( VoxelBuffer src_min_pos, Vector3 src_max_pos, Vector3 dst_min_pos, Vector3 arg3 )
#### » void create ( int sx, int sy, int sz )
#### » void downscale_to ( VoxelBuffer dst, Vector3 src_min, Vector3 src_max, Vector3 dst_min ) const
#### » void fill ( int value, int channel=0 )
#### » void fill_area ( int value, Vector3 min, Vector3 max, int channel=0 )
#### » void fill_f ( float value, int channel=0 )
#### » void for_each_voxel_metadata ( FuncRef callback ) const
#### » void for_each_voxel_metadata_in_area ( FuncRef callback, Vector3 min_pos, Vector3 max_pos )
#### » Variant get_block_metadata ( ) const
#### » int get_channel_compression ( int channel ) const
#### » int get_channel_depth ( int channel ) const
#### » Vector3 get_size ( ) const
#### » int get_size_x ( ) const
#### » int get_size_y ( ) const
#### » int get_size_z ( ) const
#### » int get_voxel ( int x, int y, int z, int channel=0 ) const
#### » float get_voxel_f ( int x, int y, int z, int channel=0 ) const
#### » Variant get_voxel_metadata ( Vector3 pos ) const
#### » VoxelTool get_voxel_tool ( )
#### » bool is_uniform ( int channel ) const
#### » void optimize ( )
#### » void set_block_metadata ( Variant meta )
#### » void set_channel_depth ( int channel, int depth )
#### » void set_voxel ( int value, int x, int y, int z, int channel=0 )
#### » void set_voxel_f ( float value, int x, int y, int z, int channel=0 )
#### » void set_voxel_metadata ( Vector3 pos, Variant value )
#### » void set_voxel_v ( int value, Vector3 pos, int channel=0 )
## Signals:
---
* [Class List](Class_List.md)
* [Doc Index](../01_get-started.md)
_Generated on Aug 10, 2020_

View File

@ -1,31 +0,0 @@
# Class: VoxelGenerator
Inherits: VoxelStream
_Godot version: 3.2_
## Online Tutorials:
## Constants:
## Properties:
## Methods:
#### » void generate_block ( VoxelBuffer out_buffer, Vector3 origin_in_voxels, int lod )
## Signals:
---
* [Class List](Class_List.md)
* [Doc Index](../01_get-started.md)
_Generated on Aug 10, 2020_

View File

@ -1,205 +0,0 @@
# Class: VoxelGeneratorGraph
Inherits: VoxelGenerator
_Godot version: 3.2_
## Online Tutorials:
## Constants:
#### » NodeTypeID.NODE_CONSTANT = 0
#### » NodeTypeID.NODE_INPUT_X = 1
#### » NodeTypeID.NODE_INPUT_Y = 2
#### » NodeTypeID.NODE_INPUT_Z = 3
#### » NodeTypeID.NODE_OUTPUT_SDF = 4
#### » NodeTypeID.NODE_ADD = 5
#### » NodeTypeID.NODE_SUBTRACT = 6
#### » NodeTypeID.NODE_MULTIPLY = 7
#### » NodeTypeID.NODE_DIVIDE = 8
#### » NodeTypeID.NODE_SIN = 9
#### » NodeTypeID.NODE_FLOOR = 10
#### » NodeTypeID.NODE_ABS = 11
#### » NodeTypeID.NODE_SQRT = 12
#### » NodeTypeID.NODE_FRACT = 13
#### » NodeTypeID.NODE_STEPIFY = 14
#### » NodeTypeID.NODE_WRAP = 15
#### » NodeTypeID.NODE_MIN = 16
#### » NodeTypeID.NODE_MAX = 17
#### » NodeTypeID.NODE_DISTANCE_2D = 18
#### » NodeTypeID.NODE_DISTANCE_3D = 19
#### » NodeTypeID.NODE_CLAMP = 20
#### » NodeTypeID.NODE_MIX = 21
#### » NodeTypeID.NODE_REMAP = 22
#### » NodeTypeID.NODE_SMOOTHSTEP = 23
#### » NodeTypeID.NODE_CURVE = 24
#### » NodeTypeID.NODE_SELECT = 25
#### » NodeTypeID.NODE_NOISE_2D = 26
#### » NodeTypeID.NODE_NOISE_3D = 27
#### » NodeTypeID.NODE_IMAGE_2D = 28
#### » NodeTypeID.NODE_SDF_PLANE = 29
#### » NodeTypeID.NODE_SDF_BOX = 30
#### » NodeTypeID.NODE_SDF_SPHERE = 31
#### » NodeTypeID.NODE_SDF_TORUS = 32
#### » NodeTypeID.NODE_SDF_PREVIEW = 33
#### » NodeTypeID.NODE_TYPE_COUNT = 34
## Properties:
## Methods:
#### » void add_connection ( int src_node_id, int src_port_index, int dst_node_id, int dst_port_index )
#### » bool can_connect ( int src_node_id, int src_port_index, int dst_node_id, int dst_port_index ) const
#### » void clear ( )
#### » void compile ( )
#### » int create_node ( int type_id, Vector2 position, int id=0 )
#### » void debug_load_waves_preset ( )
#### » float debug_measure_microseconds_per_voxel ( )
#### » float generate_single ( Vector3 arg0 )
#### » Array get_connections ( ) const
#### » Variant get_node_default_input ( int node_id, int input_index ) const
#### » Vector2 get_node_gui_position ( int node_id ) const
#### » PoolIntArray get_node_ids ( ) const
#### » Variant get_node_param ( int node_id, int param_index ) const
#### » int get_node_type_count ( ) const
#### » int get_node_type_id ( int node_id ) const
#### » Dictionary get_node_type_info ( int type_id ) const
#### » bool is_compressing_uniform_channels ( ) const
#### » void remove_connection ( int src_node_id, int src_port_index, int dst_node_id, int dst_port_index )
#### » void remove_node ( int node_id )
#### » void set_compress_uniform_channels ( bool enabled )
#### » void set_node_default_input ( int node_id, int input_index, Variant value )
#### » void set_node_gui_position ( int node_id, Vector2 position )
#### » void set_node_param ( int node_id, int param_index, Variant value )
#### » void set_node_param_null ( int node_id, int param_index )
## Signals:
---
* [Class List](Class_List.md)
* [Doc Index](../01_get-started.md)
_Generated on Aug 10, 2020_

View File

@ -1,56 +0,0 @@
# Class: VoxelGeneratorHeightmap
Inherits: VoxelGenerator
_Godot version: 3.2_
## Online Tutorials:
## Constants:
## Properties:
#### » int VoxelBuffer.ChannelId.channel
`set_channel (value)` setter
`get_channel ()` getter
#### » float height_range
`set_height_range (value)` setter
`get_height_range ()` getter
#### » float height_start
`set_height_start (value)` setter
`get_height_start ()` getter
#### » float iso_scale
`set_iso_scale (value)` setter
`get_iso_scale ()` getter
## Methods:
## Signals:
---
* [Class List](Class_List.md)
* [Doc Index](../01_get-started.md)
_Generated on Aug 10, 2020_

View File

@ -1,42 +0,0 @@
# Class: VoxelGeneratorImage
Inherits: VoxelGeneratorHeightmap
_Godot version: 3.2_
## Online Tutorials:
## Constants:
## Properties:
#### » bool blur_enabled
`set_blur_enabled (value)` setter
`is_blur_enabled ()` getter
#### » Image image
`set_image (value)` setter
`get_image ()` getter
## Methods:
## Signals:
---
* [Class List](Class_List.md)
* [Doc Index](../01_get-started.md)
_Generated on Aug 10, 2020_

View File

@ -1,56 +0,0 @@
# Class: VoxelGeneratorNoise
Inherits: VoxelGenerator
_Godot version: 3.2_
## Online Tutorials:
## Constants:
## Properties:
#### » int VoxelBuffer.ChannelId.channel
`set_channel (value)` setter
`get_channel ()` getter
#### » float height_range
`set_height_range (value)` setter
`get_height_range ()` getter
#### » float height_start
`set_height_start (value)` setter
`get_height_start ()` getter
#### » OpenSimplexNoise noise
`set_noise (value)` setter
`get_noise ()` getter
## Methods:
## Signals:
---
* [Class List](Class_List.md)
* [Doc Index](../01_get-started.md)
_Generated on Aug 10, 2020_

View File

@ -1,42 +0,0 @@
# Class: VoxelGeneratorNoise2D
Inherits: VoxelGeneratorHeightmap
_Godot version: 3.2_
## Online Tutorials:
## Constants:
## Properties:
#### » Curve curve
`set_curve (value)` setter
`get_curve ()` getter
#### » OpenSimplexNoise noise
`set_noise (value)` setter
`get_noise ()` getter
## Methods:
## Signals:
---
* [Class List](Class_List.md)
* [Doc Index](../01_get-started.md)
_Generated on Aug 10, 2020_

View File

@ -1,60 +0,0 @@
# Class: VoxelLibrary
Inherits: Resource
_Godot version: 3.2_
## Online Tutorials:
## Constants:
#### » MAX_VOXEL_TYPES = 65536
## Properties:
#### » int atlas_size
`set_atlas_size (value)` setter
`get_atlas_size ()` getter
#### » int voxel_count
`set_voxel_count (value)` setter
`get_voxel_count ()` getter
## Methods:
#### » void bake ( )
#### » Voxel create_voxel ( int id, String name )
#### » Voxel get_voxel ( int id )
#### » Voxel get_voxel_by_name ( String name )
#### » int get_voxel_index_from_name ( String name ) const
## Signals:
---
* [Class List](Class_List.md)
* [Doc Index](../01_get-started.md)
_Generated on Aug 10, 2020_

View File

@ -1,114 +0,0 @@
# Class: VoxelLodTerrain
Inherits: Spatial
_Godot version: 3.2_
## Online Tutorials:
## Constants:
## Properties:
#### » int collision_lod_count
`set_collision_lod_count (value)` setter
`get_collision_lod_count ()` getter
#### » bool generate_collisions
`set_generate_collisions (value)` setter
`get_generate_collisions ()` getter
#### » int lod_count
`set_lod_count (value)` setter
`get_lod_count ()` getter
#### » float lod_split_scale
`set_lod_split_scale (value)` setter
`get_lod_split_scale ()` getter
#### » Material material
`set_material (value)` setter
`get_material ()` getter
#### » VoxelStream stream
`set_stream (value)` setter
`get_stream ()` getter
#### » int view_distance
`set_view_distance (value)` setter
`get_view_distance ()` getter
#### » NodePath viewer_path
`set_viewer_path (value)` setter
`get_viewer_path ()` getter
## Methods:
#### » Dictionary debug_get_block_info ( Vector3 block_pos, int lod ) const
#### » Array debug_get_octrees ( ) const
#### » Array debug_print_sdf_top_down ( Vector3 center, Vector3 extents ) const
#### » Array debug_raycast_block ( Vector3 origin, Vector3 dir ) const
#### » int get_block_region_extent ( ) const
#### » int get_block_size ( ) const
#### » Dictionary get_statistics ( ) const
#### » VoxelTool get_voxel_tool ( )
#### » void save_modified_blocks ( )
#### » Vector3 voxel_to_block_position ( Vector3 lod_index, int arg1 ) const
## Signals:
---
* [Class List](Class_List.md)
* [Doc Index](../01_get-started.md)
_Generated on Aug 10, 2020_

View File

@ -1,70 +0,0 @@
# Class: VoxelMap
Inherits: Reference
_Godot version: 3.2_
## Online Tutorials:
## Constants:
## Properties:
## Methods:
#### » Vector3 block_to_voxel ( Vector3 block_pos ) const
#### » int get_block_size ( ) const
#### » void get_buffer_copy ( Vector3 min_pos, VoxelBuffer out_buffer, int channel=0 )
#### » int get_default_voxel ( int channel=0 )
#### » int get_voxel ( int x, int y, int z, int c=0 )
#### » float get_voxel_f ( int x, int y, int z, int c=1 )
#### » int get_voxel_v ( Vector3 pos, int c=0 )
#### » bool has_block ( int x, int y, int z )
#### » void set_block_buffer ( Vector3 block_pos, VoxelBuffer buffer )
#### » void set_default_voxel ( int value, int channel=0 )
#### » void set_voxel ( int value, int x, int y, int z, int c=0 )
#### » void set_voxel_f ( float value, int x, int y, int z, int c=1 )
#### » void set_voxel_v ( int value, Vector3 pos, int c=0 )
#### » Vector3 voxel_to_block ( Vector3 voxel_pos ) const
## Signals:
---
* [Class List](Class_List.md)
* [Doc Index](../01_get-started.md)
_Generated on Aug 10, 2020_

View File

@ -1,37 +0,0 @@
# Class: VoxelMesher
Inherits: Reference
_Godot version: 3.2_
## Online Tutorials:
## Constants:
## Properties:
## Methods:
#### » Mesh build_mesh ( VoxelBuffer voxel_buffer, Array materials )
#### » int get_maximum_padding ( ) const
#### » int get_minimum_padding ( ) const
## Signals:
---
* [Class List](Class_List.md)
* [Doc Index](../01_get-started.md)
_Generated on Aug 10, 2020_

View File

@ -1,51 +0,0 @@
# Class: VoxelMesherBlocky
Inherits: VoxelMesher
_Godot version: 3.2_
## Class Description:
Produces a mesh by batching models corresponding to each voxel value, similar to games like Minecraft or StarMade. Occluded faces are removed from the result, and some degree of ambient occlusion can be baked on the edges. Values are expected to be in the [constant VoxelBuffer.CHANNEL_TYPE] channel. Models are defined with a `VoxelLibrary`, in which model indices correspond to the voxel values. Models don't have to be cubes.
## Online Tutorials:
## Constants:
## Properties:
## Methods:
#### » VoxelLibrary get_library ( ) const
#### » float get_occlusion_darkness ( ) const
#### » bool get_occlusion_enabled ( ) const
#### » void set_library ( VoxelLibrary voxel_library )
#### » void set_occlusion_darkness ( float value )
#### » void set_occlusion_enabled ( bool enable )
## Signals:
---
* [Class List](Class_List.md)
* [Doc Index](../01_get-started.md)
_Generated on Aug 10, 2020_

View File

@ -1,87 +0,0 @@
# Class: VoxelMesherDMC
Inherits: VoxelMesher
_Godot version: 3.2_
## Class Description:
Implements isosurface generation (smooth voxels) using `url=https://www.volume-gfx.com/volume-rendering/dual-marching-cubes/`Dual Marching Cubes`/url`.
## Online Tutorials:
## Constants:
#### » MeshMode.MESH_NORMAL = 0
#### » MeshMode.MESH_WIREFRAME = 1
#### » MeshMode.MESH_DEBUG_OCTREE = 2
#### » MeshMode.MESH_DEBUG_DUAL_GRID = 3
#### » SimplifyMode.SIMPLIFY_OCTREE_BOTTOM_UP = 0
#### » SimplifyMode.SIMPLIFY_OCTREE_TOP_DOWN = 1
#### » SimplifyMode.SIMPLIFY_NONE = 2
#### » SeamMode.SEAM_NONE = 0
#### » SeamMode.SEAM_MARCHING_SQUARE_SKIRTS = 1
## Properties:
## Methods:
#### » float get_geometric_error ( ) const
#### » int get_mesh_mode ( ) const
#### » int get_seam_mode ( ) const
#### » int get_simplify_mode ( ) const
#### » Dictionary get_statistics ( ) const
#### » void set_geometric_error ( float error )
#### » void set_mesh_mode ( int mode )
#### » void set_seam_mode ( int mode )
#### » void set_simplify_mode ( int mode )
## Signals:
---
* [Class List](Class_List.md)
* [Doc Index](../01_get-started.md)
_Generated on Aug 10, 2020_

View File

@ -1,36 +0,0 @@
# Class: VoxelMesherTransvoxel
Inherits: VoxelMesher
_Godot version: 3.2_
## Class Description:
Implements isosurface generation (smooth voxels) using the `url=https://transvoxel.org/]Transvoxel[/url` algorithm.
## Online Tutorials:
## Constants:
## Properties:
## Methods:
#### » ArrayMesh build_transition_mesh ( VoxelBuffer voxel_buffer, int direction )
## Signals:
---
* [Class List](Class_List.md)
* [Doc Index](../01_get-started.md)
_Generated on Aug 10, 2020_

View File

@ -1,42 +0,0 @@
# Class: VoxelRaycastResult
Inherits: Reference
_Godot version: 3.2_
## Online Tutorials:
## Constants:
## Properties:
#### » Vector3 position
` (value)` setter
`get_position ()` getter
#### » Vector3 previous_position
` (value)` setter
`get_previous_position ()` getter
## Methods:
## Signals:
---
* [Class List](Class_List.md)
* [Doc Index](../01_get-started.md)
_Generated on Aug 10, 2020_

View File

@ -1,37 +0,0 @@
# Class: VoxelStream
Inherits: Resource
_Godot version: 3.2_
## Online Tutorials:
## Constants:
## Properties:
## Methods:
#### » void emerge_block ( VoxelBuffer out_buffer, Vector3 origin_in_voxels, int lod )
#### » int get_used_channels_mask ( ) const
#### » void immerge_block ( VoxelBuffer buffer, Vector3 origin_in_voxels, int lod )
## Signals:
---
* [Class List](Class_List.md)
* [Doc Index](../01_get-started.md)
_Generated on Aug 10, 2020_

View File

@ -1,35 +0,0 @@
# Class: VoxelStreamBlockFiles
Inherits: VoxelStreamFile
_Godot version: 3.2_
## Online Tutorials:
## Constants:
## Properties:
#### » String directory
`set_directory (value)` setter
`get_directory ()` getter
## Methods:
## Signals:
---
* [Class List](Class_List.md)
* [Doc Index](../01_get-started.md)
_Generated on Aug 10, 2020_

View File

@ -1,45 +0,0 @@
# Class: VoxelStreamFile
Inherits: VoxelStream
_Godot version: 3.2_
## Online Tutorials:
## Constants:
## Properties:
#### » VoxelStream fallback_stream
`set_fallback_stream (value)` setter
`get_fallback_stream ()` getter
#### » bool save_fallback_output
`set_save_fallback_output (value)` setter
`get_save_fallback_output ()` getter
## Methods:
#### » Vector3 get_block_size ( ) const
## Signals:
---
* [Class List](Class_List.md)
* [Doc Index](../01_get-started.md)
_Generated on Aug 10, 2020_

View File

@ -1,72 +0,0 @@
# Class: VoxelStreamRegionFiles
Inherits: VoxelStreamFile
_Godot version: 3.2_
## Online Tutorials:
## Constants:
## Properties:
#### » int block_size_po2
`set_block_size_po2 (value)` setter
`get_region_size_po2 ()` getter
#### » String directory
`set_directory (value)` setter
`get_directory ()` getter
#### » int lod_count
`set_lod_count (value)` setter
`get_lod_count ()` getter
#### » int region_size_po2
`set_region_size_po2 (value)` setter
`get_region_size_po2 ()` getter
#### » int sector_size
`set_sector_size (value)` setter
`get_sector_size ()` getter
## Methods:
#### » void convert_files ( Dictionary new_settings )
#### » int get_block_size_po2 ( ) const
#### » Vector3 get_region_size ( ) const
## Signals:
---
* [Class List](Class_List.md)
* [Doc Index](../01_get-started.md)
_Generated on Aug 10, 2020_

View File

@ -1,97 +0,0 @@
# Class: VoxelTerrain
Inherits: Spatial
_Godot version: 3.2_
## Online Tutorials:
## Constants:
## Properties:
#### » bool generate_collisions
`set_generate_collisions (value)` setter
`get_generate_collisions ()` getter
#### » VoxelStream stream
`set_stream (value)` setter
`get_stream ()` getter
#### » int view_distance
`set_view_distance (value)` setter
`get_view_distance ()` getter
#### » NodePath viewer_path
`set_viewer_path (value)` setter
`get_viewer_path ()` getter
#### » VoxelLibrary voxel_library
`set_voxel_library (value)` setter
`get_voxel_library ()` getter
## Methods:
#### » Vector3 block_to_voxel ( Vector3 block_pos )
#### » Material get_material ( int id ) const
#### » Dictionary get_statistics ( ) const
#### » VoxelTool get_voxel_tool ( )
#### » void save_block ( Vector3 arg0 )
#### » void save_modified_blocks ( )
#### » void set_material ( int id, Material material )
#### » Vector3 voxel_to_block ( Vector3 voxel_pos )
## Signals:
#### » block_loaded
Emitted when a new block is loaded from stream. Note it might be not visible yet.
#### » block_unloaded
Emitted when a block unloaded due to being outside view distance.
---
* [Class List](Class_List.md)
* [Doc Index](../01_get-started.md)
_Generated on Aug 10, 2020_

View File

@ -1,101 +0,0 @@
# Class: VoxelTool
Inherits: Reference
_Godot version: 3.2_
## Online Tutorials:
## Constants:
#### » Mode.MODE_ADD = 0
#### » Mode.MODE_REMOVE = 1
#### » Mode.MODE_SET = 2
## Properties:
#### » int channel
`set_channel (value)` setter
`get_channel ()` getter
#### » int eraser_value
`set_eraser_value (value)` setter
`get_eraser_value ()` getter
#### » int VoxelTool.Mode.mode
`set_mode (value)` setter
`get_mode ()` getter
#### » int value
`set_value (value)` setter
`get_value ()` getter
## Methods:
#### » void do_box ( Vector3 begin, Vector3 end )
Operate on a rectangular cuboid section of the terrain. `begin` and `end` are inclusive. Choose operation and which voxel to use by setting `value` and `mode` before calling this function.
#### » void do_point ( Vector3 pos )
#### » void do_sphere ( Vector3 center, float radius )
#### » int get_voxel ( Vector3 pos )
#### » float get_voxel_f ( Vector3 pos )
#### » Variant get_voxel_metadata ( Vector3 pos )
#### » void paste ( Vector3 dst_pos, Reference src_buffer, int src_mask_value )
#### » VoxelRaycastResult raycast ( Vector3 origin, Vector3 direction, float max_distance=10.0, int collision_mask=4294967295 )
#### » void set_voxel ( Vector3 pos, int v )
#### » void set_voxel_f ( Vector3 pos, float v )
#### » void set_voxel_metadata ( Vector3 pos, Variant meta )
## Signals:
---
* [Class List](Class_List.md)
* [Doc Index](../01_get-started.md)
_Generated on Aug 10, 2020_

View File

@ -1,31 +0,0 @@
# Class: VoxelToolTerrain
Inherits: VoxelTool
_Godot version: 3.2_
## Online Tutorials:
## Constants:
## Properties:
## Methods:
#### » void run_blocky_random_tick ( AABB voxel_count, int callback, FuncRef batch_count, int arg3=16 ) const
## Signals:
---
* [Class List](Class_List.md)
* [Doc Index](../01_get-started.md)
_Generated on Aug 10, 2020_

View File

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="FastNoiseLite" inherits="Resource" version="3.2">
<brief_description>
Generates coherent and fractal noise using the FastNoiseLite library.
</brief_description>
<description>
</description>
<tutorials>
</tutorials>
<methods>
<method name="get_noise_2d">
<return type="float">
</return>
<argument index="0" name="x" type="float">
</argument>
<argument index="1" name="y" type="float">
</argument>
<description>
</description>
</method>
<method name="get_noise_2dv">
<return type="float">
</return>
<argument index="0" name="position" type="Vector2">
</argument>
<description>
</description>
</method>
<method name="get_noise_3d">
<return type="float">
</return>
<argument index="0" name="x" type="float">
</argument>
<argument index="1" name="y" type="float">
</argument>
<argument index="2" name="z" type="float">
</argument>
<description>
</description>
</method>
<method name="get_noise_3dv">
<return type="float">
</return>
<argument index="0" name="position" type="Vector3">
</argument>
<description>
</description>
</method>
</methods>
<members>
<member name="cellular_distance_function" type="int" setter="set_cellular_distance_function" getter="get_cellular_distance_function" enum="FastNoiseLite.CellularDistanceFunction" default="1">
</member>
<member name="cellular_jitter" type="float" setter="set_cellular_jitter" getter="get_cellular_jitter" default="1.0">
</member>
<member name="cellular_return_type" type="int" setter="set_cellular_return_type" getter="get_cellular_return_type" enum="FastNoiseLite.CellularReturnType" default="1">
</member>
<member name="fractal_gain" type="float" setter="set_fractal_gain" getter="get_fractal_gain" default="0.5">
</member>
<member name="fractal_lacunarity" type="float" setter="set_fractal_lacunarity" getter="get_fractal_lacunarity" default="2.0">
</member>
<member name="fractal_octaves" type="int" setter="set_fractal_octaves" getter="get_fractal_octaves" default="3">
</member>
<member name="fractal_ping_pong_strength" type="float" setter="set_fractal_ping_pong_strength" getter="get_fractal_ping_pong_strength" default="2.0">
</member>
<member name="fractal_type" type="int" setter="set_fractal_type" getter="get_fractal_type" enum="FastNoiseLite.FractalType" default="1">
</member>
<member name="fractal_weighted_strength" type="float" setter="set_fractal_weighted_strength" getter="get_fractal_weighted_strength" default="0.0">
</member>
<member name="noise_type" type="int" setter="set_noise_type" getter="get_noise_type" enum="FastNoiseLite.NoiseType" default="0">
</member>
<member name="period" type="float" setter="set_period" getter="get_period" default="64.0">
</member>
<member name="rotation_type_3d" type="int" setter="set_rotation_type_3d" getter="get_rotation_type_3d" enum="FastNoiseLite.RotationType3D" default="0">
</member>
<member name="seed" type="int" setter="set_seed" getter="get_seed" default="0">
</member>
<member name="warp_noise" type="FastNoiseLiteGradient" setter="set_warp_noise" getter="get_warp_noise">
</member>
</members>
<constants>
<constant name="TYPE_OPEN_SIMPLEX_2" value="0" enum="NoiseType">
</constant>
<constant name="TYPE_OPEN_SIMPLEX_2S" value="1" enum="NoiseType">
</constant>
<constant name="TYPE_CELLULAR" value="2" enum="NoiseType">
</constant>
<constant name="TYPE_PERLIN" value="3" enum="NoiseType">
</constant>
<constant name="TYPE_VALUE_CUBIC" value="4" enum="NoiseType">
</constant>
<constant name="TYPE_VALUE" value="5" enum="NoiseType">
</constant>
<constant name="FRACTAL_NONE" value="0" enum="FractalType">
</constant>
<constant name="FRACTAL_FBM" value="1" enum="FractalType">
</constant>
<constant name="FRACTAL_RIDGED" value="2" enum="FractalType">
</constant>
<constant name="FRACTAL_PING_PONG" value="3" enum="FractalType">
</constant>
<constant name="ROTATION_3D_NONE" value="0" enum="RotationType3D">
</constant>
<constant name="ROTATION_3D_IMPROVE_XY_PLANES" value="1" enum="RotationType3D">
</constant>
<constant name="ROTATION_3D_IMPROVE_XZ_PLANES" value="2" enum="RotationType3D">
</constant>
<constant name="CELLULAR_DISTANCE_EUCLIDEAN" value="0" enum="CellularDistanceFunction">
</constant>
<constant name="CELLULAR_DISTANCE_EUCLIDEAN_SQ" value="1" enum="CellularDistanceFunction">
</constant>
<constant name="CELLULAR_DISTANCE_MANHATTAN" value="2" enum="CellularDistanceFunction">
</constant>
<constant name="CELLULAR_DISTANCE_HYBRID" value="3" enum="CellularDistanceFunction">
</constant>
<constant name="CELLULAR_RETURN_CELL_VALUE" value="0" enum="CellularReturnType">
</constant>
<constant name="CELLULAR_RETURN_DISTANCE" value="1" enum="CellularReturnType">
</constant>
<constant name="CELLULAR_RETURN_DISTANCE_2" value="2" enum="CellularReturnType">
</constant>
<constant name="CELLULAR_RETURN_DISTANCE_2_ADD" value="3" enum="CellularReturnType">
</constant>
<constant name="CELLULAR_RETURN_DISTANCE_2_SUB" value="4" enum="CellularReturnType">
</constant>
<constant name="CELLULAR_RETURN_DISTANCE_2_MUL" value="5" enum="CellularReturnType">
</constant>
<constant name="CELLULAR_RETURN_DISTANCE_2_DIV" value="6" enum="CellularReturnType">
</constant>
</constants>
</class>

View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="FastNoiseLiteGradient" inherits="Resource" version="3.2">
<brief_description>
Generates coherent and fractal noise gradients using the FastNoiseLite library.
</brief_description>
<description>
</description>
<tutorials>
</tutorials>
<methods>
</methods>
<members>
<member name="amplitude" type="float" setter="set_amplitude" getter="get_amplitude" default="30.0">
</member>
<member name="fractal_gain" type="float" setter="set_fractal_gain" getter="get_fractal_gain" default="0.5">
</member>
<member name="fractal_lacunarity" type="float" setter="set_fractal_lacunarity" getter="get_fractal_lacunarity" default="2.0">
</member>
<member name="fractal_octaves" type="int" setter="set_fractal_octaves" getter="get_fractal_octaves" default="3">
</member>
<member name="fractal_type" type="int" setter="set_fractal_type" getter="get_fractal_type" enum="FastNoiseLiteGradient.FractalType" default="0">
</member>
<member name="noise_type" type="int" setter="set_noise_type" getter="get_noise_type" enum="FastNoiseLiteGradient.NoiseType" default="2">
</member>
<member name="period" type="float" setter="set_period" getter="get_period" default="64.0">
</member>
<member name="rotation_type_3d" type="int" setter="set_rotation_type_3d" getter="get_rotation_type_3d" enum="FastNoiseLiteGradient.RotationType3D" default="0">
</member>
<member name="seed" type="int" setter="set_seed" getter="get_seed" default="0">
</member>
</members>
<constants>
<constant name="TYPE_OPEN_SIMPLEX_2" value="0" enum="NoiseType">
</constant>
<constant name="TYPE_OPEN_SIMPLEX_2_REDUCED" value="1" enum="NoiseType">
</constant>
<constant name="TYPE_VALUE" value="2" enum="NoiseType">
</constant>
<constant name="FRACTAL_NONE" value="0" enum="FractalType">
</constant>
<constant name="FRACTAL_DOMAIN_WARP_PROGRESSIVE" value="1" enum="FractalType">
</constant>
<constant name="FRACTAL_DOMAIN_WARP_INDEPENDENT" value="2" enum="FractalType">
</constant>
<constant name="ROTATION_3D_NONE" value="0" enum="RotationType3D">
</constant>
<constant name="ROTATION_3D_IMPROVE_XY_PLANES" value="1" enum="RotationType3D">
</constant>
<constant name="ROTATION_3D_IMPROVE_XZ_PLANES" value="2" enum="RotationType3D">
</constant>
</constants>
</class>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Voxel" inherits="Resource" version="3.2">
<brief_description>
Model stored in [VoxelLibrary] and used by [VoxelMesherBlocky].
</brief_description>
<description>
Represents a model to be used for voxels of a specific TYPE value. Such models must be contained within a [VoxelLibrary] to be used with [VoxelTerrain] or directly with a [VoxelMesherBlocky].
@ -42,22 +43,31 @@
<member name="geometry_type" type="int" setter="set_geometry_type" getter="get_geometry_type" enum="Voxel.GeometryType" default="0">
</member>
<member name="material_id" type="int" setter="set_material_id" getter="get_material_id" default="0">
ID of the material that will be used. It corresponds to the index of materials found on [VoxelTerrain].
</member>
<member name="random_tickable" type="bool" setter="set_random_tickable" getter="is_random_tickable" default="false">
If enabled, voxels having this ID in the TYPE channel will be used by [method VoxelToolTerrain.run_blocky_random_tick].
</member>
<member name="transparency_index" type="int" setter="set_transparency_index" getter="get_transparency_index" default="0">
</member>
<member name="transparent" type="bool" setter="set_transparent" getter="is_transparent" default="false">
</member>
<member name="voxel_name" type="String" setter="set_voxel_name" getter="get_voxel_name" default="&quot;&quot;">
Name that can be used for convenience, when looking up a specific [Voxel] from [VoxelLibrary].
</member>
</members>
<constants>
<constant name="GEOMETRY_NONE" value="0" enum="GeometryType">
Don't produce any geometry. The voxel will be invisible.
</constant>
<constant name="GEOMETRY_CUBE" value="1" enum="GeometryType">
Use the shape of a generated cube. It is useful for testing and quick configuration.
</constant>
<constant name="GEOMETRY_CUSTOM_MESH" value="2" enum="GeometryType">
Use the mesh specified in the [member mesh] property. This is the most versatile way to create shapes.
</constant>
<constant name="GEOMETRY_MAX" value="3" enum="GeometryType">
How many geometry modes there are.
</constant>
<constant name="SIDE_NEGATIVE_X" value="1" enum="Side">
</constant>

View File

@ -31,13 +31,10 @@
<argument index="0" name="peer" type="StreamPeer">
</argument>
<argument index="1" name="voxel_buffer" type="VoxelBuffer">
Buffer into which the data will be written. Its size and formats will determine what is expected from the deserialized data.
</argument>
<argument index="2" name="size" type="int">
How many bytes to read
</argument>
<argument index="3" name="decompress" type="bool">
If the data to read was compressed, you should set this boolean to true so it will be decompressed.
</argument>
<description>
Reads the data of a [VoxelBuffer] from a [StreamPeer]. You must provide the number of bytes to read, and the destination buffer must have the expected size.
@ -45,18 +42,15 @@
</method>
<method name="serialize">
<return type="int">
Number of bytes written.
</return>
<argument index="0" name="peer" type="StreamPeer">
</argument>
<argument index="1" name="voxel_buffer" type="VoxelBuffer">
Voxels to serialize.
</argument>
<argument index="2" name="compress" type="bool">
If true, the data will be compressed. It has a small CPU cost, but the written data will occuppy less space.
</argument>
<description>
Stores the data of a [VoxelBuffer] into a [StreamPeer]. To be able to read it back, you should use the
Stores the data of a [VoxelBuffer] into a [StreamPeer]. To be able to read it back, you should use the
</description>
</method>
</methods>

View File

@ -22,19 +22,14 @@
</method>
<method name="get_motion">
<return type="Vector3">
Modified motion vector with collisions taken into account.
</return>
<argument index="0" name="pos" type="Vector3">
Initial position of your object.
</argument>
<argument index="1" name="motion" type="Vector3">
Motion vector you would like your object to move by.
</argument>
<argument index="2" name="aabb" type="AABB">
Bounding box of your character (or whatever moving thing it is).
</argument>
<argument index="3" name="terrain" type="Node">
[VoxelTerrain] to use for collision detection.
</argument>
<description>
Given a motion vector, returns a modified vector telling you by how much to move your character. This is similar to [method KinematicBody.move_and_slide], except you have to apply the movement.

View File

@ -28,10 +28,8 @@
<return type="void">
</return>
<argument index="0" name="min_pos" type="Vector3">
Lower-end corner of the area
</argument>
<argument index="1" name="max_pos" type="Vector3">
Upper-end corner of the area (excluded)
</argument>
<description>
Erases per-voxel metadata within the specified area.
@ -41,10 +39,8 @@
<return type="void">
</return>
<argument index="0" name="other" type="VoxelBuffer">
Buffer to copy values from
</argument>
<argument index="1" name="channel" type="int">
Channel to copy values from
</argument>
<description>
Copies all values from the channel of another [VoxelBuffer] into the same channel for the current buffer. The depth formats must match.
@ -54,19 +50,14 @@
<return type="void">
</return>
<argument index="0" name="other" type="VoxelBuffer">
Buffer to copy values from
</argument>
<argument index="1" name="src_min" type="Vector3">
Lower-end corner of the area to copy from the source buffer
</argument>
<argument index="2" name="src_max" type="Vector3">
Upper-end corner of the area to copy from the source buffer (excluded)
</argument>
<argument index="3" name="dst_min" type="Vector3">
Lower-end corner of the area to paste the values to.
</argument>
<argument index="4" name="channel" type="int">
Channel to copy values from
</argument>
<description>
Copies values from a channel's sub-region of another [VoxelBuffer] into the same channel for the current buffer, at a specific location. The depth formats must match.
@ -78,16 +69,12 @@
<return type="void">
</return>
<argument index="0" name="src_buffer" type="VoxelBuffer">
Buffer to copy values from
</argument>
<argument index="1" name="src_min_pos" type="Vector3">
Lower-end corner of the area to copy from the source buffer
</argument>
<argument index="2" name="src_max_pos" type="Vector3">
Upper-end corner of the area to copy from the source buffer (excluded)
</argument>
<argument index="3" name="dst_min_pos" type="Vector3">
Lower-end corner of the area to paste the values to.
</argument>
<description>
Copies per-voxel metadata from a sub-region of another [VoxelBuffer] into the the current buffer, at a specific location. Values will be a shallow copy.
@ -99,13 +86,10 @@
<return type="void">
</return>
<argument index="0" name="sx" type="int">
How many voxels across the X axis. Should not be higher than [member MAX_SIZE].
</argument>
<argument index="1" name="sy" type="int">
How many voxels across the Y axis. Should not be higher than [member MAX_SIZE].
</argument>
<argument index="2" name="sz" type="int">
How many voxels across the Z axis. Should not be higher than [member MAX_SIZE].
</argument>
<description>
Clears the buffer and gives it the specified size.
@ -115,16 +99,12 @@
<return type="void">
</return>
<argument index="0" name="dst" type="VoxelBuffer">
Destination buffer in which to place the half-resolution data.
</argument>
<argument index="1" name="src_min" type="Vector3">
Lower-end corner of the area to copy from the source buffer
</argument>
<argument index="2" name="src_max" type="Vector3">
Upper-end corner of the area to copy from the source buffer (excluded)
</argument>
<argument index="3" name="dst_min" type="Vector3">
Lower-end corner of the area to paste the values to the destination buffer.
</argument>
<description>
Produces a downscaled version of this buffer, by a factor of 2, without any form of interpolation (i.e using nearest-neighbor).
@ -135,10 +115,8 @@
<return type="void">
</return>
<argument index="0" name="value" type="int">
Raw value to fill this buffer with.
</argument>
<argument index="1" name="channel" type="int" default="0">
Which channel should be filled.
</argument>
<description>
Fills one channel of this buffer with a specific raw value.
@ -148,16 +126,12 @@
<return type="void">
</return>
<argument index="0" name="value" type="int">
Raw value to fill the area with.
</argument>
<argument index="1" name="min" type="Vector3">
Lower-end corner of the area to fill
</argument>
<argument index="2" name="max" type="Vector3">
Upper-end corner of the area to fill (excluded)
</argument>
<argument index="3" name="channel" type="int" default="0">
Which channel should be filled
</argument>
<description>
Fills an area of a channel in this buffer with a specific raw value.
@ -167,10 +141,8 @@
<return type="void">
</return>
<argument index="0" name="value" type="float">
Float value to fill the area with.
</argument>
<argument index="1" name="channel" type="int" default="0">
Which channel should be filled.
</argument>
<description>
Fills one channel of this buffer with a specific float value.
@ -180,7 +152,6 @@
<return type="void">
</return>
<argument index="0" name="callback" type="FuncRef">
Function to execute. The expected signature is [code]f(Vector3 position, Variant metadata)[/code].
</argument>
<description>
Executes a function on every voxel in this buffer which have associated metadata.
@ -190,13 +161,10 @@
<return type="void">
</return>
<argument index="0" name="callback" type="FuncRef">
Function to execute. The expected signature is [code]f(Vector3 position, Variant metadata)[/code].
</argument>
<argument index="1" name="min_pos" type="Vector3">
Lower-end corner of the area to check
</argument>
<argument index="2" name="max_pos" type="Vector3">
Upper-end corner of the area to check (excluded)
</argument>
<description>
Executes a function on every voxel in this buffer which have associated metadata, within the specified area.
@ -257,19 +225,14 @@
</method>
<method name="get_voxel" qualifiers="const">
<return type="int">
Raw value of the voxel
</return>
<argument index="0" name="x" type="int">
X coordinate within the buffer
</argument>
<argument index="1" name="y" type="int">
Y coordinate within the buffer
</argument>
<argument index="2" name="z" type="int">
Z coordinate within the buffer
</argument>
<argument index="3" name="channel" type="int" default="0">
Channel of the voxel
</argument>
<description>
Gets the raw value of a voxel within this buffer.
@ -277,19 +240,14 @@
</method>
<method name="get_voxel_f" qualifiers="const">
<return type="float">
Float value of the voxel
</return>
<argument index="0" name="x" type="int">
X coordinate within the buffer
</argument>
<argument index="1" name="y" type="int">
Y coordinate within the buffer
</argument>
<argument index="2" name="z" type="int">
Z coordinate within the buffer
</argument>
<argument index="3" name="channel" type="int" default="0">
Channel of the voxel
</argument>
<description>
Gets the float value of a voxel within this buffer. You may use this function if you work with SDF volumes (smooth voxels).
@ -299,7 +257,6 @@
<return type="Variant">
</return>
<argument index="0" name="pos" type="Vector3">
Voxel position within the buffer. Will be [code]null[/code] if the voxel does not have metadata.
</argument>
<description>
Gets the metadata attached to a specific voxel in this buffer.
@ -314,10 +271,8 @@
</method>
<method name="is_uniform" qualifiers="const">
<return type="bool">
[code]true[/code] if the buffer is uniform, [code]false[/code] otherwise
</return>
<argument index="0" name="channel" type="int">
Channel to check
</argument>
<description>
Checks if every voxel within a channel has the same value.
@ -343,10 +298,8 @@
<return type="void">
</return>
<argument index="0" name="channel" type="int">
Which channel to change the format
</argument>
<argument index="1" name="depth" type="int" enum="VoxelBuffer.Depth">
Which depth the channel should have
</argument>
<description>
Changes the bit depth of a given channel. This controls the range of values a channel can hold. See [enum VoxelBuffer.Depth] for more information.
@ -356,19 +309,14 @@
<return type="void">
</return>
<argument index="0" name="value" type="int">
Raw value of the voxel to set
</argument>
<argument index="1" name="x" type="int">
X coordinate within the buffer
</argument>
<argument index="2" name="y" type="int">
Y coordinate within the buffer
</argument>
<argument index="3" name="z" type="int">
Z coordinate within the buffer
</argument>
<argument index="4" name="channel" type="int" default="0">
Channel of the voxel
</argument>
<description>
Sets the raw value of a voxel. If you use smooth voxels, you may prefer using [method set_voxel_f].
@ -378,16 +326,12 @@
<return type="void">
</return>
<argument index="0" name="value" type="float">
Float value of the voxel to set. If you use smooth voxels, the value will represent a signed distance field where negative values are below the isosurface (inside matter), and positive values are above the surface (outside matter).
</argument>
<argument index="1" name="x" type="int">
X coordinate within the buffer
</argument>
<argument index="2" name="y" type="int">
Y coordinate within the buffer
</argument>
<argument index="3" name="z" type="int">
Z coordinate within the buffer
</argument>
<argument index="4" name="channel" type="int" default="0">
</argument>
@ -399,10 +343,8 @@
<return type="void">
</return>
<argument index="0" name="pos" type="Vector3">
Position within the buffer
</argument>
<argument index="1" name="value" type="Variant">
Metadata to set
</argument>
<description>
Attaches arbitrary data on a specific voxel. Old data is replaced.
@ -474,5 +416,7 @@
<constant name="COMPRESSION_COUNT" value="2" enum="Compression">
How many compression modes there are.
</constant>
<constant name="MAX_SIZE" value="65535">
</constant>
</constants>
</class>

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VoxelColorPalette" inherits="Resource" version="3.2">
<brief_description>
</brief_description>
<description>
</description>
<tutorials>
</tutorials>
<methods>
<method name="get_color" qualifiers="const">
<return type="Color">
</return>
<argument index="0" name="arg0" type="int">
</argument>
<description>
</description>
</method>
<method name="set_color">
<return type="void">
</return>
<argument index="0" name="color" type="int">
</argument>
<argument index="1" name="arg1" type="Color">
</argument>
<description>
</description>
</method>
</methods>
<members>
<member name="data" type="PoolIntArray" setter="set_data" getter="get_data" default="PoolIntArray( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 )">
</member>
</members>
<constants>
<constant name="MAX_COLORS" value="256">
</constant>
</constants>
</class>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VoxelGenerator" inherits="VoxelStream" version="3.2">
<class name="VoxelGenerator" inherits="Resource" version="3.2">
<brief_description>
Base class to all voxel procedural generators. If you want to define a custom one with a script, this is the class you should extend from.
Important: this engine makes heavy use of threads. Generators will run in one of them, so make sure you don't access the scene tree or other unsafe APIs from within a generator.
@ -13,13 +13,10 @@
<return type="void">
</return>
<argument index="0" name="out_buffer" type="VoxelBuffer">
Buffer into which the voxel values must be set. Its size also determines the size of the area.
</argument>
<argument index="1" name="origin_in_voxels" type="Vector3">
Lower-corner of the area to generate. These coordinates are relative to the expected LOD and scale by powers of two. For example, LOD1 coordinates == LOD0 coordinates * 2.
</argument>
<argument index="2" name="lod" type="int">
Which LOD the block is expected for. 0 means highest level of detail. 1 means half-resolution, 2 means quarter-resolution etc.
</argument>
<description>
Generates a block of voxels within the specified world area.

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VoxelGeneratorFlat" inherits="VoxelGenerator" version="3.2">
<brief_description>
</brief_description>
<description>
</description>
<tutorials>
</tutorials>
<methods>
</methods>
<members>
<member name="channel" type="int" setter="set_channel" getter="get_channel" enum="VoxelBuffer.ChannelId" default="1">
</member>
<member name="height" type="float" setter="set_height" getter="get_height" default="0.0">
</member>
<member name="voxel_type" type="int" setter="set_voxel_type" getter="get_voxel_type" default="1">
</member>
</members>
<constants>
</constants>
</class>

View File

@ -22,6 +22,32 @@
<description>
</description>
</method>
<method name="bake_sphere_bumpmap">
<return type="void">
</return>
<argument index="0" name="im" type="Image">
</argument>
<argument index="1" name="ref_radius" type="float">
</argument>
<argument index="2" name="sdf_min" type="float">
</argument>
<argument index="3" name="sdf_max" type="float">
</argument>
<description>
</description>
</method>
<method name="bake_sphere_normalmap">
<return type="void">
</return>
<argument index="0" name="im" type="Image">
</argument>
<argument index="1" name="ref_radius" type="float">
</argument>
<argument index="2" name="strength" type="float">
</argument>
<description>
</description>
</method>
<method name="can_connect" qualifiers="const">
<return type="bool">
</return>
@ -43,7 +69,7 @@
</description>
</method>
<method name="compile">
<return type="void">
<return type="Dictionary">
</return>
<description>
</description>
@ -69,6 +95,16 @@
<method name="debug_measure_microseconds_per_voxel">
<return type="float">
</return>
<argument index="0" name="use_singular_queries" type="bool">
</argument>
<description>
</description>
</method>
<method name="find_node_by_name" qualifiers="const">
<return type="int">
</return>
<argument index="0" name="name" type="String">
</argument>
<description>
</description>
</method>
@ -209,6 +245,14 @@
</description>
</method>
</methods>
<signals>
<signal name="node_name_changed">
<argument index="0" name="node_id" type="int">
</argument>
<description>
</description>
</signal>
</signals>
<constants>
<constant name="NODE_CONSTANT" value="0" enum="NodeTypeID">
</constant>
@ -278,7 +322,17 @@
</constant>
<constant name="NODE_SDF_PREVIEW" value="33" enum="NodeTypeID">
</constant>
<constant name="NODE_TYPE_COUNT" value="34" enum="NodeTypeID">
<constant name="NODE_NORMALIZE_3D" value="35" enum="NodeTypeID">
</constant>
<constant name="NODE_FAST_NOISE_2D" value="36" enum="NodeTypeID">
</constant>
<constant name="NODE_FAST_NOISE_3D" value="37" enum="NodeTypeID">
</constant>
<constant name="NODE_FAST_NOISE_GRADIENT_2D" value="38" enum="NodeTypeID">
</constant>
<constant name="NODE_FAST_NOISE_GRADIENT_3D" value="39" enum="NodeTypeID">
</constant>
<constant name="NODE_TYPE_COUNT" value="40" enum="NodeTypeID">
</constant>
</constants>
</class>

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VoxelGeneratorScript" inherits="VoxelGenerator" version="3.2">
<brief_description>
Base class for custom generators defined with a script.
</brief_description>
<description>
</description>
<tutorials>
</tutorials>
<methods>
<method name="_generate_block" qualifiers="virtual">
<return type="void">
</return>
<argument index="0" name="out_buffer" type="VoxelBuffer">
</argument>
<argument index="1" name="origin_in_voxels" type="Vector3">
</argument>
<argument index="2" name="lod" type="int">
</argument>
<description>
</description>
</method>
<method name="_get_used_channels_mask" qualifiers="virtual">
<return type="int">
</return>
<description>
</description>
</method>
</methods>
<constants>
</constants>
</class>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VoxelGeneratorWaves" inherits="VoxelGeneratorHeightmap" version="3.2">
<brief_description>
</brief_description>
<description>
</description>
<tutorials>
</tutorials>
<methods>
</methods>
<members>
<member name="height_range" type="float" setter="set_height_range" getter="get_height_range" override="true" default="30.0" />
<member name="pattern_offset" type="Vector2" setter="set_pattern_offset" getter="get_pattern_offset" default="Vector2( 0, 0 )">
</member>
<member name="pattern_size" type="Vector2" setter="set_pattern_size" getter="get_pattern_size" default="Vector2( 30, 30 )">
</member>
</members>
<constants>
</constants>
</class>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VoxelLodTerrain" inherits="Spatial" version="3.2">
<class name="VoxelLodTerrain" inherits="VoxelNode" version="3.2">
<brief_description>
Voxel volume using variable level of detail.
</brief_description>
@ -8,6 +8,20 @@
<tutorials>
</tutorials>
<methods>
<method name="debug_dump_as_scene" qualifiers="const">
<return type="int" enum="Error">
</return>
<argument index="0" name="path" type="String">
</argument>
<description>
</description>
</method>
<method name="debug_get_block_count" qualifiers="const">
<return type="int">
</return>
<description>
</description>
</method>
<method name="debug_get_block_info" qualifiers="const">
<return type="Dictionary">
</return>
@ -56,6 +70,12 @@
<description>
</description>
</method>
<method name="get_process_mode" qualifiers="const">
<return type="int" enum="VoxelLodTerrain.ProcessMode">
</return>
<description>
</description>
</method>
<method name="get_statistics" qualifiers="const">
<return type="Dictionary">
</return>
@ -90,6 +110,14 @@
<description>
</description>
</method>
<method name="set_process_mode">
<return type="void">
</return>
<argument index="0" name="mode" type="int" enum="VoxelLodTerrain.ProcessMode">
</argument>
<description>
</description>
</method>
<method name="voxel_to_block_position" qualifiers="const">
<return type="Vector3">
</return>
@ -112,15 +140,20 @@
</member>
<member name="material" type="Material" setter="set_material" getter="get_material">
</member>
<member name="mesher" type="VoxelMesher" setter="set_mesher" getter="get_mesher" override="true" />
<member name="run_stream_in_editor" type="bool" setter="set_run_stream_in_editor" getter="is_stream_running_in_editor" default="true">
</member>
<member name="stream" type="VoxelStream" setter="set_stream" getter="get_stream">
</member>
<member name="view_distance" type="int" setter="set_view_distance" getter="get_view_distance" default="512">
</member>
<member name="viewer_path" type="NodePath" setter="set_viewer_path" getter="get_viewer_path" default="NodePath(&quot;&quot;)">
<member name="voxel_bounds" type="AABB" setter="set_voxel_bounds" getter="get_voxel_bounds" default="AABB( -5.36871e+08, -5.36871e+08, -5.36871e+08, 1.07374e+09, 1.07374e+09, 1.07374e+09 )">
</member>
</members>
<constants>
<constant name="PROCESS_MODE_IDLE" value="0" enum="ProcessMode">
</constant>
<constant name="PROCESS_MODE_PHYSICS" value="1" enum="ProcessMode">
</constant>
<constant name="PROCESS_MODE_DISABLED" value="2" enum="ProcessMode">
</constant>
</constants>
</class>

View File

@ -1,169 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VoxelMap" inherits="Reference" version="3.2">
<brief_description>
</brief_description>
<description>
</description>
<tutorials>
</tutorials>
<methods>
<method name="block_to_voxel" qualifiers="const">
<return type="Vector3">
</return>
<argument index="0" name="block_pos" type="Vector3">
</argument>
<description>
</description>
</method>
<method name="get_block_size" qualifiers="const">
<return type="int">
</return>
<description>
</description>
</method>
<method name="get_buffer_copy">
<return type="void">
</return>
<argument index="0" name="min_pos" type="Vector3">
</argument>
<argument index="1" name="out_buffer" type="VoxelBuffer">
</argument>
<argument index="2" name="channel" type="int" default="0">
</argument>
<description>
</description>
</method>
<method name="get_default_voxel">
<return type="int">
</return>
<argument index="0" name="channel" type="int" default="0">
</argument>
<description>
</description>
</method>
<method name="get_voxel">
<return type="int">
</return>
<argument index="0" name="x" type="int">
</argument>
<argument index="1" name="y" type="int">
</argument>
<argument index="2" name="z" type="int">
</argument>
<argument index="3" name="c" type="int" default="0">
</argument>
<description>
</description>
</method>
<method name="get_voxel_f">
<return type="float">
</return>
<argument index="0" name="x" type="int">
</argument>
<argument index="1" name="y" type="int">
</argument>
<argument index="2" name="z" type="int">
</argument>
<argument index="3" name="c" type="int" default="1">
</argument>
<description>
</description>
</method>
<method name="get_voxel_v">
<return type="int">
</return>
<argument index="0" name="pos" type="Vector3">
</argument>
<argument index="1" name="c" type="int" default="0">
</argument>
<description>
</description>
</method>
<method name="has_block">
<return type="bool">
</return>
<argument index="0" name="x" type="int">
</argument>
<argument index="1" name="y" type="int">
</argument>
<argument index="2" name="z" type="int">
</argument>
<description>
</description>
</method>
<method name="set_block_buffer">
<return type="void">
</return>
<argument index="0" name="block_pos" type="Vector3">
</argument>
<argument index="1" name="buffer" type="VoxelBuffer">
</argument>
<description>
</description>
</method>
<method name="set_default_voxel">
<return type="void">
</return>
<argument index="0" name="value" type="int">
</argument>
<argument index="1" name="channel" type="int" default="0">
</argument>
<description>
</description>
</method>
<method name="set_voxel">
<return type="void">
</return>
<argument index="0" name="value" type="int">
</argument>
<argument index="1" name="x" type="int">
</argument>
<argument index="2" name="y" type="int">
</argument>
<argument index="3" name="z" type="int">
</argument>
<argument index="4" name="c" type="int" default="0">
</argument>
<description>
</description>
</method>
<method name="set_voxel_f">
<return type="void">
</return>
<argument index="0" name="value" type="float">
</argument>
<argument index="1" name="x" type="int">
</argument>
<argument index="2" name="y" type="int">
</argument>
<argument index="3" name="z" type="int">
</argument>
<argument index="4" name="c" type="int" default="1">
</argument>
<description>
</description>
</method>
<method name="set_voxel_v">
<return type="void">
</return>
<argument index="0" name="value" type="int">
</argument>
<argument index="1" name="pos" type="Vector3">
</argument>
<argument index="2" name="c" type="int" default="0">
</argument>
<description>
</description>
</method>
<method name="voxel_to_block" qualifiers="const">
<return type="Vector3">
</return>
<argument index="0" name="voxel_pos" type="Vector3">
</argument>
<description>
</description>
</method>
</methods>
<constants>
</constants>
</class>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VoxelMesher" inherits="Reference" version="3.2">
<class name="VoxelMesher" inherits="Resource" version="3.2">
<brief_description>
Base class for all meshing algorithms.
</brief_description>

View File

@ -9,49 +9,15 @@
<tutorials>
</tutorials>
<methods>
<method name="get_library" qualifiers="const">
<return type="VoxelLibrary">
</return>
<description>
</description>
</method>
<method name="get_occlusion_darkness" qualifiers="const">
<return type="float">
</return>
<description>
</description>
</method>
<method name="get_occlusion_enabled" qualifiers="const">
<return type="bool">
</return>
<description>
</description>
</method>
<method name="set_library">
<return type="void">
</return>
<argument index="0" name="voxel_library" type="VoxelLibrary">
</argument>
<description>
</description>
</method>
<method name="set_occlusion_darkness">
<return type="void">
</return>
<argument index="0" name="value" type="float">
</argument>
<description>
</description>
</method>
<method name="set_occlusion_enabled">
<return type="void">
</return>
<argument index="0" name="enable" type="bool">
</argument>
<description>
</description>
</method>
</methods>
<members>
<member name="library" type="VoxelLibrary" setter="set_library" getter="get_library">
</member>
<member name="occlusion_darkness" type="float" setter="set_occlusion_darkness" getter="get_occlusion_darkness" default="0.8">
</member>
<member name="occlusion_enabled" type="bool" setter="set_occlusion_enabled" getter="get_occlusion_enabled" default="true">
</member>
</members>
<constants>
</constants>
</class>

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VoxelMesherCubes" inherits="VoxelMesher" version="3.2">
<brief_description>
</brief_description>
<description>
</description>
<tutorials>
</tutorials>
<methods>
</methods>
<members>
<member name="color_mode" type="int" setter="set_color_mode" getter="get_color_mode" enum="VoxelMesherCubes.ColorMode" default="0">
</member>
<member name="greedy_meshing_enabled" type="bool" setter="set_greedy_meshing_enabled" getter="is_greedy_meshing_enabled" default="true">
</member>
<member name="palette" type="VoxelColorPalette" setter="set_palette" getter="get_palette">
</member>
</members>
<constants>
<constant name="MATERIAL_OPAQUE" value="0" enum="Materials">
</constant>
<constant name="MATERIAL_TRANSPARENT" value="1" enum="Materials">
</constant>
<constant name="MATERIAL_COUNT" value="2" enum="Materials">
</constant>
<constant name="COLOR_RAW" value="0" enum="ColorMode">
</constant>
<constant name="COLOR_MESHER_PALETTE" value="1" enum="ColorMode">
</constant>
<constant name="COLOR_SHADER_PALETTE" value="2" enum="ColorMode">
</constant>
</constants>
</class>

View File

@ -14,24 +14,6 @@
<description>
</description>
</method>
<method name="get_mesh_mode" qualifiers="const">
<return type="int" enum="VoxelMesherDMC.MeshMode">
</return>
<description>
</description>
</method>
<method name="get_seam_mode" qualifiers="const">
<return type="int" enum="VoxelMesherDMC.SeamMode">
</return>
<description>
</description>
</method>
<method name="get_simplify_mode" qualifiers="const">
<return type="int" enum="VoxelMesherDMC.SimplifyMode">
</return>
<description>
</description>
</method>
<method name="get_statistics" qualifiers="const">
<return type="Dictionary">
</return>
@ -46,31 +28,17 @@
<description>
</description>
</method>
<method name="set_mesh_mode">
<return type="void">
</return>
<argument index="0" name="mode" type="int" enum="VoxelMesherDMC.MeshMode">
</argument>
<description>
</description>
</method>
<method name="set_seam_mode">
<return type="void">
</return>
<argument index="0" name="mode" type="int" enum="VoxelMesherDMC.SeamMode">
</argument>
<description>
</description>
</method>
<method name="set_simplify_mode">
<return type="void">
</return>
<argument index="0" name="mode" type="int" enum="VoxelMesherDMC.SimplifyMode">
</argument>
<description>
</description>
</method>
</methods>
<members>
<member name="geometric_error" type="int" setter="set_simplify_mode" getter="get_simplify_mode" enum="VoxelMesherDMC.SimplifyMode" default="0">
</member>
<member name="mesh_mode" type="int" setter="set_mesh_mode" getter="get_mesh_mode" enum="VoxelMesherDMC.MeshMode" default="0">
</member>
<member name="seam_mode" type="int" setter="set_seam_mode" getter="get_seam_mode" enum="VoxelMesherDMC.SeamMode" default="0">
</member>
<member name="simplify_mode" type="int" setter="set_simplify_mode" getter="get_simplify_mode" enum="VoxelMesherDMC.SimplifyMode" default="0">
</member>
</members>
<constants>
<constant name="MESH_NORMAL" value="0" enum="MeshMode">
</constant>

25
doc/classes/VoxelNode.xml Normal file
View File

@ -0,0 +1,25 @@
<?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>
<tutorials>
</tutorials>
<methods>
</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>
</constants>
</class>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VoxelRaycastResult" inherits="Reference" version="3.2">
<brief_description>
Result of a raycast performed with [method VoxelTool.raycast]
</brief_description>
<description>
</description>
@ -10,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,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VoxelServer" inherits="Object" version="3.2">
<brief_description>
Singleton handling common voxel processing.
Singleton handling common voxel processing in background threads.
</brief_description>
<description>
</description>

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>
@ -19,6 +20,12 @@
<description>
</description>
</method>
<method name="get_block_size" qualifiers="const">
<return type="Vector3">
</return>
<description>
</description>
</method>
<method name="get_used_channels_mask" qualifiers="const">
<return type="int">
</return>
@ -38,6 +45,20 @@
</description>
</method>
</methods>
<members>
<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

@ -7,19 +7,7 @@
<tutorials>
</tutorials>
<methods>
<method name="get_block_size" qualifiers="const">
<return type="Vector3">
</return>
<description>
</description>
</method>
</methods>
<members>
<member name="fallback_stream" type="VoxelStream" setter="set_fallback_stream" getter="get_fallback_stream">
</member>
<member name="save_fallback_output" type="bool" setter="set_save_fallback_output" getter="get_save_fallback_output" default="true">
</member>
</members>
<constants>
</constants>
</class>

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

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VoxelStreamScript" inherits="VoxelStream" version="3.2">
<brief_description>
Base class for custom streams defined with a script.
</brief_description>
<description>
</description>
<tutorials>
</tutorials>
<methods>
<method name="_emerge_block" qualifiers="virtual">
<return type="void">
</return>
<argument index="0" name="out_buffer" type="VoxelBuffer">
</argument>
<argument index="1" name="origin_in_voxels" type="Vector3">
</argument>
<argument index="2" name="lod" type="int">
</argument>
<description>
</description>
</method>
<method name="_get_used_channels_mask" qualifiers="virtual">
<return type="int">
</return>
<description>
</description>
</method>
<method name="_immerge_block" qualifiers="virtual">
<return type="void">
</return>
<argument index="0" name="buffer" type="VoxelBuffer">
</argument>
<argument index="1" name="origin_in_voxels" type="Vector3">
</argument>
<argument index="2" name="lod" type="int">
</argument>
<description>
</description>
</method>
</methods>
<constants>
</constants>
</class>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VoxelTerrain" inherits="Spatial" version="3.2">
<class name="VoxelTerrain" inherits="VoxelNode" version="3.2">
<brief_description>
Voxel volume using constant level of detail.
</brief_description>
@ -58,7 +58,6 @@
<return type="void">
</return>
<argument index="0" name="position" type="Vector3">
Position of the block, in block coordinates. Use [method voxel_to_block] to convert from voxel to block coordinates.
</argument>
<description>
Forces a specific block to be saved.
@ -114,10 +113,6 @@
Makes the terrain appear in the editor.
Important: this option will turn off automatically if you setup a script world generator. Modifying scripts while they are in use by threads causes undefined behaviors. You can still turn on this option if you need a preview, but it is strongly advised to turn it back off and wait until all generation has finished before you edit the script again.
</member>
<member name="stream" type="VoxelStream" setter="set_stream" getter="get_stream">
</member>
<member name="voxel_library" type="VoxelLibrary" setter="set_voxel_library" getter="get_voxel_library">
</member>
</members>
<signals>
<signal name="block_loaded">

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VoxelToolBuffer" inherits="VoxelTool" version="3.2">
<brief_description>
</brief_description>
<description>
</description>
<tutorials>
</tutorials>
<methods>
</methods>
<constants>
</constants>
</class>

View File

@ -12,17 +12,12 @@
<return type="void">
</return>
<argument index="0" name="area" type="AABB">
Area in which to pick voxels
</argument>
<argument index="1" name="voxel_count" type="int">
How many voxels to pick. Note, this function might not always find as many voxels, if the picked locations don't contain a tickable voxel.
</argument>
<argument index="2" name="callback" type="FuncRef">
Function to run on tickable voxels. The expected signature is [code]f(Vector3 position, int value)[/code].
</argument>
<argument index="3" name="batch_count" type="int">
Performance tuning parameter. A value of 16 should be fine for most use cases.
Every time a voxel has to be queried on [VoxelTerrain], there are two lookups to run: block lookup, and voxel lookup. Block lookup can be more expensive, so this function allows to pick random blocks and execute multiple voxel picks within the same block. This improves performance, because a lot less blocks will have to be queried. For example, if you want 512 random voxels with a batch of 1, the function would have to query 512 potentially different blocks. But if you want 512 voxels with a batch of 16, only 32 blocks will be queried (and will have 16 voxels being picked in each of them).
<argument index="3" name="batch_count" type="int" default="16">
</argument>
<description>
Picks random voxels within the specified area and executes a function on them. This only works for terrains using [VoxelMesherBlocky]. Only voxels where [member Voxel.random_tickable] is [code]true[/code] will be picked.

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" ?>
<class name="VoxelVoxLoader" inherits="Reference" version="3.2">
<brief_description>
</brief_description>
<description>
</description>
<tutorials>
</tutorials>
<methods>
<method name="load_from_file">
<return type="int" enum="Error">
</return>
<argument index="0" name="fpath" type="String">
</argument>
<argument index="1" name="voxels" type="VoxelBuffer">
</argument>
<argument index="2" name="arg2" type="VoxelColorPalette">
</argument>
<description>
</description>
</method>
</methods>
<constants>
</constants>
</class>

77
doc/mkdocs.yml Normal file
View File

@ -0,0 +1,77 @@
site_name: Voxel Tools documentation
theme: readthedocs
docs_dir: source
extra_css:
- css/extra.css
nav:
- 'index.md'
- 'getting_the_module.md'
- 'quick_start.md'
- 'overview.md'
- 'terrain_types.md'
- 'blocky_terrain.md'
- 'smooth_terrain.md'
- 'generators.md'
- 'streams.md'
- 'editor.md'
- 'scripting.md'
- 'access_to_voxels_and_multithreading.md'
- 'module_development.md'
- 'changelog.md'
- '___.md'
- 'API':
# <generated_class_list>
- api/FastNoiseLite.md
- api/FastNoiseLiteGradient.md
- api/Voxel.md
- api/VoxelBlockSerializer.md
- api/VoxelBoxMover.md
- api/VoxelBuffer.md
- api/VoxelColorPalette.md
- api/VoxelGenerator.md
- api/VoxelGeneratorFlat.md
- api/VoxelGeneratorGraph.md
- api/VoxelGeneratorHeightmap.md
- api/VoxelGeneratorImage.md
- api/VoxelGeneratorNoise.md
- api/VoxelGeneratorNoise2D.md
- api/VoxelGeneratorScript.md
- api/VoxelGeneratorWaves.md
- api/VoxelLibrary.md
- api/VoxelLodTerrain.md
- api/VoxelMesher.md
- api/VoxelMesherBlocky.md
- api/VoxelMesherCubes.md
- api/VoxelMesherDMC.md
- api/VoxelMesherTransvoxel.md
- api/VoxelNode.md
- api/VoxelRaycastResult.md
- api/VoxelServer.md
- api/VoxelStream.md
- api/VoxelStreamBlockFiles.md
- api/VoxelStreamFile.md
- api/VoxelStreamRegionFiles.md
- api/VoxelStreamScript.md
- api/VoxelTerrain.md
- api/VoxelTool.md
- api/VoxelToolBuffer.md
- api/VoxelToolTerrain.md
- api/VoxelViewer.md
- api/VoxelVoxLoader.md
# </generated_class_list>
- 'Serialization formats':
- 'specs/block_format.md'
- 'specs/region_format_v2.md'
- 'specs/region_format_v3.md'
markdown_extensions:
# Makes permalinks appear on headings
- toc:
permalink: True
# Makes boxes for notes and warnings
- admonition
# Better highlighter which supports GDScript
- codehilite

1
doc/requirements.txt Normal file
View File

@ -0,0 +1 @@
mkdocs>=1.1.2

11
doc/source/___.md Normal file
View File

@ -0,0 +1,11 @@
Nothing to see here.
This file is an expression of my lack of motivation to make Mkdocs work better with ReadTheDocs. It sits there only to separate a bit more the API section from the rest of the doc.
The API class list is at "top level" (actually second level) and does not fold, because no more than 2 file-levels are supported by the theme provided by ReadTheDocs. If the class files were placed at third level, folding works for them, but breaks the rest of the nav.
Allowing custom themes on ReadTheDocs could allow to fix it, but it's [officially not supported](https://github.com/readthedocs/readthedocs.org/issues/978#issuecomment-285212453).
I considered switching to Sphinx, but it's too complicated in comparison to Mkdocs. Switching all the existing docs and scripts to use ReStructuredText is also a lot of work. Sphinx claims to support Markdown too but my attempts at using it failed.
So for now... have a bit of space.

View File

@ -1,7 +1,7 @@
Access to voxels and multithreading
======================================
This section explains in more detail how multithreading is implemented with voxel storage, and what are the implications when you access and modify them.
This section explains in more detail how multithreading is implemented with voxel storage, and what are the implications when you access and modify voxels.
The problem
@ -18,10 +18,10 @@ This made things simple, however it causes several issues.
Internal changes
-----------------
The old design starts to change in the next version. Now, copies aren't made preemptively on the main thread anymore, and are done in the actual threaded task instead. This means accessing voxels now require to lock the data during each transaction, to make sure each thread gets consistent data.
The old design starts to change in version `godot3.2.4`. Now, copies aren't made preemptively on the main thread anymore, and are done in the actual threaded task instead. This means accessing voxels now require to lock the data during each transaction, to make sure each thread gets consistent data.
Locking is required **if you access voxels which are part of a multithreaded volume**, like a terrain present in the scene tree. You don't need to if you know the data is not used by any other thread, like inside generators, custom streams, known copies or other storage not owned by an active component of the voxel engine.
The locking strategy is implemented on each `VoxelBuffer`, using `RWLock`. Such locks are read-write-locks, also known as shared mutexes. As described earlier, it is optional, so *none of VoxelBuffer methods actually use that lock*, it's up to you. If you only need to read voxels, lock for *read*. If you also need to modify voxels, lock for *write*. Multiple threads can then read the same block, but only one can modify it at once. If a thread wants to modify the block while it is already locked for *read*, the thread will be blocked until all other threads finished reading it. This can cause stutter if done on the main thread, so if it becomes a problem, a possible solution is to lock for *read*, copy the block and then modify it (Copy-on-Write).
The locking strategy is implemented on each `VoxelBuffer`, using `RWLock`. Such locks are read-write-locks, also known as shared mutexes. As described earlier, it is optional, so *none of VoxelBuffer methods actually use that lock*, it's up to you. If you only need to read voxels, lock for *read*. If you also need to modify voxels, lock for *write*. Multiple threads can then read the same block, but only one can modify it at once. If a thread wants to modify the block while it is already locked for *read*, the thread will be blocked until all other threads finished reading it. This can cause stutter if done too often on the main thread, so if it becomes a problem, a possible solution is to lock for *read*, copy the block and then modify it (Copy-on-Write).
At time of writing, there are no threaded tasks needing a write access to voxels.
It is possible that more changes happen in the future, in particular with nodes supporting LOD.

View File

@ -0,0 +1,144 @@
# FastNoiseLite
Inherits: [Resource](https://docs.godotengine.org/en/stable/classes/class_resource.html)
Generates coherent and fractal noise using the FastNoiseLite library.
## Properties:
Type | Name | Default
------------------------ | ------------------------------------------------------------ | --------
`int` | [cellular_distance_function](#i_cellular_distance_function) | 1
`float` | [cellular_jitter](#i_cellular_jitter) | 1.0
`int` | [cellular_return_type](#i_cellular_return_type) | 1
`float` | [fractal_gain](#i_fractal_gain) | 0.5
`float` | [fractal_lacunarity](#i_fractal_lacunarity) | 2.0
`int` | [fractal_octaves](#i_fractal_octaves) | 3
`float` | [fractal_ping_pong_strength](#i_fractal_ping_pong_strength) | 2.0
`int` | [fractal_type](#i_fractal_type) | 1
`float` | [fractal_weighted_strength](#i_fractal_weighted_strength) | 0.0
`int` | [noise_type](#i_noise_type) | 0
`float` | [period](#i_period) | 64.0
`int` | [rotation_type_3d](#i_rotation_type_3d) | 0
`int` | [seed](#i_seed) | 0
`FastNoiseLiteGradient` | [warp_noise](#i_warp_noise) |
<p></p>
## Methods:
Return | Signature
------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[float](https://docs.godotengine.org/en/stable/classes/class_float.html) | [get_noise_2d](#i_get_noise_2d) ( [float](https://docs.godotengine.org/en/stable/classes/class_float.html) x, [float](https://docs.godotengine.org/en/stable/classes/class_float.html) y )
[float](https://docs.godotengine.org/en/stable/classes/class_float.html) | [get_noise_2dv](#i_get_noise_2dv) ( [Vector2](https://docs.godotengine.org/en/stable/classes/class_vector2.html) position )
[float](https://docs.godotengine.org/en/stable/classes/class_float.html) | [get_noise_3d](#i_get_noise_3d) ( [float](https://docs.godotengine.org/en/stable/classes/class_float.html) x, [float](https://docs.godotengine.org/en/stable/classes/class_float.html) y, [float](https://docs.godotengine.org/en/stable/classes/class_float.html) z )
[float](https://docs.godotengine.org/en/stable/classes/class_float.html) | [get_noise_3dv](#i_get_noise_3dv) ( [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) position )
<p></p>
## Enumerations:
enum **NoiseType**:
- **TYPE_OPEN_SIMPLEX_2** = **0**
- **TYPE_OPEN_SIMPLEX_2S** = **1**
- **TYPE_CELLULAR** = **2**
- **TYPE_PERLIN** = **3**
- **TYPE_VALUE_CUBIC** = **4**
- **TYPE_VALUE** = **5**
enum **FractalType**:
- **FRACTAL_NONE** = **0**
- **FRACTAL_FBM** = **1**
- **FRACTAL_RIDGED** = **2**
- **FRACTAL_PING_PONG** = **3**
enum **RotationType3D**:
- **ROTATION_3D_NONE** = **0**
- **ROTATION_3D_IMPROVE_XY_PLANES** = **1**
- **ROTATION_3D_IMPROVE_XZ_PLANES** = **2**
enum **CellularDistanceFunction**:
- **CELLULAR_DISTANCE_EUCLIDEAN** = **0**
- **CELLULAR_DISTANCE_EUCLIDEAN_SQ** = **1**
- **CELLULAR_DISTANCE_MANHATTAN** = **2**
- **CELLULAR_DISTANCE_HYBRID** = **3**
enum **CellularReturnType**:
- **CELLULAR_RETURN_CELL_VALUE** = **0**
- **CELLULAR_RETURN_DISTANCE** = **1**
- **CELLULAR_RETURN_DISTANCE_2** = **2**
- **CELLULAR_RETURN_DISTANCE_2_ADD** = **3**
- **CELLULAR_RETURN_DISTANCE_2_SUB** = **4**
- **CELLULAR_RETURN_DISTANCE_2_MUL** = **5**
- **CELLULAR_RETURN_DISTANCE_2_DIV** = **6**
## Property Descriptions
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_cellular_distance_function"></span> **cellular_distance_function** = 1
- [float](https://docs.godotengine.org/en/stable/classes/class_float.html)<span id="i_cellular_jitter"></span> **cellular_jitter** = 1.0
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_cellular_return_type"></span> **cellular_return_type** = 1
- [float](https://docs.godotengine.org/en/stable/classes/class_float.html)<span id="i_fractal_gain"></span> **fractal_gain** = 0.5
- [float](https://docs.godotengine.org/en/stable/classes/class_float.html)<span id="i_fractal_lacunarity"></span> **fractal_lacunarity** = 2.0
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_fractal_octaves"></span> **fractal_octaves** = 3
- [float](https://docs.godotengine.org/en/stable/classes/class_float.html)<span id="i_fractal_ping_pong_strength"></span> **fractal_ping_pong_strength** = 2.0
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_fractal_type"></span> **fractal_type** = 1
- [float](https://docs.godotengine.org/en/stable/classes/class_float.html)<span id="i_fractal_weighted_strength"></span> **fractal_weighted_strength** = 0.0
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_noise_type"></span> **noise_type** = 0
- [float](https://docs.godotengine.org/en/stable/classes/class_float.html)<span id="i_period"></span> **period** = 64.0
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_rotation_type_3d"></span> **rotation_type_3d** = 0
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_seed"></span> **seed** = 0
- [FastNoiseLiteGradient](FastNoiseLiteGradient.md)<span id="i_warp_noise"></span> **warp_noise**
## Method Descriptions
- [float](https://docs.godotengine.org/en/stable/classes/class_float.html)<span id="i_get_noise_2d"></span> **get_noise_2d**( [float](https://docs.godotengine.org/en/stable/classes/class_float.html) x, [float](https://docs.godotengine.org/en/stable/classes/class_float.html) y )
- [float](https://docs.godotengine.org/en/stable/classes/class_float.html)<span id="i_get_noise_2dv"></span> **get_noise_2dv**( [Vector2](https://docs.godotengine.org/en/stable/classes/class_vector2.html) position )
- [float](https://docs.godotengine.org/en/stable/classes/class_float.html)<span id="i_get_noise_3d"></span> **get_noise_3d**( [float](https://docs.godotengine.org/en/stable/classes/class_float.html) x, [float](https://docs.godotengine.org/en/stable/classes/class_float.html) y, [float](https://docs.godotengine.org/en/stable/classes/class_float.html) z )
- [float](https://docs.godotengine.org/en/stable/classes/class_float.html)<span id="i_get_noise_3dv"></span> **get_noise_3dv**( [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) position )
_Generated on Jan 21, 2021_

View File

@ -0,0 +1,74 @@
# FastNoiseLiteGradient
Inherits: [Resource](https://docs.godotengine.org/en/stable/classes/class_resource.html)
Generates coherent and fractal noise gradients using the FastNoiseLite library.
## Properties:
Type | Name | Default
-------- | -------------------------------------------- | --------
`float` | [amplitude](#i_amplitude) | 30.0
`float` | [fractal_gain](#i_fractal_gain) | 0.5
`float` | [fractal_lacunarity](#i_fractal_lacunarity) | 2.0
`int` | [fractal_octaves](#i_fractal_octaves) | 3
`int` | [fractal_type](#i_fractal_type) | 0
`int` | [noise_type](#i_noise_type) | 2
`float` | [period](#i_period) | 64.0
`int` | [rotation_type_3d](#i_rotation_type_3d) | 0
`int` | [seed](#i_seed) | 0
<p></p>
## Enumerations:
enum **NoiseType**:
- **TYPE_OPEN_SIMPLEX_2** = **0**
- **TYPE_OPEN_SIMPLEX_2_REDUCED** = **1**
- **TYPE_VALUE** = **2**
enum **FractalType**:
- **FRACTAL_NONE** = **0**
- **FRACTAL_DOMAIN_WARP_PROGRESSIVE** = **1**
- **FRACTAL_DOMAIN_WARP_INDEPENDENT** = **2**
enum **RotationType3D**:
- **ROTATION_3D_NONE** = **0**
- **ROTATION_3D_IMPROVE_XY_PLANES** = **1**
- **ROTATION_3D_IMPROVE_XZ_PLANES** = **2**
## Property Descriptions
- [float](https://docs.godotengine.org/en/stable/classes/class_float.html)<span id="i_amplitude"></span> **amplitude** = 30.0
- [float](https://docs.godotengine.org/en/stable/classes/class_float.html)<span id="i_fractal_gain"></span> **fractal_gain** = 0.5
- [float](https://docs.godotengine.org/en/stable/classes/class_float.html)<span id="i_fractal_lacunarity"></span> **fractal_lacunarity** = 2.0
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_fractal_octaves"></span> **fractal_octaves** = 3
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_fractal_type"></span> **fractal_type** = 0
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_noise_type"></span> **noise_type** = 2
- [float](https://docs.godotengine.org/en/stable/classes/class_float.html)<span id="i_period"></span> **period** = 64.0
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_rotation_type_3d"></span> **rotation_type_3d** = 0
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_seed"></span> **seed** = 0
_Generated on Jan 21, 2021_

107
doc/source/api/Voxel.md Normal file
View File

@ -0,0 +1,107 @@
# Voxel
Inherits: [Resource](https://docs.godotengine.org/en/stable/classes/class_resource.html)
Model stored in [VoxelLibrary](VoxelLibrary.md) and used by [VoxelMesherBlocky](VoxelMesherBlocky.md).
## Description:
Represents a model to be used for voxels of a specific TYPE value. Such models must be contained within a [VoxelLibrary](VoxelLibrary.md) to be used with [VoxelTerrain](VoxelTerrain.md) or directly with a [VoxelMesherBlocky](VoxelMesherBlocky.md).
Some other various properties also exist to make it easier to implement games based on this technique (such as Minecraft).
## Properties:
Type | Name | Default
--------- | -------------------------------------------- | --------------------
`Array` | [collision_aabbs](#i_collision_aabbs) | [ ]
`int` | [collision_mask](#i_collision_mask) | 1
`Color` | [color](#i_color) | Color( 1, 1, 1, 1 )
`Mesh` | [custom_mesh](#i_custom_mesh) |
`int` | [geometry_type](#i_geometry_type) | 0
`int` | [material_id](#i_material_id) | 0
`bool` | [random_tickable](#i_random_tickable) | false
`int` | [transparency_index](#i_transparency_index) | 0
`bool` | [transparent](#i_transparent) | false
`String` | [voxel_name](#i_voxel_name) | ""
<p></p>
## Methods:
Return | Signature
----------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------
[int](https://docs.godotengine.org/en/stable/classes/class_int.html) | [get_id](#i_get_id) ( ) const
[bool](https://docs.godotengine.org/en/stable/classes/class_bool.html) | [is_empty](#i_is_empty) ( ) const
[void](#) | [set_id](#i_set_id) ( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) id )
<p></p>
## Enumerations:
enum **GeometryType**:
- **GEOMETRY_NONE** = **0** --- Don't produce any geometry. The voxel will be invisible.
- **GEOMETRY_CUBE** = **1** --- Use the shape of a generated cube. It is useful for testing and quick configuration.
- **GEOMETRY_CUSTOM_MESH** = **2** --- Use the mesh specified in the [member mesh] property. This is the most versatile way to create shapes.
- **GEOMETRY_MAX** = **3** --- How many geometry modes there are.
enum **Side**:
- **SIDE_NEGATIVE_X** = **1**
- **SIDE_POSITIVE_X** = **0**
- **SIDE_NEGATIVE_Y** = **2**
- **SIDE_POSITIVE_Y** = **3**
- **SIDE_NEGATIVE_Z** = **4**
- **SIDE_POSITIVE_Z** = **5**
- **SIDE_COUNT** = **6**
## Property Descriptions
- [Array](https://docs.godotengine.org/en/stable/classes/class_array.html)<span id="i_collision_aabbs"></span> **collision_aabbs** = [ ]
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_collision_mask"></span> **collision_mask** = 1
- [Color](https://docs.godotengine.org/en/stable/classes/class_color.html)<span id="i_color"></span> **color** = Color( 1, 1, 1, 1 )
- [Mesh](https://docs.godotengine.org/en/stable/classes/class_mesh.html)<span id="i_custom_mesh"></span> **custom_mesh**
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_geometry_type"></span> **geometry_type** = 0
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_material_id"></span> **material_id** = 0
ID of the material that will be used. It corresponds to the index of materials found on [VoxelTerrain](VoxelTerrain.md).
- [bool](https://docs.godotengine.org/en/stable/classes/class_bool.html)<span id="i_random_tickable"></span> **random_tickable** = false
If enabled, voxels having this ID in the TYPE channel will be used by method VoxelToolTerrain.run_blocky_random_tick.
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_transparency_index"></span> **transparency_index** = 0
- [bool](https://docs.godotengine.org/en/stable/classes/class_bool.html)<span id="i_transparent"></span> **transparent** = false
- [String](https://docs.godotengine.org/en/stable/classes/class_string.html)<span id="i_voxel_name"></span> **voxel_name** = ""
Name that can be used for convenience, when looking up a specific [Voxel](Voxel.md) from [VoxelLibrary](VoxelLibrary.md).
## Method Descriptions
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_get_id"></span> **get_id**( )
- [bool](https://docs.godotengine.org/en/stable/classes/class_bool.html)<span id="i_is_empty"></span> **is_empty**( )
- [void](#)<span id="i_set_id"></span> **set_id**( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) id )
_Generated on Jan 21, 2021_

View File

@ -0,0 +1,55 @@
# VoxelBlockSerializer
Inherits: [Reference](https://docs.godotengine.org/en/stable/classes/class_reference.html)
## Description:
Low-level utility to save and load the data within a [VoxelBuffer](VoxelBuffer.md). This can be useful to send data over the network, or to store it in a file.
Note: this utility uses [StreamPeer](https://docs.godotengine.org/en/stable/classes/class_streampeer.html) as temporary support for the data, because Godot does not have a common interface between files and network streams. So typically, you should use a temporary [StreamPeerBuffer](https://docs.godotengine.org/en/stable/classes/class_streampeerbuffer.html) to put voxel data into, and then you can use its member StreamPeerBuffer.data_array to save the data in the actual place you want.
To store into a file:
```gdscript
# Note, buffer can be re-used if you do this often
var stream_peer_buffer = StreamPeerBuffer.new()
var written_size = serializer.serialize(stream_peer_buffer, voxels, true)
file.store_32(written_size)
file.store_buffer(stream_peer_buffer.data_array)
```
To read it back:
```gdscript
var size = file.get_32()
var stream_peer_buffer = StreamPeerBuffer.new()
# Unfortunately Godot will always allocate memory with this API, can't avoid that
stream_peer_buffer.data_array = file.get_buffer(size)
serializer.deserialize(stream_peer_buffer, voxels, size, true)
```
## Methods:
Return | Signature
--------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[void](#) | [deserialize](#i_deserialize) ( [StreamPeer](https://docs.godotengine.org/en/stable/classes/class_streampeer.html) peer, [VoxelBuffer](VoxelBuffer.md) voxel_buffer, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) size, [bool](https://docs.godotengine.org/en/stable/classes/class_bool.html) decompress )
[int](https://docs.godotengine.org/en/stable/classes/class_int.html) | [serialize](#i_serialize) ( [StreamPeer](https://docs.godotengine.org/en/stable/classes/class_streampeer.html) peer, [VoxelBuffer](VoxelBuffer.md) voxel_buffer, [bool](https://docs.godotengine.org/en/stable/classes/class_bool.html) compress )
<p></p>
## Method Descriptions
- [void](#)<span id="i_deserialize"></span> **deserialize**( [StreamPeer](https://docs.godotengine.org/en/stable/classes/class_streampeer.html) peer, [VoxelBuffer](VoxelBuffer.md) voxel_buffer, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) size, [bool](https://docs.godotengine.org/en/stable/classes/class_bool.html) decompress )
Reads the data of a [VoxelBuffer](VoxelBuffer.md) from a [StreamPeer](https://docs.godotengine.org/en/stable/classes/class_streampeer.html). You must provide the number of bytes to read, and the destination buffer must have the expected size.
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_serialize"></span> **serialize**( [StreamPeer](https://docs.godotengine.org/en/stable/classes/class_streampeer.html) peer, [VoxelBuffer](VoxelBuffer.md) voxel_buffer, [bool](https://docs.godotengine.org/en/stable/classes/class_bool.html) compress )
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 21, 2021_

View File

@ -0,0 +1,45 @@
# VoxelBoxMover
Inherits: [Reference](https://docs.godotengine.org/en/stable/classes/class_reference.html)
## Description:
Utility class allowing to reproduce simple move-and-slide logic using only voxel AABBs, similar to Minecraft physics. This class may only be used with blocky voxels.
Store an instance of it within a member variable of your script, and use it within method Node._process or method Node._physics_process (it works wherever you like).
```gdscript
var motion = Vector3(0, 0, -10 * delta) # Move forward
motion = _box_mover.get_motion(get_translation(), motion, aabb, terrain_node)
global_translate(motion)
```
## Methods:
Return | Signature
----------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[int](https://docs.godotengine.org/en/stable/classes/class_int.html) | [get_collision_mask](#i_get_collision_mask) ( ) const
[Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) | [get_motion](#i_get_motion) ( [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) pos, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) motion, [AABB](https://docs.godotengine.org/en/stable/classes/class_aabb.html) aabb, [Node](https://docs.godotengine.org/en/stable/classes/class_node.html) terrain )
[void](#) | [set_collision_mask](#i_set_collision_mask) ( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) mask )
<p></p>
## Method Descriptions
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_get_collision_mask"></span> **get_collision_mask**( )
- [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html)<span id="i_get_motion"></span> **get_motion**( [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) pos, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) motion, [AABB](https://docs.godotengine.org/en/stable/classes/class_aabb.html) aabb, [Node](https://docs.godotengine.org/en/stable/classes/class_node.html) terrain )
Given a motion vector, returns a modified vector telling you by how much to move your character. This is similar to method KinematicBody.move_and_slide, except you have to apply the movement.
- [void](#)<span id="i_set_collision_mask"></span> **set_collision_mask**( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) mask )
_Generated on Jan 21, 2021_

View File

@ -0,0 +1,230 @@
# VoxelBuffer
Inherits: [Reference](https://docs.godotengine.org/en/stable/classes/class_reference.html)
3D grid storing voxel data.
## Description:
This contains dense voxels data storage (every single cell holds data, there is no sparse optimization of space). Works like a normal 3D grid containing a voxel value in each cell. Organized in channels of configurable bit depth. Values can be interpreted either as unsigned integers or normalized floats. See enum Depth for more information.
Arbitrary metadata can also be stored, either for the whole buffer, or per-voxel, at higher cost. This metadata can get saved and loaded along voxels, however you must make sure the data is serializable (i.e it should not contain nodes or arbitrary objects).
## Methods:
Return | Signature
----------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[void](#) | [clear](#i_clear) ( )
[void](#) | [clear_voxel_metadata](#i_clear_voxel_metadata) ( )
[void](#) | [clear_voxel_metadata_in_area](#i_clear_voxel_metadata_in_area) ( [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) min_pos, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) max_pos )
[void](#) | [copy_channel_from](#i_copy_channel_from) ( [VoxelBuffer](VoxelBuffer.md) other, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) channel )
[void](#) | [copy_channel_from_area](#i_copy_channel_from_area) ( [VoxelBuffer](VoxelBuffer.md) other, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) src_min, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) src_max, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) dst_min, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) channel )
[void](#) | [copy_voxel_metadata_in_area](#i_copy_voxel_metadata_in_area) ( [VoxelBuffer](VoxelBuffer.md) src_buffer, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) src_min_pos, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) src_max_pos, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) dst_min_pos )
[void](#) | [create](#i_create) ( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) sx, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) sy, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) sz )
[void](#) | [downscale_to](#i_downscale_to) ( [VoxelBuffer](VoxelBuffer.md) dst, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) src_min, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) src_max, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) dst_min ) const
[void](#) | [fill](#i_fill) ( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) value, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) channel=0 )
[void](#) | [fill_area](#i_fill_area) ( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) value, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) min, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) max, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) channel=0 )
[void](#) | [fill_f](#i_fill_f) ( [float](https://docs.godotengine.org/en/stable/classes/class_float.html) value, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) channel=0 )
[void](#) | [for_each_voxel_metadata](#i_for_each_voxel_metadata) ( [FuncRef](https://docs.godotengine.org/en/stable/classes/class_funcref.html) callback ) const
[void](#) | [for_each_voxel_metadata_in_area](#i_for_each_voxel_metadata_in_area) ( [FuncRef](https://docs.godotengine.org/en/stable/classes/class_funcref.html) callback, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) min_pos, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) max_pos )
[Variant](https://docs.godotengine.org/en/stable/classes/class_variant.html) | [get_block_metadata](#i_get_block_metadata) ( ) const
[int](https://docs.godotengine.org/en/stable/classes/class_int.html) | [get_channel_compression](#i_get_channel_compression) ( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) channel ) const
[int](https://docs.godotengine.org/en/stable/classes/class_int.html) | [get_channel_depth](#i_get_channel_depth) ( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) channel ) const
[Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) | [get_size](#i_get_size) ( ) const
[int](https://docs.godotengine.org/en/stable/classes/class_int.html) | [get_size_x](#i_get_size_x) ( ) const
[int](https://docs.godotengine.org/en/stable/classes/class_int.html) | [get_size_y](#i_get_size_y) ( ) const
[int](https://docs.godotengine.org/en/stable/classes/class_int.html) | [get_size_z](#i_get_size_z) ( ) const
[int](https://docs.godotengine.org/en/stable/classes/class_int.html) | [get_voxel](#i_get_voxel) ( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) x, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) y, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) z, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) channel=0 ) const
[float](https://docs.godotengine.org/en/stable/classes/class_float.html) | [get_voxel_f](#i_get_voxel_f) ( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) x, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) y, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) z, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) channel=0 ) const
[Variant](https://docs.godotengine.org/en/stable/classes/class_variant.html) | [get_voxel_metadata](#i_get_voxel_metadata) ( [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) pos ) const
[VoxelTool](VoxelTool.md) | [get_voxel_tool](#i_get_voxel_tool) ( )
[bool](https://docs.godotengine.org/en/stable/classes/class_bool.html) | [is_uniform](#i_is_uniform) ( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) channel ) const
[void](#) | [optimize](#i_optimize) ( )
[void](#) | [set_block_metadata](#i_set_block_metadata) ( [Variant](https://docs.godotengine.org/en/stable/classes/class_variant.html) meta )
[void](#) | [set_channel_depth](#i_set_channel_depth) ( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) channel, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) depth )
[void](#) | [set_voxel](#i_set_voxel) ( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) value, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) x, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) y, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) z, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) channel=0 )
[void](#) | [set_voxel_f](#i_set_voxel_f) ( [float](https://docs.godotengine.org/en/stable/classes/class_float.html) value, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) x, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) y, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) z, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) channel=0 )
[void](#) | [set_voxel_metadata](#i_set_voxel_metadata) ( [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) pos, [Variant](https://docs.godotengine.org/en/stable/classes/class_variant.html) value )
[void](#) | [set_voxel_v](#i_set_voxel_v) ( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) value, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) pos, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) channel=0 )
<p></p>
## Enumerations:
enum **ChannelId**:
- **CHANNEL_TYPE** = **0** --- Channel used to store voxel types. Used by [VoxelMesherBlocky].
- **CHANNEL_SDF** = **1** --- Channel used to store SDF data (signed distance field). Used by [VoxelMesherTransvoxel] and other smooth meshers. Values should preferably be accessed as floats. Negative values are below the isosurface (inside matter), and positive values are above the surface (outside matter).
- **CHANNEL_COLOR** = **2** --- Channel used to store color data. Used by [VoxelMesherCubes].
- **CHANNEL_DATA3** = **3** --- Free channel. Not used by the engine yet.
- **CHANNEL_DATA4** = **4** --- Free channel. Not used by the engine yet.
- **CHANNEL_DATA5** = **5** --- Free channel. Not used by the engine yet.
- **CHANNEL_DATA6** = **6** --- Free channel. Not used by the engine yet.
- **CHANNEL_DATA7** = **7** --- Free channel. Not used by the engine yet.
- **MAX_CHANNELS** = **8** --- Maximum number of channels a [VoxelBuffer] can have.
enum **Depth**:
- **DEPTH_8_BIT** = **0** --- Voxels will be stored with 8 bits. Raw values will range from 0 to 255, and float values will be normalized between -1 and 1 (but will still take 255 possible values). Values outside the range will be clamped. If you use this for smooth voxels, you may take care of scaling SDF data with a small number like 0.1 to reduce precision artifacts.
- **DEPTH_16_BIT** = **1** --- Voxels will be stored with 16 bits. Raw values will range from 0 to 65,535, and float values will be normalized between -1 and 1 (but will still take 65535 possible values). Values outside the range will be clamped.
- **DEPTH_32_BIT** = **2** --- Voxels will be stored with 32 bits. Raw values will range from 0 to 4,294,967,295, and float values will use regular IEEE 754 representation (`float`).
- **DEPTH_64_BIT** = **3** --- Voxels will be stored with 64 bits. Raw values will range from 0 to 18,446,744,073,709,551,615, and float values will use regular IEEE 754 representation (`double`).
- **DEPTH_COUNT** = **4** --- How many depth configuration there are.
enum **Compression**:
- **COMPRESSION_NONE** = **0** --- The channel is not compressed. Every value is stored individually inside an array in memory.
- **COMPRESSION_UNIFORM** = **1** --- All voxels of the channel have the same value, so they are stored as one single value, to save space.
- **COMPRESSION_COUNT** = **2** --- How many compression modes there are.
## Constants:
- **MAX_SIZE** = **65535**
## Method Descriptions
- [void](#)<span id="i_clear"></span> **clear**( )
Erases all contents of the buffer and resets its size to zero. Channel depths and default values are preserved.
- [void](#)<span id="i_clear_voxel_metadata"></span> **clear_voxel_metadata**( )
Erases all per-voxel metadata.
- [void](#)<span id="i_clear_voxel_metadata_in_area"></span> **clear_voxel_metadata_in_area**( [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) min_pos, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) max_pos )
Erases per-voxel metadata within the specified area.
- [void](#)<span id="i_copy_channel_from"></span> **copy_channel_from**( [VoxelBuffer](VoxelBuffer.md) other, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) channel )
Copies all values from the channel of another [VoxelBuffer](VoxelBuffer.md) into the same channel for the current buffer. The depth formats must match.
- [void](#)<span id="i_copy_channel_from_area"></span> **copy_channel_from_area**( [VoxelBuffer](VoxelBuffer.md) other, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) src_min, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) src_max, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) dst_min, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) channel )
Copies values from a channel's sub-region of another [VoxelBuffer](VoxelBuffer.md) into the same channel for the current buffer, at a specific location. The depth formats must match.
If corners of the area represent a negative-size area, they will be sorted back.
If coordinates are entirely or partially out of bounds, they will be clipped automatically.
- [void](#)<span id="i_copy_voxel_metadata_in_area"></span> **copy_voxel_metadata_in_area**( [VoxelBuffer](VoxelBuffer.md) src_buffer, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) src_min_pos, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) src_max_pos, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) dst_min_pos )
Copies per-voxel metadata from a sub-region of another [VoxelBuffer](VoxelBuffer.md) into the the current buffer, at a specific location. Values will be a shallow copy.
If corners of the area represent a negative-size area, they will be sorted back.
If coordinates are entirely or partially out of bounds, they will be clipped automatically.
- [void](#)<span id="i_create"></span> **create**( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) sx, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) sy, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) sz )
Clears the buffer and gives it the specified size.
- [void](#)<span id="i_downscale_to"></span> **downscale_to**( [VoxelBuffer](VoxelBuffer.md) dst, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) src_min, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) src_max, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) dst_min )
Produces a downscaled version of this buffer, by a factor of 2, without any form of interpolation (i.e using nearest-neighbor).
Metadata is not copied.
- [void](#)<span id="i_fill"></span> **fill**( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) value, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) channel=0 )
Fills one channel of this buffer with a specific raw value.
- [void](#)<span id="i_fill_area"></span> **fill_area**( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) value, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) min, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) max, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) channel=0 )
Fills an area of a channel in this buffer with a specific raw value.
- [void](#)<span id="i_fill_f"></span> **fill_f**( [float](https://docs.godotengine.org/en/stable/classes/class_float.html) value, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) channel=0 )
Fills one channel of this buffer with a specific float value.
- [void](#)<span id="i_for_each_voxel_metadata"></span> **for_each_voxel_metadata**( [FuncRef](https://docs.godotengine.org/en/stable/classes/class_funcref.html) callback )
Executes a function on every voxel in this buffer which have associated metadata.
- [void](#)<span id="i_for_each_voxel_metadata_in_area"></span> **for_each_voxel_metadata_in_area**( [FuncRef](https://docs.godotengine.org/en/stable/classes/class_funcref.html) callback, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) min_pos, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) max_pos )
Executes a function on every voxel in this buffer which have associated metadata, within the specified area.
- [Variant](https://docs.godotengine.org/en/stable/classes/class_variant.html)<span id="i_get_block_metadata"></span> **get_block_metadata**( )
Gets metadata associated to this [VoxelBuffer](VoxelBuffer.md).
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_get_channel_compression"></span> **get_channel_compression**( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) channel )
Gets which compression mode the specified channel has.
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_get_channel_depth"></span> **get_channel_depth**( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) channel )
Gets which bit depth the specified channel has.
- [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html)<span id="i_get_size"></span> **get_size**( )
Gets the 3D size of the buffer in voxels.
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_get_size_x"></span> **get_size_x**( )
Gets how many voxels the buffer contains across the X axis.
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_get_size_y"></span> **get_size_y**( )
Gets how many voxels the buffer contains across the Y axis.
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_get_size_z"></span> **get_size_z**( )
Gets how many voxels the buffer contains across the Z axis.
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_get_voxel"></span> **get_voxel**( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) x, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) y, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) z, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) channel=0 )
Gets the raw value of a voxel within this buffer.
- [float](https://docs.godotengine.org/en/stable/classes/class_float.html)<span id="i_get_voxel_f"></span> **get_voxel_f**( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) x, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) y, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) z, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) channel=0 )
Gets the float value of a voxel within this buffer. You may use this function if you work with SDF volumes (smooth voxels).
- [Variant](https://docs.godotengine.org/en/stable/classes/class_variant.html)<span id="i_get_voxel_metadata"></span> **get_voxel_metadata**( [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) pos )
Gets the metadata attached to a specific voxel in this buffer.
- [VoxelTool](VoxelTool.md)<span id="i_get_voxel_tool"></span> **get_voxel_tool**( )
Constructs a [VoxelTool](VoxelTool.md) instance bound to this buffer. This provides access to some extra common functions.
- [bool](https://docs.godotengine.org/en/stable/classes/class_bool.html)<span id="i_is_uniform"></span> **is_uniform**( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) channel )
Checks if every voxel within a channel has the same value.
- [void](#)<span id="i_optimize"></span> **optimize**( )
- [void](#)<span id="i_set_block_metadata"></span> **set_block_metadata**( [Variant](https://docs.godotengine.org/en/stable/classes/class_variant.html) meta )
Sets arbitrary data on this buffer. Old data is replaced. Note, this is separate storage from per-voxel metadata.
If this [VoxelBuffer](VoxelBuffer.md) is saved, this metadata will also be saved along voxels, so make sure the data supports serialization (i.e you can't put nodes or arbitrary objects in it).
- [void](#)<span id="i_set_channel_depth"></span> **set_channel_depth**( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) channel, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) depth )
Changes the bit depth of a given channel. This controls the range of values a channel can hold. See enum VoxelBuffer.Depth for more information.
- [void](#)<span id="i_set_voxel"></span> **set_voxel**( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) value, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) x, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) y, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) z, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) channel=0 )
Sets the raw value of a voxel. If you use smooth voxels, you may prefer using method set_voxel_f.
- [void](#)<span id="i_set_voxel_f"></span> **set_voxel_f**( [float](https://docs.godotengine.org/en/stable/classes/class_float.html) value, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) x, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) y, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) z, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) channel=0 )
Sets the float value of a voxel. This method should be used if you work on SDF data (smooth voxels).
- [void](#)<span id="i_set_voxel_metadata"></span> **set_voxel_metadata**( [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) pos, [Variant](https://docs.godotengine.org/en/stable/classes/class_variant.html) value )
Attaches arbitrary data on a specific voxel. Old data is replaced.
If this [VoxelBuffer](VoxelBuffer.md) is saved, this metadata will also be saved along voxels, so make sure the data supports serialization (i.e you can't put nodes or arbitrary objects in it).
- [void](#)<span id="i_set_voxel_v"></span> **set_voxel_v**( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) value, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) pos, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) channel=0 )
_Generated on Jan 21, 2021_

View File

@ -0,0 +1,44 @@
# VoxelColorPalette
Inherits: [Resource](https://docs.godotengine.org/en/stable/classes/class_resource.html)
## Properties:
Type | Name | Default
--------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
`PoolIntArray` | [data](#i_data) | PoolIntArray( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
<p></p>
## Methods:
Return | Signature
------------------------------------------------------------------------- | -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[Color](https://docs.godotengine.org/en/stable/classes/class_color.html) | [get_color](#i_get_color) ( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) arg0 ) const
[void](#) | [set_color](#i_set_color) ( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) color, [Color](https://docs.godotengine.org/en/stable/classes/class_color.html) arg1 )
<p></p>
## Constants:
- **MAX_COLORS** = **256**
## Property Descriptions
- [PoolIntArray](https://docs.godotengine.org/en/stable/classes/class_poolintarray.html)<span id="i_data"></span> **data** = PoolIntArray( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 )
## Method Descriptions
- [Color](https://docs.godotengine.org/en/stable/classes/class_color.html)<span id="i_get_color"></span> **get_color**( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) arg0 )
- [void](#)<span id="i_set_color"></span> **set_color**( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) color, [Color](https://docs.godotengine.org/en/stable/classes/class_color.html) arg1 )
_Generated on Jan 21, 2021_

View File

@ -0,0 +1,24 @@
# VoxelGenerator
Inherits: [Resource](https://docs.godotengine.org/en/stable/classes/class_resource.html)
Base class to all voxel procedural generators. If you want to define a custom one with a script, this is the class you should extend from.
Important: this engine makes heavy use of threads. Generators will run in one of them, so make sure you don't access the scene tree or other unsafe APIs from within a generator.
## Methods:
Return | Signature
---------- | -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[void](#) | [generate_block](#i_generate_block) ( [VoxelBuffer](VoxelBuffer.md) out_buffer, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) origin_in_voxels, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) lod )
<p></p>
## Method Descriptions
- [void](#)<span id="i_generate_block"></span> **generate_block**( [VoxelBuffer](VoxelBuffer.md) out_buffer, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) origin_in_voxels, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) lod )
Generates a block of voxels within the specified world area.
_Generated on Jan 21, 2021_

View File

@ -0,0 +1,29 @@
# VoxelGeneratorFlat
Inherits: [VoxelGenerator](VoxelGenerator.md)
## Properties:
Type | Name | Default
-------- | ---------------------------- | --------
`int` | [channel](#i_channel) | 1
`float` | [height](#i_height) | 0.0
`int` | [voxel_type](#i_voxel_type) | 1
<p></p>
## Property Descriptions
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_channel"></span> **channel** = 1
- [float](https://docs.godotengine.org/en/stable/classes/class_float.html)<span id="i_height"></span> **height** = 0.0
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_voxel_type"></span> **voxel_type** = 1
_Generated on Jan 21, 2021_

View File

@ -0,0 +1,192 @@
# VoxelGeneratorGraph
Inherits: [VoxelGenerator](VoxelGenerator.md)
Graph-based generator for smooth voxel worlds.
## Methods:
Return | Signature
--------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[void](#) | [add_connection](#i_add_connection) ( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) src_node_id, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) src_port_index, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) dst_node_id, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) dst_port_index )
[void](#) | [bake_sphere_bumpmap](#i_bake_sphere_bumpmap) ( [Image](https://docs.godotengine.org/en/stable/classes/class_image.html) im, [float](https://docs.godotengine.org/en/stable/classes/class_float.html) ref_radius, [float](https://docs.godotengine.org/en/stable/classes/class_float.html) sdf_min, [float](https://docs.godotengine.org/en/stable/classes/class_float.html) sdf_max )
[void](#) | [bake_sphere_normalmap](#i_bake_sphere_normalmap) ( [Image](https://docs.godotengine.org/en/stable/classes/class_image.html) im, [float](https://docs.godotengine.org/en/stable/classes/class_float.html) ref_radius, [float](https://docs.godotengine.org/en/stable/classes/class_float.html) strength )
[bool](https://docs.godotengine.org/en/stable/classes/class_bool.html) | [can_connect](#i_can_connect) ( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) src_node_id, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) src_port_index, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) dst_node_id, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) dst_port_index ) const
[void](#) | [clear](#i_clear) ( )
[Dictionary](https://docs.godotengine.org/en/stable/classes/class_dictionary.html) | [compile](#i_compile) ( )
[int](https://docs.godotengine.org/en/stable/classes/class_int.html) | [create_node](#i_create_node) ( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) type_id, [Vector2](https://docs.godotengine.org/en/stable/classes/class_vector2.html) position, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) id=0 )
[void](#) | [debug_load_waves_preset](#i_debug_load_waves_preset) ( )
[float](https://docs.godotengine.org/en/stable/classes/class_float.html) | [debug_measure_microseconds_per_voxel](#i_debug_measure_microseconds_per_voxel) ( [bool](https://docs.godotengine.org/en/stable/classes/class_bool.html) use_singular_queries )
[int](https://docs.godotengine.org/en/stable/classes/class_int.html) | [find_node_by_name](#i_find_node_by_name) ( [String](https://docs.godotengine.org/en/stable/classes/class_string.html) name ) const
[float](https://docs.godotengine.org/en/stable/classes/class_float.html) | [generate_single](#i_generate_single) ( [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) arg0 )
[Array](https://docs.godotengine.org/en/stable/classes/class_array.html) | [get_connections](#i_get_connections) ( ) const
[Variant](https://docs.godotengine.org/en/stable/classes/class_variant.html) | [get_node_default_input](#i_get_node_default_input) ( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) node_id, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) input_index ) const
[Vector2](https://docs.godotengine.org/en/stable/classes/class_vector2.html) | [get_node_gui_position](#i_get_node_gui_position) ( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) node_id ) const
[PoolIntArray](https://docs.godotengine.org/en/stable/classes/class_poolintarray.html) | [get_node_ids](#i_get_node_ids) ( ) const
[Variant](https://docs.godotengine.org/en/stable/classes/class_variant.html) | [get_node_param](#i_get_node_param) ( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) node_id, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) param_index ) const
[int](https://docs.godotengine.org/en/stable/classes/class_int.html) | [get_node_type_count](#i_get_node_type_count) ( ) const
[int](https://docs.godotengine.org/en/stable/classes/class_int.html) | [get_node_type_id](#i_get_node_type_id) ( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) node_id ) const
[Dictionary](https://docs.godotengine.org/en/stable/classes/class_dictionary.html) | [get_node_type_info](#i_get_node_type_info) ( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) type_id ) const
[void](#) | [remove_connection](#i_remove_connection) ( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) src_node_id, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) src_port_index, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) dst_node_id, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) dst_port_index )
[void](#) | [remove_node](#i_remove_node) ( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) node_id )
[void](#) | [set_node_default_input](#i_set_node_default_input) ( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) node_id, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) input_index, [Variant](https://docs.godotengine.org/en/stable/classes/class_variant.html) value )
[void](#) | [set_node_gui_position](#i_set_node_gui_position) ( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) node_id, [Vector2](https://docs.godotengine.org/en/stable/classes/class_vector2.html) position )
[void](#) | [set_node_param](#i_set_node_param) ( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) node_id, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) param_index, [Variant](https://docs.godotengine.org/en/stable/classes/class_variant.html) value )
[void](#) | [set_node_param_null](#i_set_node_param_null) ( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) node_id, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) param_index )
<p></p>
## Signals:
- node_name_changed( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) node_id )
## Enumerations:
enum **NodeTypeID**:
- **NODE_CONSTANT** = **0**
- **NODE_INPUT_X** = **1**
- **NODE_INPUT_Y** = **2**
- **NODE_INPUT_Z** = **3**
- **NODE_OUTPUT_SDF** = **4**
- **NODE_ADD** = **5**
- **NODE_SUBTRACT** = **6**
- **NODE_MULTIPLY** = **7**
- **NODE_DIVIDE** = **8**
- **NODE_SIN** = **9**
- **NODE_FLOOR** = **10**
- **NODE_ABS** = **11**
- **NODE_SQRT** = **12**
- **NODE_FRACT** = **13**
- **NODE_STEPIFY** = **14**
- **NODE_WRAP** = **15**
- **NODE_MIN** = **16**
- **NODE_MAX** = **17**
- **NODE_DISTANCE_2D** = **18**
- **NODE_DISTANCE_3D** = **19**
- **NODE_CLAMP** = **20**
- **NODE_MIX** = **21**
- **NODE_REMAP** = **22**
- **NODE_SMOOTHSTEP** = **23**
- **NODE_CURVE** = **24**
- **NODE_SELECT** = **25**
- **NODE_NOISE_2D** = **26**
- **NODE_NOISE_3D** = **27**
- **NODE_IMAGE_2D** = **28**
- **NODE_SDF_PLANE** = **29**
- **NODE_SDF_BOX** = **30**
- **NODE_SDF_SPHERE** = **31**
- **NODE_SDF_TORUS** = **32**
- **NODE_SDF_PREVIEW** = **33**
- **NODE_NORMALIZE_3D** = **35**
- **NODE_FAST_NOISE_2D** = **36**
- **NODE_FAST_NOISE_3D** = **37**
- **NODE_FAST_NOISE_GRADIENT_2D** = **38**
- **NODE_FAST_NOISE_GRADIENT_3D** = **39**
- **NODE_TYPE_COUNT** = **40**
## Method Descriptions
- [void](#)<span id="i_add_connection"></span> **add_connection**( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) src_node_id, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) src_port_index, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) dst_node_id, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) dst_port_index )
- [void](#)<span id="i_bake_sphere_bumpmap"></span> **bake_sphere_bumpmap**( [Image](https://docs.godotengine.org/en/stable/classes/class_image.html) im, [float](https://docs.godotengine.org/en/stable/classes/class_float.html) ref_radius, [float](https://docs.godotengine.org/en/stable/classes/class_float.html) sdf_min, [float](https://docs.godotengine.org/en/stable/classes/class_float.html) sdf_max )
- [void](#)<span id="i_bake_sphere_normalmap"></span> **bake_sphere_normalmap**( [Image](https://docs.godotengine.org/en/stable/classes/class_image.html) im, [float](https://docs.godotengine.org/en/stable/classes/class_float.html) ref_radius, [float](https://docs.godotengine.org/en/stable/classes/class_float.html) strength )
- [bool](https://docs.godotengine.org/en/stable/classes/class_bool.html)<span id="i_can_connect"></span> **can_connect**( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) src_node_id, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) src_port_index, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) dst_node_id, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) dst_port_index )
- [void](#)<span id="i_clear"></span> **clear**( )
- [Dictionary](https://docs.godotengine.org/en/stable/classes/class_dictionary.html)<span id="i_compile"></span> **compile**( )
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_create_node"></span> **create_node**( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) type_id, [Vector2](https://docs.godotengine.org/en/stable/classes/class_vector2.html) position, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) id=0 )
- [void](#)<span id="i_debug_load_waves_preset"></span> **debug_load_waves_preset**( )
- [float](https://docs.godotengine.org/en/stable/classes/class_float.html)<span id="i_debug_measure_microseconds_per_voxel"></span> **debug_measure_microseconds_per_voxel**( [bool](https://docs.godotengine.org/en/stable/classes/class_bool.html) use_singular_queries )
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_find_node_by_name"></span> **find_node_by_name**( [String](https://docs.godotengine.org/en/stable/classes/class_string.html) name )
- [float](https://docs.godotengine.org/en/stable/classes/class_float.html)<span id="i_generate_single"></span> **generate_single**( [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) arg0 )
- [Array](https://docs.godotengine.org/en/stable/classes/class_array.html)<span id="i_get_connections"></span> **get_connections**( )
- [Variant](https://docs.godotengine.org/en/stable/classes/class_variant.html)<span id="i_get_node_default_input"></span> **get_node_default_input**( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) node_id, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) input_index )
- [Vector2](https://docs.godotengine.org/en/stable/classes/class_vector2.html)<span id="i_get_node_gui_position"></span> **get_node_gui_position**( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) node_id )
- [PoolIntArray](https://docs.godotengine.org/en/stable/classes/class_poolintarray.html)<span id="i_get_node_ids"></span> **get_node_ids**( )
- [Variant](https://docs.godotengine.org/en/stable/classes/class_variant.html)<span id="i_get_node_param"></span> **get_node_param**( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) node_id, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) param_index )
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_get_node_type_count"></span> **get_node_type_count**( )
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_get_node_type_id"></span> **get_node_type_id**( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) node_id )
- [Dictionary](https://docs.godotengine.org/en/stable/classes/class_dictionary.html)<span id="i_get_node_type_info"></span> **get_node_type_info**( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) type_id )
- [void](#)<span id="i_remove_connection"></span> **remove_connection**( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) src_node_id, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) src_port_index, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) dst_node_id, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) dst_port_index )
- [void](#)<span id="i_remove_node"></span> **remove_node**( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) node_id )
- [void](#)<span id="i_set_node_default_input"></span> **set_node_default_input**( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) node_id, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) input_index, [Variant](https://docs.godotengine.org/en/stable/classes/class_variant.html) value )
- [void](#)<span id="i_set_node_gui_position"></span> **set_node_gui_position**( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) node_id, [Vector2](https://docs.godotengine.org/en/stable/classes/class_vector2.html) position )
- [void](#)<span id="i_set_node_param"></span> **set_node_param**( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) node_id, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) param_index, [Variant](https://docs.godotengine.org/en/stable/classes/class_variant.html) value )
- [void](#)<span id="i_set_node_param_null"></span> **set_node_param_null**( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) node_id, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) param_index )
_Generated on Jan 21, 2021_

View File

@ -0,0 +1,33 @@
# VoxelGeneratorHeightmap
Inherits: [VoxelGenerator](VoxelGenerator.md)
## Properties:
Type | Name | Default
-------- | -------------------------------- | --------
`int` | [channel](#i_channel) | 1
`float` | [height_range](#i_height_range) | 200.0
`float` | [height_start](#i_height_start) | -50.0
`float` | [iso_scale](#i_iso_scale) | 0.1
<p></p>
## Property Descriptions
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_channel"></span> **channel** = 1
- [float](https://docs.godotengine.org/en/stable/classes/class_float.html)<span id="i_height_range"></span> **height_range** = 200.0
- [float](https://docs.godotengine.org/en/stable/classes/class_float.html)<span id="i_height_start"></span> **height_start** = -50.0
- [float](https://docs.godotengine.org/en/stable/classes/class_float.html)<span id="i_iso_scale"></span> **iso_scale** = 0.1
_Generated on Jan 21, 2021_

View File

@ -0,0 +1,25 @@
# VoxelGeneratorImage
Inherits: [VoxelGeneratorHeightmap](VoxelGeneratorHeightmap.md)
## Properties:
Type | Name | Default
-------- | -------------------------------- | --------
`bool` | [blur_enabled](#i_blur_enabled) | false
`Image` | [image](#i_image) |
<p></p>
## Property Descriptions
- [bool](https://docs.godotengine.org/en/stable/classes/class_bool.html)<span id="i_blur_enabled"></span> **blur_enabled** = false
- [Image](https://docs.godotengine.org/en/stable/classes/class_image.html)<span id="i_image"></span> **image**
_Generated on Jan 21, 2021_

View File

@ -0,0 +1,33 @@
# VoxelGeneratorNoise
Inherits: [VoxelGenerator](VoxelGenerator.md)
## Properties:
Type | Name | Default
------------------- | -------------------------------- | --------
`int` | [channel](#i_channel) | 1
`float` | [height_range](#i_height_range) | 300.0
`float` | [height_start](#i_height_start) | 0.0
`OpenSimplexNoise` | [noise](#i_noise) |
<p></p>
## Property Descriptions
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_channel"></span> **channel** = 1
- [float](https://docs.godotengine.org/en/stable/classes/class_float.html)<span id="i_height_range"></span> **height_range** = 300.0
- [float](https://docs.godotengine.org/en/stable/classes/class_float.html)<span id="i_height_start"></span> **height_start** = 0.0
- [OpenSimplexNoise](https://docs.godotengine.org/en/stable/classes/class_opensimplexnoise.html)<span id="i_noise"></span> **noise**
_Generated on Jan 21, 2021_

View File

@ -0,0 +1,25 @@
# VoxelGeneratorNoise2D
Inherits: [VoxelGeneratorHeightmap](VoxelGeneratorHeightmap.md)
## Properties:
Type | Name | Default
------------------- | ------------------ | --------
`Curve` | [curve](#i_curve) |
`OpenSimplexNoise` | [noise](#i_noise) |
<p></p>
## Property Descriptions
- [Curve](https://docs.godotengine.org/en/stable/classes/class_curve.html)<span id="i_curve"></span> **curve**
- [OpenSimplexNoise](https://docs.godotengine.org/en/stable/classes/class_opensimplexnoise.html)<span id="i_noise"></span> **noise**
_Generated on Jan 21, 2021_

View File

@ -0,0 +1,27 @@
# VoxelGeneratorScript
Inherits: [VoxelGenerator](VoxelGenerator.md)
Base class for custom generators defined with a script.
## Methods:
Return | Signature
--------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[void](#) | [_generate_block](#i__generate_block) ( [VoxelBuffer](VoxelBuffer.md) out_buffer, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) origin_in_voxels, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) lod ) virtual
[int](https://docs.godotengine.org/en/stable/classes/class_int.html) | [_get_used_channels_mask](#i__get_used_channels_mask) ( ) virtual
<p></p>
## Method Descriptions
- [void](#)<span id="i__generate_block"></span> **_generate_block**( [VoxelBuffer](VoxelBuffer.md) out_buffer, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) origin_in_voxels, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) lod )
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i__get_used_channels_mask"></span> **_get_used_channels_mask**( )
_Generated on Jan 21, 2021_

View File

@ -0,0 +1,29 @@
# VoxelGeneratorWaves
Inherits: [VoxelGeneratorHeightmap](VoxelGeneratorHeightmap.md)
## Properties:
Type | Name | Default
---------- | ------------------------------------ | ------------------
`float` | [height_range](#i_height_range) | 30.0
`Vector2` | [pattern_offset](#i_pattern_offset) | Vector2( 0, 0 )
`Vector2` | [pattern_size](#i_pattern_size) | Vector2( 30, 30 )
<p></p>
## Property Descriptions
- [float](https://docs.godotengine.org/en/stable/classes/class_float.html)<span id="i_height_range"></span> **height_range** = 30.0
- [Vector2](https://docs.godotengine.org/en/stable/classes/class_vector2.html)<span id="i_pattern_offset"></span> **pattern_offset** = Vector2( 0, 0 )
- [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 21, 2021_

View File

@ -0,0 +1,63 @@
# VoxelLibrary
Inherits: [Resource](https://docs.godotengine.org/en/stable/classes/class_resource.html)
## Properties:
Type | Name | Default
------ | ------------------------------ | --------
`int` | [atlas_size](#i_atlas_size) | 16
`int` | [voxel_count](#i_voxel_count) | 0
<p></p>
## Methods:
Return | Signature
--------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[void](#) | [bake](#i_bake) ( )
[Voxel](Voxel.md) | [create_voxel](#i_create_voxel) ( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) id, [String](https://docs.godotengine.org/en/stable/classes/class_string.html) name )
[Voxel](Voxel.md) | [get_voxel](#i_get_voxel) ( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) id )
[Voxel](Voxel.md) | [get_voxel_by_name](#i_get_voxel_by_name) ( [String](https://docs.godotengine.org/en/stable/classes/class_string.html) name )
[int](https://docs.godotengine.org/en/stable/classes/class_int.html) | [get_voxel_index_from_name](#i_get_voxel_index_from_name) ( [String](https://docs.godotengine.org/en/stable/classes/class_string.html) name ) const
<p></p>
## Constants:
- **MAX_VOXEL_TYPES** = **65536**
## Property Descriptions
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_atlas_size"></span> **atlas_size** = 16
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_voxel_count"></span> **voxel_count** = 0
## Method Descriptions
- [void](#)<span id="i_bake"></span> **bake**( )
- [Voxel](Voxel.md)<span id="i_create_voxel"></span> **create_voxel**( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) id, [String](https://docs.godotengine.org/en/stable/classes/class_string.html) name )
- [Voxel](Voxel.md)<span id="i_get_voxel"></span> **get_voxel**( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) id )
- [Voxel](Voxel.md)<span id="i_get_voxel_by_name"></span> **get_voxel_by_name**( [String](https://docs.godotengine.org/en/stable/classes/class_string.html) name )
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_get_voxel_index_from_name"></span> **get_voxel_index_from_name**( [String](https://docs.godotengine.org/en/stable/classes/class_string.html) name )
_Generated on Jan 21, 2021_

View File

@ -0,0 +1,159 @@
# VoxelLodTerrain
Inherits: [VoxelNode](VoxelNode.md)
Voxel volume using variable level of detail.
## Properties:
Type | Name | Default
-------------- | ------------------------------------------------ | ----------------------------------------------------------------------------------------
`int` | [collision_lod_count](#i_collision_lod_count) | -1
`bool` | [generate_collisions](#i_generate_collisions) | true
`int` | [lod_count](#i_lod_count) | 4
`float` | [lod_split_scale](#i_lod_split_scale) | 3.0
`Material` | [material](#i_material) |
`VoxelMesher` | [mesher](#i_mesher) |
`bool` | [run_stream_in_editor](#i_run_stream_in_editor) | true
`int` | [view_distance](#i_view_distance) | 512
`AABB` | [voxel_bounds](#i_voxel_bounds) | AABB( -5.36871e+08, -5.36871e+08, -5.36871e+08, 1.07374e+09, 1.07374e+09, 1.07374e+09 )
<p></p>
## Methods:
Return | Signature
----------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[int](https://docs.godotengine.org/en/stable/classes/class_int.html) | [debug_dump_as_scene](#i_debug_dump_as_scene) ( [String](https://docs.godotengine.org/en/stable/classes/class_string.html) path ) const
[int](https://docs.godotengine.org/en/stable/classes/class_int.html) | [debug_get_block_count](#i_debug_get_block_count) ( ) const
[Dictionary](https://docs.godotengine.org/en/stable/classes/class_dictionary.html) | [debug_get_block_info](#i_debug_get_block_info) ( [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) block_pos, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) lod ) const
[Array](https://docs.godotengine.org/en/stable/classes/class_array.html) | [debug_get_octrees](#i_debug_get_octrees) ( ) const
[Array](https://docs.godotengine.org/en/stable/classes/class_array.html) | [debug_print_sdf_top_down](#i_debug_print_sdf_top_down) ( [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) center, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) extents ) const
[Array](https://docs.godotengine.org/en/stable/classes/class_array.html) | [debug_raycast_block](#i_debug_raycast_block) ( [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) origin, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) dir ) const
[int](https://docs.godotengine.org/en/stable/classes/class_int.html) | [get_block_region_extent](#i_get_block_region_extent) ( ) const
[int](https://docs.godotengine.org/en/stable/classes/class_int.html) | [get_block_size](#i_get_block_size) ( ) const
[int](https://docs.godotengine.org/en/stable/classes/class_int.html) | [get_process_mode](#i_get_process_mode) ( ) const
[Dictionary](https://docs.godotengine.org/en/stable/classes/class_dictionary.html) | [get_statistics](#i_get_statistics) ( ) const
[VoxelTool](VoxelTool.md) | [get_voxel_tool](#i_get_voxel_tool) ( )
[void](#) | [save_modified_blocks](#i_save_modified_blocks) ( )
[void](#) | [set_process_mode](#i_set_process_mode) ( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) mode )
[Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) | [voxel_to_block_position](#i_voxel_to_block_position) ( [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) lod_index, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) arg1 ) const
<p></p>
## Enumerations:
enum **ProcessMode**:
- **PROCESS_MODE_IDLE** = **0**
- **PROCESS_MODE_PHYSICS** = **1**
- **PROCESS_MODE_DISABLED** = **2**
## Property Descriptions
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_collision_lod_count"></span> **collision_lod_count** = -1
- [bool](https://docs.godotengine.org/en/stable/classes/class_bool.html)<span id="i_generate_collisions"></span> **generate_collisions** = true
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_lod_count"></span> **lod_count** = 4
- [float](https://docs.godotengine.org/en/stable/classes/class_float.html)<span id="i_lod_split_scale"></span> **lod_split_scale** = 3.0
- [Material](https://docs.godotengine.org/en/stable/classes/class_material.html)<span id="i_material"></span> **material**
- [VoxelMesher](VoxelMesher.md)<span id="i_mesher"></span> **mesher**
- [bool](https://docs.godotengine.org/en/stable/classes/class_bool.html)<span id="i_run_stream_in_editor"></span> **run_stream_in_editor** = true
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_view_distance"></span> **view_distance** = 512
- [AABB](https://docs.godotengine.org/en/stable/classes/class_aabb.html)<span id="i_voxel_bounds"></span> **voxel_bounds** = AABB( -5.36871e+08, -5.36871e+08, -5.36871e+08, 1.07374e+09, 1.07374e+09, 1.07374e+09 )
## Method Descriptions
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_debug_dump_as_scene"></span> **debug_dump_as_scene**( [String](https://docs.godotengine.org/en/stable/classes/class_string.html) path )
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_debug_get_block_count"></span> **debug_get_block_count**( )
- [Dictionary](https://docs.godotengine.org/en/stable/classes/class_dictionary.html)<span id="i_debug_get_block_info"></span> **debug_get_block_info**( [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) block_pos, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) lod )
- [Array](https://docs.godotengine.org/en/stable/classes/class_array.html)<span id="i_debug_get_octrees"></span> **debug_get_octrees**( )
- [Array](https://docs.godotengine.org/en/stable/classes/class_array.html)<span id="i_debug_print_sdf_top_down"></span> **debug_print_sdf_top_down**( [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) center, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) extents )
- [Array](https://docs.godotengine.org/en/stable/classes/class_array.html)<span id="i_debug_raycast_block"></span> **debug_raycast_block**( [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) origin, [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) dir )
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_get_block_region_extent"></span> **get_block_region_extent**( )
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_get_block_size"></span> **get_block_size**( )
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_get_process_mode"></span> **get_process_mode**( )
- [Dictionary](https://docs.godotengine.org/en/stable/classes/class_dictionary.html)<span id="i_get_statistics"></span> **get_statistics**( )
Gets debug information about how much time is spent processing the terrain.
The returned dictionary has the following structure:
```gdscript
{
"time_detect_required_blocks": int,
"time_request_blocks_to_load": int,
"time_process_load_responses": int,
"time_request_blocks_to_update": int,
"time_process_update_responses": int,
"remaining_main_thread_blocks": int,
"dropped_block_loads": int,
"dropped_block_meshs": int,
"updated_blocks": int,
"blocked_lods": int
}
```
- [VoxelTool](VoxelTool.md)<span id="i_get_voxel_tool"></span> **get_voxel_tool**( )
- [void](#)<span id="i_save_modified_blocks"></span> **save_modified_blocks**( )
- [void](#)<span id="i_set_process_mode"></span> **set_process_mode**( [int](https://docs.godotengine.org/en/stable/classes/class_int.html) mode )
- [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html)<span id="i_voxel_to_block_position"></span> **voxel_to_block_position**( [Vector3](https://docs.godotengine.org/en/stable/classes/class_vector3.html) lod_index, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) arg1 )
_Generated on Jan 21, 2021_

View File

@ -0,0 +1,36 @@
# VoxelMesher
Inherits: [Resource](https://docs.godotengine.org/en/stable/classes/class_resource.html)
Base class for all meshing algorithms.
## Description:
In order to be rendered by Godot, voxels can be transformed into a mesh. There are various ways to do this, that's why this class is only a base for other, specialized ones. Voxel nodes automatically make use of meshers, but you can also produce meshes manually. For this, you may use one of the derived classes. Meshers can be re-used, which often yields better performance by reducing memory allocations.
## Methods:
Return | Signature
----------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------
[Mesh](https://docs.godotengine.org/en/stable/classes/class_mesh.html) | [build_mesh](#i_build_mesh) ( [VoxelBuffer](VoxelBuffer.md) voxel_buffer, [Array](https://docs.godotengine.org/en/stable/classes/class_array.html) materials )
[int](https://docs.godotengine.org/en/stable/classes/class_int.html) | [get_maximum_padding](#i_get_maximum_padding) ( ) const
[int](https://docs.godotengine.org/en/stable/classes/class_int.html) | [get_minimum_padding](#i_get_minimum_padding) ( ) const
<p></p>
## Method Descriptions
- [Mesh](https://docs.godotengine.org/en/stable/classes/class_mesh.html)<span id="i_build_mesh"></span> **build_mesh**( [VoxelBuffer](VoxelBuffer.md) voxel_buffer, [Array](https://docs.godotengine.org/en/stable/classes/class_array.html) materials )
Builds a mesh from the provided voxels. Materials will be attached to each surface based on the provided array. The way materials are used can depend on the type of mesher.
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_get_maximum_padding"></span> **get_maximum_padding**( )
Gets by how much voxels must be padded before their lower corner in order for the mesher to work.
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_get_minimum_padding"></span> **get_minimum_padding**( )
Gets by how much voxels must be padded after their upper corner in order for the mesher to work.
_Generated on Jan 21, 2021_

View File

@ -0,0 +1,33 @@
# VoxelMesherBlocky
Inherits: [VoxelMesher](VoxelMesher.md)
Produces a mesh by batching models corresponding to each voxel value, similar to games like Minecraft or StarMade.
## Description:
Occluded faces are removed from the result, and some degree of ambient occlusion can be baked on the edges. Values are expected to be in the constant VoxelBuffer.CHANNEL_TYPE channel. Models are defined with a [VoxelLibrary](VoxelLibrary.md), in which model indices correspond to the voxel values. Models don't have to be cubes.
## Properties:
Type | Name | Default
--------------- | -------------------------------------------- | --------
`VoxelLibrary` | [library](#i_library) |
`float` | [occlusion_darkness](#i_occlusion_darkness) | 0.8
`bool` | [occlusion_enabled](#i_occlusion_enabled) | true
<p></p>
## Property Descriptions
- [VoxelLibrary](VoxelLibrary.md)<span id="i_library"></span> **library**
- [float](https://docs.godotengine.org/en/stable/classes/class_float.html)<span id="i_occlusion_darkness"></span> **occlusion_darkness** = 0.8
- [bool](https://docs.godotengine.org/en/stable/classes/class_bool.html)<span id="i_occlusion_enabled"></span> **occlusion_enabled** = true
_Generated on Jan 21, 2021_

View File

@ -0,0 +1,44 @@
# VoxelMesherCubes
Inherits: [VoxelMesher](VoxelMesher.md)
## Properties:
Type | Name | Default
-------------------- | ---------------------------------------------------- | --------
`int` | [color_mode](#i_color_mode) | 0
`bool` | [greedy_meshing_enabled](#i_greedy_meshing_enabled) | true
`VoxelColorPalette` | [palette](#i_palette) |
<p></p>
## Enumerations:
enum **Materials**:
- **MATERIAL_OPAQUE** = **0**
- **MATERIAL_TRANSPARENT** = **1**
- **MATERIAL_COUNT** = **2**
enum **ColorMode**:
- **COLOR_RAW** = **0**
- **COLOR_MESHER_PALETTE** = **1**
- **COLOR_SHADER_PALETTE** = **2**
## Property Descriptions
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_color_mode"></span> **color_mode** = 0
- [bool](https://docs.godotengine.org/en/stable/classes/class_bool.html)<span id="i_greedy_meshing_enabled"></span> **greedy_meshing_enabled** = true
- [VoxelColorPalette](VoxelColorPalette.md)<span id="i_palette"></span> **palette**
_Generated on Jan 21, 2021_

View File

@ -0,0 +1,78 @@
# VoxelMesherDMC
Inherits: [VoxelMesher](VoxelMesher.md)
Implements isosurface generation (smooth voxels) using [url=https://www.volume-gfx.com/volume-rendering/dual-marching-cubes/](https://docs.godotengine.org/en/stable/classes/class_url=https://www.volume-gfx.com/volume-rendering/dual-marching-cubes/.html)Dual Marching Cubes[/url](https://docs.godotengine.org/en/stable/classes/class_/url.html).
## Properties:
Type | Name | Default
------ | -------------------------------------- | --------
`int` | [geometric_error](#i_geometric_error) | 0
`int` | [mesh_mode](#i_mesh_mode) | 0
`int` | [seam_mode](#i_seam_mode) | 0
`int` | [simplify_mode](#i_simplify_mode) | 0
<p></p>
## Methods:
Return | Signature
----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------
[float](https://docs.godotengine.org/en/stable/classes/class_float.html) | [get_geometric_error](#i_get_geometric_error) ( ) const
[Dictionary](https://docs.godotengine.org/en/stable/classes/class_dictionary.html) | [get_statistics](#i_get_statistics) ( ) const
[void](#) | [set_geometric_error](#i_set_geometric_error) ( [float](https://docs.godotengine.org/en/stable/classes/class_float.html) error )
<p></p>
## Enumerations:
enum **MeshMode**:
- **MESH_NORMAL** = **0**
- **MESH_WIREFRAME** = **1**
- **MESH_DEBUG_OCTREE** = **2**
- **MESH_DEBUG_DUAL_GRID** = **3**
enum **SimplifyMode**:
- **SIMPLIFY_OCTREE_BOTTOM_UP** = **0**
- **SIMPLIFY_OCTREE_TOP_DOWN** = **1**
- **SIMPLIFY_NONE** = **2**
enum **SeamMode**:
- **SEAM_NONE** = **0**
- **SEAM_MARCHING_SQUARE_SKIRTS** = **1**
## Property Descriptions
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_geometric_error"></span> **geometric_error** = 0
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_mesh_mode"></span> **mesh_mode** = 0
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_seam_mode"></span> **seam_mode** = 0
- [int](https://docs.godotengine.org/en/stable/classes/class_int.html)<span id="i_simplify_mode"></span> **simplify_mode** = 0
## Method Descriptions
- [float](https://docs.godotengine.org/en/stable/classes/class_float.html)<span id="i_get_geometric_error"></span> **get_geometric_error**( )
- [Dictionary](https://docs.godotengine.org/en/stable/classes/class_dictionary.html)<span id="i_get_statistics"></span> **get_statistics**( )
- [void](#)<span id="i_set_geometric_error"></span> **set_geometric_error**( [float](https://docs.godotengine.org/en/stable/classes/class_float.html) error )
_Generated on Jan 21, 2021_

View File

@ -0,0 +1,22 @@
# VoxelMesherTransvoxel
Inherits: [VoxelMesher](VoxelMesher.md)
Implements isosurface generation (smooth voxels) using the [url=https://transvoxel.org/](https://docs.godotengine.org/en/stable/classes/class_url=https://transvoxel.org/.html)Transvoxel[/url](https://docs.godotengine.org/en/stable/classes/class_/url.html) algorithm.
## Methods:
Return | Signature
--------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[ArrayMesh](https://docs.godotengine.org/en/stable/classes/class_arraymesh.html) | [build_transition_mesh](#i_build_transition_mesh) ( [VoxelBuffer](VoxelBuffer.md) voxel_buffer, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) direction )
<p></p>
## Method Descriptions
- [ArrayMesh](https://docs.godotengine.org/en/stable/classes/class_arraymesh.html)<span id="i_build_transition_mesh"></span> **build_transition_mesh**( [VoxelBuffer](VoxelBuffer.md) voxel_buffer, [int](https://docs.godotengine.org/en/stable/classes/class_int.html) direction )
_Generated on Jan 21, 2021_

View File

@ -0,0 +1,29 @@
# VoxelNode
Inherits: [Spatial](https://docs.godotengine.org/en/stable/classes/class_spatial.html)
Base class for voxel volumes.
## Properties:
Type | Name | Default
----------------- | -------------------------- | --------
`VoxelGenerator` | [generator](#i_generator) |
`VoxelMesher` | [mesher](#i_mesher) |
`VoxelStream` | [stream](#i_stream) |
<p></p>
## 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 21, 2021_

View File

@ -0,0 +1,25 @@
# VoxelRaycastResult
Inherits: [Reference](https://docs.godotengine.org/en/stable/classes/class_reference.html)
Result of a raycast performed with method VoxelTool.raycast
## Properties:
Type | Name | Default
---------- | ------------------------------------------ | -------------------
`Vector3` | [position](#i_position) | Vector3( 0, 0, 0 )
`Vector3` | [previous_position](#i_previous_position) | Vector3( 0, 0, 0 )
<p></p>
## 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 21, 2021_

Some files were not shown because too many files have changed in this diff Show More