|
CeresEngine 0.2.0
A game development framework
|
A simple svg writer class for generating preview and debug images. More...
#include <CeresEngine/Mesh/Generator/SvgWriter.hpp>
Classes | |
| class | BaseElem |
| class | LineElem |
| class | TriangleElem |
| class | VertexElem |
Public Member Functions | |
| SvgWriter (int width, int height) | |
| void | modelView (const Matrix4 &matrix) |
| Sets the model view matrix. Default is the identity matrix. | |
| void | perspective (double fovy, double aspect, double zNear, double zFar) |
| Sets the projection mode to perspective projection. | |
| void | ortho (double left, double right, double bottom, double top) |
| Sets the projection mode to orthographic projection. | |
| 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 Vector3 &p, const Vector3 &color={0.0, 0.0, 0.0}) |
| Write one point. Drawn as a circle. | |
| void | writeLine (const Vector3 &p1, const Vector3 &p2, const Vector3 &color={0.0, 0.0, 0.0}) |
| Write one line. | |
| void | writeTriangle (const Vector3 &p1, const Vector3 &p2, const Vector3 &p3, const Vector3 &color) |
| Write one triangle. | |
| void | writeTriangle (const Vector3 &p1, const Vector3 &p2, const Vector3 &p3) |
| Write one triangle with color automatically calculated from light. | |
| template<typename Shape > | |
| void | writeShape (const Shape &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, const bool writeVertices=false, const bool writeAxis=false) |
| Write all path edges as lines and optionally vertices, tangents, normals and binormals. | |
| template<typename Mesh > | |
| void | writeMesh (const Mesh &mesh, const bool writeVertices=false, const bool writeNormals=false) |
| Write all triangles from a mesh. | |
| std::string | str () const |
| Generates svg xml from the data written so far. | |
Private Member Functions | |
| Vector3 | project (const Vector3 &p) const |
| Vector3 | normalToColor (const Vector3 &normal) const |
Private Attributes | |
| Vector2i | size_ |
| Matrix4 | viewMatrix_ |
| Matrix4 | projMatrix_ |
| Matrix4 | viewProjMatrix_ |
| Vector2i | viewportOrigin_ |
| Vector2i | viewportSize_ |
| Vector3 | lightDir_ |
| bool | cullface_ |
| Vector< UPtr< BaseElem > > | elems_ |
A simple svg writer class for generating preview and debug images.
| width | Width of the image in pixels |
| height | Height of the iamge in pixels |
Sets if backfacing triangles should be culled. Default is true.
Sets the model view matrix. Default is the identity matrix.
|
private |
| void CeresEngine::MeshGenerator::SvgWriter::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. |
| void CeresEngine::MeshGenerator::SvgWriter::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) |
| std::string CeresEngine::MeshGenerator::SvgWriter::str | ( | ) | const |
Generates svg xml from the data written so far.
Sets the viewport. Default fills the whole image.
| void CeresEngine::MeshGenerator::SvgWriter::writeLine | ( | const Vector3 & | p1, |
| const Vector3 & | p2, | ||
| const Vector3 & | color = {0.0, 0.0, 0.0} |
||
| ) |
Write one line.
|
inline |
Write all triangles from a mesh.
|
inline |
Write all path edges as lines and optionally vertices, tangents, normals and binormals.
| void CeresEngine::MeshGenerator::SvgWriter::writePoint | ( | const Vector3 & | p, |
| const Vector3 & | color = {0.0, 0.0, 0.0} |
||
| ) |
Write one point. Drawn as a circle.
|
inline |
Write all shaped edges and optionally vertices, tangents and normals.
| void CeresEngine::MeshGenerator::SvgWriter::writeTriangle | ( | const Vector3 & | p1, |
| const Vector3 & | p2, | ||
| const Vector3 & | p3 | ||
| ) |
Write one triangle with color automatically calculated from light.
| void CeresEngine::MeshGenerator::SvgWriter::writeTriangle | ( | const Vector3 & | p1, |
| const Vector3 & | p2, | ||
| const Vector3 & | p3, | ||
| const Vector3 & | color | ||
| ) |
Write one triangle.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |