blob: 221e5fe8210b5148cda6e2a70a41f5838eba11f5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
/******************************************************************/
/* This file is part of the homework assignments for CSCI-427/527 */
/* at The College of William & Mary and authored by Pieter Peers. */
/* No part of this file, whether altered or in original form, can */
/* be distributed or used outside the context of CSCI-427/527 */
/* without consent of either the College of William & Mary or */
/* Pieter Peers. */
/******************************************************************/
#ifndef _LINEAR_INTERSECTOR_H_
#define _LINEAR_INTERSECTOR_H_
#include <memory>
#include "boundedPrimitive.h"
#include "intersector_base.h"
#include "intersector_factory_base.h"
class linear_intersector : public intersector_base {
public:
//////////////////
// Constructors //
//////////////////
linear_intersector(void);
linear_intersector(const std::vector<std::shared_ptr<const boundedPrimitive>>& compounds);
linear_intersector(const linear_intersector&) = delete;
///////////////
// Operators //
///////////////
linear_intersector& operator=(const linear_intersector&) = delete;
/////////////
// Methods //
/////////////
virtual intersectionPoint intersect(const ray& r) const final override;
private:
//////////////////
// Data Members //
//////////////////
std::vector<std::shared_ptr<const boundedPrimitive>> _compounds;
};
class linear_intersector_factory : public intersector_factory_base {
public:
/////////////////
// Constructor //
/////////////////
linear_intersector_factory(void) {}
///////////////
// Operators //
///////////////
std::unique_ptr<const intersector_base> operator()(const boundedCompound& boundedCompound) const final override
{
return std::unique_ptr<const intersector_base>(new linear_intersector(boundedCompound.compounds()));
}
};
#endif /* _LINEAR_INTERSECTOR_H_ */
|