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

The surface of a model, posed and ready for rendering. More...

Inherits G3D::ReferenceCountedObject.

Inherited by G3D::ControlPointEditor::ControlPointSurface, G3D::FogVolumeSurface, G3D::HeightfieldModel::Tile, G3D::ParticleSurface, G3D::PointSurface, G3D::SkyboxSurface, G3D::TextSurface, G3D::UniversalSurface, G3D::VisualizeCameraSurface, G3D::VisualizeLightSurface, and G3D::VoxelSurface.

Classes

class  ExpressiveLightScatteringProperties
 Non-physical properties that a Surface might use to affect light transport. More...
 

Public Member Functions

virtual ~Surface ()
 
virtual bool canBeFullyRepresentedInGBuffer (const GBuffer::Specification &specification) const =0
 Can this particular instance of this type of Surface be fully described in a G3D::GBuffer using the given specification? More...
 
virtual bool canChange () const
 Returns true if this surface should be included in static data structures because it is from an object that never changes. More...
 
virtual bool canRenderIntoSVO () const
 
const shared_ptr< Entity > & entity () const
 The Entity that created this surface. More...
 
virtual CoordinateFrame frame (bool previous=false) const
 
virtual void getCoordinateFrame (CoordinateFrame &cframe, bool previous=false) const
 
virtual void getObjectSpaceBoundingBox (AABox &box, bool previous=false) const =0
 May be infinite. More...
 
virtual void getObjectSpaceBoundingSphere (Sphere &sphere, bool previous=false) const =0
 May be infinite. More...
 
virtual void getObjectSpaceGeometry (Array< int > &index, Array< Point3 > &vertex, Array< Vector3 > &normal, Array< Vector4 > &packedTangent, Array< Point2 > &texCoord, bool previous=false) const
 Clears the arrays and appends indexed triangle list information. More...
 
virtual void getTrisHomogeneous (const Array< shared_ptr< Surface > > &surfaceArray, CPUVertexArray &cpuVertexArray, Array< Tri > &triArray, bool computePrevPosition=false) const
 Creates and appends Tris and CPUVertexArray::Vertices onto the parameter arrays using the cpuGeom's of the surfaces in surfaceArray. More...
 
virtual bool hasTransmission () const
 If true, this object transmits light, potentially refracting it and filtering the background with color or diffusion. More...
 
virtual bool isSkybox () const
 
virtual RealTime lastChangeTime () const
 Wall-clock time at which the source of this surface changed in some way, e.g., that might require recomputing a shadow map or spatial data structure. More...
 
const shared_ptr< Model > & model () const
 The Model that created this surface. More...
 
virtual String name () const
 Name of the underlying model or part for debugging purposes. More...
 
bool preferLowResolutionTransparency () const
 
virtual void render (RenderDevice *rd, const LightingEnvironment &environment, RenderPassType passTypen) const =0
 Forward-render all illumination terms for each element of surfaceArray, which must all be of the same most-derived type as this. More...
 
virtual void renderDepthOnlyHomogeneous (RenderDevice *rd, const Array< shared_ptr< Surface > > &surfaceArray, const shared_ptr< Texture > &depthPeelTexture, const float depthPeelEpsilon, TransparencyTestMode transparencyTestMode, const Color3 &transmissionWeight) const
 Use the current RenderDevice::cullFace. More...
 
virtual void renderHomogeneous (RenderDevice *rd, const Array< shared_ptr< Surface > > &surfaceArray, const LightingEnvironment &lightingEnvironment, RenderPassType passType) const
 Render a set of surfaces from the same most-derived class type. More...
 
virtual void renderIntoGBufferHomogeneous (RenderDevice *rd, const Array< shared_ptr< Surface > > &surfaceArray, const shared_ptr< GBuffer > &gbuffer, const shared_ptr< Texture > &depthPeelTexture, const float minZSeparation, const LightingEnvironment &lighting) const
 
Render all instances of surfaceArray to the currently-bound Framebuffer using the fields and mapping dictated by specification. More...
 
virtual void renderIntoSVOHomogeneous (RenderDevice *rd, Array< shared_ptr< Surface > > &surfaceArray, const shared_ptr< SVO > &svo, const CFrame &previousCameraFrame) const
 
