Support Forum G3D Web Page |
A G3D::Surface for voxel rendering. More...
Inherits G3D::Surface.
Public Member Functions | |
virtual bool | canBeFullyRepresentedInGBuffer (const GBuffer::Specification &specification) const override |
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 override |
virtual void | getCoordinateFrame (CoordinateFrame &cframe, bool previous=false) const |
virtual void | getObjectSpaceBoundingBox (G3D::AABox &, bool) const override |
May be infinite. More... | |
virtual void | getObjectSpaceBoundingSphere (G3D::Sphere &, bool) const override |
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 passType) const override |
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 > &previousDepthBuffer, const float minZSeparation, TransparencyTestMode transparencyTestMode, const Color3 &transmissionWeight) const override |
Renders into depthOnly buffer for shadow mapping. 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 override |
Renders into GBuffer for deferred shading. More... | |
virtual void | renderIntoSVOHomogeneous (RenderDevice *rd, Array< shared_ptr< Surface > > &surfaceArray, const shared_ptr< SVO > &svo, const CFrame &previousCameraFrame) const override |
Intentionally does nothing. More... | |
RenderMask | renderMask () const |
virtual void | renderWireframeHomogeneous (RenderDevice *rd, const Array< shared_ptr< Surface > > &surfaceArray, const Color4 &color, bool previous) const override |
Intentionally does nothing. More... | |
uint64 | rigidBodyID () const |
An identifier that, if nonzero, is unique for a combination of geometry and material. More... | |
virtual void | setStorage (ImageStorage newStorage) override |
virtual TransparencyType | transparencyType () const override |
What type of transparency (= alpha and transmission) does this surface have? More... | |
Static Public Member Functions | |
static shared_ptr< VoxelSurface > | create (const String &name, const CFrame &frame, const CFrame &previousFrame, const shared_ptr< VoxelModel > &model, const shared_ptr< Entity > &entity, const Surface::ExpressiveLightScatteringProperties &expressive) |
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 | |
VoxelSurface (const String &name, const CFrame &frame, const CFrame &previousFrame, const shared_ptr< VoxelModel > &model, const shared_ptr< Entity > &entity, const Surface::ExpressiveLightScatteringProperties &expressive) | |
virtual void | bindDepthPeelArgs (Args &args, RenderDevice *rd, const shared_ptr< Texture > &depthPeelTexture, const float minZSeparation) const |
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 Entity > | m_entity |
const CFrame | m_frame |
shared_ptr< class Model > | m_model |
const String | m_name |
bool | m_preferLowResolutionTransparency |
Hint for renderers to use low resolution rendering. More... | |
const CFrame | m_previousFrame |
const String | m_profilerHint |
uint64 | m_rigidBodyID = 0 |
const shared_ptr< VoxelModel > | m_voxelModel |
A G3D::Surface for voxel rendering.
The current implementation supports only deferred shading.
|
protected |
|
protectedvirtual |
|
inlineoverridevirtual |
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.
Implements G3D::Surface.
|
virtualinherited |
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.
|
inlinevirtualinherited |
Reimplemented in G3D::UniversalSurface, G3D::ParticleSurface, and G3D::FogVolumeSurface.
|
static |
|
inlinestaticprotectedinherited |
Like std::make_shared, but works for protected constructors.
Call as createShared<myclass>.
|
staticprotectedinherited |
Referenced by G3D::Surface::cull().
|
inlinestaticinherited |
Computes the array of surfaces that can be seen by camera.
Preserves order.
|
inlinestaticinherited |
Culls surfaces in place.
|
inlineinherited |
The Entity that created this surface.
May be nullptr
Referenced by G3D::ParticleSurface::create(), and G3D::ParticleSurface::ParticleSurface().
|
inlineoverridevirtual |
Reimplemented from G3D::Surface.
|
staticinherited |
|
virtualinherited |
Reimplemented in G3D::UniversalSurface, G3D::HeightfieldModel::Tile, G3D::ControlPointEditor::ControlPointSurface, G3D::SkyboxSurface, G3D::VisualizeLightSurface, and G3D::VisualizeCameraSurface.
Referenced by G3D::Surface::frame().
|
overridevirtual |
May be infinite.
Implements G3D::Surface.
|
overridevirtual |
May be infinite.
Implements G3D::Surface.
|
inlinevirtualinherited |
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.
|
staticinherited |
|
staticinherited |
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.
|
inlinevirtualinherited |
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.
|
inlinevirtualinherited |
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.
|
inlinevirtualinherited |
Reimplemented in G3D::SkyboxSurface.
|
virtualinherited |
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.
|
inlineinherited |
The Model that created this surface.
May be nullptr
|
virtualinherited |
Name of the underlying model or part for debugging purposes.
Reimplemented in G3D::UniversalSurface, G3D::HeightfieldModel::Tile, G3D::ControlPointEditor::ControlPointSurface, G3D::SkyboxSurface, G3D::VisualizeLightSurface, and G3D::VisualizeCameraSurface.
|
inlineinherited |
|
overridevirtual |
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.
environment | World-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.
Implements G3D::Surface.
|
staticinherited |
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.
|
overridevirtual |
Renders into depthOnly buffer for shadow mapping.
Reimplemented from G3D::Surface.
|
virtualinherited |
Render a set of surfaces from the same most-derived class type.
The default implementation calls render() on each surface.
surfaceArray | Pre-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.
|
staticinherited |
Renders front-to-back to a GBuffer using current stencil and depth operations.
sortedVisible | Surfaces that are visible to the camera (i.e., already culled) and sorted from back to front. |
previousCameraFrame | Used 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.
lightingEnvironment | Provided 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. |
|
overridevirtual |
Renders into GBuffer for deferred shading.
Reimplemented from G3D::Surface.
|
staticinherited |
|
inlineoverridevirtual |
Intentionally does nothing.
Reimplemented from G3D::Surface.
|
inherited |
|
staticinherited |
Utility function for rendering a set of surfaces in wireframe using the current blending mode.
previous | If true, the caller should set the RenderDevice camera transformation to the previous one. |
|
inlineoverridevirtual |
Intentionally does nothing.
Implements G3D::Surface.
|
inlineinherited |
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.
|
inlineoverridevirtual |
Implements G3D::Surface.
|
staticinherited |
Set the storage on all Materials in the array.
|
inlinestaticinherited |
|
staticinherited |
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.
wsLookVector | Sort axis; usually the -Z axis of the camera. |
Referenced by G3D::Surface::sortBackToFront().
|
inlineoverridevirtual |
What type of transparency (= alpha and transmission) does this surface have?
Implements G3D::Surface.
|
inherited |
|
protectedinherited |
Referenced by G3D::Surface::entity(), and G3D::ParticleSurface::ParticleSurface().
|
protectedinherited |
Referenced by G3D::Surface::model().
|
protected |
|
protectedinherited |
Hint for renderers to use low resolution rendering.
Referenced by G3D::FogVolumeSurface::FogVolumeSurface(), and G3D::Surface::preferLowResolutionTransparency().
|
protected |
|
protectedinherited |
Referenced by G3D::Surface::rigidBodyID().
|
protected |