SOFA API  99934cbc
Open source framework for multi-physics simuation
sofa::component::visualmodel::VisualModelImpl Class Reference

#include <VisualModelImpl.h>

Abstract class which implements partially VisualModel. More...

Inheritance diagram for sofa::component::visualmodel::VisualModelImpl:

Detailed Description

Abstract class which implements partially VisualModel.

This class implemented all non-hardware (i.e OpenGL or DirectX) specific functions for rendering. It takes a 3D model (basically a .OBJ model) and apply transformations on it. At the moment, it is only implemented by OglModel for OpenGL systems.

Classes

class  FaceGroup
 

Public Attributes

bool useTopology
 True if list of facets should be taken from the attached topology. More...
 
int lastMeshRev
 Time stamps from the last time the mesh was updated from the topology. More...
 
bool castShadow
 True if object cast shadows. More...
 
sofa::core::topology::BaseMeshTopologym_topology
 
Data< boolm_initRestPositions
 True if rest positions should be initialized with initial positions, False if nothing should be done. More...
 
Data< boolm_useNormals
 True if normals should be read from file. More...
 
Data< boolm_updateNormals
 True if normals should be updated at each iteration. More...
 
Data< boolm_computeTangents
 True if tangents should be computed at startup. More...
 
Data< boolm_updateTangents
 True if tangents should be updated at each iteration. More...
 
Data< boolm_handleDynamicTopology
 True if topological changes should be handled. More...
 
Data< boolm_fixMergedUVSeams
 True if UV seams should be handled even when duplicate UVs are merged. More...
 
Data< boolm_keepLines
 keep and draw lines (false by default) More...
 
Data< VecCoordm_vertices2
 vertices of the model (only if vertices have multiple normals/texcoords, otherwise positions are used) More...
 
topology::PointData< VecTexCoordm_vtexcoords
 coordinates of the texture More...
 
topology::PointData< VecCoordm_vtangents
 tangents for normal mapping More...
 
topology::PointData< VecCoordm_vbitangents
 tangents for normal mapping More...
 
Data< VecVisualEdgem_edges
 edges of the model More...
 
Data< VecVisualTrianglem_triangles
 triangles of the model More...
 
Data< VecVisualQuadm_quads
 quads of the model More...
 
Data< helper::vector< visual_index_type > > m_vertPosIdx
 
Data< helper::vector< visual_index_type > > m_vertNormIdx
 
sofa::core::objectmodel::DataFileName fileMesh
 
sofa::core::objectmodel::DataFileName texturename
 
sofa::defaulttype::Vec3f bbox [2]
 
Data< sofa::core::loader::Materialmaterial
 
Data< boolputOnlyTexCoords
 
Data< boolsrgbTexturing
 
Data< helper::vector< sofa::core::loader::Material > > materials
 
Data< helper::vector< FaceGroup > > groups
 
SingleLink< VisualModelImpl, sofa::core::topology::BaseMeshTopology, BaseLink::FLAG_STOREPATH|BaseLink::FLAG_STRONGLINKl_topology
 Link to be set to the topology container in the component graph. More...
 
sofa::defaulttype::Rigid3fTypes::VecCoord xforms
 Temporary added here from RigidState deprecated inheritance. More...
 
bool xformsModified
 
- Public Attributes inherited from sofa::core::objectmodel::BaseObject
Data< boolf_listening
 if true, handle the events, otherwise ignore the events More...
 
- Public Attributes inherited from sofa::core::objectmodel::Base
helper::system::SofaOStream< helper::logging::Message::Warningserr
 
helper::system::SofaOStream< helper::logging::Message::Infosout
 
helper::system::SofaEndl< Basesendl
 runs the stream processing More...
 
Data< std::string > name
 Name of the object. More...
 
Data< boolf_printLog
 if true, emits extra messages at runtime. More...
 
Data< sofa::core::objectmodel::TagSetf_tags
 list of the subsets the objet belongs to More...
 
Data< sofa::defaulttype::BoundingBoxf_bbox
 this object bounding box More...
 
Data< sofa::core::objectmodel::ComponentStated_componentState
 the object state More...
 
DeprecatedAndRemoved m_componentstate
 
DeprecatedAndRemoved d_componentstate
 
std::string m_definitionSourceFileName {""}
 
int m_definitionSourceFilePos {-1}
 
std::string m_instanciationSourceFileName {""}
 
int m_instanciationSourceFilePos {-1}
 
- Public Attributes inherited from sofa::component::visualmodel::Vec3State
topology::PointData< VecCoordm_positions
 Vertices coordinates. More...
 
topology::PointData< VecCoordm_restPositions
 Vertices rest coordinates. More...
 
topology::PointData< VecDerivm_vnormals
 Normals of the model. More...
 
bool modified
 True if input vertices modified since last rendering. More...
 

Public Member Functions

 SOFA_CLASS2 (VisualModelImpl, core::visual::VisualModel, Vec3State)
 
virtual void internalDraw (const core::visual::VisualParams *, bool)
 Rendering method. More...
 
template<class VecType >
void addTopoHandler (topology::PointData< VecType > *data, int algo=0)
 
void parse (core::objectmodel::BaseObjectDescription *arg) override
 Parse the given description to assign values to this object's fields and potentially other parameters. More...
 