RenderMask renderMask () const
 
virtual void renderWireframeHomogeneous (RenderDevice *rd, const Array< shared_ptr< Surface > > &surfaceArray, const Color4 &color, bool previous) const =0
 Rendering a set of surfaces in wireframe, using the current blending mode. More...
 
uint64 rigidBodyID () const
 An identifier that, if nonzero, is unique for a combination of geometry and material. More...
 
virtual void setStorage (ImageStorage newStorage)=0
 
virtual TransparencyType transparencyType () const =0
 What type of transparency (= alpha and transmission) does this surface have? More...
 

Static Public Member Functions

static void cull (const CoordinateFrame &cameraFrame, const class Projection &cameraProjection, const class Rect2D &viewport, const Array< shared_ptr< Surface > > &allSurfaces, Array< shared_ptr< Surface > > &outSurfaces, bool previous=false)
 Computes the array of surfaces that can be seen by camera. More...
 
static void cull (const CoordinateFrame &cameraFrame, const class Projection &cameraProjection, const class Rect2D &viewport, Array< shared_ptr< Surface > > &allSurfaces, bool previous=false)
 Culls surfaces in place. More...
 
static void getBoxBounds (const Array< shared_ptr< Surface >> &surfaceArray, AABox &bounds, bool previous=false, bool &anyInfinite=ignoreBool, bool onlyShadowCasters=false)
 Computes the world-space bounding box of an array of Surfaces of any type. More...
 
static void getSphereBounds (const Array< shared_ptr< Surface > > &surfaceArray, Sphere &bounds, bool previous=false, bool &anyInfinite=ignoreBool, bool onlyShadowCasters=false)
 Computes the world-space bounding sphere of an array of Surfaces of any type. More...
 
static void getTris (const Array< shared_ptr< Surface > > &surfaceArray, CPUVertexArray &cpuVertexArray, Array< Tri > &triArray, bool computePrevPosition=false)
 Returns a CPUVertexArray and an Array<Tri> generated from the surfaces in surfaceArray, with everything transformed to world space First separates surfaceArray by derived type and then calls getTrisHomogenous. More...
 
static void renderDepthOnly (RenderDevice *rd, const Array< shared_ptr< Surface > > &surfaceArray, CullFace cull, const shared_ptr< Texture > &depthPeelTexture=nullptr, const float minZSeparation=0.0f, TransparencyTestMode transparencyTestMode=TransparencyTestMode::REJECT_TRANSPARENCY, const Color3 &transmissionWeight=Color3::white()/3.0f)
 Render geometry only (no shading), and ignore color (but do perform alpha testing). More...
 
static void renderIntoGBuffer (RenderDevice *rd, const Array< shared_ptr< Surface > > &sortedVisible, const shared_ptr< GBuffer > &gbuffer, const shared_ptr< Texture > &depthPeelTexture=shared_ptr< Texture >(), const float minZSeparation=0.0f, const LightingEnvironment &lightingEnvironment=LightingEnvironment())
 Renders front-to-back to a GBuffer using current stencil and depth operations. More...
 
static void renderIntoSVO (RenderDevice *rd, Array< shared_ptr< Surface > > &visible, const shared_ptr< SVO > &svo, const CoordinateFrame &previousCameraFrame=CoordinateFrame())
 
static void renderWireframe (RenderDevice *rd, const Array< shared_ptr< Surface > > &surfaceArray, const Color4 &color=Color3::black(), bool previous=false)
 Utility function for rendering a set of surfaces in wireframe using the current blending mode. More...
 
static void setStorage (const Array< shared_ptr< Surface >> &surfaceArray, ImageStorage newStorage)
 Set the storage on all Materials in the array. More...
 
static void sortBackToFront (Array< shared_ptr< Surface > > &surfaces, const Vector3 &wsLookVector)
 
static void sortFrontToBack (Array< shared_ptr< Surface > > &surfaces, const Vector3 &wsLookVector)
 Divides the inModels into a front-to-back sorted array of opaque models and a back-to-front sorted array of potentially transparent models. More...
 

