What it'll be used for is this: I want to make use of OpenGL occlusion routines to determine which parts of the world can be skipped in drawing. For that i need to create a rough shape around the parts that would be drawn, keeping it cheap enough to actually make a difference. That shape is created by taking all units that would contain something and drawing shapes around them.
I could go the naive way and draw one cube per unit and call it a day. However that would be rather slow and i'd prefer to draw a rectangular shape that encompasses as many units as possible.
To give an example on practice, with a map such as this:
0 4 8 12 15
00111000000000000
1111000000000000
1111000000000000
1111000000000000
40000000000000000
0000000000000000
0000000000000000
0000000000000000
80000000000000000
0000000000000000
0000000000000000
0000000000000000
120000000000000000
0000000000000000
0000000000000000
150000000000000000
, the result would be:
0:3:2:3|2:3:0:1|0:1:1:1|1:1:0:0|. This would be 4 shapes as opposed to the 15 shapes needed if i were drawing this naively.
I'm not sure at all what you mean in your example in the first place. But my guts tell me that you kinda missed the point. Also, i have no idea about how to use inline-c.
Edit: I should also note, the grid won't get bigger. At least not in my application. 16x16 is the limit on the data i have. I merely made it work for general cases in case others might find it useful and because i found it easier to work that way.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.