Rebel Fork Framework
Urho3D::Renderer Class Reference

High-level rendering subsystem. Manages drawing of 3D views. More...

#include <Urho3D/Graphics/Renderer.h>

Inheritance diagram for Urho3D::Renderer:
Urho3D::Object Urho3D::RefCounted

Public Member Functions

 Renderer (Context *context)
 ~Renderer () override
void SetBackbufferRenderSurface (RenderSurface *renderSurface)
 Set backbuffer render surface. Null corresponds to the application backbuffer.
void SetNumViewports (unsigned num)
void SetViewport (unsigned index, Viewport *viewport)
void SetDefaultTechnique (Technique *technique)
void SetTextureAnisotropy (int level)
void SetTextureFilterMode (TextureFilterMode mode)
void SetTextureQuality (MaterialQuality quality)
void SetSkinningMode (SkinningMode mode)
 Set skinning mode.
void SetNumSoftwareSkinningBones (unsigned numBones)
 Set number of bones used for software skinning.
unsigned GetNumViewports () const
ViewportGetViewport (unsigned index) const
ViewportGetViewportForScene (Scene *scene, unsigned index) const
 Return nth backbuffer viewport associated to a scene. Index 0 returns the first.
TechniqueGetDefaultTechnique () const
int GetTextureAnisotropy () const
TextureFilterMode GetTextureFilterMode () const
MaterialQuality GetTextureQuality () const
SkinningMode GetSkinningMode () const
 Return skinning mode.
bool GetUseHardwareSkinning () const
 Return whether hardware skinning is used.
unsigned GetNumSoftwareSkinningBones () const
 Return number of bones used for software skinning.
unsigned GetNumViews () const
unsigned GetNumGeometries () const
unsigned GetNumLights () const
unsigned GetNumShadowMaps () const
unsigned GetNumOccluders () const
ZoneGetDefaultZone () const
MaterialGetDefaultMaterial () const
Texture2DGetDefaultLightRamp () const
Texture2DGetDefaultLightSpot () const
TextureCubeGetBlackCubeMap () const
 Return completely black 1x1x1 cubemap.
const FrameInfoGetFrameInfo () const
 Return the frame update parameters.
const FrameStatisticsGetFrameStats () const
 Return statistics of current frame.
FrameStatisticsGetMutableFrameStats ()
void Update (float timeStep)
 Update for rendering. Called by HandleRenderUpdate().
void Render ()
 Render. Called by Engine.
void DrawDebugGeometry (bool depthTest)
 Add debug geometry to the debug renderer.
void QueueRenderSurface (RenderSurface *renderTarget)
 Queue a render surface's viewports for rendering. Called by the surface, or by View.
void QueueViewport (RenderSurface *renderTarget, Viewport *viewport)
 Queue a viewport for rendering. Null surface means backbuffer.
GeometryGetLightGeometry (Light *light)
 Return volume geometry for a light.
GeometryGetQuadGeometry ()
 Return quad geometry used in postprocessing.
- Public Member Functions inherited from Urho3D::Object
 Object (Context *context)
 ~Object () override
 Destruct. Clean up self from event sender & receiver structures.
virtual StringHash GetType () const =0
virtual const ea::string & GetTypeName () const =0
virtual const TypeInfoGetTypeInfo () const =0
 Return type info.
virtual void OnEvent (Object *sender, StringHash eventType, VariantMap &eventData)
 Handle event.
virtual void SerializeInBlock (Archive &archive)
 Serialize content from/to archive. May throw ArchiveException.
bool IsInstanceOf (StringHash type) const
 Check current instance is type of specified type.
bool IsInstanceOf (const TypeInfo *typeInfo) const
 Check current instance is type of specified type.
template<typename T >
bool IsInstanceOf () const
 Check current instance is type of specified class.
template<typename T >
T * Cast ()
 Cast the object to specified most derived class.
template<typename T >
const T * Cast () const
 Cast the object to specified most derived class.
void SubscribeToEventManual (StringHash eventType, EventHandler *handler)
 Subscribe to an event that can be sent by any sender.
void SubscribeToEventManual (Object *sender, StringHash eventType, EventHandler *handler)
 Subscribe to a specific sender's event.
template<class T >
void SubscribeToEvent (StringHash eventType, T handler)
 Subscribe to an event that can be sent by any sender.
template<class T >
void SubscribeToEvent (Object *sender, StringHash eventType, T handler)
 Subscribe to a specific sender's event.
void UnsubscribeFromEvent (StringHash eventType)
 Unsubscribe from an event.
void UnsubscribeFromEvent (Object *sender, StringHash eventType)
 Unsubscribe from a specific sender's event.
