def __init__(self, vtype, utype): # Convert vtype to a list (in case it was already a dtype) such that we # can append new fields vtype = eval(str(np.dtype(vtype))) # Convert utype to a list (in case it was already a dtype) such that we # can append new fields utype = eval(str(np.dtype(utype))) # We add a uniform index to access uniform data from texture vtype.append( ('index', 'f4') ) VertexBuffer.__init__(self, vtype) # Check if given utype is made of float32 only rutype = dtype_reduce(utype) if type(rutype[0]) is not str or rutype[2] != 'float32': print "Uniform type cannot de reduced to float32 only" else: count = rutype[1] size = count//4 if count % 4: size += 1 utype.append(('unnused', 'f4', size*4-count)) self.uniforms_data = np.zeros((1,1), dtype=utype) self.uniforms_size = 0 self.uniforms_capacity = 1 self.uniforms_shape = None self._uniforms_id = 0
def __init__(self, vtype, utype): # Convert vtype to a list (in case it was already a dtype) such that we # can append new fields vtype = eval(str(np.dtype(vtype))) # Convert utype to a list (in case it was already a dtype) such that we # can append new fields utype = eval(str(np.dtype(utype))) # We add a uniform index to access uniform data from texture vtype.append(('index', 'f4')) VertexBuffer.__init__(self, vtype) # Check if given utype is made of float32 only rutype = dtype_reduce(utype) if type(rutype[0]) is not str or rutype[2] != 'float32': print "Uniform type cannot de reduced to float32 only" else: count = rutype[1] size = count // 4 if count % 4: size += 1 utype.append(('unnused', 'f4', size * 4 - count)) self.uniforms_data = np.zeros((1, 1), dtype=utype) self.uniforms_size = 0 self.uniforms_capacity = 1 self.uniforms_shape = None self._uniforms_id = 0