forked from polmorenoc/inversegraphics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
process_mesh.py
36 lines (25 loc) · 921 Bytes
/
process_mesh.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import meshtool.filters.simplify_filters.sander_simplify
from meshtool.filters.base_filters import MetaFilter
from meshtool.filters import factory
from itertools import chain, izip, combinations
import collada
import numpy
def process(meshPath):
mesh = collada.Collada(meshPath)
# 'triangulate',
optimize_filters = [
'combine_primitives',
'optimize_sources',
'strip_unused_sources',
'normalize_indices'
]
for f in optimize_filters:
inst = factory.getInstance(f)
mesh = inst.apply(mesh)
# f = 'sander_simplify'
# pmout = open('pm_file', 'w')
# inst = factory.getInstance(f)
# mesh = inst.apply(mesh, pmout)
# s = meshtool.filters.simplify_filters.sander_simplify.SanderSimplify(mesh, pmout)
# meshsimple = s.simplify()
return mesh