コード例 #1
0
ファイル: VRPyTransform.cpp プロジェクト: uagmw/polyvr
PyObject* VRPyTransform::getCollisions(VRPyTransform* self) {
    if (!self->valid()) return NULL;
    auto cols = self->objPtr->getPhysics()->getCollisions();
    PyObject* res = PyList_New(cols.size());
    int i=0;
    for (auto c : cols) {
        PyObject* cres = PyTuple_New(3);
        PyTuple_SetItem(cres, 0, toPyTuple(c.pos1));
        PyTuple_SetItem(cres, 1, toPyTuple(c.pos2));
        PyTuple_SetItem(cres, 2, toPyTuple(c.norm));
        PyList_SetItem(res, i, cres);
        i++;
    }
    return res;
}
コード例 #2
0
ファイル: VRPyPath.cpp プロジェクト: uagmw/polyvr
PyObject* VRPyPath::getPoints(VRPyPath* self) {
    if (self->obj == 0) { PyErr_SetString(err, "VRPyPath::getPoints - Object is invalid"); return NULL; }
    auto pnts = self->obj->getPoints();
    if (pnts.size() == 0) return PyList_New(0);
    PyObject* res = PyList_New(pnts.size());
    for (uint i=0; i<pnts.size(); i++) {
        PyObject* pnt = PyList_New(4);
        PyList_SetItem(pnt, 0, toPyTuple(pnts[i].p));
        PyList_SetItem(pnt, 1, toPyTuple(pnts[i].n));
        PyList_SetItem(pnt, 2, toPyTuple(pnts[i].c));
        PyList_SetItem(pnt, 3, toPyTuple(pnts[i].u));
        PyList_SetItem(res, i, pnt);
    }
    return res;
}
コード例 #3
0
PyObject* VRPyTransform::getCollisions(VRPyTransform* self) {
    if (self->obj == 0) { PyErr_SetString(err, "VRPyTransform::setGhost, Object is invalid"); return NULL; }
    auto cols = self->obj->getPhysics()->getCollisions();
    PyObject* res = PyList_New(cols.size());
    int i=0;
    for (auto c : cols) {
        PyObject* cres = PyTuple_New(3);
        PyTuple_SetItem(cres, 0, toPyTuple(c.pos1));
        PyTuple_SetItem(cres, 1, toPyTuple(c.pos2));
        PyTuple_SetItem(cres, 2, toPyTuple(c.norm));
        PyList_SetItem(res, i, cres);
        i++;
    }
    return res;
}
コード例 #4
0
ファイル: VRPyPath.cpp プロジェクト: uagmw/polyvr
PyObject* VRPyPath::getPositions(VRPyPath* self) {
    if (self->obj == 0) { PyErr_SetString(err, "VRPyPath::getPositions - Object is invalid"); return NULL; }
    auto pos = self->obj->getPositions();
    if (pos.size() == 0) return PyList_New(0);
    PyObject* res = PyList_New(pos.size());
    for (uint i=0; i<pos.size(); i++) PyList_SetItem(res, i, toPyTuple(pos[i]));
    return res;
}
コード例 #5
0
ファイル: VRPyTransform.cpp プロジェクト: uagmw/polyvr
PyObject* VRPyTransform::getConstraintAngleWith(VRPyTransform* self, PyObject *args) {
    if (!self->valid()) return NULL;
    VRPyTransform *t;
    int rotationOrPosition = 0;
    if (! PyArg_ParseTuple(args, "Oi",&t, &rotationOrPosition)) return NULL;
    OSG::Vec3f a = OSG::Vec3f(0.0,0.0,0.0);
    //cout << (self->objPtr->getPhysics()->getConstraintAngle(t->obj->getPhysics(),rotationOrPosition));
    if(rotationOrPosition == 0) {
        a[0] = (self->objPtr->getPhysics()->getConstraintAngle(t->obj->getPhysics(),0));
        a[1] = (self->objPtr->getPhysics()->getConstraintAngle(t->obj->getPhysics(),1));
        a[2] = (self->objPtr->getPhysics()->getConstraintAngle(t->obj->getPhysics(),2));
    }
    else if(rotationOrPosition == 1) {
        a[0] = (self->objPtr->getPhysics()->getConstraintAngle(t->obj->getPhysics(),3));
        a[1] = (self->objPtr->getPhysics()->getConstraintAngle(t->obj->getPhysics(),4));
        a[2] = (self->objPtr->getPhysics()->getConstraintAngle(t->obj->getPhysics(),5));
    }

    //Py_RETURN_TRUE;
    return toPyTuple(a);
}
コード例 #6
0
ファイル: VRPyRecorder.cpp プロジェクト: uagmw/polyvr
PyObject* VRPyRecorder::getUp(VRPyRecorder* self, PyObject* args) { return toPyTuple(self->obj->getUp( parseInt(args) ) ); }
コード例 #7
0
ファイル: VRPyColorChooser.cpp プロジェクト: TobiasHue/polyvr
PyObject* VRPyColorChooser::getLastColor(VRPyColorChooser* self) {
    if (self->obj == 0) { PyErr_SetString(err, "VRPyColorChooser::getColor - Object is invalid"); return NULL; }
    return toPyTuple( self->obj->getLastColor() );
}
コード例 #8
0
ファイル: VRPyTransform.cpp プロジェクト: uagmw/polyvr
PyObject* VRPyTransform::getTorque(VRPyTransform* self) {
    if (!self->valid()) return NULL;
    OSG::Vec3f i = self->objPtr->getPhysics()->getForce();
    return toPyTuple(i);
}
コード例 #9
0
ファイル: VRPyTransform.cpp プロジェクト: uagmw/polyvr
PyObject* VRPyTransform::getScale(VRPyTransform* self) {
    if (!self->valid()) return NULL;
    return toPyTuple(self->objPtr->getScale());
}
コード例 #10
0
ファイル: VRPyTransform.cpp プロジェクト: uagmw/polyvr
PyObject* VRPyTransform::getWorldDir(VRPyTransform* self) {
    if (!self->valid()) return NULL;
    return toPyTuple(self->objPtr->getWorldDirection());
}
コード例 #11
0
PyObject* VRPyTransform::getTorque(VRPyTransform* self) {
    if (self->obj == 0) { PyErr_SetString(err, "VRPyTransform::getTorque: C Object is invalid"); return NULL; }
    OSG::Vec3f i = self->obj->getPhysics()->getForce();
    return toPyTuple(i);
}
コード例 #12
0
PyObject* VRPyTransform::getScale(VRPyTransform* self) {
    if (self->obj == 0) { PyErr_SetString(err, "VRPyTransform::getScale, Object is invalid"); return NULL; }
    return toPyTuple(self->obj->getScale());
}
コード例 #13
0
PyObject* VRPyTransform::getWFrom(VRPyTransform* self) {
    if (self->obj == 0) { PyErr_SetString(err, "VRPyTransform::getWFrom, Object is invalid"); return NULL; }
    return toPyTuple(self->obj->getWorldPosition());
}
コード例 #14
0
ファイル: VRPyMaterial.cpp プロジェクト: uagmw/polyvr
PyObject* VRPyMaterial::getSpecular(VRPyMaterial* self) {
    if (self->objPtr == 0) { PyErr_SetString(err, "VRPyMaterial::getSpecular, C obj is invalid"); return NULL; }
    return toPyTuple(self->objPtr->getSpecular());
}