80 fGeoFrame(0),fGeoApplyButton(0),
82 fRedSlider(0), fGreenSlider(0), fBlueSlider(0), fAlphaSlider(0), fShineSlider(0),
83 fColorApplyButton(0), fColorApplyFamily(0),
224 this,
"GeoValueSet(Long_t)");
233 this,
"GeoValueSet(Long_t)");
241 this,
"GeoValueSet(Long_t)");
254 this,
"GeoValueSet(Long_t)");
262 this,
"GeoValueSet(Long_t)");
270 this,
"GeoValueSet(Long_t)");
294 for (
Int_t i = 0; i < 17; ++i)
fRGBA[i] = rgba[i];
433 fRedSlider->
Connect(
"PositionChanged(Int_t)",
"TGLPShapeObjEditor",
this,
"DoColorSlider(Int_t)");
441 fGreenSlider->
Connect(
"PositionChanged(Int_t)",
"TGLPShapeObjEditor",
this,
"DoColorSlider(Int_t)");
449 fBlueSlider->
Connect(
"PositionChanged(Int_t)",
"TGLPShapeObjEditor",
this,
"DoColorSlider(Int_t)");
456 fShineSlider->
Connect(
"PositionChanged(Int_t)",
"TGLPShapeObjEditor",
this,
"DoColorSlider(Int_t)");
487 GLUquadric *GetQuadric()
494 fQuad = gluNewQuadric();
496 Error(
"GetQuadric::Init",
"could not create quadric object");
498 gluQuadricOrientation(fQuad, (GLenum)GLU_OUTSIDE);
499 gluQuadricDrawStyle(fQuad, (GLenum)GLU_FILL);
500 gluQuadricNormals(fQuad, (GLenum)GLU_FLAT);
506 gluDeleteQuadric(fQuad);
511 return singleton.fQuad;
522 gROOT->ProcessLineFast(
Form(
"((TGLPShapeObjEditor *)0x%lx)->DrawSphere()", (
ULong_t)
this));
530 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
532 glEnable(GL_LIGHTING);
534 glEnable(GL_DEPTH_TEST);
535 glEnable(GL_CULL_FACE);
537 glMatrixMode(GL_PROJECTION);
539 glFrustum(-0.5, 0.5, -0.5, 0.5, 1., 10.);
540 glMatrixMode(GL_MODELVIEW);
542 Float_t ligPos[] = {0.f, 0.f, 0.f, 1.f};
543 glLightfv(GL_LIGHT0, GL_POSITION, ligPos);
544 glTranslated(0., 0., -3.);
546 const Float_t whiteColor[] = {1.f, 1.f, 1.f, 1.f};
547 const Float_t nullColor[] = {0.f, 0.f, 0.f, 1.f};
550 glLightfv(GL_LIGHT0, GL_DIFFUSE,
fRGBA);
551 glLightfv(GL_LIGHT0, GL_AMBIENT,
fRGBA + 4);
552 glLightfv(GL_LIGHT0, GL_SPECULAR,
fRGBA + 8);
553 glMaterialfv(GL_FRONT, GL_DIFFUSE, whiteColor);
554 glMaterialfv(GL_FRONT, GL_AMBIENT, nullColor);
555 glMaterialfv(GL_FRONT, GL_SPECULAR, whiteColor);
556 glMaterialfv(GL_FRONT, GL_EMISSION, nullColor);
557 glMaterialf(GL_FRONT, GL_SHININESS, 60.
f);
559 glLightfv(GL_LIGHT0, GL_DIFFUSE, whiteColor);
560 glLightfv(GL_LIGHT0, GL_AMBIENT, nullColor);
561 glLightfv(GL_LIGHT0, GL_SPECULAR, whiteColor);
562 glMaterialfv(GL_FRONT, GL_DIFFUSE,
fRGBA);
563 glMaterialfv(GL_FRONT, GL_AMBIENT,
fRGBA + 4);
564 glMaterialfv(GL_FRONT, GL_SPECULAR,
fRGBA + 8);
565 glMaterialfv(GL_FRONT, GL_EMISSION,
fRGBA + 12);
566 glMaterialf(GL_FRONT, GL_SHININESS,
fRGBA[16]);
570 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
571 GLUquadric * quad = GetQuadric();
573 glRotated(-90., 1., 0., 0.);
574 gluSphere(quad, 1., 100, 100);
TGButton * fGeoApplyButton
virtual TVirtualPad * GetPad() const
virtual void PShapeModified()
Shape has been modified.
void SetColorOnFamily(const Float_t rgba[17])
Set full color attributes to all physicals sharing the same logical with this object.
Wrap TGLPysicalShape into TObject so that it can be edited using GED.
virtual void SetRange(Int_t min, Int_t max)
GUI editor for TGLPShapeObj.
R__EXTERN void * gTQSender
image html pict1_TGaxis_012 png width
Define new text attributes for the label number "labNum".
virtual void SetNumber(Double_t val)
virtual void SetLayoutManager(TGLayoutManager *l)
Set the layout manager for the composite frame.
R__EXTERN TVirtualMutex * gROOTMutex
TGLPShapeObj * fPShapeObj
virtual void SetLimits(ELimit limits=TGNumberFormat::kNELNoLimits, Double_t min=0, Double_t max=1)
virtual void DoRedraw()
Redraw widget. Render sphere and pass to base-class.
TGCompositeFrame * fGeoFrame
TGButton * fLightTypes[4]
virtual void SetPShape(TGLPhysicalShape *shape)
Shape has changed.
Concrete physical shape - a GL drawable.
virtual void DoRedraw()
Redraw the frame.
virtual void SetTitlePos(ETitlePos pos=kLeft)
virtual TObject * GetModel() const
void SetColor(const Float_t rgba[17])
Set full color attributes - see OpenGL material documentation for full description.
3 component (x/y/z) vertex class.
void Init(TClassEdit::TInterpreterLookupHelper *helper)
TGButton * fColorApplyButton
virtual TGVerticalFrame * CreateEditorTabSubFrame(const char *name)
Create a vertical frame to be used by 'owner' in extra tab 'name'.
TGLVector3 GetScale() const
void CreateColorControls()
Create widgets to chose colors component and its RGBA values on fGedEditor model or family it belongs...
virtual void SetModel(TObject *obj)
Sets model or disables/hides viewer.
3 component (x/y/z) vector class.
const Float_t * Color() const
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 SetScale(const Double_t *scale)
Set internal scale data from 3 component 'c'.
TGButton * fColorApplyFamily
TGLPhysicalShape * fPShape
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...
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...
void SetRGBA(const Float_t *rgba)
Set color sliders from 17 component 'rgba'.
void DoColorButton()
Process button action.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
char * Form(const char *fmt,...)
virtual void SetPosition(Int_t pos)
TGCompositeFrame * fColorFrame
TGLPShapeObjEditor(const TGWindow *p=0, Int_t width=140, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
Constructor of TGLPhysicalShape editor GUI.
void DrawSphere() const
Draw local sphere reflecting current color options.
TGNumberEntry * fGeomData[6]
TGLVertex3 GetTranslation() const
void SetCenter(const Double_t *center)
Set internal center data from 3 component 'c'.
void Scale(const TGLVector3 &scale)
virtual void SetPShape(TGLPhysicalShape *shape)
Set the shape.
virtual Double_t GetNumber() const
void CreateGeoControls()
Create GUI for setting scale and position.
void CreateColorSliders()
Create GUI for setting light color.
void DoGeoButton()
Process 'Apply' - update the viewer object from GUI.
static constexpr double s
#define R__LOCKGUARD(mutex)
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
virtual void SetModel(TVirtualPad *pad, TObject *obj, Int_t event, Bool_t force=kFALSE)
Activate object editors according to the selected object.
TGLPhysicalShape * fPShape
Mother of all ROOT objects.
const Double_t * CArr() const
void GeoValueSet(Long_t unusedVal)
Process setting of value in edit box - activate 'Apply' button.
void SetTranslation(const TGLVertex3 &translation)
~TGLPShapeObjEditor()
Destroy color editor GUI component.
void SetColorSlidersPos()
Update GUI sliders from internal data.
void DoColorSlider(Int_t val)
Process slider movement.
const Float_t * GetRGBA() const
void CreateColorRadioButtons()
Create Diffuse/Ambient/Specular/Emissive radio buttons and sub-frames.