virtual bool hasTransparent ()
 
bool hasOpaque ()
 
void drawVisual (const core::visual::VisualParams *vparams) override
 Display the VisualModel object. More...
 
void drawTransparent (const core::visual::VisualParams *vparams) override
 Display transparent surfaces. More...
 
void drawShadow (const core::visual::VisualParams *vparams) override
 Display shadow-casting surfaces. More...
 
virtual bool loadTextures ()
 
virtual bool loadTexture (const std::string &)
 
bool load (const std::string &filename, const std::string &loader, const std::string &textureName)
 
void flipFaces ()
 
void setFilename (std::string s)
 
std::string getFilename ()
 
void setColor (float r, float g, float b, float a)
 
void setColor (std::string color)
 
void setUseNormals (bool val)
 
bool getUseNormals () const
 
void setCastShadow (bool val)
 
bool getCastShadow () const
 
void setMesh (helper::io::Mesh &m, bool tex=false)
 
bool isUsingTopology () const
 
const VecCoordgetVertices () const
 
const VecDerivgetVnormals () const
 
const VecTexCoordgetVtexcoords () const
 
const VecCoordgetVtangents () const
 
const VecCoordgetVbitangents () const
 
const VecVisualTrianglegetTriangles () const
 
const VecVisualQuadgetQuads () const
 
const VecVisualEdgegetEdges () const
 
void setVertices (VecCoord *x)
 
void setVnormals (VecDeriv *vn)
 
void setVtexcoords (VecTexCoord *vt)
 
void setVtangents (VecCoord *v)
 
void setVbitangents (VecCoord *v)
 
void setTriangles (VecVisualTriangle *t)
 
void setQuads (VecVisualQuad *q)
 
void setEdges (VecVisualEdge *e)
 
virtual void computePositions ()
 
virtual void computeMesh ()
 
virtual void computeNormals ()
 
virtual void computeTangents ()
 
void computeBBox (const core::ExecParams *params, bool=false) override
 
virtual void computeUVSphereProjection ()
 
virtual void updateBuffers ()
 
void updateVisual () override
 used to update the model if necessary. More...
 
void handleTopologyChange () override
 Handle topological changes. More...
 
void init () override
 Initialization method called at graph creation and modification, during top-down traversal. More...
 
void initVisual () override
 Initialize the textures, or other graphical resources. More...
 
void exportOBJ (std::string name, std::ostream *out, std::ostream *mtl, index_type &vindex, index_type &nindex, index_type &tindex, int &count) override
 
bool insertInNode (core::objectmodel::BaseNode *node) override
 
bool removeInNode (core::objectmodel::BaseNode *node) override
 
- Public Member Functions inherited from sofa::core::visual::VisualModel
 SOFA_ABSTRACT_CLASS (VisualModel, objectmodel::BaseObject)
 
virtual void clearVisual ()
 clear some graphical resources (generaly called before the deleteVisitor). More...
 
virtual void fwdDraw (VisualParams *)
 Called before objects in the current branch are displayed. More...
 
virtual void bwdDraw (VisualParams *)
 Called after objects in the current branch are displayed. More...
 
virtual void parallelUpdateVisual ()
 used to update the model if necessary. More...
 
virtual bool addBBox (SReal *, SReal *)
 used to add the bounding-box of this visual model to the given bounding box in order to compute the scene bounding box or cull hidden objects. More...
 
bool insertInNode (objectmodel::BaseNode *node) override
 
bool removeInNode (objectmodel::BaseNode *node) override
 
- Public Member Functions inherited from sofa::core::objectmodel::BaseObject
 SOFA_CLASS (BaseObject, Base)
 
virtual void draw (const core::visual::VisualParams *)
 Render internal data of this object, for debugging purposes. More...
 
void setSrc (const std::string &v, std::vector< std::string > *attributeList=nullptr)
 Sets a source Object and parses it to collect dependent Data. More...
 
void setSrc (const std::string &v, const BaseObject *loader, std::vector< std::string > *attributeList=nullptr)
 
void * findLinkDestClass (const BaseClass *destType, const std::string &path, const BaseLink *link) override
 
virtual std::string getPathName () const override
 Return the full path name of this object. More...
 
template<class T >
T::SPtr searchLocal () const
 Local search of an object of the given type. More...
 
template<class T >
T::SPtr searchUp () const
 Upward search of an object of the given type, starting from the local context. More...
 
template<class T >
T::SPtr searchDown () const
 Downward search of an object of the given type, starting from the local context. More...
 
template<class T >
T::SPtr searchFromRoot () const
 
template<class T >
T::SPtr searchInParents () const
 
template<class T >
helper::vector< typename T::SPtr > searchAllLocal () const
 Local search of all objects of the given type. More...
 
template<class T >
helper::vector< typename T::SPtr > searchAllUp () const
 Upward search of all objects of the given type, starting from the local context. More...
 
template<class T >
helper::vector< typename T::SPtr > searchAllDown () const
 Downward search of all objects of the given type, starting from the local context. More...
 
template<class T >
helper::vector< typename T::SPtr > searchAllFromRoot () const
 Search of all objects of the given type, starting from the root. More...
 
template<class T >
helper::vector< typename T::SPtr > searchAllInParents () const
 
