OpenStructure
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
GfxObj Class Reference

#include <gfx_object.hh>

Inherits GfxObjBase.

Inherited by Entity, GfxTestObj, MapIso, MapSlab, PrimList, Surface, and PyGfxObj.

Public Member Functions

 GfxObj (const String &name)
 
virtual GfxNodeP Copy () const
 
virtual void DeepSwap (GfxObj &go)
 
virtual void RenderGL (RenderPass pass)
 
virtual void RenderPov (PovState &pov)
 
virtual void Export (Exporter *ex)
 
virtual void Apply (GfxNodeVisitor &v, GfxNodeVisitor::Stack st)
 
virtual int GetType () const
 
virtual void SetMatAmb (const Color &c)
 
virtual void SetMatDiff (const Color &c)
 
virtual void SetMatSpec (const Color &c)
 
virtual void SetMatShin (float s)
 
virtual void SetMatEmm (const Color &c)
 
virtual void ContextSwitch ()
 
virtual void SetRenderMode (RenderMode::Type m)
 
virtual RenderMode::Type GetRenderMode () const
 
virtual geom::Vec3 GetCenter () const
 
virtual void SetLineWidth (float w)
 
virtual void SetPolyMode (unsigned int m)
 
virtual void SetAALines (bool f)
 
virtual void SetLineHalo (float f)
 
virtual void SetOutline (bool f)
 
virtual bool GetOutline () const
 
virtual void SetOutlineMode (int m)
 
virtual int GetOutlineMode () const
 
virtual void SetOutlineWidth (float f)
 
virtual float GetOutlineWidth () const
 
virtual void SetOutlineExpandFactor (float f)
 
virtual float GetOutlineExpandFactor () const
 
virtual void SetOutlineExpandColor (const Color &c)
 
virtual Color GetOutlineExpandColor () const
 
virtual void SetOpacity (float f)
 
virtual float GetOpacity () const
 
virtual void SetSolid (bool f)
 
virtual bool GetSolid () const
 
virtual void SetSolidColor (const Color &c)
 
virtual Color GetSolidColor () const
 
virtual void SetClip (bool f)
 
virtual bool GetClip () const
 
virtual void SetClipPlane (const geom::Vec4 &)
 
virtual geom::Vec4 GetClipPlane () const
 
virtual void SetClipOffset (float f)
 
virtual float GetClipOffset () const
 
virtual void ColorBy (const mol::EntityView &ev, const String &prop, const Gradient &g, float minv, float maxv)
 
virtual void ColorBy (const img::MapHandle &mh, const String &prop, const Gradient &g, float minv, float maxv)
 
virtual geom::AlignedCuboid GetBoundingBox (bool use_tf=false) const
 
virtual void ProcessLimits (geom::Vec3 &minc, geom::Vec3 &maxc, const geom::Transform &tf) const
 
virtual void CustomRenderGL (RenderPass pass)
 
virtual void CustomPreRenderGL (bool rebuild)
 
virtual void InitGL ()
 
virtual void CustomRenderPov (PovState &pov)
 
virtual bool OnSelect (const geom::Line3 &l, geom::Vec3 &result, float zlim, bool pick_flag)
 
virtual void OnInput (const InputEvent &e)
 
virtual void OnRenderModeChange ()
 
virtual void OnGLCleanup ()
 
void Clear ()
 
const geom::TransformGetTF () const
 
void SetTF (const geom::Transform &tf)
 
void AddLabel (const String &s, const geom::Vec3 &pos, const Color &col, float psize)
 
void AddLabel (const String &s, const geom::Vec3 &pos, const Color &col)
 
void AddLabel (const String &s, const geom::Vec3 &pos, float psize)
 
void AddLabel (const String &s, const geom::Vec3 &pos)
 
void ClearLabels ()
 
void FlagRebuild ()
 
void FlagRefresh ()
 
bool GetAALines () const
 
float GetLineWidth () const
 
float GetLineHalo () const
 
void SetNormalSmoothFactor (float smoothf)
 
float GetNormalSmoothFactor () const
 
Material GetMaterial () const
 
void SetMaterial (const Material &m)
 
void SmoothVertices (float smoothf)
 
void GLCleanup ()
 
