Skip to content

Commit aabdad4

Browse files
author
root
committed
changed to switch structure
1 parent 9587ad9 commit aabdad4

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

python/main.cpp

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,23 +60,27 @@ pyLoadObj(PyObject* self, PyObject* args)
6060
{
6161
current = PyList_New(0);
6262

63-
if (i == 0){
63+
switch(i) {
64+
65+
case 0:
6466
current_name = "positions";
65-
vect = vectd(cm.positions.begin(), cm.positions.end()); }
66-
else if (i == 1){
67+
vect = vectd(cm.positions.begin(), cm.positions.end()); break;
68+
case 1:
6769
current_name = "normals";
68-
vect = vectd(cm.normals.begin(), cm.normals.end()); }
69-
else if (i == 2) {
70+
vect = vectd(cm.normals.begin(), cm.normals.end()); break;
71+
case 2:
7072
current_name = "texcoords";
71-
vect = vectd(cm.texcoords.begin(), cm.texcoords.end()); }
72-
else if (i == 3) {
73+
vect = vectd(cm.texcoords.begin(), cm.texcoords.end()); break;
74+
case 3:
7375
current_name = "indicies";
74-
vect = vectd(cm.indices.begin(), cm.indices.end()); }
75-
else if (i == 4) {
76+
vect = vectd(cm.indices.begin(), cm.indices.end()); break;
77+
case 4:
7678
current_name = "material_ids";
77-
vect = vectd(cm.material_ids.begin(), cm.material_ids.end()); }
78-
79-
for (vectd::iterator it = vect.begin() ;
79+
vect = vectd(cm.material_ids.begin(), cm.material_ids.end()); break;
80+
81+
}
82+
83+
for (vectd::iterator it = vect.begin() ;
8084
it != vect.end(); it++)
8185
{
8286
PyList_Insert(current, it - vect.begin(), PyFloat_FromDouble(*it));

0 commit comments

Comments
 (0)