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 31 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 double *transform, Bool_t invertedWind, const Float_t rgba[4]) | |
Construct a physical shape using arguments: More... | |
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... | |
virtual | ~TGLPhysicalShape () |
Destroy the physical shape. More... | |
void | AddReference (TGLPShapeRef *ref) |
Add reference ref. More... | |
const TGLBoundingBox & | BoundingBox () 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_t * | Color () const |
virtual void | Draw (TGLRnrCtx &rnrCtx) const |
Draw physical shape, using LOD flags, potential from display list cache. More... | |
const TGLLogicalShape * | GetLogical () const |
EManip | GetManip () const |
const TGLPhysicalShape * | GetNextPhysical () 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 ... forward to logical shape. 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 (Color_t ci, UChar_t transparency) |
Set color from standard ROOT representation, that is color index. 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 | SetManip (EManip manip) |
void | SetTransform (const Double_t vals[16]) |
void | SetTransform (const TGLMatrix &transform) |
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... | |
TGLPhysicalShape & | operator= (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... | |
TGLPShapeRef * | fFirstPSRef |
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 TGLLogicalShape * | fLogicalShape |
EManip | fManip |
GL color array. More... | |
Bool_t | fModified |
face winding TODO: can get directly from fTransform? More... | |
TGLPhysicalShape * | fNextPhysical |
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>
Enumerator | |
---|---|
kTranslateX | |
kTranslateY | |
kTranslateZ | |
kTranslateAll | |
kScaleX | |
kScaleY | |
kScaleZ | |
kScaleAll | |
kRotateX | |
kRotateY | |
kRotateZ | |
kRotateAll | |
kManipAll |
Definition at line 41 of file TGLPhysicalShape.h.
|
private |
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:
Definition at line 66 of file TGLPhysicalShape.cxx.
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:
Definition at line 95 of file TGLPhysicalShape.cxx.
|
virtual |
Destroy the physical shape.
Definition at line 124 of file TGLPhysicalShape.cxx.
void TGLPhysicalShape::AddReference | ( | TGLPShapeRef * | ref | ) |
Add reference ref.
Definition at line 139 of file TGLPhysicalShape.cxx.
|
inline |
Definition at line 88 of file TGLPhysicalShape.h.
|
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.
|
inline |
Definition at line 113 of file TGLPhysicalShape.h.
Draw physical shape, using LOD flags, potential from display list cache.
Reimplemented in TGLClip.
Definition at line 338 of file TGLPhysicalShape.cxx.
|
inline |
Definition at line 96 of file TGLPhysicalShape.h.
|
inline |
Definition at line 100 of file TGLPhysicalShape.h.
|
inline |
Definition at line 97 of file TGLPhysicalShape.h.
|
inline |
Definition at line 141 of file TGLPhysicalShape.h.
|
inline |
Definition at line 109 of file TGLPhysicalShape.h.
|
inline |
Definition at line 147 of file TGLPhysicalShape.h.
|
inline |
Definition at line 87 of file TGLPhysicalShape.h.
Initialise the colors, using basic RGBA diffuse material color supplied.
Definition at line 207 of file TGLPhysicalShape.cxx.
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.
|
inline |
Definition at line 115 of file TGLPhysicalShape.h.
|
inline |
Definition at line 105 of file TGLPhysicalShape.h.
|
inline |
Definition at line 108 of file TGLPhysicalShape.h.
|
inline |
Definition at line 114 of file TGLPhysicalShape.h.
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.
|
private |
|
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.
|
inline |
Definition at line 197 of file TGLPhysicalShape.h.
|
inline |
Definition at line 185 of file TGLPhysicalShape.h.
Definition at line 110 of file TGLPhysicalShape.h.
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.
Set full color attributes to all physicals sharing the same logical with this object.
Definition at line 241 of file TGLPhysicalShape.cxx.
Set color from standard ROOT representation, that is color index.
Definition at line 275 of file TGLPhysicalShape.cxx.
Set color from ROOT color index and transparency [0,100].
Definition at line 254 of file TGLPhysicalShape.cxx.
Set color from RGBA quadruplet.
Definition at line 264 of file TGLPhysicalShape.cxx.
Definition at line 101 of file TGLPhysicalShape.h.
Definition at line 161 of file TGLPhysicalShape.h.
Definition at line 153 of file TGLPhysicalShape.h.
|
inline |
Definition at line 169 of file TGLPhysicalShape.h.
Setup colors - avoid setting things not required for current draw flags.
Definition at line 292 of file TGLPhysicalShape.cxx.
|
inline |
Definition at line 177 of file TGLPhysicalShape.h.
|
private |
cache
Update our internal bounding box (in global frame).
Definition at line 193 of file TGLPhysicalShape.cxx.
|
friend |
Definition at line 33 of file TGLPhysicalShape.h.
|
private |
transform (placement) of physical instance
Definition at line 63 of file TGLPhysicalShape.h.
|
private |
bounding box of the physical (transformed)
Definition at line 64 of file TGLPhysicalShape.h.
|
private |
pointer to next replica
Definition at line 59 of file TGLPhysicalShape.h.
|
private |
pointer to first reference
Definition at line 61 of file TGLPhysicalShape.h.
|
private |
selected state
Definition at line 67 of file TGLPhysicalShape.h.
|
private |
has been modified - retain across scene rebuilds
Definition at line 69 of file TGLPhysicalShape.h.
|
private |
Definition at line 57 of file TGLPhysicalShape.h.
|
private |
GL color array.
Definition at line 65 of file TGLPhysicalShape.h.
|
private |
face winding TODO: can get directly from fTransform?
Definition at line 68 of file TGLPhysicalShape.h.
|
private |
the associated logical shape
Definition at line 58 of file TGLPhysicalShape.h.
|
private |
permitted manipulation bitflags - see EManip
Definition at line 66 of file TGLPhysicalShape.h.
|
private |
unique physical ID within containing scene
Definition at line 62 of file TGLPhysicalShape.h.