Skip to content

Commit 2693964

Browse files
authored
Merge pull request #35 from cullvox/master
Add noise based wind
2 parents a8de617 + f087035 commit 2693964

16 files changed

+906
-15
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ compile_commands.json
1212
*.dylib
1313
*.o
1414
*.wasm
15+
*.obj
16+
*.pdb
17+
*.lib
18+
*.exp
1519

1620
# Godot-specific ignores
1721
.godot/
@@ -25,3 +29,5 @@ export_presets.cfg
2529
# Mono-specific ignores
2630
.mono/
2731
data_*/
32+
33+
src/gen/*

SConstruct

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ opts.Update(env)
2626
# - CPPDEFINES are for pre-processor defines
2727
# - LINKFLAGS are for linking flags
2828

29-
env.Append(CCFLAGS="-fdiagnostics-color")
29+
if os.name == "posix":
30+
env.Append(CCFLAGS="-fdiagnostics-color")
3031

3132

3233
scons_cache_path = os.environ.get("SCONS_CACHE")
@@ -40,6 +41,13 @@ if scons_cache_path:
4041
env.Append(CPPPATH=["src/"])
4142
sources = Glob("src/*.cpp")
4243

44+
# Docs
45+
if env["target"] in ["editor", "template_debug"]:
46+
try:
47+
doc_data = env.GodotCPPDocData("src/gen/doc_data.gen.cpp", source=Glob("doc_classes/*.xml"))
48+
sources.append(doc_data)
49+
except AttributeError:
50+
print("Not including class reference as we're targeting a pre-4.3 baseline.")
4351

4452
# Build
4553
if env["platform"] == "macos":
@@ -51,4 +59,6 @@ if env["platform"] == "macos":
5159
else:
5260
library = env.SharedLibrary(f"{TARGET_PATH}{env['suffix']}{env['SHLIBSUFFIX']}", source=sources)
5361

62+
63+
5464
Default(library)

compile_debug.bat

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@echo off
2+
setlocal
3+
4+
set SCONS_CACHE=%CD%\.scons_cache_debug
5+
6+
scons compiledb=yes optimize=debug debug_symbols=yes %*
7+
8+
:: platform=web threads=no
9+
10+
endlocal

compile_release.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
3+
scons optimize=speed target=template_release %*

demo/addons/ropesim/Rope.gd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ signal on_point_count_changed()
3030
## significantly by providing more segments at the beginning and less segments to the end.
3131
@export var segment_length_distribution: Curve: set = _set_seg_dist
3232

33+
@export_group("Forces")
34+
3335
## Stiffness forces the rope to return to its resting position.
3436
## The resting direction is downwards and affected by the the node's rotation.
3537
## Might not produce 100% realistic results with fixed points.
@@ -41,6 +43,9 @@ signal on_point_count_changed()
4143
## Gravity direction. Will not be normalized.
4244
@export var gravity_direction: Vector2 = Vector2.DOWN
4345

46+
## Optional parameters for wind simulation.
47+
@export var wind: RopeWindParameters
48+
4449
## Dampens the velocity of the rope.
4550
@export var damping: float = 0
4651

demo/addons/ropesim/libropesim.gdextension

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[configuration]
22

33
entry_symbol = "libropesim_init"
4-
compatibility_minimum = "4.2"
4+
compatibility_minimum = "4.3"
55

66
[libraries]
77

demo/rope_examples/wind.tscn

Lines changed: 616 additions & 0 deletions
Large diffs are not rendered by default.

doc_classes/NativeRopeServer.xml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<class name="NativeRopeServer" inherits="Object" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/godotengine/godot/master/doc/class.xsd">
3+
<brief_description>
4+
</brief_description>
5+
<description>
6+
</description>
7+
<tutorials>
8+
</tutorials>
9+
<methods>
10+
<method name="get_computation_time" qualifiers="const">
11+
<return type="float" />
12+
<description>
13+
</description>
14+
</method>
15+
<method name="get_num_ropes" qualifiers="const">
16+
<return type="int" />
17+
<description>
18+
</description>
19+
</method>
20+
<method name="register_rope">
21+
<return type="void" />
22+
<param index="0" name="rope" type="Node2D" />
23+
<description>
24+
</description>
25+
</method>
26+
<method name="unregister_rope">
27+
<return type="void" />
28+
<param index="0" name="rope" type="Node2D" />
29+
<description>
30+
</description>
31+
</method>
32+
</methods>
33+
<members>
34+
<member name="update_in_editor" type="bool" setter="set_update_in_editor" getter="get_update_in_editor" default="false">
35+
</member>
36+
</members>
37+
<signals>
38+
<signal name="on_post_post_update">
39+
<description>
40+
</description>
41+
</signal>
42+
<signal name="on_post_update">
43+
<description>
44+
</description>
45+
</signal>
46+
<signal name="on_pre_pre_update">
47+
<description>
48+
</description>
49+
</signal>
50+
<signal name="on_pre_update">
51+
<description>
52+
</description>
53+
</signal>
54+
</signals>
55+
</class>

doc_classes/RopeWindParameters.xml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<class name="RopeWindParameters" inherits="Resource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/godotengine/godot/master/doc/class.xsd">
3+
<brief_description>
4+
Data for rope wind.
5+
</brief_description>
6+
<description>
7+
</description>
8+
<tutorials>
9+
</tutorials>
10+
<members>
11+
<member name="direction" type="float" setter="set_direction" getter="get_direction" default="0.0">
12+
The angle the wind force is pushing the rope.
13+
</member>
14+
<member name="noise" type="FastNoiseLite" setter="set_noise" getter="get_noise">
15+
Noise function used when generating oscillating wind forces.
16+
</member>
17+
<member name="oscillation_strength" type="float" setter="set_oscillation_strength" getter="get_oscillation_strength" default="0.0">
18+
Amplitude of oscillations in the wind noise. Higher values increase the oscillations perpendicular to the wind direction.
19+
</member>
20+
<member name="wind_strength" type="float" setter="set_wind_strength" getter="get_wind_strength" default="0.0">
21+
How taut the wind force is pulling the rope. Lower values allow the noise to move easier, higher can straighten the rope out even with high noise oscillation strength.
22+
</member>
23+
<member name="enable_wind" type="bool" setter="set_wind_enabled" getter="get_wind_enabled" default="true">
24+
Enables or disables wind for all ropes who reference this resource.
25+
</member>
26+
</members>
27+
</class>

godot-cpp

Submodule godot-cpp updated 67 files

0 commit comments

Comments
 (0)