displacement
AQSIS_V 1.6.0


segment Data

USES 2304

param uniform  float Km
param uniform  float power
param uniform  float frequency
param uniform  float maxoctaves
varying  float size
varying  float magnitude
varying  float i
varying  point PP


segment Init
	pushif 1
	pop Km
	pushif 3
	pop power
	pushif 1
	pop frequency
	pushif 6
	pop maxoctaves


segment Code
	pushif 0
	pop magnitude
	pushv P
	pushis "shader"
	transform
	pop PP
	pushv frequency
	pop size
	pushif 0
	pop i
	RS_PUSH
:0
	S_CLEAR
	pushv maxoctaves
	pushv i
	lsff
	S_GET
	S_JZ 1
	RS_GET
	RS_PUSH
	pushv size
	pushv size
	setfp
	pushv PP
	mulpp
	noise3
	pushif 0.5
	subff
	abs
	divff
	pushv magnitude
	addff
	pop magnitude
	pushif 2
	pushv size
	mulff
	pop size
	RS_POP
	pushif 1
	pushv i
	addff
	pop i
	jmp 0
:1
	RS_POP
	pushv N
	normalize
	pushv power
	pushv magnitude
	pow
	pushv Km
	mulff
	mulfp
	pushv P
	subpp
	pop P
	pushv P
	calculatenormal
	pop N
