Beispiel #1
0
    def write(self, pbrtwriter: PbrtWriter):
        from random import uniform, randint
        from tqdm import tqdm
        from util import tqdmpos

        def uni01(x):
            return uniform(0, 1)

        print("Preparing rain instance...")
        with pbrtwriter.attribute():
            pbrtwriter.material("glass", "float eta", [1.33], "rgb Kt",
                                [.28, .72, 1])

            for i in tqdm(range(100), ascii=True):
                with pbrtwriter.objectb("RainStreak%02d" % i):
                    for dummy_1 in range(100 * self.rainfall):
                        with pbrtwriter.attribute():
                            x, y, z = map(uni01, [None] * 3)
                            l = uniform(0, 0.1)
                            pbrtwriter.translate((x, y, z))
                            pbrtwriter.shape("cylinder", "float radius",
                                             [0.001], "float zmin", [-l / 2],
                                             "float zmax", [l / 2])

            # Pbrt cylinder is z-base.
            pbrtwriter.concatTransform(
                [1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1])
            sz = self.size
            print("Writing rain streaks...")
            for x, y, z in tqdmpos(range(sz), range(sz), range(256)):
                ind = randint(0, 99)
                with pbrtwriter.attribute():
                    pbrtwriter.translate((x, y, z))
                    pbrtwriter.objectInstance("RainStreak%02d" % ind)
Beispiel #2
0
 def write(self, pbrtwriter: PbrtWriter, face):
     tex = face["texture"]
     if "tintindex" in face:
         if self.block._is("leaves"):
             tint_color = biome.getFoliageColor(self.block.biome_id, 0)
         else:
             tint_color = biome.getGrassColor(self.block.biome_id, 0)
         pbrtwriter.material("matte", "texture Kd", "%s-color" %
                             tex, "rgb tintMap", tint_color)
     else:
         pbrtwriter.material("matte", "texture Kd", "%s-color" % tex)
Beispiel #3
0
    def write(self, pbrtwriter: PbrtWriter):
        print("Writing water blocks...")

        pbrtwriter.material("glass", "float eta", [
                            1.33], "rgb Kt", [.28, .72, 1])
        self._write(pbrtwriter)
Beispiel #4
0
 def write(self, pbrtwriter: PbrtWriter, face):
     tex = face["texture"]
     tint_color = biome.getFoliageColor(self.block.biome_id, 0)
     pbrtwriter.material("translucent", "texture Kd", "%s-color" % tex,
                         "rgb reflect", tint_color, "rgb transmit", tint_color)
Beispiel #5
0
 def write(self, pbrtwriter: PbrtWriter, face):
     tex = face["texture"]
     pbrtwriter.material("glass", "texture Kr", "%s-color" % tex)