ROOT  6.06/09
Reference Guide
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
TGLPhysicalShape Class Reference

Concrete physical shape - a GL drawable.

Physical shapes are the objects the user can actually see, select, move in the viewer. It is a placement of the associated local frame TGLLogicaShape into the world frame. The draw process is:

Load attributes - material colors etc Load translation matrix - placement Load gl name (for selection) Call our associated logical shape Draw() to draw placed shape

The physical shape supports translation, scaling and rotation, selection, color changes, and permitted modification flags etc. A physical shape cannot modify or be bound to another (or no) logical shape - hence const & handle. It can perform mutable reference counting on the logical to enable purging.

Physical shape also maintains a list of references to it and provides notifications of change and destruction. See class TGLPShapeRef which needs to be sub-classes for real use.

See base/src/TVirtualViewer3D for description of common external 3D viewer architecture and how external viewer clients use it.

Definition at line 33 of file TGLPhysicalShape.h.

Public Types

enum  EManip {
  kTranslateX = 1 << 0, kTranslateY = 1 << 1, kTranslateZ = 1 << 2, kTranslateAll = kTranslateX | kTranslateY | kTranslateZ,
  kScaleX = 1 << 3, kScaleY = 1 << 4, kScaleZ = 1 << 5, kScaleAll = kScaleX | kScaleY | kScaleZ,
  kRotateX = 1 << 6, kRotateY = 1 << 7, kRotateZ = 1 << 8, kRotateAll = kRotateX | kRotateY | kRotateZ,
  kManipAll = kTranslateAll | kScaleAll | kRotateAll
}
 

Public Member Functions

 TGLPhysicalShape (UInt_t ID, const TGLLogicalShape &logicalShape, const TGLMatrix &transform, Bool_t invertedWind, const Float_t rgba[4])
 
 TGLPhysicalShape (UInt_t ID, const TGLLogicalShape &logicalShape, const double *transform, Bool_t invertedWind, const Float_t rgba[4])
 Construct a physical shape using arguments: More...
 
virtual ~TGLPhysicalShape ()
 Destroy the physical shape. More...
 
void AddReference (TGLPShapeRef *ref)
 Add reference ref. More...
 
void RemoveReference (TGLPShapeRef *ref)
 Remove reference ref. More...
 
UInt_t ID () const
 
const TGLBoundingBoxBoundingBox () const
 
virtual void CalculateShapeLOD (TGLRnrCtx &rnrCtx, Float_t &pixSize, Short_t &shapeLOD) const
 Calculate shape-lod, suitable for use under projection defined by 'rnrCtx', taking account of which local axes of the shape support LOD adjustment, and the global 'sceneFlags' passed. More...
 
virtual void QuantizeShapeLOD (Short_t shapeLOD, Short_t combiLOD, Short_t &quantLOD) const
 Factor in scene/vierer LOD and Quantize ... More...
 
void SetupGLColors (TGLRnrCtx &rnrCtx, const Float_t *color=0) const
 Setup colors - avoid setting things not required for current draw flags. More...
 
virtual void Draw (TGLRnrCtx &rnrCtx) const
 Draw physical shape, using LOD flags, potential from display list cache. More...
 
const TGLLogicalShapeGetLogical () const
 
const TGLPhysicalShapeGetNextPhysical () const
 
EManip GetManip () const
 
void SetManip (EManip manip)
 
void Modified ()
 Call this after modifying the physical so that the information can be propagated to the object referencing it. More...
 
Bool_t IsModified () const
 
Bool_t IsSelected () const
 
UChar_t GetSelected () const
 
void Select (UChar_t select)
 
const Float_tColor () const
 
Bool_t IsTransparent () const
 
Bool_t IsInvisible () const
 
void SetColor (const Float_t rgba[17])
 Set full color attributes - see OpenGL material documentation for full description. More...
 
void SetColorOnFamily (const Float_t rgba[17])
 Set full color attributes to all physicals sharing the same logical with this object. More...
 
void SetDiffuseColor (const Float_t rgba[4])
 Set color from ROOT color index and transparency [0,100]. More...
 
void SetDiffuseColor (const UChar_t rgba[4])
 Set color from RGBA quadruplet. More...
 
void SetDiffuseColor (Color_t ci, UChar_t transparency)
 Set color from standard ROOT representation, that is color index. More...
 
TGLVector3 GetScale () const
 
TGLVertex3 GetTranslation () const
 
void SetTransform (const TGLMatrix &transform)
 
void SetTransform (const Double_t vals[16])
 
void SetTranslation (const TGLVertex3 &translation)
 
