Make a copy of ShaderTeapot . py or the file you copied from this and displayed the Granny model in Chapter 18, Customizing the Render Pipeline. Call this copied file PBR.py. Make the following changes:
..
from Settings import *
from Light import *
pygame.init()
..
objects_3d = []
camera = Camera(60, (screen_width / screen_height),
0.01, 10000.0)
for x in range(10):
for y in range(10):
sphere = Object(“Sphere”)
sphere.add_component(Transform())
mat = Material(“shaders/pbrvert.vs”,
“shaders/pbrfrag.vs”)
sphere.add_component(
LoadMesh(sphere.vao_ref, mat,
GL_TRIANGLES,
“models/sphere.obj”))
sphere_mesh: LoadMesh =
sphere.get_component(LoadMesh)
sphere_mesh.set_properties(
pygame.Vector3(1, 0, 1),
x/10.0, x/10.0, y/10.0)
sphere.add_component(mat)
sphere_trans: Transform =
sphere.get_component(Transform)
sphere_trans.update_position(
pygame.Vector3(x*20, y*20, -20))
objects_3d.append(sphere)