Home
Products
Community
Manuals
Contact
Login or Signup

Code archives/3D Graphics - Mesh/ColorMesh and ColorSurface

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

Download source code

ColorMesh and ColorSurface by GIB3D(Posted 1+ years ago)
This only works if you use EntityFX

For coloring
EntityFX Mesh,2

For changing alpha
EntityFX Mesh,32

For both
EntityFX Mesh,2+32

2: use vertex colors instead of brush color
32: force alpha-blending
Function ColorMesh(mesh,red#,green#,blue#,alpha#=1)
	Local Surface,Surfaces,Vertices
	
	Surfaces = CountSurfaces(mesh)
	
	For s = 1 To Surfaces
		Surface = GetSurface(mesh,s)
		ColorSurface(Surface,red,green,blue,alpha)
	Next
End Function

Function ColorSurface(surface,red#,green#,blue#,alpha#=1)
	Local Surfaces,Vertices
	
	Vertices = CountVertices(surface)
	
	For v = 0 To Vertices - 1
		VertexColor surface,v,red,green,blue,alpha
	Next
End Function

Comments

None.

Code Archives Forum