void Translate (const TGLVector3 &vect)
 
void Scale (const TGLVector3 &scale)
 
void Rotate (const TGLVertex3 &pivot, const TGLVector3 &axis, Double_t angle)
 
void InvokeContextMenu (TContextMenu &menu, UInt_t x, UInt_t y) const
 Request creation of context menu on shape, attached to 'menu' at screen position 'x' 'y'. More...
 

Private Member Functions

 TGLPhysicalShape (const TGLPhysicalShape &)
 
TGLPhysicalShapeoperator= (const TGLPhysicalShape &)
 
void UpdateBoundingBox ()
 cache More...
 
void InitColor (const Float_t rgba[4])
 Initialise the colors, using basic RGBA diffuse material color supplied. More...
 

Private Attributes

const TGLLogicalShapefLogicalShape
 
TGLPhysicalShapefNextPhysical
 the associated logical shape More...
 
TGLPShapeReffFirstPSRef
 pointer to next replica More...
 
UInt_t fID
 pointer to first reference More...
 
TGLMatrix fTransform
 unique physical ID within containing scene More...
 
TGLBoundingBox fBoundingBox
 transform (placement) of physical instance More...
 
Float_t fColor [17]
 bounding box of the physical (transformed) More...
 
EManip fManip
 GL color array. More...
 
UChar_t fSelected
 permitted manipulation bitflags - see EManip More...
 
Bool_t fInvertedWind
 selected state More...
 
Bool_t fModified
 face winding TODO: can get directly from fTransform? More...
 
Bool_t fIsScaleForRnr
 has been modified - retain across scene rebuilds More...
 

Friends

class TGLLogicalShape
 

#include <TGLPhysicalShape.h>

+ Inheritance diagram for TGLPhysicalShape:
+ Collaboration diagram for TGLPhysicalShape:

Member Enumeration Documentation

Enumerator
kTranslateX 
kTranslateY 
kTranslateZ 
kTranslateAll 
kScaleX 
kScaleY 
kScaleZ 
kScaleAll 
kRotateX 
kRotateY 
kRotateZ 
kRotateAll 
kManipAll 

Definition at line 43 of file TGLPhysicalShape.h.

Constructor & Destructor Documentation

TGLPhysicalShape::TGLPhysicalShape ( const TGLPhysicalShape )
private
TGLPhysicalShape::TGLPhysicalShape ( UInt_t  ID,
const TGLLogicalShape logicalShape,
const TGLMatrix transform,
Bool_t  invertedWind,
const Float_t  rgba[4] 
)
TGLPhysicalShape::TGLPhysicalShape ( UInt_t  id,
const TGLLogicalShape logicalShape,
const double transform,
Bool_t  invertedWind,
const Float_t  rgba[4] 
)

Construct a physical shape using arguments:

  • id - unique drawable id.
  • logicalShape - bound logical shape
  • transform - 16 Double_t component transform for placement of logical drawing
  • invertedWind - use inverted face polygon winding?
  • rgba - basic four component (RGBA) diffuse color

Definition at line 95 of file TGLPhysicalShape.cxx.

TGLPhysicalShape::~TGLPhysicalShape ( )
virtual

Destroy the physical shape.

Definition at line 124 of file TGLPhysicalShape.cxx.

Member Function Documentation

void TGLPhysicalShape::AddReference ( TGLPShapeRef ref)

Add reference ref.

Definition at line 139 of file TGLPhysicalShape.cxx.

Referenced by TGLPShapeRef::SetPShape().

const TGLBoundingBox& TGLPhysicalShape::BoundingBox ( ) const
inline
void TGLPhysicalShape::CalculateShapeLOD ( TGLRnrCtx rnrCtx,
Float_t pixSize,
Short_t shapeLOD 
) const
virtual

Calculate shape-lod, suitable for use under projection defined by 'rnrCtx', taking account of which local axes of the shape support LOD adjustment, and the global 'sceneFlags' passed.

Returned shapeLOD component is from 0 (kLODPixel - lowest quality) to 100 (kLODHigh - highest quality).

Scene flags are not used. LOD quantization is not done. RnrCtx is not modified as this is called via lodification stage of rendering.

Definition at line 431 of file TGLPhysicalShape.cxx.

Referenced by TGLScene::UpdateSceneInfo().

const Float_t* TGLPhysicalShape::Color ( ) const
inline

Definition at line 115 of file TGLPhysicalShape.h.

Referenced by TH3GL::DirectDraw(), and TGLPShapeObjEditor::SetModel().

void TGLPhysicalShape::Draw ( TGLRnrCtx rnrCtx) const
virtual

