POV-Ray : Newsgroups : povray.newusers : MMacros Server Time
4 Nov 2024 17:36:16 EST (-0500)
  MMacros (Message 1 to 1 of 1)  
From: leseur sylvain
Subject: MMacros
Date: 24 Apr 2003 12:48:05
Message: <3ea81545@news.povray.org>
//How can i use this kind of macros texture ???
//Thanks a lot
//Friendly
//.Sylvain
//
//
//



// usage:
//(PatternNumber : 0 - 30)
//pigment { P_Checker(PatternNumber, pigment1, pigment2)  }
//texture { T_Checker(PatternNumber, texture1, texture2)  }
//
//(PatternNumber : 0 - 99)
//pigment { P_Checker2(PatternNumber, pigment1, pigment2)  }
//texture { T_Checker2(PatternNumber, texture1, texture2)  }
//
//(PatternNumber : 0 - 10)
//pigment { P_Hexagon(PatternNumber,pigment1,pigment2, pigment3)}
//texture { T_Hexagon(PatternNumber,texture1,texture2, texture3)}
//
//(PatternNumber : 0 - 3)
//pigment { P_Hexagon2(PatternNumber,pigment1,pigment2,pigment3,pigment4) }
//texture { T_Hexagon2(PatternNumber,texture1,texture2,texture3,texture4) }
//
// ----------------------------------------------------------------------
//

#macro P_CheckerSub(Pigment1, Pigment2)
    checker
    pigment {Pigment1}
    pigment {Pigment2}
#end

#macro P_Checker(PatternNo, Pigment1, Pigment2)
    #switch (PatternNo)
    #case (1)
        P_CheckerSub(Pigment1, Pigment2)
        rotate y*45
        rotate -x*degrees(acos(1/sqrt(3)))
    #break
    #case (2)
        P_CheckerSub(Pigment1, Pigment2)
        rotate y*45
        rotate -x*degrees(acos(1/sqrt(3)))
        scale <1,1/sqrt(3),1/sqrt(3)>
        rotate y*-45
    #break
    #case (3)
        checker
        pigment {P_CheckerSub(Pigment1, Pigment2) scale 1/4}
        pigment {P_CheckerSub(Pigment1, Pigment2) scale 1/2}

    #else
        P_CheckerSub(Pigment1, Pigment2)
    #end
    scale <1,1e6,1>
#end




//////////////////////////////////////////////////////////
#macro T_CheckerSub(Texture1, Texture2)
    checker
    texture {Texture1}
    texture {Texture2}
#end

#macro T_Checker(PatternNo, Texture1, Texture2)
    #switch (PatternNo)
    #case (1)
        T_CheckerSub(Texture1, Texture2)
        rotate y*45
        rotate -x*degrees(acos(1/sqrt(3)))
    #break
    #case (2)
        T_CheckerSub(Texture1, Texture2)
        rotate y*45
        rotate -x*degrees(acos(1/sqrt(3)))
        scale <1,1/sqrt(3),1/sqrt(3)>
        rotate y*-45
    #break
    #case (3)
        checker
        texture {T_CheckerSub(Texture1, Texture2) scale 1/4}
        texture {T_CheckerSub(Texture1, Texture2) scale 1/2}
    #break


    #else
        T_CheckerSub(Texture1, Texture2)
    #end
    scale <1,1e6,1>
#end




////////////////////////////////////////////////////////////
#macro P_Checker2Sub(Pigment1, Pigment2, Sc1, Sc2)
    wood
    pigment_map {
      [.5/Sc1  Pigment1]
      [.5/Sc1  Pigment2]
    }
    ramp_wave
    scale Sc2
    rotate x*90
#end

