17#include "TGLIncludes.h"
29 fLightState(kLightMask),
32 fFrontPower(0.4), fSidePower(0.7), fSpecularPower(0.8)
45 Error(
"TGLLightSet::ToggleLight",
"invalid light type");
60 Error(
"TGLViewer::ToggleLight",
"invalid light type");
93 frontLightZ = sideLightsZ;
101 sideLightsZ = eyeVector.
Mag() * -0.85;
102 frontLightZ = 0.2 * lightRadius;
123 const Float_t specLightColor[] = { specular, specular, specular, 1.0f };
125 glLightfv(GL_LIGHT0, GL_POSITION, pos0);
126 glLightfv(GL_LIGHT0, GL_DIFFUSE, frontLightColor);
127 glLightfv(GL_LIGHT0, GL_SPECULAR, specLightColor);
129 glLightfv(GL_LIGHT1, GL_POSITION, pos1);
130 glLightfv(GL_LIGHT1, GL_DIFFUSE, sideLightColor);
131 glLightfv(GL_LIGHT2, GL_POSITION, pos2);
132 glLightfv(GL_LIGHT2, GL_DIFFUSE, sideLightColor);
133 glLightfv(GL_LIGHT3, GL_POSITION, pos3);
134 glLightfv(GL_LIGHT3, GL_DIFFUSE, sideLightColor);
135 glLightfv(GL_LIGHT4, GL_POSITION, pos4);
136 glLightfv(GL_LIGHT4, GL_DIFFUSE, sideLightColor);
146 glEnable(
GLenum(GL_LIGHT0 + light));
152 glDisable(GL_LIGHTING);
154 glGetLightfv(
GLenum(GL_LIGHT0 + light), GL_POSITION, position);
156 TGLVertex3 dPosition(position[0], position[1], position[2]);
158 glEnable(GL_LIGHTING);
163 glDisable(
GLenum(GL_LIGHT0 + light));
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
Concrete class describing an orientated (free) or axis aligned box of 8 vertices.
TGLVector3 Extents() const
TGLVertex3 Center() const
Abstract base camera class - concrete classes for orthographic and perspective cameras derive from it...
TGLVertex3 FrustumCenter() const
Find the center of the camera frustum from intersection of planes This method will work even with par...
const TGLMatrix & RefModelViewMatrix() const
const TGLPlane & FrustumPlane(EFrustumPlane plane) const
TGLVertex3 EyePoint() const
Return the camera eye point (vertex) in world space Camera must have valid frustum cache - call Apply...
Encapsulates a set of lights for OpenGL.
Bool_t fUseSpecular
light states (on/off) mask
void StdSetupLights(const TGLBoundingBox &bbox, const TGLCamera &camera, Bool_t debug=kFALSE)
Setup lights for current given bounding box and camera.
void ToggleLight(ELight light)
Toggle light on/off.
Float_t fSidePower
power of the front lamp
TGLLightSet()
power of specular lamp
Float_t fSpecularPower
power of the side lamps
void SetLight(ELight light, Bool_t on)
Set a light on/off.
void MultiplyIP(TGLVector3 &v, Double_t w=1) const
Multiply vector in-place.
Orthographic projection camera.
Double_t DistanceTo(const TGLVertex3 &vertex) const
Distance from plane to vertex.
static void DrawSphere(const TGLVertex3 &position, Double_t radius, const UChar_t rgba[4])
Draw sphere, centered on vertex 'position', with radius 'radius', color 'rgba'.
static const UChar_t fgYellow[4]
3 component (x/y/z) vector class.
3 component (x/y/z) vertex class.
Mother of all ROOT objects.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.