ROOT logo
ROOT » GRAF3D » GL » TGLPhysicalShape

class TGLPhysicalShape


 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.

Function Members (Methods)

public:
TGLPhysicalShape(const TGLPhysicalShape&)
TGLPhysicalShape(UInt_t ID, const TGLLogicalShape& logicalShape, const TGLMatrix& transform, Bool_t invertedWind, const Float_t* rgba)
TGLPhysicalShape(UInt_t ID, const TGLLogicalShape& logicalShape, const double* transform, Bool_t invertedWind, const Float_t* rgba)
virtual~TGLPhysicalShape()
voidAddReference(TGLPShapeRef* ref)
const TGLBoundingBox&BoundingBox() const
virtual voidCalculateShapeLOD(TGLRnrCtx& rnrCtx, Float_t& pixSize, Short_t& shapeLOD) const
static TClass*Class()
const Float_t*Color() const
virtual voidDraw(TGLRnrCtx& rnrCtx) const
const TGLLogicalShape*GetLogical() const
TGLPhysicalShape::EManipGetManip() const
const TGLPhysicalShape*GetNextPhysical() const
TGLVector3GetScale() const
UChar_tGetSelected() const
TGLVertex3GetTranslation() const
UInt_tID() const
voidInvokeContextMenu(TContextMenu& menu, UInt_t x, UInt_t y) const
virtual TClass*IsA() const
Bool_tIsInvisible() const
Bool_tIsModified() const
Bool_tIsSelected() const
Bool_tIsTransparent() const
voidModified()
virtual voidQuantizeShapeLOD(Short_t shapeLOD, Short_t combiLOD, Short_t& quantLOD) const
voidRemoveReference(TGLPShapeRef* ref)
voidRotate(const TGLVertex3& pivot, const TGLVector3& axis, Double_t angle)
voidScale(const TGLVector3& scale)
voidSelect(UChar_t select)
voidSetColor(const Float_t* rgba)
voidSetColorOnFamily(const Float_t* rgba)
voidSetDiffuseColor(const Float_t* rgba)
voidSetDiffuseColor(const UChar_t* rgba)
voidSetDiffuseColor(Color_t ci, UChar_t transparency)
voidSetManip(TGLPhysicalShape::EManip manip)
voidSetTransform(const TGLMatrix& transform)
voidSetTransform(const Double_t* vals)
voidSetTranslation(const TGLVertex3& translation)
voidSetupGLColors(TGLRnrCtx& rnrCtx, const Float_t* color = 0) const
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
voidTranslate(const TGLVector3& vect)
private:
voidInitColor(const Float_t* rgba)
voidUpdateBoundingBox()

Data Members

private:
enum EManip { kTranslateX
kTranslateY
kTranslateZ
kTranslateAll
kScaleX
kScaleY
kScaleZ
kScaleAll
kRotateX
kRotateY
kRotateZ
kRotateAll
kManipAll
};
private:
TGLBoundingBoxfBoundingBox! bounding box of the physical (transformed)
Float_tfColor[17]! GL color array
TGLPShapeRef*fFirstPSRef! pointer to first reference
UInt_tfID! unique physical ID within containing scene
Bool_tfInvertedWind! face winding TODO: can get directly from fTransform?
const TGLLogicalShape*fLogicalShape! the associated logical shape
TGLPhysicalShape::EManipfManip! permitted manipulation bitflags - see EManip
Bool_tfModified! has been modified - retain across scene rebuilds
TGLPhysicalShape*fNextPhysical! pointer to next replica
UChar_tfSelected! selected state
TGLMatrixfTransform! transform (placement) of physical instance

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

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
TGLPhysicalShape(UInt_t id, const TGLLogicalShape & logicalShape, const Double_t * 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
~TGLPhysicalShape()
 Destroy the physical shape.
void AddReference(TGLPShapeRef* ref)
 Add reference ref.
void RemoveReference(TGLPShapeRef* ref)
 Remove reference ref.
void Modified()
 Call this after modifying the physical so that the information
 can be propagated to the object referencing it.
void UpdateBoundingBox()
 Update our internal bounding box (in global frame).
void InitColor(const Float_t* rgba)
 Initialise the colors, using basic RGBA diffuse material color supplied
void SetColor(const Float_t* rgba)
 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
void SetColorOnFamily(const Float_t* rgba)
 Set full color attributes to all physicals sharing the same
 logical with this object.
void SetDiffuseColor(const Float_t rgba[4])
 Set color from ROOT color index and transparency [0,100].
void SetDiffuseColor(const UChar_t rgba[4])
 Set color from RGBA quadruplet.
void SetDiffuseColor(Color_t ci, UChar_t transparency)
 Set color from standard ROOT representation, that is color index
 + transparency in range [0, 100].
void SetupGLColors(TGLRnrCtx& rnrCtx, const Float_t* color = 0) const
 Setup colors - avoid setting things not required
 for current draw flags.
void Draw(TGLRnrCtx& rnrCtx) const
 Draw physical shape, using LOD flags, potential from display list cache
void CalculateShapeLOD(TGLRnrCtx& rnrCtx, Float_t& pixSize, Short_t& shapeLOD) const
 Calculate shape-lod, suitible 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.
void QuantizeShapeLOD(Short_t shapeLOD, Short_t combiLOD, Short_t& quantLOD) const
 Factor in scene/vierer LOD and Quantize ... forward to
 logical shape.
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'
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)
TGLPhysicalShape(UInt_t ID, const TGLLogicalShape & logicalShape, const TGLMatrix & transform, Bool_t invertedWind, const Float_t rgba[4])
UInt_t ID() const
{ return fID; }
const TGLLogicalShape * GetLogical() const
{ return fLogicalShape; }
const TGLPhysicalShape * GetNextPhysical() const
{ return fNextPhysical; }
EManip GetManip() const
 Modification and manipulation
{ return fManip; }
void SetManip(TGLPhysicalShape::EManip manip)
{ fManip = manip; }
Bool_t IsModified() const
{ return fModified; }
Bool_t IsSelected() const
 Selection
{ return fSelected != 0; }
UChar_t GetSelected() const
{ return fSelected; }
void Select(UChar_t select)
{ fSelected = select; }
const Float_t * Color() const
{ return fColor; }
Bool_t IsTransparent() const
{ return fColor[3] < 1.f; }
Bool_t IsInvisible() const
{ return fColor[3] == 0.f; }