Skip to content

Commit 8bfb5d7

Browse files
committed
Use LocalVector for Curve and Gradient
1 parent 76c8e76 commit 8bfb5d7

File tree

7 files changed

+141
-149
lines changed

7 files changed

+141
-149
lines changed

modules/noise/tests/test_noise_texture_2d.h

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,11 @@ TEST_CASE("[NoiseTexture2D][SceneTree] Generating a basic noise texture with mip
200200
noise_texture->set_noise(noise);
201201

202202
Ref<Gradient> gradient = memnew(Gradient);
203-
Vector<Gradient::Point> points;
204-
points.push_back({ 0.0, Color(1, 0, 0) });
205-
points.push_back({ 1.0, Color(0, 0, 1) });
206-
gradient->set_points(points);
203+
Vector<float> offsets = { 0.0, 1.0 };
204+
Vector<Color> colors = { Color(1, 0, 0), Color(0, 0, 1) };
205+
gradient->set_offsets(offsets);
206+
gradient->set_colors(colors);
207+
207208
noise_texture->set_color_ramp(gradient);
208209
noise_texture->set_width(16);
209210
noise_texture->set_height(16);
@@ -251,10 +252,12 @@ TEST_CASE("[NoiseTexture2D][SceneTree] Generating a seamless noise texture") {
251252

252253
SUBCASE("16x16 modulated with default (transparent)black and white gradient (RGBA8), with seamless blend skirt of 1.0") {
253254
Ref<Gradient> gradient = memnew(Gradient);
254-
Vector<Gradient::Point> points;
255-
points.push_back({ 0.0, Color(0, 0, 0, 0) });
256-
points.push_back({ 1.0, Color(1, 1, 1, 1) });
257-
gradient->set_points(points);
255+
256+
Vector<float> offsets = { 0.0, 1.0 };
257+
Vector<Color> colors = { Color(0, 0, 0, 0), Color(1, 1, 1, 1) };
258+
gradient->set_offsets(offsets);
259+
gradient->set_colors(colors);
260+
258261
noise_texture->set_color_ramp(gradient);
259262
noise_texture->set_seamless_blend_skirt(1.0);
260263
noise_texture->connect_changed(callable_mp(tester.ptr(), &NoiseTextureTester::check_seamless_texture_rgba));

modules/noise/tests/test_noise_texture_3d.h

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,11 @@ TEST_CASE("[NoiseTexture3D][SceneTree] Generating a basic noise texture with mip
184184
noise_texture->set_noise(noise);
185185

186186
Ref<Gradient> gradient = memnew(Gradient);
187-
Vector<Gradient::Point> points;
188-
points.push_back({ 0.0, Color(1, 0, 0) });
189-
points.push_back({ 1.0, Color(0, 0, 1) });
190-
gradient->set_points(points);
187+
Vector<float> offsets = { 0.0, 1.0 };
188+
Vector<Color> colors = { Color(1, 0, 0), Color(0, 0, 1) };
189+
gradient->set_offsets(offsets);
190+
gradient->set_colors(colors);
191+
191192
noise_texture->set_color_ramp(gradient);
192193
noise_texture->set_width(16);
193194
noise_texture->set_height(16);
@@ -219,10 +220,12 @@ TEST_CASE("[NoiseTexture3D][SceneTree] Generating a seamless noise texture") {
219220

220221
SUBCASE("16x16x16 modulated with default (transparent)black and white gradient (RGBA8), with seamless blend skirt of 1.0") {
221222
Ref<Gradient> gradient = memnew(Gradient);
222-
Vector<Gradient::Point> points;
223-
points.push_back({ 0.0, Color(0, 0, 0, 0) });
224-
points.push_back({ 1.0, Color(1, 1, 1, 1) });
225-
gradient->set_points(points);
223+
224+
Vector<float> offsets = { 0.0, 1.0 };
225+
Vector<Color> colors = { Color(0, 0, 0, 0), Color(1, 1, 1, 1) };
226+
gradient->set_offsets(offsets);
227+
gradient->set_colors(colors);
228+
226229
noise_texture->set_color_ramp(gradient);
227230
noise_texture->set_seamless_blend_skirt(1.0);
228231
noise_texture->connect_changed(callable_mp(tester.ptr(), &NoiseTexture3DTester::check_seamless_texture_rgba));

0 commit comments

Comments
 (0)