Support Forum       G3D Web Page     
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
G3D::MapComponent< Image > Class Template Reference

Manages CPU and GPU versions of image data and performs conversions as needed. More...

Inherits G3D::ReferenceCountedObject.

Public Member Functions

const class shared_ptr< Image > & image () const
 Returns the CPU image portion of this component, synthesizing it if necessary. More...
 
const Image::StorageType & max () const
 Largest value in each channel of the image. More...
 
const Image::ComputeType & mean () const
 Average value in each channel of the image. More...
 
const Image::StorageType & min () const
 Smallest value in each channel of the image. More...
 
void setStorage (ImageStorage s) const
 
const shared_ptr< Texture > & texture () const
 Returns the GPU image portion of this component, synthesizing it if necessary. More...
 

Static Public Member Functions

static shared_ptr< MapComponent< Image > > create (const class shared_ptr< Image > &im, const shared_ptr< Texture > &tex)
 Returns nullptr if both are nullptr. More...
 

Protected Member Functions

 MapComponent (const class shared_ptr< Image > &im, const shared_ptr< Texture > &tex)
 
void computeCPUStats ()
 
void forceStats () const
 Used to compute min/max/mean from m_gpuImage without triggering a Texture::force() at construction time. More...
 

Static Protected Member Functions

static void convert (const Color4 &c, Color3 &v)
 
static void convert (const Color4 &c, Color4 &v)
 
static void convert (const Color4 &c, Color1 &v)
 
template<class T , class ... ArgTypes>
static shared_ptr< T > createShared (ArgTypes &&... args)
 Like std::make_shared, but works for protected constructors. More...
 
static void getTexture (const shared_ptr< Image > &im, shared_ptr< Texture > &tex)
 

Protected Attributes

shared_ptr< Imagem_cpuImage
 
shared_ptr< Texturem_gpuImage
 
Image::StorageType m_max
 
Image::ComputeType m_mean
 
Image::StorageType m_min
 
bool m_needsForce
 True when stats are out of date. More...
 

Detailed Description

template<class Image>
class G3D::MapComponent< Image >

Manages CPU and GPU versions of image data and performs conversions as needed.

Parameters
Imagethe CPU floating-point image format to use. On the GPU, the corresponding uint8 format is used.

Primarily used by Component.

Constructor & Destructor Documentation

◆ MapComponent()

template<class Image >
G3D::MapComponent< Image >::MapComponent ( const class shared_ptr< Image > &  im,
const shared_ptr< Texture > &  tex 
)
inlineprotected

Member Function Documentation

◆ computeCPUStats()

template<class Image >
void G3D::MapComponent< Image >::computeCPUStats ( )
inlineprotected

◆ convert() [1/3]

template<class Image >
static void G3D::MapComponent< Image >::convert ( const Color4 c,
Color3 v 
)
inlinestaticprotected

◆ convert() [2/3]

template<class Image >
static void G3D::MapComponent< Image >::convert ( const Color4 c,
Color4 v 
)
inlinestaticprotected

◆ convert() [3/3]

template<class Image >
static void G3D::MapComponent< Image >::convert ( const Color4 c,
Color1 v 
)
inlinestaticprotected

◆ create()

template<class Image >
static shared_ptr<MapComponent<Image> > G3D::MapComponent< Image >::create ( const class shared_ptr< Image > &  im,
const shared_ptr< Texture > &  tex 
)
inlinestatic

Returns nullptr if both are nullptr.

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

◆ forceStats()

template<class Image >
void G3D::MapComponent< Image >::forceStats ( ) const
inlineprotected

Used to compute min/max/mean from m_gpuImage without triggering a Texture::force() at construction time.

Referenced by G3D::MapComponent< Image >::max(), G3D::MapComponent< Image >::mean(), and G3D::MapComponent< Image >::min().

◆ getTexture()

template<class Image >
static void G3D::MapComponent< Image >::getTexture ( const shared_ptr< Image > &  im,
shared_ptr< Texture > &  tex 
)
inlinestaticprotected

◆ image()

template<class Image >
const class shared_ptr< Image >& G3D::MapComponent< Image >::image ( ) const
inline

Returns the CPU image portion of this component, synthesizing it if necessary.

Returns nullptr if there is no GPU data to synthesize from.

Referenced by G3D::MapComponent< Image >::setStorage().

◆ max()

template<class Image >
const Image::StorageType& G3D::MapComponent< Image >::max ( ) const
inline

Largest value in each channel of the image.

◆ mean()

template<class Image >
const Image::ComputeType& G3D::MapComponent< Image >::mean ( ) const
inline

Average value in each channel of the image.

◆ min()

template<class Image >
const Image::StorageType& G3D::MapComponent< Image >::min ( ) const
inline

Smallest value in each channel of the image.

◆ setStorage()

template<class Image >
void G3D::MapComponent< Image >::setStorage ( ImageStorage  s) const
inline

◆ texture()

template<class Image >
const shared_ptr<Texture>& G3D::MapComponent< Image >::texture ( ) const
inline

Returns the GPU image portion of this component, synthesizing it if necessary.

Referenced by G3D::MapComponent< Image >::setStorage().

Member Data Documentation

◆ m_cpuImage

template<class Image >
shared_ptr<Image> G3D::MapComponent< Image >::m_cpuImage
protected

◆ m_gpuImage

template<class Image >
shared_ptr<Texture> G3D::MapComponent< Image >::m_gpuImage
protected

◆ m_max

template<class Image >
Image::StorageType G3D::MapComponent< Image >::m_max
mutableprotected

◆ m_mean

template<class Image >
Image::ComputeType G3D::MapComponent< Image >::m_mean
mutableprotected

◆ m_min

template<class Image >
Image::StorageType G3D::MapComponent< Image >::m_min
mutableprotected

◆ m_needsForce

template<class Image >
bool G3D::MapComponent< Image >::m_needsForce
mutableprotected

True when stats are out of date.

Referenced by G3D::MapComponent< Image >::forceStats(), and G3D::MapComponent< Image >::MapComponent().


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