iMSTK
Interactive Medical Simulation Toolkit
Public Types | Public Member Functions | Protected Attributes | List of all members
imstk::Texture Class Reference

A texture can be defined by file reference or ImageData input. More...

#include <imstkTexture.h>

Inheritance diagram for imstk::Texture:
Inheritance graph
[legend]
Collaboration diagram for imstk::Texture:
Collaboration graph
[legend]

Public Types

enum  Type {
  Diffuse = 0, Normal, Roughness, Metalness,
  SubsurfaceScattering, AmbientOcclusion, Cavity, Cubemap,
  IrradianceCubeMap, RadianceCubeMap, ORM, BRDF_LUT,
  Emissive, Anistropy, CoatNormal, None
}
 Texture type - determines filtering.
 
enum  FileType {
  Unknown, Bmp, Png, Jpg,
  Dds
}
 TODO.
 
enum  WrapType { CLAMP_TO_EDGE, CLAMP_TO_BORDER, REPEAT }
 
- Public Types inherited from imstk::EventObject
using Observer = std::tuple< bool, std::weak_ptr< EventObject >, std::function< void(Event *)> >
 

Public Member Functions

 Texture (std::string path="", Type type=Type::Diffuse)
 Constructor. More...
 
 Texture (std::shared_ptr< ImageData > imageTex, Type type=Type::Diffuse)
 Constructor. More...
 
virtual ~Texture ()=default
 Destructor.
 
 SIGNAL (Texture, modified)
 
void postModified ()
 
Type getType () const
 Get type.
 
const std::string & getPath () const
 Get path.
 
FileType getFileType ()
 Get file extension.
 
bool getMipmapsEnabled () const
 Get if mipmaps are enabled.
 
const WrapType & getWrapType () const
 Get the wrapping type.
 
void setWrapType (const WrapType &repeat)
 
const ColorgetBorderColor () const
 
void setBorderColor (const Color &color)
 
bool isAnisotropyEnabled () const
 Get if anisotropic filtering is enabled.
 
double getAnisotropyFactor () const
 Get anisotropy factor.
 
void setImageData (std::shared_ptr< ImageData > imgData)
 Set the input image data, not required (paths to files can be used instead)
 
void setInterpolation (const bool interpolation)
 Set whether interpolation is used when sampling the texture.
 
bool getInterpolation ()
 Get whether interpolation is used when sampling the texture.
 
std::shared_ptr< ImageDatagetImageData () const
 Get the input image data for the texture, not required (paths to files can be used instead)
 
- Public Member Functions inherited from imstk::EventObject
template<typename T >
void postEvent (const T &e)
 Emits the event Direct observers will be immediately called, in sync Queued observers will receive the Command in their queue for later execution, reciever must implement doEvent.
 
template<typename T >
void queueEvent (const T &e)
 Queues event directly to this.
 
void doEvent ()
 Do an event, if none exists return.
 
void doAllEvents ()
 Do all the events in the event queue.
 
void foreachEvent (std::function< void(Command cmd)> func)
 Thread safe loop over all event commands, one can implement a custom handler.
 
void rforeachEvent (std::function< void(Command cmd)> func)
 thread safe reverse loop over all event commands, one can implement a custom handler
 
void clearEvents ()
 Removes all events from queue cleans up copies of the event.
 

Protected Attributes

std::shared_ptr< ImageDataimageTexture = nullptr
 
Type m_type
 Texture type.
 
std::string m_path = ""
 Texture file path.
 
bool m_mipmapsEnabled = true
 
WrapType m_wrapType = WrapType::REPEAT
 
Color m_borderColor = Color::Black
 
bool m_anisotropyEnabled = true
 
double m_anisotropyFactor = 1.0
 
bool m_interpolation = true
 
- Protected Attributes inherited from imstk::EventObject
ParallelUtils::SpinLock eventQueueLock
 
std::deque< CommandeventQueue
 
std::vector< std::pair< std::string, std::vector< Observer > > > queuedObservers
 
std::vector< std::pair< std::string, std::vector< Observer > > > directObservers
 

Detailed Description

A texture can be defined by file reference or ImageData input.

Definition at line 24 of file imstkTexture.h.

Constructor & Destructor Documentation

◆ Texture() [1/2]

imstk::Texture::Texture ( std::string  path = "",
Type  type = Type::Diffuse 
)

Constructor.

Parameters
pathPath to the texture source file
typeType of texture

Definition at line 11 of file imstkTexture.cpp.

◆ Texture() [2/2]

imstk::Texture::Texture ( std::shared_ptr< ImageData imageTex,
Type  type = Type::Diffuse 
)

Constructor.

Parameters
imageTexinput texture image
typeType of texture

Definition at line 16 of file imstkTexture.cpp.


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