]> git.jsancho.org Git - guile-irrlicht.git/blob - src/material-flags.cpp
set-material-flag! refactor
[guile-irrlicht.git] / src / material-flags.cpp
1 /* guile-irrlicht --- GNU Guile bindings for Irrlicht Engine
2
3    Copyright (C) 2020 Javier Sancho <jsf@jsancho.org>
4
5    This file is part of guile-irrlicht.
6
7    guile-irrlicht is free software; you can redistribute it and/or modify
8    it under the terms of the GNU Lesser General Public License as
9    published by the Free Software Foundation; either version 3 of the
10    License, or (at your option) any later version.
11
12    guile-irrlicht is distributed in the hope that it will be useful, but
13    WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15    General Public License for more details.
16
17    You should have received a copy of the GNU Lesser General Public
18    License along with guile-irrlicht. If not, see
19    <http://www.gnu.org/licenses/>.
20 */
21
22 #include <irrlicht/irrlicht.h>
23 #include <libguile.h>
24
25 extern "C" {
26
27   irr::video::E_MATERIAL_FLAG
28   scm_to_material_flag (SCM material_flag)
29   {
30     char* flag = scm_to_utf8_stringn (scm_symbol_to_string (material_flag), NULL);
31     if (!strcmp (flag, "wireframe"))
32       {
33         return irr::video::EMF_WIREFRAME;
34       }
35     else if (!strcmp (flag, "pointcloud"))
36       {
37         return irr::video::EMF_POINTCLOUD;
38       }
39     else if (!strcmp (flag, "gouraud-shading"))
40       {
41         return irr::video::EMF_GOURAUD_SHADING;
42       }
43     else if (!strcmp (flag, "lighting"))
44       {
45         return irr::video::EMF_LIGHTING;
46       }
47     else if (!strcmp (flag, "zbuffer"))
48       {
49         return irr::video::EMF_ZBUFFER;
50       }
51     else if (!strcmp (flag, "zwrite-enable"))
52       {
53         return irr::video::EMF_ZWRITE_ENABLE;
54       }
55     else if (!strcmp (flag, "back-face-culling"))
56       {
57         return irr::video::EMF_BACK_FACE_CULLING;
58       }
59     else if (!strcmp (flag, "front-face-culling"))
60       {
61         return irr::video::EMF_FRONT_FACE_CULLING;
62       }
63     else if (!strcmp (flag, "bilinear-filter"))
64       {
65         return irr::video::EMF_BILINEAR_FILTER;
66       }
67     else if (!strcmp (flag, "trilinear-filter"))
68       {
69         return irr::video::EMF_TRILINEAR_FILTER;
70       }
71     else if (!strcmp (flag, "anisotropic-filter"))
72       {
73         return irr::video::EMF_ANISOTROPIC_FILTER;
74       }
75     else if (!strcmp (flag, "fog-enable"))
76       {
77         return irr::video::EMF_FOG_ENABLE;
78       }
79     else if (!strcmp (flag, "normalize-normals"))
80       {
81         return irr::video::EMF_NORMALIZE_NORMALS;
82       }
83     else if (!strcmp (flag, "texture-wrap"))
84       {
85         return irr::video::EMF_TEXTURE_WRAP;
86       }
87     else if (!strcmp (flag, "anti-aliasing"))
88       {
89         return irr::video::EMF_ANTI_ALIASING;
90       }
91     else if (!strcmp (flag, "color-mask"))
92       {
93         return irr::video::EMF_COLOR_MASK;
94       }
95     else if (!strcmp (flag, "color-material"))
96       {
97         return irr::video::EMF_COLOR_MATERIAL;
98       }
99     else if (!strcmp (flag, "use-mip-maps"))
100       {
101         return irr::video::EMF_USE_MIP_MAPS;
102       }
103     else if (!strcmp (flag, "blend-operation"))
104       {
105         return irr::video::EMF_BLEND_OPERATION;
106       }
107     else if (!strcmp (flag, "polygon-offset"))
108       {
109         return irr::video::EMF_POLYGON_OFFSET;
110       }
111     else
112       {
113         scm_error (scm_arg_type_key, NULL, "Wrong material flag: ~S",
114                    scm_list_1 (material_flag), scm_list_1 (material_flag));
115       }
116   }
117
118 }