MeshLib C++ Docs
Loading...
Searching...
No Matches

Visual Object. More...

#include <MRMesh/MRVisualObject.h>

Inheritance diagram for MR::VisualObject:

Public Member Functions

 VisualObject ()
 VisualObject (VisualObject &&)=default
VisualObjectoperator= (VisualObject &&)=default
virtual ~VisualObject ()=default
virtual const char * typeName () const override
virtual std::string className () const override
virtual std::string classNameInPlural () const override
virtual bool supportsVisualizeProperty (AnyVisualizeMaskEnum type) const
 Returns true if this class supports the property type. Otherwise passing it to the functions below is illegal.
void setVisualizeProperty (bool value, AnyVisualizeMaskEnum type, ViewportMask viewportMask)
 set visual property in all viewports specified by the mask
virtual void setVisualizePropertyMask (AnyVisualizeMaskEnum type, ViewportMask viewportMask)
 set visual property mask
bool getVisualizeProperty (AnyVisualizeMaskEnum type, ViewportMask viewportMask) const
 returns true if the property is set at least in one viewport specified by the mask
virtual const ViewportMaskgetVisualizePropertyMask (AnyVisualizeMaskEnum type) const
 returns mask of viewports where given property is set
void toggleVisualizeProperty (AnyVisualizeMaskEnum type, ViewportMask viewportMask)
 toggle visual property in all viewports specified by the mask
virtual AllVisualizeProperties getAllVisualizeProperties () const
 get all visualize properties masks
void setAllVisualizeProperties (const AllVisualizeProperties &properties)
 set all visualize properties masks
void copyAllSolidColors (const VisualObject &other)
 set all object solid colors (front/back/etc.) from other object for all viewports
ViewportMask globalClippedByPlaneMask () const
 returns all viewports where this object or any of its parents is clipped by plane
bool globalClippedByPlane (ViewportMask viewportMask=ViewportMask::any()) const
 returns true if this object or any of its parents is clipped by plane in any of given viewports
void setGlobalClippedByPlane (bool on, ViewportMask viewportMask=ViewportMask::all())
 if false deactivates clipped-by-plane for this object and all of its parents, otherwise sets clipped-by-plane for this this object only
void showName (bool on)
 shows/hides object name in all viewports
bool showName () const
 returns whether object name is shown in any viewport
const ColorgetFrontColor (bool selected=true, ViewportId viewportId={}) const
 returns color of object when it is selected/not-selected (depending on argument) in given viewport
virtual void setFrontColor (const Color &color, bool selected, ViewportId viewportId={})
 sets color of object when it is selected/not-selected (depending on argument) in given viewport
virtual const ViewportProperty< Color > & getFrontColorsForAllViewports (bool selected=true) const
 returns color of object when it is selected/not-selected (depending on argument) in all viewports
virtual void setFrontColorsForAllViewports (ViewportProperty< Color > val, bool selected=true)
 sets color of object when it is selected/not-selected (depending on argument) in all viewports
virtual const ViewportProperty< Color > & getBackColorsForAllViewports () const
 returns backward color of object in all viewports
virtual void setBackColorsForAllViewports (ViewportProperty< Color > val)
 sets backward color of object in all viewports
const ColorgetBackColor (ViewportId viewportId={}) const
 returns backward color of object in given viewport
virtual void setBackColor (const Color &color, ViewportId viewportId={})
 sets backward color of object in given viewport
const uint8_t & getGlobalAlpha (ViewportId viewportId={}) const
 returns global transparency alpha of object in given viewport
virtual void setGlobalAlpha (uint8_t alpha, ViewportId viewportId={})
 sets global transparency alpha of object in given viewport
virtual const ViewportProperty< uint8_t > & getGlobalAlphaForAllViewports () const
 returns global transparency alpha of object in all viewports
virtual void setGlobalAlphaForAllViewports (ViewportProperty< uint8_t > val)
 sets global transparency alpha of object in all viewports
virtual void setDirtyFlags (uint32_t mask, bool invalidateCaches=true)
uint32_t getDirtyFlags () const
 returns current dirty flags for the object
