I need help! Can someone please tell me where I'm going wrong here?
I'm manually creating surfaces and they seem to be fine, except that I can't get Blitz to understand that I want them to be affected by lights in the scene! I can only see them if I set the AmbientLight values quite high, or if I use EntityFX to turn full-bright on.
If I replace the MakeFace call with CreateCube(), then scale the cube to the required size and texture it, it works okay.
So what am I missing?
;------------
Graphics3D 640, 480, 0, 2
SetBuffer BackBuffer()
camera = CreateCamera()
PositionEntity camera, 0, 0, -10
light=CreateLight()
RotateEntity light, 75, 0, 0
Global tex = LoadTexture("texture.bmp")
b = MakeFace(4, 5)
While Not KeyHit(1)
TurnEntity b, .5, 0, 1
UpdateWorld
RenderWorld
Flip
Wend
End
Function MakeFace(h#, w#)
mesh = CreateMesh()
brush = CreateBrush()
BrushTexture brush, tex
surf = CreateSurface(mesh, brush)
v0 = AddVertex (surf, -w, h, 0, 0, 0 )
v1 = AddVertex (surf, -w, -h, 0, 0, 1 )
v2 = AddVertex (surf, w, -h, 0, 1, 1 )
v3 = AddVertex (surf, w, h, 0, 1, 0 )
tri = AddTriangle (surf, v0, v3, v2)
tri = AddTriangle (surf, v0, v2, v1)
Return mesh
End Function; MakeFace
;---------
I'm manually creating surfaces and they seem to be fine, except that I can't get Blitz to understand that I want them to be affected by lights in the scene! I can only see them if I set the AmbientLight values quite high, or if I use EntityFX to turn full-bright on.
If I replace the MakeFace call with CreateCube(), then scale the cube to the required size and texture it, it works okay.
So what am I missing?
;------------
Graphics3D 640, 480, 0, 2
SetBuffer BackBuffer()
camera = CreateCamera()
PositionEntity camera, 0, 0, -10
light=CreateLight()
RotateEntity light, 75, 0, 0
Global tex = LoadTexture("texture.bmp")
b = MakeFace(4, 5)
While Not KeyHit(1)
TurnEntity b, .5, 0, 1
UpdateWorld
RenderWorld
Flip
Wend
End
Function MakeFace(h#, w#)
mesh = CreateMesh()
brush = CreateBrush()
BrushTexture brush, tex
surf = CreateSurface(mesh, brush)
v0 = AddVertex (surf, -w, h, 0, 0, 0 )
v1 = AddVertex (surf, -w, -h, 0, 0, 1 )
v2 = AddVertex (surf, w, -h, 0, 1, 1 )
v3 = AddVertex (surf, w, h, 0, 1, 0 )
tri = AddTriangle (surf, v0, v3, v2)
tri = AddTriangle (surf, v0, v2, v1)
Return mesh
End Function; MakeFace
;---------