void UnsubscribeFromEvents (Object *sender)
 Unsubscribe from a specific sender's events.
void UnsubscribeFromAllEvents ()
 Unsubscribe from all events.
void UnsubscribeFromAllEventsExcept (const ea::vector< StringHash > &exceptions)
 Unsubscribe from all events except those listed.
void UnsubscribeFromAllEventsExcept (const ea::vector< Object * > &exceptions)
 Unsubscribe from all events except those with listed senders.
void SendEvent (StringHash eventType)
 Send event to all subscribers.
void SendEvent (StringHash eventType, VariantMap &eventData)
 Send event with parameters to all subscribers.
VariantMapGetEventDataMap () const
 Return a preallocated map for event data. Used for optimization to avoid constant re-allocation of event data maps.
template<typename... Args>
void SendEvent (StringHash eventType, const Args &... args)
 Send event with variadic parameter pairs to all subscribers. The parameters are (paramID, paramValue) pairs.
ContextGetContext () const
 Return execution context.
const VariantGetGlobalVar (StringHash key) const
const VariantMapGetGlobalVars () const
void SetGlobalVar (StringHash key, const Variant &value)
ObjectGetSubsystem (StringHash type) const
 Return subsystem by type.
ObjectGetEventSender () const
 Return active event sender. Null outside event handling.
EventHandlerGetEventHandler () const
 Return active event handler. Null outside event handling.
bool HasSubscribedToEvent (StringHash eventType) const
 Return whether has subscribed to an event without specific sender.
bool HasSubscribedToEvent (Object *sender, StringHash eventType) const
 Return whether has subscribed to a specific sender's event.
bool HasEventHandlers () const
 Return whether has subscribed to any event.
template<class T >
T * GetSubsystem () const
 Template version of returning a subsystem.
const ea::string & GetCategory () const
void SendEvent (StringHash eventType, const VariantMap &eventData)
 Send event with parameters to all subscribers.
void SetBlockEvents (bool block)
 Block object from sending and receiving events.
bool GetBlockEvents () const
 Return sending and receiving events blocking status.
- Public Member Functions inherited from Urho3D::RefCounted
 RefCounted ()
 Construct. Allocate the reference count structure and set an initial self weak reference.
virtual ~RefCounted ()
 Destruct. Mark as expired and also delete the reference count structure if no outside weak references exist.
 RefCounted (const RefCounted &rhs)=delete
 Prevent copy construction.
RefCountedoperator= (const RefCounted &rhs)=delete
 Prevent assignment.
int AddRef ()
int ReleaseRef ()
int Refs () const
int WeakRefs () const
RefCountRefCountPtr () const
 Return pointer to the reference count structure.
bool HasScriptObject () const
 Return true if script runtime object wrapping this native object exists.
bool IsScriptStrongRef () const
 Return true if script reference is strong.

Private Member Functions

 URHO3D_OBJECT (Renderer, Object)
void Initialize ()
 Initialize when screen mode initially set.
void ReleaseMaterialShaders ()
 Release shaders used in materials.
void ReloadTextures ()
 Reload textures.
void CreateGeometries ()
 Create light volume geometries.
void UpdateQueuedViewport (unsigned index)
 Update a queued viewport for rendering. More...
void HandleScreenMode (StringHash eventType, VariantMap &eventData)
 Handle screen mode event.
void HandleRenderUpdate (StringHash eventType, VariantMap &eventData)
 Handle render update event.
void UpdateMousePositionsForMainViewports ()

Private Attributes

WeakPtr< Graphicsgraphics_
 Graphics subsystem.
WeakPtr< RenderSurfacebackbufferSurface_
 Render surface that acts as backbuffer.
bool backbufferSurfaceViewportsDirty_ {}
SharedPtr< TechniquedefaultTechnique_
 Default non-textured material technique.
SharedPtr< ZonedefaultZone_
 Default zone.
SharedPtr< GeometrydirLightGeometry_
 Directional light quad geometry.
SharedPtr< GeometryspotLightGeometry_
 Spot light volume geometry.
SharedPtr< GeometrypointLightGeometry_
 Point light volume geometry.
SharedPtr< MaterialdefaultMaterial_
 Default material.
SharedPtr< Texture2DdefaultLightRamp_
 Default range attenuation texture.
SharedPtr< Texture2DdefaultLightSpot_
 Default spotlight attenuation texture.
SharedPtr< TextureCubeblackCubeMap_
ea::vector< SharedPtr< Viewport > > viewports_
 Backbuffer viewports.
ea::vector< ea::pair< WeakPtr< RenderSurface >, WeakPtr< Viewport > > > queuedViewports_
 Render surface viewports queued for update.
