I recently added lights to go along with a lens flare effect I am working on in my game and I got a most unwelcome surprise.
The lights seem to make my hud completely black. My hud is made with quad's that are textured, but it seems that the light is causing them to be completely black. Is there any way I can make it so that lights won't affect a particular entity?
I thought this was what the FX fullbright did, but apparently I was wrong. I'll give my code here, excuse my formatting its been awhile since I posted anything and I forget the formatting labels.
----------HUD CODE---------
Global nWinWid=800,nWinHit=600
Global nCameraZoom# = 1
Type hud
Field mesh
Field surface
Field x#
Field y#
Field w#
Field h#
Field ScaleSpeed# ;for any guages, this records the speed at which the guage can scale itself
Field CurrentValue# ;this variable stores what value the guage is currently displaying
Field Brush
Field Alpha
End Type
;------------------------------------------
Function CreateHud.hud(Brush, ScaleSpeed# = 0)
;------------------------------------------
Hud.Hud = New Hud
Hud\ScaleSpeed# = ScaleSpeed#
Hud\mesh=CreateMesh()
Hud\surface=CreateSurface(Hud\mesh)
AddVertex Hud\surface,-1,+1,-1,0,0 : AddVertex Hud\surface,+1,+1,-1,1,0
AddVertex Hud\surface,+1,-1,-1,1,1 : AddVertex Hud\surface,-1,-1,-1,0,1
AddTriangle Hud\surface,0,1,2 : AddTriangle Hud\surface,0,2,3
EntityOrder(Hud\mesh, -1) ; ensure the sprite is drawn after everything else
EntityBlend(Hud\mesh, 1) ; alphamode, use 1 or 3
EntityFX(Hud\mesh, 1)
If Brush > 0 Then PaintEntity(Hud\mesh, Brush)
Hud\Brush = Brush
Return Hud
End Function
;-----------------------------
Function HudParent(Display.hud,camera)
;-----------------------------
EntityParent(Display\mesh,camera)
End Function
;------------------------------------------
Function PlaceHud(Display.hud,x#,y#,w#,h#)
;------------------------------------------
Display\x# = x#
Display\y# = y#
Display\w# = w#
Display\h# = h#
Local cx#,cy#,px#,py#
cx# = x#+(w#/2)
cy# = y#+(h#/2)
px# = 2*(cx#-(Float(nWinWid)/Float(2)))
py# = -2*(cy#-(Float(nWinHit)/Float(2)))
ScaleEntity(Display\mesh,w#,h#,1)
PositionEntity(Display\mesh,px#,py#,nCameraZoom# * nWinWid)
End Function
;------------------------------------------
Function FreeHud(Hud.Hud)
;------------------------------------------
FreeEntity Hud\mesh
Delete Hud
End Function
---------LIGHT CODE-------------
B\HandleNum = CreateLight(1, User\EnvironHandle)
RotateEntity B\HandleNum, -Pitch#, WrapAngle(Yaw#-180), 0
LightColor B\HandleNum, B\Red, B\Green, B\Blue
The lights seem to make my hud completely black. My hud is made with quad's that are textured, but it seems that the light is causing them to be completely black. Is there any way I can make it so that lights won't affect a particular entity?
I thought this was what the FX fullbright did, but apparently I was wrong. I'll give my code here, excuse my formatting its been awhile since I posted anything and I forget the formatting labels.
----------HUD CODE---------
Global nWinWid=800,nWinHit=600
Global nCameraZoom# = 1
Type hud
Field mesh
Field surface
Field x#
Field y#
Field w#
Field h#
Field ScaleSpeed# ;for any guages, this records the speed at which the guage can scale itself
Field CurrentValue# ;this variable stores what value the guage is currently displaying
Field Brush
Field Alpha
End Type
;------------------------------------------
Function CreateHud.hud(Brush, ScaleSpeed# = 0)
;------------------------------------------
Hud.Hud = New Hud
Hud\ScaleSpeed# = ScaleSpeed#
Hud\mesh=CreateMesh()
Hud\surface=CreateSurface(Hud\mesh)
AddVertex Hud\surface,-1,+1,-1,0,0 : AddVertex Hud\surface,+1,+1,-1,1,0
AddVertex Hud\surface,+1,-1,-1,1,1 : AddVertex Hud\surface,-1,-1,-1,0,1
AddTriangle Hud\surface,0,1,2 : AddTriangle Hud\surface,0,2,3
EntityOrder(Hud\mesh, -1) ; ensure the sprite is drawn after everything else
EntityBlend(Hud\mesh, 1) ; alphamode, use 1 or 3
EntityFX(Hud\mesh, 1)
If Brush > 0 Then PaintEntity(Hud\mesh, Brush)
Hud\Brush = Brush
Return Hud
End Function
;-----------------------------
Function HudParent(Display.hud,camera)
;-----------------------------
EntityParent(Display\mesh,camera)
End Function
;------------------------------------------
Function PlaceHud(Display.hud,x#,y#,w#,h#)
;------------------------------------------
Display\x# = x#
Display\y# = y#
Display\w# = w#
Display\h# = h#
Local cx#,cy#,px#,py#
cx# = x#+(w#/2)
cy# = y#+(h#/2)
px# = 2*(cx#-(Float(nWinWid)/Float(2)))
py# = -2*(cy#-(Float(nWinHit)/Float(2)))
ScaleEntity(Display\mesh,w#,h#,1)
PositionEntity(Display\mesh,px#,py#,nCameraZoom# * nWinWid)
End Function
;------------------------------------------
Function FreeHud(Hud.Hud)
;------------------------------------------
FreeEntity Hud\mesh
Delete Hud
End Function
---------LIGHT CODE-------------
B\HandleNum = CreateLight(1, User\EnvironHandle)
RotateEntity B\HandleNum, -Pitch#, WrapAngle(Yaw#-180), 0
LightColor B\HandleNum, B\Red, B\Green, B\Blue