From 5d5e7df7c5bc93ef4b1b23c464aeb4d994e6379d Mon Sep 17 00:00:00 2001 From: Jasmine Hsu Date: Mon, 27 Jun 2016 11:19:57 -0700 Subject: [PATCH] exposing near/far values as params; commented out debug printf which caused failed checks --- examples/pybullet/pybullet.c | 42 +++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/examples/pybullet/pybullet.c b/examples/pybullet/pybullet.c index bf55cc46a..aa0115e95 100644 --- a/examples/pybullet/pybullet.c +++ b/examples/pybullet/pybullet.c @@ -1033,8 +1033,9 @@ static PyObject* pybullet_renderImage(PyObject* self, PyObject* args) float cameraUp[3]; float left, right, bottom, top, aspect; - float nearVal = .001; - float farVal = 1000; + float nearVal, farVal; + // float nearVal = .001; + // float farVal = 1000; // inialize cmd b3SharedMemoryCommandHandle command; @@ -1073,32 +1074,33 @@ static PyObject* pybullet_renderImage(PyObject* self, PyObject* args) if (size==5) // set camera resoluation and view and projection matrix { - if (PyArg_ParseTuple(args, "iiOOO", &width, &height, &objCameraPos, &objTargetPos, &objCameraUp)) + if (PyArg_ParseTuple(args, "iiOOOii", &width, &height, &objCameraPos, &objTargetPos, &objCameraUp, &nearVal, %farVal)) { b3RequestCameraImageSetPixelResolution(command,width,height); if (pybullet_internalSetVector(objCameraPos, cameraPos) && pybullet_internalSetVector(objTargetPos, targetPos) && pybullet_internalSetVector(objCameraUp, cameraUp)) { - printf("\ncamera pos:\n"); - for(int i =0;i<3; i++) { - printf(" %f", cameraPos[i]); - } - - printf("\ntargetPos pos:\n"); - for(int i =0;i<3; i++) { - printf(" %f", targetPos[i]); - } - - printf("\ncameraUp pos:\n"); - for(int i =0;i<3; i++) { - printf(" %f", cameraUp[i]); - } - printf("\n"); + // printf("\ncamera pos:\n"); + // for(int i =0;i<3; i++) { + // printf(" %f", cameraPos[i]); + // } + // + // printf("\ntargetPos pos:\n"); + // for(int i =0;i<3; i++) { + // printf(" %f", targetPos[i]); + // } + // + // printf("\ncameraUp pos:\n"); + // for(int i =0;i<3; i++) { + // printf(" %f", cameraUp[i]); + // } + // printf("\n"); b3RequestCameraImageSetViewMatrix(command, cameraPos, targetPos, cameraUp); - printf("\n"); + // printf("\n"); } + aspect = width/height; left = -aspect * nearVal; right = aspect * nearVal; @@ -1106,7 +1108,7 @@ static PyObject* pybullet_renderImage(PyObject* self, PyObject* args) top = nearVal; b3RequestCameraImageSetProjectionMatrix(command, left, right, bottom, top, nearVal, farVal); - printf("\n"); + // printf("\n"); } }