iMSTK
Interactive Medical Simulation Toolkit
|
A texture can be defined by file reference or ImageData input. More...
#include <imstkTexture.h>
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 } |
![]() | |
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 Color & | getBorderColor () 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< ImageData > | getImageData () const |
Get the input image data for the texture, not required (paths to files can be used instead) | |
![]() | |
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< ImageData > | imageTexture = 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 |
![]() | |
ParallelUtils::SpinLock | eventQueueLock |
std::deque< Command > | eventQueue |
std::vector< std::pair< std::string, std::vector< Observer > > > | queuedObservers |
std::vector< std::pair< std::string, std::vector< Observer > > > | directObservers |
A texture can be defined by file reference or ImageData input.
Definition at line 24 of file imstkTexture.h.
imstk::Texture::Texture | ( | std::string | path = "" , |
Type | type = Type::Diffuse |
||
) |
Constructor.
path | Path to the texture source file |
type | Type of texture |
Definition at line 11 of file imstkTexture.cpp.
Constructor.
imageTex | input texture image |
type | Type of texture |
Definition at line 16 of file imstkTexture.cpp.