def _createVertexBuffer(self): self.vertexbuffer = VertexBuffer.MakeStandardVertexBuffer( vertices=[vec3(*x) for x in self.vertexArray], tex_coords=ListFunctions.flattenListOfLists( self.texCoords ), tex_coords_2=ListFunctions.flattenListOfLists( self.worldTexCoords ) ) self.indexbuffer = VertexBuffer.IndexBufferObject( self.indexArray, element_type='I' )
def _createVertexBuffer(self): self.vertexbuffer = VertexBuffer.MakeStandardVertexBuffer( vertices=[vec3(*x) for x in self.vertexArray], tex_coords=ListFunctions.flattenListOfLists(self.texCoords), tex_coords_2=ListFunctions.flattenListOfLists(self.worldTexCoords)) self.indexbuffer = VertexBuffer.IndexBufferObject(self.indexArray, element_type='I')
def makeVertexBuffer(self): self.vertexbuffer = VertexBuffer.MakeStandardVertexBuffer( vertices=[vec3(*x) for x in self.vertices_gl], normals=[vec3(*x) for x in self.normals_gl], tex_coords=ListFunctions.flattenListOfLists(self.texcoord_gl) ) self.indexbuffer = VertexBuffer.IndexBufferObject( self.indices_gl )
def _createPhysicsBody(self): """Creates a physics body""" solver = self.world.solver #Create the collision geometry print "Creating collision geometry..." self.collisionGeom = self.world.solver.makeMesh() #check if the heightmap mesh has already been serialized.. meshpath = self.world.fsPath() + 'terrain.superserial' if os.path.isfile(meshpath): #...if it has, just load it print "Heightmap mesh collision exists, loading.." self.collisionGeom.Deserialize(meshpath) else: self.collisionGeom.BeginBuild() faces = self.getFaceList() for face in faces: self.collisionGeom.AddFace( ListFunctions.flattenListOfLists(face), 0) self.collisionGeom.EndBuild(0) print "Heightmap mesh collision built, saving for future uses..." self.collisionGeom.Serialize(meshpath) #Create the body self.body = solver.makeBody(self.collisionGeom, self) self.body.TreeCollisionCallback = self.onHeightmapCollision
def _createPhysicsBody( self): """Creates a physics body""" solver = self.world.solver #Create the collision geometry print "Creating collision geometry..." self.collisionGeom = self.world.solver.makeMesh( ) #check if the heightmap mesh has already been serialized.. meshpath = self.world.fsPath() + 'terrain.superserial' if os.path.isfile( meshpath ): #...if it has, just load it print "Heightmap mesh collision exists, loading.." self.collisionGeom.Deserialize( meshpath ) else: self.collisionGeom.BeginBuild() faces = self.getFaceList() for face in faces: self.collisionGeom.AddFace( ListFunctions.flattenListOfLists( face), 0 ) self.collisionGeom.EndBuild(0) print "Heightmap mesh collision built, saving for future uses..." self.collisionGeom.Serialize( meshpath ) #Create the body self.body = solver.makeBody( self.collisionGeom, self ) self.body.TreeCollisionCallback = self.onHeightmapCollision
def _getProjectionMatrixFromGL(self): glMatrixMode(GL_PROJECTION) glPushMatrix() glLoadIdentity() gluPerspective(self.FOV, self.aspect, self.near, self.far) self.projectionMatrix = mat4( ListFunctions.flattenListOfLists( glGetDoublev(GL_PROJECTION_MATRIX))).transpose() glPopMatrix() glMatrixMode(GL_MODELVIEW) return self.projectionMatrix
def string_length(s): """This method counts the amount of characters a given string has.""" # convert string to a list string = list(s) length = 0 # Important to note that we could simply apply this principle by returning # the len of the string in list format but this is easier to visualize. for i in range(1, lf.list_len(string) + 1): length += 1 return length
def string_reverse(s): """This function will reverse any given string.""" # we must first convert the given string into a list. # and create the new String that we will return. string = list(s) newString = "" for i in range(lf.list_len(string)): # -(i + 1) represents the incrementation of the index, i, in reverse order newString = newString + string[-(i + 1)] return newString
def _getProjectionMatrixFromGL(self ): glMatrixMode(GL_PROJECTION) glPushMatrix() glLoadIdentity() gluPerspective(self.FOV, self.aspect, self.near, self.far) self.projectionMatrix = mat4( ListFunctions.flattenListOfLists( glGetDoublev( GL_PROJECTION_MATRIX )) ).transpose() glPopMatrix() glMatrixMode(GL_MODELVIEW) return self.projectionMatrix
def makeVertexBuffer(self): self.vertexbuffer = VertexBuffer.MakeStandardVertexBuffer( vertices=[vec3(*x) for x in self.vertices_gl], normals=[vec3(*x) for x in self.normals_gl], tex_coords=ListFunctions.flattenListOfLists(self.texcoord_gl)) self.indexbuffer = VertexBuffer.IndexBufferObject(self.indices_gl)
import ListFunctions LinksToIndexPages = BeautifulSoupFunctions.GetLinkListOLD( 'https://members.nanaimochamber.bc.ca/list/', 'searchalpha') with open('NanaimoChamber.csv', mode='w') as writeFile: NanaimoChamberCSV = csv.writer(writeFile, delimiter=',', lineterminator='\n', quotechar='"', quoting=csv.QUOTE_MINIMAL) for IndexPage in LinksToIndexPages: #print(IndexPage) LinksToBusinesPages = BeautifulSoupFunctions.GetLinkListOLD( IndexPage, 't/member/') for BusinessLink in ListFunctions.RemoveDupesFromList( LinksToBusinesPages): #print(BusinessLink) BusinessID = BusinessLink[BusinessLink.rfind("-", 0) + 1:len(BusinessLink)] print(BusinessID) BusinessSoup = BeautifulSoupFunctions.GetSoup(BusinessLink) #ShowPrettySoup(BusinessLink) if len(BusinessSoup.find_all("span", class_="gz-cat")) > 0: BusinessName = BusinessSoup.find_all( "h1", class_="gz-pagetitle")[0].getText() else: BusinessName = "N/A" print(BusinessName) if len(BusinessSoup.find_all("span", class_="gz-cat")) > 0: BusinessCat = BusinessSoup.find_all(