Heya all.

I based my TerrainEngine in part on Scronty's TriangleStrip Demo.
Unfortunaltely, the algorithm presented has a problem...
every SECOND horizontal strip's vertices are created ass-about.
This means you need to render with D3DRS_CULLMODE=D3DCULL_NONE to see the entire strip... unfortunately, since we create a SINGLE strip, we end up with the secondary problem of vertical strip seams, which I have exaggerated in the accompanying image.
Does anyone want to have a go at rewriting that algo?
Posted on 2004-03-07 23:41:10 by Homer
Afternoon, EvilHomer2k.

Add to .data:


dwdirection DWORD 0 ; 0 == left. 1 == right

... and then change the algo to...


@Outerloop:
push ecx

mov ecx, 0
@Innerloop:
push ecx

fld rlx
fstp [esi].CUSTOMVERTEX.x
fld rly
fld1
[color=blue].if dwdirection == 0
fadd
.else
fsub
.endif[/color]

fstp [esi].CUSTOMVERTEX.y
fld rlz
fstp [esi].CUSTOMVERTEX.z
fld dwcolor
fstp [esi].CUSTOMVERTEX.color
add esi, size CUSTOMVERTEX

fld rlx
fstp [esi].CUSTOMVERTEX.x
fld rly
fld1
[color=blue].if dwdirection == 0
fsub
.else
fadd
.endif[/color]

fstp [esi].CUSTOMVERTEX.y
fld rlz
fstp [esi].CUSTOMVERTEX.z
fld dwcolor
fstp [esi].CUSTOMVERTEX.color
add esi, size CUSTOMVERTEX

fld rlx
fadd rldir ; this variable changes between +2.0 and -2.0
fstp rlx


pop ecx
inc ecx
cmp ecx, dwcmp_innerloop
jnz @Innerloop

; time to flip the direction of dwx...
fld rldir ; load the current value of *rldir* into st(0)
fchs ; CHange Sign in st(0)
fstp rldir ; store the result back into *rldir*, and pop st(0) away.

fld rlx
fadd rldir
fstp rlx

fld rly
fld1 ; }
fld1 ; } add *2.0f* to *rly*
fadd ; }
fadd ; }
fstp rly

[color=blue]not dwdirection[/color]

pop ecx
inc ecx
cmp ecx, dwcmp_outerloop
jnz @Outerloop


Cheers,
Scronty
Posted on 2004-03-11 07:23:31 by Scronty
Hm, conditional jumps in the innerloop? Might it be cheaper to fmul with either 1/-1 depending on direction?

:stupid:
Posted on 2004-03-11 09:12:05 by f0dder
All polygons created in the same direction now? Looks like it:) I'll give it a try shortly, thanks :)
Posted on 2004-03-13 05:15:13 by Homer