void Debug (unsigned int flags)
 
IndexedVertexArrayGetVA ()
 
const IndexedVertexArrayGetVA () const
 
- Public Member Functions inherited from GfxObjBase
 GfxObjBase (const String &name)
 
- Public Member Functions inherited from GfxNode
 GfxNode (const String &name)
 
virtual ~GfxNode ()
 
virtual void DeepSwap (GfxNode &n)
 
String GetName () const
 
void RemoveAll ()
 
void Rename (const String &name)
 
void Add (GfxObjP obj)
 
bool IsNameAvailable (const String &name) const
 
void Remove (GfxObjP obj)
 
void Add (GfxNodeP node)
 
void Remove (GfxNodeP node)
 
void Remove (const String &name)
 
size_t GetChildCount () const
 
void Hide ()
 
void Show ()
 
bool IsVisible () const
 
bool IsAttachedToScene () const
 
gfx::GfxNodeP GetParent () const
 
const GfxNodeVectorGetChildren () const
 
GfxNodeVectorGetChildren ()
 

Static Public Member Functions

static Color Ele2Color (const String &ele)
 

Protected Member Functions

void PreRenderGL (bool flag)
 
void AppendColorOp (gfx::ColorOp *op)
 
void CleanColorOps ()
 
void ReapplyColorOps ()
 
void render_labels () const
 
void render_depth_only ()
 

Protected Attributes

IndexedVertexArray va_
 
RenderMode::Type render_mode_
 
unsigned int debug_flags_
 
geom::Transform transform_
 
bool rebuild_
 
bool refresh_
 
float line_width_
 
unsigned int poly_mode_
 
bool aalines_flag_
 
float line_halo_
 
Material mat_
 
unsigned int mat_dlist_
 
bool mat_update_
 
float opacity_
 
float smoothf_
 
bool outline_flag_
 
int outline_mode_
 
bool solid_
 
Color solid_color_
 
bool clip_flag_
 
geom::Vec4 clip_plane_
 
float clip_offset_
 
boost::ptr_vector< gfx::ColorOpc_ops_
 
TextPrimList labels_
 
bool use_occlusion_
 

Detailed Description

main class for all graphic objects

Definition at line 51 of file gfx_object.hh.

Constructor & Destructor Documentation

◆ GfxObj()

GfxObj ( const String name)

Member Function Documentation

◆ AddLabel() [1/4]

void AddLabel ( const String s,
const geom::Vec3 pos 
)

◆ AddLabel() [2/4]

void AddLabel ( const String s,
const geom::Vec3 pos,
const Color col 
)

◆ AddLabel() [3/4]

void AddLabel ( const String s,
const geom::Vec3 pos,
const Color col,
float  psize 
)

◆ AddLabel() [4/4]

void AddLabel ( const String s,
const geom::Vec3 pos,
float  psize 
)

◆ AppendColorOp()

void AppendColorOp ( gfx::ColorOp op)
protected

◆ Apply()

virtual void Apply ( GfxNodeVisitor v,
GfxNodeVisitor::Stack  st 
)
virtual

Reimplemented from GfxNode.

◆ CleanColorOps()

void CleanColorOps ( )
protected

◆ Clear()

void Clear ( )

removes all graphical elements

◆ ClearLabels()

void ClearLabels ( )

◆ ColorBy() [1/2]

virtual void ColorBy ( const img::MapHandle mh,
const String prop,
const Gradient g,
float  minv,
float  maxv 
)
virtual

color based on image

Implements GfxObjBase.

Reimplemented in Surface, and Entity.

◆ ColorBy() [2/2]

virtual void ColorBy ( const mol::EntityView ev,
const String prop,
const Gradient g,
float  minv,
float  maxv 
)
virtual

color each component based on the gradient-mapped property of the given entity

Implements GfxObjBase.

Reimplemented in Surface, and Entity.

◆ ContextSwitch()

virtual void ContextSwitch ( )
virtual

rendering context switch, some things need to be regenerated

Implements GfxObjBase.

◆ Copy()

virtual GfxNodeP Copy ( ) const
virtual

Reimplemented from GfxNode.

◆ CustomPreRenderGL()

virtual void CustomPreRenderGL ( bool  rebuild)
virtual