Public Attributes

const ExpressiveLightScatteringProperties expressiveLightScatteringProperties
 

Protected Member Functions

 Surface (const ExpressiveLightScatteringProperties &e=ExpressiveLightScatteringProperties(), bool preferLowResTransparency=false)
 

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...
 
static void cull (const CoordinateFrame &cameraFrame, const class Projection &cameraProjection, const class Rect2D &viewport, Array< shared_ptr< Surface > > &allSurfaces, Array< shared_ptr< Surface > > &outSurfaces, bool previous, bool inPlace)
 

Protected Attributes

shared_ptr< class Entitym_entity
 
shared_ptr< class Modelm_model
 
bool m_preferLowResolutionTransparency
 Hint for renderers to use low resolution rendering. More...
 
uint64 m_rigidBodyID = 0
 

Detailed Description

The surface of a model, posed and ready for rendering.

Most methods support efficient OpenGL rendering, but this class also supports extracting a mesh that approximates the surface for ray tracing or collision detection.

"Homogeneous" Methods: Many subclasses of Surface need to bind shader and other state in order to render. To amortize the cost of doing so, renderers use categorizeByDerivedType<shared_ptr<Surface> > to distinguish subclasses and then invoke the methods with names ending in "Homogeneous" on arrays of derived instances.

"previous" Arguments: To support motion blur and reverse reprojection, Surface represents the surface at two times: the "current" time, and some "previous" time that is usually the previous frame. The pose of the underlying model at these times is specified to the class that created the Surface. All rendering methods, including shading, operate on the current-time version. A GBuffer can represent a forward difference estimate of velocity in these with a GBuffer::Field::CS_POSITION_CHANGE field. Access methods on Surface take a boolean argument previous that specifies whether the "current" or "previous" description of the surface is desired.

Note that one could also render at multiple times by posing the original models at different times. However, models do not guarantee that they will produce the same number of Surfaces, or Surfaces with the same topology each time that they are posed. The use of timeOffset allows the caller to assume that the geometry deforms but has the same topology across an interval.

Constructor & Destructor Documentation

◆ Surface()

G3D::Surface::Surface ( const ExpressiveLightScatteringProperties e = ExpressiveLightScatteringProperties(),
bool  preferLowResTransparency = false 
)
inlineprotected

◆ ~Surface()

virtual G3D::Surface::~Surface ( )
inlinevirtual

Member Function Documentation

◆ canBeFullyRepresentedInGBuffer()

virtual bool G3D::Surface::canBeFullyRepresentedInGBuffer ( const GBuffer::Specification specification) const
pure virtual

Can this particular instance of this type of Surface be fully described in a G3D::GBuffer using the given specification?

Often set to false for Surfaces with fractional alpha values, transmission, special back-to-front rendering needs, that require more dynamic range in the emissive channel, or that simply lack a renderIntoGBufferHomogeneous implementation.

Surfaces that return false for canBeFullyRepresentedInGBuffer may still implement renderIntoGBufferHomogeneous for the parts of their surfaces that are representable, and doing so will improve the quality of AmbientOcclusion and post-processing techniques like MotionBlur and DepthOfField.

See also
anyUnblended, requiresBlending

Implemented in G3D::UniversalSurface, G3D::HeightfieldModel::Tile, G3D::ControlPointEditor::ControlPointSurface, G3D::VisualizeLightSurface, G3D::SkyboxSurface, G3D::TextSurface, G3D::VisualizeCameraSurface, G3D::ParticleSurface, G3D::VoxelSurface, G3D::FogVolumeSurface, and G3D::PointSurface.

◆ canChange()

virtual bool G3D::Surface::canChange ( ) const
virtual

Returns true if this surface should be included in static data structures because it is from an object that never changes.

The default implementation tests whether the surface comes from an Entity and that Entity::canChange.

See also
Entity::canChange
lastChangeTime

◆ canRenderIntoSVO()

virtual bool G3D::Surface::canRenderIntoSVO ( ) const
inlinevirtual

◆ 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>.

◆ cull() [1/3]