Draw physical shape, using LOD flags, potential from display list cache.

Reimplemented in TGLClip.

Definition at line 338 of file TGLPhysicalShape.cxx.

Referenced by TGLViewer::DoSecondarySelect(), TGLClip::Draw(), and TGLScene::RenderElements().

const TGLLogicalShape* TGLPhysicalShape::GetLogical ( ) const
inline
EManip TGLPhysicalShape::GetManip ( ) const
inline
const TGLPhysicalShape* TGLPhysicalShape::GetNextPhysical ( ) const
inline

Definition at line 99 of file TGLPhysicalShape.h.

TGLVector3 TGLPhysicalShape::GetScale ( ) const
inline
UChar_t TGLPhysicalShape::GetSelected ( ) const
inline
TGLVertex3 TGLPhysicalShape::GetTranslation ( ) const
inline

Definition at line 149 of file TGLPhysicalShape.h.

Referenced by TGLPShapeObjEditor::SetModel().

UInt_t TGLPhysicalShape::ID ( ) const
inline
void TGLPhysicalShape::InitColor ( const Float_t  rgba[4])
private

Initialise the colors, using basic RGBA diffuse material color supplied.

Definition at line 207 of file TGLPhysicalShape.cxx.

Referenced by TGLPhysicalShape().

void TGLPhysicalShape::InvokeContextMenu ( TContextMenu menu,
UInt_t  x,
UInt_t  y 
) const

Request creation of context menu on shape, attached to 'menu' at screen position 'x' 'y'.

Definition at line 510 of file TGLPhysicalShape.cxx.

Referenced by TGLEventHandler::PopupContextMenu().

Bool_t TGLPhysicalShape::IsInvisible ( ) const
inline

Definition at line 117 of file TGLPhysicalShape.h.

Bool_t TGLPhysicalShape::IsModified ( ) const
inline

Definition at line 107 of file TGLPhysicalShape.h.

Bool_t TGLPhysicalShape::IsSelected ( ) const
inline

Definition at line 110 of file TGLPhysicalShape.h.

Bool_t TGLPhysicalShape::IsTransparent ( ) const
inline
void TGLPhysicalShape::Modified ( )

Call this after modifying the physical so that the information can be propagated to the object referencing it.

Definition at line 180 of file TGLPhysicalShape.cxx.

Referenced by TGLClip::Modified(), Rotate(), Scale(), SetColor(), SetDiffuseColor(), SetTransform(), SetTranslation(), and Translate().

TGLPhysicalShape& TGLPhysicalShape::operator= ( const TGLPhysicalShape )
private
void TGLPhysicalShape::QuantizeShapeLOD ( Short_t  shapeLOD,
Short_t  combiLOD,
Short_t quantLOD 
) const
virtual

Factor in scene/vierer LOD and Quantize ...

forward to logical shape.

Definition at line 501 of file TGLPhysicalShape.cxx.

void TGLPhysicalShape::RemoveReference ( TGLPShapeRef ref)

Remove reference ref.

Definition at line 150 of file TGLPhysicalShape.cxx.

Referenced by TGLPShapeRef::SetPShape().

void TGLPhysicalShape::Rotate ( const TGLVertex3 pivot,
const TGLVector3 axis,
Double_t  angle 
)
inline

Definition at line 199 of file TGLPhysicalShape.h.

Referenced by TGLRotateManip::HandleMotion().

void TGLPhysicalShape::Scale ( const TGLVector3 scale)
inline
void TGLPhysicalShape::Select ( UChar_t  select)
inline

Definition at line 112 of file TGLPhysicalShape.h.

Referenced by TEveSceneList::ProcessSceneChanges(), and TEveScene::Repaint().

void TGLPhysicalShape::SetColor ( const Float_t  color[17])

Set full color attributes - see OpenGL material documentation for full description.

0->3 diffuse, 4->7 ambient, 8->11 specular, 12->15 emission, 16 shininess

Definition at line 227 of file TGLPhysicalShape.cxx.

Referenced by TGLPShapeObjEditor::DoColorButton(), and SetColorOnFamily().

void TGLPhysicalShape::SetColorOnFamily ( const Float_t  color[17])

Set full color attributes to all physicals sharing the same logical with this object.

Definition at line 241 of file TGLPhysicalShape.cxx.

Referenced by TGLPShapeObjEditor::DoColorButton().

void TGLPhysicalShape::SetDiffuseColor ( const Float_t  rgba[4])

Set color from ROOT color index and transparency [0,100].

Definition at line 254 of file TGLPhysicalShape.cxx.

