How to use the pyassimp.postprocess.aiProcess_Triangulate function in pyassimp

To help you get started, we’ve selected a few pyassimp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github RobotLocomotion / director / src / python / director / assimp2vtk.py View on Github external
def loadAssimpSceneFromFile(inFile):
    baseDir = os.path.dirname(inFile)
    scene = pyassimp.load(inFile, pyassimp.postprocess.aiProcess_Triangulate)
    return AssimpScene(scene, baseDir)
github DLR-RM / AugmentedAutoencoder / auto_pose / meshrenderer / gl_utils / geometry.py View on Github external
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
github assimp / assimp / port / PyAssimp / scripts / sample.py View on Github external
def main(filename=None):

    scene = pyassimp.load(filename, processing=pyassimp.postprocess.aiProcess_Triangulate)
    
    #the model we load
    print("MODEL:" + filename)
    print
    
    #write some statistics
    print("SCENE:")
    print("  meshes:" + str(len(scene.meshes)))
    print("  materials:" + str(len(scene.materials)))
    print("  textures:" + str(len(scene.textures)))
    print
    
    print("NODES:")
    recur_node(scene.rootnode)

    print
github TangibleDisplay / twiz / ddd / assimpobjloader.py View on Github external
def __init__(self, source):
        # super(AssimpObjLoader, **kwargs)
        # source = kwargs.get('source', '')
        if not source:
            print "no source given!"
            return

        self.scene = scene = load(
            source, 0
            | postprocess.aiProcess_Triangulate
            | postprocess.aiProcess_SplitLargeMeshes
            | postprocess.aiProcess_GenNormals
            )

        self.objects = {}
        for i, mesh in enumerate(scene.meshes):
            self.objects[i] = AssimpMesh(scene, mesh)
github TangibleDisplay / twiz / examples / cube / libs / garden / garden.ddd / assimpobjloader.py View on Github external
def __init__(self, source):
        # super(AssimpObjLoader, **kwargs)
        # source = kwargs.get('source', '')
        if not source:
            print "no source given!"
            return

        self.scene = scene = load(
            source, 0
            | postprocess.aiProcess_Triangulate
            | postprocess.aiProcess_SplitLargeMeshes
            | postprocess.aiProcess_GenNormals
            )

        self.objects = {}
        for i, mesh in enumerate(scene.meshes):
            self.objects[i] = AssimpMesh(scene, mesh)
github MTASZTAKI / ApertusVR / 3rdParty / assimp / port / PyAssimp / scripts / sample.py View on Github external
def main(filename=None):

    scene = pyassimp.load(filename, processing=pyassimp.postprocess.aiProcess_Triangulate)
    
    #the model we load
    print("MODEL:" + filename)
    print
    
    #write some statistics
    print("SCENE:")
    print("  meshes:" + str(len(scene.meshes)))
    print("  materials:" + str(len(scene.materials)))
    print("  textures:" + str(len(scene.textures)))
    print
    
    print("NODES:")
    recur_node(scene.rootnode)

    print
github tensorflow / models / research / cognitive_mapping_and_planning / render / swiftshader_renderer.py View on Github external
def get_pyassimp_load_options(self):
    load_flags = assimp.postprocess.aiProcess_Triangulate;
    load_flags = load_flags | assimp.postprocess.aiProcess_SortByPType;
    load_flags = load_flags | assimp.postprocess.aiProcess_OptimizeMeshes;
    load_flags = load_flags | assimp.postprocess.aiProcess_RemoveRedundantMaterials;
    load_flags = load_flags | assimp.postprocess.aiProcess_FindDegenerates;
    load_flags = load_flags | assimp.postprocess.aiProcess_GenSmoothNormals;
    load_flags = load_flags | assimp.postprocess.aiProcess_JoinIdenticalVertices;
    load_flags = load_flags | assimp.postprocess.aiProcess_ImproveCacheLocality;
    load_flags = load_flags | assimp.postprocess.aiProcess_GenUVCoords;
    load_flags = load_flags | assimp.postprocess.aiProcess_FindInvalidData;
    return load_flags