DynamicLines.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 /* Desc: Dynamic line generator
00018  * Author: Nate Koenig
00019  * Date: 28 June 2007
00020  * CVS: $Id$
00021  */
00022 
00023 #ifndef OGREDYNAMICLINES_HH
00024 #define OGREDYNAMICLINES_HH
00025 
00026 #include "math/Vector3.hh"
00027 #include "rendering/DynamicRenderable.hh"
00028 
00029 #include <vector>
00030 
00031 namespace gazebo
00032 {
00033     namespace rendering
00034   {
00035   
00038     
00040     class DynamicLines : public DynamicRenderable
00041     {
00043       public: DynamicLines(RenderOpType opType=RENDERING_LINE_STRIP);
00044     
00046       public: virtual ~DynamicLines();
00047     
00048       public: static std::string GetMovableType();
00049 
00051       public: virtual const Ogre::String &getMovableType() const;
00052     
00055       public: void AddPoint(const math::Vector3 &pt);
00056     
00060       public: void SetPoint(unsigned int index, const math::Vector3 &value);
00061     
00065       public: const math::Vector3& GetPoint(unsigned int index) const;
00066     
00069       public: unsigned int GetPointCount() const;
00070     
00072       public: void Clear();
00073     
00075       public: void Update();
00076     
00078       protected: virtual void  CreateVertexDeclaration();
00079     
00081       protected: virtual void FillHardwareBuffers();
00082     
00083       private: std::vector<math::Vector3> points;
00084       private: bool dirty;
00085     };
00086     
00088   }
00089 }
00090 #endif