X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=src%2Fmaterial.cpp;h=7c2eb0e6569370363d79dcd473d98b43e167fe5a;hb=4f049544ec827a9f1f16a913d7241f29179fdde7;hp=d24c2b428a9c4a1fa99c632b4ae44d35ebc4b70c;hpb=d69b0483db5791086c6aa80cbca08fa38c631cad;p=guile-irrlicht.git diff --git a/src/material.cpp b/src/material.cpp index d24c2b4..7c2eb0e 100644 --- a/src/material.cpp +++ b/src/material.cpp @@ -27,21 +27,68 @@ #include "material.h" #include "material-types.h" - using namespace irr; - SCM -video_SMaterial_make (SCM material_type, SCM ambient_color, SCM diffuse_color, - SCM emissive_color, SCM specular_color, SCM shininess, - SCM material_type_param, SCM material_type_param_2, SCM thickness, - SCM z_buffer, SCM anti_aliasing, SCM color_mask, - SCM color_material, SCM blend_operation, SCM polygon_offset_factor, - SCM polygon_offset_direction, SCM wireframe, SCM point_cloud, - SCM gouraud_shading, SCM lighting, SCM z_write_enable, - SCM backface_culling, SCM frontface_culling, SCM fog_enable, - SCM normalize_normals, SCM use_mip_maps) +video_SMaterial_make (SCM rest) { + SCM material_type; + SCM ambient_color; + SCM diffuse_color; + SCM emissive_color; + SCM specular_color; + SCM shininess; + SCM material_type_param; + SCM material_type_param_2; + SCM thickness; + SCM z_buffer; + SCM anti_aliasing; + SCM color_mask; + SCM color_material; + SCM blend_operation; + SCM polygon_offset_factor; + SCM polygon_offset_direction; + SCM wireframe; + SCM point_cloud; + SCM gouraud_shading; + SCM lighting; + SCM z_write_enable; + SCM backface_culling; + SCM frontface_culling; + SCM fog_enable; + SCM normalize_normals; + SCM use_mip_maps; + + scm_c_bind_keyword_arguments + ("video_SMaterial_make", rest, (scm_t_keyword_arguments_flags)0, + scm_from_utf8_keyword ("material-type"), &material_type, + scm_from_utf8_keyword ("ambient-color"), &ambient_color, + scm_from_utf8_keyword ("diffuse-color"), &diffuse_color, + scm_from_utf8_keyword ("emissive-color"), &emissive_color, + scm_from_utf8_keyword ("specular-color"), &specular_color, + scm_from_utf8_keyword ("shininess"), &shininess, + scm_from_utf8_keyword ("material-type-param"), &material_type_param, + scm_from_utf8_keyword ("material-type-param-2"), &material_type_param_2, + scm_from_utf8_keyword ("thickness"), &thickness, + scm_from_utf8_keyword ("z-buffer"), &z_buffer, + scm_from_utf8_keyword ("anti-aliasing"), &anti_aliasing, + scm_from_utf8_keyword ("color-mask"), &color_mask, + scm_from_utf8_keyword ("color-material"), &color_material, + scm_from_utf8_keyword ("blend-operation"), &blend_operation, + scm_from_utf8_keyword ("polygon-offset-factor"), &polygon_offset_factor, + scm_from_utf8_keyword ("polygon-offset-direction"), &polygon_offset_direction, + scm_from_utf8_keyword ("wireframe"), &wireframe, + scm_from_utf8_keyword ("point-cloud"), &point_cloud, + scm_from_utf8_keyword ("gouraud-shading"), &gouraud_shading, + scm_from_utf8_keyword ("lighting"), &lighting, + scm_from_utf8_keyword ("z-write-enable"), &z_write_enable, + scm_from_utf8_keyword ("backface-culling"), &backface_culling, + scm_from_utf8_keyword ("frontface-culling"), &frontface_culling, + scm_from_utf8_keyword ("fog-enable"), &fog_enable, + scm_from_utf8_keyword ("normalize-normals"), &normalize_normals, + scm_from_utf8_keyword ("use-mip-maps"), &use_mip_maps, + SCM_UNDEFINED); + video::SMaterial* material = new video::SMaterial (); material->MaterialType = scm_to_material_type(material_type); material->AmbientColor = scm_to_color (ambient_color); @@ -72,22 +119,16 @@ video_SMaterial_make (SCM material_type, SCM ambient_color, SCM diffuse_color, return scm_from_pointer ((void*) material, NULL); } - -extern "C" { - - void - init_material (void) - { - DEFINE_GSUBR ("video_SMaterial_make", 26, 0, 0, video_SMaterial_make); - } - +void +init_material (void) +{ + DEFINE_GSUBR ("video_SMaterial_make", 0, 0, 1, video_SMaterial_make); } - video::E_ANTI_ALIASING_MODE scm_to_anti_aliasing_mode (SCM anti_aliasing_mode) { - char* mode = scm_to_utf8_stringn (scm_symbol_to_string (anti_aliasing_mode), NULL); + char* mode = scm_to_utf8_string (scm_symbol_to_string (anti_aliasing_mode)); if (!strcmp (mode, "off")) { return video::EAAM_OFF; @@ -123,11 +164,10 @@ scm_to_anti_aliasing_mode (SCM anti_aliasing_mode) } } - video::E_BLEND_OPERATION scm_to_blend_operation (SCM blend_operation) { - char* operation = scm_to_utf8_stringn (scm_symbol_to_string (blend_operation), NULL); + char* operation = scm_to_utf8_string (scm_symbol_to_string (blend_operation)); if (!strcmp (operation, "none")) { return video::EBO_NONE; @@ -175,11 +215,10 @@ scm_to_blend_operation (SCM blend_operation) } } - video::E_COLOR_MATERIAL scm_to_color_material (SCM color_material) { - char* material = scm_to_utf8_stringn (scm_symbol_to_string (color_material), NULL); + char* material = scm_to_utf8_string (scm_symbol_to_string (color_material)); if (!strcmp (material, "none")) { return video::ECM_NONE; @@ -211,11 +250,10 @@ scm_to_color_material (SCM color_material) } } - video::E_COLOR_PLANE scm_to_color_plane (SCM color_plane) { - char* plane = scm_to_utf8_stringn (scm_symbol_to_string (color_plane), NULL); + char* plane = scm_to_utf8_string (scm_symbol_to_string (color_plane)); if (!strcmp (plane, "none")) { return video::ECP_NONE; @@ -251,11 +289,10 @@ scm_to_color_plane (SCM color_plane) } } - video::E_COMPARISON_FUNC scm_to_comparison_func (SCM comparison_func) { - char* func = scm_to_utf8_stringn (scm_symbol_to_string (comparison_func), NULL); + char* func = scm_to_utf8_string (scm_symbol_to_string (comparison_func)); if (!strcmp (func, "never")) { return video::ECFN_NEVER; @@ -295,11 +332,10 @@ scm_to_comparison_func (SCM comparison_func) } } - video::E_POLYGON_OFFSET scm_to_polygon_offset (SCM polygon_offset) { - char* offset = scm_to_utf8_stringn (scm_symbol_to_string (polygon_offset), NULL); + char* offset = scm_to_utf8_string (scm_symbol_to_string (polygon_offset)); if (!strcmp (offset, "back")) { return video::EPO_BACK;