2017-08-12 09:25:25 +01:00
|
|
|
; Ambient light:
|
2017-08-12 20:24:19 +01:00
|
|
|
NOP LQ VF26, ambientLight(VI00)
|
|
|
|
NOP XITOP VI01
|
|
|
|
NOP IADDIU VI03, VI12, 2
|
2017-08-12 09:25:25 +01:00
|
|
|
Ambloop:
|
2017-08-12 20:24:19 +01:00
|
|
|
NOP LQ VF03, 0(VI03) ; output color
|
|
|
|
NOP NOP
|
|
|
|
NOP NOP
|
|
|
|
NOP NOP
|
|
|
|
ITOF0 VF03, VF03 NOP
|
|
|
|
NOP NOP
|
|
|
|
NOP NOP
|
|
|
|
NOP NOP
|
|
|
|
ADD.xyz VF03, VF03, VF26 NOP
|
|
|
|
NOP NOP
|
|
|
|
NOP NOP
|
|
|
|
NOP NOP
|
|
|
|
FTOI0 VF03, VF03 NOP
|
|
|
|
NOP IADDI VI01, VI01, -1
|
|
|
|
NOP IADDIU VI03, VI03, numOutAttribs
|
|
|
|
NOP IBNE VI01, VI00, Ambloop
|
|
|
|
NOP SQ VF03, -numOutAttribs(VI03)
|
2017-08-12 09:25:25 +01:00
|
|
|
; end amblight
|
|
|
|
|
|
|
|
; Direct Light
|
2017-08-12 20:24:19 +01:00
|
|
|
NOP LQ VF26, lightDir(VI00)
|
|
|
|
NOP XITOP VI01
|
|
|
|
NOP XTOP VI02
|
|
|
|
NOP IADDIU VI03, VI12, 2
|
2017-08-12 09:25:25 +01:00
|
|
|
SUB.xyz VF26, VF00, VF26 NOP
|
|
|
|
Dirloop:
|
2017-08-12 20:24:19 +01:00
|
|
|
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
|
2017-08-12 09:25:25 +01:00
|
|
|
ADDy.x VF03, VF03, VF03y NOP
|
2017-08-12 20:24:19 +01:00
|
|
|
NOP NOP
|
|
|
|
NOP NOP
|
|
|
|
NOP NOP
|
2017-08-12 09:25:25 +01:00
|
|
|
ADDz.x VF03, VF03, VF03z NOP
|
2017-08-12 20:24:19 +01:00
|
|
|
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
|
2017-08-12 09:25:25 +01:00
|
|
|
ADDx.xyz VF02, VF02, VF03x NOP
|
2017-08-12 20:24:19 +01:00
|
|
|
NOP NOP
|
|
|
|
NOP NOP
|
|
|
|
NOP NOP
|
|
|
|
FTOI0 VF02, VF02 NOP
|
|
|
|
NOP IADDI VI01, VI01, -1
|
|
|
|
NOP IADDIU VI02, VI02, numInAttribs
|
|
|
|
NOP IADDIU VI03, VI03, numOutAttribs
|
|
|
|
NOP IBNE VI01, VI00, Dirloop
|
|
|
|
NOP SQ VF02, -numOutAttribs(VI03)
|
2017-08-12 09:25:25 +01:00
|
|
|
; end dirlight
|
|
|
|
|
|
|
|
; Material color and clamp
|
2017-08-12 20:24:19 +01:00
|
|
|
NOP LQ VF27, matColor(VI00)
|
|
|
|
NOP XITOP VI01
|
|
|
|
NOP IADDIU VI03, VI12, 2
|
2017-08-12 09:25:25 +01:00
|
|
|
Colorloop:
|
2017-08-12 20:24:19 +01:00
|
|
|
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
|
|
|
|
NOP IADDIU VI03, VI03, numOutAttribs
|
|
|
|
NOP IBNE VI01, VI00, Colorloop
|
|
|
|
NOP SQ VF03, -numOutAttribs(VI03)
|
2017-08-12 09:25:25 +01:00
|
|
|
; end material color
|