Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
BVHRenderer Class Referencefinal

Renderer coupled with a basic diffuse path tracer. The user can move the camera anywhere and trigger a path-traced rendering. Can also display the raycaster acceleration structure. More...

#include <BVHRenderer.hpp>

Public Member Functions

 BVHRenderer ()
 
void setScene (const std::shared_ptr< Scene > &scene, const Raycaster &raycaster)
 
void draw (const Camera &camera, Texture *dstColor, Texture *dstDepth, uint layer=0) override
 
 ~BVHRenderer () override
 
void castRay (const glm::vec3 &position, const glm::vec3 &direction)
 
void clearRay ()
 
bool & showBVH ()
 
glm::ivec2 & range ()
 
int maxLevel ()
 
- Public Member Functions inherited from Renderer
 Renderer (const std::string &name)
 
virtual void draw (const Camera &camera, Texture *dstColor, Texture *dstDepth, uint layer=0)
 
virtual void resize (uint width, uint height)
 
virtual void interface ()
 
virtual ~Renderer ()=default
 
 Renderer (const Renderer &)=delete
 
Rendereroperator= (const Renderer &)=delete
 
 Renderer (Renderer &&)=delete
 
Rendereroperator= (Renderer &&)=delete
 
Layout outputColorFormat () const
 
Layout outputDepthFormat () const
 

Private Attributes

Program_objectProgram
 Basic object program.
 
Program_bvhProgram
 BVH visualisation program.
 
std::vector< Mesh_bvhLevels
 The BVH visualisation mesh.
 
std::vector< Mesh_rayLevels
 BVH nodes intersected with a ray.
 
Mesh _rayVis = Mesh("rayVis")
 Mesh representing a ray and its intersected triangle.
 
std::shared_ptr< Scene_scene
 The scene to render.
 
std::unique_ptr< RaycasterVisualisation_visuHelper
 Helper for raycaster internal data visualisation.
 
glm::ivec2 _bvhRange = glm::ivec2(0, 1)
 The subset of the BVH to display.
 
bool _showBVH = true
 Show the raytracer BVH.
 

Additional Inherited Members

- Protected Attributes inherited from Renderer
std::string _name
 Debug name.
 
Layout _colorFormat = Layout::NONE
 The preferred output format for a given renderer.
 
Layout _depthFormat = Layout::NONE
 The preferred output format for a given renderer.
 

Detailed Description

Renderer coupled with a basic diffuse path tracer. The user can move the camera anywhere and trigger a path-traced rendering. Can also display the raycaster acceleration structure.

Inherits Renderer.

Constructor & Destructor Documentation

◆ BVHRenderer()

BVHRenderer::BVHRenderer ( )
explicit

Constructor.

◆ ~BVHRenderer()

BVHRenderer::~BVHRenderer ( )
override

Destructor.

Member Function Documentation

◆ castRay()

void BVHRenderer::castRay ( const glm::vec3 &  position,
const glm::vec3 &  direction 
)

Generate visualisation for a ray cast from a position.

Parameters
positionthe ray origin.
directionthe ray direction.

◆ clearRay()

void BVHRenderer::clearRay ( )

Delete the displayed ray.

◆ draw()

void BVHRenderer::draw ( const Camera camera,
Texture dstColor,
Texture dstDepth,
uint  layer = 0 
)
overridevirtual

Draw from a given viewpoint.

Parameters
camerathe rendering viewpoint
dstColorthe destination color texture (optional, see outputColorFormat)
dstDepththe destination depth texture (optional, see outputDepthFormat)
layerthe layer to write to in the target

Reimplemented from Renderer.

◆ maxLevel()

int BVHRenderer::maxLevel ( )

The maximum depth of the BVH.

Returns
the maximum level

◆ range()

glm::ivec2 & BVHRenderer::range ( )
inline

Display a range of levels of the BVH.

Returns
the range

◆ setScene()

void BVHRenderer::setScene ( const std::shared_ptr< Scene > &  scene,
const Raycaster raycaster 
)

Set the scene to render.

Parameters
scenethe new scene
raycasterthe associated raycaster

◆ showBVH()

bool & BVHRenderer::showBVH ( )
inline

Show the BVH structure.

Returns
the toggle

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