print 'static void ' + name( intype, outtype, inpv, outpv, prim ) + '('
if intype != GENERATE:
print ' const void * _in,'
+ print ' unsigned start,'
print ' unsigned nr,'
print ' void *_out )'
print '{'
def points(intype, outtype, inpv, outpv):
preamble(intype, outtype, inpv, outpv, prim='points')
- print ' for (i = 0; i < nr; i++) { '
+ print ' for (i = start; i < (nr+start); i++) { '
do_point( intype, outtype, 'out+i', 'i' );
print ' }'
postamble()
def lines(intype, outtype, inpv, outpv):
preamble(intype, outtype, inpv, outpv, prim='lines')
- print ' for (i = 0; i < nr; i+=2) { '
+ print ' for (i = start; i < (nr+start); i+=2) { '
do_line( intype, outtype, 'out+i', 'i', 'i+1', inpv, outpv );
print ' }'
postamble()
def linestrip(intype, outtype, inpv, outpv):
preamble(intype, outtype, inpv, outpv, prim='linestrip')
- print ' for (j = i = 0; j < nr; j+=2, i++) { '
+ print ' for (i = start, j = 0; j < nr; j+=2, i++) { '
do_line( intype, outtype, 'out+j', 'i', 'i+1', inpv, outpv );
print ' }'
postamble()
def lineloop(intype, outtype, inpv, outpv):
preamble(intype, outtype, inpv, outpv, prim='lineloop')
- print ' for (j = i = 0; j < nr - 2; j+=2, i++) { '
+ print ' for (i = start, j = 0; j < nr - 2; j+=2, i++) { '
do_line( intype, outtype, 'out+j', 'i', 'i+1', inpv, outpv );
print ' }'
do_line( intype, outtype, 'out+j', 'i', '0', inpv, outpv );
def tris(intype, outtype, inpv, outpv):
preamble(intype, outtype, inpv, outpv, prim='tris')
- print ' for (i = 0; i < nr; i+=3) { '
+ print ' for (i = start; i < (nr+start); i+=3) { '
do_tri( intype, outtype, 'out+i', 'i', 'i+1', 'i+2', inpv, outpv );
print ' }'
postamble()
def tristrip(intype, outtype, inpv, outpv):
preamble(intype, outtype, inpv, outpv, prim='tristrip')
- print ' for (j = i = 0; j < nr; j+=3, i++) { '
+ print ' for (i = start, j = 0; j < nr; j+=3, i++) { '
if inpv == FIRST:
do_tri( intype, outtype, 'out+j', 'i', 'i+1+(i&1)', 'i+2-(i&1)', inpv, outpv );
else:
def trifan(intype, outtype, inpv, outpv):
preamble(intype, outtype, inpv, outpv, prim='trifan')
- print ' for (j = i = 0; j < nr; j+=3, i++) { '
+ print ' for (i = start, j = 0; j < nr; j+=3, i++) { '
do_tri( intype, outtype, 'out+j', '0', 'i+1', 'i+2', inpv, outpv );
print ' }'
postamble()
def polygon(intype, outtype, inpv, outpv):
preamble(intype, outtype, inpv, outpv, prim='polygon')
- print ' for (j = i = 0; j < nr; j+=3, i++) { '
+ print ' for (i = start, j = 0; j < nr; j+=3, i++) { '
if inpv == FIRST:
do_tri( intype, outtype, 'out+j', '0', 'i+1', 'i+2', inpv, outpv );
else:
def quads(intype, outtype, inpv, outpv):
preamble(intype, outtype, inpv, outpv, prim='quads')
- print ' for (j = i = 0; j < nr; j+=6, i+=4) { '
+ print ' for (i = start, j = 0; j < nr; j+=6, i+=4) { '
do_quad( intype, outtype, 'out+j', 'i+0', 'i+1', 'i+2', 'i+3', inpv, outpv );
print ' }'
postamble()
def quadstrip(intype, outtype, inpv, outpv):
preamble(intype, outtype, inpv, outpv, prim='quadstrip')
- print ' for (j = i = 0; j < nr; j+=6, i+=2) { '
+ print ' for (i = start, j = 0; j < nr; j+=6, i+=2) { '
do_quad( intype, outtype, 'out+j', 'i+2', 'i+0', 'i+1', 'i+3', inpv, outpv );
print ' }'
postamble()
print 'static void ' + name( intype, outtype, prim ) + '('
if intype != GENERATE:
print ' const void * _in,'
+ print ' unsigned start,'
print ' unsigned nr,'
print ' void *_out )'
print '{'
def tris(intype, outtype):
preamble(intype, outtype, prim='tris')
- print ' for (j = i = 0; j < nr; j+=6, i+=3) { '
+ print ' for (i = start, j = 0; j < nr; j+=6, i+=3) { '
do_tri( intype, outtype, 'out+j', 'i', 'i+1', 'i+2' );
print ' }'
postamble()
def tristrip(intype, outtype):
preamble(intype, outtype, prim='tristrip')
- print ' for (j = i = 0; j < nr; j+=6, i++) { '
+ print ' for (i = start, j = 0; j < nr; j+=6, i++) { '
do_tri( intype, outtype, 'out+j', 'i', 'i+1/*+(i&1)*/', 'i+2/*-(i&1)*/' );
print ' }'
postamble()
def trifan(intype, outtype):
preamble(intype, outtype, prim='trifan')
- print ' for (j = i = 0; j < nr; j+=6, i++) { '
+ print ' for (i = start, j = 0; j < nr; j+=6, i++) { '
do_tri( intype, outtype, 'out+j', '0', 'i+1', 'i+2' );
print ' }'
postamble()
def polygon(intype, outtype):
preamble(intype, outtype, prim='polygon')
- print ' for (j = i = 0; j < nr; j+=2, i++) { '
+ print ' for (i = start, j = 0; j < nr; j+=2, i++) { '
line( intype, outtype, 'out+j', 'i', '(i+1)%(nr/2)' )
print ' }'
postamble()
def quads(intype, outtype):
preamble(intype, outtype, prim='quads')
- print ' for (j = i = 0; j < nr; j+=8, i+=4) { '
+ print ' for (i = start, j = 0; j < nr; j+=8, i+=4) { '
do_quad( intype, outtype, 'out+j', 'i+0', 'i+1', 'i+2', 'i+3' );
print ' }'
postamble()
def quadstrip(intype, outtype):
preamble(intype, outtype, prim='quadstrip')
- print ' for (j = i = 0; j < nr; j+=8, i+=2) { '
+ print ' for (i = start, j = 0; j < nr; j+=8, i+=2) { '
do_quad( intype, outtype, 'out+j', 'i+2', 'i+0', 'i+1', 'i+3' );
print ' }'
postamble()