Skip to content

Commit 36b615a

Browse files
committed
WIP
1 parent b3dc39c commit 36b615a

File tree

1 file changed

+69
-14
lines changed

1 file changed

+69
-14
lines changed

PyGLM/functions/detail/func_common.h

Lines changed: 69 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,32 @@ case get_format_specifier<bool>(): \
262262
return apply_min_from_PyObject_vector_vector<L, bool>(items); \
263263
}
264264

265+
// #define GLM_ARRAY_MINMAX_IF_IS_VEC(F, T) switch (arr1->shape[0]) {\
266+
// case 1:\
267+
// return F<glm::vec<1, T>>(arr1->data);
268+
// case 2:\
269+
// return F<glm::vec<2, T>>(arr1->data);
270+
// case 3:\
271+
// return F<glm::vec<3, T>>(arr1->data);
272+
// case 4:\
273+
// return F<glm::vec<4, T>>(arr1->data);
274+
// default:\
275+
// PyGLM_ASSERT(0, "Invalid shape occured. This should not have happened.");\
276+
// }
277+
278+
// template<typename T>
279+
// static T
280+
// min_internal(T* items) {
281+
// T minimum = items[0];
282+
// for (T item : items) {
283+
// if (item == minimum) {
284+
// continue;
285+
// }
286+
// minimum = glm::min(item, minimum);
287+
// }
288+
// return minimum;
289+
// }
290+
265291
static PyObject*
266292
min_(PyObject*, PyObject* args) {
267293
PyObject *arg1, *arg2 = NULL, *arg3 = NULL, *arg4 = NULL;
@@ -275,20 +301,49 @@ min_(PyObject*, PyObject* args) {
275301
// the correct template to apply_min over the contents of a glmArray
276302
PyGLMTypeObject* pti = (PyGLMTypeObject*)type;
277303

278-
switch (pti->C) {
279-
case 1:
280-
min_GEN_TYPE_SWITCH_STATEMENT_FOR_VECTOR(1);
281-
break;
282-
case 2:
283-
min_GEN_TYPE_SWITCH_STATEMENT_FOR_VECTOR(2);
284-
break;
285-
case 3:
286-
min_GEN_TYPE_SWITCH_STATEMENT_FOR_VECTOR(3);
287-
break;
288-
case 4:
289-
min_GEN_TYPE_SWITCH_STATEMENT_FOR_VECTOR(4);
290-
break;
291-
}
304+
// switch (pti->C) {
305+
// case 1:
306+
// min_GEN_TYPE_SWITCH_STATEMENT_FOR_VECTOR(1);
307+
// break;
308+
// case 2:
309+
// min_GEN_TYPE_SWITCH_STATEMENT_FOR_VECTOR(2);
310+
// break;
311+
// case 3:
312+
// min_GEN_TYPE_SWITCH_STATEMENT_FOR_VECTOR(3);
313+
// break;
314+
// case 4:
315+
// min_GEN_TYPE_SWITCH_STATEMENT_FOR_VECTOR(4);
316+
// break;
317+
// }
318+
319+
// if (arr1->glmType == PyGLM_TYPE_VEC) {
320+
// switch (arr1->format) {
321+
// case 'f':
322+
// GLM_ARRAY_MIN_IF_IS_VEC(min_internal, float);
323+
// case 'd':
324+
// GLM_ARRAY_MIN_IF_IS_VEC(min_internal, double);
325+
// case 'i':
326+
// GLM_ARRAY_MIN_IF_IS_VEC(min_internal, int32);
327+
// case 'I':
328+
// GLM_ARRAY_MIN_IF_IS_VEC(min_internal, uint32);
329+
// case 'b':
330+
// GLM_ARRAY_MIN_IF_IS_VEC(min_internal, int8);
331+
// case 'B':
332+
// GLM_ARRAY_MIN_IF_IS_VEC(min_internal, uint8);
333+
// case 'h':
334+
// GLM_ARRAY_MIN_IF_IS_VEC(min_internal, int16);
335+
// case 'H':
336+
// GLM_ARRAY_MIN_IF_IS_VEC(min_internal, uint16);
337+
// case 'q':
338+
// GLM_ARRAY_MIN_IF_IS_VEC(min_internal, int64);
339+
// case 'Q':
340+
// GLM_ARRAY_MIN_IF_IS_VEC(min_internal, uint64);
341+
// case '?':
342+
// GLM_ARRAY_MIN_IF_IS_VEC(min_internal, bool);
343+
// default:
344+
// PyGLM_ASSERT(0, "Invalid format specifier. This should not have happened.");
345+
// }
346+
// }
292347
}
293348
if (PyObject_IterCheck(arg1)) {
294349
PyObject* iterator = PyObject_GetIter(arg1);

0 commit comments

Comments
 (0)