src/vector3d.cpp \
src/vertex3d.cpp \
src/video-driver.cpp \
- src/wchar.cpp \
src/wrapped.cpp
libguile_irrlicht_la_CPPFLAGS = @GUILE_CFLAGS@
libguile_irrlicht_la_LDFLAGS = \
scene::EMD2_ANIMATION_TYPE
scm_to_md2_animation_type (SCM md2_animation_type)
{
- char* flag = scm_to_utf8_string (scm_symbol_to_string (md2_animation_type));
- if (!strcmp (flag, "stand"))
+ char* type_name = scm_to_utf8_string (scm_symbol_to_string (md2_animation_type));
+ scene::EMD2_ANIMATION_TYPE type;
+
+ if (!strcmp (type_name, "stand"))
{
- return scene::EMAT_STAND;
+ type = scene::EMAT_STAND;
}
- else if (!strcmp (flag, "run"))
+ else if (!strcmp (type_name, "run"))
{
- return scene::EMAT_RUN;
+ type = scene::EMAT_RUN;
}
- else if (!strcmp (flag, "attack"))
+ else if (!strcmp (type_name, "attack"))
{
- return scene::EMAT_ATTACK;
+ type = scene::EMAT_ATTACK;
}
- else if (!strcmp (flag, "pain-a"))
+ else if (!strcmp (type_name, "pain-a"))
{
- return scene::EMAT_PAIN_A;
+ type = scene::EMAT_PAIN_A;
}
- else if (!strcmp (flag, "pain-b"))
+ else if (!strcmp (type_name, "pain-b"))
{
- return scene::EMAT_PAIN_B;
+ type = scene::EMAT_PAIN_B;
}
- else if (!strcmp (flag, "pain-c"))
+ else if (!strcmp (type_name, "pain-c"))
{
- return scene::EMAT_PAIN_C;
+ type = scene::EMAT_PAIN_C;
}
- else if (!strcmp (flag, "jump"))
+ else if (!strcmp (type_name, "jump"))
{
- return scene::EMAT_JUMP;
+ type = scene::EMAT_JUMP;
}
- else if (!strcmp (flag, "flip"))
+ else if (!strcmp (type_name, "flip"))
{
- return scene::EMAT_FLIP;
+ type = scene::EMAT_FLIP;
}
- else if (!strcmp (flag, "salute"))
+ else if (!strcmp (type_name, "salute"))
{
- return scene::EMAT_SALUTE;
+ type = scene::EMAT_SALUTE;
}
- else if (!strcmp (flag, "fallback"))
+ else if (!strcmp (type_name, "fallback"))
{
- return scene::EMAT_FALLBACK;
+ type = scene::EMAT_FALLBACK;
}
- else if (!strcmp (flag, "wave"))
+ else if (!strcmp (type_name, "wave"))
{
- return scene::EMAT_WAVE;
+ type = scene::EMAT_WAVE;
}
- else if (!strcmp (flag, "point"))
+ else if (!strcmp (type_name, "point"))
{
- return scene::EMAT_POINT;
+ type = scene::EMAT_POINT;
}
- else if (!strcmp (flag, "crouch-stand"))
+ else if (!strcmp (type_name, "crouch-stand"))
{
- return scene::EMAT_CROUCH_STAND;
+ type = scene::EMAT_CROUCH_STAND;
}
- else if (!strcmp (flag, "crouch-walk"))
+ else if (!strcmp (type_name, "crouch-walk"))
{
- return scene::EMAT_CROUCH_WALK;
+ type = scene::EMAT_CROUCH_WALK;
}
- else if (!strcmp (flag, "crouch-attack"))
+ else if (!strcmp (type_name, "crouch-attack"))
{
- return scene::EMAT_CROUCH_ATTACK;
+ type = scene::EMAT_CROUCH_ATTACK;
}
- else if (!strcmp (flag, "crouch-pain"))
+ else if (!strcmp (type_name, "crouch-pain"))
{
- return scene::EMAT_CROUCH_PAIN;
+ type = scene::EMAT_CROUCH_PAIN;
}
- else if (!strcmp (flag, "crouch-death"))
+ else if (!strcmp (type_name, "crouch-death"))
{
- return scene::EMAT_CROUCH_DEATH;
+ type = scene::EMAT_CROUCH_DEATH;
}
- else if (!strcmp (flag, "death-fallback"))
+ else if (!strcmp (type_name, "death-fallback"))
{
- return scene::EMAT_DEATH_FALLBACK;
+ type = scene::EMAT_DEATH_FALLBACK;
}
- else if (!strcmp (flag, "death-fallforward"))
+ else if (!strcmp (type_name, "death-fallforward"))
{
- return scene::EMAT_DEATH_FALLFORWARD;
+ type = scene::EMAT_DEATH_FALLFORWARD;
}
- else if (!strcmp (flag, "death-fallbackslow"))
+ else if (!strcmp (type_name, "death-fallbackslow"))
{
- return scene::EMAT_DEATH_FALLBACKSLOW;
+ type = scene::EMAT_DEATH_FALLBACKSLOW;
}
- else if (!strcmp (flag, "boom"))
+ else if (!strcmp (type_name, "boom"))
{
- return scene::EMAT_BOOM;
+ type = scene::EMAT_BOOM;
}
else
{
scm_error (scm_arg_type_key, NULL, "Wrong MD2 animation type: ~S",
scm_list_1 (md2_animation_type), scm_list_1 (md2_animation_type));
}
+
+ free (type_name);
+ return type;
}
#include "dimension2d.h"
#include "driver-types.h"
#include "gsubr.h"
-#include "wchar.h"
#include "wrapped.h"
using namespace irr;
IrrlichtDevice_setWindowCaption (SCM device,
SCM text)
{
- ((IrrlichtDevice*)scm_to_irr_pointer (device))->
- setWindowCaption (scm_to_wide_char_string (text));
+ wchar_t* wtext = (wchar_t*) scm_to_utf32_string (text);
+ ((IrrlichtDevice*)scm_to_irr_pointer (device))->setWindowCaption (wtext);
+ free (wtext);
return SCM_UNSPECIFIED;
}
video::E_DRIVER_TYPE
scm_to_driver_type (SCM driver_type)
{
- char* driverType = scm_to_utf8_string (scm_symbol_to_string (driver_type));
- if (!strcmp (driverType, "null"))
+ char* type_name = scm_to_utf8_string (scm_symbol_to_string (driver_type));
+ video::E_DRIVER_TYPE type;
+
+ if (!strcmp (type_name, "null"))
{
- return video::EDT_NULL;
+ type = video::EDT_NULL;
}
- else if (!strcmp (driverType, "software"))
+ else if (!strcmp (type_name, "software"))
{
- return video::EDT_SOFTWARE;
+ type = video::EDT_SOFTWARE;
}
- else if (!strcmp (driverType, "burnings"))
+ else if (!strcmp (type_name, "burnings"))
{
- return video::EDT_BURNINGSVIDEO;
+ type = video::EDT_BURNINGSVIDEO;
}
- else if (!strcmp (driverType, "direct3d8"))
+ else if (!strcmp (type_name, "direct3d8"))
{
- return video::EDT_DIRECT3D8;
+ type = video::EDT_DIRECT3D8;
}
- else if (!strcmp (driverType, "direct3d9"))
+ else if (!strcmp (type_name, "direct3d9"))
{
- return video::EDT_DIRECT3D9;
+ type = video::EDT_DIRECT3D9;
}
- else if (!strcmp (driverType, "opengl"))
+ else if (!strcmp (type_name, "opengl"))
{
- return video::EDT_OPENGL;
+ type = video::EDT_OPENGL;
}
else
{
scm_error (scm_arg_type_key, NULL, "Wrong driver type: ~S",
scm_list_1 (driver_type), scm_list_1 (driver_type));
}
+
+ free (type_name);
+ return type;
}
io::E_FILE_ARCHIVE_TYPE
scm_to_file_archive_type (SCM file_archive_type)
{
- char* type = scm_to_utf8_string (scm_symbol_to_string (file_archive_type));
- if (!strcmp (type, "zip"))
+ char* type_name = scm_to_utf8_string (scm_symbol_to_string (file_archive_type));
+ io::E_FILE_ARCHIVE_TYPE type;
+
+ if (!strcmp (type_name, "zip"))
{
- return io::EFAT_ZIP;
+ type = io::EFAT_ZIP;
}
- else if (!strcmp (type, "gzip"))
+ else if (!strcmp (type_name, "gzip"))
{
- return io::EFAT_GZIP;
+ type = io::EFAT_GZIP;
}
- else if (!strcmp (type, "folder"))
+ else if (!strcmp (type_name, "folder"))
{
- return io::EFAT_FOLDER;
+ type = io::EFAT_FOLDER;
}
- else if (!strcmp (type, "pak"))
+ else if (!strcmp (type_name, "pak"))
{
- return io::EFAT_PAK;
+ type = io::EFAT_PAK;
}
- else if (!strcmp (type, "npk"))
+ else if (!strcmp (type_name, "npk"))
{
- return io::EFAT_NPK;
+ type = io::EFAT_NPK;
}
- else if (!strcmp (type, "tar"))
+ else if (!strcmp (type_name, "tar"))
{
- return io::EFAT_TAR;
+ type = io::EFAT_TAR;
}
- else if (!strcmp (type, "wad"))
+ else if (!strcmp (type_name, "wad"))
{
- return io::EFAT_WAD;
+ type = io::EFAT_WAD;
}
- else if (!strcmp (type, "unknown"))
+ else if (!strcmp (type_name, "unknown"))
{
- return io::EFAT_UNKNOWN;
+ type = io::EFAT_UNKNOWN;
}
else
{
scm_error (scm_arg_type_key, NULL, "Wrong file archive type: ~S",
scm_list_1 (file_archive_type), scm_list_1 (file_archive_type));
}
+
+ free (type_name);
+ return type;
}
retArchiveReference = &retArchive;
}
- return scm_from_bool
+ char* cfilename = scm_to_utf8_string (filename);
+ char* cpassword = scm_to_utf8_string (password);
+ bool result =
(((io::IFileSystem*)scm_to_irr_pointer (file_system))->
- addFileArchive (scm_to_utf8_string (filename),
+ addFileArchive (cfilename,
scm_to_bool (ignore_case),
scm_to_bool (ignore_paths),
scm_to_file_archive_type (archive_type),
- scm_to_utf8_string (password),
+ cpassword,
retArchiveReference));
+
+ free (cfilename);
+ free (cpassword);
+ return scm_from_bool (result);
}
void
SCM text,
SCM tooltiptext)
{
+ wchar_t* wtext = (wchar_t*) scm_to_utf32_string (text);
+ wchar_t* wtooltiptext = (wchar_t*) scm_to_utf32_string (tooltiptext);
+
gui::IGUIButton* button =
((gui::IGUIEnvironment*)scm_to_irr_pointer (gui_environment))->
addButton (scm_to_rect_s32 (rectangle),
(TParent)scm_to_irr_pointer (parent),
scm_to_int32 (id),
- scm_to_wide_char_string (text),
- scm_to_wide_char_string (tooltiptext));
+ wtext,
+ wtooltiptext);
+
+ free (wtext);
+ free (wtooltiptext);
return scm_from_pointer ((void*)button, NULL);
}
SCM parent,
SCM id)
{
+ wchar_t* wtext = (wchar_t*) scm_to_utf32_string (text);
+
gui::IGUIEditBox* editbox =
((gui::IGUIEnvironment*)scm_to_irr_pointer (gui_environment))->
- addEditBox (scm_to_wide_char_string (text),
+ addEditBox (wtext,
scm_to_rect_s32 (rectangle),
scm_to_bool (border),
(TParent)scm_to_irr_pointer (parent),
scm_to_int32 (id));
+
+ free (wtext);
return scm_from_pointer ((void*)editbox, NULL);
}
SCM text)
{
gui::IGUIEnvironment* guienv = (gui::IGUIEnvironment*)scm_to_irr_pointer (gui_environment);
+ wchar_t* wtext = (wchar_t*) scm_to_utf32_string (text);
+
gui::IGUIImage* new_image =
guienv->addImage ((video::ITexture*)scm_to_irr_pointer (image),
scm_to_position2d_s32 (position),
scm_to_bool (use_alpha_channel),
(TParent)scm_to_irr_pointer (parent),
scm_to_int32 (id),
- scm_to_wide_char_string (text));
+ wtext);
+
+ free (wtext);
return scm_from_pointer ((void*) new_image, NULL);
}
SCM id,
SCM fill_background)
{
+ wchar_t* wtext = (wchar_t*) scm_to_utf32_string (text);
+
gui::IGUIStaticText* static_text =
((gui::IGUIEnvironment*)scm_to_irr_pointer (gui_environment))->
- addStaticText (scm_to_wide_char_string (text),
+ addStaticText (wtext,
scm_to_rect_s32 (rectangle),
scm_to_bool (border),
scm_to_bool (word_wrap),
(TParent)scm_to_irr_pointer (parent),
scm_to_int32 (id),
scm_to_bool (fill_background));
+
+ free (wtext);
return scm_from_pointer ((void*)static_text, NULL);
}
SCM parent,
SCM id)
{
+ wchar_t* wtext = (wchar_t*) scm_to_utf32_string (text);
+
gui::IGUIWindow* window =
((gui::IGUIEnvironment*)scm_to_irr_pointer (gui_environment))->
addWindow (scm_to_rect_s32 (rectangle),
scm_to_bool (modal),
- scm_to_wide_char_string (text),
+ wtext,
(TParent)scm_to_irr_pointer (parent),
scm_to_int32 (id));
+
+ free (wtext);
return scm_from_pointer ((void*)window, NULL);
}
IGUIEnvironment_getFont (SCM gui_environment,
SCM filename)
{
+ char* cfilename = scm_to_utf8_string (filename);
gui::IGUIFont* font =
- ((gui::IGUIEnvironment*)scm_to_irr_pointer (gui_environment))->
- getFont (scm_to_utf8_string (filename));
+ ((gui::IGUIEnvironment*)scm_to_irr_pointer (gui_environment))->getFont (cfilename);
+ free (cfilename);
return scm_from_pointer ((void*)font, NULL);
}
#include <libguile.h>
#include "gui-listbox.h"
#include "gsubr.h"
-#include "wchar.h"
#include "wrapped.h"
using namespace irr;
SCM icon)
{
gui::IGUIListBox* listbox = (gui::IGUIListBox*)scm_to_irr_pointer (gui_listbox);
+ wchar_t* wtext = (wchar_t*) scm_to_utf32_string (text);
u32 item_id;
if (icon == SCM_UNDEFINED)
{
- item_id = listbox->addItem (scm_to_wide_char_string (text));
+ item_id = listbox->addItem (wtext);
}
else
{
- item_id = listbox->addItem (scm_to_wide_char_string (text),
+ item_id = listbox->addItem (wtext,
scm_to_int32 (icon));
}
+ free (wtext);
return scm_from_uint32 (item_id);
}
gui::EGUI_DEFAULT_COLOR
scm_to_default_color (SCM default_color)
{
- char* color = scm_to_utf8_string (scm_symbol_to_string (default_color));
- if (!strcmp (color, "3d-dark-shadow"))
+ char* color_name = scm_to_utf8_string (scm_symbol_to_string (default_color));
+ gui::EGUI_DEFAULT_COLOR color;
+
+ if (!strcmp (color_name, "3d-dark-shadow"))
{
- return gui::EGDC_3D_DARK_SHADOW;
+ color = gui::EGDC_3D_DARK_SHADOW;
}
- else if (!strcmp (color, "3d-shadow"))
+ else if (!strcmp (color_name, "3d-shadow"))
{
- return gui::EGDC_3D_SHADOW;
+ color = gui::EGDC_3D_SHADOW;
}
- else if (!strcmp (color, "3d-face"))
+ else if (!strcmp (color_name, "3d-face"))
{
- return gui::EGDC_3D_FACE;
+ color = gui::EGDC_3D_FACE;
}
- else if (!strcmp (color, "3d-high-light"))
+ else if (!strcmp (color_name, "3d-high-light"))
{
- return gui::EGDC_3D_HIGH_LIGHT;
+ color = gui::EGDC_3D_HIGH_LIGHT;
}
- else if (!strcmp (color, "3d-light"))
+ else if (!strcmp (color_name, "3d-light"))
{
- return gui::EGDC_3D_LIGHT;
+ color = gui::EGDC_3D_LIGHT;
}
- else if (!strcmp (color, "active-border"))
+ else if (!strcmp (color_name, "active-border"))
{
- return gui::EGDC_ACTIVE_BORDER;
+ color = gui::EGDC_ACTIVE_BORDER;
}
- else if (!strcmp (color, "active-caption"))
+ else if (!strcmp (color_name, "active-caption"))
{
- return gui::EGDC_ACTIVE_CAPTION;
+ color = gui::EGDC_ACTIVE_CAPTION;
}
- else if (!strcmp (color, "app-workspace"))
+ else if (!strcmp (color_name, "app-workspace"))
{
- return gui::EGDC_APP_WORKSPACE;
+ color = gui::EGDC_APP_WORKSPACE;
}
- else if (!strcmp (color, "button-text"))
+ else if (!strcmp (color_name, "button-text"))
{
- return gui::EGDC_BUTTON_TEXT;
+ color = gui::EGDC_BUTTON_TEXT;
}
- else if (!strcmp (color, "gray-text"))
+ else if (!strcmp (color_name, "gray-text"))
{
- return gui::EGDC_GRAY_TEXT;
+ color = gui::EGDC_GRAY_TEXT;
}
- else if (!strcmp (color, "high-light"))
+ else if (!strcmp (color_name, "high-light"))
{
- return gui::EGDC_HIGH_LIGHT;
+ color = gui::EGDC_HIGH_LIGHT;
}
- else if (!strcmp (color, "high-light-text"))
+ else if (!strcmp (color_name, "high-light-text"))
{
- return gui::EGDC_HIGH_LIGHT_TEXT;
+ color = gui::EGDC_HIGH_LIGHT_TEXT;
}
- else if (!strcmp (color, "inactive-border"))
+ else if (!strcmp (color_name, "inactive-border"))
{
- return gui::EGDC_INACTIVE_BORDER;
+ color = gui::EGDC_INACTIVE_BORDER;
}
- else if (!strcmp (color, "inactive-caption"))
+ else if (!strcmp (color_name, "inactive-caption"))
{
- return gui::EGDC_INACTIVE_CAPTION;
+ color = gui::EGDC_INACTIVE_CAPTION;
}
- else if (!strcmp (color, "tooltip"))
+ else if (!strcmp (color_name, "tooltip"))
{
- return gui::EGDC_TOOLTIP;
+ color = gui::EGDC_TOOLTIP;
}
- else if (!strcmp (color, "tooltip-background"))
+ else if (!strcmp (color_name, "tooltip-background"))
{
- return gui::EGDC_TOOLTIP_BACKGROUND;
+ color = gui::EGDC_TOOLTIP_BACKGROUND;
}
- else if (!strcmp (color, "scrollbar"))
+ else if (!strcmp (color_name, "scrollbar"))
{
- return gui::EGDC_SCROLLBAR;
+ color = gui::EGDC_SCROLLBAR;
}
- else if (!strcmp (color, "window"))
+ else if (!strcmp (color_name, "window"))
{
- return gui::EGDC_WINDOW;
+ color = gui::EGDC_WINDOW;
}
- else if (!strcmp (color, "window-symbol"))
+ else if (!strcmp (color_name, "window-symbol"))
{
- return gui::EGDC_WINDOW_SYMBOL;
+ color = gui::EGDC_WINDOW_SYMBOL;
}
- else if (!strcmp (color, "icon"))
+ else if (!strcmp (color_name, "icon"))
{
- return gui::EGDC_ICON;
+ color = gui::EGDC_ICON;
}
- else if (!strcmp (color, "icon-high-light"))
+ else if (!strcmp (color_name, "icon-high-light"))
{
- return gui::EGDC_ICON_HIGH_LIGHT;
+ color = gui::EGDC_ICON_HIGH_LIGHT;
}
- else if (!strcmp (color, "gray-window-symbol"))
+ else if (!strcmp (color_name, "gray-window-symbol"))
{
- return gui::EGDC_GRAY_WINDOW_SYMBOL;
+ color = gui::EGDC_GRAY_WINDOW_SYMBOL;
}
- else if (!strcmp (color, "editable"))
+ else if (!strcmp (color_name, "editable"))
{
- return gui::EGDC_EDITABLE;
+ color = gui::EGDC_EDITABLE;
}
- else if (!strcmp (color, "gray-editable"))
+ else if (!strcmp (color_name, "gray-editable"))
{
- return gui::EGDC_GRAY_EDITABLE;
+ color = gui::EGDC_GRAY_EDITABLE;
}
- else if (!strcmp (color, "focused-editable"))
+ else if (!strcmp (color_name, "focused-editable"))
{
- return gui::EGDC_FOCUSED_EDITABLE;
+ color = gui::EGDC_FOCUSED_EDITABLE;
}
else
{
scm_error (scm_arg_type_key, NULL, "Wrong default color: ~S",
scm_list_1 (default_color), scm_list_1 (default_color));
}
+
+ free (color_name);
+ return color;
}
gui::EGUI_DEFAULT_FONT
scm_to_default_font (SCM default_font)
{
- char* font = scm_to_utf8_string (scm_symbol_to_string (default_font));
- if (!strcmp (font, "default"))
+ char* font_name = scm_to_utf8_string (scm_symbol_to_string (default_font));
+ gui::EGUI_DEFAULT_FONT font;
+
+ if (!strcmp (font_name, "default"))
{
- return gui::EGDF_DEFAULT;
+ font = gui::EGDF_DEFAULT;
}
- else if (!strcmp (font, "button"))
+ else if (!strcmp (font_name, "button"))
{
- return gui::EGDF_BUTTON;
+ font = gui::EGDF_BUTTON;
}
- else if (!strcmp (font, "window"))
+ else if (!strcmp (font_name, "window"))
{
- return gui::EGDF_WINDOW;
+ font = gui::EGDF_WINDOW;
}
- else if (!strcmp (font, "menu"))
+ else if (!strcmp (font_name, "menu"))
{
- return gui::EGDF_MENU;
+ font = gui::EGDF_MENU;
}
- else if (!strcmp (font, "tooltip"))
+ else if (!strcmp (font_name, "tooltip"))
{
- return gui::EGDF_TOOLTIP;
+ font = gui::EGDF_TOOLTIP;
}
else
{
scm_error (scm_arg_type_key, NULL, "Wrong default font: ~S",
scm_list_1 (default_font), scm_list_1 (default_font));
}
+
+ free (font_name);
+ return font;
}
#include <libguile.h>
#include "gsubr.h"
#include "gui-toolbar.h"
-#include "wchar.h"
#include "wrapped.h"
using namespace irr;
SCM use_alpha_channel)
{
gui::IGUIToolBar* toolbar = (gui::IGUIToolBar*) scm_to_irr_pointer (gui_toolbar);
+ wchar_t* wtext = (wchar_t*) scm_to_utf32_string (text);
+ wchar_t* wtooltiptext = (wchar_t*) scm_to_utf32_string (tooltiptext);
+
gui::IGUIButton* button =
toolbar->addButton (scm_to_int32 (id),
- scm_to_wide_char_string (text),
- scm_to_wide_char_string (tooltiptext),
+ wtext,
+ wtooltiptext,
(video::ITexture*) scm_to_irr_pointer (img),
(video::ITexture*) scm_to_irr_pointer (pressedimg),
scm_to_bool (is_push_button),
scm_to_bool (use_alpha_channel));
+
+ free (wtext);
+ free (wtooltiptext);
return scm_from_pointer ((void*) button, NULL);
}
video::E_MATERIAL_FLAG
scm_to_material_flag (SCM material_flag)
{
- char* flag = scm_to_utf8_string (scm_symbol_to_string (material_flag));
- if (!strcmp (flag, "wireframe"))
+ char* flag_name = scm_to_utf8_string (scm_symbol_to_string (material_flag));
+ video::E_MATERIAL_FLAG flag;
+
+ if (!strcmp (flag_name, "wireframe"))
{
- return video::EMF_WIREFRAME;
+ flag = video::EMF_WIREFRAME;
}
- else if (!strcmp (flag, "pointcloud"))
+ else if (!strcmp (flag_name, "pointcloud"))
{
- return video::EMF_POINTCLOUD;
+ flag = video::EMF_POINTCLOUD;
}
- else if (!strcmp (flag, "gouraud-shading"))
+ else if (!strcmp (flag_name, "gouraud-shading"))
{
- return video::EMF_GOURAUD_SHADING;
+ flag = video::EMF_GOURAUD_SHADING;
}
- else if (!strcmp (flag, "lighting"))
+ else if (!strcmp (flag_name, "lighting"))
{
- return video::EMF_LIGHTING;
+ flag = video::EMF_LIGHTING;
}
- else if (!strcmp (flag, "zbuffer"))
+ else if (!strcmp (flag_name, "zbuffer"))
{
- return video::EMF_ZBUFFER;
+ flag = video::EMF_ZBUFFER;
}
- else if (!strcmp (flag, "zwrite-enable"))
+ else if (!strcmp (flag_name, "zwrite-enable"))
{
- return video::EMF_ZWRITE_ENABLE;
+ flag = video::EMF_ZWRITE_ENABLE;
}
- else if (!strcmp (flag, "back-face-culling"))
+ else if (!strcmp (flag_name, "back-face-culling"))
{
- return video::EMF_BACK_FACE_CULLING;
+ flag = video::EMF_BACK_FACE_CULLING;
}
- else if (!strcmp (flag, "front-face-culling"))
+ else if (!strcmp (flag_name, "front-face-culling"))
{
- return video::EMF_FRONT_FACE_CULLING;
+ flag = video::EMF_FRONT_FACE_CULLING;
}
- else if (!strcmp (flag, "bilinear-filter"))
+ else if (!strcmp (flag_name, "bilinear-filter"))
{
- return video::EMF_BILINEAR_FILTER;
+ flag = video::EMF_BILINEAR_FILTER;
}
- else if (!strcmp (flag, "trilinear-filter"))
+ else if (!strcmp (flag_name, "trilinear-filter"))
{
- return video::EMF_TRILINEAR_FILTER;
+ flag = video::EMF_TRILINEAR_FILTER;
}
- else if (!strcmp (flag, "anisotropic-filter"))
+ else if (!strcmp (flag_name, "anisotropic-filter"))
{
- return video::EMF_ANISOTROPIC_FILTER;
+ flag = video::EMF_ANISOTROPIC_FILTER;
}
- else if (!strcmp (flag, "fog-enable"))
+ else if (!strcmp (flag_name, "fog-enable"))
{
- return video::EMF_FOG_ENABLE;
+ flag = video::EMF_FOG_ENABLE;
}
- else if (!strcmp (flag, "normalize-normals"))
+ else if (!strcmp (flag_name, "normalize-normals"))
{
- return video::EMF_NORMALIZE_NORMALS;
+ flag = video::EMF_NORMALIZE_NORMALS;
}
- else if (!strcmp (flag, "texture-wrap"))
+ else if (!strcmp (flag_name, "texture-wrap"))
{
- return video::EMF_TEXTURE_WRAP;
+ flag = video::EMF_TEXTURE_WRAP;
}
- else if (!strcmp (flag, "anti-aliasing"))
+ else if (!strcmp (flag_name, "anti-aliasing"))
{
- return video::EMF_ANTI_ALIASING;
+ flag = video::EMF_ANTI_ALIASING;
}
- else if (!strcmp (flag, "color-mask"))
+ else if (!strcmp (flag_name, "color-mask"))
{
- return video::EMF_COLOR_MASK;
+ flag = video::EMF_COLOR_MASK;
}
- else if (!strcmp (flag, "color-material"))
+ else if (!strcmp (flag_name, "color-material"))
{
- return video::EMF_COLOR_MATERIAL;
+ flag = video::EMF_COLOR_MATERIAL;
}
- else if (!strcmp (flag, "use-mip-maps"))
+ else if (!strcmp (flag_name, "use-mip-maps"))
{
- return video::EMF_USE_MIP_MAPS;
+ flag = video::EMF_USE_MIP_MAPS;
}
- else if (!strcmp (flag, "blend-operation"))
+ else if (!strcmp (flag_name, "blend-operation"))
{
- return video::EMF_BLEND_OPERATION;
+ flag = video::EMF_BLEND_OPERATION;
}
- else if (!strcmp (flag, "polygon-offset"))
+ else if (!strcmp (flag_name, "polygon-offset"))
{
- return video::EMF_POLYGON_OFFSET;
+ flag = video::EMF_POLYGON_OFFSET;
}
else
{
scm_error (scm_arg_type_key, NULL, "Wrong material flag: ~S",
scm_list_1 (material_flag), scm_list_1 (material_flag));
}
+
+ free (flag_name);
+ return flag;
}
video::E_MATERIAL_TYPE
scm_to_material_type (SCM material_type)
{
- char* type = scm_to_utf8_string (scm_symbol_to_string (material_type));
- if (!strcmp (type, "solid"))
+ char* type_name = scm_to_utf8_string (scm_symbol_to_string (material_type));
+ video::E_MATERIAL_TYPE type;
+
+ if (!strcmp (type_name, "solid"))
{
- return video::EMT_SOLID;
+ type = video::EMT_SOLID;
}
- else if (!strcmp (type, "solid-2-layer"))
+ else if (!strcmp (type_name, "solid-2-layer"))
{
- return video::EMT_SOLID_2_LAYER;
+ type = video::EMT_SOLID_2_LAYER;
}
- else if (!strcmp (type, "lightmap"))
+ else if (!strcmp (type_name, "lightmap"))
{
- return video::EMT_LIGHTMAP;
+ type = video::EMT_LIGHTMAP;
}
- else if (!strcmp (type, "lightmap-add"))
+ else if (!strcmp (type_name, "lightmap-add"))
{
- return video::EMT_LIGHTMAP_ADD;
+ type = video::EMT_LIGHTMAP_ADD;
}
- else if (!strcmp (type, "lightmap-m2"))
+ else if (!strcmp (type_name, "lightmap-m2"))
{
- return video::EMT_LIGHTMAP_M2;
+ type = video::EMT_LIGHTMAP_M2;
}
- else if (!strcmp (type, "lightmap-m4"))
+ else if (!strcmp (type_name, "lightmap-m4"))
{
- return video::EMT_LIGHTMAP_M4;
+ type = video::EMT_LIGHTMAP_M4;
}
- else if (!strcmp (type, "lightmap-lighting"))
+ else if (!strcmp (type_name, "lightmap-lighting"))
{
- return video::EMT_LIGHTMAP_LIGHTING;
+ type = video::EMT_LIGHTMAP_LIGHTING;
}
- else if (!strcmp (type, "lightmap-lighting-m2"))
+ else if (!strcmp (type_name, "lightmap-lighting-m2"))
{
- return video::EMT_LIGHTMAP_LIGHTING_M2;
+ type = video::EMT_LIGHTMAP_LIGHTING_M2;
}
- else if (!strcmp (type, "lightmap-lighting-m4"))
+ else if (!strcmp (type_name, "lightmap-lighting-m4"))
{
- return video::EMT_LIGHTMAP_LIGHTING_M4;
+ type = video::EMT_LIGHTMAP_LIGHTING_M4;
}
- else if (!strcmp (type, "detail-map"))
+ else if (!strcmp (type_name, "detail-map"))
{
- return video::EMT_DETAIL_MAP;
+ type = video::EMT_DETAIL_MAP;
}
- else if (!strcmp (type, "sphere-map"))
+ else if (!strcmp (type_name, "sphere-map"))
{
- return video::EMT_SPHERE_MAP;
+ type = video::EMT_SPHERE_MAP;
}
- else if (!strcmp (type, "reflection-2-layer"))
+ else if (!strcmp (type_name, "reflection-2-layer"))
{
- return video::EMT_REFLECTION_2_LAYER;
+ type = video::EMT_REFLECTION_2_LAYER;
}
- else if (!strcmp (type, "transparent-add-color"))
+ else if (!strcmp (type_name, "transparent-add-color"))
{
- return video::EMT_TRANSPARENT_ADD_COLOR;
+ type = video::EMT_TRANSPARENT_ADD_COLOR;
}
- else if (!strcmp (type, "transparent-alpha-channel"))
+ else if (!strcmp (type_name, "transparent-alpha-channel"))
{
- return video::EMT_TRANSPARENT_ALPHA_CHANNEL;
+ type = video::EMT_TRANSPARENT_ALPHA_CHANNEL;
}
- else if (!strcmp (type, "transparent-alpha-channel-ref"))
+ else if (!strcmp (type_name, "transparent-alpha-channel-ref"))
{
- return video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
+ type = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
}
- else if (!strcmp (type, "transparent-vertex-alpha"))
+ else if (!strcmp (type_name, "transparent-vertex-alpha"))
{
- return video::EMT_TRANSPARENT_VERTEX_ALPHA;
+ type = video::EMT_TRANSPARENT_VERTEX_ALPHA;
}
- else if (!strcmp (type, "transparent-reflection-2-layer"))
+ else if (!strcmp (type_name, "transparent-reflection-2-layer"))
{
- return video::EMT_TRANSPARENT_REFLECTION_2_LAYER;
+ type = video::EMT_TRANSPARENT_REFLECTION_2_LAYER;
}
- else if (!strcmp (type, "normal-map-solid"))
+ else if (!strcmp (type_name, "normal-map-solid"))
{
- return video::EMT_NORMAL_MAP_SOLID;
+ type = video::EMT_NORMAL_MAP_SOLID;
}
- else if (!strcmp (type, "normal-map-transparent-add-color"))
+ else if (!strcmp (type_name, "normal-map-transparent-add-color"))
{
- return video::EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR;
+ type = video::EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR;
}
- else if (!strcmp (type, "normal-map-transparent-vertex-alpha"))
+ else if (!strcmp (type_name, "normal-map-transparent-vertex-alpha"))
{
- return video::EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA;
+ type = video::EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA;
}
- else if (!strcmp (type, "parallax-map-solid"))
+ else if (!strcmp (type_name, "parallax-map-solid"))
{
- return video::EMT_PARALLAX_MAP_SOLID;
+ type = video::EMT_PARALLAX_MAP_SOLID;
}
- else if (!strcmp (type, "parallax-map-transparent-add-color"))
+ else if (!strcmp (type_name, "parallax-map-transparent-add-color"))
{
- return video::EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR;
+ type = video::EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR;
}
- else if (!strcmp (type, "parallax-map-transparent-vertex-alpha"))
+ else if (!strcmp (type_name, "parallax-map-transparent-vertex-alpha"))
{
- return video::EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA;
+ type = video::EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA;
}
- else if (!strcmp (type, "onetexture-blend"))
+ else if (!strcmp (type_name, "onetexture-blend"))
{
- return video::EMT_ONETEXTURE_BLEND;
+ type = video::EMT_ONETEXTURE_BLEND;
}
else
{
scm_error (scm_arg_type_key, NULL, "Wrong material type: ~S",
scm_list_1 (material_type), scm_list_1 (material_type));
}
+
+ free (type_name);
+ return type;
}
video::E_ANTI_ALIASING_MODE
scm_to_anti_aliasing_mode (SCM anti_aliasing_mode)
{
- char* mode = scm_to_utf8_string (scm_symbol_to_string (anti_aliasing_mode));
- if (!strcmp (mode, "off"))
+ char* mode_name = scm_to_utf8_string (scm_symbol_to_string (anti_aliasing_mode));
+ video::E_ANTI_ALIASING_MODE mode;
+
+ if (!strcmp (mode_name, "off"))
{
- return video::EAAM_OFF;
+ mode = video::EAAM_OFF;
}
- else if (!strcmp (mode, "simple"))
+ else if (!strcmp (mode_name, "simple"))
{
- return video::EAAM_SIMPLE;
+ mode = video::EAAM_SIMPLE;
}
- else if (!strcmp (mode, "quality"))
+ else if (!strcmp (mode_name, "quality"))
{
- return video::EAAM_QUALITY;
+ mode = video::EAAM_QUALITY;
}
- else if (!strcmp (mode, "line-smooth"))
+ else if (!strcmp (mode_name, "line-smooth"))
{
- return video::EAAM_LINE_SMOOTH;
+ mode = video::EAAM_LINE_SMOOTH;
}
- else if (!strcmp (mode, "point-smooth"))
+ else if (!strcmp (mode_name, "point-smooth"))
{
- return video::EAAM_POINT_SMOOTH;
+ mode = video::EAAM_POINT_SMOOTH;
}
- else if (!strcmp (mode, "full-basic"))
+ else if (!strcmp (mode_name, "full-basic"))
{
- return video::EAAM_FULL_BASIC;
+ mode = video::EAAM_FULL_BASIC;
}
- else if (!strcmp (mode, "alpha-to-coverage"))
+ else if (!strcmp (mode_name, "alpha-to-coverage"))
{
- return video::EAAM_ALPHA_TO_COVERAGE;
+ mode = video::EAAM_ALPHA_TO_COVERAGE;
}
else
{
scm_error (scm_arg_type_key, NULL, "Wrong anti aliasing mode: ~S",
scm_list_1 (anti_aliasing_mode), scm_list_1 (anti_aliasing_mode));
}
+
+ free (mode_name);
+ return mode;
}
video::E_BLEND_OPERATION
scm_to_blend_operation (SCM blend_operation)
{
- char* operation = scm_to_utf8_string (scm_symbol_to_string (blend_operation));
- if (!strcmp (operation, "none"))
+ char* operation_name = scm_to_utf8_string (scm_symbol_to_string (blend_operation));
+ video::E_BLEND_OPERATION operation;
+
+ if (!strcmp (operation_name, "none"))
{
- return video::EBO_NONE;
+ operation = video::EBO_NONE;
}
- else if (!strcmp (operation, "add"))
+ else if (!strcmp (operation_name, "add"))
{
- return video::EBO_ADD;
+ operation = video::EBO_ADD;
}
- else if (!strcmp (operation, "subtract"))
+ else if (!strcmp (operation_name, "subtract"))
{
- return video::EBO_SUBTRACT;
+ operation = video::EBO_SUBTRACT;
}
- else if (!strcmp (operation, "rev-subtract"))
+ else if (!strcmp (operation_name, "rev-subtract"))
{
- return video::EBO_REVSUBTRACT;
+ operation = video::EBO_REVSUBTRACT;
}
- else if (!strcmp (operation, "min"))
+ else if (!strcmp (operation_name, "min"))
{
- return video::EBO_MIN;
+ operation = video::EBO_MIN;
}
- else if (!strcmp (operation, "max"))
+ else if (!strcmp (operation_name, "max"))
{
- return video::EBO_MAX;
+ operation = video::EBO_MAX;
}
- else if (!strcmp (operation, "min-factor"))
+ else if (!strcmp (operation_name, "min-factor"))
{
- return video::EBO_MIN_FACTOR;
+ operation = video::EBO_MIN_FACTOR;
}
- else if (!strcmp (operation, "max-factor"))
+ else if (!strcmp (operation_name, "max-factor"))
{
- return video::EBO_MAX_FACTOR;
+ operation = video::EBO_MAX_FACTOR;
}
- else if (!strcmp (operation, "min-alpha"))
+ else if (!strcmp (operation_name, "min-alpha"))
{
- return video::EBO_MIN_ALPHA;
+ operation = video::EBO_MIN_ALPHA;
}
- else if (!strcmp (operation, "max-alpha"))
+ else if (!strcmp (operation_name, "max-alpha"))
{
- return video::EBO_MAX_ALPHA;
+ operation = video::EBO_MAX_ALPHA;
}
else
{
scm_error (scm_arg_type_key, NULL, "Wrong blend operation: ~S",
scm_list_1 (blend_operation), scm_list_1 (blend_operation));
}
+
+ free (operation_name);
+ return operation;
}
video::E_COLOR_MATERIAL
scm_to_color_material (SCM color_material)
{
- char* material = scm_to_utf8_string (scm_symbol_to_string (color_material));
- if (!strcmp (material, "none"))
+ char* material_name = scm_to_utf8_string (scm_symbol_to_string (color_material));
+ video::E_COLOR_MATERIAL material;
+
+ if (!strcmp (material_name, "none"))
{
- return video::ECM_NONE;
+ material = video::ECM_NONE;
}
- else if (!strcmp (material, "diffuse"))
+ else if (!strcmp (material_name, "diffuse"))
{
- return video::ECM_DIFFUSE;
+ material = video::ECM_DIFFUSE;
}
- else if (!strcmp (material, "ambient"))
+ else if (!strcmp (material_name, "ambient"))
{
- return video::ECM_AMBIENT;
+ material = video::ECM_AMBIENT;
}
- else if (!strcmp (material, "emissive"))
+ else if (!strcmp (material_name, "emissive"))
{
- return video::ECM_EMISSIVE;
+ material = video::ECM_EMISSIVE;
}
- else if (!strcmp (material, "specular"))
+ else if (!strcmp (material_name, "specular"))
{
- return video::ECM_SPECULAR;
+ material = video::ECM_SPECULAR;
}
- else if (!strcmp (material, "diffuse-and-ambient"))
+ else if (!strcmp (material_name, "diffuse-and-ambient"))
{
- return video::ECM_DIFFUSE_AND_AMBIENT;
+ material = video::ECM_DIFFUSE_AND_AMBIENT;
}
else
{
scm_error (scm_arg_type_key, NULL, "Wrong color material: ~S",
scm_list_1 (color_material), scm_list_1 (color_material));
}
+
+ free (material_name);
+ return material;
}
video::E_COLOR_PLANE
scm_to_color_plane (SCM color_plane)
{
- char* plane = scm_to_utf8_string (scm_symbol_to_string (color_plane));
- if (!strcmp (plane, "none"))
+ char* plane_name = scm_to_utf8_string (scm_symbol_to_string (color_plane));
+ video::E_COLOR_PLANE plane;
+
+ if (!strcmp (plane_name, "none"))
{
- return video::ECP_NONE;
+ plane = video::ECP_NONE;
}
- else if (!strcmp (plane, "alpha"))
+ else if (!strcmp (plane_name, "alpha"))
{
- return video::ECP_ALPHA;
+ plane = video::ECP_ALPHA;
}
- else if (!strcmp (plane, "red"))
+ else if (!strcmp (plane_name, "red"))
{
- return video::ECP_RED;
+ plane = video::ECP_RED;
}
- else if (!strcmp (plane, "green"))
+ else if (!strcmp (plane_name, "green"))
{
- return video::ECP_GREEN;
+ plane = video::ECP_GREEN;
}
- else if (!strcmp (plane, "blue"))
+ else if (!strcmp (plane_name, "blue"))
{
- return video::ECP_BLUE;
+ plane = video::ECP_BLUE;
}
- else if (!strcmp (plane, "rgb"))
+ else if (!strcmp (plane_name, "rgb"))
{
- return video::ECP_RGB;
+ plane = video::ECP_RGB;
}
- else if (!strcmp (plane, "all"))
+ else if (!strcmp (plane_name, "all"))
{
- return video::ECP_ALL;
+ plane = video::ECP_ALL;
}
else
{
scm_error (scm_arg_type_key, NULL, "Wrong color plane: ~S",
scm_list_1 (color_plane), scm_list_1 (color_plane));
}
+
+ free (plane_name);
+ return plane;
}
video::E_COMPARISON_FUNC
scm_to_comparison_func (SCM comparison_func)
{
- char* func = scm_to_utf8_string (scm_symbol_to_string (comparison_func));
- if (!strcmp (func, "never"))
+ char* func_name = scm_to_utf8_string (scm_symbol_to_string (comparison_func));
+ video::E_COMPARISON_FUNC func;
+
+ if (!strcmp (func_name, "never"))
{
- return video::ECFN_NEVER;
+ func = video::ECFN_NEVER;
}
- else if (!strcmp (func, "less-equal"))
+ else if (!strcmp (func_name, "less-equal"))
{
- return video::ECFN_LESSEQUAL;
+ func = video::ECFN_LESSEQUAL;
}
- else if (!strcmp (func, "equal"))
+ else if (!strcmp (func_name, "equal"))
{
- return video::ECFN_EQUAL;
+ func = video::ECFN_EQUAL;
}
- else if (!strcmp (func, "less"))
+ else if (!strcmp (func_name, "less"))
{
- return video::ECFN_LESS;
+ func = video::ECFN_LESS;
}
- else if (!strcmp (func, "not-equal"))
+ else if (!strcmp (func_name, "not-equal"))
{
- return video::ECFN_NOTEQUAL;
+ func = video::ECFN_NOTEQUAL;
}
- else if (!strcmp (func, "greater-equal"))
+ else if (!strcmp (func_name, "greater-equal"))
{
- return video::ECFN_GREATEREQUAL;
+ func = video::ECFN_GREATEREQUAL;
}
- else if (!strcmp (func, "greater"))
+ else if (!strcmp (func_name, "greater"))
{
- return video::ECFN_GREATER;
+ func = video::ECFN_GREATER;
}
- else if (!strcmp (func, "always"))
+ else if (!strcmp (func_name, "always"))
{
- return video::ECFN_ALWAYS;
+ func = video::ECFN_ALWAYS;
}
else
{
scm_error (scm_arg_type_key, NULL, "Wrong comparison func: ~S",
scm_list_1 (comparison_func), scm_list_1 (comparison_func));
}
+
+ free (func_name);
+ return func;
}
video::E_POLYGON_OFFSET
scm_to_polygon_offset (SCM polygon_offset)
{
- char* offset = scm_to_utf8_string (scm_symbol_to_string (polygon_offset));
- if (!strcmp (offset, "back"))
+ char* offset_name = scm_to_utf8_string (scm_symbol_to_string (polygon_offset));
+ video::E_POLYGON_OFFSET offset;
+
+ if (!strcmp (offset_name, "back"))
{
- return video::EPO_BACK;
+ offset = video::EPO_BACK;
}
- else if (!strcmp (offset, "front"))
+ else if (!strcmp (offset_name, "front"))
{
- return video::EPO_FRONT;
+ offset = video::EPO_FRONT;
}
else
{
scm_error (scm_arg_type_key, NULL, "Wrong polygon offset: ~S",
scm_list_1 (polygon_offset), scm_list_1 (polygon_offset));
}
+
+ free (offset_name);
+ return offset;
}
scene::E_PRIMITIVE_TYPE
scm_to_primitive_type (SCM primitive_type)
{
- char* type = scm_to_utf8_string (scm_symbol_to_string (primitive_type));
- if (!strcmp (type, "points"))
+ char* type_name = scm_to_utf8_string (scm_symbol_to_string (primitive_type));
+ scene::E_PRIMITIVE_TYPE type;
+
+ if (!strcmp (type_name, "points"))
{
- return scene::EPT_POINTS;
+ type = scene::EPT_POINTS;
}
- else if (!strcmp (type, "line-strip"))
+ else if (!strcmp (type_name, "line-strip"))
{
- return scene::EPT_LINE_STRIP;
+ type = scene::EPT_LINE_STRIP;
}
- else if (!strcmp (type, "line-loop"))
+ else if (!strcmp (type_name, "line-loop"))
{
- return scene::EPT_LINE_LOOP;
+ type = scene::EPT_LINE_LOOP;
}
- else if (!strcmp (type, "lines"))
+ else if (!strcmp (type_name, "lines"))
{
- return scene::EPT_LINES;
+ type = scene::EPT_LINES;
}
- else if (!strcmp (type, "triangle-strip"))
+ else if (!strcmp (type_name, "triangle-strip"))
{
- return scene::EPT_TRIANGLE_STRIP;
+ type = scene::EPT_TRIANGLE_STRIP;
}
- else if (!strcmp (type, "triangle-fan"))
+ else if (!strcmp (type_name, "triangle-fan"))
{
- return scene::EPT_TRIANGLE_FAN;
+ type = scene::EPT_TRIANGLE_FAN;
}
- else if (!strcmp (type, "triangles"))
+ else if (!strcmp (type_name, "triangles"))
{
- return scene::EPT_TRIANGLES;
+ type = scene::EPT_TRIANGLES;
}
- else if (!strcmp (type, "quad-strip"))
+ else if (!strcmp (type_name, "quad-strip"))
{
- return scene::EPT_QUAD_STRIP;
+ type = scene::EPT_QUAD_STRIP;
}
- else if (!strcmp (type, "quads"))
+ else if (!strcmp (type_name, "quads"))
{
- return scene::EPT_QUADS;
+ type = scene::EPT_QUADS;
}
- else if (!strcmp (type, "polygon"))
+ else if (!strcmp (type_name, "polygon"))
{
- return scene::EPT_POLYGON;
+ type = scene::EPT_POLYGON;
}
- else if (!strcmp (type, "point-sprites"))
+ else if (!strcmp (type_name, "point-sprites"))
{
- return scene::EPT_POINT_SPRITES;
+ type = scene::EPT_POINT_SPRITES;
}
else
{
scm_error (scm_arg_type_key, NULL, "Wrong primitive type: ~S",
scm_list_1 (primitive_type), scm_list_1 (primitive_type));
}
+
+ free (type_name);
+ return type;
}
ISceneManager_getMesh (SCM scene_manager,
SCM filename)
{
+ char* cfilename = scm_to_utf8_string (filename);
scene::ISceneManager* smgr = (scene::ISceneManager*) scm_to_irr_pointer (scene_manager);
- scene::IAnimatedMesh* mesh = smgr->getMesh(scm_to_utf8_string (filename));
+ scene::IAnimatedMesh* mesh = smgr->getMesh(cfilename);
+ free (cfilename);
return scm_from_pointer ((void*) mesh, NULL);
}
video::E_VERTEX_TYPE
scm_to_vertex_type (SCM vertex_type)
{
- char* type = scm_to_utf8_string (scm_symbol_to_string (vertex_type));
- if (!strcmp (type, "standard"))
+ char* type_name = scm_to_utf8_string (scm_symbol_to_string (vertex_type));
+ video::E_VERTEX_TYPE type;
+
+ if (!strcmp (type_name, "standard"))
{
- return video::EVT_STANDARD;
+ type = video::EVT_STANDARD;
}
- else if (!strcmp (type, "2tcoords"))
+ else if (!strcmp (type_name, "2tcoords"))
{
- return video::EVT_2TCOORDS;
+ type = video::EVT_2TCOORDS;
}
- else if (!strcmp (type, "tangents"))
+ else if (!strcmp (type_name, "tangents"))
{
- return video::EVT_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;
}
#include "rect.h"
#include "vertex3d.h"
#include "video-driver.h"
-#include "wchar.h"
#include "wrapped.h"
using namespace irr;
IVideoDriver_getName (SCM video_driver)
{
video::IVideoDriver* driver = (video::IVideoDriver*) scm_to_irr_pointer (video_driver);
- return scm_from_wide_char_string (driver->getName ());
+ return scm_from_utf32_string ((scm_t_wchar*) driver->getName ());
}
SCM
IVideoDriver_getTexture (SCM video_driver,
SCM filename)
{
+ char* cfilename = scm_to_utf8_string (filename);
video::IVideoDriver* driver = (video::IVideoDriver*) scm_to_irr_pointer (video_driver);
- video::ITexture* texture = driver->getTexture (scm_to_utf8_string (filename));
+ video::ITexture* texture = driver->getTexture (cfilename);
+ free (cfilename);
return scm_from_pointer ((void*) texture, NULL);
}
video::E_TRANSFORMATION_STATE
scm_to_transformation_state (SCM transformation_state)
{
- char* state = scm_to_utf8_string (scm_symbol_to_string (transformation_state));
- if (!strcmp (state, "view"))
+ char* state_name = scm_to_utf8_string (scm_symbol_to_string (transformation_state));
+ video::E_TRANSFORMATION_STATE state;
+
+ if (!strcmp (state_name, "view"))
{
- return video::ETS_VIEW;
+ state = video::ETS_VIEW;
}
- else if (!strcmp (state, "world"))
+ else if (!strcmp (state_name, "world"))
{
- return video::ETS_WORLD;
+ state = video::ETS_WORLD;
}
- else if (!strcmp (state, "projection"))
+ else if (!strcmp (state_name, "projection"))
{
- return video::ETS_PROJECTION;
+ state = video::ETS_PROJECTION;
}
- else if (!strcmp (state, "texture0"))
+ else if (!strcmp (state_name, "texture0"))
{
- return video::ETS_TEXTURE_0;
+ state = video::ETS_TEXTURE_0;
}
- else if (!strcmp (state, "texture1"))
+ else if (!strcmp (state_name, "texture1"))
{
- return video::ETS_TEXTURE_1;
+ state = video::ETS_TEXTURE_1;
}
- else if (!strcmp (state, "texture2"))
+ else if (!strcmp (state_name, "texture2"))
{
- return video::ETS_TEXTURE_2;
+ state = video::ETS_TEXTURE_2;
}
- else if (!strcmp (state, "texture3"))
+ else if (!strcmp (state_name, "texture3"))
{
- return video::ETS_TEXTURE_3;
+ state = video::ETS_TEXTURE_3;
}
else
{
scm_error (scm_arg_type_key, NULL, "Wrong transformation state: ~S",
scm_list_1 (transformation_state), scm_list_1 (transformation_state));
}
+
+ free (state_name);
+ return state;
}
+++ /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 <libguile.h>
-#include <wchar.h>
-#include "wchar.h"
-
-SCM
-scm_from_wide_char_string (const wchar_t* text)
-{
- return scm_from_utf32_string ((const scm_t_wchar*) text);
-}
-
-const wchar_t*
-scm_to_wide_char_string (SCM text)
-{
- return (const wchar_t*) scm_to_utf32_string (text);
-}
+++ /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/>.
-*/
-
-#ifndef __GUILE_IRRLICHT_WCHAR_H_INCLUDED__
-#define __GUILE_IRRLICHT_WCHAR_H_INCLUDED__
-
-#include <libguile.h>
-#include <wchar.h>
-
-SCM
-scm_from_wide_char_string (const wchar_t* wtext);
-
-const wchar_t*
-scm_to_wide_char_string (SCM text);
-
-#endif