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 GIB3D1+ 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)
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
End Function


RemiD(Posted 1+ years ago)
Your function ColorSurface() should be called something like ColorSurfaceWithVertexColor() because you can also color a surface with a brush or with a texture...

Stevie G(Posted 1+ years ago)
Better to automatically set the fx flags in the function.

Code Archives Forum
Blitz Social Club