示例#1
0
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
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
PyObject* VRPyRecorder::getUp(VRPyRecorder* self, PyObject* args) { return toPyTuple(self->obj->getUp( parseInt(args) ) ); }
示例#7
0
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
PyObject* VRPyTransform::getTorque(VRPyTransform* self) {
    if (!self->valid()) return NULL;
    OSG::Vec3f i = self->objPtr->getPhysics()->getForce();
    return toPyTuple(i);
}
示例#9
0
PyObject* VRPyTransform::getScale(VRPyTransform* self) {
    if (!self->valid()) return NULL;
    return toPyTuple(self->objPtr->getScale());
}
示例#10
0
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
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());
}