Skip to content

Commit 97e4a73

Browse files
committed
Revert tri, ellipse, annulus primitives
This reverts commit b0fbca7b0c6c4e77491b1bbebc6ed5fe939d912e. Removing these primitives, since we will not be using them. This change also removes the temporary test scene for quads. Resolves #292 Resolves #662 Resolves #681 Resolves #756 Resolves #780
1 parent f5b4153 commit 97e4a73

File tree

3 files changed

+7
-112
lines changed

3 files changed

+7
-112
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ Change Log -- Ray Tracing in One Weekend
2323
- Change: hittable::bounding_box() signature has changed to always return a value (#859)
2424
- Fix: Enabled compiler warnings for MSVC, Clang, GNU. Cleaned up warnings as fit (#865)
2525
- Change: replaced random vector in `isotropic` with `random_unit_vector`
26+
- Delete: `box`, `xy_rect`, `yz_rect`, `xz_rect` classes. Now replaced with new `quad` primitive
27+
(#292, #780, #681)
28+
- Fix: rect hit returning NaNs and infinities. Superseded with new `quad` primitive (#681)
29+
- Added: New 2D `quad` primitive of arbitrary orientation (#756)
30+
- Added: New `box()` utility function returns `hittable_list` of new `quad` primitives (#780)
2631

2732
### In One Weekend
2833
- Added: More commentary about the choice between `double` and `float` (#752)
@@ -35,7 +40,7 @@ Change Log -- Ray Tracing in One Weekend
3540
- Change: Broad rewrite of time management for moving objects, primarily `camera` and
3641
`moving_sphere`, but also impacting the API for `hittable::bounding_box()` (#799)
3742
- Fix: Fixed `bvh_node` constructor definition signature (#872)
38-
- Fix: Fixed scaling for final Perlin noise texture (#896).
43+
- Fix: Fixed scaling for final Perlin noise texture (#896).
3944

4045
### The Rest of Your Life
4146
- Fix: Added missing functionality for `isotropic` (#664)

src/TheNextWeek/main.cc

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -318,56 +318,14 @@ void default_scene(scene& scene_desc) {
318318
}
319319

320320

321-
void quad_test(scene& scene_desc) {
322-
scene_desc.image_width = 400;
323-
scene_desc.aspect_ratio = 1.0;
324-
scene_desc.samples_per_pixel = 4;
325-
scene_desc.max_depth = 4;
326-
327-
scene_desc.cam.aperture = 0.0;
328-
scene_desc.cam.vfov = 20.0;
329-
scene_desc.cam.lookfrom = point3(0,0,12);
330-
scene_desc.cam.lookat = point3(0,0,0);
331-
332-
scene_desc.background = color(0.90, 0.90, 0.90);
333-
334-
auto earth_texture = make_shared<image_texture>("earthmap.jpg");
335-
auto mat = make_shared<lambertian>(earth_texture);
336-
337-
shared_ptr<hittable> thing;
338-
switch (0) {
339-
default:
340-
case 0:
341-
thing = make_shared<quad>(point3(-2,-1,0), vec3(4,0,0), vec3(0,2,0), mat);
342-
break;
343-
case 1:
344-
scene_desc.cam.vfov = 30.0;
345-
scene_desc.cam.lookat = point3(1,0,0);
346-
thing = make_shared<quad>(point3(-2,-1,0), vec3(4,0,0), vec3(2,2,0), mat);
347-
break;
348-
case 2:
349-
thing = make_shared<tri>(point3(-2,-1,0), vec3(4,0,0), vec3(0,2,0), mat);
350-
break;
351-
case 3:
352-
thing = make_shared<ellipse>(point3(0,0,0), vec3(2,0,0), vec3(0,1,0), mat);
353-
break;
354-
case 4:
355-
thing = make_shared<annulus>(point3(0,0,0), vec3(2,0,0), vec3(0,1,0), 0.60, mat);
356-
break;
357-
}
358-
359-
scene_desc.world.add(thing);
360-
}
361-
362-
363321
int main() {
364322
scene scene_desc;
365323

366324
scene_desc.background = color(0.70, 0.80, 1.00);
367325
scene_desc.cam.vup = vec3(0,1,0);
368326
scene_desc.cam.focus_dist = 10.0;
369327

370-
switch (100) {
328+
switch (0) {
371329
case 1: random_spheres(scene_desc); break;
372330
case 2: two_spheres(scene_desc); break;
373331
case 3: earth(scene_desc); break;
@@ -378,8 +336,6 @@ int main() {
378336
case 8: final_scene(scene_desc); break;
379337
default:
380338
case 9: default_scene(scene_desc); break;
381-
382-
case 100: quad_test(scene_desc); break;
383339
}
384340

385341
scene_desc.render();

src/TheNextWeek/quad.h

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -113,70 +113,4 @@ inline shared_ptr<hittable_list> box(const point3& a, const point3& b, shared_pt
113113
}
114114

115115

116-
class tri : public quad {
117-
public:
118-
tri(const point3& o, const vec3& aa, const vec3& ab, shared_ptr<material> m)
119-
: quad(o, aa, ab, m)
120-
{}
121-
122-
virtual bool hit_ab(double a, double b, hit_record& rec) const override {
123-
if ((a < 0) || (b < 0) || (a + b > 1))
124-
return false;
125-
126-
rec.u = a;
127-
rec.v = b;
128-
return true;
129-
}
130-
};
131-
132-
133-
class ellipse : public quad {
134-
public:
135-
ellipse(
136-
const point3& center, const vec3& side_A, const vec3& side_B, shared_ptr<material> m
137-
) : quad(center, side_A, side_B, m)
138-
{}
139-
140-
virtual void set_bounding_box() override {
141-
bbox = aabb(plane_origin - axis_A - axis_B, plane_origin + axis_A + axis_B).pad();
142-
}
143-
144-
virtual bool hit_ab(double a, double b, hit_record& rec) const override {
145-
if ((a*a + b*b) > 1)
146-
return false;
147-
148-
rec.u = a/2 + 0.5;
149-
rec.v = b/2 + 0.5;
150-
return true;
151-
}
152-
};
153-
154-
155-
class annulus : public quad {
156-
public:
157-
annulus(
158-
const point3& center, const vec3& side_A, const vec3& side_B, double _inner,
159-
shared_ptr<material> m)
160-
: quad(center, side_A, side_B, m), inner(_inner)
161-
{}
162-
163-
virtual void set_bounding_box() override {
164-
bbox = aabb(plane_origin - axis_A - axis_B, plane_origin + axis_A + axis_B).pad();
165-
}
166-
167-
virtual bool hit_ab(double a, double b, hit_record& rec) const override {
168-
auto center_dist = sqrt(a*a + b*b);
169-
if ((center_dist < inner) || (center_dist > 1))
170-
return false;
171-
172-
rec.u = a/2 + 0.5;
173-
rec.v = b/2 + 0.5;
174-
return true;
175-
}
176-
177-
private:
178-
double inner;
179-
};
180-
181-
182116
#endif

0 commit comments

Comments
 (0)