dynamic.cc
Go to the documentation of this file.
1 #include "stage.hh"
2 using namespace Stg;
3 
4 // Stage calls this when the model starts up
5 extern "C" int Init(Model *mod)
6 {
7  printf("Creating 100 models");
8 
9  for (int i = 0; i < 100; i++) {
10  Model *child = mod->GetWorld()->CreateModel(mod, "model");
11  assert(child);
12 
13  child->SetPose(Pose::Random(-1, 1, -1, 1));
14  child->SetGeom(Geom(Pose(), Stg::Size(0.1, 0.1, 0.1)));
15  child->SetColor(Color(0, 0, 1, 1));
16  }
17  return 0; // ok
18 }
Model class
Definition: stage.hh:1651
The Stage library uses its own namespace.
Definition: canvas.hh:8
void SetPose(const Pose &pose)
Definition: model.cc:1216
void Init(int *argc, char **argv[])
Definition: stage.cc:17
static Pose Random(meters_t xmin, meters_t xmax, meters_t ymin, meters_t ymax)
Definition: stage.hh:269
World * GetWorld() const
Definition: stage.hh:2188
void SetGeom(const Geom &src)
Definition: model.cc:1061
Model * CreateModel(Model *parent, const std::string &typestr)
Definition: world.cc:307
void SetColor(Color col)
Definition: model.cc:1081


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 Mon Feb 28 2022 23:48:55