本文整理匯總了Python中pyrr.Matrix44.identity方法的典型用法代碼示例。如果您正苦於以下問題:Python Matrix44.identity方法的具體用法?Python Matrix44.identity怎麽用?Python Matrix44.identity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pyrr.Matrix44
的用法示例。
在下文中一共展示了Matrix44.identity方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from pyrr import Matrix44 [as 別名]
# 或者: from pyrr.Matrix44 import identity [as 別名]
def __init__(self, name=None, position=None, texImg=None, specTexImg=None,
normalMap=None, shininess=None, ka=None, kd=None, ks=None,
program=None):
self.model = mat4.identity(dtype='f')
self.name = name
self.position = position
self.texImg = texImg
self.specTexImg = specTexImg
self.normalMap = normalMap
self.shininess = shininess
self.ka = ka
self.kd = kd
self.ks = ks
self.program = program
self.initTextures()
示例2: render
# 需要導入模塊: from pyrr import Matrix44 [as 別名]
# 或者: from pyrr.Matrix44 import identity [as 別名]
def render(self, app, currentTime):
glBindVertexArray(self._vao.identifier)
try:
glUseProgram(self._program.identifier)
bg_color = (
math.sin(currentTime) * 0.5 + 0.5,
math.cos(currentTime) * 0.5 + 0.5,
0.0,
1.0
)
glClearBufferfv(GL_COLOR, 0, bg_color)
glClearBufferfv(GL_DEPTH, 0, [1])
f = currentTime * 0.3
mv_matrix = Matrix44.identity(dtype='f4')
mv_matrix *= Matrix44.from_x_rotation(
currentTime * math.radians(81))
mv_matrix *= Matrix44.from_y_rotation(
currentTime * math.radians(45))
mv_matrix *= Matrix44.from_translation([
math.sin(2.1 * f) * 0.5,
math.cos(1.7 * f) * 0.5,
math.sin(1.3 * f) * math.cos(1.5 * f) * 2.0])
mv_matrix *= Matrix44.from_translation([0.0, 0.0, -4.0])
self._uniform_block.mv_matrix[:] = mv_matrix.reshape(16)
glBufferSubData(
GL_UNIFORM_BUFFER,
0,
ctypes.sizeof(self._uniform_block),
ctypes.byref(self._uniform_block))
self._torus_obj.render()
finally:
glBindVertexArray(NULL_GL_OBJECT)
示例3: __init__
# 需要導入模塊: from pyrr import Matrix44 [as 別名]
# 或者: from pyrr.Matrix44 import identity [as 別名]
def __init__(self):
self.renderBatches = {}
self.view = Matrix44.identity()
self.AdjustView((0.0, 0.0, -30), (0.0, 0.0, 0.0), (0.0, 1.0, 0.0))
self.perspectiveMatrix = Matrix44.identity()
示例4: getModelMatrix
# 需要導入模塊: from pyrr import Matrix44 [as 別名]
# 或者: from pyrr.Matrix44 import identity [as 別名]
def getModelMatrix(self):
return mat4.identity(dtype='f')