Reimplemented in Surface, PrimList, MapSlab, MapIso, and Entity.

◆ CustomRenderGL()

virtual void CustomRenderGL ( RenderPass  pass)
virtual

Reimplemented in Surface, PrimList, MapSlab, MapIso, GfxTestObj, and Entity.

◆ CustomRenderPov()

virtual void CustomRenderPov ( PovState pov)
virtual

Reimplemented in Surface, PrimList, MapSlab, MapIso, and Entity.

◆ Debug()

void Debug ( unsigned int  flags)

◆ DeepSwap()

virtual void DeepSwap ( GfxObj go)
virtual

◆ Ele2Color()

static Color Ele2Color ( const String ele)
static

◆ Export()

virtual void Export ( Exporter ex)
virtual

Reimplemented from GfxNode.

Reimplemented in Entity.

◆ FlagRebuild()

void FlagRebuild ( )

◆ FlagRefresh()

void FlagRefresh ( )

◆ GetAALines()

bool GetAALines ( ) const
inline

Definition at line 200 of file gfx_object.hh.

◆ GetBoundingBox()

virtual geom::AlignedCuboid GetBoundingBox ( bool  use_tf = false) const
virtual

returns the bounding box of this object

The bounding box, i.e. the left-bottom-front and the right-top-back corner of the object, is obtained with this method. The single boolean parameter denotes whether to return local coordinates or global scene coordinates; global scene coordinates are local coordinates with the object's transformation (if present) applied. The default is false, i.e. return local coordinates.

Reimplemented in PrimList, MapSlab, Entity, Surface, and MapIso.

◆ GetCenter()

virtual geom::Vec3 GetCenter ( ) const
virtual

get geometric center

Implements GfxObjBase.

Reimplemented in PrimList, MapSlab, MapIso, and GfxTestObj.

◆ GetClip()

virtual bool GetClip ( ) const
inlinevirtual

Implements GfxObjBase.

Definition at line 98 of file gfx_object.hh.

◆ GetClipOffset()

virtual float GetClipOffset ( ) const
inlinevirtual

Implements GfxObjBase.

Definition at line 102 of file gfx_object.hh.

◆ GetClipPlane()

virtual geom::Vec4 GetClipPlane ( ) const
inlinevirtual

Implements GfxObjBase.

Definition at line 100 of file gfx_object.hh.

◆ GetLineHalo()

float GetLineHalo ( ) const
inline

Definition at line 202 of file gfx_object.hh.

◆ GetLineWidth()

float GetLineWidth ( ) const
inline

Definition at line 201 of file gfx_object.hh.

◆ GetMaterial()

Material GetMaterial ( ) const

◆ GetNormalSmoothFactor()

float GetNormalSmoothFactor ( ) const

◆ GetOpacity()

virtual float GetOpacity ( ) const
inlinevirtual

returns a value smaller than 1.0 if transparency is used in this object

Implements GfxObjBase.

Reimplemented in Entity.

Definition at line 91 of file gfx_object.hh.

◆ GetOutline()

virtual bool GetOutline ( ) const
inlinevirtual

get state of outline rendering

Implements GfxObjBase.

Definition at line 81 of file gfx_object.hh.

◆ GetOutlineExpandColor()

virtual Color GetOutlineExpandColor ( ) const
virtual

get current outline color (mode 3)

Implements GfxObjBase.

◆ GetOutlineExpandFactor()

virtual float GetOutlineExpandFactor ( ) const
virtual

get current outline expand factor (mode 3)

Implements GfxObjBase.

◆ GetOutlineMode()

virtual int GetOutlineMode ( ) const
inlinevirtual

get current outline mode

Implements GfxObjBase.

Definition at line 83 of file gfx_object.hh.

◆ GetOutlineWidth()

virtual float GetOutlineWidth ( ) const
virtual

get current outline width

Implements GfxObjBase.

◆ GetRenderMode()

virtual RenderMode::Type GetRenderMode ( ) const
virtual

current render mode

Implements GfxObjBase.

◆ GetSolid()

virtual bool GetSolid ( ) const
inlinevirtual

Implements GfxObjBase.

Definition at line 93 of file gfx_object.hh.

◆ GetSolidColor()

