Changeset 15 in flair-src for trunk/lib/FlairSimulator/src/Blade.cpp


Ignore:
Timestamp:
04/08/16 15:40:57 (8 years ago)
Author:
Bayard Gildas
Message:

sources reformatted with flair-format-dir script

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairSimulator/src/Blade.cpp

    r10 r15  
    3333using namespace flair::core;
    3434
    35 namespace flair
    36 {
    37 namespace simulator
    38 {
     35namespace flair {
     36namespace simulator {
    3937
    40 Blade::Blade(Model* parent,const vector3df& position,bool inverted,s32 id)
    41     : ISceneNode(parent->getSceneNode(), getGui()->getSceneManager(), id,position)
    42 {
    43     ISceneManager* mgr=getGui()->getSceneManager();
     38Blade::Blade(Model *parent, const vector3df &position, bool inverted, s32 id)
     39    : ISceneNode(parent->getSceneNode(), getGui()->getSceneManager(), id,
     40                 position) {
     41  ISceneManager *mgr = getGui()->getSceneManager();
    4442
    45     const IGeometryCreator *geo;
    46     geo=mgr->getGeometryCreator();
    47     pale=geo->createCubeMesh(vector3df(63.5,0.5,5));
     43  const IGeometryCreator *geo;
     44  geo = mgr->getGeometryCreator();
     45  pale = geo->createCubeMesh(vector3df(63.5, 0.5, 5));
    4846
    49     float angle;
    50     if(inverted==false)
    51     {
    52         angle=20;
    53     }
    54     else
    55     {
    56         angle=-20;
    57     }
     47  float angle;
     48  if (inverted == false) {
     49    angle = 20;
     50  } else {
     51    angle = -20;
     52  }
    5853
    59     ITexture* texture=getGui()->getTexture("carbone.jpg");
    60     pale_1=new MeshSceneNode(parent, pale, vector3df(-30,0,0),vector3df(-angle+90,0,0),texture);
    61     pale_1->setParent(this);
    62     pale_2=new MeshSceneNode(parent, pale, vector3df(30,0,0),vector3df(angle+90,0,0),texture);
    63     pale_2->setParent(this);
     54  ITexture *texture = getGui()->getTexture("carbone.jpg");
     55  pale_1 = new MeshSceneNode(parent, pale, vector3df(-30, 0, 0),
     56                             vector3df(-angle + 90, 0, 0), texture);
     57  pale_1->setParent(this);
     58  pale_2 = new MeshSceneNode(parent, pale, vector3df(30, 0, 0),
     59                             vector3df(angle + 90, 0, 0), texture);
     60  pale_2->setParent(this);
    6461
    65     anim = mgr->createRotationAnimator(vector3df(0.f, 0.f, 0.f));
    66     addAnimator(anim);
     62  anim = mgr->createRotationAnimator(vector3df(0.f, 0.f, 0.f));
     63  addAnimator(anim);
    6764}
    6865
    69 void Blade::OnRegisterSceneNode()
    70 {
    71     if (IsVisible)
    72         SceneManager->registerNodeForRendering(this);
     66void Blade::OnRegisterSceneNode() {
     67  if (IsVisible)
     68    SceneManager->registerNodeForRendering(this);
    7369
    74     ISceneNode::OnRegisterSceneNode();
     70  ISceneNode::OnRegisterSceneNode();
    7571}
    7672
    77 void Blade::SetRotationSpeed(float value)
    78 {
    79     IAttributes* attribs =getSceneManager()->getFileSystem()->createEmptyAttributes();
     73void Blade::SetRotationSpeed(float value) {
     74  IAttributes *attribs =
     75      getSceneManager()->getFileSystem()->createEmptyAttributes();
    8076
    81     attribs->setAttribute("Type","rotation");
    82     attribs->setAttribute("Rotation",vector3df(0.f, 0.f,value));
    83     anim->deserializeAttributes(attribs);
     77  attribs->setAttribute("Type", "rotation");
     78  attribs->setAttribute("Rotation", vector3df(0.f, 0.f, value));
     79  anim->deserializeAttributes(attribs);
    8480
    85     attribs->drop();
     81  attribs->drop();
    8682}
    8783
    88 void Blade::render()
    89 {
    90     IVideoDriver* driver = SceneManager->getVideoDriver();
    91     driver->setTransform(ETS_WORLD, AbsoluteTransformation);
     84void Blade::render() {
     85  IVideoDriver *driver = SceneManager->getVideoDriver();
     86  driver->setTransform(ETS_WORLD, AbsoluteTransformation);
    9287}
    9388
    9489} // end namespace simulator
    9590} // end namespace flair
    96 #endif //GL
     91#endif // GL
Note: See TracChangeset for help on using the changeset viewer.