void resetDirty () const
 resets all dirty flags (except for cache flags that will be reset automatically on cache update)
virtual void resetDirtyExceptMask (uint32_t mask) const
 reset dirty flags without some specific bits (useful for lazy normals update)
Box3f getBoundingBox () const
 returns cached bounding box of this object in local coordinates
virtual Box3f getWorldBox (ViewportId={}) const override
virtual bool getRedrawFlag (ViewportMask viewportMask) const override
 returns true if the object must be redrawn (due to dirty flags) in one of specified viewports
bool isPickable (ViewportMask viewportMask=ViewportMask::any()) const
 whether the object can be picked (by mouse) in any of given viewports
virtual void setPickable (bool on, ViewportMask viewportMask=ViewportMask::all())
 sets the object as can/cannot be picked (by mouse) in all of given viewports
ColoringType getColoringType () const
 returns the current coloring mode of the object
virtual void setColoringType (ColoringType coloringType)
 sets coloring mode of the object with given argument
float getShininess () const
 returns the current shininess visual value
virtual void setShininess (float shininess)
 sets shininess visual value of the object with given argument
float getSpecularStrength () const
 returns intensity of reflections
virtual void setSpecularStrength (float specularStrength)
 sets intensity of reflections
float getAmbientStrength () const
 returns intensity of non-directional light
virtual void setAmbientStrength (float ambientStrength)
 sets intensity of non-directional light
virtual std::shared_ptr< Objectclone () const override
virtual std::shared_ptr< ObjectshallowClone () const override
virtual bool render (const ModelRenderParams &) const
virtual void renderForPicker (const ModelBaseRenderParams &, unsigned) const
 draws this object for picking
virtual void renderUi (const UiRenderParams &params) const
 draws this object for 2d UI
 VisualObject (ProtectedStruct, const VisualObject &obj)
 this ctor is public only for std::make_shared used inside clone()
virtual size_t heapBytes () const override
 returns the amount of memory this object occupies on heap
virtual std::vector< std::string > getInfoLines () const override
 return several info lines that can better describe the object in the UI
bool useDefaultScenePropertiesOnDeserialization () const
void setUseDefaultScenePropertiesOnDeserialization (bool useDefaultScenePropertiesOnDeserialization)
virtual void resetFrontColor ()
 reset basic object colors to their default values from the current theme
virtual void resetColors ()
 reset all object colors to their default values from the current theme
Public Member Functions inherited from MR::Object
 Object ()=default
 Object (Object &&) noexcept=default
Objectoperator= (Object &&) noexcept=default
virtual ~Object ()=default
template<typename T>
T * asType ()
template<typename T>
const T * asType () const
const std::string & name () const
virtual void setName (std::string name)
std::shared_ptr< const Objectfind (const std::string_view &name) const
 finds a direct child by name
std::shared_ptr< Objectfind (const std::string_view &name)
template<typename T>
std::shared_ptr< const T > find () const
 finds a direct child by type
template<typename T>
std::shared_ptr< T > find ()
template<typename T>
std::shared_ptr< const T > find (const std::string_view &name) const
 finds a direct child by name and type
template<typename T>
std::shared_ptr< T > find (const std::string_view &name)
const AffineXf3f & xf (ViewportId id={}, bool *isDef=nullptr) const
virtual void setXf (const AffineXf3f &xf, ViewportId id={})
virtual void resetXf (ViewportId id={})
 forgets specific transform in given viewport (or forgets all specific transforms for {} input)
const ViewportProperty< AffineXf3f > & xfsForAllViewports () const
 returns xfs for all viewports, combined into a single object
virtual void setXfsForAllViewports (ViewportProperty< AffineXf3f > xf)
 modifies xfs for all viewports at once
AffineXf3f worldXf (ViewportId id={}, bool *isDef=nullptr) const
void setWorldXf (const AffineXf3f &xf, ViewportId id={})
virtual void applyScale (float scaleFactor)
 scale object size (all point positions)
