mt
Class MT_MarbleTexture

Object
  extended by common:Generic
      extended by common:TrapShape
          extended by mt:MT_MarbleTexture

class 
TrapShape:MT_MarbleTexture

Mark Townsend, May 2008


Ultra Fractal Source

Toggle UF Source Code Display

 class MT_MarbleTexture(common.ulb:TrapShape) {
 ;
 ; Mark Townsend, May 2008
 ;
 public:
   float func Triangle_Wave(float value)
     float offset
     if (value >= 0.0)
       offset = value - floor(value)
     else
       offset = value + 1.0 + floor(abs(value))
     endif
     if (offset >= 0.5)
       return 1.0 - offset
     else
       return offset
     endif
   endfunc
 
   func MT_MarbleTexture(Generic pparent)
     TrapShape.TrapShape(pparent)
     fTurbulence = new @p_turbulence(this)
   endfunc
   
   func Init(complex pz)
     fTurbulence.Init(pz)
   endfunc
 
   float func Iterate(complex pz)
     TrapShape.Iterate(pz)
     if @wave == "Sine"
       float a = 0.5 * (sin(@p_frequency * real(pz) + (@p_amount * fTurbulence.Iterate(pz))) + 1)
     elseif @wave == "Sine 2"
       float a = sin(@p_frequency * real(pz) + (@p_amount * fTurbulence.Iterate(pz))) + 1
     else
       a = triangle_wave(@p_frequency * real(pz) + (@p_amount * fTurbulence.Iterate(pz)))
     endif
     return a
   endfunc
 
 private:
   TrapShape fTurbulence
 
 default:
   title = "Marble Texture"
   param wave
     caption = "Wave"
     enum = "Sine" "Sine 2" "Triangle"
   endparam
   TrapShape param p_turbulence
     caption = "Turbulence"
     default = MT_PerlinNoiseTexture
   endparam
   float param p_frequency
     caption = "Frequency"
     default = 10
   endparam
   float param p_amount
     caption = "Amount"
     default = 10
   endparam
 }
 


Constructor Summary
MT_MarbleTexture()
           
MT_MarbleTexture(Generic pparent)
           
 
Method Summary
 void Init(complex pz)
          call this before each sequence of values to be trapped
 float Iterate(complex pz)
          call this for each iteration being trapped
 float Triangle_Wave(float value)
           
 
Methods inherited from class common:TrapShape
GetColorChannel, GetTextureValue, GetTransformedPoint, IterateSilent, SetThreshold
 
Methods inherited from class common:Generic
GetParent
 
Methods inherited from class Object
 

Constructor Detail

MT_MarbleTexture

public MT_MarbleTexture(Generic pparent)

MT_MarbleTexture

public MT_MarbleTexture()
Method Detail

Triangle_Wave

public float Triangle_Wave(float value)

Init

public void Init(complex pz)
Description copied from class: TrapShape
call this before each sequence of values to be trapped

Overrides:
Init in class TrapShape

Iterate

public float Iterate(complex pz)
Description copied from class: TrapShape
call this for each iteration being trapped

Overrides:
Iterate in class TrapShape