The old surfaces problem

Blitz3D Forums/Blitz3D Programming/The old surfaces problem

Maybe it's something I'm doing elsewhere, I dunno. Well here it is, anyway. This is the new, single-poly version I just finished. Each particle is a polygon big enough to fit one non-repeating version of the texture, hence the UV value of 1.5, to allow the polygon to be big enough to not cut off the sprite. This seems to work fine, Beaker, I can't think of a reason not to do it.

ppsrf%=GetSurface(doparty\parent,1)
PositionEntity doparty\modelhandle,doparty\xpos,doparty\ypos,doparty\zpos
PointEntity doparty\modelhandle,maincam,doparty\angle
TurnEntity doparty\modelhandle,0,180,0

TFormPoint 0-(doparty\size*0.375),0-(doparty\size*0.375),0,doparty\modelhandle,doparty\parent
blx#=TFormedX():bly#=TFormedY():blz#=TFormedZ()
TFormPoint 0-(doparty\size*0.375),(0+(doparty\size*0.375))*2,0,doparty\modelhandle,doparty\parent
tlx#=TFormedX():tly#=TFormedY():tlz#=TFormedZ()
TFormPoint (0+(doparty\size*0.375))*2,0-(doparty\size*0.375),0,doparty\modelhandle,doparty\parent
brx#=TFormedX():bry#=TFormedY():brz#=TFormedZ()
		
v1=AddVertex(ppsrf%,blx#,bly#,blz#,0,0,0)
v2=AddVertex(ppsrf%,tlx#,tly#,tlz#,0,1.5,0)
v3=AddVertex(ppsrf%,brx#,bry#,brz#,1.5,0,0)

VertexColor(ppsrf%,v1,255,255,255,doparty\alpha#)
VertexColor(ppsrf%,v2,255,255,255,doparty\alpha#)
VertexColor(ppsrf%,v3,255,255,255,doparty\alpha#)

AddTriangle(ppsrf%,v1,v2,v3)


The first part positions the null object. It's flipped 180 degrees so the polys are facing the right way.

Obviously, this code is called per-particle. The \parent field refers to the handle of the parent object housing the particles, what's normally called an "emitter" I guess. I don't quite follow the emitter philosophy, but each local explosion and effect has one or two of these parents, basically one for each particle type involved in the effect.

ppsrf% is the surface of the parent object that the polys are being added to, cleared every frame.

TFormPoint is used to find the four corners to join together for each party.

Thanks for the help, guys.