ViewportMask globalVisibilityMask () const
 returns all viewports where this object is visible together with all its parents
bool globalVisibility (ViewportMask viewportMask=ViewportMask::any()) const
 returns true if this object is visible together with all its parents in any of given viewports
void setGlobalVisibility (bool on, ViewportMask viewportMask=ViewportMask::any())
 if true sets all predecessors visible, otherwise sets this object invisible
bool isLocked () const
 object properties lock for UI
virtual void setLocked (bool on)
bool isParentLocked () const
virtual void setParentLocked (bool lock)
const Objectparent () const
 returns parent object in the tree
Objectparent ()
bool isAncestor (const Object *ancestor) const
 return true if given object is ancestor of this one, false otherwise
ObjectfindCommonAncestor (Object &other)
const ObjectfindCommonAncestor (const Object &other) const
virtual bool detachFromParent ()
const std::vector< std::shared_ptr< Object > > & children ()
 an object can hold other sub-objects
const std::vector< std::shared_ptr< const Object > > & children () const
virtual bool addChild (std::shared_ptr< Object > child, bool recognizedChild=true)
virtual bool addChildBefore (std::shared_ptr< Object > newChild, const std::shared_ptr< Object > &existingChild)
bool removeChild (const std::shared_ptr< Object > &child)
 returns false if it was not child of this
virtual bool removeChild (Object *child)
virtual void removeAllChildren ()
 detaches all recognized children from this, keeping all unrecognized ones
void sortChildren ()
 sort recognized children by name
virtual bool select (bool on)
 selects the object, returns true if value changed, otherwise returns false
virtual bool isSelected () const
virtual void setAncillary (bool ancillary)
bool isAncillary () const
bool isGlobalAncillary () const
 returns true if the object or any of its ancestors are ancillary
void setVisible (bool on, ViewportMask viewportMask=ViewportMask::all())
 sets the object visible in the viewports specified by the mask (by default in all viewports)
bool isVisible (ViewportMask viewportMask=ViewportMask::any()) const
 checks whether the object is visible in any of the viewports specified by the mask (by default in any viewport)
virtual void setVisibilityMask (ViewportMask viewportMask)
 specifies object visibility as bitmask of viewports
virtual ViewportMask visibilityMask () const
 gets object visibility as bitmask of viewports
void resetRedrawFlag () const
std::shared_ptr< ObjectcloneTree () const
 clones all tree of this object (except ancillary and unrecognized children)
std::shared_ptr< ObjectshallowCloneTree () const
MR_BIND_IGNORE Expected< std::vector< std::future< Expected< void > > > > serializeRecursive (const std::filesystem::path &path, Json::Value &root, int childId) const
Expected< void > deserializeRecursive (const std::filesystem::path &path, const Json::Value &root, ProgressCallback progressCb={}, int *objCounter=nullptr)
void swap (Object &other)
Box3f getWorldTreeBox (ViewportId={}) const
 returns bounding box of this object and all children visible in given (or default) viewport in world coordinates
virtual bool hasVisualRepresentation () const
 does the object have any visual representation (visible points, triangles, edges, etc.), no considering child objects
virtual bool hasModel () const
const std::set< std::string > & tags () const
bool addTag (std::string tag)
bool removeTag (const std::string &tag)
virtual bool sameModels (const Object &other) const
 return true if model of current object equals to model (the same) of other
virtual size_t getModelHash () const
 return hash of model (or hash object pointer if object has no model)
 Object (ProtectedStruct, const Object &obj)
Public Member Functions inherited from MR::ObjectChildrenHolder
 ObjectChildrenHolder ()=default
 ObjectChildrenHolder (const ObjectChildrenHolder &) noexcept
ObjectChildrenHolderoperator= (const ObjectChildrenHolder &) noexcept
 ObjectChildrenHolder (ObjectChildrenHolder &&) noexcept
ObjectChildrenHolderoperator= (ObjectChildrenHolder &&) noexcept
 ~ObjectChildrenHolder ()
std::shared_ptr< ObjectgetSharedPtr () const
size_t heapBytes () const

