surface
AQSIS_V 1.2.0


segment Data

USES 522267

param uniform  float Ka
param uniform  float Kd
param uniform  float Ks
param uniform  float roughness
param uniform  color specularcolor
param uniform  string texturename
varying  normal Nf
varying  vector V
varying  color Ct


segment Init
	pushif 1
	pop Ka
	pushif 0.5
	pop Kd
	pushif 0.5
	pop Ks
	pushif 0.1
	pop roughness
	pushif 1
	setfc
	pop specularcolor
	pushis ""
	pop texturename


segment Code
	S_CLEAR
	pushis ""
	pushv texturename
	ness
	S_GET
	RS_PUSH
	RS_GET
	RS_JZ 1
	pushif 0
	pushv texturename
	pushif 0
	ctexture1
	pop Ct
:1
	RS_JNZ 0
	RS_INVERSE
	pushif 1
	setfc
	pop Ct
:0
	RS_POP
	pushv I
	pushv N
	normalize
	faceforward
	pop Nf
	pushv I
	normalize
	negp
	pop V
	pushv Os
	pop Oi
	pushv roughness
	pushv V
	pushv Nf
	specular
	pushv Ks
	setfc
	pushv specularcolor
	mulcc
	mulcc
	pushv Nf
	diffuse
	pushv Kd
	mulfc
	ambient
	pushv Ka
	mulfc
	addcc
	pushv Ct
	pushv Cs
	mulcc
	mulcc
	addcc
	pushv Os
	mulcc
	pop Ci