template<class T >
helper::vector< typename T::SPtr > searchAllLocal (const Tag &t) const
 Local search of all objects of the given type with a given Tag. More...
 
template<class T >
helper::vector< typename T::SPtr > searchAllUp (const Tag &t) const
 Upward search of all objects of the given type with a given Tag, starting from the local context. More...
 
template<class T >
helper::vector< typename T::SPtr > searchAllDown (const Tag &t) const
 Downward search of all objects of the given typee with a given Tag, starting from the local context. More...
 
template<class T >
helper::vector< typename T::SPtr > searchAllFromRoot (const Tag &t) const
 Search of all objects of the given typee with a given Tag, starting from the root. More...
 
template<class T >
helper::vector< typename T::SPtr > searchAllInParents (const Tag &t) const
 
template<class T >
helper::vector< typename T::SPtr > searchAllLocal (const TagSet &t) const
 Local search of all objects of the given type with a given TagSet. More...
 
template<class T >
helper::vector< typename T::SPtr > searchAllUp (const TagSet &t) const
 Upward search of all objects of the given type with a given TagSet, starting from the local context. More...
 
template<class T >
helper::vector< typename T::SPtr > searchAllDown (const TagSet &t) const
 Downward search of all objects of the given typee with a given TagSet, starting from the local context. More...
 
template<class T >
helper::vector< typename T::SPtr > searchAllFromRoot (const TagSet &t) const
 Search of all objects of the given typee with a given TagSet, starting from the root. More...
 
template<class T >
helper::vector< typename T::SPtr > searchAllInParents (const TagSet &t) const
 
SReal getTime () const
 Current time. More...
 
const BaseContextgetContext () const
 
BaseContextgetContext ()
 
const BaseObjectgetMaster () const
 
BaseObjectgetMaster ()
 
const VecSlavesgetSlaves () const
 
BaseObjectgetSlave (const std::string &name) const
 
virtual void addSlave (BaseObject::SPtr s)
 
virtual void removeSlave (BaseObject::SPtr s)
 
virtual void handleEvent (Event *)
 Handle an event. More...
 
virtual void handleTopologyChange (core::topology::Topology *t)
 
void parse (BaseObjectDescription *arg) override
 Parse the given description to assign values to this object's fields and potentially other parameters. More...
 
virtual void bwdInit ()
 Initialization method called at graph creation and modification, during bottom-up traversal. More...
 
virtual void reinit ()
 Update method called when variables used in precomputation are modified. More...
 
void updateInternal ()
 Update method called when variables (used to compute other internal variables) are modified. More...
 
virtual void storeResetState ()
 Save the initial state for later uses in reset() More...
 
virtual void reset ()
 Reset to initial state. More...
 
virtual void cleanup ()
 
- Public Member Functions inherited from sofa::core::objectmodel::Base
virtual const BaseClassgetClass () const
 
void addUpdateCallback (const std::string &name, std::initializer_list< BaseData * > inputs, std::function< sofa::core::objectmodel::ComponentState(const DataTracker &)> function, std::initializer_list< BaseData * > outputs)
 
void addOutputsToCallback (const std::string &name, std::initializer_list< BaseData * > outputs)
 
const std::string & getName () const
 Accessor to the object name. More...
 
void setName (const std::string &n)
 Set the name of this object. More...
 
void setName (const std::string &n, int counter)
 Set the name of this object, adding an integer counter. More...
 
virtual std::string getTypeName () const
 Get the type name of this object (i.e. class and template types) More...
 
virtual std::string getClassName () const
 Get the class name of this object. More...
 
virtual std::string getTemplateName () const
 Get the template type names (if any) used to instantiate this object. More...
 
virtual std::string getNameSpaceName () const
 Get the template type names (if any) used to instantiate this object. More...
 
void setDefinitionSourceFileName (const std::string &sourceFileName)
 Set the source filename (where the component is implemented) More...
 
const std::string & getDefinitionSourceFileName () const
 Get the source filename (where the component is implemented) More...
 
void setDefinitionSourceFilePos (const int)
 Set the source location (where the component is implemented) More...
 
int getDefinitionSourceFilePos () const
 Get the source location (where the component is implemented) More...
 
void setInstanciationSourceFileName (const std::string &sourceFileName)
 
const std::string & getInstanciationSourceFileName () const
 
void setInstanciationSourceFilePos (const int)
 
int getInstanciationSourceFilePos () const
 
const std::string getWarnings () const
 
const std::string getOutputs () const
 use getLoggedMessageAsString() or getLoggedMessage instead. More...
 
void clearWarnings ()
 use getLoggedMessageAsString() or getLoggedMessage instead. More...
 
void clearOutputs ()
 use clearLoggedMessages() instead More...
 
void processStream (std::ostream &out)
 use clearLoggedMessages() instead More...
 
void addMessage (const sofa::helper::logging::Message &m) const
 
size_t countLoggedMessages (sofa::helper::logging::Message::TypeSet t=sofa::helper::logging::Message::AnyTypes) const
 
const std::deque< sofa::helper::logging::Message > & getLoggedMessages () const
 
const std::string getLoggedMessagesAsString (sofa::helper::logging::Message::TypeSet t=sofa::helper::logging::Message::AnyTypes) const
 
