model_blinkenlight.cc
Go to the documentation of this file.
00001 
00002 //
00003 // File: model_blinkenlight
00004 // Author: Richard Vaughan
00005 // Date: 7 March 2008
00006 //
00007 // CVS info:
00008 //  $Source: /home/tcollett/stagecvs/playerstage-cvs/code/stage/libstage/model_blinkenlight.cc,v $
00009 //  $Author: rtv $
00010 //  $Revision$
00011 //
00013 
00050 //#define DEBUG 1
00051 #include "stage.hh"
00052 #include "worldfile.hh"
00053 #include "option.hh"
00054 using namespace Stg;
00055 
00056 //TODO make instance attempt to register an option (as customvisualizations do)
00057 Option ModelBlinkenlight::showBlinkenData( "Show Blink", "show_blinken", "", true, NULL );
00058 
00059 
00060 ModelBlinkenlight::ModelBlinkenlight( World* world,
00061                                                                                                   Model* parent,
00062                                                                                                   const std::string& type ) : 
00063   Model( world, parent, type ),
00064   dutycycle( 1.0 ),
00065   enabled( true ),
00066   period( 1000 ),
00067   on( true )
00068 {
00069         PRINT_DEBUG2( "Constructing ModelBlinkenlight %d (%s)\n", 
00070                         id, typestr );
00071 
00072         // Set up sensible defaults
00073 
00074         this->SetColor( Color( "green" ) );
00075 
00076 
00077         Geom geom;
00078         memset( &geom, 0, sizeof(geom)); // no size
00079         geom.size.x = 0.02;
00080         geom.size.y = 0.02;
00081         geom.size.z = 0.02;
00082         this->SetGeom( geom );
00083 
00084 
00085         this->Startup();
00086         
00087         RegisterOption( &showBlinkenData );
00088 }
00089 
00090 ModelBlinkenlight::~ModelBlinkenlight()
00091 {
00092 }
00093 
00094 void ModelBlinkenlight::Load( void )
00095 {
00096   Model::Load();
00097   
00098   this->dutycycle = wf->ReadFloat( wf_entity, "dutycycle", this->dutycycle );
00099   this->period = wf->ReadInt( wf_entity, "period", this->period );
00100   this->enabled = wf->ReadInt( wf_entity, "dutycycle", this->enabled );
00101 }
00102 
00103 
00104 void ModelBlinkenlight::Update( void )
00105 {     
00106         // invert
00107         this->on = ! this->on;
00108         Model::Update();
00109 }
00110 
00111 
00112 void ModelBlinkenlight::DataVisualize( Camera* cam )
00113 {
00114   (void)cam; // avoid warning about unused var
00115 
00116   // TODO XX
00117         if( on && showBlinkenData )
00118         {
00119                 //LISTMETHOD( this->blocks, Block*, Draw );
00120         }
00121 }
00122 


stage
Author(s): Richard Vaughan , Brian Gerkey , Reed Hedges , Andrew Howard , Toby Collett , Pooya Karimian , Jeremy Asher , Alex Couture-Beil , Geoff Biggs , Rich Mattes , Abbas Sadat
autogenerated on Thu Aug 27 2015 15:20:57