Static Public Member Functions

static constexpr const char * StaticTypeName () noexcept
static constexpr const char * StaticClassName () noexcept
static constexpr const char * StaticClassNameInPlural () noexcept
Static Public Member Functions inherited from MR::Object
static constexpr const char * StaticTypeName () noexcept
 return name of subtype for serialization purposes
static constexpr const char * StaticClassName () noexcept
 return human readable name of subclass
static constexpr const char * StaticClassNameInPlural () noexcept
 return human readable name of subclass in plural form

Protected Member Functions

 VisualObject (const VisualObject &obj)=default
virtual void swapBase_ (Object &other) override
 swaps this object with other
virtual void setupRenderObject_ () const
void setDirtyFlagsFast_ (uint32_t mask)
 todo: make virtual and public when all children support separate fast dirty and cache invalidation
void invalidateMetricsCache_ (uint32_t mask)
ViewportMaskgetVisualizePropertyMask_ (AnyVisualizeMaskEnum type)
virtual void serializeFields_ (Json::Value &root) const override
void deserializeFields_ (const Json::Value &root) override
virtual Box3f computeBoundingBox_ () const
void boundingBoxToInfoLines_ (std::vector< std::string > &res) const
 adds information about bounding box in res
virtual void setAllVisualizeProperties_ (const AllVisualizeProperties &properties, std::size_t &pos)
template<AnyVisualizeMaskEnumType T>
void setAllVisualizePropertiesForEnum (const AllVisualizeProperties &properties, std::size_t &pos)
 Derived classes should use this to implement setAllVisualizeProperties().
template<AnyVisualizeMaskEnumType T>
void getAllVisualizePropertiesForEnum (AllVisualizeProperties &properties) const
 Derived classes should use this to implement getAllVisualizeProperties().
Protected Member Functions inherited from MR::Object
 Object (const Object &obj)=default
 user should not be able to call copy implicitly, use clone() function instead
virtual void swapSignals_ (Object &other)
virtual Expected< std::future< Expected< void > > > serializeModel_ (const std::filesystem::path &path) const
virtual Expected< void > deserializeModel_ (const std::filesystem::path &path, ProgressCallback progressCb={})
 Reads model from file.
virtual Expected< void > setSharedModel_ (const Object &other)
 shares model from other object
void sendWorldXfChangedSignal_ ()
virtual void onWorldXfChanged_ ()
 Emits worldXfChangedSignal, but derived classes can add additional behavior to it.

Protected Attributes

UniquePtr< IRenderObjectrenderObj_
ViewportMask clipByPlane_
ViewportMask showName_
ViewportMask pickable_ = ViewportMask::all()
 enable picking by gl
ViewportMask depthTest_ = ViewportMask::all()
float shininess_ {35.0f}
 specular exponent
float specularStrength_ { 0.5f }
float ambientStrength_ { 0.1f }
 reflection intensity
ColoringType coloringType_ {ColoringType::SolidColor}
 non - directional light intensity
ViewportProperty< ColorselectedColor_
ViewportProperty< ColorunselectedColor_
ViewportProperty< ColorbackFacesColor_
ViewportProperty< uint8_t > globalAlpha_ { 255 }
bool useDefaultScenePropertiesOnDeserialization_ { false }
Protected Attributes inherited from MR::Object
std::string name_
ViewportProperty< AffineXf3f > xf_
ViewportMask visibilityMask_ = ViewportMask::all()
bool locked_ = false
 Prefer to not read directly. Use the getter, as it can be overridden.
bool parentLocked_ = false
bool selected_ { false }
bool ancillary_ { false }
bool needRedraw_ {false}
std::set< std::string > tags_
Protected Attributes inherited from MR::ObjectChildrenHolder
ObjectChildrenHolderparent_ = nullptr
std::vector< std::shared_ptr< Object > > children_
std::vector< std::weak_ptr< Object > > bastards_
 recognized ones

Additional Inherited Members

