props_2d/README.md

102 lines
3.1 KiB
Markdown
Raw Normal View History

2022-02-21 22:12:25 +01:00
# Prop2Ds Module
2021-11-23 16:53:47 +01:00
This is a c++ engine module for the Godot Engine.
It gives you props, and editor utilities to convert scenes to props.
2023-01-09 21:02:15 +01:00
## Godot Version Support
This branch tries to follow godot's master branch (as much as I have time).
For different godot versions look at the other branches.
Status for this branch: Update for 4.0 is work in progress.
2021-11-23 16:53:47 +01:00
# Pre-built binaries
You can grab a pre-built editor binary from the [Broken Seals](https://github.com/Relintai/broken_seals/releases)
repo, should you want to. It contains all my modules.
# Optional Dependencies
[Mesh Data Resource](https://github.com/Relintai/mesh_data_resource): Support for merged meshes, even in gles2.\
2022-02-21 22:12:25 +01:00
[Texture Packer](https://github.com/Relintai/texture_packer): Prop2D Instance will use this to merge textures.\
[Thread Pool](https://github.com/Relintai/thread_pool): Prop2D Instance will use this for multithreaded generation.
2021-11-23 16:53:47 +01:00
2022-02-21 22:12:25 +01:00
# Prop2DData
2021-11-23 16:53:47 +01:00
2022-02-21 22:12:25 +01:00
Prop2Ds are basicly 3D scenes in a simple format, so other things can easily process them without instancing.
2021-11-23 16:53:47 +01:00
For example if you create a building from MeshDataInstances, and then convert that scene to a prop, Voxelman
can spawn it, merge it's meshes, and create lods without any scene instancing.
2022-02-21 22:12:25 +01:00
Prop2DData is the main class you'll use, it's main purpose it to store a list of Prop2DDataEntries.
2021-11-23 16:53:47 +01:00
2022-02-21 22:12:25 +01:00
# Prop2DDataEntries
2021-11-23 16:53:47 +01:00
These are the classes that actually store data.
They contain 4 methods for scene->prop conversion, namely:
```
2022-02-21 22:12:25 +01:00
//Whether or not this Prop2DDataEntry can process the given Node.
2021-11-23 16:53:47 +01:00
virtual bool _processor_handles(Node *node);
//Save the given Node into the given prop_data any way you like, at tranform.
2022-02-21 22:12:25 +01:00
virtual void _processor_process(Ref<Prop2DData> prop_data, Node *node, const Transform &transform);
2021-11-23 16:53:47 +01:00
2022-02-21 22:12:25 +01:00
//Turn Prop2DDataEntry back into a Node
2021-11-23 16:53:47 +01:00
virtual Node *_processor_get_node_for(const Transform &transform);
2022-02-21 22:12:25 +01:00
//Whether the system should skip evaluating the children of a processes Node or not. See Prop2DDataScene, or Prop2DDataProp2D.
2021-11-23 16:53:47 +01:00
virtual bool _processor_evaluate_children();
```
2022-02-21 22:12:25 +01:00
# Prop2DInstances
2021-11-23 16:53:47 +01:00
2022-02-21 22:12:25 +01:00
Prop2DInstances are not yet finished.
2021-11-23 16:53:47 +01:00
2022-02-21 22:12:25 +01:00
They will be able to merge meshes, texture etc from a Prop2D, and also generate lods for it.
2021-11-23 16:53:47 +01:00
Essentially they will be a more advanced MeshInstance.
Voxelman implements all of this, just haven't finished porting it yet.
2022-02-21 22:12:25 +01:00
# Prop2DUtils Singleton
2021-11-23 16:53:47 +01:00
2022-02-21 22:12:25 +01:00
The Prop2DUtils singleton helps with scene->prop conversion.
2021-11-23 16:53:47 +01:00
2022-02-21 22:12:25 +01:00
You can register new Prop2DDataEntries as processors, should you need to.
2021-11-23 16:53:47 +01:00
# Scene conversion
2022-02-21 22:12:25 +01:00
You can either click the new "To Prop2D" button on the menubar of the 3D scene for a quick conversion,
2021-11-23 16:53:47 +01:00
or look into Project->Tools.
# Building
1. Get the source code for the engine.
If you want Godot 3.2:
```git clone -b 3.2 https://github.com/godotengine/godot.git godot```
If you want Godot 4.0:
```git clone https://github.com/godotengine/godot.git godot```
2. Go into Godot's modules directory.
```
cd ./godot/modules/
```
3. Clone this repository
```
git clone https://github.com/Relintai/props props
```
4. Build Godot. [Tutorial](https://docs.godotengine.org/en/latest/development/compiling/index.html)