ea::vector< WeakPtr< RenderPipelineView > > renderPipelineViews_
 Render pipeline views that have been processed this frame.
ea::hash_set< Octree * > updatedOctrees_
 Octrees that have been updated during the frame.
ea::hash_set< Technique * > shaderErrorDisplayed_
 Techniques for which missing shader error has been displayed.
FrameInfo frame_
 Frame info for rendering.
int textureAnisotropy_ {4}
 Texture anisotropy level.
TextureFilterMode textureFilterMode_ {FILTER_TRILINEAR}
 Texture filtering mode.
MaterialQuality textureQuality_ {QUALITY_HIGH}
 Texture quality level.
bool initialized_ {}
 Initialized flag.
bool resetViews_ {}
 Flag for views needing reset.
bool hardwareSkinningSupported_ { true }
 Whether hardware skinning is supported.
SkinningMode skinningMode_ {}
 Skinning mode.
unsigned numSoftwareSkinningBones_ { 4 }
 Number of bones used for software skinning.
FrameStatistics frameStats_

Additional Inherited Members

- Static Public Member Functions inherited from Urho3D::Object
static const TypeInfoGetTypeInfoStatic ()
 Return type info static.
- Protected Attributes inherited from Urho3D::Object
WeakPtr< Contextcontext_
 Execution context.

Detailed Description

High-level rendering subsystem. Manages drawing of 3D views.

Member Function Documentation

◆ GetDefaultLightRamp()

Texture2D* Urho3D::Renderer::GetDefaultLightRamp ( ) const

Return the default range attenuation texture.

◆ GetDefaultLightSpot()

Texture2D* Urho3D::Renderer::GetDefaultLightSpot ( ) const

Return the default spotlight attenuation texture.

◆ GetDefaultMaterial()

Material* Urho3D::Renderer::GetDefaultMaterial ( ) const

Return the default material.

◆ GetDefaultTechnique()

Technique * Urho3D::Renderer::GetDefaultTechnique ( ) const

Return default non-textured material technique.

◆ GetDefaultZone()

Zone* Urho3D::Renderer::GetDefaultZone ( ) const

Return the default zone.

◆ GetNumGeometries()

unsigned Urho3D::Renderer::GetNumGeometries ( ) const

Return number of geometries rendered.

◆ GetNumLights()

unsigned Urho3D::Renderer::GetNumLights ( ) const

Return number of lights rendered.

◆ GetNumOccluders()

unsigned Urho3D::Renderer::GetNumOccluders ( ) const

Return number of occluders rendered.

◆ GetNumShadowMaps()

unsigned Urho3D::Renderer::GetNumShadowMaps ( ) const

Return number of shadow maps rendered.

◆ GetNumViewports()

unsigned Urho3D::Renderer::GetNumViewports ( ) const

Return number of backbuffer viewports.

◆ GetNumViews()

unsigned Urho3D::Renderer::GetNumViews ( ) const

Return number of views rendered.

◆ GetTextureAnisotropy()

int Urho3D::Renderer::GetTextureAnisotropy ( ) const

Return default texture max. anisotropy level.

◆ GetTextureFilterMode()

TextureFilterMode Urho3D::Renderer::GetTextureFilterMode ( ) const

Return default texture filtering mode.

◆ GetTextureQuality()

MaterialQuality Urho3D::Renderer::GetTextureQuality ( ) const

Return texture quality level.

◆ GetViewport()

Viewport * Urho3D::Renderer::GetViewport ( unsigned  index) const

Return backbuffer viewport by index.

◆ SetDefaultTechnique()

void Urho3D::Renderer::SetDefaultTechnique ( Technique technique)

Set default non-textured material technique.

◆ SetNumViewports()

void Urho3D::Renderer::SetNumViewports ( unsigned  num)

Set number of backbuffer viewports to render.

◆ SetTextureAnisotropy()

void Urho3D::Renderer::SetTextureAnisotropy ( int  level)

Set default texture max anisotropy level.

◆ SetTextureFilterMode()

void Urho3D::Renderer::SetTextureFilterMode ( TextureFilterMode  mode)

Set default texture filtering.

◆ SetTextureQuality()

void Urho3D::Renderer::SetTextureQuality ( MaterialQuality  quality)

Set texture quality level. See the QUALITY constants in GraphicsDefs.h.

◆ SetViewport()

void Urho3D::Renderer::SetViewport ( unsigned  index,
Viewport viewport 

Set a backbuffer viewport.

◆ UpdateQueuedViewport()

void Urho3D::Renderer::UpdateQueuedViewport ( unsigned  index)

Update a queued viewport for rendering.

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