displacement
AQSIS_V 1.1.0


segment Data

USES 63768

param uniform  float Km
param uniform  float truedisp
param uniform  string texturename
param uniform  float furfreq
param uniform  float furval
varying  normal NN
varying  float mag
varying  float texVal
varying  float cx
varying  float cy
varying  float cz
varying  color texCol
varying  vector disp


segment Init
	pushif 0.1
	pop Km
	pushif 1
	pop truedisp
	pushis ""
	pop texturename
	pushif 10
	pop furfreq
	pushif 10
	pop furval


segment Code
	pushv N
	normalize
	pop NN
	pushif 0
	pop mag
	pushif 0
	pushif 0
	pushif 0
	settv
	pop disp
	S_CLEAR
	pushis ""
	pushv texturename
	ness
	S_GET
	RS_PUSH
	RS_GET
	RS_JZ 0
	pushif 0
	pushv texturename
	pushif 0
	ctexture1
	pop texCol
	pushif 0
	pushv texturename
	pushif 0
	ftexture1
	pop texVal
	S_CLEAR
	pushif 0.0001
	pushif 0
	pushv texCol
	comp
	gtff
	S_GET
	RS_PUSH
	RS_GET
	RS_JZ 2
	pushv P
	pushv furfreq
	mulfp
	noise3
	pushif 0
	pushv texCol
	comp
	pushv furval
	mulff
	mulff
	pop mag
	pushv NN
	pushv Km
	pushv mag
	mulff
	mulfp
	pop disp
	pushv disp
	xcomp
	frandom
	mulff
	pop cx
	pushv disp
	ycomp
	frandom
	mulff
	pop cy
	pushv disp
	zcomp
	frandom
	mulff
	pop cz
	pushv cx
	pushv disp
	setxcomp
	pushv cy
	pushv disp
	setycomp
	pushv cz
	pushv disp
	setzcomp
:2
	RS_JNZ 1
	RS_INVERSE
	pushv NN
	pushv Km
	pushv mag
	mulff
	mulfp
	pop disp
:1
	RS_POP
:0
	RS_POP
	S_CLEAR
	pushif 1
	pushv truedisp
	eqff
	S_GET
	RS_PUSH
	RS_GET
	RS_JZ 4
	pushv disp
	pushv P
	subpp
	pop P
	pushv P
	calculatenormal
	pop N
:4
	RS_JNZ 3
	RS_INVERSE
	pushv disp
	pushv P
	subpp
	calculatenormal
	pop N
:3
	RS_POP