Referenced by TEveSceneList::ProcessSceneChanges(), TGLScene::UpdatePhysical(), and TGLScene::UpdatePhysioLogical().

void TGLPhysicalShape::SetDiffuseColor ( const UChar_t  rgba[4])

Set color from RGBA quadruplet.

Definition at line 264 of file TGLPhysicalShape.cxx.

void TGLPhysicalShape::SetDiffuseColor ( Color_t  ci,
UChar_t  transparency 
)

Set color from standard ROOT representation, that is color index.

  • transparency in range [0, 100].

Definition at line 275 of file TGLPhysicalShape.cxx.

void TGLPhysicalShape::SetManip ( EManip  manip)
inline

Definition at line 103 of file TGLPhysicalShape.h.

Referenced by TGLClipPlane::TGLClipPlane().

void TGLPhysicalShape::SetTransform ( const TGLMatrix transform)
inline
void TGLPhysicalShape::SetTransform ( const Double_t  vals[16])
inline

Definition at line 163 of file TGLPhysicalShape.h.

void TGLPhysicalShape::SetTranslation ( const TGLVertex3 translation)
inline

Definition at line 171 of file TGLPhysicalShape.h.

Referenced by TGLPShapeObjEditor::DoGeoButton().

void TGLPhysicalShape::SetupGLColors ( TGLRnrCtx rnrCtx,
const Float_t color = 0 
) const

Setup colors - avoid setting things not required for current draw flags.

Definition at line 292 of file TGLPhysicalShape.cxx.

Referenced by Draw().

void TGLPhysicalShape::Translate ( const TGLVector3 vect)
inline
void TGLPhysicalShape::UpdateBoundingBox ( )
private

cache

Update our internal bounding box (in global frame).

Definition at line 193 of file TGLPhysicalShape.cxx.

Referenced by Rotate(), Scale(), SetTransform(), SetTranslation(), TGLPhysicalShape(), Translate(), and TGLLogicalShape::UpdateBoundingBoxesOfPhysicals().

Friends And Related Function Documentation

friend class TGLLogicalShape
friend

Definition at line 35 of file TGLPhysicalShape.h.

Member Data Documentation

TGLBoundingBox TGLPhysicalShape::fBoundingBox
private

transform (placement) of physical instance

Definition at line 65 of file TGLPhysicalShape.h.

Referenced by BoundingBox(), Scale(), and UpdateBoundingBox().

Float_t TGLPhysicalShape::fColor[17]
private

bounding box of the physical (transformed)

Definition at line 66 of file TGLPhysicalShape.h.

Referenced by Color(), Draw(), InitColor(), SetColor(), SetDiffuseColor(), and SetupGLColors().

TGLPShapeRef* TGLPhysicalShape::fFirstPSRef
private

pointer to next replica

Definition at line 61 of file TGLPhysicalShape.h.

Referenced by AddReference(), Modified(), RemoveReference(), and ~TGLPhysicalShape().

UInt_t TGLPhysicalShape::fID
private

pointer to first reference

Definition at line 63 of file TGLPhysicalShape.h.

Referenced by ID().

Bool_t TGLPhysicalShape::fInvertedWind
private

selected state

Definition at line 69 of file TGLPhysicalShape.h.

Referenced by Draw().

Bool_t TGLPhysicalShape::fIsScaleForRnr
private

has been modified - retain across scene rebuilds

Definition at line 71 of file TGLPhysicalShape.h.

Referenced by Draw(), and UpdateBoundingBox().

const TGLLogicalShape* TGLPhysicalShape::fLogicalShape
private
EManip TGLPhysicalShape::fManip
private

GL color array.

Definition at line 67 of file TGLPhysicalShape.h.

Referenced by GetManip().

Bool_t TGLPhysicalShape::fModified
private

face winding TODO: can get directly from fTransform?

Definition at line 70 of file TGLPhysicalShape.h.

Referenced by IsModified(), and Modified().

TGLPhysicalShape* TGLPhysicalShape::fNextPhysical
private
UChar_t TGLPhysicalShape::fSelected
private

permitted manipulation bitflags - see EManip

Definition at line 68 of file TGLPhysicalShape.h.

Referenced by GetSelected().

TGLMatrix TGLPhysicalShape::fTransform
private

unique physical ID within containing scene

Definition at line 64 of file TGLPhysicalShape.h.

Referenced by Draw(), GetScale(), GetTranslation(), Rotate(), Scale(), SetTransform(), SetTranslation(), TGLPhysicalShape(), Translate(), and UpdateBoundingBox().


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