Obtaining Entity of Tiles

monah

29-12-2009 08:31:06

How can I get Entity of Tiles in PLSM?

monah

30-12-2009 10:28:09

I'm trying to create a shape OgreOpcode of tiles PLSM 10 - 11 tiles shapes are fine but against flies here with such a mistake


Here's the code creation

int pageX = plsmEvent-> mPagex;
int pageZ = plsmEvent-> mPagez;
int tileX = plsmEvent-> mTilex;
int tileZ = plsmEvent-> mTilez;

/ / ask reference to geometry to PLSM2
std:: vector <; void *> params;
int renderLevel = 0;
params.push_back (& pageX);
params.push_back (& pageZ);
params.push_back (& tileX);
params.push_back (& tileZ);
params.push_back (& renderLevel);
mSceneMgr-> getOption ( "PageGetTileVertexData_2", & params);

/ / recover data at the end of the vector and send it to our physics class for the next step
int * numVtx = ((int *) params [5]);
Ogre:: Vector3 * vertices = ((Ogre:: Vector3 *) params [6]);
Ogre:: IndexData * indexData = ((Ogre:: IndexData *) params [7]);
size_t num_verts = * numVtx;
float * mVertices = new float [num_verts * 3];
size_t offset = 0;
for (size_t i = 0; i <;; num_verts; i + +)
(
mVertices [offset + +] = vertices . x;
mVertices [offset + +] = vertices . y;
mVertices [offset + +] = vertices . z;
)
size_t num_indexes = indexData-> indexCount;
unsigned long * indices = new unsigned long [indexData-> indexCount];
size_t num_trees = num_indexes / 3;
Ogre:: HardwareIndexBufferSharedPtr ibuf = indexData-> indexBuffer;
bool use32bitindexes = (ibuf-> getType () == Ogre:: HardwareIndexBuffer:: IT_32BIT);
unsigned long * pLong = static_cast <; unsigned long *> (ibuf-> lock (Ogre:: HardwareIndexBuffer:: HBL_READ_ONLY));
unsigned short * pShort = reinterpret_cast <; unsigned short *> (pLong);
offset = 0;
if (use32bitindexes)
(
for (size_t k = 0; k <;; num_trees * 3; + + k)
(
indices [offset + +] = pLong [k];
)
)
else
(
for (size_t k = 0; k <;; num_trees * 3; + + k)
(
indices [offset + +] = static_cast <; unsigned long> (pShort [k]);
)
)
ibuf-> unlock ();

size_t * mIndexes = reinterpret_cast <; size_t *> (indices);

OgreOpcode:: PtrCollisionShape * shape = new OgreOpcode:: PtrCollisionShape ( "Page_" + Ogre:: StringConverter:: toString (pageX) + "_" + Ogre:: StringConverter:: toString (pageZ) + "Tile_" + Ogre:: StringConverter:: toString (tileX) + "_" + Ogre:: StringConverter:: toString (tileZ));
shape-> load (num_verts, num_indexes, mVertices, mIndexes);
shape-> visualize (NULL);

/ / cleanup
delete [] vertices;
delete [] indices;
delete numVtx;


Someone with such a face?