Example #1
0
static PyObject* pyConvexIsect_transform(pyConvexIsect* self, PyObject* args) {
    PyObject* l2w;
    PyObject* w2l;
    if (!PyArg_ParseTuple(args, "OO", &l2w, &w2l) || !pyMatrix44_Check(l2w) || !pyMatrix44_Check(w2l)) {
        PyErr_SetString(PyExc_TypeError, "transform expects hsMatrix44, hsMatrix44");
        return NULL;
    }
    self->fThis->transform(*((pyMatrix44*)l2w)->fThis, *((pyMatrix44*)w2l)->fThis);
    Py_INCREF(Py_None);
    return Py_None;
}
Example #2
0
static PyObject* pyMatrix44_multiply(PyObject* left, PyObject* right) {
    if (pyMatrix44_Check(left)) {
        if (pyMatrix44_Check(right)) {
            return pyMatrix44_FromMatrix44(*((pyMatrix44*)left)->fThis * *((pyMatrix44*)right)->fThis);
        } else {
            PyErr_SetString(PyExc_TypeError, "Multiplication operand is not another matrix");
            return NULL;
        }
    } else if (pyMatrix44_Check(right)) {
        PyErr_SetString(PyExc_TypeError, "Multiplication operand is not another matrix");
        return NULL;
    }
    // This should not happen...
    return NULL;
}
static int pyCoordinateInterface_setW2L(pyCoordinateInterface* self, PyObject* value, void*) {
    if (value == NULL || (!pyMatrix44_Check(value))) {
        PyErr_SetString(PyExc_TypeError, "worldToLocal should be an hsMatrix44");
        return -1;
    }
    self->fThis->setWorldToLocal(*((pyMatrix44*)value)->fThis);
    return 0;
}
Example #4
0
static int pySpanInstance_setL2W(pySpanInstance* self, PyObject* value, void*) {
    if (value == NULL || !pyMatrix44_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "localToWorld should be an hsMatrix44");
        return -1;
    }
    self->fThis->setLocalToWorld(*((pyMatrix44*)value)->fThis);
    return 0;
}
Example #5
0
static int pyViewFaceModifier_setP2L(pyViewFaceModifier* self, PyObject* value, void*) {
    if (value == NULL || !pyMatrix44_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "parentToLocal should be an hsMatrix44");
        return -1;
    }
    self->fThis->setParentToLocal(*((pyMatrix44*)value)->fThis);
    return 0;
}
Example #6
0
static int pyGeometrySpan_setWorldToLocal(pyGeometrySpan* self, PyObject* value, void*) {
    if (value == NULL || !pyMatrix44_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "worldToLocal should be an hsMatrix44");
        return -1;
    }
    self->fThis->setWorldToLocal(*((pyMatrix44*)value)->fThis);
    return 0;
}
Example #7
0
static int pyLightInfo_setW2L(pyLightInfo* self, PyObject* value, void*) {
    if (value == NULL || !pyMatrix44_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "worldToLight should be an hsMatrix44");
        return -1;
    }
    self->fThis->setWorldToLight(*((pyMatrix44*)value)->fThis);
    return 0;
}
Example #8
0
static int pyMatrix44Key_setValue(pyMatrix44Key* self, PyObject* value, void*) {
    if (value == NULL || !pyMatrix44_Check(value)) {
        PyErr_SetString(PyExc_TypeError, "value should be an hsMatrix44");
        return -1;
    }
    self->fThis->fValue = *((pyMatrix44*)value)->fThis;
    return 0;
}
Example #9
0
static PyObject* pyDrawableSpans_addTransform(pyDrawableSpans* self, PyObject* args) {
    pyMatrix44* l2w;
    pyMatrix44* w2l;
    pyMatrix44* l2b;
    pyMatrix44* b2l;
    if (!PyArg_ParseTuple(args, "OOOO", &l2w, &w2l, &l2b, &b2l)) {
        PyErr_SetString(PyExc_TypeError, "addTransform expects 4 hsMatrix44s");
        return NULL;
    }
    if (!pyMatrix44_Check((PyObject*)l2w) || !pyMatrix44_Check((PyObject*)w2l) ||
        !pyMatrix44_Check((PyObject*)l2b) || !pyMatrix44_Check((PyObject*)b2l)) {
        PyErr_SetString(PyExc_TypeError, "addTransform expects 4 hsMatrix44s");
        return NULL;
    }
    self->fThis->addTransform(*l2w->fThis, *w2l->fThis, *l2b->fThis, *b2l->fThis);
    Py_INCREF(Py_None);
    return Py_None;
}
Example #10
0
static int pyMatrix44___init__(pyMatrix44* self, PyObject* args, PyObject* kwds) {
    PyObject* init = NULL;
    if (!PyArg_ParseTuple(args, "|O", &init))
        return -1;

    if (init != NULL) {
        if (pyMatrix44_Check(init)) {
            (*self->fThis) = (*((pyMatrix44*)init)->fThis);
        } else {
            PyErr_SetString(PyExc_TypeError, "__init__ expects a matrix");
            return -1;
        }
    } else {
        self->fThis->Reset();
    }
    return 0;
}