Code archives/3D Graphics - Misc/defaultTextureEntity

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

Download source code

defaultTextureEntity by Giano2002
A simple routine that add a squared texture to any mesh
Sometimes I need a mesh for test (sphere, cylinder , box ecc..) and want to show better than an empty white mesh.
Ok just call defaultTextureEntity(mesh) and will be texturized

examples...
s = createSphere()
defaultTextureEntity(s, 255,0,0, 0,0,255) ; red and blue
c = createCone()
defaultTextureEntity(s)
Function defaultTextureEntity(mesh, colr1=32,colg1=128,colb1=192, colr2=255,colg2=255,colb2=160)
	tex=CreateTexture( 64,64 )
	ScaleTexture tex,.125,.125
	SetBuffer TextureBuffer( tex )
	Color colr1,colg1,colb1:Rect 32,0,32,32:Rect 0,32,32,32
	Color colr2,colg2,colb2:Rect 0,0,32,32:Rect 32,32,32,32
	SetBuffer BackBuffer()
	Color 255,255,255
	EntityTexture mesh,tex
	FreeTexture tex
End Function

Comments

None.

Code Archives Forum