eos 1.4.0
Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations | Functions
eos::render Namespace Reference

Software rendering and texture extraction functionality. More...

Classes

class  ExtractionFragmentShader
 A fragment shader that is used to extract, or remap, texture from an image to a UV map (i.e. the reverse process of texturing). More...
 
class  Rasterizer
 Todo. More...
 
class  SoftwareRenderer
 X. More...
 
class  Texture
 Represents a texture for rendering. More...
 
class  TexturingFragmentShader
 A fragment shader that textures. More...
 
class  VertexColoringFragmentShader
 A simple fragment shader that does vertex-colouring. More...
 
class  VertexShader
 A simple vertex shader that projects the vertex and returns the vertex in clip-space coordinates. More...
 

Typedefs

template<typename T >
using Triangle = std::array< detail::Vertex< T >, 3 >
 X.
 

Enumerations

enum class  ProjectionType { Orthographic , Perspective }
 

Functions

void draw_line (core::Image3u &image, float x0, float y0, float x1, float y1, Eigen::Vector3f color)
 
void draw_wireframe (core::Image3u &image, const core::Mesh &mesh, Eigen::Matrix4f modelview, Eigen::Matrix4f projection, Eigen::Vector4f viewport, Eigen::Vector3f color=Eigen::Vector3f(0, 255, 0))
 
template<typename T >
Eigen::Vector3< T > compute_inverse_perspectively_correct_lambda (const Eigen::Vector3< T > &lambda_world, const T &one_over_w0, const T &one_over_w1, const T &one_over_w2)
 Computes inverse perspectively correct lambda.
 
template<typename T >
Eigen::Matrix4< T > perspective (T fov_y, T aspect, T z_near, T z_far)
 
template<typename T >
Eigen::Matrix4< T > ortho (T left, T right, T bottom, T top)
 Creates a 2D orthographic projection matrix.
 
template<typename T >
Eigen::Matrix4< T > ortho (T left, T right, T bottom, T top, T z_near, T z_far)
 Creates a matrix for an orthographic parallel viewing volume, using right-handed coordinates.
 
template<typename T >
Eigen::Vector3< T > project (const Eigen::Vector3< T > &point_3d, const Eigen::Matrix4< T > &modelview_matrix, const Eigen::Matrix4< T > &projection_matrix, const Eigen::Vector4< T > &viewport)
 
Eigen::Vector3f compute_face_normal (const Eigen::Vector3f &v0, const Eigen::Vector3f &v1, const Eigen::Vector3f &v2)
 
Eigen::Vector3f compute_face_normal (const Eigen::Vector4f &v0, const Eigen::Vector4f &v1, const Eigen::Vector4f &v2)
 
std::vector< Eigen::Vector3f > compute_face_normals (const std::vector< Eigen::Vector3f > &vertices, const std::vector< std::array< int, 3 > > &triangle_vertex_indices)
 
std::vector< Eigen::Vector3f > compute_vertex_normals (const std::vector< Eigen::Vector3f > &vertices, const std::vector< std::array< int, 3 > > &triangle_vertex_indices, const std::vector< Eigen::Vector3f > &face_normals)
 
void draw_wireframe (cv::Mat image, const core::Mesh &mesh, Eigen::Matrix4f modelview, Eigen::Matrix4f projection, Eigen::Vector4f viewport, cv::Scalar color=cv::Scalar(0, 255, 0, 255))
 
cv::Mat draw_texcoords (core::Mesh mesh, cv::Mat image=cv::Mat())
 
std::pair< bool, cpp17::optional< float > > ray_triangle_intersect (const Eigen::Vector3f &ray_origin, const Eigen::Vector3f &ray_direction, const Eigen::Vector3f &v0, const Eigen::Vector3f &v1, const Eigen::Vector3f &v2, bool enable_backculling)
 Computes the intersection of the given ray with the given triangle.
 
core::Image4u render (const core::Mesh &mesh, const Eigen::Matrix4f &model_view_matrix, const Eigen::Matrix4f &projection_matrix, int viewport_width, int viewport_height, bool enable_backface_culling=false, bool enable_near_clipping=true, bool enable_far_clipping=true)
 
core::Image4u render (const core::Mesh &mesh, const Eigen::Matrix4f &model_view_matrix, const Eigen::Matrix4f &projection_matrix, int viewport_width, int viewport_height, Texture texture, bool enable_backface_culling=false, bool enable_near_clipping=true, bool enable_far_clipping=true)
 