virtual Color GetSolidColor ( ) const
inlinevirtual

Implements GfxObjBase.

Definition at line 95 of file gfx_object.hh.

◆ GetTF()

const geom::Transform& GetTF ( ) const

get transform

◆ GetType()

virtual int GetType ( ) const
virtual

Reimplemented from GfxNode.

◆ GetVA() [1/2]

IndexedVertexArray& GetVA ( )
inline

Definition at line 220 of file gfx_object.hh.

◆ GetVA() [2/2]

const IndexedVertexArray& GetVA ( ) const
inline

Definition at line 221 of file gfx_object.hh.

◆ GLCleanup()

void GLCleanup ( )

◆ InitGL()

virtual void InitGL ( )
virtual

◆ OnGLCleanup()

virtual void OnGLCleanup ( )
virtual

◆ OnInput()

virtual void OnInput ( const InputEvent e)
virtual

Reimplemented in MapIso.

◆ OnRenderModeChange()

virtual void OnRenderModeChange ( )
virtual

Reimplemented in Surface, PrimList, MapIso, and Entity.

◆ OnSelect()

virtual bool OnSelect ( const geom::Line3 l,
geom::Vec3 result,
float  zlim,
bool  pick_flag 
)
virtual

Reimplemented in Entity.

◆ PreRenderGL()

void PreRenderGL ( bool  flag)
protected

◆ ProcessLimits()

virtual void ProcessLimits ( geom::Vec3 minc,
geom::Vec3 maxc,
const geom::Transform tf 
) const
virtual

adjust minimum and maximum extent based on graphical object

this routine will adjust the provided minimum and maximum points based on the vertices of the underlying graphical representation, combining the given Transform with the object transform.

If derived classes do not implement this method then the limits will be adjusted based on the Cuboid returned by GetBoundingBox(true)

Reimplemented in PrimList.

◆ ReapplyColorOps()

void ReapplyColorOps ( )
protected

◆ render_depth_only()

void render_depth_only ( )
protected

◆ render_labels()

void render_labels ( ) const
protected

◆ RenderGL()

virtual void RenderGL ( RenderPass  pass)
virtual

Reimplemented from GfxNode.

◆ RenderPov()

virtual void RenderPov ( PovState pov)
virtual

Reimplemented from GfxNode.

◆ SetAALines()

virtual void SetAALines ( bool  f)
virtual

turn on sophisticated line anti-aliasing, requires shader

Implements GfxObjBase.

◆ SetClip()

virtual void SetClip ( bool  f)
virtual

Implements GfxObjBase.

◆ SetClipOffset()

virtual void SetClipOffset ( float  f)
virtual

Implements GfxObjBase.

Reimplemented in Entity.

◆ SetClipPlane()

virtual void SetClipPlane ( const geom::Vec4 )
virtual

Implements GfxObjBase.

◆ SetLineHalo()

virtual void SetLineHalo ( float  f)
virtual

turn on line halo of given strength

Implements GfxObjBase.

◆ SetLineWidth()

virtual void SetLineWidth ( float  w)
virtual

set line width

Implements GfxObjBase.

Reimplemented in PrimList.

◆ SetMatAmb()

virtual void SetMatAmb ( const Color c)
virtual

material ambient color

Implements GfxObjBase.

◆ SetMatDiff()

virtual void SetMatDiff ( const Color c)
virtual

material diffuse color

Implements GfxObjBase.

◆ SetMatEmm()

virtual void SetMatEmm ( const Color c)
virtual

material emmissive color

Implements GfxObjBase.

◆ SetMaterial()

void SetMaterial ( const Material m)

◆ SetMatShin()

virtual void SetMatShin ( float  s)
virtual

material shininess

Implements GfxObjBase.

◆ SetMatSpec()

virtual void SetMatSpec ( const Color c)
virtual

material specular color

Implements GfxObjBase.

◆ SetNormalSmoothFactor()

void SetNormalSmoothFactor ( float  smoothf)

◆ SetOpacity()

virtual void SetOpacity ( float  f)
virtual

set opacity (1 = no transparency)

Implements GfxObjBase.

Reimplemented in Entity.

◆ SetOutline()

virtual void SetOutline ( bool  f)
virtual

