25#include "TGLIncludes.h"
165 fPShape->SetTranslation(trans);
218 this,
"GeoValueSet(Long_t)");
227 this,
"GeoValueSet(Long_t)");
235 this,
"GeoValueSet(Long_t)");
248 this,
"GeoValueSet(Long_t)");
256 this,
"GeoValueSet(Long_t)");
264 this,
"GeoValueSet(Long_t)");
277 fGeoApplyButton->Connect(
"Pressed()",
"TGLPShapeObjEditor",
this,
"DoGeoButton()");
288 for (
Int_t i = 0; i < 17; ++i)
fRGBA[i] = rgba[i];
394 fLightTypes[
kDiffuse]->Connect(
"Pressed()",
"TGLPShapeObjEditor",
this,
"DoColorButton()");
399 fLightTypes[
kAmbient]->Connect(
"Pressed()",
"TGLPShapeObjEditor",
this,
"DoColorButton()");
427 fRedSlider->Connect(
"PositionChanged(Int_t)",
"TGLPShapeObjEditor",
this,
"DoColorSlider(Int_t)");
435 fGreenSlider->Connect(
"PositionChanged(Int_t)",
"TGLPShapeObjEditor",
this,
"DoColorSlider(Int_t)");
443 fBlueSlider->Connect(
"PositionChanged(Int_t)",
"TGLPShapeObjEditor",
this,
"DoColorSlider(Int_t)");
450 fShineSlider->Connect(
"PositionChanged(Int_t)",
"TGLPShapeObjEditor",
this,
"DoColorSlider(Int_t)");
465 if (
fRGBA[16] >= 0.f)
481 GLUquadric *GetQuadric()
488 fQuad = gluNewQuadric();
490 Error(
"GetQuadric::Init",
"could not create quadric object");
492 gluQuadricOrientation(fQuad, (GLenum)GLU_OUTSIDE);
493 gluQuadricDrawStyle(fQuad, (GLenum)GLU_FILL);
494 gluQuadricNormals(fQuad, (GLenum)GLU_FLAT);
500 gluDeleteQuadric(fQuad);
505 return singleton.fQuad;
516 gROOT->ProcessLineFast(
Form(
"((TGLPShapeObjEditor *)0x%zx)->DrawSphere()", (
size_t)
this));
524 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
526 glEnable(GL_LIGHTING);
528 glEnable(GL_DEPTH_TEST);
529 glEnable(GL_CULL_FACE);
531 glMatrixMode(GL_PROJECTION);
533 glFrustum(-0.5, 0.5, -0.5, 0.5, 1., 10.);
534 glMatrixMode(GL_MODELVIEW);
536 Float_t ligPos[] = {0.f, 0.f, 0.f, 1.f};
537 glLightfv(GL_LIGHT0, GL_POSITION, ligPos);
538 glTranslated(0., 0., -3.);
540 const Float_t whiteColor[] = {1.f, 1.f, 1.f, 1.f};
541 const Float_t nullColor[] = {0.f, 0.f, 0.f, 1.f};
543 if (
fRGBA[16] < 0.f) {
544 glLightfv(GL_LIGHT0, GL_DIFFUSE,
fRGBA);
545 glLightfv(GL_LIGHT0, GL_AMBIENT,
fRGBA + 4);
546 glLightfv(GL_LIGHT0, GL_SPECULAR,
fRGBA + 8);
547 glMaterialfv(GL_FRONT, GL_DIFFUSE, whiteColor);
548 glMaterialfv(GL_FRONT, GL_AMBIENT, nullColor);
549 glMaterialfv(GL_FRONT, GL_SPECULAR, whiteColor);
550 glMaterialfv(GL_FRONT, GL_EMISSION, nullColor);
551 glMaterialf(GL_FRONT, GL_SHININESS, 60.f);
553 glLightfv(GL_LIGHT0, GL_DIFFUSE, whiteColor);
554 glLightfv(GL_LIGHT0, GL_AMBIENT, nullColor);
555 glLightfv(GL_LIGHT0, GL_SPECULAR, whiteColor);
556 glMaterialfv(GL_FRONT, GL_DIFFUSE,
fRGBA);
557 glMaterialfv(GL_FRONT, GL_AMBIENT,
fRGBA + 4);
558 glMaterialfv(GL_FRONT, GL_SPECULAR,
fRGBA + 8);
559 glMaterialfv(GL_FRONT, GL_EMISSION,
fRGBA + 12);
560 glMaterialf(GL_FRONT, GL_SHININESS,
fRGBA[16]);
564 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
565 GLUquadric * quad = GetQuadric();
567 glRotated(-90., 1., 0., 0.);
568 gluSphere(quad, 1., 100, 100);
594 fColorApplyButton->Connect(
"Pressed()",
"TGLPShapeObjEditor",
this,
"DoColorButton()");
599 fColorApplyFamily->Connect(
"Pressed()",
"TGLPShapeObjEditor",
this,
"DoColorButton()");
ULong_t Pixel_t
Pixel value.
int Int_t
Signed integer 4 bytes (int).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
double Double_t
Double 8 bytes.
float Float_t
Float 4 bytes (float).
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
externTVirtualMutex * 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.
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.
virtual void SetPShape(TGLPhysicalShape *shape)
Set the shape.
TGLPhysicalShape * fPShape
friend class TGLPhysicalShape
3 component (x/y/z) vector class.
3 component (x/y/z) vertex class.
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.
Slider widgets allow easy selection of a range.
Yield an action as soon as it is clicked.
ROOT GUI Window base 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'.
TGedFrame(const TGedFrame &)=delete
Mother of all ROOT objects.