7 #include "visuVTKAdaptor/STexture.hpp" 9 #include <fwCom/Signal.hxx> 10 #include <fwCom/Slot.hxx> 11 #include <fwCom/Slots.hxx> 13 #include <fwData/Image.hpp> 14 #include <fwData/Material.hpp> 15 #include <fwData/mt/ObjectReadLock.hpp> 16 #include <fwData/mt/ObjectWriteLock.hpp> 17 #include <fwData/Reconstruction.hpp> 19 #include <fwDataTools/fieldHelper/MedicalImageHelpers.hpp> 21 #include <fwMedData/ModelSeries.hpp> 23 #include <fwServices/macros.hpp> 25 #include <vtkRenderWindowInteractor.h> 26 #include <vtkTexture.h> 33 const ::fwCom::Slots::SlotKeyType STexture::s_APPLY_TEXTURE_SLOT =
"applyTexture";
35 static const ::fwServices::IService::KeyType s_TEXTURE_INOUT =
"texture";
40 m_filtering("linear"),
59 const ConfigType config = this->
getConfigTree().get_child(
"config.<xmlattr>");
61 m_filtering = config.get<std::string>(
"filtering",
"linear");
63 m_wrapping = config.get<std::string>(
"wrapping",
"repeat");
65 m_lighting = (config.get<std::string>(
"lighting",
"yes") ==
"yes");
100 ::fwData::Image::sptr image = this->getInOut< ::fwData::Image >(s_TEXTURE_INOUT);
101 SLM_ASSERT(
"Texture image is missing.", image);
125 filtering = ::fwData::Material::NEAREST;
129 filtering = ::fwData::Material::LINEAR;
139 wrapping = ::fwData::Material::REPEAT;
143 wrapping = ::fwData::Material::CLAMP;
151 ::fwData::Object::ModifiedSignalType::sptr sig;
VISUVTKADAPTOR_API void stopping() override
Uninitialize the service activity. The stop() method is always invoked before destroying a service...
This class is a helper to define the connections of a service and its data.
bool m_lighting
enable or not the lighting (default true)
VISUVTKADAPTOR_API void configuring() override
Configure the service before starting. Apply the configuration to service.
void applyTexture(std::shared_ptr< ::fwData::Material > _material)
Slot called when a texture must be applied on a material.
Class allowing to block a Connection.
WrappingType
Texture wrapping types.
The namespace visuVTKAdaptor contains the list of adaptors available for the generic scene...
This class defines a material. A material is represented by an ambient color and a diffuse color...
void setShadingMode(ShadingType _shadingMode)
get/set the shading models(flat, gouraud, phong)
std::set< std::shared_ptr< ::fwData::Material > > m_materialSet
Contains all mesh adaptors that currently have this texture applied. Needed when image is updated...
FWRENDERVTK_API void configureParams()
Parse the xml configuration for renderer, picker and transform.
A helper to lock object on read mode.
std::string m_wrapping
How to wrap the texture.
FilteringType
Texture filtering types.
A helper to lock object on exclusive mode.
VISUVTKADAPTOR_API void starting() override
Initialize the service activity.
VISUVTKADAPTOR_API void updating() override
Perform some computations according to object (this service is attached to) attribute values and its ...
VISUVTKADAPTOR_API STexture() noexcept
Constructor.
void setDiffuseTextureWrapping(WrappingType _diffuseTextureWrapping)
get/set the texture wrapping
UpdateSlotType::sptr m_slotUpdate
Slot to call update method.
virtual VISUVTKADAPTOR_API KeyConnectionsMap getAutoConnections() const override
Returns proposals to connect service slots to associated object signals, this method is used for obj/...
std::string m_filtering
How to filter this texture.
FWDATA_API void setDiffuseTexture(const Image::sptr &diffuseTexture)
Setter for diffuse texture.
virtual VISUVTKADAPTOR_API ~STexture() noexcept
Destructor.
#define OSLM_WARN(message)
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_BUFFER_MODIFIED_SIG
Type of signal when image's buffer is added.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_MODIFIED_SIG
Key in m_signals map of signal m_sigModified.
FWRENDERVTK_API void initialize()
Initialize the adaptor with the associated render service. (must be call in starting).
void setDiffuseTextureFiltering(FilteringType _diffuseTextureFiltering)
get/set the texture filtering
Adaptor to map a texture on a mesh.
static FWSERVICES_APIconst::fwCom::Slots::SlotKeyType s_UPDATE_SLOT
Slot to call start method.
Base class for VTK adaptors.
FWSERVICES_API ConfigType getConfigTree() const
Return the configuration, in an boost property tree.