void clearLoggedMessages () const
 
bool notMuted () const
 
bool IsInheritingFromBase ()
 
const sofa::core::objectmodel::TagSetgetTags () const
 Represents the subsets the object belongs to. More...
 
bool hasTag (Tag t) const
 Return true if the object belong to the given subset. More...
 
void addTag (Tag t)
 Add a subset qualification to the object. More...
 
void removeTag (Tag t)
 Remove a subset qualification to the object. More...
 
ComponentState getComponentState () const
 
bool isComponentStateValid () const
 
virtual bool parseField (const std::string &attribute, const std::string &value)
 Assign one field value (Data or Link) More...
 
virtual bool hasField (const std::string &attribute) const
 Check if a given Data field or Link exists. More...
 
void parseFields (const std::list< std::string > &str)
 Assign the field values stored in the given list of name + value pairs of strings. More...
 
virtual void parseFields (const std::map< std::string, std::string * > &str)
 Assign the field values stored in the given map of name -> value pairs. More...
 
void writeDatas (std::map< std::string, std::string * > &str)
 Write the current field values to the given map of name -> value pairs. More...
 
void writeDatas (std::ostream &out, const std::string &separator=" ")
 
BaseDatafindData (const std::string &name) const
 
std::vector< BaseData * > findGlobalField (const std::string &name) const
 Find data fields given a name: several can be found as we look into the alias map. More...
 
BaseLinkfindLink (const std::string &name) const
 
std::vector< BaseLink * > findLinks (const std::string &name) const
 Find link fields given a name: several can be found as we look into the alias map. More...
 
virtual void updateLinks (bool logErrors=true)
 Update pointers in case the pointed-to objects have appeared. More...
 
template<class T >
BaseData::BaseInitData initData (Data< T > *field, const char *name, const char *help, bool isDisplayed=true, bool isReadOnly=false)
 Helper method used to initialize a data field containing a value of type T. More...
 
template<class T >
Data< T >::InitData initData (Data< T > *field, const T &value, const char *name, const char *help, bool isDisplayed=true, bool isReadOnly=false)
 Helper method used to initialize a data field containing a value of type T. More...
 
void addData (BaseData *f, const std::string &name)
 
void addData (BaseData *f)
 
void removeData (BaseData *f)
 Remove a data field. More...
 
void addAlias (BaseData *field, const char *alias)
 Add an alias to a Data. More...
 
void addLink (BaseLink *l)
 Add a link. More...
 
void addAlias (BaseLink *link, const char *alias)
 Add an alias to a Link. More...
 
const VecDatagetDataFields () const
 Accessor to the vector containing all the fields of this object. More...
 
const MapDatagetDataAliases () const
 Accessor to the map containing all the aliases of this object. More...
 
const VecLinkgetLinks () const
 Accessor to the vector containing all the fields of this object. More...
 
const MapLinkgetLinkAliases () const
 Accessor to the map containing all the aliases of this object. More...
 
virtual bool findDataLinkDest (BaseData *&ptr, const std::string &path, const BaseLink *link)
 
template<class T >
bool findLinkDest (T *&ptr, const std::string &path, const BaseLink *link)
 
- Public Member Functions inherited from sofa::component::visualmodel::Vec3State
 Vec3State ()
 
virtual void resize (size_t vsize)
 Resize all stored vector. More...
 
virtual size_t getSize () const
 Current size of all stored vectors. More...
 
virtual Data< VecCoord > * write (core::VecCoordId v)
 
virtual const Data< VecCoord > * read (core::ConstVecCoordId v) const
 
virtual Data< VecDeriv > * write (core::VecDerivId v)
 
virtual const Data< VecDeriv > * read (core::ConstVecDerivId v) const
 
virtual Data< MatrixDeriv > * write (core::MatrixDerivId)
 
virtual const Data< MatrixDeriv > * read (core::ConstMatrixDerivId) const
 
- Public Member Functions inherited from sofa::core::State< sofa::defaulttype::Vec3Types >
 SOFA_CLASS (SOFA_TEMPLATE(State, sofa::defaulttype::Vec3Types), BaseState)
 
void computeBBox (const core::ExecParams *params, bool onlyVisible=false) override
 
objectmodel::BaseDatabaseWrite (VecId v) override
 
const objectmodel::BaseDatabaseRead (ConstVecId v) const override
 
ReadVecCoord readPositions () const
 
WriteVecCoord writePositions ()
 
WriteOnlyVecCoord writeOnlyPositions ()
 
ReadVecCoord readRestPositions () const
 
WriteVecCoord writeRestPositions ()
 
WriteOnlyVecCoord writeOnlyRestPositions ()
 
ReadVecDeriv readVelocities () const
 
WriteVecDeriv writeVelocities ()
 
WriteOnlyVecDeriv writeOnlyVelocities ()
 
ReadVecDeriv readForces () const
 
WriteVecDeriv writeForces ()
 
WriteOnlyVecDeriv writeOnlyForces ()
 
ReadVecDeriv readDx () const
 
WriteVecDeriv writeDx ()
 
WriteOnlyVecDeriv writeOnlyDx ()
 
ReadVecDeriv readNormals () const
 
