Support Forum       G3D Web Page     
Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
G3D::Renderer Class Referenceabstract

Base class for 3D rendering pipelines. More...

Inherits G3D::ReferenceCountedObject.

Inherited by G3D::DefaultRenderer.

Public Member Functions

virtual const StringclassName () const =0
 
bool diskFramebuffer () const
 
virtual void render (RenderDevice *rd, const shared_ptr< Camera > &camera, const shared_ptr< Framebuffer > &framebuffer, const shared_ptr< Framebuffer > &depthPeelFramebuffer, LightingEnvironment &lightingEnvironment, const shared_ptr< GBuffer > &gbuffer, const Array< shared_ptr< Surface >> &allSurfaces, const std::function< const shared_ptr< TriTree > &()> &tritreeFunction=nullptr)=0
 
The active camera and time interval are taken from the GBuffer. More...
 
void setDiskFramebuffer (bool b)
 

Protected Types

enum  Order {
  FRONT_TO_BACK,
  BACK_TO_FRONT,
  ARBITRARY
}
 

Protected Member Functions

virtual void computeGBuffer (RenderDevice *rd, const Array< shared_ptr< Surface >> &sortedVisibleSurfaces, const shared_ptr< GBuffer > &gbuffer, const shared_ptr< Framebuffer > &depthPeelFramebuffer, float depthPeelSeparationHint)
 Render z-prepass, depth peel, and G-buffer. More...
 
virtual void computeShadowing (RenderDevice *rd, const Array< shared_ptr< Surface >> &allSurfaces, const shared_ptr< GBuffer > &gbuffer, const shared_ptr< Framebuffer > &depthPeelFramebuffer, LightingEnvironment &lightingEnvironment)
 Compute ambient occlusion and direct illumination shadow maps. More...
 
virtual void cullAndSort (const shared_ptr< Camera > &camera, const shared_ptr< GBuffer > &gbuffer, const Rect2D &viewport, const Array< shared_ptr< Surface >> &allSurfaces, Array< shared_ptr< Surface >> &sortedVisibleSurfaces, Array< shared_ptr< Surface >> &forwardOpaqueSurfaces, Array< shared_ptr< Surface >> &forwardBlendedSurfaces)
 
Appends to sortedVisibleSurfaces and forwardSurfaces. More...
 
virtual void forwardShade (RenderDevice *rd, Array< shared_ptr< Surface > > &surfaceArray, const shared_ptr< GBuffer > &gbuffer, const LightingEnvironment &environment, const RenderPassType &renderPassType, Order order)
 Forward shade everything in surfaceArray. More...
 

Static Protected Member Functions

template<class T , class ... ArgTypes>
static shared_ptr< T > createShared (ArgTypes &&... args)
 Like std::make_shared, but works for protected constructors. More...
 

Protected Attributes

bool m_diskFramebuffer = false
 For VR. More...
 

Detailed Description

Base class for 3D rendering pipelines.

See also
GApp::onGraphics3D

Member Enumeration Documentation

◆ Order

enum G3D::Renderer::Order
protected
Enumerator
FRONT_TO_BACK 

Good for early depth culling.

BACK_TO_FRONT 

Good for painter's algorithm sorted transparency.

ARBITRARY 

Allows minimizing state changes by batching primitives.

Member Function Documentation

◆ className()

virtual const String& G3D::Renderer::className ( ) const
pure virtual

Implemented in G3D::DefaultRenderer.

◆ computeGBuffer()

virtual void G3D::Renderer::computeGBuffer ( RenderDevice rd,
const Array< shared_ptr< Surface >> &  sortedVisibleSurfaces,
const shared_ptr< GBuffer > &  gbuffer,
const shared_ptr< Framebuffer > &  depthPeelFramebuffer,
float  depthPeelSeparationHint 
)
protectedvirtual

Render z-prepass, depth peel, and G-buffer.

Called from render().

Parameters
gbufferMust already have had GBuffer::prepare() called
depthPeelFramebufferOnly rendered if notNull()