Public Types inherited from MR::Object
using XfChangedSignal = Signal<void()>
Public Attributes inherited from MR::Object
XfChangedSignal worldXfChangedSignal

Detailed Description

Visual Object.

Constructor & Destructor Documentation

◆ VisualObject() [1/4]

MR::VisualObject::VisualObject ( )

◆ VisualObject() [2/4]

MR::VisualObject::VisualObject ( VisualObject && )
default

◆ ~VisualObject()

virtual MR::VisualObject::~VisualObject ( )
virtualdefault

◆ VisualObject() [3/4]

MR::VisualObject::VisualObject ( ProtectedStruct ,
const VisualObject & obj )
inline

this ctor is public only for std::make_shared used inside clone()

◆ VisualObject() [4/4]

MR::VisualObject::VisualObject ( const VisualObject & obj)
protecteddefault

Member Function Documentation

◆ boundingBoxToInfoLines_()

void MR::VisualObject::boundingBoxToInfoLines_ ( std::vector< std::string > & res) const
protected

adds information about bounding box in res

◆ className()

◆ classNameInPlural()

◆ clone()

◆ computeBoundingBox_()

virtual Box3f MR::VisualObject::computeBoundingBox_ ( ) const
inlineprotectedvirtual

◆ copyAllSolidColors()

void MR::VisualObject::copyAllSolidColors ( const VisualObject & other)

set all object solid colors (front/back/etc.) from other object for all viewports

◆ deserializeFields_()

void MR::VisualObject::deserializeFields_ ( const Json::Value & root)
overrideprotectedvirtual

Reads parameters from json value

Note
if you override this method, please call Base::deserializeFields_(root) in the beginning

Reimplemented from MR::Object.

◆ getAllVisualizeProperties()

◆ getAllVisualizePropertiesForEnum()

template<AnyVisualizeMaskEnumType T>
void MR::VisualObject::getAllVisualizePropertiesForEnum ( AllVisualizeProperties & properties) const
inlineprotected

Derived classes should use this to implement getAllVisualizeProperties().

◆ getAmbientStrength()

float MR::VisualObject::getAmbientStrength ( ) const
inline

returns intensity of non-directional light

◆ getBackColor()

const Color & MR::VisualObject::getBackColor ( ViewportId viewportId = {}) const

returns backward color of object in given viewport

◆ getBackColorsForAllViewports()

virtual const ViewportProperty< Color > & MR::VisualObject::getBackColorsForAllViewports ( ) const
virtual

returns backward color of object in all viewports

◆ getBoundingBox()

Box3f MR::VisualObject::getBoundingBox ( ) const

returns cached bounding box of this object in local coordinates

◆ getColoringType()

ColoringType MR::VisualObject::getColoringType ( ) const
inline

returns the current coloring mode of the object

◆ getDirtyFlags()

uint32_t MR::VisualObject::getDirtyFlags ( ) const
inline

returns current dirty flags for the object

◆ getFrontColor()

const Color & MR::VisualObject::getFrontColor ( bool selected = true,
ViewportId viewportId = {} ) const

returns color of object when it is selected/not-selected (depending on argument) in given viewport

◆ getFrontColorsForAllViewports()

virtual const ViewportProperty< Color > & MR::VisualObject::getFrontColorsForAllViewports ( bool selected = true) const
virtual

returns color of object when it is selected/not-selected (depending on argument) in all viewports

◆ getGlobalAlpha()

const uint8_t & MR::VisualObject::getGlobalAlpha ( ViewportId viewportId = {}) const

returns global transparency alpha of object in given viewport

◆ getGlobalAlphaForAllViewports()

virtual const ViewportProperty< uint8_t > & MR::VisualObject::getGlobalAlphaForAllViewports ( ) const
virtual

◆ getInfoLines()

virtual std::vector< std::string > MR::VisualObject::getInfoLines ( ) const
overridevirtual

return several info lines that can better describe the object in the UI

Reimplemented from MR::Object.