- Public Member Functions inherited from sofa::core::BaseState
 SOFA_ABSTRACT_CLASS (BaseState, objectmodel::BaseObject)
 
bool insertInNode (objectmodel::BaseNode *node) override
 
bool removeInNode (objectmodel::BaseNode *node) override
 

Static Public Member Functions

static std::string GetCustomTemplateName ()
 
static Coord computeTangent (const Coord &v1, const Coord &v2, const Coord &v3, const TexCoord &t1, const TexCoord &t2, const TexCoord &t3)
 Utility method to compute tangent from vertices and texture coordinates. More...
 
static Coord computeBitangent (const Coord &v1, const Coord &v2, const Coord &v3, const TexCoord &t1, const TexCoord &t2, const TexCoord &t3)
 Utility method to compute bitangent from vertices and texture coordinates. More...
 
- Static Public Member Functions inherited from sofa::core::objectmodel::BaseObject
template<class T >
static bool canCreate (T *, BaseContext *, BaseObjectDescription *)
 Pre-construction check method called by ObjectFactory. More...
 
template<class T >
static T::SPtr create (T *, BaseContext *context, BaseObjectDescription *arg)
 Construction method called by ObjectFactory. More...
 
- Static Public Member Functions inherited from sofa::core::objectmodel::Base
static const BaseClassGetClass ()
 
template<class T >
static void dynamicCast (T *&ptr, Base *b)
 
template<class T >
static std::string typeName (const T *ptr=nullptr)
 
template<class T >
static std::string className (const T *ptr=nullptr)
 
template<class T >
static std::string namespaceName (const T *ptr=nullptr)
 
template<class T >
static std::string templateName (const T *ptr=nullptr)
 
template<class T >
static std::string shortName (const T *ptr=nullptr, BaseObjectDescription *=nullptr)
 

Protected Member Functions

 VisualModelImpl ()
 Default constructor. More...
 
 ~VisualModelImpl () override
 Default destructor. More...
 
- Protected Member Functions inherited from sofa::core::visual::VisualModel
 ~VisualModel () override
 Destructor. More...
 
- Protected Member Functions inherited from sofa::core::objectmodel::BaseObject
 BaseObject ()
 
 ~BaseObject () override
 
virtual void doUpdateInternal ()
 Implementation of the internal update. More...
 
void changeContextLink (BaseContext *before, BaseContext *&after)
 
void changeSlavesLink (BaseObject::SPtr ptr, std::size_t, bool add)
 This method insures that slaves objects have master and context links set correctly. More...
 
void trackInternalData (const BaseData &data)
 Method called to add the Data to the DataTracker (listing the Data to track) More...
 
void cleanTracker ()
 
bool hasDataChanged (const BaseData &data)
 Method called to know if a tracked Data has changed. More...
 
- Protected Member Functions inherited from sofa::core::objectmodel::Base
 Base ()
 
virtual ~Base ()
 
void initData0 (BaseData *field, BaseData::BaseInitData &res, const char *name, const char *help, bool isDisplayed=true, bool isReadOnly=false)
 Helper method used by initData() More...
 
void initData0 (BaseData *field, BaseData::BaseInitData &res, const char *name, const char *help, BaseData::DataFlags dataFlags)
 Helper method used by initData() More...
 
template<class T >
void initData0 (Data< T > *field, typename Data< T >::InitData &res, const T &value, const char *name, const char *help, bool isDisplayed=true, bool isReadOnly=false)
 Helper method used by initData() More...
 
- Protected Member Functions inherited from sofa::core::State< sofa::defaulttype::Vec3Types >
 State ()
 
 ~State () override
 
- Protected Member Functions inherited from sofa::core::BaseState
 BaseState ()
 
 ~BaseState () override
 

Initial transformation attributes

typedef sofa::defaulttype::Vec< 3, RealVec3Real
 
Data< Vec3Realm_translation
 Initial Translation of the object. More...
 
Data< Vec3Realm_rotation
 Initial Rotation of the object. More...
 
Data< Vec3Realm_scale
 Initial Scale of the object. More...
 
Data< TexCoordm_scaleTex
 Scale of the texture. More...
 
Data< TexCoordm_translationTex
 Translation of the texture. More...
 
void applyTranslation (const SReal dx, const SReal dy, const SReal dz) override
 
void applyRotation (const SReal rx, const SReal ry, const SReal rz) override
 Apply Rotation from Euler angles (in degree!) More...
 
void applyRotation (const sofa::defaulttype::Quat q) override
 
void applyScale (const SReal sx, const SReal sy, const SReal sz) override
 
virtual void applyUVTransformation ()
 
void applyUVTranslation (const Real dU, const Real dV)
 
void applyUVScale (const Real su, const Real sv)
 
void setTranslation (SReal dx, SReal dy, SReal dz)
 
void setRotation (SReal rx, SReal ry, SReal rz)
 
void setScale (SReal sx, SReal sy, SReal sz)
 

Additional Inherited Members

- Protected Attributes inherited from sofa::core::objectmodel::BaseObject
SingleLink< BaseObject, BaseContext, BaseLink::FLAG_DOUBLELINKl_context
 
LinkSlaves l_slaves
 
SingleLink< BaseObject, BaseObject, BaseLink::FLAG_DOUBLELINKl_master
 