◆ computeShadowing()

virtual void G3D::Renderer::computeShadowing ( RenderDevice rd,
const Array< shared_ptr< Surface >> &  allSurfaces,
const shared_ptr< GBuffer > &  gbuffer,
const shared_ptr< Framebuffer > &  depthPeelFramebuffer,
LightingEnvironment lightingEnvironment 
)
protectedvirtual

Compute ambient occlusion and direct illumination shadow maps.

◆ createShared()

template<class T , class ... ArgTypes>
static shared_ptr<T> G3D::ReferenceCountedObject::createShared ( ArgTypes &&...  args)
inlinestaticprotectedinherited

Like std::make_shared, but works for protected constructors.

Call as createShared<myclass>.

◆ cullAndSort()

virtual void G3D::Renderer::cullAndSort ( const shared_ptr< Camera > &  camera,
const shared_ptr< GBuffer > &  gbuffer,
const Rect2D viewport,
const Array< shared_ptr< Surface >> &  allSurfaces,
Array< shared_ptr< Surface >> &  sortedVisibleSurfaces,
Array< shared_ptr< Surface >> &  forwardOpaqueSurfaces,
Array< shared_ptr< Surface >> &  forwardBlendedSurfaces 
)
protectedvirtual


Appends to sortedVisibleSurfaces and forwardSurfaces.

Parameters
sortedVisibleSurfacesAll surfaces visible to the GBuffer::camera(), sorted from back to front
forwardOpaqueSurfacesSurfaces for which Surface::canBeFullyRepresentedInGBuffer() returned false. These require a forward pass in a deferred shader. (They may be capable of deferred shading for some pixels covered, e.g., if the GBuffer did not contain a sufficient emissive channel.)
forwardBlendedSurfacesSurfaces that returned true Surface::hasBlendedTransparency() because they require per-pixel blending at some locations

◆ diskFramebuffer()

bool G3D::Renderer::diskFramebuffer ( ) const
inline

◆ forwardShade()

virtual void G3D::Renderer::forwardShade ( RenderDevice rd,
Array< shared_ptr< Surface > > &  surfaceArray,
const shared_ptr< GBuffer > &  gbuffer,
const LightingEnvironment environment,
const RenderPassType renderPassType,
Order  order 
)
protectedvirtual

Forward shade everything in surfaceArray.

Called from render()

Parameters
surfaceArrayVisible surfaces sorted from front to back

◆ render()

virtual void G3D::Renderer::render ( RenderDevice rd,
const shared_ptr< Camera > &  camera,
const shared_ptr< Framebuffer > &  framebuffer,
const shared_ptr< Framebuffer > &  depthPeelFramebuffer,
LightingEnvironment lightingEnvironment,
const shared_ptr< GBuffer > &  gbuffer,
const Array< shared_ptr< Surface >> &  allSurfaces,
const std::function< const shared_ptr< TriTree > &()> &  tritreeFunction = nullptr 
)
pure virtual


The active camera and time interval are taken from the GBuffer.

Parameters
framebufferTarget color and depth framebuffer. Will be rendered in high dynamic range (HDR) linear radiance.
gbufferMust be allocated, sized, and prepared. Will be rendered according to its specification by this method.
allSurfacesSurfaces not visible to the camera will automatically be culled
depthPeelFramebufferMay be nullptr
lightingEnvironmentShadow maps will be updated for any lights that require them. AO will be updated if the ambientOcclusion field is non-nullptr. Screen-space color buffer will be updated with textures the next frame.
tritreeThe BVH for ray tracing queries.

Implemented in G3D::DefaultRenderer.

◆ setDiskFramebuffer()

void G3D::Renderer::setDiskFramebuffer ( bool  b)
inline

Member Data Documentation

◆ m_diskFramebuffer

bool G3D::Renderer::m_diskFramebuffer = false
protected

For VR.

Default is false.

Referenced by diskFramebuffer(), and setDiskFramebuffer().


documentation generated on Wed Nov 24 2021 08:01:59 using doxygen 1.8.15