static void G3D::Surface::cull ( const CoordinateFrame cameraFrame,
const class Projection cameraProjection,
const class Rect2D viewport,
Array< shared_ptr< Surface > > &  allSurfaces,
Array< shared_ptr< Surface > > &  outSurfaces,
bool  previous,
bool  inPlace 
)
staticprotected

Referenced by cull().

◆ cull() [2/3]

static void G3D::Surface::cull ( const CoordinateFrame cameraFrame,
const class Projection cameraProjection,
const class Rect2D viewport,
const Array< shared_ptr< Surface > > &  allSurfaces,
Array< shared_ptr< Surface > > &  outSurfaces,
bool  previous = false 
)
inlinestatic

Computes the array of surfaces that can be seen by camera.

Preserves order.

◆ cull() [3/3]

static void G3D::Surface::cull ( const CoordinateFrame cameraFrame,
const class Projection cameraProjection,
const class Rect2D viewport,
Array< shared_ptr< Surface > > &  allSurfaces,
bool  previous = false 
)
inlinestatic

Culls surfaces in place.

◆ entity()

const shared_ptr<Entity>& G3D::Surface::entity ( ) const
inline

The Entity that created this surface.

May be nullptr

Referenced by G3D::ParticleSurface::create(), and G3D::ParticleSurface::ParticleSurface().

◆ frame()

virtual CoordinateFrame G3D::Surface::frame ( bool  previous = false) const
inlinevirtual

◆ getBoxBounds()

static void G3D::Surface::getBoxBounds ( const Array< shared_ptr< Surface >> &  surfaceArray,
AABox bounds,
bool  previous = false,
bool &  anyInfinite = ignoreBool,
bool  onlyShadowCasters = false 
)
static

Computes the world-space bounding box of an array of Surfaces of any type.

Ignores infinite bounding boxes.

Parameters
anyInfiniteSet to true if any bounding box in surfaceArray was infinite. Not modified otherwise.
onlyShadowCastersIf true, only get the bounds of shadow casting surfaces.

◆ getCoordinateFrame()

virtual void G3D::Surface::getCoordinateFrame ( CoordinateFrame cframe,
bool  previous = false 
) const
virtual

◆ getObjectSpaceBoundingBox()

virtual void G3D::Surface::getObjectSpaceBoundingBox ( AABox box,
bool  previous = false 
) const
pure virtual

◆ getObjectSpaceBoundingSphere()

virtual void G3D::Surface::getObjectSpaceBoundingSphere ( Sphere sphere,
bool  previous = false 
) const
pure virtual

◆ getObjectSpaceGeometry()

virtual void G3D::Surface::getObjectSpaceGeometry ( Array< int > &  index,
Array< Point3 > &  vertex,
Array< Vector3 > &  normal,
Array< Vector4 > &  packedTangent,
Array< Point2 > &  texCoord,
bool  previous = false 
) const
inlinevirtual

Clears the arrays and appends indexed triangle list information.

Many subclasses will ignore previous because they only use that for rigid-body transformations and can be represented by the current geometry and moving coordinate frame. However, it is possible to include skinning or keyframe information in a Surface and respond to timeOffset.

Not required to be implemented.

Reimplemented in G3D::UniversalSurface.

◆ getSphereBounds()

static void G3D::Surface::getSphereBounds ( const Array< shared_ptr< Surface > > &  surfaceArray,
Sphere bounds,
bool  previous = false,
bool &  anyInfinite = ignoreBool,
bool  onlyShadowCasters = false 
)
static

Computes the world-space bounding sphere of an array of Surfaces of any type.

Ignores infinite bounding boxes.

Parameters
anyInfiniteSet to true if any bounding box in surfaceArray was infinite. Not modified otherwise.
onlyShadowCastersIf true, only get the bounds of shadow casting surfaces.

◆ getTris()

static void G3D::Surface::getTris ( const Array< shared_ptr< Surface > > &  surfaceArray,
CPUVertexArray cpuVertexArray,
Array< Tri > &  triArray,
bool  computePrevPosition = false 
)
static

Returns a CPUVertexArray and an Array<Tri> generated from the surfaces in surfaceArray, with everything transformed to world space First separates surfaceArray by derived type and then calls getTrisHomogenous.

