本文整理汇总了Python中mesh.Mesh.buildFromFragment方法的典型用法代码示例。如果您正苦于以下问题:Python Mesh.buildFromFragment方法的具体用法?Python Mesh.buildFromFragment怎么用?Python Mesh.buildFromFragment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mesh.Mesh
的用法示例。
在下文中一共展示了Mesh.buildFromFragment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createAnimatedModel
# 需要导入模块: from mesh import Mesh [as 别名]
# 或者: from mesh.Mesh import buildFromFragment [as 别名]
def createAnimatedModel(self, f11):
wld = self.wld_container.wld_file_obj
f10 = wld.getFragment(f11.fragRef)
if f10.type != 0x10:
print 'Model::createAnimatedModel() ERROR expected 0x10 fragment but got:', f10.type
return
# Lets initially try to only read all the mesh pieces and assemble the basic
# model. Once that is working we can start looking into animation
# Loop over the parts of the model/skeleton: the entries list in the f10 fragment
# define these
root_mesh = None
for i in range(0, f10.size1):
if i > 0:
f2d = wld.getFragment(f10.entries[i][3]) # entry[3] -> fragRef2
# f2d.dump()
f36 = wld.getFragment(f2d.fragRef)
# f36.dump()
m = Mesh(self.name+'_mesh_'+str(i))
m.buildFromFragment(f36, self.wld_container, False)
m.root.reparentTo(root_mesh.root)
else: # the root node (index 0) does not have a mesh
m = Mesh(self.name+'_mesh_'+str(i)) # empty dummy mesh
root_mesh = m
self.meshes.append(m)
# get model part orientation data from 0x10->0x13->0x12 ref chain
f13 = wld.getFragment(f10.entries[i][2]) # entry[2] -> fragRef1
f12 = wld.getFragment(f13.fragRef)
denom = float(f12.rotDenom)
if denom != 0.0:
rotx = f12.rotx/denom
roty = f12.roty/denom
rotz = f12.rotz/denom
m.root.setHpr(rotx / 512.0 * 360.0, roty / 512.0 * 360.0, rotz / 512.0 * 360.0)
denom = float(f12.shiftDenom)
if denom != 0.0:
shiftx = float(f12.shiftx)/denom
shifty = float(f12.shifty)/denom
shiftz = float(f12.shiftz)/denom
# print shiftx, shifty, shiftz
m.root.setPos(shiftx, shifty, shiftz)
self.loaded = 1
示例2: createStaticModel
# 需要导入模块: from mesh import Mesh [as 别名]
# 或者: from mesh.Mesh import buildFromFragment [as 别名]
def createStaticModel(self, f36):
m = Mesh(self.name+'_mesh')
m.buildFromFragment(f36, self.wld_container,False)
self.meshes.append(m)
self.loaded = 1