Reimplemented in MR::AngleMeasurementObject, MR::DistanceMeasurementObject, MR::ObjectDistanceMap, MR::ObjectGcode, MR::ObjectLines, MR::ObjectMesh, MR::ObjectPoints, MR::ObjectVoxels, and MR::RadiusMeasurementObject.

◆ getRedrawFlag()

virtual bool MR::VisualObject::getRedrawFlag ( ViewportMask viewportMask) const
inlineoverridevirtual

returns true if the object must be redrawn (due to dirty flags) in one of specified viewports

Reimplemented from MR::Object.

Reimplemented in MR::ObjectMeshHolder.

◆ getShininess()

float MR::VisualObject::getShininess ( ) const
inline

returns the current shininess visual value

◆ getSpecularStrength()

float MR::VisualObject::getSpecularStrength ( ) const
inline

returns intensity of reflections

◆ getVisualizeProperty()

bool MR::VisualObject::getVisualizeProperty ( AnyVisualizeMaskEnum type,
ViewportMask viewportMask ) const

returns true if the property is set at least in one viewport specified by the mask

◆ getVisualizePropertyMask()

◆ getVisualizePropertyMask_()

ViewportMask & MR::VisualObject::getVisualizePropertyMask_ ( AnyVisualizeMaskEnum type)
protected

◆ getWorldBox()

virtual Box3f MR::VisualObject::getWorldBox ( ViewportId = {}) const
overridevirtual

returns bounding box of this object in given viewport in world coordinates, to get world bounding box of the object with all child objects, please call Object::getWorldTreeBox method

Reimplemented from MR::Object.

Reimplemented in MR::ObjectLabel, MR::ObjectLinesHolder, MR::ObjectMeshHolder, and MR::ObjectPointsHolder.

◆ globalClippedByPlane()

bool MR::VisualObject::globalClippedByPlane ( ViewportMask viewportMask = ViewportMask::any()) const
inlinenodiscard

returns true if this object or any of its parents is clipped by plane in any of given viewports

◆ globalClippedByPlaneMask()

ViewportMask MR::VisualObject::globalClippedByPlaneMask ( ) const
nodiscard

returns all viewports where this object or any of its parents is clipped by plane

◆ heapBytes()

virtual size_t MR::VisualObject::heapBytes ( ) const
nodiscardoverridevirtual

returns the amount of memory this object occupies on heap

Reimplemented from MR::Object.

Reimplemented in MR::ObjectDistanceMap, MR::ObjectGcode, MR::ObjectLabel, MR::ObjectLinesHolder, MR::ObjectMeshHolder, MR::ObjectPointsHolder, and MR::ObjectVoxels.

◆ invalidateMetricsCache_()

void MR::VisualObject::invalidateMetricsCache_ ( uint32_t mask)
protected

◆ isPickable()

bool MR::VisualObject::isPickable ( ViewportMask viewportMask = ViewportMask::any()) const
inline

whether the object can be picked (by mouse) in any of given viewports

◆ operator=()

VisualObject & MR::VisualObject::operator= ( VisualObject && )
default

◆ render()

virtual bool MR::VisualObject::render ( const ModelRenderParams & ) const
virtual

draws this object for visualization Returns true if something was drawn.

◆ renderForPicker()

virtual void MR::VisualObject::renderForPicker ( const ModelBaseRenderParams & ,
unsigned  ) const
virtual

draws this object for picking

◆ renderUi()

virtual void MR::VisualObject::renderUi ( const UiRenderParams & params) const
virtual

draws this object for 2d UI

◆ resetColors()

virtual void MR::VisualObject::resetColors ( )
virtual

reset all object colors to their default values from the current theme

Reimplemented in MR::ObjectMeshHolder, and MR::ObjectPointsHolder.

◆ resetDirty()

void MR::VisualObject::resetDirty ( ) const

resets all dirty flags (except for cache flags that will be reset automatically on cache update)

◆ resetDirtyExceptMask()

virtual void MR::VisualObject::resetDirtyExceptMask ( uint32_t mask) const
virtual

reset dirty flags without some specific bits (useful for lazy normals update)

◆ resetFrontColor()

