mt
Class MT_BumpMapsTexture
Object
common:Generic
common:TrapShape
mt:MT_BumpMapsTexture
class
- TrapShape:MT_BumpMapsTexture
Based on formulas by David Makin and Damien Jones
Mark Townsend, May 2008
Ultra Fractal Source
Toggle UF Source Code Display
class MT_BumpMapsTexture(common.ulb:TrapShape) {
;
; Based on formulas by David Makin and Damien Jones
; <p>
; Mark Townsend, May 2008
;
public:
func MT_BumpMapsTexture(Generic pparent)
TrapShape.TrapShape(pparent)
fTrapShape[0] = new @TrapShapeClass(this)
fTrapShape[1] = new @TrapShapeClass(this)
fTrapShape[2] = new @TrapShapeClass(this)
endfunc
float func Iterate(complex pz)
float e1 = fTrapShape[0].Iterate(pz)
float vx = fTrapShape[1].Iterate(pz + @offset) - e1
float vy = fTrapShape[2].Iterate(pz + flip(@offset)) - e1
float vd = 1 / sqrt(sqr(vx) + sqr(vy) + sqr(@offset))
complex z = vd * (vx + flip(vy))
float vz = -sqrt(1 - |z|)
float d2r = #pi / 180
float lx = cos((270 - @angle) * d2r) * cos(@elevation * d2r)
float ly = sin((270 - @angle) * d2r) * cos(@elevation * d2r)
float lz = -sin(@elevation * d2r)
float l = lx * real(z) + ly * imag(z) + lz * vz
if (l < @ambient)
l = @ambient
endif
if (@ambient < 0)
l = l + 1
endif
if @invert
return 1 - l
else
return l * 0.99
endif
endfunc
private:
TrapShape fTrapShape[3]
default:
title = "Bump Maps Texture"
TrapShape param TrapShapeClass
caption = "Texture"
default = MT_PerlinNoiseTexture
endparam
float param offset
caption = "Orbit Separation"
default = 0.00000001
exponential = true
hint = "Defines how far apart the simultaneous orbits are. Smaller \
distances will produce more accurate results, the deeper you zoom \
the smaller the value needs to be to keep detail."
endparam
param @angle
caption = "Light Rotation"
default = 90.0
hint = "Gives the rotation of the light source, in degrees. With 0 \
degrees, the light comes from above. Positive values give \
clockwise rotation."
endparam
param @elevation
caption = "Light Elevation"
default = 30.0
hint = "Gives the elevation of the light source, in degrees."
endparam
param @ambient
caption = "Ambient Light"
default = 0.0
min = -1.0
max = 1.0
hint = "Specifies the level of ambient light. Use -1.0 to \
color all surfaces."
endparam
bool param @invert
caption = "Invert Value"
default = true
endparam
}
Method Summary |
float |
Iterate(complex pz)
call this for each iteration being trapped |
Methods inherited from class Object |
|
MT_BumpMapsTexture
public MT_BumpMapsTexture(Generic pparent)
MT_BumpMapsTexture
public MT_BumpMapsTexture()
Iterate
public float Iterate(complex pz)
- Description copied from class:
TrapShape
- call this for each iteration being trapped
- Overrides:
Iterate
in class TrapShape