unsigned int get_max_possible_mipmaps_num (unsigned int width, unsigned int height)
 
bool is_power_of_two (int x)
 
Texture create_mipmapped_texture (const eos::core::Image4u &image, unsigned int mipmapsNum=0)
 
eos::core::Image4u extract_texture (const core::Mesh &mesh, Eigen::Matrix4f view_model_matrix, Eigen::Matrix4f projection_matrix, ProjectionType projection_type, const eos::core::Image4u &image, int texturemap_resolution=512)
 Extracts the texture from the given image and returns a texture map.
 
Eigen::Vector2f clip_to_screen_space (const Eigen::Vector2f &clip_coordinates, int screen_width, int screen_height)
 
template<typename T >
Eigen::Vector2< T > clip_to_screen_space (const T clip_coord_x, const T clip_coord_y, int screen_width, int screen_height)
 
bool is_vertex_visible (const Eigen::Vector3f &probe_vertex, const std::vector< Eigen::Vector3f > &mesh_vertices, const std::vector< std::array< int, 3 > > &mesh_triangle_vertex_indices, detail::RayDirection ray_direction_type)
 
std::vector< bool > compute_per_vertex_self_occlusion (const std::vector< Eigen::Vector3f > &viewspace_vertices, const std::vector< std::array< int, 3 > > &triangle_vertex_indices, detail::RayDirection ray_direction_type)
 
std::vector< bool > compute_per_vertex_self_occlusion (const std::vector< Eigen::Vector3f > &vertices, const std::vector< std::array< int, 3 > > &triangle_vertex_indices, const Eigen::Matrix4f &modelview, detail::RayDirection ray_direction_type)
 

Detailed Description

Software rendering and texture extraction functionality.

Typedef Documentation

◆ Triangle

template<typename T >
using eos::render::Triangle = typedef std::array<detail::Vertex<T>, 3>

X.

Can this go into the SoftwareRenderer class or something? No, I think FragShader needs it? Where to put it?

Enumeration Type Documentation

◆ ProjectionType

enum class eos::render::ProjectionType
strong

Specifies whether orthographic or perspective projection shall be used.

Function Documentation

◆ clip_to_screen_space()

Eigen::Vector2f eos::render::clip_to_screen_space ( const Eigen::Vector2f &  clip_coordinates,
int  screen_width,
int  screen_height 
)
inline

Transforms a point from clip space ([-1, 1] x [-1, 1]) to image (screen) coordinates, i.e. the window transform. Note that the y-coordinate is flipped because the image origin is top-left while in clip space top is +1 and bottom is -1. No z-division is performed. Note: It should rather be called from NDC to screen space?

Exactly conforming to the OpenGL viewport transform, except that we flip y at the end. Qt: Origin top-left. OpenGL: bottom-left. OCV: top-left.

Parameters
[in]clip_coordinatesA point in clip coordinates.
[in]screen_widthWidth of the screen or window.
[in]screen_heightHeight of the screen or window.
Returns
A vector with x and y coordinates transformed to screen space.

◆ compute_face_normal() [1/2]

Eigen::Vector3f eos::render::compute_face_normal ( const Eigen::Vector3f &  v0,
const Eigen::Vector3f &  v1,
const Eigen::Vector3f &  v2 
)
inline

Computes the normal of a face (triangle), i.e. the per-face normal. Returned normal will be unit length.

Assumes the triangle is given in CCW order, i.e. vertices in counterclockwise order on the screen are front-facing.

Parameters
[in]v0First vertex.
[in]v1Second vertex.
[in]v2Third vertex.
Returns
The unit-length normal of the given triangle.

◆ compute_face_normal() [2/2]

Eigen::Vector3f eos::render::compute_face_normal ( const Eigen::Vector4f &  v0,
const Eigen::Vector4f &  v1,
const Eigen::Vector4f &  v2 
)
inline

Computes the normal of a face (triangle), i.e. the per-face normal. Returned normal will be unit length.

Assumes the triangle is given in CCW order, i.e. vertices in counterclockwise order on the screen are front-facing.

Parameters
[in]v0First vertex.
[in]v1Second vertex.
[in]v2Third vertex.
Returns
The unit-length normal of the given triangle.

◆ compute_face_normals()

