EntityAlpha on Terrains

Blitz3D Forums/Blitz3D Programming/EntityAlpha on Terrains

Just cooked this up, also learned a thing about how to UV map vertices here as well on a single quad.....hope it helps ya any :

Graphics3D 640,480,0,2


Global thingy = CreateMesh() ; Create Mesh

CreateQuad(thingy,2,3) ; Create a Quad within the mesh


cam = CreateCamera()
PositionEntity cam, 0,3,-4
RotateEntity cam, 45,0,0
CameraClsColor cam, 100,100,100


tex1 = CreateTexture(128,128)
tex2 = CreateTexture(128,128)
tex3 = CreateTexture(128,128)

SetBuffer TextureBuffer(tex1)
Color 255,255,255
Rect 0,0,128,128
Color 255,0,0
Rect 0,0,75,75
	  
SetBuffer TextureBuffer(tex2)
Color 255,255,255
Rect 0,0,128,128
Color 0,255,0
Rect 25,25,75,75 

SetBuffer TextureBuffer(tex3)
Color 255,255,255
Rect 0,0,128,128
Color 0,0,255
Rect 55,55,75,75 



EntityTexture thingy, tex1,0,1
EntityTexture thingy, tex2,0,2
EntityTexture thingy, tex3,0,3

EntityFX thingy, 1 


SetBuffer BackBuffer()
While Not KeyHit(1)
Cls

TurnEntity thingy, 0.15,0.5,0.2

UpdateWorld
RenderWorld


Flip
Wend
End




;thinger = the mesh you passed on to get a quad embedded on, SX = ScaleX, SZ = ScaleZ
Function CreateQuad(thinger, sx,sz) 

	otherthingy = CreateSurface(thinger)
	
	v0 = AddVertex(otherthingy, (-1*sx),0, (1*sz),0,0)   ;top-left
	v1 = AddVertex(otherthingy, (-1*sx),0, (-1*sz),0,1)  ;bottom-left
	v2 = AddVertex(otherthingy, (1*sx),0, (1*sz),1,0)    ;top-right
	v3 = AddVertex(otherthingy, (1*sx),0, (-1*sz),1,1)   ;bottom-right
	 
	tri1 = AddTriangle(otherthingy,v0,v2,v1)  ;   top-left  tri
	tri2 = AddTriangle(otherthingy,v1,v2,v3)  ;bottom-Right tri

End Function



Any chance someone knows how to get the textures so they dont have the multiply effect, but are also masked?
(tried using flag 4 on texture while using textureblend to disable the multiply effect, but it aint workin)

BTW, this is the first time in a long...long while I've ever actually coded something in B3d....
(never really got around to making an actual 3d game, still tryin to make a 2d-platformer here)