equal
deleted
inserted
replaced
421 |
421 |
422 v = PyObject_New(RaytracerObject, &RaytracerType); |
422 v = PyObject_New(RaytracerObject, &RaytracerType); |
423 v->raytracer = new Raytracer(); |
423 v->raytracer = new Raytracer(); |
424 v->children = new vector<PyObject*>(); |
424 v->children = new vector<PyObject*>(); |
425 v->raytracer->setCamera(new Camera()); |
425 v->raytracer->setCamera(new Camera()); |
|
426 v->raytracer->setTop(new KdTree()); |
426 |
427 |
427 return (PyObject*)v; |
428 return (PyObject*)v; |
428 } |
429 } |
429 |
430 |
430 static void Raytracer_Destructor(PyObject* self) |
431 static void Raytracer_Destructor(PyObject* self) |
451 |
452 |
452 if (!PyArg_ParseTuple(args, "(ii)", &w, &h)) |
453 if (!PyArg_ParseTuple(args, "(ii)", &w, &h)) |
453 return NULL; |
454 return NULL; |
454 |
455 |
455 printf("[pyrit] Raytracing...\n"); |
456 printf("[pyrit] Raytracing...\n"); |
456 data = ((RaytracerObject *)self)->raytracer->render(w, h); |
457 ((RaytracerObject *)self)->raytracer->getTop()->optimize(); |
|
458 data = (float *) malloc(w*h*3*sizeof(float)); |
|
459 ((RaytracerObject *)self)->raytracer->render(w, h, data); |
457 if (!data) { |
460 if (!data) { |
458 Py_INCREF(Py_None); |
461 Py_INCREF(Py_None); |
459 return Py_None; |
462 return Py_None; |
460 } |
463 } |
461 |
464 |