std::vector< Eigen::Vector3f > eos::render::compute_face_normals ( const std::vector< Eigen::Vector3f > &  vertices,
const std::vector< std::array< int, 3 > > &  triangle_vertex_indices 
)
inline

Computes the per-face (per-triangle) normals of all triangles of the given mesh. Returned normals will be unit length.

Assumes triangles are given in CCW order, i.e. vertices in counterclockwise order on the screen are front-facing.

Parameters
[in]verticesA list of vertices.
[in]triangle_vertex_indicesTriangle list for the given vertices.
Returns
The unit-length per-face normals.

◆ compute_inverse_perspectively_correct_lambda()

template<typename T >
Eigen::Vector3< T > eos::render::compute_inverse_perspectively_correct_lambda ( const Eigen::Vector3< T > &  lambda_world,
const T &  one_over_w0,
const T &  one_over_w1,
const T &  one_over_w2 
)

Computes inverse perspectively correct lambda.

X. Inverts the perspective texture mapping. Can be derived using some tedious algebra. Todo: Probably move to a texturing file, internal/detail one, where we will also put the tex2d, mipmapping etc stuff?

Parameters
[in]XX.
Returns
X.

◆ compute_per_vertex_self_occlusion() [1/2]

std::vector< bool > eos::render::compute_per_vertex_self_occlusion ( const std::vector< Eigen::Vector3f > &  vertices,
const std::vector< std::array< int, 3 > > &  triangle_vertex_indices,
const Eigen::Matrix4f &  modelview,
detail::RayDirection  ray_direction_type 
)
inline

For each given vertex, compute whether it is visible or self-occluded by the mesh formed by the given vertices and triangle indices.

Transforms the vertices into view space first using the given modelview matrix.

Parameters
[in]verticesA set of vertices that form a mesh.
[in]triangle_vertex_indicesTriangle indices corresponding to the given mesh.
[in]modelviewModel-view matrix, to transform the given vertices from model space to view space.
[in]ray_direction_typeWhether the occlusion should be computed under orthographic or perspective projection.
Returns
Returns the per-vertex visibility (true if the vertex is visible, false if it is self-occluded).

◆ compute_per_vertex_self_occlusion() [2/2]

std::vector< bool > eos::render::compute_per_vertex_self_occlusion ( const std::vector< Eigen::Vector3f > &  viewspace_vertices,
const std::vector< std::array< int, 3 > > &  triangle_vertex_indices,
detail::RayDirection  ray_direction_type 
)
inline

For each given vertex, compute whether it is visible or self-occluded by the mesh formed by the given vertices and triangle indices.

The function uses simple ray casting for each vertex, and checks whether each ray intersects any other triangle. Thus, the algorithm can become quite slow for larger meshes. Depending on ray_direction_type, the rays are either casted from each vertex along the positive z axis, or towards the origin (0, 0, 0).

Parameters
[in]viewspace_verticesA set of vertices that form a mesh, in view-space coordinates.
[in]triangle_vertex_indicesTriangle indices corresponding to the given mesh.
[in]ray_direction_typeWhether the occlusion should be computed under orthographic or perspective projection.
Returns
Returns the per-vertex visibility (true if the vertex is visible, false if it is self-occluded).

◆ compute_vertex_normals()

std::vector< Eigen::Vector3f > eos::render::compute_vertex_normals ( const std::vector< Eigen::Vector3f > &  vertices,
const std::vector< std::array< int, 3 > > &  triangle_vertex_indices,
const std::vector< Eigen::Vector3f > &  face_normals 
)
inline

Computes the per-vertex normals of all vertices of the given mesh. Returned normals will be unit length.

Assumes triangles are given in CCW order, i.e. vertices in counterclockwise order on the screen are front-facing.

Parameters
[in]verticesA list of vertices.
[in]triangle_vertex_indicesTriangle list for the given vertices.
[in]face_normalsPer-face normals for all triangles.
Returns
The unit-length per-vertex normals.

◆ draw_line()

void eos::render::draw_line ( core::Image3u image,
float  x0,
float  y0,
float  x1,
float  y1,
Eigen::Vector3f  color 
)
inline

Draws a line using the Bresenham algorithm.

From: https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm I also tried this: https://www.thecrazyprogrammer.com/2017/01/bresenhams-line-drawing-algorithm-c-c.html which looks awesome, but it drew weird lines.

