Skip to content

Commit a4e9cce

Browse files
author
Thais Malheiros Assumpcao
committed
Merge branch 'develop' of github.com:Chrystian-Natanael/MiniRT into develop
2 parents 09387e0 + 50f848f commit a4e9cce

File tree

11 files changed

+53
-58
lines changed

11 files changed

+53
-58
lines changed

includes/Parser.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/* By: cnatanae <[email protected]> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2025/01/22 14:57:54 by tmalheir #+# #+# */
9-
/* Updated: 2025/02/06 13:35:41 by cnatanae ### ########.fr */
9+
/* Updated: 2025/02/06 15:43:44 by cnatanae ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

@@ -49,6 +49,7 @@ bool parse_sphere(char *line, t_world *world);
4949
bool parse_plane(char *line, t_world *world);
5050
void set_plane(t_obj **pl, char *pos, char *norm, char *col);
5151
t_matrix rotate_mtx(double *pos, double *norm, t_obj **obj);
52+
t_matrix get_matrix(t_matrix scale, t_matrix rotate, t_matrix translate);
5253

5354
int sign(int number);
5455
t_matrix get_rot_matrix(double x, double z);

tests/my_tests/Tests_Colors.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@ class FixtureColor : public ::testing::Test
1515

1616
void SetUp() override
1717
{
18-
init_pools();
1918
set = get_pool();
19+
set->the_pool = create_pool(500000);
2020
}
2121

2222
void TearDown() override
2323
{
24-
deallocate(set->mem);
25-
deallocate(set);
24+
deallocate(set->the_pool);
2625
}
2726
};
2827

tests/my_tests/Tests_Intersection.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ class FixtureInter : public ::testing::Test {
1515
protected:
1616
t_pool_set *set;
1717

18-
void SetUp() override {
19-
init_pools();
18+
void SetUp() override
19+
{
2020
set = get_pool();
21+
set->the_pool = create_pool(500000);
2122
}
2223

23-
void TearDown() override {
24-
deallocate(set->mem);
25-
deallocate(set);
24+
void TearDown() override
25+
{
26+
deallocate(set->the_pool);
2627
}
2728
};
2829

tests/my_tests/Tests_Light_And_Shading.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@ class FixtureLight : public ::testing::Test
1515

1616
void SetUp() override
1717
{
18-
init_pools();
1918
set = get_pool();
19+
set->the_pool = create_pool(500000);
2020
}
2121

2222
void TearDown() override
2323
{
24-
deallocate(set->mem);
25-
deallocate(set);
24+
deallocate(set->the_pool);
2625
}
2726
};
2827

tests/my_tests/Tests_Making_a_Scene.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,13 @@ class FixtureWorld : public ::testing::Test
1818

1919
void SetUp() override
2020
{
21-
init_pools();
2221
set = get_pool();
22+
set->the_pool = create_pool(500000);
2323
}
2424

2525
void TearDown() override
2626
{
27-
deallocate(set->mem);
28-
deallocate(set);
27+
deallocate(set->the_pool);
2928
}
3029
};
3130

@@ -394,7 +393,7 @@ TEST_F(FixtureWorld, ShadeHitIsGivenAnIntersectionInShadow)
394393
{
395394
t_world *w = world();
396395

397-
w->lights_lst = (t_lights *)alloc_pool(sizeof(t_lights), set->colors);
396+
w->lights_lst = (t_lights *)alloc_pool(sizeof(t_lights), set->the_pool);
398397
w->lights_lst->light_src = pt_light(point(0, 0, -10), create_color(1, 1, 1));
399398

400399
create_obj_lst(w, SPHERE);

tests/my_tests/Tests_Matrix.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@ class FixtureMatrix : public ::testing::Test {
1212
protected:
1313
t_pool_set *set;
1414

15-
void SetUp() override {
16-
init_pools();
15+
void SetUp() override
16+
{
1717
set = get_pool();
18+
set->the_pool = create_pool(500000);
1819
}
1920

20-
void TearDown() override {
21-
deallocate(set->mem);
22-
deallocate(set);
21+
void TearDown() override
22+
{
23+
deallocate(set->the_pool);
2324
}
2425
};
2526

tests/my_tests/Tests_Obj.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ class FixtureObj : public ::testing::Test {
1515
protected:
1616
t_pool_set *set;
1717

18-
void SetUp() override {
19-
init_pools();
18+
void SetUp() override
19+
{
2020
set = get_pool();
21+
set->the_pool = create_pool(500000);
2122
}
2223

23-
void TearDown() override {
24-
deallocate(set->mem);
25-
deallocate(set);
24+
void TearDown() override
25+
{
26+
deallocate(set->the_pool);
2627
}
2728
};
2829

@@ -45,7 +46,7 @@ TEST_F(FixtureObj, NormalOfPlaneIsConstantEverywhere) {
4546
EXPECT_TRUE(equal(n2[X], expected_normal[X]));
4647
EXPECT_TRUE(equal(n2[Y], expected_normal[Y]));
4748
EXPECT_TRUE(equal(n2[Z], expected_normal[Z]));
48-
49+
4950
EXPECT_TRUE(equal(n3[X], expected_normal[X]));
5051
EXPECT_TRUE(equal(n3[Y], expected_normal[Y]));
5152
EXPECT_TRUE(equal(n3[Z], expected_normal[Z]));

tests/my_tests/Tests_Parsing.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,24 @@ class FixtureTest : public ::testing::Test {
1616
protected:
1717
t_pool_set *set;
1818

19-
void SetUp() override {
20-
init_pools();
19+
void SetUp() override
20+
{
2121
set = get_pool();
22+
set->the_pool = create_pool(500000);
2223
}
2324

24-
void TearDown() override {
25-
deallocate(set->mem);
26-
deallocate(set);
25+
void TearDown() override
26+
{
27+
deallocate(set->the_pool);
2728
}
2829
};
2930

3031
TEST_F(FixtureTest, ParseSphere) {
3132
t_world *wld = world();
32-
set_scene(wld);
33+
wld->scene.has_ambient = 0;
34+
wld->scene.has_camera = 0;
35+
wld->scene.has_light = 0;
36+
wld->scene.save_img = false;
3337

3438
char line[] = "sp 0.0,0.0,20.6 12.6 10,0,255";
3539
bool result = parse_sphere(line, wld);
@@ -44,10 +48,7 @@ TEST_F(FixtureTest, ParseSphere) {
4448
double expected_scale = 12.6 / 2;
4549
double expected_color[3] = {10.0 / 255.0, 0.0, 255.0 / 255.0};
4650

47-
t_matrix expected_transformation = multiply_mtx(
48-
scale(expected_scale, expected_scale, expected_scale),
49-
translate(expected_pos[0], expected_pos[1], expected_pos[2])
50-
);
51+
t_matrix expected_transformation = rotate_mtx(expected_pos, point(0, 1, 0), &sphere);
5152

5253
for (int i = 0; i < 16; ++i) {
5354
EXPECT_TRUE(equal(sphere->shape->transf.content[i], expected_transformation.content[i]));

tests/my_tests/Tests_Patterns.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,13 @@ class FixturePatterns : public ::testing::Test
2020

2121
void SetUp() override
2222
{
23-
init_pools();
2423
set = get_pool();
24+
set->the_pool = create_pool(500000);
2525
}
2626

2727
void TearDown() override
2828
{
29-
deallocate(set->mem);
30-
deallocate(set);
29+
deallocate(set->the_pool);
3130
}
3231
};
3332

tests/my_tests/Tests_Transformation.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@ class FixtureTransf : public ::testing::Test {
1313
protected:
1414
t_pool_set *set;
1515

16-
void SetUp() override {
17-
init_pools();
16+
void SetUp() override
17+
{
1818
set = get_pool();
19+
set->the_pool = create_pool(500000);
1920
}
2021

21-
void TearDown() override {
22-
deallocate(set->mem);
23-
deallocate(set);
22+
void TearDown() override
23+
{
24+
deallocate(set->the_pool);
2425
}
2526
};
2627

0 commit comments

Comments
 (0)