librw/tests/ps2/light.vu

95 lines
1.7 KiB
Plaintext
Raw Normal View History

2015-01-18 18:35:23 +00:00
; Ambient light:
NOP LQ VF26, ambientLight(VI00)
NOP XITOP VI01
2015-06-18 22:05:37 +01:00
NOP IADDIU VI03, VI12, 2
2015-01-18 18:35:23 +00:00
Ambloop:
NOP LQ VF03, 0(VI03) ; output color
NOP NOP
NOP NOP
NOP NOP
ITOF0 VF03, VF03 NOP
NOP NOP
NOP NOP
NOP NOP
ADD VF03, VF03, VF26 NOP
NOP NOP
NOP NOP
NOP NOP
FTOI0 VF03, VF03 NOP
NOP IADDI VI01, VI01, -1
2015-06-18 22:05:37 +01:00
NOP IADDIU VI03, VI03, numOutAttribs
2015-01-18 18:35:23 +00:00
NOP IBNE VI01, VI00, Ambloop
2015-06-18 22:05:37 +01:00
NOP SQ VF03, -numOutAttribs(VI03)
2015-01-18 18:35:23 +00:00
; end amblight
; Direct Light
NOP LQ VF26, lightDir(VI00)
NOP XITOP VI01
NOP XTOP VI02
2015-06-18 22:05:37 +01:00
NOP IADDIU VI03, VI12, 2
2015-01-18 18:35:23 +00:00
SUB.xyz VF26, VF00, VF26 NOP
Dirloop:
NOP LQ VF01, 3(VI02); ; normal
NOP LQ VF02, 0(VI03); ; output color
NOP NOP
NOP NOP
MUL VF03, VF01, VF26 NOP
ITOF0 VF02, VF02 NOP
NOP NOP
NOP NOP
ADDy.x VF03, VF03, VF03y NOP
NOP NOP
NOP NOP
NOP NOP
ADDz.x VF03, VF03, VF03z NOP
NOP NOP
NOP NOP
NOP NOP
MAX.x VF03, VF00, VF03 NOP ; clamp to 0
NOP[I] LOI 255
NOP NOP
NOP NOP
MULi.x VF03, VF03, I NOP
NOP NOP
NOP NOP
NOP NOP
ADDx.xyz VF02, VF02, VF03x NOP
NOP NOP
NOP NOP
NOP NOP
FTOI0 VF02, VF02 NOP
NOP IADDI VI01, VI01, -1
NOP IADDIU VI02, VI02, numInAttribs
2015-06-18 22:05:37 +01:00
NOP IADDIU VI03, VI03, numOutAttribs
2015-01-18 18:35:23 +00:00
NOP IBNE VI01, VI00, Dirloop
2015-06-18 22:05:37 +01:00
NOP SQ VF02, -numOutAttribs(VI03)
2015-01-18 18:35:23 +00:00
; end dirlight
; Material color and clamp
NOP LQ VF27, matColor(VI00)
NOP XITOP VI01
2015-06-18 22:05:37 +01:00
NOP IADDIU VI03, VI12, 2
2015-01-18 18:35:23 +00:00
Colorloop:
NOP LQ VF03, 0(VI03)
NOP NOP
NOP NOP
NOP NOP
ITOF0 VF03, VF03 NOP
NOP NOP
NOP NOP
NOP NOP
MUL VF03, VF03, VF27 NOP
NOP[I] LOI 255
NOP NOP
NOP NOP
MINIi VF03, VF03, I NOP
NOP NOP
NOP NOP
NOP NOP
FTOI0 VF03, VF03 NOP
NOP IADDI VI01, VI01, -1
2015-06-18 22:05:37 +01:00
NOP IADDIU VI03, VI03, numOutAttribs
2015-01-18 18:35:23 +00:00
NOP IBNE VI01, VI00, Colorloop
2015-06-18 22:05:37 +01:00
NOP SQ VF03, -numOutAttribs(VI03)
2015-01-18 18:35:23 +00:00
; end material color