def __init__(self): vertices, vnormals, f, self.vertexCount = \ graphics.loadObj("data/model/moon.obj") self.verticesId, self.normalsId = \ graphics.createVBO("moon", vertices, vnormals) self.angle = 270.0 * (3.1415/180.0)
def __init__(self): vertices, vnormals, f, self.vertexCount = \ graphics.loadObj("data/model/sun.obj") self.verticesId, self.normalsId = \ graphics.createVBO("sun", vertices, vnormals) #self.angle = 3.1415/4.0 #in radians self.angle = 90.0 * (3.1415/180.0)
def __init__(self, name = "Fireball 1", position = (0.0, 20.0, -40.0), \ orientation = (0.0, 180.0, 0.0), scale = 0.1, mass = 20, \ velocity = (0.0, 0.0, 0.0), guid = None, sound = None): GameObject.__init__(self, "Fireball", name, position, orientation, scale, mass, velocity, guid) vertices, vnormals, f, self.vertexCount = \ graphics.loadObj("data/model/Fireball.obj") self.verticesId, self.normalsId = \ graphics.createVBO(self.data.type, vertices, vnormals) self.sound = sound
def __init__(self, type, name, position, orientation, scale, mass, objects, server=False, guid=None): self.objects = objects GameObject.__init__(self, type, name, position, orientation, scale, mass, (0.0, 0.0, 0.0), guid) self.intelligenceThread = None if server: return vertices, vnormals, f, self.vertexCount = graphics.loadObj(self.objPath()) self.verticesId, self.normalsId = graphics.createVBO(self.data.type, vertices, vnormals)
def __init__(self, name = "Player 1", position = (0.0, 20.0, -40.0), \ orientation = (0.0, 180.0, 0.0), scale = 1.0, mass = 100, \ guid = None, sound = None): GameObject.__init__(self, "player1", name, position, orientation, scale, mass, (0.0, 0.0, 0.0), guid) vertices, vnormals, f, self.vertexCount = \ graphics.loadObj("data/model/player1.obj") self.verticesId, self.normalsId = \ graphics.createVBO(self.data.type, vertices, vnormals) self.sound = sound self.can_jump = 0 self.rotated = 0.0
def __init__(self): self.sun = Sun() self.moon = Moon() vertices, vnormals, f, self.vertexCount = \ graphics.loadObj("data/model/skydome.obj") xMax = xMin = vertices[0][0] zMax = zMin = vertices[0][2] for i in vertices: if i[0] < xMin: xMin = i[0] elif i[0] > xMax: xMax = i[0] if i[2] < zMin: zMin = i[2] elif i[2] > zMax: zMax = i[2] sizeX = xMax - xMin sizeY = zMax - zMin texCoords = Numeric.zeros((self.vertexCount, 2), 'f') nightTexCoords = Numeric.zeros((self.vertexCount, 2), 'f') self.textureId, textureWidthRatio, textureHeightRatio = \ graphics.loadTexture("data/image/cl.jpg") nIndex = 0 for i in vertices: texCoords[nIndex, 0] = (i[0]-xMin) / sizeX * textureWidthRatio texCoords[nIndex, 1] = (i[2]-zMin) / sizeY * textureHeightRatio nIndex += 1 self.nightTextureId, textureWidthRatio, textureHeightRatio = \ graphics.loadTexture("data/image/nightsky.jpg") nIndex = 0 for i in vertices: nightTexCoords[nIndex, 0] = (i[0]-xMin) / sizeX * textureWidthRatio nightTexCoords[nIndex, 1] = (i[2]-zMin) / sizeY * textureHeightRatio nIndex += 1 self.nightTexCoordsId = glGenBuffersARB(1) glBindBufferARB(GL_ARRAY_BUFFER_ARB, self.nightTexCoordsId) glBufferDataARB(GL_ARRAY_BUFFER_ARB, nightTexCoords, GL_STATIC_DRAW_ARB) self.verticesId, self.normalsId, self.texCoordsId = \ graphics.createVBO("skydome", vertices, vnormals, texCoords) self.vertices = vertices self.normals = vnormals
def __init__(self): meshVertices, self.vertexCount, meshNormals = self.generateMesh() self.verticesId, self.normalsId = \ graphics.createVBO("water", meshVertices, meshNormals) self.initShader()