Nirkin Face Swap  0.9.0
Face swap.
face_swap::FaceRenderer Class Reference

Simple renderer for rendering textured face meshes. More...

#include <face_renderer.h>

Public Member Functions

 FaceRenderer ()
 Create an instance of FaceRenderer.
 
 ~FaceRenderer ()
 Destrcutor.
 
void init (int width, int height, bool force=false)
 Initialize buffers and viewport. More...
 
void clear ()
 Clear all allocated data.
 
void clearFrameBuffer ()
 Clear the frame buffer.
 
void clearMesh ()
 Clear the mesh.
 
void setViewport (int width, int height)
 Set viewport resolution. More...
 
void setProjection (float f, float z_near=10, float z_far=10000)
 Set projection. More...
 
void setMesh (const Mesh &mesh)
 Set mesh to render.
 
void render (const cv::Mat &vecR, const cv::Mat &vecT)
 Render with the specified pose. More...
 
void getFrameBuffer (cv::Mat &img)
 Get frame buffer (should be called after render).
 
void getDepthBuffer (cv::Mat &depth)
 Get depth buffer (should be called after render).
 
void setLight (const cv::Mat &pos_dir, const cv::Mat &ambient, const cv::Mat &diffuse)
 Set light position and color. More...
 
void clearLight ()
 Clear previously set light.
 

Detailed Description

Simple renderer for rendering textured face meshes.

Member Function Documentation

void face_swap::FaceRenderer::init ( int  width,
int  height,
bool  force = false 
)

Initialize buffers and viewport.

Parameters
widthThe width of the viewport [pixels].
heightThe height of the viewport [pixels].
forceForce initialization even if the resolution is the same as the last one.
void face_swap::FaceRenderer::render ( const cv::Mat &  vecR,
const cv::Mat &  vecT 
)

Render with the specified pose.

Parameters
vecRRotation vector [Euler angles].
vecTTranslation vector.
void face_swap::FaceRenderer::setLight ( const cv::Mat &  pos_dir,
const cv::Mat &  ambient,
const cv::Mat &  diffuse 
)

Set light position and color.

Parameters
pos_dirLight's position or direction in OpenGL's format.
ambientLight's ambient color in OpenGL's format.
diffuseLight's diffuse color in OpenGL's format.
void face_swap::FaceRenderer::setProjection ( float  f,
float  z_near = 10,
float  z_far = 10000 
)

Set projection.

Parameters
fFocal length.
z_nearThe near plane distance on Z axis.
z_farThe far plane distance on Z axis.
void face_swap::FaceRenderer::setViewport ( int  width,
int  height 
)

Set viewport resolution.

Parameters
widthThe width of the viewport [pixels].
heightThe height of the viewport [pixels].

The documentation for this class was generated from the following file: