+++ /dev/null
-/* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine
-
- Copyright (C) 2020 Javier Sancho <jsf@jsancho.org>
-
- This file is part of guile-irrlicht.
-
- guile-irrlicht is free software; you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 3 of the
- License, or (at your option) any later version.
-
- guile-irrlicht is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with guile-irrlicht. If not, see
- <http://www.gnu.org/licenses/>.
-*/
-
-#include <irrlicht/irrlicht.h>
-#include <libguile.h>
-#include "color.h"
-#include "gsubr.h"
-#include "vector2d.h"
-#include "vector3d.h"
-#include "vertex3d.h"
-#include "wrapped.h"
-
-using namespace irr;
-
-SCM
-S3DVertex_make (SCM position,
- SCM normal,
- SCM color,
- SCM tcoords)
-{
- video::S3DVertex* vertex =
- new video::S3DVertex (scm_to_vector3df (position),
- scm_to_vector3df (normal),
- scm_to_color (color),
- scm_to_vector2df (tcoords));
- return scm_from_irr_pointer ("<vertex3d>", (void*) vertex);
-}
-
-SCM
-S3DVertex_Pos (SCM vertex) {
- video::S3DVertex* s3dvertex = (video::S3DVertex*) scm_to_irr_pointer (vertex);
- return scm_from_vector3df (s3dvertex->Pos);
-}
-
-void
-init_vertex3d (void)
-{
- DEFINE_GSUBR ("S3DVertex_make", 4, 0, 0, S3DVertex_make);
- DEFINE_GSUBR ("S3DVertex_Pos", 1, 0, 0, S3DVertex_Pos);
-}
-
-video::E_VERTEX_TYPE
-scm_to_vertex_type (SCM vertex_type)
-{
- char* type_name = scm_to_utf8_string (scm_symbol_to_string (vertex_type));
- video::E_VERTEX_TYPE type;
-
- if (!strcmp (type_name, "standard"))
- {
- type = video::EVT_STANDARD;
- }
- else if (!strcmp (type_name, "2tcoords"))
- {
- type = video::EVT_2TCOORDS;
- }
- else if (!strcmp (type_name, "tangents"))
- {
- type = 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));
- }
-
- free (type_name);
- return type;
-}