- Protected Attributes inherited from sofa::core::objectmodel::Base
std::map< std::string, sofa::core::DataTrackerCallbackm_internalEngine
 
VecData m_vecData
 List of fields (Data instances) More...
 
MapData m_aliasData
 name -> Data multi-map (includes names and aliases) More...
 
VecLink m_vecLink
 List of links. More...
 
MapLink m_aliasLink
 name -> Link multi-map (includes names and aliases) More...
 

Attribute details

sofa::defaulttype::Vec3f sofa::component::visualmodel::VisualModelImpl::bbox[2]
bool sofa::component::visualmodel::VisualModelImpl::castShadow

True if object cast shadows.

sofa::core::objectmodel::DataFileName sofa::component::visualmodel::VisualModelImpl::fileMesh
Data< helper::vector<FaceGroup> > sofa::component::visualmodel::VisualModelImpl::groups

Link to be set to the topology container in the component graph.

int sofa::component::visualmodel::VisualModelImpl::lastMeshRev

Time stamps from the last time the mesh was updated from the topology.

Data<bool> sofa::component::visualmodel::VisualModelImpl::m_computeTangents

True if tangents should be computed at startup.

Data< VecVisualEdge > sofa::component::visualmodel::VisualModelImpl::m_edges

edges of the model

Data<bool> sofa::component::visualmodel::VisualModelImpl::m_fixMergedUVSeams

True if UV seams should be handled even when duplicate UVs are merged.

Data<bool> sofa::component::visualmodel::VisualModelImpl::m_handleDynamicTopology

True if topological changes should be handled.

Data<bool> sofa::component::visualmodel::VisualModelImpl::m_initRestPositions

True if rest positions should be initialized with initial positions, False if nothing should be done.

Data<bool> sofa::component::visualmodel::VisualModelImpl::m_keepLines

keep and draw lines (false by default)

Data< VecVisualQuad > sofa::component::visualmodel::VisualModelImpl::m_quads

quads of the model

Data< Vec3Real > sofa::component::visualmodel::VisualModelImpl::m_rotation

Initial Rotation of the object.

Data< Vec3Real > sofa::component::visualmodel::VisualModelImpl::m_scale

Initial Scale of the object.

Data< TexCoord > sofa::component::visualmodel::VisualModelImpl::m_scaleTex

Scale of the texture.

sofa::core::topology::BaseMeshTopology* sofa::component::visualmodel::VisualModelImpl::m_topology
Data< Vec3Real > sofa::component::visualmodel::VisualModelImpl::m_translation

Initial Translation of the object.

Data< TexCoord > sofa::component::visualmodel::VisualModelImpl::m_translationTex

Translation of the texture.

Data< VecVisualTriangle > sofa::component::visualmodel::VisualModelImpl::m_triangles

triangles of the model

Data<bool> sofa::component::visualmodel::VisualModelImpl::m_updateNormals

True if normals should be updated at each iteration.

Data<bool> sofa::component::visualmodel::VisualModelImpl::m_updateTangents

True if tangents should be updated at each iteration.

Data<bool> sofa::component::visualmodel::VisualModelImpl::m_useNormals

True if normals should be read from file.

topology::PointData< VecCoord > sofa::component::visualmodel::VisualModelImpl::m_vbitangents

tangents for normal mapping

Data< VecCoord > sofa::component::visualmodel::VisualModelImpl::m_vertices2

vertices of the model (only if vertices have multiple normals/texcoords, otherwise positions are used)

Data< helper::vector<visual_index_type> > sofa::component::visualmodel::VisualModelImpl::m_vertNormIdx

Similarly this vector store which input normal is used for each vertex If it is empty then each vertex correspond to one normal

Data< helper::vector<visual_index_type> > sofa::component::visualmodel::VisualModelImpl::m_vertPosIdx

If vertices have multiple normals/texcoords, then we need to separate them This vector store which input position is used for each vertex If it is empty then each vertex correspond to one position

topology::PointData< VecCoord > sofa::component::visualmodel::VisualModelImpl::m_vtangents

tangents for normal mapping

topology::PointData< VecTexCoord > sofa::component::visualmodel::VisualModelImpl::m_vtexcoords

coordinates of the texture

Data< sofa::core::loader::Material > sofa::component::visualmodel::VisualModelImpl::material
Data< helper::vector<sofa::core::loader::Material> > sofa::component::visualmodel::VisualModelImpl::materials
Data< bool > sofa::component::visualmodel::VisualModelImpl::putOnlyTexCoords
Data< bool > sofa::component::visualmodel::VisualModelImpl::srgbTexturing
sofa::core::objectmodel::DataFileName sofa::component::visualmodel::VisualModelImpl::texturename
bool sofa::component::visualmodel::VisualModelImpl::useTopology

True if list of facets should be taken from the attached topology.

sofa::defaulttype::Rigid3fTypes::VecCoord sofa::component::visualmodel::VisualModelImpl::xforms

Temporary added here from RigidState deprecated inheritance.

bool sofa::component::visualmodel::VisualModelImpl::xformsModified

Constructor details

sofa::component::visualmodel::VisualModelImpl::VisualModelImpl ( )
protected

Default constructor.

sofa::component::visualmodel::VisualModelImpl::~VisualModelImpl ( )
overrideprotected

