--- a/src/raytracermodule.cc Thu May 15 19:15:57 2008 +0200
+++ b/src/raytracermodule.cc Mon May 19 22:59:04 2008 +0200
@@ -914,8 +914,9 @@
}
-//=========================== Vertex Object (abstract) ===========================
+//=========================== Vertex Object ===========================
+static PyObject *Vertex_Constructor(PyObject* self, PyObject* args, PyObject *kwd);
static void Vertex_Destructor(PyObject* self);
static PyMethodDef VertexMethods[] = {
@@ -935,6 +936,32 @@
0 /* tp_init */
);
+static PyObject* Vertex_Constructor(PyObject* self, PyObject* args, PyObject *kwd)
+{
+ VertexObject *v;
+ static char *kwdlist[] = {"vector", NULL};
+ PyObject *TVer = NULL;
+ Float vx, vy, vz;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwd, "O", kwdlist, &TVer))
+ return NULL;
+
+ if (TVer->ob_type == &VertexType)
+ {
+ v = PyObject_New(VertexObject, &VertexType);
+ v->vertex = new Vertex(*((VertexObject*)TVer)->vertex);
+ }
+ else
+ {
+ if (!PyArg_ParseTuple(TVer, "fff", &vx, &vy, &vz))
+ return NULL;
+
+ v = PyObject_New(VertexObject, &VertexType);
+ v->vertex = new Vertex(Vector(vx, vy, vz));
+ }
+ return (PyObject*)v;
+}
+
static void Vertex_Destructor(PyObject* self)
{
delete ((VertexObject *)self)->vertex;