Parameters
[in]imageAn image to draw into.
[in]x0X coordinate of the start point.
[in]y0Y coordinate of the start point.
[in]x1X coordinate of the start point.
[in]y1Y coordinate of the end point.
[in]colorRGB colour of the line to be drawn.

◆ draw_texcoords()

cv::Mat eos::render::draw_texcoords ( core::Mesh  mesh,
cv::Mat  image = cv::Mat() 
)
inline

Draws the texture coordinates (uv-coords) of the given mesh into an image by looping over the triangles and drawing each triangle's texcoords.

Note/Todo: This function has a slight problems, the lines do not actually get drawn blue, if the image is 8UC4. Well if I save a PNG, it is blue. Not sure.

Parameters
[in]meshA mesh with texture coordinates.
[in]imageAn optional image to draw onto.
Returns
An image with the texture coordinate triangles drawn in it, 512x512 if no image is given.

◆ draw_wireframe() [1/2]

void eos::render::draw_wireframe ( core::Image3u image,
const core::Mesh mesh,
Eigen::Matrix4f  modelview,
Eigen::Matrix4f  projection,
Eigen::Vector4f  viewport,
Eigen::Vector3f  color = Eigen::Vector3f(0, 255, 0) 
)
inline

Draws the given mesh as wireframe into the image.

It does backface culling, i.e. draws only vertices in CCW order.

Parameters
[in]imageAn image to draw into.
[in]meshThe mesh to draw.
[in]modelviewModel-view matrix to draw the mesh.
[in]projectionProjection matrix to draw the mesh.
[in]viewportViewport to draw the mesh.
[in]colorColour of the mesh to be drawn, in RGB.

◆ draw_wireframe() [2/2]

void eos::render::draw_wireframe ( cv::Mat  image,
const core::Mesh mesh,
Eigen::Matrix4f  modelview,
Eigen::Matrix4f  projection,
Eigen::Vector4f  viewport,
cv::Scalar  color = cv::Scalar(0, 255, 0, 255) 
)
inline

Draws the given mesh as wireframe into the image.

It does backface culling, i.e. draws only vertices in CCW order.

Note: This function might be deprecated in the future, in favour of draw_wireframe(...) in render/draw_utils.hpp, which doesn't depend on OpenCV anymore.

Parameters
[in]imageAn image to draw into.
[in]meshThe mesh to draw.
[in]modelviewModel-view matrix to draw the mesh.
[in]projectionProjection matrix to draw the mesh.
[in]viewportViewport to draw the mesh.
[in]colorColour of the mesh to be drawn.

◆ extract_texture()

eos::core::Image4u eos::render::extract_texture ( const core::Mesh mesh,
Eigen::Matrix4f  view_model_matrix,
Eigen::Matrix4f  projection_matrix,
ProjectionType  projection_type,
const eos::core::Image4u image,
int  texturemap_resolution = 512 
)
inline

Extracts the texture from the given image and returns a texture map.

Remaps the texture from the given image, using the given mesh, projection matrices, and the mesh's uv coordinates, to a texture map.

Notes & todo's:

  • The function does currently not compute a view-angle and store that in the alpha channel, like the previous function did. We have to re-add that. Documentation of the old parameter: `compute_view_angle A flag whether the view angle of each vertex should be computed and returned. If set to true, the angle will be encoded into the alpha channel (0 meaning occluded or facing away 90°, 127 meaning facing a 45° angle and 255 meaning front-facing, and all values in between). If set to false, the alpha channel will only contain 0 for occluded vertices and 255 for visible vertices.
  • We perhaps should add another parameter,Eigen::Vector4 viewport. We could need to change clip_to_screen_space()to make use of that.
  • Perhaps add an overload that takes avector<bool> visible vertices`, for the case when we already computed the visibility? (e.g. from the edge-fitting)
Parameters
[in]meshA mesh with texture coordinates.
[in]view_model_matrixModel-view matrix, to bring the mesh into view-space.
[in]projection_matrixProjection matrix, to bring the mesh into clip-space.
[in]projection_typeIndicates whether the projection used is orthographic or perspective.
[in]imageThe image to extract the texture from.
[in]texturemap_resolutionThe resolution of the generated texture map. Defaults to 512x512.
Returns
Texture map with the extracted texture.

◆ is_vertex_visible()

