25#include "TGLIncludes.h"
75 fGeoFrame(0),fGeoApplyButton(0),
77 fRedSlider(0), fGreenSlider(0), fBlueSlider(0), fAlphaSlider(0), fShineSlider(0),
78 fColorApplyButton(0), fColorApplyFamily(0),
219 this,
"GeoValueSet(Long_t)");
228 this,
"GeoValueSet(Long_t)");
236 this,
"GeoValueSet(Long_t)");
249 this,
"GeoValueSet(Long_t)");
257 this,
"GeoValueSet(Long_t)");
265 this,
"GeoValueSet(Long_t)");
289 for (
Int_t i = 0; i < 17; ++i)
fRGBA[i] = rgba[i];
428 fRedSlider->
Connect(
"PositionChanged(Int_t)",
"TGLPShapeObjEditor",
this,
"DoColorSlider(Int_t)");
436 fGreenSlider->
Connect(
"PositionChanged(Int_t)",
"TGLPShapeObjEditor",
this,
"DoColorSlider(Int_t)");
444 fBlueSlider->
Connect(
"PositionChanged(Int_t)",
"TGLPShapeObjEditor",
this,
"DoColorSlider(Int_t)");
451 fShineSlider->
Connect(
"PositionChanged(Int_t)",
"TGLPShapeObjEditor",
this,
"DoColorSlider(Int_t)");
466 if (
fRGBA[16] >= 0.f)
482 GLUquadric *GetQuadric()
489 fQuad = gluNewQuadric();
491 Error(
"GetQuadric::Init",
"could not create quadric object");
501 gluDeleteQuadric(fQuad);
506 return singleton.fQuad;
517 gROOT->ProcessLineFast(
Form(
"((TGLPShapeObjEditor *)0x%zx)->DrawSphere()", (
size_t)
this));
525 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
527 glEnable(GL_LIGHTING);
529 glEnable(GL_DEPTH_TEST);
530 glEnable(GL_CULL_FACE);
532 glMatrixMode(GL_PROJECTION);
534 glFrustum(-0.5, 0.5, -0.5, 0.5, 1., 10.);
535 glMatrixMode(GL_MODELVIEW);
537 Float_t ligPos[] = {0.f, 0.f, 0.f, 1.f};
538 glLightfv(GL_LIGHT0, GL_POSITION, ligPos);
539 glTranslated(0., 0., -3.);
541 const Float_t whiteColor[] = {1.f, 1.f, 1.f, 1.f};
542 const Float_t nullColor[] = {0.f, 0.f, 0.f, 1.f};
544 if (
fRGBA[16] < 0.f) {
545 glLightfv(GL_LIGHT0, GL_DIFFUSE,
fRGBA);
546 glLightfv(GL_LIGHT0, GL_AMBIENT,
fRGBA + 4);
547 glLightfv(GL_LIGHT0, GL_SPECULAR,
fRGBA + 8);
548 glMaterialfv(GL_FRONT, GL_DIFFUSE, whiteColor);
549 glMaterialfv(GL_FRONT, GL_AMBIENT, nullColor);
550 glMaterialfv(GL_FRONT, GL_SPECULAR, whiteColor);
551 glMaterialfv(GL_FRONT, GL_EMISSION, nullColor);
552 glMaterialf(GL_FRONT, GL_SHININESS, 60.f);
554 glLightfv(GL_LIGHT0, GL_DIFFUSE, whiteColor);
555 glLightfv(GL_LIGHT0, GL_AMBIENT, nullColor);
556 glLightfv(GL_LIGHT0, GL_SPECULAR, whiteColor);
557 glMaterialfv(GL_FRONT, GL_DIFFUSE,
fRGBA);
558 glMaterialfv(GL_FRONT, GL_AMBIENT,
fRGBA + 4);
559 glMaterialfv(GL_FRONT, GL_SPECULAR,
fRGBA + 8);
560 glMaterialfv(GL_FRONT, GL_EMISSION,
fRGBA + 12);
561 glMaterialf(GL_FRONT, GL_SHININESS,
fRGBA[16]);
565 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
566 GLUquadric * quad = GetQuadric();
568 glRotated(-90., 1., 0., 0.);
569 gluSphere(quad, 1., 100, 100);
ULong_t Pixel_t
Pixel value.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize wid
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
R__EXTERN void * gTQSender
R__EXTERN TVirtualMutex * gROOTMutex
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
#define R__LOCKGUARD(mutex)
virtual void SetLayoutManager(TGLayoutManager *l)
Set the layout manager for the composite frame.
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
void DoRedraw() override
Redraw the frame.
A composite frame with a border and a title.
virtual void SetTitlePos(ETitlePos pos=kLeft)
Concrete class for horizontal slider.
A composite frame that layout their children in horizontal way.
GUI editor for TGLPShapeObj.
TGButton * fColorApplyFamily
void SetColorSlidersPos()
Update GUI sliders from internal data.
void PShapeModified() override
Shape has been modified.
void CreateColorSliders()
Create GUI for setting light color.
TGCompositeFrame * fColorFrame
TGButton * fLightTypes[4]
void CreateGeoControls()
Create GUI for setting scale and position.
TGNumberEntry * fGeomData[6]
void GeoValueSet(Long_t unusedVal)
Process setting of value in edit box - activate 'Apply' button.
void SetModel(TObject *obj) override
Sets model or disables/hides viewer.
TGButton * fGeoApplyButton
void SetScale(const Double_t *scale)
Set internal scale data from 3 component 'c'.
void DoRedraw() override
Redraw widget. Render sphere and pass to base-class.
TGLPShapeObj * fPShapeObj
TGButton * fColorApplyButton
TGLPShapeObjEditor(const TGWindow *p=nullptr, Int_t width=140, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Constructor of TGLPhysicalShape editor GUI.
void DoColorButton()
Process button action.
~TGLPShapeObjEditor() override
Destroy color editor GUI component.
void DrawSphere() const
Draw local sphere reflecting current color options.
void CreateColorControls()
Create widgets to chose colors component and its RGBA values on fGedEditor model or family it belongs...
TGCompositeFrame * fGeoFrame
const Float_t * GetRGBA() const
void SetRGBA(const Float_t *rgba)
Set color sliders from 17 component 'rgba'.
void SetPShape(TGLPhysicalShape *shape) override
Shape has changed.
void CreateColorRadioButtons()
Create Diffuse/Ambient/Specular/Emissive radio buttons and sub-frames.
void SetCenter(const Double_t *center)
Set internal center data from 3 component 'c'.
void DoGeoButton()
Process 'Apply' - update the viewer object from GUI.
void GetObjectData(Double_t *shift, Double_t *scale)
Extract the GUI object data, return center in 3 component 'center' scale in 3 component 'scale'.
void DoColorSlider(Int_t val)
Process slider movement.
Wrap TGLPysicalShape into TObject so that it can be edited using GED.
TGLPhysicalShape * fPShape
virtual void SetPShape(TGLPhysicalShape *shape)
Set the shape.
TGLPhysicalShape * fPShape
Concrete physical shape - a GL drawable.
void Scale(const TGLVector3 &scale)
const Float_t * Color() const
TGLVector3 GetScale() const
void SetColor(const Float_t rgba[17])
Set full color attributes - see OpenGL material documentation for full description.
TGLVertex3 GetTranslation() const
void SetColorOnFamily(const Float_t rgba[17])
Set full color attributes to all physicals sharing the same logical with this object.
void SetTranslation(const TGLVertex3 &translation)
3 component (x/y/z) vector class.
3 component (x/y/z) vertex class.
const Double_t * CArr() const
void RequestDraw(Short_t LOD=TGLRnrCtx::kLODMed)
Post request for redraw of viewer at level of detail 'LOD' Request is directed via cross thread gVirt...
This class handles GUI labels.
This class describes layout hints used by the layout classes.
This layout managers does not make use of TGLayoutHints.
TGNumberEntry is a number entry input widget with up/down buttons.
virtual void SetLimits(ELimit limits=TGNumberFormat::kNELNoLimits, Double_t min=0, Double_t max=1)
virtual Double_t GetNumber() const
virtual void SetNumber(Double_t val, Bool_t emit=kTRUE)
Slider widgets allow easy selection of a range.
virtual void SetPosition(Int_t pos)
Set slider position.
virtual void SetRange(Int_t min, Int_t max)
Set slider range.
Yield an action as soon as it is clicked.
ROOT GUI Window base class.
virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event, Bool_t force=kFALSE)
Activate object editors according to the selected object.
virtual TVirtualPad * GetPad() const
virtual TObject * GetModel() const
Base frame for implementing GUI - a service class.
TGedEditor * fGedEditor
manager of this frame
virtual TGVerticalFrame * CreateEditorTabSubFrame(const char *name)
Create a vertical frame to be used by 'owner' in extra tab 'name'.
Mother of all ROOT objects.
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.