69 fLogicalShape (&logicalShape),
73 fTransform (transform),
76 fInvertedWind (invertedWind),
78 fIsScaleForRnr(kFALSE)
80 fLogicalShape->AddRef(
this);
98 fLogicalShape (&logicalShape),
102 fTransform (transform),
105 fInvertedWind (invertedWind),
172 Error(
"TGLPhysicalShape::RemoveReference",
"Attempt to un-ref an unregistered shape-ref.");
230 for (
UInt_t i = 0; i < 17; i++) {
256 for (
Int_t i=0; i<4; ++i)
266 for (
Int_t i=0; i<4; ++i)
283 fColor[3] = 1.0f - 0.01*transparency;
294 if (color == 0) color =
fColor;
312 glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, color);
313 glMaterialfv(GL_FRONT, GL_AMBIENT, color + 4);
314 glMaterialfv(GL_FRONT, GL_SPECULAR, color + 8);
315 glMaterialfv(GL_FRONT, GL_EMISSION, color + 12);
316 glMaterialf(GL_FRONT, GL_SHININESS, color[16]);
342 Info(
"TGLPhysicalShape::Draw",
"this %ld (class %s) LOD %d",
361 Info(
"TGLPhysicalShape::Draw",
"this %ld (class %s) LOD %d",
371 glPushAttrib(GL_LIGHTING_BIT | GL_DEPTH_BUFFER_BIT);
373 glDisable(GL_LIGHTING);
374 glDisable(GL_DEPTH_TEST);
378 static const Int_t offsets[20][2] =
379 { {-1,-1}, { 1,-1}, { 1, 1}, {-1, 1},
380 { 1, 0}, { 0, 1}, {-1, 0}, { 0,-1},
381 { 0,-2}, { 2, 0}, { 0, 2}, {-2, 0},
382 {-2,-2}, { 2,-2}, { 2, 2}, {-2, 2},
383 { 0,-3}, { 3, 0}, { 0, 3}, {-3, 0} };
384 static const Int_t max_off =
389 for (
int i = 0; i < max_off; ++i)
391 glViewport(vp.
X() + offsets[i][0], vp.
Y() + offsets[i][1], vp.
Width(), vp.
Height());
445 std::vector <Double_t> boxViewportDiags;
471 Error(
"TGLPhysicalShape::CalcPhysicalLOD",
"LOD calculation for single axis not implemented presently");
478 for (
UInt_t i = 0; i < boxViewportDiags.size(); i++) {
479 if (boxViewportDiags[i] > largestDiagonal) {
480 largestDiagonal = boxViewportDiags[i];
483 pixSize = largestDiagonal;
485 if (largestDiagonal <= 1.0) {
492 if (lodApp > 1000) lodApp = 1000;
TGLScene * GetScene() const
The TGLRnrCtx class aggregates data for a given redering context as needed by various parts of the RO...
TGLRect ViewportRect(const TGLBoundingBox &box, TGLBoundingBox::EFace face) const
Calculate viewport rectangle which just contains projection of single 'face' of world frame bounding ...
Abstract base camera class - concrete classes for orthographic and perspective cameras derive from it...
Bool_t HighlightOutline() const
void SetColorOnFamily(const Float_t rgba[17])
Set full color attributes to all physicals sharing the same logical with this object.
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'...
void Set(const TGLVertex3 vertex[8])
Set a bounding box from provided 8 vertices.
Bool_t IsScalingForRender() const
Return true if matrix is to be considered a scaling matrix for rendering.
16 component (4x4) transform matrix - column MAJOR as per GL.
virtual ~TGLPhysicalShape()
Destroy the physical shape.
const TGLBoundingBox & BoundingBox() const
Bool_t fModified
face winding TODO: can get directly from fTransform?
static Float_t GetScreenScalingFactor()
Returns scaling factor between screen points and GL viewport pixels.
void Transpose3x3()
Transpose the top left 3x3 matrix component along major diagonal Supported as currently incompatibili...
void UpdateBoundingBox()
cache
void AddRef(TGLPhysicalShape *phys) const
Add reference to given physical shape.
void Modified()
Call this after modifying the physical so that the information can be propagated to the object refere...
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Bool_t fInvertedWind
selected state
const TGLLogicalShape * fLogicalShape
virtual Short_t QuantizeShapeLOD(Short_t shapeLOD, Short_t combiLOD) const
Logical shapes usually support only discreet LOD values, especially in view of display-list caching...
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 l...
TGLViewer::ECameraType camera
Concrete physical shape - a GL drawable.
void SubRef(TGLPhysicalShape *phys) const
Remove reference to given physical shape, potentially deleting this object when hitting zero ref-coun...
void InitColor(const Float_t rgba[4])
Initialise the colors, using basic RGBA diffuse material color supplied.
TGLBoundingBox fBoundingBox
transform (placement) of physical instance
void SetColor(const Float_t rgba[17])
Set full color attributes - see OpenGL material documentation for full description.
virtual void Draw(TGLRnrCtx &rnrCtx) const
Draw physical shape, using LOD flags, potential from display list cache.
void Transform(const TGLMatrix &matrix)
Transform all vertices with matrix.
virtual ELODAxes SupportedLODAxes() const
double pow(double, double)
void Info(const char *location, const char *msgfmt,...)
Viewport (pixel base) 2D rectangle class.
static UInt_t LockColor()
Prevent further color changes.
static UInt_t UnlockColor()
Allow color changes.
void Error(const char *location, const char *msgfmt,...)
virtual void QuantizeShapeLOD(Short_t shapeLOD, Short_t combiLOD, Short_t &quantLOD) const
Factor in scene/vierer LOD and Quantize ...
const TGLPhysicalShape * GetFirstPhysical() const
TGLPhysicalShape * fNextPhysical
the associated logical shape
virtual void Draw(TGLRnrCtx &rnrCtx) const
Draw the GL drawable, using draw flags.
virtual void PShapeModified()
This is called from physical shape when it is modified.
Bool_t IsDrawPassOutlineLine() const
void InvokeContextMenu(TContextMenu &menu, UInt_t x, UInt_t y) const
Invoke popup menu or our bound external TObject (if any), using passed 'menu' object, at location 'x' 'y'.
Base class for references to TGLPysicalShape that need to be notified when the shape is destroyed...
void InvalidateBoundingBox()
Abstract logical shape - a GL 'drawable' - base for all shapes - faceset sphere etc.
Bool_t fIsScaleForRnr
has been modified - retain across scene rebuilds
virtual void SetPShape(TGLPhysicalShape *shape)
Set the shape.
void AddReference(TGLPShapeRef *ref)
Add reference ref.
TGLPhysicalShape(const TGLPhysicalShape &)
Float_t fColor[17]
bounding box of the physical (transformed)
The color creation and management class.
TGLMatrix fTransform
unique physical ID within containing scene
Concrete class describing an orientated (free) or axis aligned box of 8 vertices. ...
Int_t Diagonal() const
Return the diagonal of the rectangle.
void RemoveReference(TGLPShapeRef *ref)
Remove reference ref.
const TGLBoundingBox & BoundingBox() const
void SetupGLColors(TGLRnrCtx &rnrCtx, const Float_t *color=0) const
Setup colors - avoid setting things not required for current draw flags.
TGLColorSet & ColorSet()
Return reference to current color-set (top of the stack).
TGLPShapeRef * fNextPSRef
TGLPShapeRef * fFirstPSRef
pointer to next replica
static void ColorAlpha(const TGLColor &color, UChar_t alpha)
Set color from TGLColor and alpha value.
const Double_t * CArr() const
ClassImp(TGLPhysicalShape) TGLPhysicalShape
Construct a physical shape using arguments:
void SetDiffuseColor(const Float_t rgba[4])
Set color from ROOT color index and transparency [0,100].
virtual void DrawHighlight(TGLRnrCtx &rnrCtx, const TGLPhysicalShape *pshp, Int_t lvl=-1) const
Draw the logical shape in highlight mode.