1+ /*
2+ Copyright (C) 2002-2008 Shawn Kirst <skirst@insightbb.com>
3+
4+ This program is free software; you can redistribute it and/or
5+ modify it under the terms of the GNU General Public
6+ License as published by the Free Software Foundation; either
7+ version 2 of the License, or (at your option) any later version.
8+
9+ This program is distributed in the hope that it will be useful,
10+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+ General Public License for more details.
13+
14+ You should have received a copy of the GNU General Public License
15+ along with this program; see the file COPYING. If not, write to
16+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17+ Boston, MA 02111-1307, USA.
18+ */
19+ #ifndef NORMAL_MAP
20+ #define NORMAL_MAP
21+
22+ #include <stdint.h>
23+
24+ #define ENUM_EACH (PARAM ) PARAM,
25+ #define STR_EACH (PARAM ) #PARAM,
26+ #define STR_EACH_SEP_WS (PARAM ) #PARAM " "
27+
28+ #define EACH_FILTER_TYPE (DO ) \
29+ DO(FILTER_NONE) \
30+ DO(FILTER_SOBEL_3x3) \
31+ DO(FILTER_SOBEL_5x5) \
32+ DO(FILTER_PREWITT_3x3) \
33+ DO(FILTER_PREWITT_5x5) \
34+ DO(FILTER_3x3) \
35+ DO(FILTER_5x5) \
36+ DO(FILTER_7x7) \
37+ DO(FILTER_9x9) \
38+ DO(MAX_FILTER_TYPE)
39+ #define FILTER_TYPE_COUNT (10)
40+
41+ enum FILTER_TYPE { EACH_FILTER_TYPE (ENUM_EACH ) };
42+
43+ static char * FILTER_TYPE_NAMES [] = {
44+ EACH_FILTER_TYPE (STR_EACH )
45+ };
46+
47+ enum ALPHA_TYPE
48+ {
49+ ALPHA_NONE , ALPHA_HEIGHT , ALPHA_INVERSE_HEIGHT , ALPHA_ZERO , ALPHA_ONE ,
50+ ALPHA_INVERT , ALPHA_MAP , MAX_ALPHA_TYPE
51+ };
52+
53+ enum CONVERSION_TYPE
54+ {
55+ CONVERT_NONE , CONVERT_BIASED_RGB , CONVERT_RED , CONVERT_GREEN ,
56+ CONVERT_BLUE , CONVERT_MAX_RGB , CONVERT_MIN_RGB , CONVERT_COLORSPACE ,
57+ CONVERT_NORMALIZE_ONLY , CONVERT_DUDV_TO_NORMAL , CONVERT_HEIGHTMAP ,
58+ CONVERT_KEY_RGB ,
59+ MAX_CONVERSION_TYPE
60+ };
61+
62+ enum DUDV_TYPE
63+ {
64+ DUDV_NONE , DUDV_8BIT_SIGNED , DUDV_8BIT_UNSIGNED , DUDV_16BIT_SIGNED ,
65+ DUDV_16BIT_UNSIGNED ,
66+ MAX_DUDV_TYPE
67+ };
68+
69+ typedef struct
70+ {
71+ int filter ;
72+ double minz ;
73+ double scale ;
74+ int wrap ;
75+ int height_source ;
76+ int alpha ;
77+ int conversion ;
78+ int dudv ;
79+ int xinvert ;
80+ int yinvert ;
81+ int swapRGB ;
82+ double contrast ;
83+ int32_t alphamap_id ;
84+ } NormalmapVals ;
85+
86+ int32_t normalmap (uint8_t * img , uint8_t * nm_img , size_t dx , size_t dy , NormalmapVals nmapvals );
87+
88+
89+ #endif
0 commit comments