def drawCharacterHead(self, x, y, z, realCoords=None, dim=0): GL.glEnable(GL.GL_CULL_FACE) origin = (x - 0.25, y - 0.25, z - 0.25) size = (0.5, 0.5, 0.5) box = FloatBox(origin, size) hat_origin = (x - 0.275, y - 0.275, z - 0.275) hat_size = (0.55, 0.55, 0.55) hat_box = FloatBox(hat_origin, hat_size) if realCoords is not None and self.playerPos[dim][ realCoords] != "Player" and config.settings.downloadPlayerSkins.get( ): drawCube( box, texture=self.playerTexture[self.playerPos[dim][realCoords]], textureVertices=self.texVerts[0]) GL.glEnable(GL.GL_BLEND) GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA) drawCube( hat_box, texture=self.playerTexture[self.playerPos[dim][realCoords]], textureVertices=self.texVerts[1]) GL.glDisable(GL.GL_BLEND) else: drawCube(box, texture=self.charTex, textureVertices=self.texVerts[0]) GL.glDisable(GL.GL_CULL_FACE)
def drawCharacterHead(self, x, y, z): glEnable(GL_CULL_FACE) box = FloatBox() box.origin = (x - 0.25, y - 0.25, z - 0.25) box.size = (0.5, 0.5, 0.5) drawCube(box, texture=self.charTex, textureVertices=self.texVerts) glDisable(GL_CULL_FACE)
def _drawToolMarkers(self): GL.glColor(1.0, 1.0, 1.0, 0.5) GL.glEnable(GL.GL_DEPTH_TEST) GL.glMatrixMode(GL.GL_MODELVIEW) for player in self.editor.level.players: try: pos = self.editor.level.getPlayerPosition(player) yaw, pitch = self.editor.level.getPlayerOrientation(player) dim = self.editor.level.getPlayerDimension(player) if dim != self.editor.level.dimNo: continue x, y, z = pos GL.glPushMatrix() GL.glTranslate(x, y, z) GL.glRotate(-yaw, 0, 1, 0) GL.glRotate(pitch, 1, 0, 0) GL.glColor(1, 1, 1, 1) self.drawCharacterHead(0, 0, 0) GL.glPopMatrix() # GL.glEnable(GL.GL_BLEND) drawTerrainCuttingWire( FloatBox((x - .5, y - .5, z - .5), (1, 1, 1)), c0=(0.3, 0.9, 0.7, 1.0), c1=(0, 0, 0, 0), ) #GL.glDisable(GL.GL_BLEND) except Exception, e: print repr(e) continue
def _drawToolMarkers(self): x, y, z = self.editor.level.playerSpawnPosition() GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA) GL.glEnable(GL.GL_BLEND) color = config.selectionColors.black.get() + (0.35,) GL.glColor(*color) GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_LINE) GL.glLineWidth(2.0) drawCube(FloatBox((x, y, z), (1, 1, 1))) GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL) drawCube(FloatBox((x, y, z), (1, 1, 1))) GL.glDisable(GL.GL_BLEND) GL.glEnable(GL.GL_DEPTH_TEST) GL.glColor(1.0, 1.0, 1.0, 1.0) self.drawCage(x, y, z) self.drawCharacterHead(x + 0.5, y + 0.5 + 0.125 * numpy.sin(self.editor.frames * 0.05), z + 0.5) GL.glDisable(GL.GL_DEPTH_TEST)
def _drawToolMarkers(self): GL.glColor(1.0, 1.0, 1.0, 0.5) GL.glEnable(GL.GL_DEPTH_TEST) GL.glMatrixMode(GL.GL_MODELVIEW) for player in self.editor.level.players: try: pos = self.editor.level.getPlayerPosition(player) yaw, pitch = self.editor.level.getPlayerOrientation(player) dim = self.editor.level.getPlayerDimension(player) self.inOtherDimension[dim].append(player) self.playerPos[dim][pos] = player self.revPlayerPos[dim][player] = pos if player != "Player" and config.settings.downloadPlayerSkins.get( ): # print 7 r = self.playercache.getPlayerSkin(player, force_download=False) if not isinstance(r, (str, unicode)): r = r.join() self.playerTexture[player] = loadPNGTexture(r) else: self.playerTexture[player] = self.charTex if dim != self.editor.level.dimNo: continue x, y, z = pos GL.glPushMatrix() GL.glTranslate(x, y, z) GL.glRotate(-yaw, 0, 1, 0) GL.glRotate(pitch, 1, 0, 0) GL.glColor(1, 1, 1, 1) self.drawCharacterHead(0, 0, 0, (x, y, z), self.editor.level.dimNo) GL.glPopMatrix() # GL.glEnable(GL.GL_BLEND) drawTerrainCuttingWire( FloatBox((x - .5, y - .5, z - .5), (1, 1, 1)), c0=(0.3, 0.9, 0.7, 1.0), c1=(0, 0, 0, 0), ) #GL.glDisable(GL.GL_BLEND) except Exception, e: print "Exception in editortools.player.PlayerPositionTool._drawToolMarkers:", repr( e) import traceback print traceback.format_exc() continue
def drawCharacterHead(self, x, y, z, realCoords=None): # FIXME: Top head texture is rotated incorrectly # TODO: Possible add hat layer support GL.glEnable(GL.GL_CULL_FACE) origin = (x - 0.25, y - 0.25, z - 0.25) size = (0.5, 0.5, 0.5) box = FloatBox(origin, size) if realCoords != None and self.playerPos[realCoords] != "Player": drawCube(box, texture=self.playerTexture[self.playerPos[realCoords]], textureVertices=self.texVerts) else: drawCube(box, texture=self.charTex, textureVertices=self.texVerts) GL.glDisable(GL.GL_CULL_FACE)
def _drawToolMarkers(self): GL.glColor(1.0, 1.0, 1.0, 0.5) GL.glEnable(GL.GL_DEPTH_TEST) GL.glMatrixMode(GL.GL_MODELVIEW) for player in self.editor.level.players: try: pos = self.editor.level.getPlayerPosition(player) yaw, pitch = self.editor.level.getPlayerOrientation(player) dim = self.editor.level.getPlayerDimension(player) self.inOtherDimension[dim].append(player) self.playerPos[dim][pos] = player self.revPlayerPos[dim][player] = pos if player != "Player" and config.settings.downloadPlayerSkins.get( ): self.playerTexture[player] = loadPNGTexture( version_utils.getPlayerSkin(player, force=False)) else: self.playerTexture[player] = self.charTex if dim != self.editor.level.dimNo: continue x, y, z = pos GL.glPushMatrix() GL.glTranslate(x, y, z) GL.glRotate(-yaw, 0, 1, 0) GL.glRotate(pitch, 1, 0, 0) GL.glColor(1, 1, 1, 1) self.drawCharacterHead(0, 0, 0, (x, y, z), self.editor.level.dimNo) GL.glPopMatrix() # GL.glEnable(GL.GL_BLEND) drawTerrainCuttingWire( FloatBox((x - .5, y - .5, z - .5), (1, 1, 1)), c0=(0.3, 0.9, 0.7, 1.0), c1=(0, 0, 0, 0), ) #GL.glDisable(GL.GL_BLEND) except Exception, e: print repr(e) continue