#VRML V2.0 utf8

Viewpoint {
  position 2 2 2
  orientation -0.590285 0.769274 0.244504 0.987861
  fieldOfView 0.785398
  description "ViewPoint 1"
}

NAME neutral PhBXYZSpectrum {xyz 1 1 1}


NAME Light PhBHomogeneousSurface {
   edf PhBEDF {
      intensity 10000.   		# [lux]
      spectrum USE neutral
      emitter PhBDiffuseEmitter { }
   }
}


NAME BumpMap PhBBumpMap {
   height 10
   texture PhBNoiseTexture { k .05 }
}


PROTO QuadFace [
 exposedField MFVec3f points [ ]
] {
   IndexedFaceSet {
      coord Coordinate {
	 point IS points
      }
      coordIndex [ 0 1 2 3 ]
      colorPerVertex FALSE
      normalPerVertex FALSE
      solid FALSE
   }
}

PROTO WardSurface [
 exposedField SFFloat rho_d 1. ,
 exposedField SFNode  spectrum_d NULL,
 exposedField SFFloat rho_s 0. ,
 exposedField SFNode  spectrum_s NULL,
 exposedField SFFloat alpha_x 0.1 ,
 exposedField SFFloat alpha_y 0.1
] {
   PhBHomogeneousSurface {
      bsdf [ PhBSimpleBSDF {
	 intensity IS rho_d
	 spectrum IS spectrum_d
	 scatterer PhBDiffuseReflector {}
      }
	     , PhBSimpleBSDF {
	 intensity IS rho_s
	 spectrum IS spectrum_s
	 scatterer PhBWardReflector {
	    standardDeviationX IS alpha_x
	    standardDeviationY IS alpha_y
	 }
      }
     ]
   }
}

NAME rolledbrass WardSurface {
   rho_d 0.10
   rho_s 0.33
   alpha_x 0.050
   alpha_y 0.16
}


Transform {
   children [ Shape {
      geometry Box { }
      appearance PhBAppearance {
	 bumpMap USE BumpMap
	 surface USE rolledbrass
      }
   },
      Transform {                  # first light
	 translation 10 5 5           
	 children Shape {
	    geometry QuadFace { points 
	  [ -1  1 -1
	    -1 -1 -1
	    -1 -1  1
	    -1  1  1 ]
      }
	    appearance PhBAppearance {
	       surface USE Light
	    }
	 }
      }
  ]
}

