9 #include "imstkEventObject.h" 10 #include "imstkColor.h" 74 Texture(std::string path =
"",
Type type = Type::Diffuse);
81 Texture(std::shared_ptr<ImageData> imageTex,
Type type = Type::Diffuse);
118 void setWrapType(
const WrapType& repeat)
124 const Color& getBorderColor()
const {
return m_borderColor; }
125 void setBorderColor(
const Color& color)
127 m_borderColor = color;
144 void setImageData(std::shared_ptr<ImageData> imgData) { imageTexture = imgData; }
151 m_interpolation = interpolation;
163 std::shared_ptr<ImageData>
getImageData()
const {
return imageTexture; }
166 std::shared_ptr<ImageData> imageTexture =
nullptr;
171 bool m_mipmapsEnabled =
true;
173 WrapType m_wrapType = WrapType::REPEAT;
174 Color m_borderColor = Color::Black;
177 bool m_anisotropyEnabled =
true;
178 double m_anisotropyFactor = 1.0;
181 bool m_interpolation =
true;
191 template<>
struct less<
std::shared_ptr<imstk::Texture>>
193 bool operator()(
const std::shared_ptr<imstk::Texture>& texture1,
194 const std::shared_ptr<imstk::Texture>& texture2)
const 196 if (texture1->getType() != texture2->getType())
198 return (texture1->getType() < texture2->getType());
201 if (texture1->getPath() != texture2->getPath())
203 return (texture1->getPath() < texture2->getPath());
206 if (texture1->getMipmapsEnabled() != texture2->getMipmapsEnabled())
208 return (texture1->getMipmapsEnabled() < texture2->getMipmapsEnabled());
211 if (texture1->isAnisotropyEnabled() != texture2->isAnisotropyEnabled())
213 return (texture1->isAnisotropyEnabled() < texture2->isAnisotropyEnabled());
216 if (texture1->getAnisotropyFactor() != texture2->getAnisotropyFactor())
218 return (texture1->getAnisotropyFactor() < texture2->getAnisotropyFactor());
bool getInterpolation()
Get whether interpolation is used when sampling the texture.
void setInterpolation(const bool interpolation)
Set whether interpolation is used when sampling the texture.
Base class for events which contain a type, priority, and data priority defaults to 0 and uses a grea...
Texture(std::string path="", Type type=Type::Diffuse)
Constructor.
Type
Texture type - determines filtering.
std::string m_path
Texture file path.
bool isAnisotropyEnabled() const
Get if anisotropic filtering is enabled.
Type getType() const
Get type.
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)
bool getMipmapsEnabled() const
Get if mipmaps are enabled.
FileType getFileType()
Get file extension.
EventObject is the base class for all objects in iMSTK that can receive and emit events. It supports direct and queued observer functions. Direct observers receive events immediately on the same thread This can either be posted on an object or be a function pointer Queued observers receive events within their queue which they can process whenever they like. These can be connected with the connect/queuedConnect/disconnect functions Lambda recievers cannot be disconnected unless all receivers to a signal are removed.
A texture can be defined by file reference or ImageData input.
const std::string & getPath() const
Get path.
const WrapType & getWrapType() const
Get the wrapping type.
std::shared_ptr< ImageData > getImageData() const
Get the input image data for the texture, not required (paths to files can be used instead) ...
void postEvent(const T &e)
Emits the event Direct observers will be immediately called, in sync Queued observers will receive th...
virtual ~Texture()=default
Destructor.
This method is defined to allow for the map to be properly indexed by Texture objects.