b311480e |
1 | -- Created on: 1992-01-22 |
2 | -- Created by: GG |
3 | -- Copyright (c) 1992-1999 Matra Datavision |
4 | -- Copyright (c) 1999-2012 OPEN CASCADE SAS |
5 | -- |
6 | -- The content of this file is subject to the Open CASCADE Technology Public |
7 | -- License Version 6.5 (the "License"). You may not use the content of this file |
8 | -- except in compliance with the License. Please obtain a copy of the License |
9 | -- at http://www.opencascade.org and read it completely before using this file. |
10 | -- |
11 | -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
13 | -- |
14 | -- The Original Code and all software distributed under the License is |
15 | -- distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | -- Initial Developer hereby disclaims all such warranties, including without |
17 | -- limitation, any warranties of merchantability, fitness for a particular |
18 | -- purpose or non-infringement. Please see the License for the specific terms |
19 | -- and conditions governing the rights and limitations under the License. |
20 | |
7fd59977 |
21 | -- Update: FDA Oct 15 1994 |
22 | -- ZOV - Mars 30 1998 |
7fd59977 |
23 | |
24 | |
25 | class PositionalLight from V3d |
26 | |
27 | ---Version: |
28 | |
29 | ---Purpose: Creation and modification of an isolated |
30 | -- light source. |
31 | |
32 | ---Keywords: Light,Positional |
33 | |
34 | ---Warning: |
35 | |
36 | ---References: |
37 | |
38 | |
39 | inherits PositionLight from V3d |
40 | |
41 | uses |
42 | |
43 | Viewer from V3d, |
44 | Coordinate from V3d, |
45 | View from V3d, |
46 | TypeOfRepresentation from V3d, |
47 | NameOfColor from Quantity, |
48 | Coefficient from Quantity, |
49 | Parameter from Quantity, |
50 | Structure from Graphic3d, |
51 | Vertex from Graphic3d, |
52 | Group from Graphic3d |
53 | |
6942f04a |
54 | raises BadValue from V3d |
7fd59977 |
55 | |
56 | is |
57 | |
58 | Create ( VM : mutable Viewer ; X,Y,Z : Coordinate ; |
59 | Color : NameOfColor = Quantity_NOC_WHITE ; |
60 | Attenuation1 : Coefficient = 1.0 ; |
61 | Attenuation2 : Coefficient = 0.0 ) |
62 | returns mutable PositionalLight |
63 | ---Level: Public |
64 | ---Purpose: Creates an isolated light source X,Y,Z in the viewer. |
65 | -- It is also defined by the color Color and |
66 | -- two attenuation factors Attenuation1, Attenuation2. |
67 | -- The resulting attenuation factor determining the |
68 | -- illumination of a surface depends on the following |
69 | -- formula : |
70 | -- F = 1/(A1 + A2*Length) |
71 | -- A1,A2 being the two factors of attenuation |
72 | -- Length is the distance of the isolated source |
73 | -- from the surface. |
6942f04a |
74 | raises BadValue from V3d; |
75 | ---Purpose: Warning! raises BadValue from V3d |
7fd59977 |
76 | -- if one of the attenuation coefficients is not between 0 et 1. |
77 | |
78 | Create ( VM : mutable Viewer ; Xt,Yt,Zt : Coordinate; |
79 | Xp,Yp,Zp : Coordinate; |
80 | Color : NameOfColor = Quantity_NOC_WHITE ; |
81 | Attenuation1 : Coefficient = 1.0 ; |
82 | Attenuation2 : Coefficient = 0.0 ) |
83 | returns mutable PositionalLight |
84 | ---Level: Public |
85 | ---Purpose: Creates a light source of the Positional type |
86 | -- in the viewer. |
87 | -- Xt,Yt,Zt : Coordinate of Target light source. |
88 | -- Xp,Yp,Zp : Coordinate of Position light source. |
89 | -- The light source is also defined by the color Color |
90 | -- and two attenuation factors Attenuation1, |
91 | -- Attenuation2 that determine the illumination of a |
92 | -- surface using the following formula : |
93 | -- F = 1/(A1 + A2*Length) where: |
94 | -- - A1,A2 are the two attenuation factors, and |
95 | -- - Length is the distance from the isolated source. |
6942f04a |
96 | raises BadValue from V3d; |
97 | ---Purpose: Warning! raises BadValue from V3d |
7fd59977 |
98 | -- if one of the attenuation coefficients is not between 0 et 1. |
99 | |
100 | |
101 | -------------------------------------------------------- |
102 | ---Category: Methods to modify the Attributes of the Light |
103 | -------------------------------------------------------- |
104 | |
105 | SetPosition ( me : mutable; X,Y,Z : Coordinate ) is redefined; |
106 | ---Level: Public |
107 | ---Purpose: Defines the position of the light source. |
108 | |
6942f04a |
109 | SetAttenuation( me : mutable; A1,A2 : Coefficient ) raises BadValue from V3d is static; |
7fd59977 |
110 | ---Level: Public |
111 | ---Purpose: Defines the attenuation factors. |
6942f04a |
112 | -- Warning: raises BadValue from V3d |
7fd59977 |
113 | -- if one of the attenuation coefficients is not between 0 et 1. |
114 | |
115 | --------------------------------------------------- |
116 | ---Category: Displaying methods |
117 | --------------------------------------------------- |
118 | |
119 | Display(me: mutable; aView: View from V3d; |
120 | Representation : TypeOfRepresentation) |
121 | is redefined static; |
122 | ---Level: Public |
123 | ---Purpose: Display the graphic structure of light source |
124 | -- in the choosen view. We have three type of representation |
125 | -- - SIMPLE : Only the light source is displayed. |
126 | -- - PARTIAL : The light source and the light space are |
127 | -- displayed. |
128 | -- - COMPLETE : The light source, the light space and the |
129 | -- radius of light space are displayed. |
130 | -- We can choose the "SAMELAST" as parameter of representation |
131 | -- In this case the graphic structure representation will be |
132 | -- the last displayed. |
133 | |
134 | --------------------------------------------------- |
135 | ---Category: Inquire methods |
136 | --------------------------------------------------- |
137 | |
138 | Position ( me; X,Y,Z : out Coordinate ) is redefined static; |
139 | ---Level: Public |
140 | ---Purpose : Returns the position of the light source. |
141 | |
142 | Attenuation ( me; A1,A2 : out Coefficient ) is static; |
143 | ---Level: Public |
144 | ---Purpose : Returns the attenuation factors A1,A2 of the light |
145 | -- source used at construction time. |
146 | |
147 | ----------------------------------------- |
148 | ---Category: Private or Protected methods |
149 | ----------------------------------------- |
150 | |
151 | Symbol ( me ; gsymbol : mutable Group from Graphic3d ; |
152 | aView : View from V3d ) is redefined static private; |
153 | ---Level: Internal |
154 | ---Purpose: Defined the representation of the positional light source. |
155 | |
156 | end PositionalLight; |
157 | |
158 | |