◆ getTrisHomogeneous()

virtual void G3D::Surface::getTrisHomogeneous ( const Array< shared_ptr< Surface > > &  surfaceArray,
CPUVertexArray cpuVertexArray,
Array< Tri > &  triArray,
bool  computePrevPosition = false 
) const
inlinevirtual

Creates and appends Tris and CPUVertexArray::Vertices onto the parameter arrays using the cpuGeom's of the surfaces in surfaceArray.

Invoking this with elements of surfaceArray that are not of the same most-derived type as this will result in an error.

This function maintains a table of already used cpuGeoms, so that we don't need to duplicate things unneccessarily.

Reimplemented in G3D::UniversalSurface.

◆ hasTransmission()

virtual bool G3D::Surface::hasTransmission ( ) const
inlinevirtual

If true, this object transmits light, potentially refracting it and filtering the background with color or diffusion.

This says nothing about whether it has partial coverage.

The default implementation returns false.

Reimplemented in G3D::UniversalSurface, G3D::HeightfieldModel::Tile, G3D::ParticleSurface, G3D::FogVolumeSurface, and G3D::VisualizeLightSurface.

◆ isSkybox()

virtual bool G3D::Surface::isSkybox ( ) const
inlinevirtual

Reimplemented in G3D::SkyboxSurface.

◆ lastChangeTime()

virtual RealTime G3D::Surface::lastChangeTime ( ) const
virtual

Wall-clock time at which the source of this surface changed in some way, e.g., that might require recomputing a shadow map or spatial data structure.

The default implementation returns the Entity's last change time if it is not null or System::time() otherwise, indicating that the surface is always out of date.

See also
canChange

◆ model()

const shared_ptr<Model>& G3D::Surface::model ( ) const
inline

The Model that created this surface.

May be nullptr

◆ name()

virtual String G3D::Surface::name ( ) const
virtual

◆ preferLowResolutionTransparency()

bool G3D::Surface::preferLowResolutionTransparency ( ) const
inline

◆ render()

virtual void G3D::Surface::render ( RenderDevice rd,
const LightingEnvironment environment,
RenderPassType  passTypen 
) const
pure virtual

Forward-render all illumination terms for each element of surfaceArray, which must all be of the same most-derived type as this.

Implementations must obey the semantics of the current stencil, viewport, clipping, and depth tests.

Parameters
environmentWorld-space, screen-space, and light-space data needed for illumination.

Use the writePixel() function defined by the Framebuffer for generating output. when passType == RenderPassType::SINGLE_PASS_UNORDERED_BLENDED_SAMPLES.

Implemented in G3D::UniversalSurface, G3D::HeightfieldModel::Tile, G3D::ParticleSurface, G3D::TextSurface, G3D::SkyboxSurface, G3D::VoxelSurface, G3D::FogVolumeSurface, G3D::ControlPointEditor::ControlPointSurface, G3D::PointSurface, G3D::VisualizeLightSurface, and G3D::VisualizeCameraSurface.

◆ renderDepthOnly()

static void G3D::Surface::renderDepthOnly ( RenderDevice rd,
const Array< shared_ptr< Surface > > &  surfaceArray,
CullFace  cull,
const shared_ptr< Texture > &  depthPeelTexture = nullptr,
const float  minZSeparation = 0.0f,
TransparencyTestMode  transparencyTestMode = TransparencyTestMode::REJECT_TRANSPARENCY,
const Color3 transmissionWeight = Color3::white()/3.0f 
)
static

Render geometry only (no shading), and ignore color (but do perform alpha testing).

Render only back or front faces (two-sided surfaces render no matter what).

Does not sort or cull based on the view frustum of the camera like other batch rendering routines–sort before invoking if you want that.

Used for z prepass and shadow mapping.

◆ renderDepthOnlyHomogeneous()

virtual void G3D::Surface::renderDepthOnlyHomogeneous ( RenderDevice rd,
const Array< shared_ptr< Surface > > &  surfaceArray,
const shared_ptr< Texture > &  depthPeelTexture,
const float  depthPeelEpsilon,
TransparencyTestMode  transparencyTestMode,
const Color3 transmissionWeight 
) const
virtual

