120 return NULL; |
120 return NULL; |
121 if (TCol && !PyArg_ParseTuple(TCol, "fff", &cr, &cg, &cb)) |
121 if (TCol && !PyArg_ParseTuple(TCol, "fff", &cr, &cg, &cb)) |
122 return NULL; |
122 return NULL; |
123 |
123 |
124 v = PyObject_New(LightObject, &LightType); |
124 v = PyObject_New(LightObject, &LightType); |
125 v->light = new Light(Vector3(px, py, pz), Colour(cr, cg, cb)); |
125 v->light = new Light(Vector(px, py, pz), Colour(cr, cg, cb)); |
126 return (PyObject*)v; |
126 return (PyObject*)v; |
127 } |
127 } |
128 |
128 |
129 static void Light_Destructor(PyObject* self) |
129 static void Light_Destructor(PyObject* self) |
130 { |
130 { |
220 if (!PyArg_ParseTuple(Tv, "fff", &vx, &vy, &vz)) |
220 if (!PyArg_ParseTuple(Tv, "fff", &vx, &vy, &vz)) |
221 return NULL; |
221 return NULL; |
222 |
222 |
223 v = PyObject_New(CameraObject, &CameraType); |
223 v = PyObject_New(CameraObject, &CameraType); |
224 if (TLookAt) |
224 if (TLookAt) |
225 v->camera = new Camera(Vector3(ex, ey, ez), |
225 v->camera = new Camera(Vector(ex, ey, ez), |
226 Vector3(lax, lay, laz), Vector3(upx, upy, upz)); |
226 Vector(lax, lay, laz), Vector(upx, upy, upz)); |
227 else |
227 else |
228 v->camera = new Camera(Vector3(ex, ey, ez), |
228 v->camera = new Camera(Vector(ex, ey, ez), |
229 Vector3(px, py, pz), Vector3(ux, uy, uz), Vector3(vx, vy, vz)); |
229 Vector(px, py, pz), Vector(ux, uy, uz), Vector(vx, vy, vz)); |
230 return (PyObject*)v; |
230 return (PyObject*)v; |
231 } |
231 } |
232 |
232 |
233 static void Camera_Destructor(PyObject* self) |
233 static void Camera_Destructor(PyObject* self) |
234 { |
234 { |
453 if (TNor) |
453 if (TNor) |
454 if (!PyArg_ParseTuple(TNor, "fff", &nx, &ny, &nz)) |
454 if (!PyArg_ParseTuple(TNor, "fff", &nx, &ny, &nz)) |
455 return NULL; |
455 return NULL; |
456 |
456 |
457 v = PyObject_New(NormalVertexObject, &NormalVertexType); |
457 v = PyObject_New(NormalVertexObject, &NormalVertexType); |
458 v->nvertex = new NormalVertex(Vector3(vx, vy, vz), Vector3(nx, ny, nz)); |
458 v->nvertex = new NormalVertex(Vector(vx, vy, vz), Vector(nx, ny, nz)); |
459 } |
459 } |
460 return (PyObject*)v; |
460 return (PyObject*)v; |
461 } |
461 } |
462 |
462 |
463 static void NormalVertex_Destructor(PyObject* self) |
463 static void NormalVertex_Destructor(PyObject* self) |
565 |
565 |
566 static PyObject* Triangle_getNormal(PyObject* self, PyObject* args) |
566 static PyObject* Triangle_getNormal(PyObject* self, PyObject* args) |
567 { |
567 { |
568 PyObject *obj; |
568 PyObject *obj; |
569 |
569 |
570 Vector3 N = ((Triangle*)((TriangleObject *)self)->shape.shape)->getNormal(); |
570 Vector N = ((Triangle*)((TriangleObject *)self)->shape.shape)->getNormal(); |
571 |
571 |
572 obj = Py_BuildValue("(fff)", N.x, N.y, N.z); |
572 obj = Py_BuildValue("(fff)", N.x, N.y, N.z); |
573 return obj; |
573 return obj; |
574 } |
574 } |
575 |
575 |
612 |
612 |
613 if (!PyArg_ParseTuple(TCentre, "fff", &cx, &cy, &cz)) |
613 if (!PyArg_ParseTuple(TCentre, "fff", &cx, &cy, &cz)) |
614 return NULL; |
614 return NULL; |
615 |
615 |
616 v = PyObject_New(SphereObject, &SphereType); |
616 v = PyObject_New(SphereObject, &SphereType); |
617 v->shape.shape = new Sphere(Vector3(cx, cy, cz), radius, material->material); |
617 v->shape.shape = new Sphere(Vector(cx, cy, cz), radius, material->material); |
618 Py_INCREF(material); |
618 Py_INCREF(material); |
619 return (PyObject*)v; |
619 return (PyObject*)v; |
620 } |
620 } |
621 |
621 |
622 //=========================== Box Object =========================== |
622 //=========================== Box Object =========================== |
662 |
662 |
663 if (!PyArg_ParseTuple(TH, "fff", &hx, &hy, &hz)) |
663 if (!PyArg_ParseTuple(TH, "fff", &hx, &hy, &hz)) |
664 return NULL; |
664 return NULL; |
665 |
665 |
666 v = PyObject_New(BoxObject, &BoxType); |
666 v = PyObject_New(BoxObject, &BoxType); |
667 v->shape.shape = new Box(Vector3(lx, ly, lz), Vector3(hx, hy, hz), material->material); |
667 v->shape.shape = new Box(Vector(lx, ly, lz), Vector(hx, hy, hz), material->material); |
668 Py_INCREF(material); |
668 Py_INCREF(material); |
669 return (PyObject*)v; |
669 return (PyObject*)v; |
670 } |
670 } |
671 |
671 |
672 //=========================== Pixmap Object =========================== |
672 //=========================== Pixmap Object =========================== |