Banks to hold entities memory locations
Blitz3D Forums/Blitz3D Programming/Banks to hold entities memory locations
| ||
Could i use Banks to store the memory location (ie: the value of the 'entity handle') in, and then equate a variable to that banks value at that point (changing where it reads oiver time to effect different meshes) so that i can affect a different mesh by reading that variable to different stored 'entity handles'? i'd be reading ints, right? ;------- i dont think i phrased that very well: Basically, could i write a memory location for an entity, into a bank as an int, and then read it out in a variable, and use that variable as the entity handle. (it can be done with images i think) |
| ||
Yes. |
| ||
Thanks -im a 3d noob and i didnt want to spend time replacing the local arrays i've set up unless i knew it should work. |
| ||
Type bank Field pointer%,bank% End Type Function bankCreate.bank(size%) this.bank= New bank this\bank%=CreateBank(size%*4) Return this End Function Function bankResize(this.bank,size%) ResizeBank this\bank%,size% End Function Function bankPush%(this.bank,value%) PokeInt(this\bank%,this\pointer%,value%) this\pointer%=this\pointer%+4 End Function Function bankPop%(this.bank) this\pointer%=this\pointer%-4 Return PeekInt(this\bank%,this\pointer%) End Function ;Uses mybank.bank=bankCreate(NumberOfEntities) entity%=CreateCube() bankPush(mybank,entity%) ;<-- put entity on bank stack entity%=bankPop(mybank) ;<-- get entity off bank stack bankResize(mybank,LargerNumberOfEntities) |
| ||
Thanks-should be much faster than using arrays |
| ||
Thanks-should be much faster than using arrays Not necessarily. |
| ||
faster access is what i meant, and what i was looking for |