def addShaderAttributes(self, shaderFunc): """ adds a per vertex shader attribute. """ FaceVArray.addShaderAttributes(self, shaderFunc) if self.hasTangents(): shaderFunc.addAttribute(type="vec4", name="vertexTangent")
def __init__(self, name, params): self.tangents = params.get('vertexTangent') conf = params.get('tangentsConf') if conf!=None and conf.dynamic: self.dynamicTangents = True else: self.dynamicTangents = False FaceVArray.__init__(self, name, params)
def duplicatePerVertexAttribute(self, index): FaceVArray.duplicatePerVertexAttribute(self, index) if self.hasTangents(): # FIXME: TSPACE: for different per face uv tangents cant be duplicated like this, # because their calculation depends on the uv values self.tangents.data.append(self.tangents.data[index])
def postCreate(self): FaceVArray.postCreate(self) del self.tangents
def createVBOs(self): """ add tangent attribute before creating the vbos. """ self.addAttribute(self.tangents) FaceVArray.createVBOs(self)
def isDynamicAttribute(self, attribute): if self.tangents==attribute: return self.dynamicTangents else: return FaceVArray.isDynamicAttribute(self, attribute)
def createResources(self): FaceVArray.createResources(self) if self.needTangents(): self.tangents = self.generateTangents()