1vpSetLight(3)              Library Functions Manual              vpSetLight(3)
2
3
4

NAME

6       vpSetLight - set lighting properties
7

SYNOPSIS

9       #include <volpack.h>
10
11       vpResult
12       vpSetLight(vpc, light_num, property, n0, n1, n2)
13           vpContext *vpc;
14           int light_num;
15           int property;
16           double n0, n1, n2;
17

ARGUMENTS

19       vpc    VolPack context from vpCreateContext.
20
21       light_num
22              A  constant  specifying  a  particular  light source (VP_LIGHT0,
23              VP_LIGHT1, ..., VP_LIGHT5).
24
25       property
26              A  constant  specifying  one  lighting  property  (VP_COLOR   or
27              VP_DIRECTION).
28
29       n0, n1, n2
30              Components  of an RGB color (for VP_COLOR) or a direction vector
31              (for VP_DIRECTION).
32

DESCRIPTION

34       vpSetLight is used to set the properties of a  light  source.   VolPack
35       currently only supports directional light sources: each light is infin‐
36       itely distant, so it can be fully characterized by a  direction  vector
37       and  a color.  The lighting properties are used by vpShadeTable to com‐
38       pute the shading lookup table, which is then used to  compute  a  color
39       for each voxel.
40
41       To  initialize the lighting environment, call vpSetLight twice for each
42       light source which will be enabled.  One call should set the RGB compo‐
43       nents  of  the light color (by using the VP_COLOR code for the property
44       parameter), and one call should set the XYZ  components  of  the  light
45       direction  vector  (by  using  the  VP_DIRECTION  code for the property
46       parameter).  The particular light source is specified with one  of  the
47       light  source  codes  defined  in volpack.h: VP_LIGHT0, VP_LIGHT1, ...,
48       VP_LIGHT5.  In the current implementation, at most  six  light  sources
49       may be specified.
50
51       The  RGB components of a light color should be numbers in the range 0.0
52       (zero intensity) to 1.0 (full  intensity).   For  grayscale  renderings
53       only  the first (red) component is used and the other components may be
54       set to any legal value.  The default is white light (1.0, 1.0, 1.0).
55
56       The light direction vector points from the light source towards the lit
57       object.   It  is  transformed  by  the current contents of the modeling
58       matrix (see vpCurrentMatrix).  This allows the direction vector  to  be
59       specified  in an arbitrary coordinate system, provided the current mod‐
60       eling matrix properly transforms the  vector  into  world  coordinates.
61       The default is the vector (1,1,1).
62
63       Each  light source contributes to the shading computation only if it is
64       enabled by calling vpEnable.  By default, VP_LIGHT0 is enabled and  all
65       other  lights  are  disabled.  The more light sources that are enabled,
66       the longer it takes to precompute the contents of  the  shading  lookup
67       table.
68
69       One  additional property of the light sources can be set with vpEnable:
70       VP_LIGHT_BOTH_SIDES.  With this option enabled each light source shines
71       in  two  opposing directions, as if there were two light sources facing
72       each other with opposite direction vectors.  No additional  computation
73       is required when this option is enabled.
74

STATE VARIABLES

76       Information about the current lighting properties can be retrieved with
77       the    following    state    variable    codes     (see     vpGeti(3)):
78       VP_LIGHT_BOTH_SIDES.
79

ERRORS

81       The  normal  return  value is VP_OK.  The following error return values
82       are possible:
83
84       VPERROR_LIMIT_EXCEEDED
85              The light number is invalid or exceeds an implementation limit.
86
87       VPERROR_SINGULAR
88              The light direction vector is a zero vector.
89
90       VPERROR_BAD_VALUE
91              The RGB color components are out of range.
92
93       VPERROR_BAD_OPTION
94              The property argument is invalid.
95

SEE ALSO

97       VolPack(3), vpCreateContext(3), vpSetLookupShader(3),  vpShadeTable(3),
98       vpGetLight(3)
99
100
101
102VolPack                                                          vpSetLight(3)
Impressum