MiniB3D Thread 2

BlitzMax Modules Forums/MiniB3D/MiniB3D Thread 2

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.

anawiki - I couldn't replicate the multiple lights issue. Could you post an example?

Here's my own example - put it in the tests folder - has two lights, seems to work fine:

Import "../MiniB3D.bmx"

Local width=640,height=480,depth=16,mode=0

Graphics3D width,height,depth,mode
AmbientLight 32,32,32

Local cam=CreateCamera()
PositionEntity cam,0,0,-60

Local light=CreateLight(2)
LightColor light,255,0,0
LightRange light,5
PositionEntity light,0,0,0

Local light2=CreateLight(2)
LightColor light2,255,255,0
LightRange light2,5
PositionEntity light2,10,0,0

Local ent1=LoadAnimMesh("media/grid.b3d")
Local ent2=CopyEntity(ent1)

PositionEntity ent1,0,10,0
PositionEntity ent2,0,-10,0

RotateEntity ent1,180,0,0

Local ent3=CreateSphere(20)
Local ent4=CreateSphere(20)

PositionEntity ent3,-10,0,0
PositionEntity ent4,10,0,0

ScaleEntity ent3,4,4,4
ScaleEntity ent4,4,4,4

Local cx#=0
Local cy#=0
Local cz#=0

Local pitch#=0
Local yaw#=0
Local roll#=0

' used by fps code
Local old_ms=MilliSecs()
Local renders
Local fps

While Not KeyDown(KEY_ESCAPE)		

	If KeyHit(KEY_ENTER) Then DebugStop

	' control camera

	If KeyDown(KEY_UP) Then cz#=cz#+1.0
	If KeyDown(KEY_LEFT) Then cx#=cx#-1.0
	If KeyDown(KEY_RIGHT) Then cx#=cx#+1.0
	If KeyDown(KEY_DOWN) Then cz#=cz#-1.0
	
	If KeyDown(KEY_W) Then pitch#=pitch#-1.0
	If KeyDown(KEY_A) Then yaw#=yaw#+1.0
	If KeyDown(KEY_S) Then pitch#=pitch#+1.0
	If KeyDown(KEY_D) Then yaw#=yaw#-1.0

	MoveEntity cam,cx#*0.5,cy#*0.5,cz#*0.5
	RotateEntity cam,pitch#,yaw#,roll#

	cx#=0
	cy#=0
	cz#=0

	'
	
	RenderWorld
	renders=renders+1
	
	' calculate fps
	If MilliSecs()-old_ms>=1000
		old_ms=MilliSecs()
		fps=renders
		renders=0
	EndIf
	
	GLDrawText "FPS: "+String(fps),0,0

	Flip

Wend
End