Panda3D
contrib
src
rplight
rpPointLight.I
1
/**
2
*
3
* RenderPipeline
4
*
5
* Copyright (c) 2014-2016 tobspr <tobias.springer1@gmail.com>
6
*
7
* Permission is hereby granted, free of charge, to any person obtaining a copy
8
* of this software and associated documentation files (the "Software"), to deal
9
* in the Software without restriction, including without limitation the rights
10
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
* copies of the Software, and to permit persons to whom the Software is
12
* furnished to do so, subject to the following conditions:
13
*
14
* The above copyright notice and this permission notice shall be included in
15
* all copies or substantial portions of the Software.
16
*
17
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
* THE SOFTWARE.
24
*
25
*/
26
27
28
/**
29
* @brief Sets the radius of the light
30
* @details This sets the radius of the light. It controls the lights
31
* influence. After a distance greater than this radius, the light influence
32
* is zero.
33
*
34
* @param radius Light radius in world space
35
*/
36
inline
void
RPPointLight::set_radius
(
float
radius) {
37
nassertv(radius > 0);
// Invalid light radius
38
_radius = radius;
39
set_needs_update
(
true
);
40
invalidate_shadows
();
41
}
42
43
/**
44
* @brief Returns the lights radius
45
* @details This returns the lights radius previously set with
46
* RPPointLight::set_radius
47
* @return Light radius in world space
48
*/
49
inline
float
RPPointLight::get_radius
()
const
{
50
return
_radius;
51
}
52
53
/**
54
* @brief Sets the inner radius of the light
55
* @details This sets the inner radius of the light. Anything greater than
56
* zero causes the light to get an area light. This has influence on the
57
* specular highlights of the light aswell as the shadows.
58
*
59
* The inner radius controls the size of the lights sphere size in world
60
* space units. A radius of 0 means the light has no inner radius, and the
61
* light will be have like an infinite small point light source.
62
* A radius greater than zero will cause the light to behave like it would be
63
* an emissive sphere with the given inner radius emitting light. This is
64
* more physically correct.
65
*
66
* @param inner_radius Inner-radius in world space
67
*/
68
inline
void
RPPointLight::set_inner_radius
(
float
inner_radius) {
69
nassertv(inner_radius >= 0.01);
// Invalid inner radius
70
_inner_radius = inner_radius;
71
set_needs_update
(
true
);
72
}
73
74
/**
75
* @brief Returns the inner radius of the light
76
* @details This returns the inner radius of the light, previously set with
77
* RPPointLight::get_inner_radius.
78
* @return [description]
79
*/
80
inline
float
RPPointLight::get_inner_radius
()
const
{
81
return
_inner_radius;
82
}
RPLight::invalidate_shadows
void invalidate_shadows()
Invalidates the shadows.
Definition:
rpLight.I:153
RPPointLight::get_radius
get_radius
Returns the lights radius.
Definition:
rpPointLight.h:45
RPLight::set_needs_update
void set_needs_update(bool flag)
Sets whether the light needs an update.
Definition:
rpLight.I:80
RPPointLight::set_radius
set_radius
RenderPipeline.
Definition:
rpPointLight.h:45
RPPointLight::get_inner_radius
get_inner_radius
Returns the inner radius of the light.
Definition:
rpPointLight.h:49
RPPointLight::set_inner_radius
set_inner_radius
Sets the inner radius of the light.
Definition:
rpPointLight.h:49
Generated on Sat Jan 11 2020 15:14:37 for Panda3D by
1.8.17