Use the current RenderDevice::cullFace.

Assume that surfaceArray is sorted back to front, so render in reverse order for optimal early-z test behavior.

Parameters
transparencyTestModenet coverage testing mode applied after the alphaFilter's processing.
transmissionWeightHow wavelength-varying transmission elements (for shadow map rendering: lightPower/dot(lightPower, vec3(1,1,1)))
See also
renderDepthOnly

Reimplemented in G3D::UniversalSurface, G3D::HeightfieldModel::Tile, G3D::SkyboxSurface, G3D::ParticleSurface, G3D::TextSurface, G3D::VoxelSurface, G3D::FogVolumeSurface, G3D::PointSurface, G3D::VisualizeLightSurface, and G3D::VisualizeCameraSurface.

◆ renderHomogeneous()

virtual void G3D::Surface::renderHomogeneous ( RenderDevice rd,
const Array< shared_ptr< Surface > > &  surfaceArray,
const LightingEnvironment lightingEnvironment,
RenderPassType  passType 
) const
virtual

Render a set of surfaces from the same most-derived class type.

The default implementation calls render() on each surface.

Parameters
surfaceArrayPre-sorted from back to front and culled to the current camera. Invoking this method with elements of surfaceArray that are not of the same most-derived type as this will result in an error.

Reimplemented in G3D::HeightfieldModel::Tile, G3D::ParticleSurface, and G3D::TextSurface.

◆ renderIntoGBuffer()

static void G3D::Surface::renderIntoGBuffer ( RenderDevice rd,
const Array< shared_ptr< Surface > > &  sortedVisible,
const shared_ptr< GBuffer > &  gbuffer,
const shared_ptr< Texture > &  depthPeelTexture = shared_ptr< Texture >(),
const float  minZSeparation = 0.0f,
const LightingEnvironment lightingEnvironment = LightingEnvironment() 
)
static

Renders front-to-back to a GBuffer using current stencil and depth operations.

Parameters
sortedVisibleSurfaces that are visible to the camera (i.e., already culled) and sorted from back to front.
previousCameraFrameUsed for rendering GBuffer::CS_POSITION_CHANGE frames.

If depthPeelTexture is not null, then use it and minZSeparation to perform a depth peel. This will result in the depth buffer representing the closest geometry at least minZSeparation behind the geometry in depthPeelTexture.

Parameters
lightingEnvironmentProvided even though this method is primarily used for deferred shading to allow objects with partly pre-computed lighting to complete their shading and write directly to the emissive buffer.
See also
cull, sortBackToFront

◆ renderIntoGBufferHomogeneous()

virtual void G3D::Surface::renderIntoGBufferHomogeneous ( RenderDevice rd,
const Array< shared_ptr< Surface > > &  surfaceArray,
const shared_ptr< GBuffer > &  gbuffer,
const shared_ptr< Texture > &  depthPeelTexture,
const float  minZSeparation,
const LightingEnvironment lighting 
) const
inlinevirtual


Render all instances of surfaceArray to the currently-bound Framebuffer using the fields and mapping dictated by specification.

This is also used for depth-only (e.g., z-prepass) rendering.

Invoking this with elements of surfaceArray that are not of the same most-derived type as this will result in an error.

If depthPeelTexture is not null, then use it and minZSeparation to perform a depth peel. This will result in the GBuffer representing the closest geometry at least minZSeparation behind the geometry in depthPeelTexture.

Parameters
previousCameraFrameUsed for rendering GBuffer::CS_POSITION_CHANGE frames.
See also
renderIntoGBuffer

Reimplemented in G3D::UniversalSurface, G3D::HeightfieldModel::Tile, G3D::VoxelSurface, G3D::SkyboxSurface, and G3D::PointSurface.

◆ renderIntoSVO()

static void G3D::Surface::renderIntoSVO ( RenderDevice rd,
Array< shared_ptr< Surface > > &  visible,
const shared_ptr< SVO > &  svo,
const CoordinateFrame previousCameraFrame = CoordinateFrame() 
)
static

◆ renderIntoSVOHomogeneous()