bool eos::render::is_vertex_visible ( const Eigen::Vector3f &  probe_vertex,
const std::vector< Eigen::Vector3f > &  mesh_vertices,
const std::vector< std::array< int, 3 > > &  mesh_triangle_vertex_indices,
detail::RayDirection  ray_direction_type 
)
inline

Computes whether the given probe_vertex is visible or self-occluded by the mesh formed by the given vertices and triangle indices.

The function uses simple ray casting and checks whether the ray intersects any triangle of the given mesh. Thus, the algorithm can become quite slow for larger meshes. Depending on ray_direction_type, the rays are either casted from each vertex along the positive z axis, or towards the origin (0, 0, 0).

Parameters
[in]probe_vertexA single vertex to compute the visibility for.
[in]mesh_verticesA set of vertices that form a mesh.
[in]mesh_triangle_vertex_indicesTriangle indices corresponding to the given mesh.
[in]ray_direction_typeWhether the occlusion should be computed under orthographic or perspective projection.
Returns
Returns whether the given vertex is visible (true if the vertex is visible, false if it is self-occluded).

◆ ortho() [1/2]

template<typename T >
Eigen::Matrix4< T > eos::render::ortho ( left,
right,
bottom,
top 
)

Creates a 2D orthographic projection matrix.

This function sets up a two-dimensional orthographic viewing region. This is equivalent to calling glOrtho with near=-1 and far=1. The function is equivalent to glm::orthoRH_NO(), but with near=-1 and far=1.

More details can be found on the gluOrtho2D man page: https://registry.khronos.org/OpenGL-Refpages/gl2.1/xhtml/gluOrtho2D.xml.

Parameters
[in]leftSpecifies the coordinates for the left vertical clipping plane.
[in]rightSpecifies the coordinates for the right vertical clipping plane.
[in]bottomSpecifies the coordinates for the bottom horizontal clipping plane.
[in]topSpecifies the coordinates for the top horizontal clipping plane.
Template Parameters
TA floating-point scalar type, ceres::Jet, or similar compatible type.
Returns
The corresponding orthographic projection matrix.

◆ ortho() [2/2]

template<typename T >
Eigen::Matrix4< T > eos::render::ortho ( left,
right,
bottom,
top,
z_near,
z_far 
)

Creates a matrix for an orthographic parallel viewing volume, using right-handed coordinates.

The function follows the OpenGL clip volume definition, which is also the GLM default. The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively.

The function is equivalent to glm::orthoRH_NO(...).

Parameters
[in]leftSpecifies the coordinates for the left vertical clipping plane.
[in]rightSpecifies the coordinates for the right vertical clipping plane.
[in]bottomSpecifies the coordinates for the bottom horizontal clipping plane.
[in]topSpecifies the coordinates for the top horizontal clipping plane.
[in]z_nearSpecifies the distance from the viewer to the near clipping plane (always positive).
[in]z_farSpecifies the distance from the viewer to the far clipping plane (always positive).
Template Parameters
TA floating-point scalar type, ceres::Jet, or similar compatible type.
Returns
The corresponding orthographic projection matrix.

◆ perspective()

template<typename T >
Eigen::Matrix4< T > eos::render::perspective ( fov_y,
aspect,
z_near,
z_far 
)

Creates a matrix for a right-handed, symmetric perspective-view frustum.

The function follows the OpenGL clip volume definition, which is also the GLM default. The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively.

This function is equivalent to glm::perspectiveRH_NO(...).

More details can be found on the gluPerspective man page: https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluPerspective.xml.

Parameters
[in]fov_ySpecifies the field of view angle in the y direction. Expressed in radians.
[in]aspectSpecifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
[in]z_nearSpecifies the distance from the viewer to the near clipping plane (always positive).
[in]z_farSpecifies the distance from the viewer to the far clipping plane (always positive).
Template Parameters
TA floating-point scalar type, ceres::Jet, or similar compatible type.
Returns
The corresponding perspective projection matrix.

◆ project()

template<typename T >
Eigen::Vector3< T > eos::render::project ( const Eigen::Vector3< T > &  point_3d,
const Eigen::Matrix4< T > &  modelview_matrix,
const Eigen::Matrix4< T > &  projection_matrix,
const Eigen::Vector4< T > &  viewport 
)

Project the given point_3d (from object coordinates) into window coordinates.

