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


Base class for materials in G3D, mostly useful as an interface for ray tracing since hardware rasterization rendering needs to be specialized for each Surface and Material subclass. More...

Inherits G3D::ReferenceCountedObject.

Inherited by G3D::UniversalMaterial.

Public Member Functions

virtual bool coverageLessThanEqual (const float alphaThreshold, const Point2 &texCoord) const =0
 Returns true if this material has an alpha value less than alphaThreshold at texCoord. More...
 
virtual bool hasPartialCoverage () const =0
 Return true if coverageLessThanEqual(1) can ever return true. More...
 
virtual const Stringname () const =0
 
virtual void sample (const Tri &tri, float u, float v, int triIndex, const CPUVertexArray &vertexArray, bool backside, shared_ptr< Surfel > &surfel, float du=0, float dv=0, bool twoSided=true) const =0
 
virtual void setStorage (ImageStorage s) const =0
 

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

Detailed Description


Base class for materials in G3D, mostly useful as an interface for ray tracing since hardware rasterization rendering needs to be specialized for each Surface and Material subclass.

lazy_ptr

Material is a lazy_ptr subclass so that classes using it mayassociate arbitrary data with UniversalMaterials or computing Materials on demand without having to subclass UniversalMaterial itself.

Subclassing UniversalMaterial is often undesirable because that class has complex initialization and data management routines. Note that UniversalMaterial itself implements lazy_ptr<UniversalMaterial>, so you can simply use a UniversalMaterial with any API (such as Tri) that requires a proxy.

See also
UniversalMaterial

Member Function Documentation

◆ coverageLessThanEqual()

virtual bool G3D::Material::coverageLessThanEqual ( const float  alphaThreshold,
const Point2 texCoord 
) const
pure virtual

Returns true if this material has an alpha value less than alphaThreshold at texCoord.

Implemented in G3D::UniversalMaterial.

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

◆ hasPartialCoverage()

virtual bool G3D::Material::hasPartialCoverage ( ) const
pure virtual

Return true if coverageLessThanEqual(1) can ever return true.

Implemented in G3D::UniversalMaterial.

◆ name()

virtual const String& G3D::Material::name ( ) const
pure virtual

Implemented in G3D::UniversalMaterial.

◆ sample()

virtual void G3D::Material::sample ( const Tri tri,
float  u,
float  v,
int  triIndex,
const CPUVertexArray vertexArray,
bool  backside,
shared_ptr< Surfel > &  surfel,
float  du = 0,
float  dv = 0,
bool  twoSided = true 
) const
pure virtual

Implemented in G3D::UniversalMaterial.

◆ setStorage()

virtual void G3D::Material::setStorage ( ImageStorage  s) const
pure virtual

Implemented in G3D::UniversalMaterial.


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