virtual void G3D::Surface::renderIntoSVOHomogeneous ( RenderDevice rd,
Array< shared_ptr< Surface > > &  surfaceArray,
const shared_ptr< SVO > &  svo,
const CFrame previousCameraFrame 
) const
inlinevirtual

◆ renderMask()

RenderMask G3D::Surface::renderMask ( ) const

◆ renderWireframe()

static void G3D::Surface::renderWireframe ( RenderDevice rd,
const Array< shared_ptr< Surface > > &  surfaceArray,
const Color4 color = Color3::black(),
bool  previous = false 
)
static

Utility function for rendering a set of surfaces in wireframe using the current blending mode.

Parameters
previousIf true, the caller should set the RenderDevice camera transformation to the previous one.

◆ renderWireframeHomogeneous()

virtual void G3D::Surface::renderWireframeHomogeneous ( RenderDevice rd,
const Array< shared_ptr< Surface > > &  surfaceArray,
const Color4 color,
bool  previous 
) const
pure virtual

Rendering a set of surfaces in wireframe, using the current blending mode.

This is primarily used for debugging.

Invoking this with elements of surfaceArray that are not of the same most-derived type as this will result in an error.

If depthPeelTexture is not null, then use it and minZSeparation to perform a depth peel. This will result in the depth buffer representing the closest geometry at least minZSeparation behind the geometry in depthPeelTexture.

Parameters
previousIf true, the caller should set the RenderDevice camera transformation to the previous one. This is provided for debugging previous frame data.
See also
renderWireframe

Implemented in G3D::UniversalSurface, G3D::HeightfieldModel::Tile, G3D::TextSurface, G3D::VoxelSurface, G3D::ParticleSurface, G3D::SkyboxSurface, G3D::PointSurface, G3D::ControlPointEditor::ControlPointSurface, G3D::VisualizeLightSurface, and G3D::VisualizeCameraSurface.

◆ rigidBodyID()

uint64 G3D::Surface::rigidBodyID ( ) const
inline

An identifier that, if nonzero, is unique for a combination of geometry and material.

This allows high-level data structures such as G3D::TriTreeBase to identify corresponding Surfaces between frames that have moved but not otherwise changed and avoid rebuilding the data structure.

◆ setStorage() [1/2]

static void G3D::Surface::setStorage ( const Array< shared_ptr< Surface >> &  surfaceArray,
ImageStorage  newStorage 
)
static

Set the storage on all Materials in the array.

◆ setStorage() [2/2]

virtual void G3D::Surface::setStorage ( ImageStorage  newStorage)
pure virtual

◆ sortBackToFront()

static void G3D::Surface::sortBackToFront ( Array< shared_ptr< Surface > > &  surfaces,
const Vector3 wsLookVector 
)
inlinestatic

◆ sortFrontToBack()

static void G3D::Surface::sortFrontToBack ( Array< shared_ptr< Surface > > &  surfaces,
const Vector3 wsLookVector 
)
static

Divides the inModels into a front-to-back sorted array of opaque models and a back-to-front sorted array of potentially transparent models.

Any data originally in the output arrays is cleared.

Parameters
wsLookVectorSort axis; usually the -Z axis of the camera.

Referenced by sortBackToFront().

◆ transparencyType()

virtual TransparencyType G3D::Surface::transparencyType ( ) const
pure virtual

Member Data Documentation

◆ expressiveLightScatteringProperties

const ExpressiveLightScatteringProperties G3D::Surface::expressiveLightScatteringProperties

◆ m_entity

shared_ptr<class Entity> G3D::Surface::m_entity
protected

◆ m_model

shared_ptr<class Model> G3D::Surface::m_model
protected

Referenced by model().

◆ m_preferLowResolutionTransparency

bool G3D::Surface::m_preferLowResolutionTransparency
protected

Hint for renderers to use low resolution rendering.

Referenced by G3D::FogVolumeSurface::FogVolumeSurface(), and preferLowResolutionTransparency().

◆ m_rigidBodyID

uint64 G3D::Surface::m_rigidBodyID = 0
protected

Referenced by rigidBodyID().


documentation generated on Wed Nov 24 2021 08:02:00 using doxygen 1.8.15