diff --git a/README.md b/README.md index 357b8408..cd1b8987 100644 --- a/README.md +++ b/README.md @@ -11,11 +11,11 @@ Features --------------------------- - Realtime editable, 3D based terrain (Unlike a heightmap based terrain, this allows for overhangs, tunnels, and user creation/destruction) -- Full collision support +- Physics based collision and raycast support - Infinite terrains made by paging sections in and out -- Voxel data is streamed from a variety of sources, which includes the ability to write your own +- Voxel data is streamed from a variety of sources, which includes the ability to write your own generators - Minecraft-style blocky voxel terrain, with multiple materials and baked ambient occlusion -- Smooth terrain using Dual Marching Cubes +- Smooth terrain using Transvoxel - Levels of detail for smooth terrain - Voxel storage using 8-bit channels for any general purpose @@ -32,7 +32,7 @@ What This Module Doesn't Provide How To Install And Use ------------------------- -Voxel Tools is a custom C++ module for Godot 3.1+. It must be compiled into the engine to work. +Voxel Tools is a custom C++ module for Godot 3.1+. It must be compiled into the engine to work. [Prebuilt binaries](http://tokisan.com/godot-binaries) are available. Please see the [Getting Started Guide](doc/01_get-started.md) for instructions, or [Zylann's demos](https://github.com/Zylann/voxelgame) and [TinmanJuggernaut's demo](https://github.com/tinmanjuggernaut/voxelgame) for working examples. @@ -44,5 +44,5 @@ These are some ideas that may or may not be implemented in the future: * LOD (in development) * Support general voxel use (not just terrains) -* Transvoxel and other meshing algorithms +* Other meshing algorithms (e.g. dual contouring) * GPU Offloading (Maybe when Godot 4+ supports compute shaders) diff --git a/config.py b/config.py index 197710e3..103a1dfa 100644 --- a/config.py +++ b/config.py @@ -1,5 +1,4 @@ - def can_build(env, platform): return True @@ -20,21 +19,27 @@ def get_doc_classes(): "VoxelLodTerrain", "VoxelStream", - "VoxelStreamTest", - "VoxelStreamImage", - "VoxelStreamNoise", "VoxelStreamFile", "VoxelStreamBlockFiles", "VoxelStreamRegionFiles", + "VoxelGenerator", + "VoxelGeneratorHeightmap", + "VoxelGeneratorImage", + "VoxelGeneratorNoise", + "VoxelGeneratorNoise2D", + "VoxelGeneratorTest", + "VoxelBoxMover", - "VoxelIsoSurfaceTool", + "VoxelTool", + "VoxelRaycastResult", "VoxelMesher", "VoxelMesherBlocky", "VoxelMesherTransvoxel", "VoxelMesherDMC" - ] + + ] def get_doc_path(): diff --git a/doc/01_get-started.md b/doc/01_get-started.md index 9c772af4..df8b736b 100644 --- a/doc/01_get-started.md +++ b/doc/01_get-started.md @@ -2,6 +2,8 @@ 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) diff --git a/doc/02_build-voxel-tools.md b/doc/02_build-voxel-tools.md index 2fe7959c..8cf8c37a 100644 --- a/doc/02_build-voxel-tools.md +++ b/doc/02_build-voxel-tools.md @@ -4,7 +4,7 @@ These steps will walk you through creating a custom build of Godot with the Voxe ## 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. Generally you want the master branch to match with the master branch of Voxel Tools. However as of Godot 3.1, a stable branch is being maintained. +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). @@ -12,8 +12,8 @@ These steps will walk you through creating a custom build of Godot with the Voxe ## 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. Generally you want the master branch to get the latest features and fixes. If you desired, you can use the branch that corresponds with Godot's stable branch (e.g. godot3.1). -1. Place the Voxel Tools directory inside your Godot source, in the `godot/modules` directory. +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: @@ -31,7 +31,7 @@ If you cloned Godot and Voxel Tools, you can use git to update your local code. 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. +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. --- diff --git a/doc/03_create-terrain.md b/doc/03_create-terrain.md index c9a655cc..66e74256 100644 --- a/doc/03_create-terrain.md +++ b/doc/03_create-terrain.md @@ -2,17 +2,21 @@ # 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 VoxelStreamImage. Then click VoxelStreamImage again. - 1. Image: Load. Select your imported noise texture. - 1. Decide on the type of terrain you want: - * Blocky: Set Channel = "Type" (or 0), and leave Smooth Meshing Enabled unchecked (lower down). - * Smooth: Set Channel = "SDF" (or 1), and enable Smooth Meshing Enabled. - 1. Voxel Library: add a New VoxelLibrary + 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. @@ -22,7 +26,7 @@ Now that your Godot Engine has voxel support built in, you can either download o ## Create A Terrain In The Editor: VoxelLODTerrain + 3D Noise -Here we'll look at `VoxelLODTerrain` with a noise data stream. +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: @@ -30,7 +34,7 @@ Here we'll look at `VoxelLODTerrain` with a noise data stream. 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 VoxelStreamNoise. Then click VoxelStreamNoise again. + 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. @@ -70,14 +74,14 @@ const HEIGHT_MAP = preload("res://blocky_terrain/noise_distorted.png") var terrain = VoxelTerrain.new() func _ready(): - terrain.voxel_library = VoxelLibrary.new() - terrain.stream = VoxelStreamImage.new() + 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) diff --git a/doc/04_materials.md b/doc/04_materials.md index 5f0cd576..5a94a289 100644 --- a/doc/04_materials.md +++ b/doc/04_materials.md @@ -6,24 +6,24 @@ Here are some notes for better results. ## Recommended Reading -* [SpatialMatieral](https://docs.godotengine.org/en/3.1/tutorials/3d/spatial_material.html) - demonstrates many of the shader options available in Godot. -* [Shading Index](https://docs.godotengine.org/en/3.1/tutorials/shading/index.html) - tutorials and the shader language API +* [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/3.1/tutorials/shading/shading_reference/shading_language.html) - * [SpatialShader](https://docs.godotengine.org/en/3.1/tutorials/shading/shading_reference/spatial_shader.html) + * [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 onto only part of object that faces the X-axis directly. Then projecting it on the sides that face the Y-axis directly. Then again for the Z-axis. The edges of these projections are then blended together with a specified sharpness. +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/3.1/tutorials/3d/spatial_material.html?highlight=triplanar%20#triplanar-mapping). +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. @@ -35,18 +35,23 @@ Rather than writing your own shader from scratch, especially with triplanar mapp 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 the curves of the terrain in the distance. Otherwise you'll just see an undifferentiated mass of color. +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. + -## How To View Live Changes To Materials -You can't see the terrain in the viewport, so there are two options to view your material live while making changes: +## 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.) +* 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 @@ -60,6 +65,7 @@ Your material now has shader code that produces the same material your SpatialMa 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. diff --git a/doc/05_collision.md b/doc/05_collision.md index 9bc597ab..cb565d1d 100644 --- a/doc/05_collision.md +++ b/doc/05_collision.md @@ -4,7 +4,7 @@ Physics based collision is enabled by default. It provides both raycasting and c 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 the setting unless they are regenerated. +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 diff --git a/doc/06_custom-streams.md b/doc/06_custom-generator.md similarity index 55% rename from doc/06_custom-streams.md rename to doc/06_custom-generator.md index cef60a27..c7633dfa 100644 --- a/doc/06_custom-streams.md +++ b/doc/06_custom-generator.md @@ -1,17 +1,22 @@ -# Create Your Own Voxel Data Stream -You can provide your own stream of voxel data by extending VoxelStream either in GDScript or C++. +# Generate Your Own Voxel Data +You can provide your own voxel generator by extending VoxelGenerator in either GDScript or C++. -Note: Your stream must be thread safe. +Note: Your generator must be thread safe. Create MyStream.gd with the following contents: ``` -extends VoxelStream - -func emerge_block(buffer:VoxelBuffer, origin:Vector3, lod:int) -> void: +extends VoxelGenerator + +export var channel:int = VoxelBuffer.CHANNEL_TYPE + +func get_used_channels_mask () -> int: + return 1< void: if lod != 0: return - if origin.y < 0: buffer.fill(1, 0) - if origin.x==origin.z and origin.y < 1: buffer.fill(1,0) + 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: @@ -22,7 +27,6 @@ var terrain = VoxelTerrain.new() func _ready(): terrain.stream = MyStream.new() - terrain.voxel_library = VoxelLibrary.new() terrain.view_distance = 256 terrain.viewer_path = "/root/Spatial/Player" # Set this path to your player/camera add_child(terrain) @@ -30,7 +34,7 @@ func _ready(): -Though `VoxelBuffer.fill()` is probably not what you want to use, the above is a quick example. Emerge_block generally gives you a block of 16x16x16 cubes to fill all at once, so you probably want to use `VoxelBuffer.set_voxel()` to specify each one. +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](../streams/voxel_stream_test.cpp), which runs a lot faster. diff --git a/doc/07_performance-tips.md b/doc/07_performance-tips.md index 8cf3e844..e74632ba 100644 --- a/doc/07_performance-tips.md +++ b/doc/07_performance-tips.md @@ -4,11 +4,15 @@ * 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. I might use 200-400 on a GTX1060, but maybe 20 or disabled on an integrated card. +* 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. --- diff --git a/doc/08_api-overview.md b/doc/08_api-overview.md index 287cf44f..8dd76aca 100644 --- a/doc/08_api-overview.md +++ b/doc/08_api-overview.md @@ -38,7 +38,7 @@ Note that the engine and your graphics card do not work with voxels. They are co **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 (WIP) and is structured to support other algorithms in the future. Some are faster, use less memory, provide manifold meshes (cleaner meshes), and/or provide more accurate representations of the voxel data. +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. @@ -57,7 +57,7 @@ Note: Terrains use their VoxelStream and VoxelMeshers from multiple threads. Acc ### 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 VoxelStream (e.g. noise image, 3D noise texture, etc). +* 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. @@ -67,7 +67,7 @@ An infinite, paged terrain made of voxel blocks, all with the same level of deta ### 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 VoxelStream, which must support LOD. +* 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. @@ -79,29 +79,26 @@ An infinite, paged terrain made of voxel blocks with a variable level of detail. These classes provide the source voxel data. -### VoxelStream +### 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 stream 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. +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. -### VoxelStreamTest -Provides a flat plane or 2D sine waves. +### VoxelGeneratorTest +Provides a flat plane or sine waves. -* Blocky only. - -### VoxelStreamImage +### 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. -* Blocky or smooth. +### VoxelGeneratorNoise +Generates 3D noise via a noise algorithm. -### VoxelStreamNoise -Generates 3D noise via OpenSimplexNoise. - -* Smooth only. +### VoxelGeneratorNoise2D +Generates a terrain from a 2D noise heightmap. ## Mesher Classes @@ -111,7 +108,7 @@ These classes use full cubes or an isosurface extraction algorithm to represent 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 VoxelStream, this class cannot be implemented with a script. You must extend it with a C++ class to implement another meshing algorithm. +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. @@ -132,9 +129,7 @@ Builds a smooth mesh using the Dual Marching Cubes algorithm. ### VoxelMesherTransvoxel Builds a smooth mesh using the Transvoxel algorithm. -* Development is on hold for now. Use DMC. -* Partial implementation, which may or may not be broken. - +* This is now the default smooth mesher. ## Storage Classes @@ -150,7 +145,7 @@ Where Terrains store their voxels, as an infinite, 3D, sparse grid. It can be th 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 (Unregistered) +### 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. @@ -167,26 +162,26 @@ The underlying storage for voxels. Also used to pass voxels between functions. ## Supporting Classes -### VoxelIsoSurfaceTool -Provides functions to add or remove smooth terrain. Currently supported shapes are sphere, plane, cube, heightmap. +### 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 VoxelStream. +* 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 images, a custom shape could be added using an existing VoxelBuffer as input. This is not yet implemented. +* 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 -Provides Axis Aligned Bounding Box based collision. (blocky only) +### VoxelBoxMover (blocky) +Provides Axis Aligned Bounding Box based collision. -### Voxel -A basic voxel unit. Creating Voxels with VoxelLibrary is recommended. (blocky only) +### Voxel (blocky) +A basic voxel unit. Creating Voxels with VoxelLibrary is recommended. * Stores ID, name, material, transparency and type -### VoxelLibrary -A factory for creating Voxels. (blocky only) +### 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) diff --git a/doc/api/Class_List.md b/doc/api/Class_List.md index 23bbcbd3..73f305e3 100644 --- a/doc/api/Class_List.md +++ b/doc/api/Class_List.md @@ -5,7 +5,12 @@ These classes are exposed to GDScript. This information is also available within * [Voxel.md](Voxel.md) * [VoxelBoxMover.md](VoxelBoxMover.md) * [VoxelBuffer.md](VoxelBuffer.md) -* [VoxelIsoSurfaceTool.md](VoxelIsoSurfaceTool.md) +* [VoxelGenerator.md](VoxelGenerator.md) +* [VoxelGeneratorHeightmap.md](VoxelGeneratorHeightmap.md) +* [VoxelGeneratorImage.md](VoxelGeneratorImage.md) +* [VoxelGeneratorNoise.md](VoxelGeneratorNoise.md) +* [VoxelGeneratorNoise2D.md](VoxelGeneratorNoise2D.md) +* [VoxelGeneratorTest.md](VoxelGeneratorTest.md) * [VoxelLibrary.md](VoxelLibrary.md) * [VoxelLodTerrain.md](VoxelLodTerrain.md) * [VoxelMap.md](VoxelMap.md) @@ -13,15 +18,14 @@ These classes are exposed to GDScript. This information is also available within * [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) -* [VoxelStreamImage.md](VoxelStreamImage.md) -* [VoxelStreamNoise.md](VoxelStreamNoise.md) * [VoxelStreamRegionFiles.md](VoxelStreamRegionFiles.md) -* [VoxelStreamTest.md](VoxelStreamTest.md) * [VoxelTerrain.md](VoxelTerrain.md) +* [VoxelTool.md](VoxelTool.md) --- * [Doc Index](../01_get-started.md) -_Generated on Aug 26, 2019_ +_Generated on Feb 16, 2020_ diff --git a/doc/api/Voxel.md b/doc/api/Voxel.md index 3c6b19eb..990660c3 100644 --- a/doc/api/Voxel.md +++ b/doc/api/Voxel.md @@ -2,7 +2,7 @@ Inherits: Resource -_Godot version: 3.2_ +_Godot version: 3.2.1_ ## Online Tutorials: @@ -11,56 +11,47 @@ _Godot version: 3.2_ ## Constants: -#### » GeometryType.GEOMETRY_NONE = 0 +#### » GeometryType.GEOMETRY_NONE = 0 -#### » GeometryType.GEOMETRY_CUBE = 1 +#### » GeometryType.GEOMETRY_CUBE = 1 -#### » GeometryType.GEOMETRY_MAX = 2 - - -#### » ChannelMode.CHANNEL_TYPE = 0 - - -#### » ChannelMode.CHANNEL_ISOLEVEL = 1 - - -#### » ChannelMode.CHANNEL_DATA = 2 +#### » GeometryType.GEOMETRY_MAX = 2 ## Properties: -#### » Color color +#### » Color color `set_color (value)` setter `get_color ()` getter -#### » int Voxel.GeometryType.geometry_type +#### » int Voxel.GeometryType.geometry_type `set_geometry_type (value)` setter `get_geometry_type ()` getter -#### » int material_id +#### » int material_id `set_material_id (value)` setter `get_material_id ()` getter -#### » bool transparent +#### » bool transparent `set_transparent (value)` setter `is_transparent ()` getter -#### » String voxel_name +#### » String voxel_name `set_voxel_name (value)` setter @@ -70,22 +61,22 @@ _Godot version: 3.2_ ## Methods: -#### » int get_id ( ) const +#### » int get_id ( ) const -#### » Voxel set_color ( Color color ) +#### » Voxel set_color ( Color color ) -#### » Voxel set_id ( int id ) +#### » Voxel set_id ( int id ) -#### » Voxel set_material_id ( int id ) +#### » Voxel set_material_id ( int id ) -#### » Voxel set_transparent ( bool transparent=true ) +#### » Voxel set_transparent ( bool transparent=true ) -#### » Voxel set_voxel_name ( String name ) +#### » Voxel set_voxel_name ( String name ) @@ -96,4 +87,4 @@ _Godot version: 3.2_ * [Class List](Class_List.md) * [Doc Index](../01_get-started.md) -_Generated on Aug 26, 2019_ +_Generated on Feb 16, 2020_ diff --git a/doc/api/VoxelBoxMover.md b/doc/api/VoxelBoxMover.md index bbf7c004..b3b308e8 100644 --- a/doc/api/VoxelBoxMover.md +++ b/doc/api/VoxelBoxMover.md @@ -2,7 +2,7 @@ Inherits: Reference -_Godot version: 3.2_ +_Godot version: 3.2.1_ ## Online Tutorials: @@ -17,7 +17,7 @@ _Godot version: 3.2_ ## Methods: -#### » Vector3 get_motion ( Vector3 pos, Vector3 motion, AABB aabb, Node terrain ) +#### » Vector3 get_motion ( Vector3 pos, Vector3 motion, AABB aabb, Node terrain ) @@ -28,4 +28,4 @@ _Godot version: 3.2_ * [Class List](Class_List.md) * [Doc Index](../01_get-started.md) -_Generated on Aug 26, 2019_ +_Generated on Feb 16, 2020_ diff --git a/doc/api/VoxelBuffer.md b/doc/api/VoxelBuffer.md index 7423991d..53b50154 100644 --- a/doc/api/VoxelBuffer.md +++ b/doc/api/VoxelBuffer.md @@ -2,7 +2,7 @@ Inherits: Reference -_Godot version: 3.2_ +_Godot version: 3.2.1_ ## Online Tutorials: @@ -11,31 +11,46 @@ _Godot version: 3.2_ ## Constants: -#### » ChannelId.CHANNEL_TYPE = 0 +#### » ChannelId.CHANNEL_TYPE = 0 -#### » ChannelId.CHANNEL_ISOLEVEL = 1 +#### » ChannelId.CHANNEL_SDF = 1 -#### » ChannelId.CHANNEL_DATA2 = 2 +#### » ChannelId.CHANNEL_DATA2 = 2 -#### » ChannelId.CHANNEL_DATA3 = 3 +#### » ChannelId.CHANNEL_DATA3 = 3 -#### » ChannelId.CHANNEL_DATA4 = 4 +#### » ChannelId.CHANNEL_DATA4 = 4 -#### » ChannelId.CHANNEL_DATA5 = 5 +#### » ChannelId.CHANNEL_DATA5 = 5 -#### » ChannelId.CHANNEL_DATA6 = 6 +#### » ChannelId.CHANNEL_DATA6 = 6 -#### » ChannelId.CHANNEL_DATA7 = 7 +#### » ChannelId.CHANNEL_DATA7 = 7 -#### » ChannelId.MAX_CHANNELS = 8 +#### » 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 @@ -44,58 +59,70 @@ _Godot version: 3.2_ ## Methods: -#### » void clear ( ) +#### » void clear ( ) -#### » void copy_from ( VoxelBuffer other, int channel=0 ) +#### » void copy_channel_from ( VoxelBuffer other, int channel ) -#### » void copy_from_area ( VoxelBuffer other, Vector3 src_min, Vector3 src_max, Vector3 dst_min, int channel=0 ) +#### » void copy_channel_from_area ( VoxelBuffer other, Vector3 src_min, Vector3 src_max, Vector3 dst_min, int channel ) -#### » void create ( int sx, int sy, int sz ) +#### » void create ( int sx, int sy, int sz ) -#### » void fill ( int value, int channel=0 ) +#### » void downscale_to ( VoxelBuffer dst, Vector3 src_min, Vector3 src_max, Vector3 dst_min ) const -#### » void fill_area ( int value, Vector3 min, Vector3 max, int channel=0 ) +#### » void fill ( int value, int channel=0 ) -#### » void fill_f ( float value, int channel=0 ) +#### » void fill_area ( int value, Vector3 min, Vector3 max, int channel=0 ) -#### » Vector3 get_size ( ) const +#### » void fill_f ( float value, int channel=0 ) -#### » int get_size_x ( ) const +#### » int get_channel_depth ( int channel ) const -#### » int get_size_y ( ) const +#### » Vector3 get_size ( ) const -#### » int get_size_z ( ) const +#### » int get_size_x ( ) const -#### » int get_voxel ( int x, int y, int z, int channel=0 ) const +#### » int get_size_y ( ) const -#### » float get_voxel_f ( int x, int y, int z, int channel=0 ) const +#### » int get_size_z ( ) const -#### » bool is_uniform ( int channel ) const +#### » int get_voxel ( int x, int y, int z, int channel=0 ) const -#### » void optimize ( ) +#### » float get_voxel_f ( int x, int y, int z, int channel=0 ) const -#### » void set_voxel ( int value, int x, int y, int z, int channel=0 ) +#### » VoxelTool get_voxel_tool ( ) -#### » void set_voxel_f ( float value, int x, int y, int z, int channel=0 ) +#### » bool is_uniform ( int channel ) const -#### » void set_voxel_v ( int value, Vector3 pos, int channel=0 ) +#### » void optimize ( ) + + +#### » 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_v ( int value, Vector3 pos, int channel=0 ) @@ -106,4 +133,4 @@ _Godot version: 3.2_ * [Class List](Class_List.md) * [Doc Index](../01_get-started.md) -_Generated on Aug 26, 2019_ +_Generated on Feb 16, 2020_ diff --git a/doc/api/VoxelGenerator.md b/doc/api/VoxelGenerator.md new file mode 100644 index 00000000..0666e3a7 --- /dev/null +++ b/doc/api/VoxelGenerator.md @@ -0,0 +1,31 @@ +# Class: VoxelGenerator + +Inherits: VoxelStream + +_Godot version: 3.2.1_ + + +## 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 Feb 16, 2020_ diff --git a/doc/api/VoxelGeneratorHeightmap.md b/doc/api/VoxelGeneratorHeightmap.md new file mode 100644 index 00000000..c2ba5554 --- /dev/null +++ b/doc/api/VoxelGeneratorHeightmap.md @@ -0,0 +1,55 @@ +# Class: VoxelGeneratorHeightmap + +Inherits: VoxelGenerator + +_Godot version: 3.2.1_ + + +## Online Tutorials: + + + +## Constants: + + +## Properties: + +#### » 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: + +#### » int get_channel ( ) const + + +#### » void set_channel ( int channel ) + + + +## Signals: + + +--- +* [Class List](Class_List.md) +* [Doc Index](../01_get-started.md) + +_Generated on Feb 16, 2020_ diff --git a/doc/api/VoxelStreamImage.md b/doc/api/VoxelGeneratorImage.md similarity index 50% rename from doc/api/VoxelStreamImage.md rename to doc/api/VoxelGeneratorImage.md index 98b6cc96..64d53b69 100644 --- a/doc/api/VoxelStreamImage.md +++ b/doc/api/VoxelGeneratorImage.md @@ -1,8 +1,8 @@ -# Class: VoxelStreamImage +# Class: VoxelGeneratorImage -Inherits: VoxelStream +Inherits: VoxelGeneratorHeightmap -_Godot version: 3.2_ +_Godot version: 3.2.1_ ## Online Tutorials: @@ -14,14 +14,21 @@ _Godot version: 3.2_ ## Properties: -#### » int VoxelBuffer.ChannelId.channel +#### » bool blur_enabled + +`set_blur_enabled (value)` setter + +`is_blur_enabled ()` getter + + +#### » int VoxelBuffer.ChannelId.channel `set_channel (value)` setter `get_channel ()` getter -#### » Image image +#### » Image image `set_image (value)` setter @@ -39,4 +46,4 @@ _Godot version: 3.2_ * [Class List](Class_List.md) * [Doc Index](../01_get-started.md) -_Generated on Aug 26, 2019_ +_Generated on Feb 16, 2020_ diff --git a/doc/api/VoxelStreamNoise.md b/doc/api/VoxelGeneratorNoise.md similarity index 54% rename from doc/api/VoxelStreamNoise.md rename to doc/api/VoxelGeneratorNoise.md index 7389817a..c6b372cd 100644 --- a/doc/api/VoxelStreamNoise.md +++ b/doc/api/VoxelGeneratorNoise.md @@ -1,8 +1,8 @@ -# Class: VoxelStreamNoise +# Class: VoxelGeneratorNoise -Inherits: VoxelStream +Inherits: VoxelGenerator -_Godot version: 3.2_ +_Godot version: 3.2.1_ ## Online Tutorials: @@ -14,21 +14,28 @@ _Godot version: 3.2_ ## Properties: -#### » float height_range +#### » 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 +#### » float height_start `set_height_start (value)` setter `get_height_start ()` getter -#### » OpenSimplexNoise noise +#### » OpenSimplexNoise noise `set_noise (value)` setter @@ -46,4 +53,4 @@ _Godot version: 3.2_ * [Class List](Class_List.md) * [Doc Index](../01_get-started.md) -_Generated on Aug 26, 2019_ +_Generated on Feb 16, 2020_ diff --git a/doc/api/VoxelGeneratorNoise2D.md b/doc/api/VoxelGeneratorNoise2D.md new file mode 100644 index 00000000..5b79018b --- /dev/null +++ b/doc/api/VoxelGeneratorNoise2D.md @@ -0,0 +1,49 @@ +# Class: VoxelGeneratorNoise2D + +Inherits: VoxelGeneratorHeightmap + +_Godot version: 3.2.1_ + + +## Online Tutorials: + + + +## Constants: + + +## Properties: + +#### » int VoxelBuffer.ChannelId.channel + +`set_channel (value)` setter + +`get_channel ()` getter + + +#### » 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 Feb 16, 2020_ diff --git a/doc/api/VoxelStreamTest.md b/doc/api/VoxelGeneratorTest.md similarity index 52% rename from doc/api/VoxelStreamTest.md rename to doc/api/VoxelGeneratorTest.md index 0b1dd730..7d3c09e4 100644 --- a/doc/api/VoxelStreamTest.md +++ b/doc/api/VoxelGeneratorTest.md @@ -1,8 +1,8 @@ -# Class: VoxelStreamTest +# Class: VoxelGeneratorTest -Inherits: VoxelStream +Inherits: VoxelGenerator -_Godot version: 3.2_ +_Godot version: 3.2.1_ ## Online Tutorials: @@ -11,37 +11,44 @@ _Godot version: 3.2_ ## Constants: -#### » Mode.MODE_FLAT = 0 +#### » Mode.MODE_FLAT = 0 -#### » Mode.MODE_WAVES = 1 +#### » Mode.MODE_WAVES = 1 ## Properties: -#### » int VoxelStreamTest.Mode.mode +#### » int VoxelBuffer.ChannelId.channel + +`set_channel (value)` setter + +`get_channel ()` getter + + +#### » int VoxelGeneratorTest.Mode.mode `set_mode (value)` setter `get_mode ()` getter -#### » Vector3 pattern_offset +#### » Vector3 pattern_offset `set_pattern_offset (value)` setter `get_pattern_offset ()` getter -#### » Vector3 pattern_size +#### » Vector3 pattern_size `set_pattern_size (value)` setter `get_pattern_size ()` getter -#### » int voxel_type +#### » int voxel_type `set_voxel_type (value)` setter @@ -59,4 +66,4 @@ _Godot version: 3.2_ * [Class List](Class_List.md) * [Doc Index](../01_get-started.md) -_Generated on Aug 26, 2019_ +_Generated on Feb 16, 2020_ diff --git a/doc/api/VoxelIsoSurfaceTool.md b/doc/api/VoxelIsoSurfaceTool.md deleted file mode 100644 index 91eee894..00000000 --- a/doc/api/VoxelIsoSurfaceTool.md +++ /dev/null @@ -1,67 +0,0 @@ -# Class: VoxelIsoSurfaceTool - -Inherits: Reference - -_Godot version: 3.2_ - - -## Online Tutorials: - - - -## Constants: - -#### » Operation.OP_ADD = 0 - - -#### » Operation.OP_SUBTRACT = 1 - - -#### » Operation.OP_SET = 2 - - - -## Properties: - - -## Methods: - -#### » void do_cube ( Transform transform, Vector3 extents, int op=0 ) - - -#### » void do_heightmap ( Image heightmap, Vector3 offset, float vertical_scale, int op=0 ) - - -#### » void do_plane ( Plane plane, int op=0 ) - - -#### » void do_sphere ( Vector3 center, float radius, int op=0 ) - - -#### » VoxelBuffer get_buffer ( ) const - - -#### » float get_iso_scale ( ) const - - -#### » Vector3 get_offset ( ) const - - -#### » void set_buffer ( VoxelBuffer voxel_buffer ) - - -#### » void set_iso_scale ( float iso_scale ) - - -#### » void set_offset ( Vector3 offset ) - - - -## Signals: - - ---- -* [Class List](Class_List.md) -* [Doc Index](../01_get-started.md) - -_Generated on Aug 26, 2019_ diff --git a/doc/api/VoxelLibrary.md b/doc/api/VoxelLibrary.md index 7d719951..613f8f1d 100644 --- a/doc/api/VoxelLibrary.md +++ b/doc/api/VoxelLibrary.md @@ -2,7 +2,7 @@ Inherits: Resource -_Godot version: 3.2_ +_Godot version: 3.2.1_ ## Online Tutorials: @@ -11,23 +11,33 @@ _Godot version: 3.2_ ## Constants: +#### » MAX_VOXEL_TYPES = 65536 + + ## Properties: -#### » int atlas_size +#### » 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: -#### » Voxel create_voxel ( int id, String name ) +#### » Voxel create_voxel ( int id, String name ) -#### » Voxel get_voxel ( int id ) +#### » Voxel get_voxel ( int id ) @@ -38,4 +48,4 @@ _Godot version: 3.2_ * [Class List](Class_List.md) * [Doc Index](../01_get-started.md) -_Generated on Aug 26, 2019_ +_Generated on Feb 16, 2020_ diff --git a/doc/api/VoxelLodTerrain.md b/doc/api/VoxelLodTerrain.md index 477fe021..268491f2 100644 --- a/doc/api/VoxelLodTerrain.md +++ b/doc/api/VoxelLodTerrain.md @@ -2,7 +2,7 @@ Inherits: Spatial -_Godot version: 3.2_ +_Godot version: 3.2.1_ ## Online Tutorials: @@ -14,56 +14,56 @@ _Godot version: 3.2_ ## Properties: -#### » int collision_lod_count +#### » int collision_lod_count `set_collision_lod_count (value)` setter `get_collision_lod_count ()` getter -#### » bool generate_collisions +#### » bool generate_collisions `set_generate_collisions (value)` setter `get_generate_collisions ()` getter -#### » int lod_count +#### » int lod_count `set_lod_count (value)` setter `get_lod_count ()` getter -#### » float lod_split_scale +#### » float lod_split_scale `set_lod_split_scale (value)` setter `get_lod_split_scale ()` getter -#### » Material material +#### » Material material `set_material (value)` setter `get_material ()` getter -#### » VoxelStream stream +#### » VoxelStream stream `set_stream (value)` setter `get_stream ()` getter -#### » int view_distance +#### » int view_distance `set_view_distance (value)` setter `get_view_distance ()` getter -#### » NodePath viewer_path +#### » NodePath viewer_path `set_viewer_path (value)` setter @@ -73,16 +73,34 @@ _Godot version: 3.2_ ## Methods: -#### » Dictionary get_block_info ( Vector3 block_pos, int lod ) const +#### » Dictionary debug_get_block_info ( Vector3 block_pos, int lod ) const -#### » int get_block_region_extent ( ) const +#### » Array debug_get_octrees ( ) const -#### » Dictionary get_statistics ( ) const +#### » Array debug_print_sdf_top_down ( Vector3 center, Vector3 extents ) const -#### » Vector3 voxel_to_block_position ( Vector3 lod_index, int arg1 ) const +#### » Array debug_raycast_block ( Vector3 origin, Vector3 dir ) const + + +#### » void debug_save_all_modified_blocks ( ) + + +#### » int get_block_region_extent ( ) const + + +#### » int get_block_size ( ) const + + +#### » Dictionary get_statistics ( ) const + + +#### » VoxelTool get_voxel_tool ( ) + + +#### » Vector3 voxel_to_block_position ( Vector3 lod_index, int arg1 ) const @@ -93,4 +111,4 @@ _Godot version: 3.2_ * [Class List](Class_List.md) * [Doc Index](../01_get-started.md) -_Generated on Aug 26, 2019_ +_Generated on Feb 16, 2020_ diff --git a/doc/api/VoxelMap.md b/doc/api/VoxelMap.md index b794f72a..59555042 100644 --- a/doc/api/VoxelMap.md +++ b/doc/api/VoxelMap.md @@ -2,7 +2,7 @@ Inherits: Reference -_Godot version: 3.2_ +_Godot version: 3.2.1_ ## Online Tutorials: @@ -17,46 +17,46 @@ _Godot version: 3.2_ ## Methods: -#### » Vector3 block_to_voxel ( Vector3 block_pos ) const +#### » Vector3 block_to_voxel ( Vector3 block_pos ) const -#### » int get_block_size ( ) const +#### » int get_block_size ( ) const -#### » void get_buffer_copy ( Vector3 min_pos, VoxelBuffer out_buffer, int channel=0 ) +#### » void get_buffer_copy ( Vector3 min_pos, VoxelBuffer out_buffer, int channel=0 ) -#### » int get_default_voxel ( int channel=0 ) +#### » int get_default_voxel ( int channel=0 ) -#### » int get_voxel ( int x, int y, int z, int c=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 ) +#### » float get_voxel_f ( int x, int y, int z, int c=1 ) -#### » int get_voxel_v ( Vector3 pos, int c=0 ) +#### » int get_voxel_v ( Vector3 pos, int c=0 ) -#### » bool has_block ( int x, int y, int z ) +#### » bool has_block ( int x, int y, int z ) -#### » void set_block_buffer ( Vector3 block_pos, VoxelBuffer buffer ) +#### » void set_block_buffer ( Vector3 block_pos, VoxelBuffer buffer ) -#### » void set_default_voxel ( int value, int channel=0 ) +#### » 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 ( 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_f ( float value, int x, int y, int z, int c=1 ) -#### » void set_voxel_v ( int value, Vector3 pos, int c=0 ) +#### » void set_voxel_v ( int value, Vector3 pos, int c=0 ) -#### » Vector3 voxel_to_block ( Vector3 voxel_pos ) const +#### » Vector3 voxel_to_block ( Vector3 voxel_pos ) const @@ -67,4 +67,4 @@ _Godot version: 3.2_ * [Class List](Class_List.md) * [Doc Index](../01_get-started.md) -_Generated on Aug 26, 2019_ +_Generated on Feb 16, 2020_ diff --git a/doc/api/VoxelMesher.md b/doc/api/VoxelMesher.md index 3e7a54cc..183348ba 100644 --- a/doc/api/VoxelMesher.md +++ b/doc/api/VoxelMesher.md @@ -2,7 +2,7 @@ Inherits: Reference -_Godot version: 3.2_ +_Godot version: 3.2.1_ ## Online Tutorials: @@ -17,7 +17,13 @@ _Godot version: 3.2_ ## Methods: -#### » Mesh build_mesh ( VoxelBuffer voxel_buffer ) +#### » Mesh build_mesh ( VoxelBuffer voxel_buffer ) + + +#### » int get_maximum_padding ( ) const + + +#### » int get_minimum_padding ( ) const @@ -28,4 +34,4 @@ _Godot version: 3.2_ * [Class List](Class_List.md) * [Doc Index](../01_get-started.md) -_Generated on Aug 26, 2019_ +_Generated on Feb 16, 2020_ diff --git a/doc/api/VoxelMesherBlocky.md b/doc/api/VoxelMesherBlocky.md index f1b6540f..5eb5db93 100644 --- a/doc/api/VoxelMesherBlocky.md +++ b/doc/api/VoxelMesherBlocky.md @@ -2,7 +2,7 @@ Inherits: VoxelMesher -_Godot version: 3.2_ +_Godot version: 3.2.1_ ## Online Tutorials: @@ -17,22 +17,22 @@ _Godot version: 3.2_ ## Methods: -#### » VoxelLibrary get_library ( ) const +#### » VoxelLibrary get_library ( ) const -#### » float get_occlusion_darkness ( ) const +#### » float get_occlusion_darkness ( ) const -#### » bool get_occlusion_enabled ( ) const +#### » bool get_occlusion_enabled ( ) const -#### » void set_library ( VoxelLibrary voxel_library ) +#### » void set_library ( VoxelLibrary voxel_library ) -#### » void set_occlusion_darkness ( float value ) +#### » void set_occlusion_darkness ( float value ) -#### » void set_occlusion_enabled ( bool enable ) +#### » void set_occlusion_enabled ( bool enable ) @@ -43,4 +43,4 @@ _Godot version: 3.2_ * [Class List](Class_List.md) * [Doc Index](../01_get-started.md) -_Generated on Aug 26, 2019_ +_Generated on Feb 16, 2020_ diff --git a/doc/api/VoxelMesherDMC.md b/doc/api/VoxelMesherDMC.md index a8d5910e..8938f58d 100644 --- a/doc/api/VoxelMesherDMC.md +++ b/doc/api/VoxelMesherDMC.md @@ -2,7 +2,7 @@ Inherits: VoxelMesher -_Godot version: 3.2_ +_Godot version: 3.2.1_ ## Online Tutorials: @@ -11,31 +11,31 @@ _Godot version: 3.2_ ## Constants: -#### » MeshMode.MESH_NORMAL = 0 +#### » MeshMode.MESH_NORMAL = 0 -#### » MeshMode.MESH_WIREFRAME = 1 +#### » MeshMode.MESH_WIREFRAME = 1 -#### » MeshMode.MESH_DEBUG_OCTREE = 2 +#### » MeshMode.MESH_DEBUG_OCTREE = 2 -#### » MeshMode.MESH_DEBUG_DUAL_GRID = 3 +#### » MeshMode.MESH_DEBUG_DUAL_GRID = 3 -#### » SimplifyMode.SIMPLIFY_OCTREE_BOTTOM_UP = 0 +#### » SimplifyMode.SIMPLIFY_OCTREE_BOTTOM_UP = 0 -#### » SimplifyMode.SIMPLIFY_OCTREE_TOP_DOWN = 1 +#### » SimplifyMode.SIMPLIFY_OCTREE_TOP_DOWN = 1 -#### » SimplifyMode.SIMPLIFY_NONE = 2 +#### » SimplifyMode.SIMPLIFY_NONE = 2 -#### » SeamMode.SEAM_NONE = 0 +#### » SeamMode.SEAM_NONE = 0 -#### » SeamMode.SEAM_MARCHING_SQUARE_SKIRTS = 1 +#### » SeamMode.SEAM_MARCHING_SQUARE_SKIRTS = 1 @@ -44,31 +44,31 @@ _Godot version: 3.2_ ## Methods: -#### » float get_geometric_error ( ) const +#### » float get_geometric_error ( ) const -#### » int get_mesh_mode ( ) const +#### » int get_mesh_mode ( ) const -#### » int get_seam_mode ( ) const +#### » int get_seam_mode ( ) const -#### » int get_simplify_mode ( ) const +#### » int get_simplify_mode ( ) const -#### » Dictionary get_statistics ( ) const +#### » Dictionary get_statistics ( ) const -#### » void set_geometric_error ( float error ) +#### » void set_geometric_error ( float error ) -#### » void set_mesh_mode ( int mode ) +#### » void set_mesh_mode ( int mode ) -#### » void set_seam_mode ( int mode ) +#### » void set_seam_mode ( int mode ) -#### » void set_simplify_mode ( int mode ) +#### » void set_simplify_mode ( int mode ) @@ -79,4 +79,4 @@ _Godot version: 3.2_ * [Class List](Class_List.md) * [Doc Index](../01_get-started.md) -_Generated on Aug 26, 2019_ +_Generated on Feb 16, 2020_ diff --git a/doc/api/VoxelMesherTransvoxel.md b/doc/api/VoxelMesherTransvoxel.md index 5dd4f49b..00fce551 100644 --- a/doc/api/VoxelMesherTransvoxel.md +++ b/doc/api/VoxelMesherTransvoxel.md @@ -2,7 +2,7 @@ Inherits: VoxelMesher -_Godot version: 3.2_ +_Godot version: 3.2.1_ ## Online Tutorials: @@ -17,6 +17,9 @@ _Godot version: 3.2_ ## Methods: +#### » ArrayMesh build_transition_mesh ( VoxelBuffer voxel_buffer, int direction ) + + ## Signals: @@ -25,4 +28,4 @@ _Godot version: 3.2_ * [Class List](Class_List.md) * [Doc Index](../01_get-started.md) -_Generated on Aug 26, 2019_ +_Generated on Feb 16, 2020_ diff --git a/doc/api/VoxelRaycastResult.md b/doc/api/VoxelRaycastResult.md new file mode 100644 index 00000000..6bd46402 --- /dev/null +++ b/doc/api/VoxelRaycastResult.md @@ -0,0 +1,42 @@ +# Class: VoxelRaycastResult + +Inherits: Reference + +_Godot version: 3.2.1_ + + +## 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 Feb 16, 2020_ diff --git a/doc/api/VoxelStream.md b/doc/api/VoxelStream.md index c0d81410..74bf722b 100644 --- a/doc/api/VoxelStream.md +++ b/doc/api/VoxelStream.md @@ -2,7 +2,7 @@ Inherits: Resource -_Godot version: 3.2_ +_Godot version: 3.2.1_ ## Online Tutorials: @@ -17,10 +17,13 @@ _Godot version: 3.2_ ## Methods: -#### » void emerge_block ( VoxelBuffer out_buffer, Vector3 origin_in_voxels, int lod ) +#### » void emerge_block ( VoxelBuffer out_buffer, Vector3 origin_in_voxels, int lod ) -#### » void immerge_block ( VoxelBuffer buffer, Vector3 origin_in_voxels, int lod ) +#### » int get_used_channels_mask ( ) const + + +#### » void immerge_block ( VoxelBuffer buffer, Vector3 origin_in_voxels, int lod ) @@ -31,4 +34,4 @@ _Godot version: 3.2_ * [Class List](Class_List.md) * [Doc Index](../01_get-started.md) -_Generated on Aug 26, 2019_ +_Generated on Feb 16, 2020_ diff --git a/doc/api/VoxelStreamBlockFiles.md b/doc/api/VoxelStreamBlockFiles.md index a030dce3..a4cffd8d 100644 --- a/doc/api/VoxelStreamBlockFiles.md +++ b/doc/api/VoxelStreamBlockFiles.md @@ -2,7 +2,7 @@ Inherits: VoxelStreamFile -_Godot version: 3.2_ +_Godot version: 3.2.1_ ## Online Tutorials: @@ -14,7 +14,7 @@ _Godot version: 3.2_ ## Properties: -#### » String directory +#### » String directory `set_directory (value)` setter @@ -32,4 +32,4 @@ _Godot version: 3.2_ * [Class List](Class_List.md) * [Doc Index](../01_get-started.md) -_Generated on Aug 26, 2019_ +_Generated on Feb 16, 2020_ diff --git a/doc/api/VoxelStreamFile.md b/doc/api/VoxelStreamFile.md index b9628955..9c520d48 100644 --- a/doc/api/VoxelStreamFile.md +++ b/doc/api/VoxelStreamFile.md @@ -2,7 +2,7 @@ Inherits: VoxelStream -_Godot version: 3.2_ +_Godot version: 3.2.1_ ## Online Tutorials: @@ -14,14 +14,14 @@ _Godot version: 3.2_ ## Properties: -#### » VoxelStream fallback_stream +#### » VoxelStream fallback_stream `set_fallback_stream (value)` setter `get_fallback_stream ()` getter -#### » bool save_fallback_output +#### » bool save_fallback_output `set_save_fallback_output (value)` setter @@ -31,7 +31,7 @@ _Godot version: 3.2_ ## Methods: -#### » Vector3 get_block_size ( ) const +#### » Vector3 get_block_size ( ) const @@ -42,4 +42,4 @@ _Godot version: 3.2_ * [Class List](Class_List.md) * [Doc Index](../01_get-started.md) -_Generated on Aug 26, 2019_ +_Generated on Feb 16, 2020_ diff --git a/doc/api/VoxelStreamRegionFiles.md b/doc/api/VoxelStreamRegionFiles.md index d3445a91..6ea63578 100644 --- a/doc/api/VoxelStreamRegionFiles.md +++ b/doc/api/VoxelStreamRegionFiles.md @@ -2,7 +2,7 @@ Inherits: VoxelStreamFile -_Godot version: 3.2_ +_Godot version: 3.2.1_ ## Online Tutorials: @@ -14,35 +14,35 @@ _Godot version: 3.2_ ## Properties: -#### » int block_size_po2 +#### » int block_size_po2 `set_block_size_po2 (value)` setter `get_region_size_po2 ()` getter -#### » String directory +#### » String directory `set_directory (value)` setter `get_directory ()` getter -#### » int lod_count +#### » int lod_count `set_lod_count (value)` setter `get_lod_count ()` getter -#### » int region_size_po2 +#### » int region_size_po2 `set_region_size_po2 (value)` setter `get_region_size_po2 ()` getter -#### » int sector_size +#### » int sector_size `set_sector_size (value)` setter @@ -52,13 +52,13 @@ _Godot version: 3.2_ ## Methods: -#### » void convert_files ( Dictionary new_settings ) +#### » void convert_files ( Dictionary new_settings ) -#### » int get_block_size_po2 ( ) const +#### » int get_block_size_po2 ( ) const -#### » Vector3 get_region_size ( ) const +#### » Vector3 get_region_size ( ) const @@ -69,4 +69,4 @@ _Godot version: 3.2_ * [Class List](Class_List.md) * [Doc Index](../01_get-started.md) -_Generated on Aug 26, 2019_ +_Generated on Feb 16, 2020_ diff --git a/doc/api/VoxelTerrain.md b/doc/api/VoxelTerrain.md index c54dd4e4..70b629d5 100644 --- a/doc/api/VoxelTerrain.md +++ b/doc/api/VoxelTerrain.md @@ -2,7 +2,7 @@ Inherits: Spatial -_Godot version: 3.2_ +_Godot version: 3.2.1_ ## Online Tutorials: @@ -14,42 +14,35 @@ _Godot version: 3.2_ ## Properties: -#### » bool generate_collisions +#### » bool generate_collisions `set_generate_collisions (value)` setter `get_generate_collisions ()` getter -#### » bool smooth_meshing_enabled - -`set_smooth_meshing_enabled (value)` setter - -`is_smooth_meshing_enabled ()` getter - - -#### » VoxelStream stream +#### » VoxelStream stream `set_stream (value)` setter `get_stream ()` getter -#### » int view_distance +#### » int view_distance `set_view_distance (value)` setter `get_view_distance ()` getter -#### » NodePath viewer_path +#### » NodePath viewer_path `set_viewer_path (value)` setter `get_viewer_path ()` getter -#### » VoxelLibrary voxel_library +#### » VoxelLibrary voxel_library `set_voxel_library (value)` setter @@ -59,31 +52,22 @@ _Godot version: 3.2_ ## Methods: -#### » Vector3 block_to_voxel ( Vector3 block_pos ) +#### » Vector3 block_to_voxel ( Vector3 block_pos ) -#### » Material get_material ( int id ) const +#### » Material get_material ( int id ) const -#### » Dictionary get_statistics ( ) const +#### » Dictionary get_statistics ( ) const -#### » VoxelMap get_storage ( ) +#### » VoxelTool get_voxel_tool ( ) -#### » void make_area_dirty ( AABB aabb ) +#### » void set_material ( int id, Material material ) -#### » void make_voxel_dirty ( Vector3 pos ) - - -#### » Variant raycast ( Vector3 origin, Vector3 direction, float max_distance=100 ) - - -#### » void set_material ( int id, Material material ) - - -#### » Vector3 voxel_to_block ( Vector3 voxel_pos ) +#### » Vector3 voxel_to_block ( Vector3 voxel_pos ) @@ -94,4 +78,4 @@ _Godot version: 3.2_ * [Class List](Class_List.md) * [Doc Index](../01_get-started.md) -_Generated on Aug 26, 2019_ +_Generated on Feb 16, 2020_ diff --git a/doc/api/VoxelTool.md b/doc/api/VoxelTool.md new file mode 100644 index 00000000..6c7ad2e3 --- /dev/null +++ b/doc/api/VoxelTool.md @@ -0,0 +1,86 @@ +# Class: VoxelTool + +Inherits: Reference + +_Godot version: 3.2.1_ + + +## 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_point ( Vector3 pos ) + + +#### » void do_sphere ( Vector3 center, float radius ) + + +#### » int get_voxel ( Vector3 pos ) + + +#### » float get_voxel_f ( Vector3 pos ) + + +#### » VoxelRaycastResult raycast ( Vector3 origin, Vector3 direction, float max_distance=10.0 ) + + +#### » void set_voxel ( Vector3 pos, int v ) + + +#### » void set_voxel_f ( Vector3 pos, float v ) + + + +## Signals: + + +--- +* [Class List](Class_List.md) +* [Doc Index](../01_get-started.md) + +_Generated on Feb 16, 2020_ diff --git a/doc/classes/Voxel.xml b/doc/classes/Voxel.xml index 5b121f9a..007cd064 100644 --- a/doc/classes/Voxel.xml +++ b/doc/classes/Voxel.xml @@ -1,5 +1,5 @@ - + @@ -73,11 +73,5 @@ - - - - - - diff --git a/doc/classes/VoxelBoxMover.xml b/doc/classes/VoxelBoxMover.xml index 4d51b123..a55d0f88 100644 --- a/doc/classes/VoxelBoxMover.xml +++ b/doc/classes/VoxelBoxMover.xml @@ -1,5 +1,5 @@ - + diff --git a/doc/classes/VoxelBuffer.xml b/doc/classes/VoxelBuffer.xml index 6e9d6b4e..0360d1fd 100644 --- a/doc/classes/VoxelBuffer.xml +++ b/doc/classes/VoxelBuffer.xml @@ -1,5 +1,5 @@ - + @@ -13,17 +13,17 @@ - + - + - + @@ -34,7 +34,7 @@ - + @@ -51,6 +51,20 @@ + + + + + + + + + + + + + + @@ -85,6 +99,14 @@ + + + + + + + + @@ -137,6 +159,12 @@ + + + + + + @@ -151,6 +179,16 @@ + + + + + + + + + + @@ -199,7 +237,7 @@ - + @@ -215,5 +253,15 @@ + + + + + + + + + + diff --git a/doc/classes/VoxelGenerator.xml b/doc/classes/VoxelGenerator.xml new file mode 100644 index 00000000..4536fe96 --- /dev/null +++ b/doc/classes/VoxelGenerator.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/classes/VoxelGeneratorHeightmap.xml b/doc/classes/VoxelGeneratorHeightmap.xml new file mode 100644 index 00000000..4b8a9d25 --- /dev/null +++ b/doc/classes/VoxelGeneratorHeightmap.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/classes/VoxelStreamImage.xml b/doc/classes/VoxelGeneratorImage.xml similarity index 59% rename from doc/classes/VoxelStreamImage.xml rename to doc/classes/VoxelGeneratorImage.xml index b9916fea..0aff5105 100644 --- a/doc/classes/VoxelStreamImage.xml +++ b/doc/classes/VoxelGeneratorImage.xml @@ -1,5 +1,5 @@ - + @@ -9,7 +9,9 @@ - + + + diff --git a/doc/classes/VoxelStreamNoise.xml b/doc/classes/VoxelGeneratorNoise.xml similarity index 73% rename from doc/classes/VoxelStreamNoise.xml rename to doc/classes/VoxelGeneratorNoise.xml index d2f419cd..6eebb00c 100644 --- a/doc/classes/VoxelStreamNoise.xml +++ b/doc/classes/VoxelGeneratorNoise.xml @@ -1,5 +1,5 @@ - + @@ -9,6 +9,8 @@ + + diff --git a/doc/classes/VoxelGeneratorNoise2D.xml b/doc/classes/VoxelGeneratorNoise2D.xml new file mode 100644 index 00000000..47481812 --- /dev/null +++ b/doc/classes/VoxelGeneratorNoise2D.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/classes/VoxelStreamTest.xml b/doc/classes/VoxelGeneratorTest.xml similarity index 76% rename from doc/classes/VoxelStreamTest.xml rename to doc/classes/VoxelGeneratorTest.xml index fb652f05..daeafa44 100644 --- a/doc/classes/VoxelStreamTest.xml +++ b/doc/classes/VoxelGeneratorTest.xml @@ -1,5 +1,5 @@ - + @@ -9,7 +9,9 @@ - + + + diff --git a/doc/classes/VoxelIsoSurfaceTool.xml b/doc/classes/VoxelIsoSurfaceTool.xml deleted file mode 100644 index 05f575ba..00000000 --- a/doc/classes/VoxelIsoSurfaceTool.xml +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/classes/VoxelLibrary.xml b/doc/classes/VoxelLibrary.xml index 05703459..13fd7e23 100644 --- a/doc/classes/VoxelLibrary.xml +++ b/doc/classes/VoxelLibrary.xml @@ -1,5 +1,5 @@ - + @@ -29,7 +29,11 @@ + + + + diff --git a/doc/classes/VoxelLodTerrain.xml b/doc/classes/VoxelLodTerrain.xml index 93ac8a76..d0020de6 100644 --- a/doc/classes/VoxelLodTerrain.xml +++ b/doc/classes/VoxelLodTerrain.xml @@ -1,5 +1,5 @@ - + @@ -7,7 +7,7 @@ - + @@ -17,18 +17,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -45,7 +89,7 @@ - + @@ -53,7 +97,7 @@ - + diff --git a/doc/classes/VoxelMap.xml b/doc/classes/VoxelMap.xml index 97e8e60d..306e37c5 100644 --- a/doc/classes/VoxelMap.xml +++ b/doc/classes/VoxelMap.xml @@ -1,5 +1,5 @@ - + diff --git a/doc/classes/VoxelMesher.xml b/doc/classes/VoxelMesher.xml index dd9a5fcf..a026bc5b 100644 --- a/doc/classes/VoxelMesher.xml +++ b/doc/classes/VoxelMesher.xml @@ -1,5 +1,5 @@ - + @@ -15,6 +15,18 @@ + + + + + + + + + + + + diff --git a/doc/classes/VoxelMesherBlocky.xml b/doc/classes/VoxelMesherBlocky.xml index 9f0fcc40..e61dc191 100644 --- a/doc/classes/VoxelMesherBlocky.xml +++ b/doc/classes/VoxelMesherBlocky.xml @@ -1,5 +1,5 @@ - + diff --git a/doc/classes/VoxelMesherDMC.xml b/doc/classes/VoxelMesherDMC.xml index 8e6d0c8f..470d65d3 100644 --- a/doc/classes/VoxelMesherDMC.xml +++ b/doc/classes/VoxelMesherDMC.xml @@ -1,5 +1,5 @@ - + diff --git a/doc/classes/VoxelMesherTransvoxel.xml b/doc/classes/VoxelMesherTransvoxel.xml index 3e5f430e..188ebd2e 100644 --- a/doc/classes/VoxelMesherTransvoxel.xml +++ b/doc/classes/VoxelMesherTransvoxel.xml @@ -1,5 +1,5 @@ - + @@ -7,6 +7,16 @@ + + + + + + + + + + diff --git a/doc/classes/VoxelRaycastResult.xml b/doc/classes/VoxelRaycastResult.xml new file mode 100644 index 00000000..c8f78dff --- /dev/null +++ b/doc/classes/VoxelRaycastResult.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/doc/classes/VoxelStream.xml b/doc/classes/VoxelStream.xml index 5334a4a9..0ee7dc08 100644 --- a/doc/classes/VoxelStream.xml +++ b/doc/classes/VoxelStream.xml @@ -1,5 +1,5 @@ - + @@ -19,6 +19,12 @@ + + + + + + diff --git a/doc/classes/VoxelStreamBlockFiles.xml b/doc/classes/VoxelStreamBlockFiles.xml index 45d2dbde..84f434e2 100644 --- a/doc/classes/VoxelStreamBlockFiles.xml +++ b/doc/classes/VoxelStreamBlockFiles.xml @@ -1,5 +1,5 @@ - + diff --git a/doc/classes/VoxelStreamFile.xml b/doc/classes/VoxelStreamFile.xml index f00179ff..072c879a 100644 --- a/doc/classes/VoxelStreamFile.xml +++ b/doc/classes/VoxelStreamFile.xml @@ -1,5 +1,5 @@ - + diff --git a/doc/classes/VoxelStreamRegionFiles.xml b/doc/classes/VoxelStreamRegionFiles.xml index 9074ff2f..7fe1571c 100644 --- a/doc/classes/VoxelStreamRegionFiles.xml +++ b/doc/classes/VoxelStreamRegionFiles.xml @@ -1,5 +1,5 @@ - + diff --git a/doc/classes/VoxelTerrain.xml b/doc/classes/VoxelTerrain.xml index 4ffbae1f..2eeefeec 100644 --- a/doc/classes/VoxelTerrain.xml +++ b/doc/classes/VoxelTerrain.xml @@ -1,5 +1,5 @@ - + @@ -29,40 +29,12 @@ - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -85,8 +57,6 @@ - - diff --git a/doc/classes/VoxelTool.xml b/doc/classes/VoxelTool.xml new file mode 100644 index 00000000..cc8cfcb0 --- /dev/null +++ b/doc/classes/VoxelTool.xml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/tools/build.py b/doc/tools/build.py index 4e83df54..0d5693ce 100755 --- a/doc/tools/build.py +++ b/doc/tools/build.py @@ -118,7 +118,7 @@ def find_godot(godot, bindir): else: filemask = 'godot.*.[36][24]' - binfiles = glob.glob(bindir+filemask) + binfiles = glob.glob(os.path.join(bindir,filemask)) if len(binfiles) > 0: return binfiles[0] diff --git a/generators/voxel_generator_heightmap.cpp b/generators/voxel_generator_heightmap.cpp index f59db2b5..ea88916f 100644 --- a/generators/voxel_generator_heightmap.cpp +++ b/generators/voxel_generator_heightmap.cpp @@ -7,13 +7,20 @@ VoxelGeneratorHeightmap::VoxelGeneratorHeightmap() { void VoxelGeneratorHeightmap::set_channel(VoxelBuffer::ChannelId channel) { ERR_FAIL_INDEX(channel, VoxelBuffer::MAX_CHANNELS); - _channel = channel; + if(_channel != channel) { + _channel = channel; + emit_changed(); + } } VoxelBuffer::ChannelId VoxelGeneratorHeightmap::get_channel() const { return _channel; } +int VoxelGeneratorHeightmap::get_used_channels_mask() const { + return (1<<_channel); +} + void VoxelGeneratorHeightmap::set_height_start(float start) { _range.start = start; } @@ -52,7 +59,6 @@ void VoxelGeneratorHeightmap::_bind_methods() { ClassDB::bind_method(D_METHOD("set_iso_scale", "scale"), &VoxelGeneratorHeightmap::set_iso_scale); ClassDB::bind_method(D_METHOD("get_iso_scale"), &VoxelGeneratorHeightmap::get_iso_scale); - ADD_PROPERTY(PropertyInfo(Variant::INT, "channel", PROPERTY_HINT_ENUM, VoxelBuffer::CHANNEL_ID_HINT_STRING), "set_channel", "get_channel"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "height_start"), "set_height_start", "get_height_start"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "height_range"), "set_height_range", "get_height_range"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "iso_scale"), "set_iso_scale", "get_iso_scale"); diff --git a/generators/voxel_generator_heightmap.h b/generators/voxel_generator_heightmap.h index b6237d14..fd1de4df 100644 --- a/generators/voxel_generator_heightmap.h +++ b/generators/voxel_generator_heightmap.h @@ -12,6 +12,7 @@ public: void set_channel(VoxelBuffer::ChannelId channel); VoxelBuffer::ChannelId get_channel() const; + int get_used_channels_mask() const override; void set_height_start(float start); float get_height_start() const; @@ -97,7 +98,7 @@ private: } }; - VoxelBuffer::ChannelId _channel = VoxelBuffer::CHANNEL_TYPE; + VoxelBuffer::ChannelId _channel = VoxelBuffer::CHANNEL_SDF; int _matter_type = 1; Range _range; float _iso_scale = 0.1; diff --git a/generators/voxel_generator_image.cpp b/generators/voxel_generator_image.cpp index 4c32a1e2..ddb7a79d 100644 --- a/generators/voxel_generator_image.cpp +++ b/generators/voxel_generator_image.cpp @@ -70,6 +70,7 @@ void VoxelGeneratorImage::_bind_methods() { ClassDB::bind_method(D_METHOD("set_blur_enabled", "enable"), &VoxelGeneratorImage::set_blur_enabled); ClassDB::bind_method(D_METHOD("is_blur_enabled"), &VoxelGeneratorImage::is_blur_enabled); + ADD_PROPERTY(PropertyInfo(Variant::INT, "channel", PROPERTY_HINT_ENUM, VoxelBuffer::CHANNEL_ID_HINT_STRING), "set_channel", "get_channel"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "image", PROPERTY_HINT_RESOURCE_TYPE, "Image"), "set_image", "get_image"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "blur_enabled"), "set_blur_enabled", "is_blur_enabled"); } diff --git a/generators/voxel_generator_image.h b/generators/voxel_generator_image.h index ae9d4ec5..983a3c6a 100644 --- a/generators/voxel_generator_image.h +++ b/generators/voxel_generator_image.h @@ -7,6 +7,7 @@ // Provides infinite tiling heightmap based on an image class VoxelGeneratorImage : public VoxelGeneratorHeightmap { GDCLASS(VoxelGeneratorImage, VoxelGeneratorHeightmap) + public: VoxelGeneratorImage(); diff --git a/generators/voxel_generator_noise.cpp b/generators/voxel_generator_noise.cpp index fc853fbc..d32e7a6b 100644 --- a/generators/voxel_generator_noise.cpp +++ b/generators/voxel_generator_noise.cpp @@ -1,16 +1,23 @@ #include "voxel_generator_noise.h" +void VoxelGeneratorNoise::set_noise(Ref noise) { + _noise = noise; +} + void VoxelGeneratorNoise::set_channel(VoxelBuffer::ChannelId channel) { ERR_FAIL_INDEX(channel, VoxelBuffer::MAX_CHANNELS); - _channel = channel; + if(_channel != channel) { + _channel = channel; + emit_changed(); + } } VoxelBuffer::ChannelId VoxelGeneratorNoise::get_channel() const { return _channel; } -void VoxelGeneratorNoise::set_noise(Ref noise) { - _noise = noise; +int VoxelGeneratorNoise::get_used_channels_mask() const { + return (1<<_channel); } Ref VoxelGeneratorNoise::get_noise() const { @@ -160,6 +167,8 @@ void VoxelGeneratorNoise::generate_block(VoxelBlockRequest &input) { } void VoxelGeneratorNoise::_bind_methods() { + ClassDB::bind_method(D_METHOD("set_channel", "channel"), &VoxelGeneratorNoise::set_channel); + ClassDB::bind_method(D_METHOD("get_channel"), &VoxelGeneratorNoise::get_channel); ClassDB::bind_method(D_METHOD("set_noise", "noise"), &VoxelGeneratorNoise::set_noise); ClassDB::bind_method(D_METHOD("get_noise"), &VoxelGeneratorNoise::get_noise); @@ -170,11 +179,8 @@ void VoxelGeneratorNoise::_bind_methods() { ClassDB::bind_method(D_METHOD("set_height_range", "hrange"), &VoxelGeneratorNoise::set_height_range); ClassDB::bind_method(D_METHOD("get_height_range"), &VoxelGeneratorNoise::get_height_range); - ClassDB::bind_method(D_METHOD("set_channel", "channel"), &VoxelGeneratorNoise::set_channel); - ClassDB::bind_method(D_METHOD("get_channel"), &VoxelGeneratorNoise::get_channel); - + ADD_PROPERTY(PropertyInfo(Variant::INT, "channel", PROPERTY_HINT_ENUM, VoxelBuffer::CHANNEL_ID_HINT_STRING), "set_channel", "get_channel"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "noise", PROPERTY_HINT_RESOURCE_TYPE, "OpenSimplexNoise"), "set_noise", "get_noise"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "height_start"), "set_height_start", "get_height_start"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "height_range"), "set_height_range", "get_height_range"); - ADD_PROPERTY(PropertyInfo(Variant::INT, "channel", PROPERTY_HINT_ENUM, VoxelBuffer::CHANNEL_ID_HINT_STRING), "set_channel", "get_channel"); } diff --git a/generators/voxel_generator_noise.h b/generators/voxel_generator_noise.h index 394a83f8..26d15bb9 100644 --- a/generators/voxel_generator_noise.h +++ b/generators/voxel_generator_noise.h @@ -11,6 +11,7 @@ class VoxelGeneratorNoise : public VoxelGenerator { public: void set_channel(VoxelBuffer::ChannelId channel); VoxelBuffer::ChannelId get_channel() const; + int get_used_channels_mask() const override; void set_noise(Ref noise); Ref get_noise() const; @@ -27,7 +28,7 @@ protected: static void _bind_methods(); private: - VoxelBuffer::ChannelId _channel = VoxelBuffer::CHANNEL_TYPE; + VoxelBuffer::ChannelId _channel = VoxelBuffer::CHANNEL_SDF; Ref _noise; FloatBuffer3D _noise_buffer; float _height_start = 0; diff --git a/generators/voxel_generator_noise_2d.cpp b/generators/voxel_generator_noise_2d.cpp index 7bd4647c..5e534412 100644 --- a/generators/voxel_generator_noise_2d.cpp +++ b/generators/voxel_generator_noise_2d.cpp @@ -48,6 +48,7 @@ void VoxelGeneratorNoise2D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_curve", "curve"), &VoxelGeneratorNoise2D::set_curve); ClassDB::bind_method(D_METHOD("get_curve"), &VoxelGeneratorNoise2D::get_curve); + ADD_PROPERTY(PropertyInfo(Variant::INT, "channel", PROPERTY_HINT_ENUM, VoxelBuffer::CHANNEL_ID_HINT_STRING), "set_channel", "get_channel"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "noise", PROPERTY_HINT_RESOURCE_TYPE, "OpenSimplexNoise"), "set_noise", "get_noise"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "curve", PROPERTY_HINT_RESOURCE_TYPE, "Curve"), "set_curve", "get_curve"); } diff --git a/generators/voxel_generator_noise_2d.h b/generators/voxel_generator_noise_2d.h index f1e1edd7..5d524f40 100644 --- a/generators/voxel_generator_noise_2d.h +++ b/generators/voxel_generator_noise_2d.h @@ -6,6 +6,7 @@ class VoxelGeneratorNoise2D : public VoxelGeneratorHeightmap { GDCLASS(VoxelGeneratorNoise2D, VoxelGeneratorHeightmap) + public: VoxelGeneratorNoise2D(); diff --git a/generators/voxel_generator_test.cpp b/generators/voxel_generator_test.cpp index 90bb7799..23de7b61 100644 --- a/generators/voxel_generator_test.cpp +++ b/generators/voxel_generator_test.cpp @@ -8,6 +8,22 @@ VoxelGeneratorTest::VoxelGeneratorTest() { _pattern_size = Vector3i(10, 10, 10); } +void VoxelGeneratorTest::set_channel(VoxelBuffer::ChannelId channel) { + ERR_FAIL_INDEX(channel, VoxelBuffer::MAX_CHANNELS); + if(_channel != channel) { + _channel = channel; + emit_changed(); + } +} + +VoxelBuffer::ChannelId VoxelGeneratorTest::get_channel() const { + return _channel; +} + +int VoxelGeneratorTest::get_used_channels_mask() const { + return (1<<_channel); +} + void VoxelGeneratorTest::set_mode(Mode mode) { ERR_FAIL_INDEX(mode, MODE_COUNT); _mode = mode; @@ -66,7 +82,7 @@ void VoxelGeneratorTest::generate_block_flat(VoxelBuffer &out_buffer, Vector3i o for (int rz = 0; rz < size.z; ++rz) { for (int rx = 0; rx < size.x; ++rx) { for (int ry = 0; ry < rh; ++ry) { - out_buffer.set_voxel(_voxel_type, rx, ry, rz, 0); + out_buffer.set_voxel(_voxel_type, rx, ry, rz, _channel); } } } @@ -105,7 +121,7 @@ void VoxelGeneratorTest::generate_block_waves(VoxelBuffer &out_buffer, Vector3i rh = size.y; for (int ry = 0; ry < rh; ++ry) { - out_buffer.set_voxel(_voxel_type, rx, ry, rz, 0); + out_buffer.set_voxel(_voxel_type, rx, ry, rz, _channel); //out_buffer.set_voxel(255, rx, ry, rz, 1); // TRANSVOXEL TEST } } @@ -115,6 +131,9 @@ void VoxelGeneratorTest::generate_block_waves(VoxelBuffer &out_buffer, Vector3i void VoxelGeneratorTest::_bind_methods() { + ClassDB::bind_method(D_METHOD("set_channel", "channel"), &VoxelGeneratorTest::set_channel); + ClassDB::bind_method(D_METHOD("get_channel"), &VoxelGeneratorTest::get_channel); + ClassDB::bind_method(D_METHOD("set_mode", "mode"), &VoxelGeneratorTest::set_mode); ClassDB::bind_method(D_METHOD("get_mode"), &VoxelGeneratorTest::get_mode); @@ -127,6 +146,7 @@ void VoxelGeneratorTest::_bind_methods() { ClassDB::bind_method(D_METHOD("set_pattern_offset", "offset"), &VoxelGeneratorTest::_set_pattern_offset); ClassDB::bind_method(D_METHOD("get_pattern_offset"), &VoxelGeneratorTest::_get_pattern_offset); + ADD_PROPERTY(PropertyInfo(Variant::INT, "channel", PROPERTY_HINT_ENUM, VoxelBuffer::CHANNEL_ID_HINT_STRING), "set_channel", "get_channel"); ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Flat,Waves"), "set_mode", "get_mode"); ADD_PROPERTY(PropertyInfo(Variant::INT, "voxel_type", PROPERTY_HINT_RANGE, "0,255,1"), "set_voxel_type", "get_voxel_type"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "pattern_size"), "set_pattern_size", "get_pattern_size"); diff --git a/generators/voxel_generator_test.h b/generators/voxel_generator_test.h index 3d6c6e8a..ff92b263 100644 --- a/generators/voxel_generator_test.h +++ b/generators/voxel_generator_test.h @@ -15,6 +15,10 @@ public: VoxelGeneratorTest(); + void set_channel(VoxelBuffer::ChannelId channel); + VoxelBuffer::ChannelId get_channel() const; + int get_used_channels_mask() const override; + void generate_block(VoxelBlockRequest &input) override; void set_mode(Mode mode); @@ -42,6 +46,7 @@ protected: void _set_pattern_offset(Vector3 offset) { set_pattern_offset(Vector3i(offset)); } private: + VoxelBuffer::ChannelId _channel = VoxelBuffer::CHANNEL_SDF; Mode _mode; int _voxel_type; Vector3i _pattern_offset; diff --git a/streams/voxel_stream.cpp b/streams/voxel_stream.cpp index cf312d74..64f9faea 100644 --- a/streams/voxel_stream.cpp +++ b/streams/voxel_stream.cpp @@ -76,6 +76,27 @@ void VoxelStream::_immerge_block(Ref buffer, Vector3 origin_in_voxe immerge_block(buffer, Vector3i(origin_in_voxels), lod); } +int VoxelStream::get_used_channels_mask() const { + ScriptInstance *script = get_script_instance(); + int mask = 0; + if (script) { + // Call script to get mask + Variant::CallError err; + //const Variant *args[3] = { &arg1, &arg2, &arg3 }; + mask = script->call(VoxelStringNames::get_singleton()->get_used_channels_mask, NULL, 0, err); + ERR_FAIL_COND_V_MSG(err.error != Variant::CallError::CALL_OK, mask, + "voxel_stream.cpp:get_used_channels_mask gave an error: " + String::num(err.error) + + " Argument: " + String::num(err.argument) + + " Expected type: " + Variant::get_type_name(err.expected)); + // This had to be explicitely logged due to the usual GD debugger not working with threads + } + return mask; +} + +int VoxelStream::_get_used_channels_mask() const { + return get_used_channels_mask(); +} + VoxelStream::Stats VoxelStream::get_statistics() const { return _stats; } @@ -85,4 +106,5 @@ void VoxelStream::_bind_methods() { ClassDB::bind_method(D_METHOD("emerge_block", "out_buffer", "origin_in_voxels", "lod"), &VoxelStream::_emerge_block); ClassDB::bind_method(D_METHOD("immerge_block", "buffer", "origin_in_voxels", "lod"), &VoxelStream::_immerge_block); + ClassDB::bind_method(D_METHOD("get_used_channels_mask"), &VoxelStream::_get_used_channels_mask); } diff --git a/streams/voxel_stream.h b/streams/voxel_stream.h index 71dd9f51..e8edb379 100644 --- a/streams/voxel_stream.h +++ b/streams/voxel_stream.h @@ -33,6 +33,8 @@ public: // This function is recommended if you save to files, because you can batch their access. virtual void immerge_blocks(Vector &p_blocks); + virtual int get_used_channels_mask() const; + virtual bool is_thread_safe() const; virtual bool is_cloneable() const; @@ -43,6 +45,7 @@ protected: void _emerge_block(Ref out_buffer, Vector3 origin_in_voxels, int lod); void _immerge_block(Ref buffer, Vector3 origin_in_voxels, int lod); + int _get_used_channels_mask() const; Stats _stats; }; diff --git a/terrain/voxel_lod_terrain.cpp b/terrain/voxel_lod_terrain.cpp index d4d2ffac..01638e92 100644 --- a/terrain/voxel_lod_terrain.cpp +++ b/terrain/voxel_lod_terrain.cpp @@ -83,6 +83,15 @@ VoxelLodTerrain::~VoxelLodTerrain() { } } +String VoxelLodTerrain::get_configuration_warning() const { + if (_stream.is_valid()) { + if (! (_stream->get_used_channels_mask() & (1< VoxelLodTerrain::get_material() const { return _material; } @@ -154,6 +163,8 @@ void VoxelLodTerrain::_on_stream_params_changed() { Lod &lod = _lods[i]; lod.last_view_distance_blocks = 0; } + + update_configuration_warning(); } void VoxelLodTerrain::set_block_size_po2(unsigned int p_block_size_po2) { diff --git a/terrain/voxel_lod_terrain.h b/terrain/voxel_lod_terrain.h index 6e62d6c0..b0478780 100644 --- a/terrain/voxel_lod_terrain.h +++ b/terrain/voxel_lod_terrain.h @@ -22,6 +22,8 @@ public: VoxelLodTerrain(); ~VoxelLodTerrain(); + String get_configuration_warning() const override; + Ref get_material() const; void set_material(Ref p_material); diff --git a/terrain/voxel_terrain.cpp b/terrain/voxel_terrain.cpp index f755c858..452c4feb 100644 --- a/terrain/voxel_terrain.cpp +++ b/terrain/voxel_terrain.cpp @@ -27,7 +27,10 @@ VoxelTerrain::VoxelTerrain() { _block_updater = nullptr; _run_in_editor = false; - _smooth_meshing_enabled = false; + + Ref library; + library.instance(); + set_voxel_library(library); } VoxelTerrain::~VoxelTerrain() { @@ -46,6 +49,15 @@ VoxelTerrain::~VoxelTerrain() { } } +String VoxelTerrain::get_configuration_warning() const { + if (_stream.is_valid()) { + if (! (_stream->get_used_channels_mask() & ((1< VoxelTerrain::get_material(unsigned int id) const { return _materials[id]; } -bool VoxelTerrain::is_smooth_meshing_enabled() const { - return _smooth_meshing_enabled; -} - -void VoxelTerrain::set_smooth_meshing_enabled(bool enabled) { - if (_smooth_meshing_enabled != enabled) { - _smooth_meshing_enabled = enabled; - stop_updater(); - start_updater(); - make_all_view_dirty_deferred(); - } -} - void VoxelTerrain::make_block_dirty(Vector3i bpos) { // TODO Immediate update viewer distance? @@ -384,7 +385,11 @@ void VoxelTerrain::start_updater() { // TODO Thread-safe way to change those parameters VoxelMeshUpdater::MeshingParams params; - params.smooth_surface = _smooth_meshing_enabled; + + if (_stream.is_valid()) { + params.smooth_surface = _stream->get_used_channels_mask() & (1 << VoxelBuffer::CHANNEL_SDF); + } + params.library = _library; _block_updater = memnew(VoxelMeshUpdater(1, params)); @@ -894,7 +899,7 @@ void VoxelTerrain::_process() { // Smooth meshing works on more neighbors, so checking a single block isn't enough to ignore it, // but that will slow down meshing a lot. // TODO This is one reason to separate terrain systems between blocky and smooth (other reason is LOD) - if (!_smooth_meshing_enabled) { + if (! (_stream->get_used_channels_mask() & (1<get_block(block_pos); if (block == nullptr) { continue; @@ -1060,7 +1065,15 @@ void VoxelTerrain::_process() { } Ref VoxelTerrain::get_voxel_tool() { - return Ref(memnew(VoxelToolTerrain(this, _map))); + Ref vt = memnew(VoxelToolTerrain(this, _map)); + if (_stream.is_valid()) { + if(_stream->get_used_channels_mask() & (1<set_channel(VoxelBuffer::CHANNEL_SDF); + } else { + vt->set_channel(VoxelBuffer::CHANNEL_TYPE); + } + } + return vt; } Vector3 VoxelTerrain::_b_voxel_to_block(Vector3 pos) { @@ -1091,9 +1104,6 @@ void VoxelTerrain::_bind_methods() { ClassDB::bind_method(D_METHOD("get_viewer_path"), &VoxelTerrain::get_viewer_path); ClassDB::bind_method(D_METHOD("set_viewer_path", "path"), &VoxelTerrain::set_viewer_path); - ClassDB::bind_method(D_METHOD("is_smooth_meshing_enabled"), &VoxelTerrain::is_smooth_meshing_enabled); - ClassDB::bind_method(D_METHOD("set_smooth_meshing_enabled", "enabled"), &VoxelTerrain::set_smooth_meshing_enabled); - ClassDB::bind_method(D_METHOD("voxel_to_block", "voxel_pos"), &VoxelTerrain::_b_voxel_to_block); ClassDB::bind_method(D_METHOD("block_to_voxel", "block_pos"), &VoxelTerrain::_b_block_to_voxel); @@ -1107,5 +1117,4 @@ void VoxelTerrain::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "view_distance"), "set_view_distance", "get_view_distance"); ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "viewer_path"), "set_viewer_path", "get_viewer_path"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "generate_collisions"), "set_generate_collisions", "get_generate_collisions"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "smooth_meshing_enabled"), "set_smooth_meshing_enabled", "is_smooth_meshing_enabled"); } diff --git a/terrain/voxel_terrain.h b/terrain/voxel_terrain.h index 24988564..812e9bec 100644 --- a/terrain/voxel_terrain.h +++ b/terrain/voxel_terrain.h @@ -23,6 +23,8 @@ public: VoxelTerrain(); ~VoxelTerrain(); + String get_configuration_warning() const override; + void set_stream(Ref p_stream); Ref get_stream() const; @@ -49,9 +51,6 @@ public: void set_material(unsigned int id, Ref material); Ref get_material(unsigned int id) const; - bool is_smooth_meshing_enabled() const; - void set_smooth_meshing_enabled(bool enabled); - Ref get_storage() const { return _map; } Ref get_voxel_tool(); @@ -103,7 +102,6 @@ private: Vector3 _b_block_to_voxel(Vector3 pos); //void _force_load_blocks_binding(Vector3 center, Vector3 extents) { force_load_blocks(center, extents); } -private: // Voxel storage Ref _map; @@ -132,7 +130,6 @@ private: bool _generate_collisions = true; bool _run_in_editor; - bool _smooth_meshing_enabled; Ref _materials[VoxelMesherBlocky::MAX_MATERIALS]; diff --git a/voxel_string_names.cpp b/voxel_string_names.cpp index ab52caca..c435f14d 100644 --- a/voxel_string_names.cpp +++ b/voxel_string_names.cpp @@ -18,6 +18,7 @@ VoxelStringNames::VoxelStringNames() { emerge_block = StaticCString::create("emerge_block"); immerge_block = StaticCString::create("immerge_block"); generate_block = StaticCString::create("generate_block"); + get_used_channels_mask = StaticCString::create("get_used_channels_mask"); u_transition_mask = StaticCString::create("u_transition_mask"); } diff --git a/voxel_string_names.h b/voxel_string_names.h index 42e4a95a..70c8f856 100644 --- a/voxel_string_names.h +++ b/voxel_string_names.h @@ -20,6 +20,7 @@ public: StringName emerge_block; StringName immerge_block; StringName generate_block; + StringName get_used_channels_mask; StringName u_transition_mask; };