The function follows the OpenGL clip volume definition. The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. This function is equivalent to glm::projectNO(...).

More details can be found on the gluProject man page: https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluProject.xml.

Parameters
[in]point_3dA 3D point in object coordinates.
[in]modelview_matrixA model-view matrix, transforming the point into view (camera) space.
[in]projection_matrixThe projection matrix to be used.
[in]viewportThe viewport transformation to be used.
Template Parameters
TA floating-point scalar type, ceres::Jet, or similar compatible type.
Returns
Return the computed window coordinates.

◆ ray_triangle_intersect()

std::pair< bool, cpp17::optional< float > > eos::render::ray_triangle_intersect ( const Eigen::Vector3f &  ray_origin,
const Eigen::Vector3f &  ray_direction,
const Eigen::Vector3f &  v0,
const Eigen::Vector3f &  v1,
const Eigen::Vector3f &  v2,
bool  enable_backculling 
)
inline

Computes the intersection of the given ray with the given triangle.

Uses the Möller-Trumbore algorithm "Fast Minimum Storage Ray/Triangle Intersection". Independent implementation, inspired by: http://www.scratchapixel.com/lessons/3d-basic-rendering/ray-tracing-rendering-a-triangle/moller-trumbore-ray-triangle-intersection The default eps (1e-6f) is from the paper. When culling is on, rays intersecting triangles from the back will be discarded - otherwise, the triangles normal direction w.r.t. the ray direction is just ignored.

Todo: We don't need the pair<> here, we could just return optional<float>. Also, I hope optional wouldn't be a performance problem here, as this function is called loads of times.

Parameters
[in]ray_originRay origin.
[in]ray_directionRay direction.
[in]v0First vertex of a triangle.
[in]v1Second vertex of a triangle.
[in]v2Third vertex of a triangle.
[in]enable_backcullingWhen culling is on, rays intersecting triangles from the back will be discarded.
Returns
Whether the ray intersects the triangle, and if yes, including the distance.

◆ render() [1/2]

core::Image4u eos::render::render ( const core::Mesh mesh,
const Eigen::Matrix4f &  model_view_matrix,
const Eigen::Matrix4f &  projection_matrix,
int  viewport_width,
int  viewport_height,
bool  enable_backface_culling = false,
bool  enable_near_clipping = true,
bool  enable_far_clipping = true 
)

Convenience function that renders the given mesh onto a 2D image using SoftwareRenderer. Conforms to OpenGL conventions.

Renders using per-vertex colouring, without texturing.

Parameters
[in]meshA 3D mesh.
[in]model_view_matrixA 4x4 OpenGL model-view matrix.
[in]projection_matrixA 4x4 orthographic or perspective OpenGL projection matrix.
[in]viewport_widthScreen width.
[in]viewport_heightScreen height.
[in]enable_backface_cullingWhether the renderer should perform backface culling. If true, only draw triangles with vertices ordered CCW in screen-space.
[in]enable_near_clippingWhether vertices should be clipped against the near plane.
[in]enable_far_clippingWhether vertices should be clipped against the far plane.
Returns
Framebuffer (colourbuffer) with the rendered image.

◆ render() [2/2]

core::Image4u eos::render::render ( const core::Mesh mesh,
const Eigen::Matrix4f &  model_view_matrix,
const Eigen::Matrix4f &  projection_matrix,
int  viewport_width,
int  viewport_height,
Texture  texture,
bool  enable_backface_culling = false,
bool  enable_near_clipping = true,
bool  enable_far_clipping = true 
)

Convenience function that renders the given mesh onto a 2D image using SoftwareRenderer. Conforms to OpenGL conventions.

Performs texturing using the given texture.

Parameters
[in]meshA 3D mesh.
[in]model_view_matrixA 4x4 OpenGL model-view matrix.
[in]projection_matrixA 4x4 orthographic or perspective OpenGL projection matrix.
[in]viewport_widthScreen width.
[in]viewport_heightScreen height.
[in]textureA texture map to texture the model.
[in]enable_backface_cullingWhether the renderer should perform backface culling. If true, only draw triangles with vertices ordered CCW in screen-space.
[in]enable_near_clippingWhether vertices should be clipped against the near plane.
[in]enable_far_clippingWhether vertices should be clipped against the far plane.
Returns
Framebuffer (colourbuffer) with the rendered image.