Menu

Determine the size of a mesh

Help
2003-08-18
2003-08-19
  • Roger Durańona Vargas

    How can I determine the size of a mesh? I have a *tile* mesh (a box) and I can exactly find its size in coordinate system units to make fit exactly each tile in  a plane without spaces.

     
    • John Goewert

      John Goewert - 2003-08-18

      I can't address your question, but I can provide an alternative.

      For tiles, if you really don't need a full cube, the hillplane mesh is a good helper to use for tiles. You would just need to slap them into some scenenodes and set the texture.

      [code]
          irr::core::dimension2d<irr::f32> tilesize = irr::core::dimension2d<irr::f32>(256.0f,256.0f);
          irr::core::dimension2d<irr::s32> tilecount = irr::core::dimension2d<irr::s32>(2,2);
          irr::f32 hillheight = 0.0f;
          irr::core::dimension2d<irr::f32> hillcount = irr::core::dimension2d<irr::f32>(0.0f,0.0f);
          irr::core::dimension2d<irr::f32> texturerepeat = irr::core::dimension2d<irr::f32>(8.0f,8.0f);
          lbMesh = smgr->addHillPlaneMesh("field",tilesize,tilecount,0,hillheight,hillcount,texturerepeat);
      [code]

       
    • Roger Durańona Vargas

      Thanks for the idea. I dont use a full cube, just a thin box and I apply the adequate texture.

       
    • Nikolaus Gebhardt

      > I can't address your question,

      Me too. :) But if you want to get the Bounding box of your box and use IMesh or IMeshBuffer, then getBoundingBox is the right method for you.

       
    • Roger Durańona Vargas

      Well, what I mean is to calculate the size in coordinate units, so I know that the mesh, when drawn, will span N units in X axis, N2 in Y axis and so on.

       
    • Nikolaus Gebhardt

      Then getBoundingBox() is the thing you want. :)