turn outline rendering on or off

Implements GfxObjBase.

◆ SetOutlineExpandColor()

virtual void SetOutlineExpandColor ( const Color c)
virtual

set outline color (mode 3)

Implements GfxObjBase.

Reimplemented in Entity.

◆ SetOutlineExpandFactor()

virtual void SetOutlineExpandFactor ( float  f)
virtual

set outline expansion factor (mode 3) this scales with resolution

Implements GfxObjBase.

Reimplemented in Entity.

◆ SetOutlineMode()

virtual void SetOutlineMode ( int  m)
virtual

set outline mode, 1, 2 or 3

Implements GfxObjBase.

◆ SetOutlineWidth()

virtual void SetOutlineWidth ( float  f)
virtual

set outline width in pixels (modes 1 + 2) this does not scale with resolution

Implements GfxObjBase.

Reimplemented in Entity.

◆ SetPolyMode()

virtual void SetPolyMode ( unsigned int  m)
virtual

set polygon mode

Implements GfxObjBase.

◆ SetRenderMode()

virtual void SetRenderMode ( RenderMode::Type  m)
virtual

change render mode

Implements GfxObjBase.

Reimplemented in Entity.

◆ SetSolid()

virtual void SetSolid ( bool  f)
virtual

Implements GfxObjBase.

◆ SetSolidColor()

virtual void SetSolidColor ( const Color c)
virtual

Implements GfxObjBase.

◆ SetTF()

void SetTF ( const geom::Transform tf)

set transform

◆ SmoothVertices()

void SmoothVertices ( float  smoothf)

Field Documentation

◆ aalines_flag_

bool aalines_flag_
protected

Definition at line 247 of file gfx_object.hh.

◆ c_ops_

boost::ptr_vector<gfx::ColorOp> c_ops_
protected

Definition at line 266 of file gfx_object.hh.

◆ clip_flag_

bool clip_flag_
protected

Definition at line 262 of file gfx_object.hh.

◆ clip_offset_

float clip_offset_
protected

Definition at line 264 of file gfx_object.hh.

◆ clip_plane_

geom::Vec4 clip_plane_
protected

Definition at line 263 of file gfx_object.hh.

◆ debug_flags_

unsigned int debug_flags_
protected

Definition at line 240 of file gfx_object.hh.

◆ labels_

TextPrimList labels_
protected

Definition at line 268 of file gfx_object.hh.

◆ line_halo_

float line_halo_
protected

Definition at line 248 of file gfx_object.hh.

◆ line_width_

float line_width_
protected

Definition at line 245 of file gfx_object.hh.

◆ mat_

Material mat_
protected

Definition at line 250 of file gfx_object.hh.

◆ mat_dlist_

unsigned int mat_dlist_
protected

Definition at line 251 of file gfx_object.hh.

◆ mat_update_

bool mat_update_
protected

Definition at line 252 of file gfx_object.hh.

◆ opacity_

float opacity_
protected

Definition at line 254 of file gfx_object.hh.

◆ outline_flag_

bool outline_flag_
protected

Definition at line 256 of file gfx_object.hh.

◆ outline_mode_

int outline_mode_
protected

Definition at line 257 of file gfx_object.hh.

◆ poly_mode_

unsigned int poly_mode_
protected

Definition at line 246 of file gfx_object.hh.

◆ rebuild_

bool rebuild_
protected

Definition at line 243 of file gfx_object.hh.

◆ refresh_

bool refresh_
protected

Definition at line 244 of file gfx_object.hh.

◆ render_mode_

RenderMode::Type render_mode_
protected

Definition at line 239 of file gfx_object.hh.

◆ smoothf_

float smoothf_
protected

Definition at line 255 of file gfx_object.hh.

◆ solid_

bool solid_
protected

Definition at line 259 of file gfx_object.hh.

◆ solid_color_

Color solid_color_
protected

Definition at line 260 of file gfx_object.hh.

◆ transform_

geom::Transform transform_
protected

Definition at line 242 of file gfx_object.hh.

◆ use_occlusion_

bool use_occlusion_
protected

Definition at line 270 of file gfx_object.hh.

◆ va_

IndexedVertexArray va_
protected

Definition at line 238 of file gfx_object.hh.


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