本文整理匯總了Python中texture.Texture.putTexture方法的典型用法代碼示例。如果您正苦於以下問題:Python Texture.putTexture方法的具體用法?Python Texture.putTexture怎麽用?Python Texture.putTexture使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類texture.Texture
的用法示例。
在下文中一共展示了Texture.putTexture方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: generateVideoButton
# 需要導入模塊: from texture import Texture [as 別名]
# 或者: from texture.Texture import putTexture [as 別名]
def generateVideoButton(self):
# for i in range(len(self.shapes)):
# print " "
# print self.shapes[i].name
# for j in range(len(self.shapes[i].faces)):
# print self.shapes[i].faces[j].faceOrientation, " : ", self.shapes[i].faces[j].facePoints
mb = ModelBuilder()
Models = []
for i in self.shapes:
each_model = mb.BuildModel(i)
# Print out the 3D model's vertex and texel coordinate
# print "Print out the 3D model's vertex and texel coordinate---------------------------"
# for j in each_model:
# # j is one polygon
# print "Vertex is:"
# for k in j.Vertex:
# print k.x, k.y, k.z
# print "Texel is:"
# for n in j.Texel:
# print n.u, n.v
Models.append(each_model)
print "Models list size: ", len(Models)
img = cv2.imread("project.png",cv2.CV_LOAD_IMAGE_COLOR)
texture = Texture(img)
points = []
for i in range(0,len(Models),1):
pointsOfEachModel = []
if (i<5): # for single model building 4,11,12,13 and ground
fileIndex = i
for j in range(len(Models[i])): # j is surfaces of each model
pointsOfEachFace = texture.putTexture(Models[i][j])
pointsOfEachModel.extend(pointsOfEachFace)
elif i==5: #5-6 compound building 10
fileIndex = 5
for j in range(5, 7):
for k in range(len(Models[j])):
pointsOfEachFace = texture.putTexture(Models[j][k])
pointsOfEachModel.extend(pointsOfEachFace)
elif i==7: #7-12 compound building 9
fileIndex = 6
for j in range(7, 13):
for k in range(len(Models[j])):
pointsOfEachFace = texture.putTexture(Models[j][k])
pointsOfEachModel.extend(pointsOfEachFace)
elif (i-13)>=0 and (i-13)%2==0: #compound buildings 1-8
multiple = (i-13)/2
fileIndex = 7 + multiple
for j in range(i, i+2):
for k in range(len(Models[j])):
pointsOfEachFace = texture.putTexture(Models[j][k])
pointsOfEachModel.extend(pointsOfEachFace)
else:
continue
points = pointsOfEachModel
fileRGB = open("Models/model_"+str(fileIndex)+".dat", "w+")
for k in range(len(pointsOfEachModel)):
point = "{0},{1},{2},{r},{g},{b}\n".format(points[k].x, points[k].y,points[k].z,r=points[k].r, g=points[k].g, b=points[k].b)
fileRGB.write(point)
print "Model "+str(fileIndex)+":"+str(k)+" points generated"
print "----------UI Phase Finished----------"
print "All models have been generated, please use main.py to generate fraems of video"