17 #include <third_party/box2d/box2d.h> 31 explicit Receptor(
const b2Color& color,
float distance)
32 : color(color), depth(distance) {}
41 Camera(b2Body* body,
float fov,
float near,
float far,
int resolution);
43 vector<Receptor> render()
const;
45 void setPosition(
const b2Vec2& position) { position_ = position; }
46 const b2Vec2& position()
const {
return position_; }
48 void setFilterId(
const void* filter_id) { filter_id_ = filter_id; }
50 b2Body* body()
const {
return body_; }
52 float fov()
const {
return fov_; }
53 float near()
const {
return near_; }
54 float far()
const {
return far_; }
55 int resolution()
const {
return resolution_; }
58 Receptor castRay(
const b2Vec2& ray_start,
59 const b2Vec2& ray_end,
60 float min_fraction)
const;
63 b2Body* body_ =
nullptr;
68 const float near_ = 0;
71 const int resolution_ = 0;
75 float shadow_attenuation_ = 1.0f;
77 bool render_specular_ =
true;
81 b2Color ambient_light_{ 0.2f, 0.2f, 0.2f };
84 b2Vec2 position_{ 0, 0 };
88 const void* filter_id_ =
nullptr;
Raytraced rendering of a 2d world.
Definition: camera.h:39
Definition: accelerometer.cpp:19
A single color & depth "pixel".
Definition: camera.h:25