]> git.jsancho.org Git - guile-irrlicht.git/blob - src/material-types.cpp
clean code
[guile-irrlicht.git] / src / material-types.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 #include "material-types.h"
25
26 using namespace irr;
27
28 video::E_MATERIAL_TYPE
29 scm_to_material_type (SCM material_type)
30 {
31   char* type = scm_to_utf8_stringn (scm_symbol_to_string (material_type), NULL);
32   if (!strcmp (type, "solid"))
33     {
34       return video::EMT_SOLID;
35     }
36   else if (!strcmp (type, "solid-2-layer"))
37     {
38       return video::EMT_SOLID_2_LAYER;
39     }
40   else if (!strcmp (type, "lightmap"))
41     {
42       return video::EMT_LIGHTMAP;
43     }
44   else if (!strcmp (type, "lightmap-add"))
45     {
46       return video::EMT_LIGHTMAP_ADD;
47     }
48   else if (!strcmp (type, "lightmap-m2"))
49     {
50       return video::EMT_LIGHTMAP_M2;
51     }
52   else if (!strcmp (type, "lightmap-m4"))
53     {
54       return video::EMT_LIGHTMAP_M4;
55     }
56   else if (!strcmp (type, "lightmap-lighting"))
57     {
58       return video::EMT_LIGHTMAP_LIGHTING;
59     }
60   else if (!strcmp (type, "lightmap-lighting-m2"))
61     {
62       return video::EMT_LIGHTMAP_LIGHTING_M2;
63     }
64   else if (!strcmp (type, "lightmap-lighting-m4"))
65     {
66       return video::EMT_LIGHTMAP_LIGHTING_M4;
67     }
68   else if (!strcmp (type, "detail-map"))
69     {
70       return video::EMT_DETAIL_MAP;
71     }
72   else if (!strcmp (type, "sphere-map"))
73     {
74       return video::EMT_SPHERE_MAP;
75     }
76   else if (!strcmp (type, "reflection-2-layer"))
77     {
78       return video::EMT_REFLECTION_2_LAYER;
79     }
80   else if (!strcmp (type, "transparent-add-color"))
81     {
82       return video::EMT_TRANSPARENT_ADD_COLOR;
83     }
84   else if (!strcmp (type, "transparent-alpha-channel"))
85     {
86       return video::EMT_TRANSPARENT_ALPHA_CHANNEL;
87     }
88   else if (!strcmp (type, "transparent-alpha-channel-ref"))
89     {
90       return video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
91     }
92   else if (!strcmp (type, "transparent-vertex-alpha"))
93     {
94       return video::EMT_TRANSPARENT_VERTEX_ALPHA;
95     }
96   else if (!strcmp (type, "transparent-reflection-2-layer"))
97     {
98       return video::EMT_TRANSPARENT_REFLECTION_2_LAYER;
99     }
100   else if (!strcmp (type, "normal-map-solid"))
101     {
102       return video::EMT_NORMAL_MAP_SOLID;
103     }
104   else if (!strcmp (type, "normal-map-transparent-add-color"))
105     {
106       return video::EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR;
107     }
108   else if (!strcmp (type, "normal-map-transparent-vertex-alpha"))
109     {
110       return video::EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA;
111     }
112   else if (!strcmp (type, "parallax-map-solid"))
113     {
114       return video::EMT_PARALLAX_MAP_SOLID;
115     }
116   else if (!strcmp (type, "parallax-map-transparent-add-color"))
117     {
118       return video::EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR;
119     }
120   else if (!strcmp (type, "parallax-map-transparent-vertex-alpha"))
121     {
122       return video::EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA;
123     }
124   else if (!strcmp (type, "onetexture-blend"))
125     {
126       return video::EMT_ONETEXTURE_BLEND;
127     }
128   else
129     {
130       scm_error (scm_arg_type_key, NULL, "Wrong material type: ~S",
131                  scm_list_1 (material_type), scm_list_1 (material_type));
132     }
133 }