Unravel Engine C++ Reference
|
A simple svg writer class for generating preview and debug images. More...
#include <svg_writer.hpp>
Public Member Functions | |
svg_writer_t (int width, int height) | |
void | modelView (const gml::dmat4 &matrix) |
Sets the model view matrix. Default is the identity matrix. | |
void | perspective (double fovy, double aspect, double zNear, double zFar) |
void | ortho (double left, double right, double bottom, double top) |
void | viewport (int x, int y, int width, int height) |
Sets the viewport. Default fills the whole image. | |
void | cullface (bool cullface) |
Sets if backfacing triangles should be culled. Default is true. | |
void | writePoint (const gml::dvec3 &p, const gml::dvec3 &color={0.0, 0.0, 0.0}) |
Write one point. Drawn as a circle. | |
void | writeLine (const gml::dvec3 &p1, const gml::dvec3 &p2, const gml::dvec3 &color={0.0, 0.0, 0.0}) |
Write one line. | |
void | writeTriangle (const gml::dvec3 &p1, const gml::dvec3 &p2, const gml::dvec3 &p3, const gml::dvec3 &color) |
Write one triangle. | |
void | writeTriangle (const gml::dvec3 &p1, const gml::dvec3 &p2, const gml::dvec3 &p3) |
Write one triangle with color automatically calculated from light. | |
template<typename shape_t > | |
void | writeShape (const shape_t &shape, bool writeVertices=false, bool writeAxis=false) |
Write all shaped edges and optionally vertices, tangents and normals. | |
template<typename Path > | |
void | writePath (const Path &path, bool writeVertices=false, bool writeAxis=false) |
template<typename Mesh > | |
void | writeMesh (const Mesh &mesh, bool writeVertices=false, bool writeNormals=false) |
Write all triangles from a mesh. | |
std::string | str () const |
Generates svg xml from the data written so far. | |
A simple svg writer class for generating preview and debug images.
Definition at line 23 of file svg_writer.hpp.
svg_writer_t::svg_writer_t | ( | int | width, |
int | height ) |
width | Width of the image in pixels |
height | Height of the iamge in pixels |
Definition at line 98 of file svg_writer.cpp.
void svg_writer_t::cullface | ( | bool | cullface | ) |
Sets if backfacing triangles should be culled. Default is true.
Definition at line 136 of file svg_writer.cpp.
void svg_writer_t::modelView | ( | const gml::dmat4 & | matrix | ) |
Sets the model view matrix. Default is the identity matrix.
Definition at line 112 of file svg_writer.cpp.
void svg_writer_t::ortho | ( | double | left, |
double | right, | ||
double | bottom, | ||
double | top ) |
Sets the projection mode to orthographic projection. This is the default.
left | Coordinate that maps to the left edge. |
right | Coordinate that maps to the right edge. |
Definition at line 124 of file svg_writer.cpp.
void svg_writer_t::perspective | ( | double | fovy, |
double | aspect, | ||
double | zNear, | ||
double | zFar ) |
Sets the projection mode to perspective projection. Default is the orthographic.
fovy | Field of view along the y-axis. |
aspect | aspect ratio (should usually match the vieport) |
Definition at line 118 of file svg_writer.cpp.
std::string svg_writer_t::str | ( | ) | const |
Generates svg xml from the data written so far.
Definition at line 176 of file svg_writer.cpp.
void svg_writer_t::viewport | ( | int | x, |
int | y, | ||
int | width, | ||
int | height ) |
Sets the viewport. Default fills the whole image.
Definition at line 130 of file svg_writer.cpp.
void svg_writer_t::writeLine | ( | const gml::dvec3 & | p1, |
const gml::dvec3 & | p2, | ||
const gml::dvec3 & | color = {0.0, 0.0, 0.0} ) |
Write one line.
Definition at line 146 of file svg_writer.cpp.
|
inline |
Write all triangles from a mesh.
Definition at line 204 of file svg_writer.hpp.
|
inline |
Write all path edges as lines and optionally vertices, tangents, normals and binormals.
Definition at line 170 of file svg_writer.hpp.
void svg_writer_t::writePoint | ( | const gml::dvec3 & | p, |
const gml::dvec3 & | color = {0.0, 0.0, 0.0} ) |
Write one point. Drawn as a circle.
Definition at line 141 of file svg_writer.cpp.
|
inline |
Write all shaped edges and optionally vertices, tangents and normals.
Definition at line 129 of file svg_writer.hpp.
void svg_writer_t::writeTriangle | ( | const gml::dvec3 & | p1, |
const gml::dvec3 & | p2, | ||
const gml::dvec3 & | p3 ) |
Write one triangle with color automatically calculated from light.
Definition at line 171 of file svg_writer.cpp.
void svg_writer_t::writeTriangle | ( | const gml::dvec3 & | p1, |
const gml::dvec3 & | p2, | ||
const gml::dvec3 & | p3, | ||
const gml::dvec3 & | color ) |
Write one triangle.
Definition at line 153 of file svg_writer.cpp.