@@ -56,28 +56,28 @@ def same(v):
5656}
5757
5858
59- def draw (instance , unlit = False , useTexture = True ):
59+ def draw (instance , lighting_enabled = True , textures_enabled = True ):
6060 """Generic draw function"""
6161 # Draw Wavefront instance
6262 if isinstance (instance , Wavefront ):
63- draw_materials (instance .materials , unlit = unlit , useTexture = useTexture )
63+ draw_materials (instance .materials , lighting_enabled = lighting_enabled , textures_enabled = textures_enabled )
6464 # Draw single material
6565 elif isinstance (instance , Material ):
66- draw_material (instance , unlit = unlit , useTexture = useTexture )
66+ draw_material (instance , lighting_enabled = lighting_enabled , textures_enabled = textures_enabled )
6767 # Draw dict of materials
6868 elif isinstance (instance , dict ):
69- draw_materials (instance , unlit = unlit , useTexture = useTexture )
69+ draw_materials (instance , lighting_enabled = lighting_enabled , textures_enabled = textures_enabled )
7070 else :
7171 raise ValueError ("Cannot figure out how to draw: {}" .format (instance ))
7272
7373
74- def draw_materials (materials , unlit = False , useTexture = True ):
74+ def draw_materials (materials , lighting_enabled = True , textures_enabled = True ):
7575 """Draw a dict of meshes"""
7676 for name , material in materials .items ():
77- draw_material (material , unlit = unlit , useTexture = useTexture )
77+ draw_material (material , lighting_enabled = lighting_enabled , textures_enabled = textures_enabled )
7878
7979
80- def draw_material (material , face = GL_FRONT_AND_BACK , unlit = False , useTexture = True ):
80+ def draw_material (material , face = GL_FRONT_AND_BACK , lighting_enabled = True , textures_enabled = True ):
8181 """Draw a single material"""
8282 if material .gl_floats is None :
8383 material .gl_floats = (GLfloat * len (material .vertices ))(* material .vertices )
@@ -93,15 +93,15 @@ def draw_material(material, face=GL_FRONT_AND_BACK, unlit=False, useTexture=True
9393 glEnable (GL_DEPTH_TEST )
9494 glCullFace (GL_BACK )
9595
96- if useTexture :
96+ if textures_enabled :
9797 # Fall back to ambient texture if no diffuse
9898 texture = material .texture or material .texture_ambient
9999 if texture and material .has_uvs :
100100 bind_texture (texture )
101101 else :
102102 glDisable (GL_TEXTURE_2D )
103103
104- if not unlit :
104+ if lighting_enabled :
105105 glMaterialfv (face , GL_DIFFUSE , gl_light (material .diffuse ))
106106 glMaterialfv (face , GL_AMBIENT , gl_light (material .ambient ))
107107 glMaterialfv (face , GL_SPECULAR , gl_light (material .specular ))
0 commit comments