Logo ROOT   6.08/07
Reference Guide
List of all members | 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])
 Construct a physical shape using arguments: More...
 
 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...
 
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...
 
const Float_tColor () const
 
virtual void Draw (TGLRnrCtx &rnrCtx) const
 Draw physical shape, using LOD flags, potential from display list cache. More...
 
const TGLLogicalShapeGetLogical () const
 
EManip GetManip () const
 
const TGLPhysicalShapeGetNextPhysical () const
 
TGLVector3 GetScale () const
 
UChar_t GetSelected () const
 
TGLVertex3 GetTranslation () const
 
UInt_t ID () const
 
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...
 
Bool_t IsInvisible () const
 
Bool_t IsModified () const
 
Bool_t IsSelected () const
 
Bool_t IsTransparent () const
 
void Modified ()
 Call this after modifying the physical so that the information can be propagated to the object referencing it. More...
 
virtual void QuantizeShapeLOD (Short_t shapeLOD, Short_t combiLOD, Short_t &quantLOD) const
 Factor in scene/vierer LOD and Quantize ... More...
 
void RemoveReference (TGLPShapeRef *ref)
 Remove reference ref. More...
 
void Rotate (const TGLVertex3 &pivot, const TGLVector3 &axis, Double_t angle)
 
void Scale (const TGLVector3 &scale)
 
void Select (UChar_t select)
 
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...
 
void SetManip (EManip manip)
 
void SetTransform (const TGLMatrix &transform)
 
void SetTransform (const Double_t vals[16])
 
void SetTranslation (const TGLVertex3 &translation)
 
void SetupGLColors (TGLRnrCtx &rnrCtx, const Float_t *color=0) const
 Setup colors - avoid setting things not required for current draw flags. More...
 
void Translate (const TGLVector3 &vect)
 

Private Member Functions

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

Private Attributes

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

Friends

class TGLLogicalShape
 

#include <TGLPhysicalShape.h>

Inheritance diagram for TGLPhysicalShape:
[legend]

Member Enumeration Documentation

◆ EManip

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() [1/3]

TGLPhysicalShape::TGLPhysicalShape ( const TGLPhysicalShape )
private

◆ TGLPhysicalShape() [2/3]

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

Construct a physical shape using arguments:

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

Definition at line 66 of file TGLPhysicalShape.cxx.

◆ TGLPhysicalShape() [3/3]

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::~TGLPhysicalShape ( )
virtual

Destroy the physical shape.

Definition at line 124 of file TGLPhysicalShape.cxx.

Member Function Documentation

◆ AddReference()

void TGLPhysicalShape::AddReference ( TGLPShapeRef ref)

Add reference ref.

Definition at line 139 of file TGLPhysicalShape.cxx.

◆ BoundingBox()

const TGLBoundingBox& TGLPhysicalShape::BoundingBox ( ) const
inline

Definition at line 90 of file TGLPhysicalShape.h.

◆ CalculateShapeLOD()

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.

◆ Color()

const Float_t* TGLPhysicalShape::Color ( ) const
inline

Definition at line 115 of file TGLPhysicalShape.h.

◆ Draw()

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.

◆ GetLogical()

const TGLLogicalShape* TGLPhysicalShape::GetLogical ( ) const
inline

Definition at line 98 of file TGLPhysicalShape.h.

◆ GetManip()

EManip TGLPhysicalShape::GetManip ( ) const
inline

Definition at line 102 of file TGLPhysicalShape.h.

◆ GetNextPhysical()

const TGLPhysicalShape* TGLPhysicalShape::GetNextPhysical ( ) const
inline

Definition at line 99 of file TGLPhysicalShape.h.

◆ GetScale()

TGLVector3 TGLPhysicalShape::GetScale ( ) const
inline

Definition at line 143 of file TGLPhysicalShape.h.

◆ GetSelected()

UChar_t TGLPhysicalShape::GetSelected ( ) const
inline

Definition at line 111 of file TGLPhysicalShape.h.

◆ GetTranslation()

TGLVertex3 TGLPhysicalShape::GetTranslation ( ) const
inline

Definition at line 149 of file TGLPhysicalShape.h.

◆ ID()

UInt_t TGLPhysicalShape::ID ( ) const
inline

Definition at line 89 of file TGLPhysicalShape.h.

◆ InitColor()

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.

◆ InvokeContextMenu()

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.

◆ IsInvisible()

Bool_t TGLPhysicalShape::IsInvisible ( ) const
inline

Definition at line 117 of file TGLPhysicalShape.h.

◆ IsModified()

Bool_t TGLPhysicalShape::IsModified ( ) const
inline

Definition at line 107 of file TGLPhysicalShape.h.

◆ IsSelected()

