Code archives/3D Graphics - Misc/CreateQuad()

This code has been declared by its author to be Public Domain code.

Download source code

CreateQuad() by Zenith(Matt Griffith)2001
First you must start the code:
plane=CreateQuad()

and then when you want to make instances of it.

person=CopyEntity(plane)

It's much faster to copy, than create a square each time :)
Function CreateQuad()
	sprite=CreateMesh()
	he=CreateBrush(255,255,255)
	v=CreateSurface(sprite,he)
	FreeBrush he
	AddVertex ( v,-3,3,0,1,0)  ; top left 0,1;1,0
	AddVertex ( v,3,3,0,0,0)   ; top right 1,1;1,1
	AddVertex ( v,-3,-3,0,1,1) ; bottom left 0,0;,0,0
	AddVertex ( v,3,-3,0,0,1)  ; bottom right 1,0;0,1
	AddTriangle( v,0,1,2)
	AddTriangle( v,3,2,1)
	FlipMesh(sprite)
	HideEntity(sprite)
	Return sprite
End Function

Comments

None.

Code Archives Forum