dx lighting and tris

Blitz3D Forums/Blitz3D Programming/dx lighting and tris

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Heh nice example ross.. hmmm sadly though i get quite a diffrent effect when using this approach.. This is odd... Gonna strip out some stuff until it works then start adding back in until i find out whats causing it..

Also, im sure this has been covered... EntityAlpha() on meshes set to use vertex coloring (entityfx mesh,2) dosent work.. its either all the way on or all the way off. Im sure its because setting fx 2 truns off alphablending ?

Try ross's example with enityfx command remed out, then try it on..

Graphics3D 800,600
SetBuffer BackBuffer()

light=CreateLight()

piv=CreatePivot()
cam=CreateCamera(piv): CameraClsColor cam,255,0,0
PositionEntity cam,0,2,10
PointEntity cam,piv

Global mesh=CreateMesh()
Global surf=CreateSurface(mesh)
Global angle#=0
EntityFX mesh,2
EntityAlpha mesh,.5

v0	= AddVertex(surf,-1 ,  1 , 0 , 0 ,0  )
v1	= AddVertex(surf, 1 ,  1 , 0 , 0 ,0  )
v2	= AddVertex(surf,-1 , -1 , 0 , 0 ,0  )
v3	= AddVertex(surf, 1 , -1 , 0 , 0 ,0  )
tri	= AddTriangle(surf,v0,v1,v2)
tri1= AddTriangle(surf,v1,v3,v2)

UpdateNormals(mesh)



While Not KeyHit(1)

	
	angle=angle+1
	TurnEntity piv,0,1,0
	rotate()
	
	
	UpdateWorld
	RenderWorld
	Flip
Wend
End

Function rotate()
	VertexCoords(surf,0,	Cos(angle),	 	 1,	 Sin(angle)	 )
	VertexCoords(surf,1,	Cos(angle+180),	 1,	 Sin(angle+180) )
	VertexCoords(surf,2,	Cos(angle)	,	-1,	 Sin(angle)	 )
	VertexCoords(surf,3,	Cos(angle+180),	-1,	 Sin(angle+180))
	UpdateNormals(mesh)
End Function





Ross, thanks.
Sswift, thanks.