virtual void MR::VisualObject::resetFrontColor ( )
virtual

reset basic object colors to their default values from the current theme

Reimplemented in MR::ObjectDistanceMap, MR::ObjectLinesHolder, MR::ObjectMeshHolder, MR::ObjectPointsHolder, and MR::ObjectVoxels.

◆ serializeFields_()

virtual void MR::VisualObject::serializeFields_ ( Json::Value & root) const
overrideprotectedvirtual

◆ setAllVisualizeProperties()

void MR::VisualObject::setAllVisualizeProperties ( const AllVisualizeProperties & properties)
inline

set all visualize properties masks

◆ setAllVisualizeProperties_()

◆ setAllVisualizePropertiesForEnum()

template<AnyVisualizeMaskEnumType T>
void MR::VisualObject::setAllVisualizePropertiesForEnum ( const AllVisualizeProperties & properties,
std::size_t & pos )
inlineprotected

Derived classes should use this to implement setAllVisualizeProperties().

◆ setAmbientStrength()

virtual void MR::VisualObject::setAmbientStrength ( float ambientStrength)
inlinevirtual

sets intensity of non-directional light

◆ setBackColor()

virtual void MR::VisualObject::setBackColor ( const Color & color,
ViewportId viewportId = {} )
virtual

sets backward color of object in given viewport

◆ setBackColorsForAllViewports()

virtual void MR::VisualObject::setBackColorsForAllViewports ( ViewportProperty< Color > val)
virtual

sets backward color of object in all viewports

◆ setColoringType()

virtual void MR::VisualObject::setColoringType ( ColoringType coloringType)
virtual

sets coloring mode of the object with given argument

◆ setDirtyFlags()

virtual void MR::VisualObject::setDirtyFlags ( uint32_t mask,
bool invalidateCaches = true )
virtual

sets some dirty flags for the object (to force its visual update)

Parameters
maskis a union of DirtyFlags flags
invalidateCacheswhether to automatically invalidate model caches (pass false here if you manually update the caches)

Reimplemented in MR::ObjectGcode, MR::ObjectLinesHolder, MR::ObjectMeshHolder, MR::ObjectPointsHolder, and MR::ObjectVoxels.

◆ setDirtyFlagsFast_()

void MR::VisualObject::setDirtyFlagsFast_ ( uint32_t mask)
protected

todo: make virtual and public when all children support separate fast dirty and cache invalidation

◆ setFrontColor()

virtual void MR::VisualObject::setFrontColor ( const Color & color,
bool selected,
ViewportId viewportId = {} )
virtual

sets color of object when it is selected/not-selected (depending on argument) in given viewport

Reimplemented in MR::ObjectGcode.

◆ setFrontColorsForAllViewports()

virtual void MR::VisualObject::setFrontColorsForAllViewports ( ViewportProperty< Color > val,
bool selected = true )
virtual

sets color of object when it is selected/not-selected (depending on argument) in all viewports

◆ setGlobalAlpha()

virtual void MR::VisualObject::setGlobalAlpha ( uint8_t alpha,
ViewportId viewportId = {} )
virtual

sets global transparency alpha of object in given viewport

◆ setGlobalAlphaForAllViewports()

virtual void MR::VisualObject::setGlobalAlphaForAllViewports ( ViewportProperty< uint8_t > val)
virtual

sets global transparency alpha of object in all viewports

◆ setGlobalClippedByPlane()

void MR::VisualObject::setGlobalClippedByPlane ( bool on,
ViewportMask viewportMask = ViewportMask::all() )

if false deactivates clipped-by-plane for this object and all of its parents, otherwise sets clipped-by-plane for this this object only

◆ setPickable()

virtual void MR::VisualObject::setPickable ( bool on,
ViewportMask viewportMask = ViewportMask::all() )
virtual

sets the object as can/cannot be picked (by mouse) in all of given viewports

◆ setShininess()

virtual void MR::VisualObject::setShininess ( float shininess)
inlinevirtual

sets shininess visual value of the object with given argument

◆ setSpecularStrength()