#macro P_Checker2(PatternNo, Pigment1, Pigment2)
    #switch (PatternNo)
    #case (1)
        checker  pigment {
            P_Checker2Sub(Pigment1, Pigment2, 10, 20)
            scale .5
            translate <.5,0,.5>
            warp {repeat x}
            warp {repeat z}
        }
        pigment {
            P_Checker2Sub(Pigment2, Pigment1, 10, 20)
            scale .5
            translate <.5,0,.5>
            warp {repeat x}
            warp {repeat z}
        }
        scale 2
    #break
    #case (2)
        checker   pigment {
            P_Checker2Sub(Pigment1, Pigment2, 10, 10)
            scale .5
            translate <.5,0,.5>
            warp {repeat x}
            warp {repeat z}
        }
        pigment {
            P_Checker2Sub(Pigment2, Pigment1, 10, 10)
            scale .5
            translate <.5,0,.5>
            warp {repeat x}
            warp {repeat z}
        }
        scale 2
    #break
    #case (3)
        checker  pigment {
            P_Checker2Sub(Pigment1, Pigment2, 1, 1)
            scale .5
            translate <.5,0,.5>
            warp {repeat x}
            warp {repeat z}
        }
        pigment {
            P_Checker2Sub(Pigment2, Pigment1, 1, 1)
            scale .5
            translate <.5,0,.5>
            warp {repeat x}
            warp {repeat z}
        }
        scale 2
    #break


    #else
        P_Checker2Sub(Pigment1, Pigment2, 20, 20)
        translate <.5,0,.5>
        warp {repeat x}
        warp {repeat z}
        scale 2
    #end
    scale <1,1e6,1>
#end




////////////////////////////////////////////////////
#macro T_Checker2Sub(Texture1, Texture2, Sc1, Sc2)
    wood    texture_map {
      [.5/Sc1  Texture1]
      [.5/Sc1  Texture2]
    }
    ramp_wave
    scale Sc2
    rotate x*90
#end

#macro T_Checker2(PatternNo, Texture1, Texture2)
    #switch (PatternNo)
    #case (1)
        checker texture {
            T_Checker2Sub(Texture1, Texture2, 10, 20)
            scale .5
            translate <.5,0,.5>
            warp {repeat x}
            warp {repeat z}
        }
        texture {
            T_Checker2Sub(Texture2, Texture1, 10, 20)
            scale .5
            translate <.5,0,.5>
            warp {repeat x}
            warp {repeat z}
        }
        scale 2
    #break
    #case (2)
        checker  texture {
            T_Checker2Sub(Texture1, Texture2, 10, 10)
            scale .5
            translate <.5,0,.5>
            warp {repeat x}
            warp {repeat z}
        }
        texture {
            T_Checker2Sub(Texture2, Texture1, 10, 10)
            scale .5
            translate <.5,0,.5>
            warp {repeat x}
            warp {repeat z}
        }
        scale 2
    #break
    #case (3)
        checker  texture {
            T_Checker2Sub(Texture1, Texture2, 1, 1)
            scale .5
            translate <.5,0,.5>
            warp {repeat x}
            warp {repeat z}
        }
        texture {
            T_Checker2Sub(Texture2, Texture1, 1, 1)
            scale .5
            translate <.5,0,.5>
            warp {repeat x}
            warp {repeat z}
        }
        scale 2
    #break


    #else
        T_Checker2Sub(Texture1, Texture2, 20, 20)
        translate <.5,0,.5>
        warp {repeat x}
        warp {repeat z}
        scale 2
    #end
    scale <1,1e6,1>
#end




/////////////////////////////////////////////////////////////////////////
// Hexagon
#macro P_HexagonSub(P1, P2, P3)
    hexagon
    pigment{P1}
    pigment{P2}
    pigment{P3}
#end

#macro P_Hexagon(PatternNo, P1, P2, P3)
    #switch (PatternNo)
    #case (1)
  hexagon      //111111111111&&
  pigment{P_HexagonSub(P1, P2, P3) translate<1/2,0,sqrt(3)/2>}
  pigment{P_HexagonSub(P1, P2, P3) translate -x}
  pigment{P_HexagonSub(P1, P2, P3) translate<1/2,0,-sqrt(3)/2>}
    #break
    #case (2)

  pigment{P_HexagonSub(P1, P2, P3) translate<1/2,0,sqrt(3)/2>}
  pigment{P_HexagonSub(P3, P1, P2) translate -x}
  pigment{P_HexagonSub(P2, P3, P1) translate<1/2,0,-sqrt(3)/2>}
    #break
    #case (3)
  hexagon  //333333333333333
  pigment{P_HexagonSub(P1, P2, P3) translate<1/2,0,sqrt(3)/2>}
  pigment{P_HexagonSub(P1, P2, P3) translate -x rotate y*60}
  pigment{P_HexagonSub(P1, P2, P3) translate<1/2,0,-sqrt(3)/2>}
    #break

    #else
  P_HexagonSub(P1, P2, P3)
    #end
    scale <1,1e6,1>
#end




