#include <irrlicht/irrlicht.h>
#include <libguile.h>
+
#include "color.h"
+#include "gsubr.h"
#include "vector2d.h"
#include "vector3d.h"
#include "vertex3d.h"
init_vertex3d (void)
{
init_vertex3d_type ();
- scm_c_define_gsubr ("make-vertex3d", 4, 0, 0, (scm_t_subr)make_vertex3d);
- scm_c_export ("make-vertex3d", NULL);
+ DEFINE_GSUBR ("make-vertex3d", 4, 0, 0, make_vertex3d);
+ DEFINE_GSUBR ("vertex3d-position", 1, 0, 0, vertex3d_position);
}
DEFINE_WRAPPED_TYPE (irr::video::S3DVertex*, "vertex3d",
return wrap_vertex3d (vertex);
}
+ SCM
+ vertex3d_position (SCM vertex) {
+ irr::video::S3DVertex* s3dvertex = unwrap_vertex3d (vertex);
+ return scm_from_vector3df (s3dvertex->Pos);
+ }
+
+ irr::video::E_VERTEX_TYPE
+ scm_to_vertex_type (SCM vertex_type)
+ {
+ char* type = scm_to_utf8_stringn (scm_symbol_to_string (vertex_type), NULL);
+ if (!strcmp (type, "standard"))
+ {
+ return irr::video::EVT_STANDARD;
+ }
+ else if (!strcmp (type, "2tcoords"))
+ {
+ return irr::video::EVT_2TCOORDS;
+ }
+ else if (!strcmp (type, "tangents"))
+ {
+ return irr::video::EVT_TANGENTS;
+ }
+ else
+ {
+ scm_error (scm_arg_type_key, NULL, "Wrong vertex_type: ~S",
+ scm_list_1 (vertex_type), scm_list_1 (vertex_type));
+ }
+ }
+
}