<s> from shortcrust . gl2 import * <EOL> from shortcrust . buffer import AttributeBuffer , ElementArrayBuffer <EOL> from shortcrust . matrix import vec3 <EOL> class Mesh ( object ) : <EOL> mode = GL_TRIANGLES <EOL> def __init__ ( self , geometry , material_color = [ <NUM_LIT:1.0> , <NUM_LIT:1.0> , <NUM_LIT:1.0> ] , texture = None ) : <EOL> self . positions = AttributeBuffer ( geometry . positions ) <EOL> self . normals = AttributeBuffer ( geometry . normals ) <EOL> self . texture_positions = AttributeBuffer ( geometry . texture_positions ) <EOL> self . indices = ElementArrayBuffer ( geometry . indices ) <EOL> self . index_count = self . indices . element_count <EOL> self . material_color = vec3 . create ( material_color ) <EOL> self . texture = texture <EOL> def draw ( self ) : <EOL> glBindBuffer ( GL_ELEMENT_ARRAY_BUFFER , self . indices . name ) <EOL> glDrawElements ( self . mode , self . index_count , self . indices . data_type , None ) <EOL> class BaseGeometry ( object ) : <EOL> def to_mesh ( self , ** kwargs ) : <EOL> return Mesh ( self , ** kwargs ) </s>
