/usr/include/vtk-6.3/vtkLightKit.h is in libvtk6-dev 6.3.0+dfsg1-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | /*=========================================================================
Program: Visualization Toolkit
Module: vtkLightKit.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkLightKit - a simple but quality lighting kit
// .SECTION Description
// vtkLightKit is designed to make general purpose lighting of vtk
// scenes simple, flexible, and attractive (or at least not horribly
// ugly without significant effort). Use a LightKit when you want
// more control over your lighting than you can get with the default
// vtk light, which is a headlight located at the camera. (HeadLights
// are very simple to use, but they don't show the shape of objects very
// well, don't give a good sense of "up" and "down", and don't evenly
// light the object.)
//
// A LightKit consists of three lights, a key light, a fill light, and
// a headlight. The main light is the key light. It is usually
// positioned so that it appears like an overhead light (like the sun,
// or a ceiling light). It is generally positioned to shine down on the
// scene from about a 45 degree angle vertically and at least a little
// offset side to side. The key light usually at least about twice as
// bright as the total of all other lights in the scene to provide good
// modeling of object features.
//
// The other lights in the kit (the fill light, headlight, and a pair of
// back lights) are weaker sources that provide extra
// illumination to fill in the spots that the key light misses. The
// fill light is usually positioned across from or opposite from the
// key light (though still on the same side of the object as the
// camera) in order to simulate diffuse reflections from other objects
// in the scene. The headlight, always located at the position of the
// camera, reduces the contrast between areas lit by the key and fill
// light. The two back lights, one on the left of the object as seen
// from the observer and one on the right, fill on the high-contrast
// areas behind the object. To enforce the relationship between the
// different lights, the intensity of the fill, back and headlights
// are set as a ratio to the key light brightness. Thus, the
// brightness of all the lights in the scene can be changed by
// changing the key light intensity.
//
// All lights are directional lights (infinitely far away with no
// falloff). Lights move with the camera.
//
// For simplicity, the position of lights in the LightKit can only be
// specified using angles: the elevation (latitude) and azimuth
// (longitude) of each light with respect to the camera, expressed in
// degrees. (Lights always shine on the camera's lookat point.) For
// example, a light at (elevation=0, azimuth=0) is located at the
// camera (a headlight). A light at (elevation=90, azimuth=0) is
// above the lookat point, shining down. Negative azimuth values move
// the lights clockwise as seen above, positive values
// counter-clockwise. So, a light at (elevation=45, azimuth=-20) is
// above and in front of the object and shining slightly from the left
// side.
//
// vtkLightKit limits the colors that can be assigned to any light to
// those of incandescent sources such as light bulbs and sunlight. It
// defines a special color spectrum called "warmth" from which light
// colors can be chosen, where 0 is cold blue, 0.5 is neutral white,
// and 1 is deep sunset red. Colors close to 0.5 are "cool whites" and
// "warm whites," respectively.
//
// Since colors far from white on the warmth scale appear less bright,
// key-to-fill and key-to-headlight ratios are skewed by
// key, fill, and headlight colors. If the flag MaintainLuminance
// is set, vtkLightKit will attempt to compensate for these perceptual
// differences by increasing the brightness of more saturated colors.
//
// A LightKit is not explicitly part of the vtk pipeline. Rather, it
// is a composite object that controls the behavior of lights using a
// unified user interface. Every time a parameter of vtkLightKit is
// adjusted, the properties of its lights are modified.
//
// .SECTION Credits
// vtkLightKit was originally written and contributed to vtk by
// Michael Halle (mhalle@bwh.harvard.edu) at the Surgical Planning
// Lab, Brigham and Women's Hospital.
#ifndef vtkLightKit_h
#define vtkLightKit_h
#include "vtkRenderingCoreModule.h" // For export macro
#include "vtkObject.h"
class vtkLight;
class vtkPiecewiseFunction;
class vtkRenderer;
class VTKRENDERINGCORE_EXPORT vtkLightKit : public vtkObject
{
public:
static vtkLightKit *New();
vtkTypeMacro(vtkLightKit, vtkObject);
void PrintSelf(ostream& os, vtkIndent indent);
//BTX
enum LightKitType {
TKeyLight,
TFillLight,
TBackLight,
THeadLight
};
enum LightKitSubType {
Warmth,
Intensity,
Elevation,
Azimuth,
KFRatio,
KBRatio,
KHRatio
};
//ETX
// Description:
// Set/Get the intensity of the key light. The key light is the
// brightest light in the scene. The intensities of the other two
// lights are ratios of the key light's intensity.
vtkSetMacro(KeyLightIntensity, double);
vtkGetMacro(KeyLightIntensity, double);
// Description:
// Set/Get the key-to-fill ratio. This ratio controls
// how bright the fill light is compared to the key light: larger
// values correspond to a dimmer fill light. The purpose of the
// fill light is to light parts of the object not lit by the key
// light, while still maintaining constrast. This type of lighting
// may correspond to indirect illumination from the key light, bounced
// off a wall, floor, or other object. The fill light should never
// be brighter than the key light: a good range for the key-to-fill
// ratio is between 2 and 10.
vtkSetClampMacro(KeyToFillRatio, double, 0.5, VTK_DOUBLE_MAX);
vtkGetMacro(KeyToFillRatio, double);
// Description:
// Set/Get the key-to-headlight ratio. Similar to the key-to-fill
// ratio, this ratio controls how bright the headlight light is
// compared to the key light: larger values correspond to a dimmer
// headlight light. The headlight is special kind of fill light,
// lighting only the parts of the object that the camera can see.
// As such, a headlight tends to reduce the contrast of a scene. It
// can be used to fill in "shadows" of the object missed by the key
// and fill lights. The headlight should always be significantly
// dimmer than the key light: ratios of 2 to 15 are typical.
vtkSetClampMacro(KeyToHeadRatio, double, 0.5, VTK_DOUBLE_MAX);
vtkGetMacro(KeyToHeadRatio, double);
// Description:
// Set/Get the key-to-back light ratio. This ratio controls
// how bright the back lights are compared to the key light: larger
// values correspond to dimmer back lights. The back lights fill
// in the remaining high-contrast regions behind the object.
// Values between 2 and 10 are good.
vtkSetClampMacro(KeyToBackRatio, double, 0.5, VTK_DOUBLE_MAX);
vtkGetMacro(KeyToBackRatio, double);
// Description:
// Set the warmth of each the lights. Warmth is a parameter that
// varies from 0 to 1, where 0 is "cold" (looks icy or lit by a very
// blue sky), 1 is "warm" (the red of a very red sunset, or the
// embers of a campfire), and 0.5 is a neutral white. The warmth
// scale is non-linear. Warmth values close to 0.5 are subtly
// "warmer" or "cooler," much like a warmer tungsten incandescent
// bulb, a cooler halogen, or daylight (cooler still). Moving
// further away from 0.5, colors become more quickly varying towards
// blues and reds. With regards to aesthetics, extremes of warmth
// should be used sparingly.
vtkSetMacro(KeyLightWarmth, double);
vtkGetMacro(KeyLightWarmth, double);
vtkSetMacro(FillLightWarmth, double);
vtkGetMacro(FillLightWarmth, double);
vtkSetMacro(HeadLightWarmth, double);
vtkGetMacro(HeadLightWarmth, double);
vtkSetMacro(BackLightWarmth, double);
vtkGetMacro(BackLightWarmth, double);
// Description:
// Returns the floating-point RGB values of each of the light's color.
vtkGetVectorMacro(KeyLightColor, double, 3);
vtkGetVectorMacro(FillLightColor, double, 3);
vtkGetVectorMacro(HeadLightColor, double, 3);
vtkGetVectorMacro(BackLightColor, double, 3);
// Description:
// If MaintainLuminance is set, the LightKit will attempt to maintain
// the apparent intensity of lights based on their perceptual brightnesses.
// By default, MaintainLuminance is off.
vtkBooleanMacro(MaintainLuminance, int);
vtkGetMacro(MaintainLuminance, int);
vtkSetMacro(MaintainLuminance, int);
// Description:
// Get/Set the position of the key, fill, and back lights
// using angular methods. Elevation corresponds to latitude,
// azimuth to longitude. It is recommended that the key light
// always be on the viewer's side of the object and above the
// object, while the fill light generally lights the part of the object
// not lit by the fill light. The headlight, which is always located
// at the viewer, can then be used to reduce the contrast in the image.
// There are a pair of back lights. They are located at the same
// elevation and at opposing azimuths (ie, one to the left, and one to
// the right). They are generally set at the equator (elevation = 0),
// and at approximately 120 degrees (lighting from each side and behind).
void SetKeyLightAngle(double elevation, double azimuth);
void SetKeyLightAngle(double angle[2])
{ this->SetKeyLightAngle(angle[0], angle[1]); }
void SetKeyLightElevation(double x)
{ this->SetKeyLightAngle(x, this->KeyLightAngle[1]); }
void SetKeyLightAzimuth(double x)
{ this->SetKeyLightAngle(this->KeyLightAngle[0], x); }
vtkGetVectorMacro(KeyLightAngle, double, 2);
double GetKeyLightElevation()
{ double ang[2]; this->GetKeyLightAngle(ang); return ang[0]; }
double GetKeyLightAzimuth()
{ double ang[2]; this->GetKeyLightAngle(ang); return ang[1]; }
void SetFillLightAngle(double elevation, double azimuth);
void SetFillLightAngle(double angle[2])
{ this->SetFillLightAngle(angle[0], angle[1]); }
void SetFillLightElevation(double x)
{ this->SetFillLightAngle(x, this->FillLightAngle[1]); }
void SetFillLightAzimuth(double x)
{ this->SetFillLightAngle(this->FillLightAngle[0], x); }
vtkGetVectorMacro(FillLightAngle, double, 2);
double GetFillLightElevation() {
double ang[2]; this->GetFillLightAngle(ang); return ang[0]; }
double GetFillLightAzimuth()
{ double ang[2]; this->GetFillLightAngle(ang); return ang[1]; }
void SetBackLightAngle(double elevation, double azimuth);
void SetBackLightAngle(double angle[2])
{ this->SetBackLightAngle(angle[0], angle[1]); }
void SetBackLightElevation(double x)
{ this->SetBackLightAngle(x, this->BackLightAngle[1]); }
void SetBackLightAzimuth(double x)
{ this->SetBackLightAngle(this->BackLightAngle[0], x); }
vtkGetVectorMacro(BackLightAngle, double, 2);
double GetBackLightElevation()
{ double ang[2]; this->GetBackLightAngle(ang); return ang[0]; }
double GetBackLightAzimuth()
{ double ang[2]; this->GetBackLightAngle(ang); return ang[1]; }
// Description:
// Add lights to, or remove lights from, a renderer.
// Lights may be added to more than one renderer, if desired.
void AddLightsToRenderer(vtkRenderer *renderer);
void RemoveLightsFromRenderer(vtkRenderer *renderer);
void DeepCopy(vtkLightKit *kit);
void Modified();
void Update();
// Description:
// Helper method to go from a enum type to a string type
static const char *GetStringFromType(int type);
// Description:
// Helper method to go from a enum subtype to a string subtype
static const char *GetStringFromSubType(int type);
// Description:
// Helper method to go from a enum subtype to a string subtype
// The difference from GetStringFromSubType is that it returns
// a shorter strings (useful for GUI with minimun space)
static const char *GetShortStringFromSubType(int subtype);
// Description:
// Return the possible subtype from a given type. You have to pass
// in a number i [0,3] no check is done.
static LightKitSubType GetSubType(LightKitType type, int i);
protected:
vtkLightKit();
~vtkLightKit();
void WarmthToRGBI(double w, double rgb[3], double& i);
void WarmthToRGB(double w, double rgb[3]);
void InitializeWarmthFunctions();
double WarmthToIntensity(double w);
double KeyLightIntensity;
double KeyToFillRatio;
double KeyToHeadRatio;
double KeyToBackRatio;
vtkLight *KeyLight;
double KeyLightWarmth;
double KeyLightAngle[2];
double KeyLightColor[3];
vtkLight *FillLight;
double FillLightWarmth;
double FillLightAngle[2];
double FillLightColor[3];
double BackLightWarmth;
double BackLightColor[3];
vtkLight *BackLight0;
vtkLight *BackLight1;
double BackLightAngle[2];
vtkLight *HeadLight;
double HeadLightWarmth;
double HeadLightColor[3];
int MaintainLuminance;
vtkPiecewiseFunction *WarmthFunction[4]; // r, g, b, perceptual length
private:
vtkLightKit(const vtkLightKit&); // Not implemented.
void operator=(const vtkLightKit&); // Not implemented.
};
#endif
|