Panda3D
rpSpotLight.h
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 #ifndef RPSPOTLIGHT_H
28 #define RPSPOTLIGHT_H
29 
30 #include "pandabase.h"
31 #include "rpLight.h"
32 
33 /**
34  * @brief SpotLight class
35  * @details This represents a spot light, a light which has a position, radius,
36  * direction and FoV. Checkout the RenderPipeline documentation for more
37  * information about this type of light.
38  */
39 class RPSpotLight : public RPLight {
40 PUBLISHED:
41  RPSpotLight();
42 
43  inline void set_radius(float radius);
44  inline float get_radius() const;
45  MAKE_PROPERTY(radius, get_radius, set_radius);
46 
47  inline void set_fov(float fov);
48  inline float get_fov() const;
49  MAKE_PROPERTY(fov, get_fov, set_fov);
50 
51  inline void set_direction(LVecBase3 direction);
52  inline void set_direction(float dx, float dy, float dz);
53  inline const LVecBase3& get_direction() const;
54  inline void look_at(LVecBase3 point);
55  inline void look_at(float x, float y, float z);
56  MAKE_PROPERTY(direction, get_direction, set_direction);
57 
58 public:
59  virtual void write_to_command(GPUCommand &cmd);
60  virtual void init_shadow_sources();
61  virtual void update_shadow_sources();
62 
63 protected:
64  float _radius;
65  float _fov;
66  LVecBase3 _direction;
67 };
68 
69 #include "rpSpotLight.I"
70 
71 #endif // RPSPOTLIGHT_H
RPSpotLight()
Creates a new spot light.
Definition: rpSpotLight.cxx:41
RenderPipeline.
Definition: rpSpotLight.h:39
set_radius
RenderPipeline.
Definition: rpSpotLight.h:45
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual void write_to_command(GPUCommand &cmd)
Writes the light to a GPUCommand.
Definition: rpSpotLight.cxx:54
Class for storing data to be transferred to the GPU.
Definition: gpuCommand.h:47
virtual void update_shadow_sources()
Updates the shadow sources.
Definition: rpSpotLight.cxx:78
RenderPipeline.
Definition: rpLight.h:41
virtual void init_shadow_sources()
Inits the shadow sources of the light.
Definition: rpSpotLight.cxx:68