Bool_t TGLPhysicalShape::IsSelected ( ) const
inline

Definition at line 110 of file TGLPhysicalShape.h.

◆ IsTransparent()

Bool_t TGLPhysicalShape::IsTransparent ( ) const
inline

Definition at line 116 of file TGLPhysicalShape.h.

◆ Modified()

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.

◆ operator=()

TGLPhysicalShape& TGLPhysicalShape::operator= ( const TGLPhysicalShape )
private

◆ QuantizeShapeLOD()

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.

◆ RemoveReference()

void TGLPhysicalShape::RemoveReference ( TGLPShapeRef ref)

Remove reference ref.

Definition at line 150 of file TGLPhysicalShape.cxx.

◆ Rotate()

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

Definition at line 199 of file TGLPhysicalShape.h.

◆ Scale()

void TGLPhysicalShape::Scale ( const TGLVector3 scale)
inline

Definition at line 187 of file TGLPhysicalShape.h.

◆ Select()

void TGLPhysicalShape::Select ( UChar_t  select)
inline

Definition at line 112 of file TGLPhysicalShape.h.

◆ SetColor()

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.

◆ 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.

◆ SetDiffuseColor() [1/3]

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.

◆ SetDiffuseColor() [2/3]

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

Set color from RGBA quadruplet.

Definition at line 264 of file TGLPhysicalShape.cxx.

◆ SetDiffuseColor() [3/3]

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.

◆ SetManip()

void TGLPhysicalShape::SetManip ( EManip  manip)
inline

Definition at line 103 of file TGLPhysicalShape.h.

◆ SetTransform() [1/2]

void TGLPhysicalShape::SetTransform ( const TGLMatrix transform)
inline

Definition at line 155 of file TGLPhysicalShape.h.

◆ SetTransform() [2/2]

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

Definition at line 163 of file TGLPhysicalShape.h.

◆ SetTranslation()

void TGLPhysicalShape::SetTranslation ( const TGLVertex3 translation)
inline

Definition at line 171 of file TGLPhysicalShape.h.

◆ SetupGLColors()

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.

◆ Translate()

void TGLPhysicalShape::Translate ( const TGLVector3 vect)
inline

Definition at line 179 of file TGLPhysicalShape.h.

◆ UpdateBoundingBox()

void TGLPhysicalShape::UpdateBoundingBox ( )
private

cache

Update our internal bounding box (in global frame).

Definition at line 193 of file TGLPhysicalShape.cxx.

Friends And Related Function Documentation

◆ TGLLogicalShape

friend class TGLLogicalShape
friend

Definition at line 35 of file TGLPhysicalShape.h.

Member Data Documentation

◆ fBoundingBox

TGLBoundingBox TGLPhysicalShape::fBoundingBox
private

transform (placement) of physical instance

Definition at line 65 of file TGLPhysicalShape.h.

◆ fColor

Float_t TGLPhysicalShape::fColor[17]
private

bounding box of the physical (transformed)

Definition at line 66 of file TGLPhysicalShape.h.

◆ fFirstPSRef

TGLPShapeRef* TGLPhysicalShape::fFirstPSRef
private

pointer to next replica

Definition at line 61 of file TGLPhysicalShape.h.

◆ fID

UInt_t TGLPhysicalShape::fID
private

pointer to first reference

Definition at line 63 of file TGLPhysicalShape.h.

◆ fInvertedWind

Bool_t TGLPhysicalShape::fInvertedWind
private

selected state

Definition at line 69 of file TGLPhysicalShape.h.

◆ fIsScaleForRnr

Bool_t TGLPhysicalShape::fIsScaleForRnr
private

has been modified - retain across scene rebuilds

Definition at line 71 of file TGLPhysicalShape.h.

◆ fLogicalShape

const TGLLogicalShape* TGLPhysicalShape::fLogicalShape
private

Definition at line 59 of file TGLPhysicalShape.h.

◆ fManip

EManip TGLPhysicalShape::fManip
private

GL color array.

Definition at line 67 of file TGLPhysicalShape.h.

◆ fModified

Bool_t TGLPhysicalShape::fModified
private

face winding TODO: can get directly from fTransform?

Definition at line 70 of file TGLPhysicalShape.h.

◆ fNextPhysical

TGLPhysicalShape* TGLPhysicalShape::fNextPhysical
private

the associated logical shape

Definition at line 60 of file TGLPhysicalShape.h.

◆ fSelected

UChar_t TGLPhysicalShape::fSelected
private

permitted manipulation bitflags - see EManip

Definition at line 68 of file TGLPhysicalShape.h.

◆ fTransform

TGLMatrix TGLPhysicalShape::fTransform
private

unique physical ID within containing scene

Definition at line 64 of file TGLPhysicalShape.h.


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