当前位置: 首页>>代码示例>>Python>>正文


Python pyassimp.release方法代码示例

本文整理汇总了Python中pyassimp.release方法的典型用法代码示例。如果您正苦于以下问题:Python pyassimp.release方法的具体用法?Python pyassimp.release怎么用?Python pyassimp.release使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyassimp的用法示例。


在下文中一共展示了pyassimp.release方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: load_meshes

# 需要导入模块: import pyassimp [as 别名]
# 或者: from pyassimp import release [as 别名]
def load_meshes(obj_files, vertex_tmp_store_folder, recalculate_normals=False):
    hashed_file_name = hashlib.md5((''.join(obj_files) + 'load_meshes' + str(recalculate_normals)).encode('utf-8') ).hexdigest() + '.npy'

    out_file = os.path.join( vertex_tmp_store_folder, hashed_file_name)
    if os.path.exists(out_file):
        return np.load(out_file)
    else:
        bar = progressbar.ProgressBar()
        attributes = []
        for model_path in bar(obj_files):
            scene = pyassimp.load(model_path, pyassimp.postprocess.aiProcess_Triangulate)
            mesh = scene.meshes[0]
            vertices = mesh.vertices
            normals = calc_normals(vertices) if recalculate_normals else mesh.normals
            attributes.append( (vertices, normals) )
            pyassimp.release(scene)
        np.save(out_file, attributes)
        return attributes 
开发者ID:DLR-RM,项目名称:AugmentedAutoencoder,代码行数:20,代码来源:geometry.py

示例2: __del__

# 需要导入模块: import pyassimp [as 别名]
# 或者: from pyassimp import release [as 别名]
def __del__(self):
    scene = self.scene
    assimp.release(scene) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:5,代码来源:swiftshader_renderer.py

示例3: _make_mesh

# 需要导入模块: import pyassimp [as 别名]
# 或者: from pyassimp import release [as 别名]
def _make_mesh(self, c, scale = (1, 1, 1)):
    '''
    This was taken from moveit commander and slightly modified.
    '''
    filename = c.geometry.filename
    if pyassimp is False:
        raise RuntimeError("Pyassimp needs patch https://launchpadlibrarian.net/319496602/patchPyassim.txt")
    scene = pyassimp.load(filename)
    if not scene.meshes or len(scene.meshes) == 0:
        raise MoveItCommanderException("There are no meshes in the file")
    if len(scene.meshes[0].faces) == 0:
        raise MoveItCommanderException("There are no faces in the mesh")
    
    mesh = Mesh()
    first_face = scene.meshes[0].faces[0]
    if hasattr(first_face, '__len__'):
        for face in scene.meshes[0].faces:
            if len(face) == 3:
                triangle = MeshTriangle()
                triangle.vertex_indices = [face[0], face[1], face[2]]
                mesh.triangles.append(triangle)
    elif hasattr(first_face, 'indices'):
        for face in scene.meshes[0].faces:
            if len(face.indices) == 3:
                triangle = MeshTriangle()
                triangle.vertex_indices = [face.indices[0],
                                           face.indices[1],
                                           face.indices[2]]
                mesh.triangles.append(triangle)
    else:
        raise RuntimeError("Unable to build triangles from mesh due to mesh object structure")
    for vertex in scene.meshes[0].vertices:
        point = Point()
        point.x = vertex[0]*scale[0]
        point.y = vertex[1]*scale[1]
        point.z = vertex[2]*scale[2]
        mesh.vertices.append(point)
    pyassimp.release(scene)
    return mesh 
开发者ID:jhu-lcsr,项目名称:costar_plan,代码行数:41,代码来源:urdf_to_collision_object.py


注:本文中的pyassimp.release方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。