Default destructor.

Function details

template<class VecType >
void sofa::component::visualmodel::VisualModelImpl::addTopoHandler ( topology::PointData< VecType > *  data,
int  algo = 0 
)
void sofa::component::visualmodel::VisualModelImpl::applyRotation ( const SReal  rx,
const SReal  ry,
const SReal  rz 
)
overridevirtual

Apply Rotation from Euler angles (in degree!)

Reimplemented from sofa::core::visual::VisualModel.

void sofa::component::visualmodel::VisualModelImpl::applyRotation ( const sofa::defaulttype::Quat  )
overridevirtual

Rotate the positions

This method is optional, it is used when the user want to interactively change the position of an object

Reimplemented from sofa::core::visual::VisualModel.

void sofa::component::visualmodel::VisualModelImpl::applyScale ( const SReal  ,
const SReal  ,
const SReal   
)
overridevirtual

Scale the positions

This method is optional, it is used when the user want to interactively change the position of an object

Reimplemented from sofa::core::visual::VisualModel.

void sofa::component::visualmodel::VisualModelImpl::applyTranslation ( const SReal  ,
const SReal  ,
const SReal   
)
overridevirtual

Translate the positions

This method is optional, it is used when the user want to interactively change the position of an object

Reimplemented from sofa::core::visual::VisualModel.

void sofa::component::visualmodel::VisualModelImpl::applyUVScale ( const Real  su,
const Real  sv 
)
void sofa::component::visualmodel::VisualModelImpl::applyUVTransformation ( )
virtual
void sofa::component::visualmodel::VisualModelImpl::applyUVTranslation ( const Real  dU,
const Real  dV 
)
void sofa::component::visualmodel::VisualModelImpl::computeBBox ( const core::ExecParams ,
bool  = false 
)
overridevirtual

Bounding Box computation method. Default to empty method.

Reimplemented from sofa::core::objectmodel::BaseObject.

VisualModelImpl::Coord sofa::component::visualmodel::VisualModelImpl::computeBitangent ( const Coord v1,
const Coord v2,
const Coord v3,
const TexCoord t1,
const TexCoord t2,
const TexCoord t3 
)
static

Utility method to compute bitangent from vertices and texture coordinates.

void sofa::component::visualmodel::VisualModelImpl::computeMesh ( )
virtual
void sofa::component::visualmodel::VisualModelImpl::computeNormals ( )
virtual
void sofa::component::visualmodel::VisualModelImpl::computePositions ( )
virtual
VisualModelImpl::Coord sofa::component::visualmodel::VisualModelImpl::computeTangent ( const Coord v1,
const Coord v2,
const Coord v3,
const TexCoord t1,
const TexCoord t2,
const TexCoord t3 
)
static

Utility method to compute tangent from vertices and texture coordinates.

void sofa::component::visualmodel::VisualModelImpl::computeTangents ( )
virtual
void sofa::component::visualmodel::VisualModelImpl::computeUVSphereProjection ( )
virtual
void sofa::component::visualmodel::VisualModelImpl::drawShadow ( const core::visual::VisualParams vparams)
overridevirtual

Display shadow-casting surfaces.

This method default to calling draw(). Object that do not cast any shadows, or that use a different LOD for them should reimplement it.

Reimplemented from sofa::core::visual::VisualModel.

void sofa::component::visualmodel::VisualModelImpl::drawTransparent ( const core::visual::VisualParams )
overridevirtual

Display transparent surfaces.

Transparent objects should use this method to get a correct display order.

Reimplemented from sofa::core::visual::VisualModel.

void sofa::component::visualmodel::VisualModelImpl::drawVisual ( const core::visual::VisualParams )
overridevirtual

Display the VisualModel object.

Reimplemented from sofa::core::visual::VisualModel.

void sofa::component::visualmodel::VisualModelImpl::exportOBJ ( std::string  name,
std::ostream *  out,
std::ostream *  mtl,
index_type vindex,
index_type nindex,
index_type tindex,
int count 
)
overridevirtual

Append this mesh to an OBJ format stream. The number of vertices position, normal, and texture coordinates already written is given as parameters This method should update them

Reimplemented from sofa::core::visual::VisualModel.

void sofa::component::visualmodel::VisualModelImpl::flipFaces ( )
bool sofa::component::visualmodel::VisualModelImpl::getCastShadow ( ) const
inline
static std::string sofa::component::visualmodel::VisualModelImpl::GetCustomTemplateName ( )
inlinestatic

Returns the sofa class name. By default the name of the c++ class is exposed... More details on the name customization infrastructure is in NameDecoder.h

const VecVisualEdge& sofa::component::visualmodel::VisualModelImpl::getEdges ( ) const
inline
std::string sofa::component::visualmodel::VisualModelImpl::getFilename ( )
inline
const VecVisualQuad& sofa::component::visualmodel::VisualModelImpl::getQuads ( ) const
inline
const VecVisualTriangle& sofa::component::visualmodel::VisualModelImpl::getTriangles ( ) const
inline
bool sofa::component::visualmodel::VisualModelImpl::getUseNormals ( ) const
inline
const VecCoord& sofa::component::visualmodel::VisualModelImpl::getVbitangents ( ) const
inline
const VecCoord& sofa::component::visualmodel::VisualModelImpl::getVertices ( ) const
inline
const VecDeriv& sofa::component::visualmodel::VisualModelImpl::getVnormals ( ) const
inline
const VecCoord& sofa::component::visualmodel::VisualModelImpl::getVtangents ( ) const
inline
const VecTexCoord& sofa::component::visualmodel::VisualModelImpl::getVtexcoords ( ) const
inline
void sofa::component::visualmodel::VisualModelImpl::handleTopologyChange ( )
overridevirtual

