#VRML V2.0 utf8


Viewpoint {
  position 1.22798 4.37156 4.4094
  orientation -0.998828 0.045177 0.0173584 0.734462
  fieldOfView 0.785398
  description "ViewPoint 1"
}

NAME neutral PhBXYZSpectrum {xyz 1 1 1}

NAME red PhBXYZSpectrum { xyz   0.514145 0.265106 0.024101    }
NAME green PhBXYZSpectrum { xyz   0.323884 0.670106 0.122853    }
NAME blue PhBXYZSpectrum { xyz    0.161971 0.064788 0.853047   }

PROTO AshikminSurface [
  exposedField SFFloat rho_d 1.
  exposedField SFNode  spectrum_d NULL
  exposedField SFFloat rho_s 0.
  exposedField SFNode  spectrum_s NULL
  exposedField SFFloat u  1. # nu
  exposedField SFFloat v  1. # nv

] {
   PhBHomogeneousSurface {
      bsdf [
	    PhBSimpleBSDF {
	       intensity IS rho_s
	       spectrum IS spectrum_s
	       scatterer PhBAshikminReflector {
		  nu IS u
		  nv IS v
	       }
	    },
	    PhBSimpleBSDF {
	       intensity IS rho_d
	       spectrum IS spectrum_d
	       scatterer PhBDiffuseReflector {}
	    }
	   ]
   }
}

NAME DiffRed PhBHomogeneousSurface {
   bsdf PhBSimpleBSDF {
      intensity .5
      spectrum USE red
      scatterer PhBDiffuseReflector {}
   }
}

NAME DiffGreen PhBHomogeneousSurface {
   bsdf PhBSimpleBSDF {
      intensity .5
      spectrum USE green
      scatterer PhBDiffuseReflector {}
   }
}


NAME DiffBlue PhBHomogeneousSurface {
   bsdf PhBSimpleBSDF {
      intensity .5
      spectrum USE blue
      scatterer PhBDiffuseReflector {}
   }
}

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

NAME A AshikminSurface {
   rho_d 0.0
   spectrum_d USE neutral
   rho_s 1.0
   spectrum_s USE neutral
   v 10.
   u 100.
}

NAME TextMap PhBTexturedSurface {
   texture PhBBilinearInterpolation {
      texture PhBImageTexture {  url "thing.ppm"
                                clamping FALSE
                                repeating TRUE }
   }

   textureTransform TextureTransform {
      scale 8.0 8.0
      translation .5 .5
   }

   surfaces [ USE DiffRed, USE DiffGreen,  USE DiffBlue ]
   textureProjection PhBBoxTextureProjection { size 40 .1 40 }
}

Transform {
   children [ Shape {
      geometry Box { size 40 .1 40 }
      appearance PhBAppearance {
	 surface USE TextMap
      }
   }, Transform {
      translation 1.25 1.25 1.25
      children Shape {
	 geometry Sphere { radius 1.25 }
	 appearance PhBAppearance {
	    surface USE A
	    textureProjection PhBSphereTextureProjection {}
	 }
      }
   },
      Transform {                  # first light
	 translation 7.5 15 15           
	 children Shape {
	    geometry Sphere { radius .1 }
	    appearance PhBAppearance {
	       surface USE Light
	    }
	 }
      }
  ]
}
