ContactVisual.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: Camera Visualization Class
00018  * Author: Nate Koenig
00019  */
00020 
00021 #ifndef CONTACTVISUAL_HH
00022 #define CONTACTVISUAL_HH
00023 
00024 #include "rendering/Visual.hh"
00025 
00026 namespace gazebo
00027 {
00028   namespace rendering
00029   {
00030     class ContactVisual : public Visual
00031     {
00032       public: ContactVisual(const std::string &_name, VisualPtr _vis,
00033                             const std::string &_topicName);
00034 
00035       public: virtual ~ContactVisual();
00036 
00037       private: void Update();
00038       private: void OnContact(
00039                    ConstContactsPtr &_msg);
00040 
00041       private: void SetupInstancedMaterialToEntity(Ogre::Entity *ent);
00042 
00043       private: transport::NodePtr node;
00044       private: transport::SubscriberPtr contactsSub;
00045       private: boost::shared_ptr<msgs::Contacts const> contactsMsg;
00046       private: std::vector<event::ConnectionPtr> connections;
00047 
00048       private: class ContactPoint
00049                {
00050                  public: Ogre::SceneNode *sceneNode;
00051                  public: DynamicLines *normal, *depth;
00052                };
00053       private: std::vector<ContactVisual::ContactPoint*> points;
00054     };
00055   }
00056 }
00057 #endif