Handle topological changes.

Reimplemented from sofa::core::objectmodel::BaseObject.

bool sofa::component::visualmodel::VisualModelImpl::hasOpaque ( )
bool sofa::component::visualmodel::VisualModelImpl::hasTransparent ( )
virtual
void sofa::component::visualmodel::VisualModelImpl::init ( void  )
overridevirtual

Initialization method called at graph creation and modification, during top-down traversal.

Reimplemented from sofa::core::objectmodel::BaseObject.

void sofa::component::visualmodel::VisualModelImpl::initVisual ( )
overridevirtual

Initialize the textures, or other graphical resources.

Called once before the first frame is drawn, and if the graphical context has been recreated.

Reimplemented from sofa::core::visual::VisualModel.

bool sofa::component::visualmodel::VisualModelImpl::insertInNode ( core::objectmodel::BaseNode )
inlineoverridevirtual

the component can insert itseft direclty in the right sequence in the Node so the Node does not have to test its type against every known types.

Returns
true iff the component was inserted

Reimplemented from sofa::core::objectmodel::BaseObject.

virtual void sofa::component::visualmodel::VisualModelImpl::internalDraw ( const core::visual::VisualParams ,
bool   
)
inlinevirtual

Rendering method.

Reimplemented in sofa::component::visualmodel::OglModel.

bool sofa::component::visualmodel::VisualModelImpl::isUsingTopology ( ) const
inline
bool sofa::component::visualmodel::VisualModelImpl::load ( const std::string &  filename,
const std::string &  loader,
const std::string &  textureName 
)
virtual bool sofa::component::visualmodel::VisualModelImpl::loadTexture ( const std::string &  )
inlinevirtual
virtual bool sofa::component::visualmodel::VisualModelImpl::loadTextures ( )
inlinevirtual
void sofa::component::visualmodel::VisualModelImpl::parse ( core::objectmodel::BaseObjectDescription arg)
overridevirtual

Parse the given description to assign values to this object's fields and potentially other parameters.

Reimplemented from sofa::core::objectmodel::Base.

bool sofa::component::visualmodel::VisualModelImpl::removeInNode ( core::objectmodel::BaseNode )
inlineoverridevirtual

the component can remove itseft direclty in the right sequence in the Node so the Node does not have to test its type against every known types.

Returns
true iff the component was removed

Reimplemented from sofa::core::objectmodel::BaseObject.

void sofa::component::visualmodel::VisualModelImpl::setCastShadow ( bool  val)
inline
void sofa::component::visualmodel::VisualModelImpl::setColor ( float  r,
float  g,
float  b,
float  a 
)
void sofa::component::visualmodel::VisualModelImpl::setColor ( std::string  color)
void sofa::component::visualmodel::VisualModelImpl::setEdges ( VecVisualEdge e)
inline
void sofa::component::visualmodel::VisualModelImpl::setFilename ( std::string  s)
inline
void sofa::component::visualmodel::VisualModelImpl::setMesh ( helper::io::Mesh m,
bool  tex = false 
)
void sofa::component::visualmodel::VisualModelImpl::setQuads ( VecVisualQuad q)
inline
void sofa::component::visualmodel::VisualModelImpl::setRotation ( SReal  rx,
SReal  ry,
SReal  rz 
)
inline
void sofa::component::visualmodel::VisualModelImpl::setScale ( SReal  sx,
SReal  sy,
SReal  sz 
)
inline
void sofa::component::visualmodel::VisualModelImpl::setTranslation ( SReal  dx,
SReal  dy,
SReal  dz 
)
inline
void sofa::component::visualmodel::VisualModelImpl::setTriangles ( VecVisualTriangle t)
inline
void sofa::component::visualmodel::VisualModelImpl::setUseNormals ( bool  val)
inline
void sofa::component::visualmodel::VisualModelImpl::setVbitangents ( VecCoord v)
inline
void sofa::component::visualmodel::VisualModelImpl::setVertices ( VecCoord x)
inline
void sofa::component::visualmodel::VisualModelImpl::setVnormals ( VecDeriv vn)
inline
void sofa::component::visualmodel::VisualModelImpl::setVtangents ( VecCoord v)
inline
void sofa::component::visualmodel::VisualModelImpl::setVtexcoords ( VecTexCoord vt)
inline
sofa::component::visualmodel::VisualModelImpl::SOFA_CLASS2 ( VisualModelImpl  ,
core::visual::VisualModel  ,
Vec3State   
)
virtual void sofa::component::visualmodel::VisualModelImpl::updateBuffers ( )
inlinevirtual
void sofa::component::visualmodel::VisualModelImpl::updateVisual ( )
overridevirtual

used to update the model if necessary.

Reimplemented from sofa::core::visual::VisualModel.