//////////////////////////////////////////////////////////////////////////
#macro P_Hexagon2(PatternNo, P1, P2, P3, P4)
    #switch (PatternNo)
    #case (1)
  hexagon
  pigment{P_HexagonSub(P1, P2, P3) translate<1/2,0,sqrt(3)/2>}
  pigment{P_HexagonSub(P2, P3, P1) translate -x}
  pigment{P_HexagonSub(P4, P4, P4) translate<1/2,0,-sqrt(3)/2>}
    #break
    #case (2)
  hexagon
  pigment{P_HexagonSub(P1, P2, P3) translate<1/2,0,sqrt(3)/2>}
  pigment{P_HexagonSub(P1, P2, P3) translate -x rotate y*60}
  pigment{P4}
    #break
    #case (3)
  hexagon
  pigment{P_HexagonSub(P1, P2, P3) rotate y*30 scale sqrt(3)/2 }
  pigment{P4}
  pigment{P4}
    #break
    #else
  hexagon
  pigment{P_HexagonSub(P1, P2, P3) translate<1/2,0,sqrt(3)/2>}
  pigment{P_HexagonSub(P1, P2, P3) translate -x}
  pigment{P4}
    #end
    scale <1,1e6,1>
#end



/////////////////////////////////////////////////////////////
#macro T_HexagonSub(T1, T2, T3)
    hexagon
    texture{T1}
    texture{T2}
    texture{T3}
#end

#macro T_Hexagon(PatternNo, T1, T2, T3)
    #switch (PatternNo)
    #case (1)
  hexagon
  texture{T_HexagonSub(T1, T2, T3) translate<1/2,0,sqrt(3)/2>}
  texture{T_HexagonSub(T1, T2, T3) translate -x}
  texture{T_HexagonSub(T1, T2, T3) translate<1/2,0,-sqrt(3)/2>}
    #break
    #case (2)
  hexagon
  texture{T_HexagonSub(T1, T2, T3) translate<1/2,0,sqrt(3)/2>}
  texture{T_HexagonSub(T3, T1, T2) translate -x}
  texture{T_HexagonSub(T2, T3, T1) translate<1/2,0,-sqrt(3)/2>}
    #break
    #case (3)
  hexagon
  texture{T_HexagonSub(T1, T2, T3) translate<1/2,0,sqrt(3)/2>}
  texture{T_HexagonSub(T1, T2, T3) translate -x rotate y*60}
  texture{T_HexagonSub(T1, T2, T3) translate<1/2,0,-sqrt(3)/2>}
    #break

    #else
     T_HexagonSub(T1, T2, T3)
    #end
    scale <1,1e6,1>
#end




///////////////////////////////////////////////////////////////////////////
#macro T_Hexagon2(PatternNo, T1, T2, T3, T4)
    #switch (PatternNo)
    #case (1)
  hexagon
  texture{T_HexagonSub(T1, T2, T3) translate<1/2,0,sqrt(3)/2>}
  texture{T_HexagonSub(T2, T3, T1) translate -x}
  texture{T_HexagonSub(T4, T4, T4) translate<1/2,0,-sqrt(3)/2>}
    #break
    #case (2)
  hexagon
  texture{T_HexagonSub(T1, T2, T3) translate<1/2,0,sqrt(3)/2>}
  texture{T_HexagonSub(T1, T2, T3) translate -x rotate y*60}
  texture{T4}
    #break
    #case (3)
  hexagon
  texture{T_HexagonSub(T1, T2, T3) rotate y*30 scale sqrt(3)/2 }
  texture{T4}
  texture{T4}
    #break
    #else
  hexagon
  texture{T_HexagonSub(T1, T2, T3) translate<1/2,0,sqrt(3)/2>}
  texture{T_HexagonSub(T1, T2, T3) translate -x}
  texture{T4}
    #end
    scale <1,1e6,1>
#end
  //fin de checker.inc






/////////////////////////////////////////////////
/////////////////////////////////////////////////
/////////////////////////////////////////////////
//(Moray)
// Use right handed-system
// Where Z is up
camera {  //  Camera StdCam
  location  <    -12.000,     -20.000,      15.000>
  sky       <    0.00000,     0.00000,     1.00000>
  up        <        0.0,         0.0,         1.0>
  right     <    1.35836,         0.0,         0.0>
  angle         40.00000    // Vertical      30.000
  look_at   <      0.000,       0.000,       0.000>
}



light_source {   // Light1
  <0.0, 0.0, 0.0>
  color rgb <1.000, 1.000, 1.000>
  translate  <0.0, -20.0, 20.0>
}
 //?????????????????????????????????????????


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.