Light.hh
00001 /* 00002 * Copyright 2011 Nate Koenig & Andrew Howard 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 * 00016 */ 00017 00018 /* Desc: A Light 00019 * Author: Nate Koenig 00020 * Date: 15 July 2003 00021 */ 00022 00023 #ifndef LIGHT_HH 00024 #define LIGHT_HH 00025 00026 #include <string> 00027 #include <iostream> 00028 00029 #include "common/Event.hh" 00030 #include "common/Color.hh" 00031 00032 #include "sdf/sdf.h" 00033 00034 namespace Ogre 00035 { 00036 class Light; 00037 class SceneManager; 00038 } 00039 00040 namespace gazebo 00041 { 00042 namespace rendering 00043 { 00044 class Visual; 00045 class Scene; 00046 class DynamicLines; 00047 00050 00052 class Light 00053 { 00055 public: Light(Scene *scene); 00056 00058 public: virtual ~Light(); 00059 00061 public: void Load( sdf::ElementPtr &_sdf ); 00062 00064 public: void Load( ); 00065 00067 public: void LoadFromMsg(ConstLightPtr &msg); 00068 00070 public: void SetName( const std::string &name ); 00071 00073 public: std::string GetName() const; 00074 00076 public: void SetPosition(const math::Vector3 &p); 00077 00080 public: virtual bool SetSelected( bool s ); 00081 00082 // \brief Toggle light visual visibility 00083 public: void ToggleShowVisual(); 00084 00086 public: void ShowVisual(bool s); 00087 00089 public: void SetLightType(const std::string &type); 00090 00092 public: void SetDiffuseColor(const common::Color &color); 00093 00095 public: void SetSpecularColor(const common::Color &color); 00096 00098 public: void SetDirection(const math::Vector3 &dir); 00099 00101 public: void SetAttenuation(double constant, double linear, 00102 double quadratic); 00103 00105 public: void SetSpotInnerAngle(const double &angle); 00106 00108 public: void SetSpotOuterAngle(const double &angle); 00109 00111 public: void SetSpotFalloff(const double &angle); 00112 00114 public: void SetRange(const double &range); 00115 00117 public: void SetCastShadows(const bool &cast); 00118 00120 private: void CreateVisual(); 00121 00122 private: void SetupShadows(); 00123 00124 protected: virtual void OnPoseChange() {} 00125 00127 private: Ogre::Light *light; 00128 00129 private: Visual *visual; 00130 private: DynamicLines *line; 00131 00132 private: sdf::ElementPtr sdf; 00133 00134 private: event::ConnectionPtr showLightsConnection; 00135 private: static unsigned int lightCounter; 00136 private: Scene *scene; 00137 }; 00139 } 00140 } 00141 #endif

1.7.5.1