displacement
AQSIS_V 1.2.0


segment Data

USES 14616

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
:0
	S_CLEAR
	pushv maxoctaves
	pushv i
	lsff
	S_GET
	S_JZ 1
	RS_PUSH
	RS_GET
	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
	pushif 1
	pushv i
	addff
	pop i
	RS_POP
	jmp 0
:1
	pushv N
	normalize
	pushv power
	pushv magnitude
	pow
	pushv Km
	mulff
	mulfp
	pushv P
	subpp
	pop P
	pushv P
	calculatenormal
	pop N
