コード例 #1
0
ファイル: poisson_spheres.py プロジェクト: ssebs/pg
 def setup(self):
     self.wasd = pg.WASD(self, speed=10)
     self.wasd.look_at((0, 3, 12), (0, 0, 7))
     self.context = pg.Context(pg.DirectionalLightProgram())
     self.points = pg.poisson_disc(-10, -10, 10, 10, 1.5, 32)
     self.mats = [pg.Matrix().translate((x, 0, z)) for x, z in self.points]
     self.sphere = pg.Sphere(4, 0.7)
コード例 #2
0
ファイル: poisson_spheres.py プロジェクト: Emilgardis/pg
 def setup(self):
     self.wasd = pg.WASD(self, speed=10)
     self.wasd.look_at((0, 3, 12), (0, 0, 7))
     self.context = pg.Context(pg.DirectionalLightProgram())
     self.points = pg.poisson_disc(-10, -10, 10, 10, 1.5, 32)
     self.mats = [pg.Matrix().translate((x, 0, z)) for x, z in self.points]
     self.sphere = pg.Sphere(4, 0.7)
コード例 #3
0
 def setup(self):
     self.wasd = pg.WASD(self, speed=3)
     self.wasd.look_at((-5, 4, 5), (0, 0, 0))
     self.context = pg.Context(pg.DirectionalLightProgram())
     data = []
     points = pg.poisson_disc(-4, -4, 4, 4, 1, 32)
     for x, z in points:
         noise = pg.simplex2(10 + x * 0.25, 10 + z * 0.25, 4)
         y = (noise + 1) / 1
         shape = pg.Cone((x, 0, z), (x, y, z), 0.4, 36)
         data.extend(pg.interleave(shape.positions, shape.normals))
         shape = pg.Sphere(3, 0.3, (x, y, z))
         data.extend(pg.interleave(shape.positions, shape.normals))
     self.context.position, self.context.normal = (
         pg.VertexBuffer(data).slices(3, 3))
     self.plane = pg.Context(pg.DirectionalLightProgram())
     self.plane.object_color = (1, 1, 1)
     shape = pg.Plane((0, -0.1, 0), (0, 1, 0), 5)
     data = pg.interleave(shape.positions, shape.normals)
     self.plane.position, self.plane.normal = (pg.VertexBuffer(data).slices(
         3, 3))
     self.axes = pg.Context(pg.SolidColorProgram())
     self.axes.color = (0.3, 0.3, 0.3)
     self.axes.position = pg.VertexBuffer(pg.Axes(100).positions)
コード例 #4
0
ファイル: temp.py プロジェクト: Emilgardis/pg
 def setup(self):
     self.wasd = pg.WASD(self, speed=3)
     self.wasd.look_at((-5, 4, 5), (0, 0, 0))
     self.context = pg.Context(pg.DirectionalLightProgram())
     data = []
     points = pg.poisson_disc(-4, -4, 4, 4, 1, 32)
     for x, z in points:
         noise = pg.simplex2(10 + x * 0.25, 10 + z * 0.25, 4)
         y = (noise + 1) / 1
         shape = pg.Cone((x, 0, z), (x, y, z), 0.4, 36)
         data.extend(pg.interleave(shape.positions, shape.normals))
         shape = pg.Sphere(3, 0.3, (x, y, z))
         data.extend(pg.interleave(shape.positions, shape.normals))
     self.context.position, self.context.normal = (
         pg.VertexBuffer(data).slices(3, 3))
     self.plane = pg.Context(pg.DirectionalLightProgram())
     self.plane.object_color = (1, 1, 1)
     shape = pg.Plane((0, -0.1, 0), (0, 1, 0), 5)
     data = pg.interleave(shape.positions, shape.normals)
     self.plane.position, self.plane.normal = (
         pg.VertexBuffer(data).slices(3, 3))
     self.axes = pg.Context(pg.SolidColorProgram())
     self.axes.color = (0.3, 0.3, 0.3)
     self.axes.position = pg.VertexBuffer(pg.Axes(100).positions)