virtual void MR::VisualObject::setSpecularStrength ( float specularStrength)
inlinevirtual

sets intensity of reflections

◆ setupRenderObject_()

virtual void MR::VisualObject::setupRenderObject_ ( ) const
inlineprotectedvirtual

◆ setUseDefaultScenePropertiesOnDeserialization()

void MR::VisualObject::setUseDefaultScenePropertiesOnDeserialization ( bool useDefaultScenePropertiesOnDeserialization)
inline

set whether the scene-related properties should get their values from SceneColors and SceneSettings instances rather than from the input data on deserialization

◆ setVisualizeProperty()

void MR::VisualObject::setVisualizeProperty ( bool value,
AnyVisualizeMaskEnum type,
ViewportMask viewportMask )

set visual property in all viewports specified by the mask

◆ setVisualizePropertyMask()

virtual void MR::VisualObject::setVisualizePropertyMask ( AnyVisualizeMaskEnum type,
ViewportMask viewportMask )
virtual

set visual property mask

◆ shallowClone()

◆ showName() [1/2]

bool MR::VisualObject::showName ( ) const
inline

returns whether object name is shown in any viewport

◆ showName() [2/2]

void MR::VisualObject::showName ( bool on)
inline

shows/hides object name in all viewports

◆ StaticClassName()

constexpr const char * MR::VisualObject::StaticClassName ( )
inlinestaticconstexprnoexcept

◆ StaticClassNameInPlural()

constexpr const char * MR::VisualObject::StaticClassNameInPlural ( )
inlinestaticconstexprnoexcept

◆ StaticTypeName()

constexpr const char * MR::VisualObject::StaticTypeName ( )
inlinestaticconstexprnoexcept

◆ supportsVisualizeProperty()

◆ swapBase_()

◆ toggleVisualizeProperty()

void MR::VisualObject::toggleVisualizeProperty ( AnyVisualizeMaskEnum type,
ViewportMask viewportMask )

toggle visual property in all viewports specified by the mask

◆ typeName()

◆ useDefaultScenePropertiesOnDeserialization()

bool MR::VisualObject::useDefaultScenePropertiesOnDeserialization ( ) const
inlinenodiscard

whether the scene-related properties should get their values from SceneColors and SceneSettings instances rather than from the input data on deserialization

Member Data Documentation

◆ ambientStrength_

float MR::VisualObject::ambientStrength_ { 0.1f }
protected

reflection intensity

◆ backFacesColor_

ViewportProperty<Color> MR::VisualObject::backFacesColor_
protected

◆ clipByPlane_

ViewportMask MR::VisualObject::clipByPlane_
protected

Visualization options Each option is a binary mask specifying on which viewport each option is set. When using a single viewport, standard boolean can still be used for simplicity.

◆ coloringType_

ColoringType MR::VisualObject::coloringType_ {ColoringType::SolidColor}
protected

non - directional light intensity

Main coloring options

◆ depthTest_

ViewportMask MR::VisualObject::depthTest_ = ViewportMask::all()
protected

◆ globalAlpha_

ViewportProperty<uint8_t> MR::VisualObject::globalAlpha_ { 255 }
protected

◆ pickable_

ViewportMask MR::VisualObject::pickable_ = ViewportMask::all()
protected

enable picking by gl

◆ renderObj_

UniquePtr<IRenderObject> MR::VisualObject::renderObj_
mutableprotected

◆ selectedColor_

ViewportProperty<Color> MR::VisualObject::selectedColor_
protected

◆ shininess_

float MR::VisualObject::shininess_ {35.0f}
protected

specular exponent

◆ showName_

ViewportMask MR::VisualObject::showName_
protected

◆ specularStrength_

float MR::VisualObject::specularStrength_ { 0.5f }
protected

◆ unselectedColor_

ViewportProperty<Color> MR::VisualObject::unselectedColor_
protected

◆ useDefaultScenePropertiesOnDeserialization_

bool MR::VisualObject::useDefaultScenePropertiesOnDeserialization_ { false }
protected

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