Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] - [Matrix1] Custom vertexdata system - break the 65535 indexdata limit!

Years of Service
User Offline
Joined: 25th May 2009
Posted: 11th Apr 2015 03:40 Edited at: 19th Apr 2015 01:44
Thanks so much to MonoCoder for the thread explaining the structure of Get Vertexdata Ptr() over here:
A few days back I was experimenting with combining lots of objects together into a single object to see if I could improve my FPS. I'm not sure how many people run into this problem, but it turns out DBPro won't allow an object to have an indexdata count more than 65535, for whatever reason (legacy support? ), which limits the amount of vertex/index data you can add with 'add mesh to vertexdata' - once the indexdata reaches the limit, you can't add anything else :/
Anyway, thanks to Monocoder's awesome thread I managed to put together an alternative system for adding vertexdata which gets around the limit, meaning you can have pretty much an infinite number of indicies per object!
Basically all it does is copy object's vertexdata and indexdata to a new chunk memory and manipulate it from there, so all the standard vertexdata commands still work fine for setting position, UV, etc

Here's the command list:
All the pointers used as parameters should be the pointer returned by Get Vertexdata Ptr() when that limb or mesh is locked!
+ Code Snippet

And here's the code (with a small example):
+ Code Snippet

Unfortunately, since this is a little hacky and DBPro isn't supposed to support objects with more than 65535 indicies, there's a few things you can't do with this method (as far as I know):
Use meshes (as targets for lots of indexdata) - If you try and turn a mesh with indexdata > 65535 into an object, you'll get a crash, so you need to use 'lock vertexdata for limb' instead

Save the object - Trying to save an object past the limit as a DBO gets you a crash instead

Have an object with more than 65535 verticies - unfortunately each indexdata entry is stored as a word with a maximum value of 65535, so even though you can have unlimited indexdata, you're limited to 65535 verticies per object (since indexdata entries can't reference verticies above that value)

Feel free to do whatever you want with this, hope it helps someone

The code never bothered me anyway...

Login to post a reply

Server time is: 2017-07-22 03:53:09
Your offset time is: 2017-07-22 03:53:09