#include <screen.hpp>
Collaboration diagram for Screen:
Public Types | |
enum | eplane { UNDEFINED = 0, PLANE_XY = 1, PLANE_YZ, PLANE_ZX } |
typedef color3 | color |
Public Member Functions | |
Screen (size_t w, size_t h, prec_t sw, prec_t sh, const color &bg=WHITE) | |
Create screen. | |
Screen (const Screen ©) | |
~Screen () | |
Screen & | operator= (const Screen ©) |
void | clear (const color &c=WHITE) |
void | draw_axes (prec_t interval=0.0, const color &c=BLUE) |
Draw axes onto screen based on the scales. | |
void | set_pixel (size_t x, size_t y, const color &c) |
Set pixel at raster position (x, y) on screen. | |
void | set_pixel (const vect3d &p, const color &c) |
Set pixel on screen at given position p. | |
void | set_pixel_merge (size_t x, size_t y, prec_t factor, const color &c) |
void | translate (const vect3d &p, size_t &out_x, size_t &out_y) |
Translate given position p into raster coordinate (out_x, out_y). | |
void | translate (const vect3d &p, prec_t &out_x, prec_t &out_y, prec_t &out_z) |
Translate given position p into scaled coordinate (x, y) and distance from screen out_z. | |
void | reverse (size_t x, size_t y, vect3d &out_p) |
Translate raster coordinate (x, y) into space coordinate out_p. | |
prec_t | get_dx () |
prec_t | get_dy () |
prec_t | get_dw () |
prec_t | get_dh () |
void | write (const char *path) |
Write screen as window bitmap into given path. | |
void | write (const std::string &path) |
Write screen as window bitmap into given path. | |
prec_t | get_space_width () |
size_t | get_width () const |
size_t | get_height () const |
void | set_axis (eplane plane, prec_t distance=0.0) |
Set axes of the camera to match the given plane. | |
void | set_axis (const vect3d &pos0, const vect3d &xaxix, const vect3d &yaxis) |
Set axes of the camera. | |
void | set_perspective (bool p) |
Set screen into perspective mode. | |
void | set_zbuffer (bool enable) |
Enable zbuffer. | |
void | draw_line (const vect3d &p0, const vect3d &p1, const color &c) |
Draw a generic aliased line. | |
void | draw_cross (const vect3d &p0, const color &c, prec_t len=0.05) |
Draw a cross across all axes. | |
const vect3d & | get_center () const |
Static Public Attributes | |
static const color | WHITE |
static const color | RED |
static const color | GREEN |
static const color | BLUE |
static const color | BLACK |
Definition at line 45 of file screen.hpp.
typedef color3 Screen::color |
Definition at line 48 of file screen.hpp.
enum Screen::eplane |
Create screen.
w | Width of screen in pixels | |
h | Height of screen in pixels | |
sw | Horizontal scale of screen (meters) | |
sh | Vertical scale of screen (meters) |
Screen::Screen | ( | const Screen & | copy | ) |
Screen::~Screen | ( | ) |
Draw axes onto screen based on the scales.
void Screen::set_pixel | ( | size_t | x, | |
size_t | y, | |||
const color & | c | |||
) |
Set pixel at raster position (x, y) on screen.
Set pixel on screen at given position p.
The position is translated into raster coordinates.
void Screen::translate | ( | const vect3d & | p, | |
size_t & | out_x, | |||
size_t & | out_y | |||
) |
Translate given position p into raster coordinate (out_x, out_y).
Translate given position p into scaled coordinate (x, y) and distance from screen out_z.
void Screen::reverse | ( | size_t | x, | |
size_t | y, | |||
vect3d & | out_p | |||
) |
Translate raster coordinate (x, y) into space coordinate out_p.
prec_t Screen::get_dx | ( | ) | [inline] |
Definition at line 87 of file screen.hpp.
prec_t Screen::get_dy | ( | ) | [inline] |
Definition at line 88 of file screen.hpp.
prec_t Screen::get_dw | ( | ) | [inline] |
Definition at line 89 of file screen.hpp.
prec_t Screen::get_dh | ( | ) | [inline] |
Definition at line 90 of file screen.hpp.
void Screen::write | ( | const char * | path | ) |
void Screen::write | ( | const std::string & | path | ) | [inline] |
Write screen as window bitmap into given path.
Definition at line 96 of file screen.hpp.
References write().
prec_t Screen::get_space_width | ( | ) | [inline] |
Definition at line 98 of file screen.hpp.
size_t Screen::get_width | ( | ) | const [inline] |
Definition at line 100 of file screen.hpp.
size_t Screen::get_height | ( | ) | const [inline] |
Definition at line 101 of file screen.hpp.
Set axes of the camera to match the given plane.
Set axes of the camera.
void Screen::set_perspective | ( | bool | p | ) | [inline] |
void Screen::set_zbuffer | ( | bool | enable | ) |
Enable zbuffer.
Draw a generic aliased line.
Draw a cross across all axes.
const vect3d& Screen::get_center | ( | ) | const [inline] |
Definition at line 119 of file screen.hpp.
const color Screen::WHITE [static] |
Definition at line 50 of file screen.hpp.
const color Screen::RED [static] |
Definition at line 51 of file screen.hpp.
const color Screen::GREEN [static] |
Definition at line 52 of file screen.hpp.
const color Screen::BLUE [static] |
Definition at line 53 of file screen.hpp.
const color Screen::BLACK [static] |
Definition at line 54 of file screen.hpp.