/* ctexmap.sl used for project II -----------------------*/ /* Name: Phuc Nguyen Danny Ho */ /* Login: cs184-dh cs184-dl */ /* SID: 13547274 */ /* ---------------------------------------------------------*/ /* --------------------------------------------------------- */ /* texmap - texture-map shader */ /* */ /* This puts a COLOR texture map onto a surface. */ /* Parameters: */ /* texname - the name of the texture file */ /* */ /* roughness (float) - to adjust the brighness */ /* ----------------------------------------------------------*/ surface ctexmap(string texname = ""; float Ka=1, Kd=.5, Ks=.8, roughness=.1; color specularcolor = 1) { uniform float ssize, tsize; varying vector Nf, NI; float strength; Nf = faceforward( normalize(N), I); if (texname == "") Ci = Cs; else Ci = color texture(texname); Oi = Os; Ci = Os * (Ci * (Ka*ambient() + Kd*diffuse(Nf)) + Ks*specularcolor*specular(Nf,-I,roughness)); }