(meshfile)
| 90 | |
| 91 | |
| 92 | def loadobj(meshfile): |
| 93 | v = [] |
| 94 | f = [] |
| 95 | meshfp = open(meshfile, 'r') |
| 96 | for line in meshfp.readlines(): |
| 97 | data = line.strip().split(' ') |
| 98 | data = [da for da in data if len(da) > 0] |
| 99 | if len(data) != 4: |
| 100 | continue |
| 101 | if data[0] == 'v': |
| 102 | v.append([float(d) for d in data[1:]]) |
| 103 | if data[0] == 'f': |
| 104 | data = [da.split('/')[0] for da in data] |
| 105 | f.append([int(d) for d in data[1:]]) |
| 106 | meshfp.close() |
| 107 | |
| 108 | # torch need int64 |
| 109 | facenp_fx3 = np.array(f, dtype=np.int64) - 1 |
| 110 | pointnp_px3 = np.array(v, dtype=np.float32) |
| 111 | return pointnp_px3, facenp_fx3 |
| 112 | |
| 113 | |
| 114 | def loadobjtex(meshfile): |
nothing calls this directly
no outgoing calls
no test coverage detected