All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Light.h
Go to the documentation of this file.
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SURGSIM_GRAPHICS_LIGHT_H
17 #define SURGSIM_GRAPHICS_LIGHT_H
18 
20 #include "SurgSim/Math/Vector.h"
21 
22 namespace SurgSim
23 {
24 namespace Graphics
25 {
26 
27 class Group;
28 
47 class Light : public virtual Representation
48 {
49 public:
50 
52  explicit Light(const std::string& name) : Representation(name)
53  {
54  }
55 
56  virtual ~Light()
57  {
58  }
59 
63  virtual bool setGroup(std::shared_ptr<SurgSim::Graphics::Group> group) = 0;
64 
67  virtual std::shared_ptr<SurgSim::Graphics::Group> getGroup() = 0;
68 
71  virtual void setDiffuseColor(const SurgSim::Math::Vector4d& color) = 0;
72 
76 
79  virtual void setSpecularColor(const SurgSim::Math::Vector4d& color) = 0;
80 
84 
87  virtual void setConstantAttenuation(double val) = 0;
88 
91  virtual double getConstantAttenuation() = 0;
92 
95  virtual void setLinearAttenuation(double val) = 0;
96 
99  virtual double getLinearAttenuation() = 0;
100 
103  virtual void setQuadraticAttenuation(double val) = 0;
104 
107  virtual double getQuadraticAttenuation() = 0;
108 
111  virtual void setLightGroupReference(const std::string& name) = 0;
112 
115  virtual std::string getLightGroupReference() = 0;
116 };
117 
118 }; // Graphics
119 }; // SurgSim
120 
121 #endif
virtual SurgSim::Math::Vector4d getDiffuseColor()=0
Gets diffuse color.
virtual void setQuadraticAttenuation(double val)=0
Sets quadratic attenuation.
virtual double getQuadraticAttenuation()=0
Gets quadratic attenuation.
virtual ~Light()
Definition: Light.h:56
Abstract interface for a light, a light needs to be assigned to a group to be active, only the members of this group will be considered to be lit by this light.
Definition: Light.h:47
virtual void setSpecularColor(const SurgSim::Math::Vector4d &color)=0
Sets specular color of this light.
virtual void setLinearAttenuation(double val)=0
Sets linear attenuation.
virtual void setConstantAttenuation(double val)=0
Sets constant attenuation.
virtual bool setGroup(std::shared_ptr< SurgSim::Graphics::Group > group)=0
Sets the group for this light, setting nullptr here will remove the light from its current group...
virtual SurgSim::Math::Vector4d getSpecularColor()=0
Gets specular color.
virtual double getConstantAttenuation()=0
Gets constant attenuation.
Base graphics representation class, which defines the interface that all graphics representations mus...
Definition: Representation.h:39
virtual void setDiffuseColor(const SurgSim::Math::Vector4d &color)=0
Sets diffuse color of this light.
Light(const std::string &name)
Constructor.
Definition: Light.h:52
Definitions of small fixed-size vector types.
virtual double getLinearAttenuation()=0
Gets linear attenuation.
virtual std::string getLightGroupReference()=0
Gets the name of the group this light should operate on.
Eigen::Matrix< double, 4, 1 > Vector4d
A 4D vector of doubles.
Definition: Vector.h:60
virtual std::shared_ptr< SurgSim::Graphics::Group > getGroup()=0
Gets the group that this light has been assigned to.
virtual void setLightGroupReference(const std::string &name)=0
Sets the name of the group that this light should work on.