本文整理匯總了Python中pi3d.util.Utility.rotatef方法的典型用法代碼示例。如果您正苦於以下問題:Python Utility.rotatef方法的具體用法?Python Utility.rotatef怎麽用?Python Utility.rotatef使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pi3d.util.Utility
的用法示例。
在下文中一共展示了Utility.rotatef方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: string
# 需要導入模塊: from pi3d.util import Utility [as 別名]
# 或者: from pi3d.util.Utility import rotatef [as 別名]
def string(font, string, x, y, z, rot, sclx, scly):
opengles.glNormalPointer(GL_BYTE, 0, RECT_NORMALS)
Utility.texture_min_mag()
opengles.glEnableClientState(GL_TEXTURE_COORD_ARRAY)
opengles.glBindTexture(GL_TEXTURE_2D,font.tex)
opengles.glEnable(GL_TEXTURE_2D)
opengles.glDisable(GL_DEPTH_TEST)
opengles.glDisable(GL_CULL_FACE)
opengles.glEnable(GL_BLEND)
opengles.glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA)
mtrx =(c_float * 16)()
opengles.glGetFloatv(GL_MODELVIEW_MATRIX,ctypes.byref(mtrx))
Utility.translatef(x, y, z)
Utility.rotatef(rot, 0, 0, 1)
Utility.scalef(sclx, scly, 1)
for c in range(0,len(string)):
v = ord(string[c])-32
w, h, texc, verts = font.chr[v]
if v > 0:
opengles.glVertexPointer(3, GL_FLOAT, 0,verts)
opengles.glTexCoordPointer(2, GL_FLOAT,0,texc)
opengles.glDrawElements( GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, RECT_TRIANGLES)
Utility.translatef(w, 0, 0)
opengles.glLoadMatrixf(mtrx)
opengles.glDisable(GL_TEXTURE_2D)
opengles.glDisable(GL_BLEND)
opengles.glEnable(GL_DEPTH_TEST)
opengles.glEnable(GL_CULL_FACE)
示例2: _draw
# 需要導入模塊: from pi3d.util import Utility [as 別名]
# 或者: from pi3d.util.Utility import rotatef [as 別名]
def _draw(verts, tex, x, y, w, h, r, z):
opengles.glNormalPointer(GL_BYTE, 0, RECT_NORMALS);
opengles.glVertexPointer(3, GL_BYTE, 0, verts);
Utility.load_identity()
Utility.translatef(x, y, z)
Utility.scalef(w, h, 1)
if r:
Utility.rotatef(r, 0, 0, 1)
with Texture.Loader(tex,RECT_TEX_COORDS,GL_BYTE):
opengles.glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, RECT_TRIANGLES)
示例3: rotate
# 需要導入模塊: from pi3d.util import Utility [as 別名]
# 或者: from pi3d.util.Utility import rotatef [as 別名]
def rotate(self, rx, ry, rz):
if rz:
Utility.rotatef(rz, 0, 0, 1)
if rx:
Utility.rotatef(rx, 1, 0, 0)
if ry:
Utility.rotatef(ry, 0, 1, 0)
示例4: transform
# 需要導入模塊: from pi3d.util import Utility [as 別名]
# 或者: from pi3d.util.Utility import rotatef [as 別名]
def transform(self):
Utility.translatef(self.x - self.cx, self.y - self.cy, self.z - self.cz)
# TODO: why the reverse order?
Utility.rotatef(self.rotz, 0, 0, 1)
Utility.rotatef(self.roty, 0, 1, 0)
Utility.rotatef(self.rotx, 1, 0, 0)
Utility.scalef(self.sx, self.sy, self.sz)
Utility.translatef(self.cx, self.cy, self.cz)
示例5: Keyboard
# 需要導入模塊: from pi3d.util import Utility [as 別名]
# 或者: from pi3d.util.Utility import rotatef [as 別名]
# Fetch key presses
mykeys = Keyboard()
# mastrix and rotate variables
rot=0
#create a light
mylight = Light(0,1,1,1,"",10,10,0)
mylight.on()
while 1:
display.clear()
Utility.load_identity()
Utility.translatef(0,0, -40)
Utility.rotatef(rot, 0, 1, 0)
rot += 3
mymodel.draw()
k = mykeys.read()
if k >-1:
if k==112: display.screenshot("Triceratops.jpg")
elif k==27:
mykeys.close()
texs.deleteAll()
display.destroy()
break
else:
print k