1 /*
2  * OutputApp.h
3  *
4  * Copyright (C) 2003 J. "MUFTI" Scheurich
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program (see the file "COPYING" for details); if
18  * not, write to the Free Software Foundation, Inc., 675 Mass Ave,
19  * Cambridge, MA 02139, USA.
20  */
21 
22 #pragma once
23 
24 extern bool parseCommandlineArgumentOutput(int & i,int argc, char** argv);
25 
26 enum {
27     MATERIAL_NAME_BEFORE_LAST_UNDERSCORE = 1,
28     MATERIAL_NAME_AFTER_FIRST_UNDERSCORE = 2
29 };
30 
31 class WonderlandModuleExport;
32 
33 class OutputApp {
34 public:
35                         OutputApp();
36 
SetKeepURLs(bool flag)37     void                SetKeepURLs(bool flag) { m_keepURLs = flag; }
GetKeepURLs()38     bool                GetKeepURLs() const { return m_keepURLs; }
39 
SetIndent(int value)40     void                SetIndent(int value) {m_indent = value;}
GetIndent(void)41     int                 GetIndent(void) {return m_indent;}
42 
43     void                SetFloatDigits(int value);
GetFloatDigits(void)44     int                 GetFloatDigits(void) {return m_floatDigits;}
45 
46     void                forbidEFloatWriteFormat();
47     void                enableEFloatWriteFormat(int writeFlags);
48     void                disableEFloatWriteFormat(int writeFlags);
49     void                useEFloatWriteFormat(int flag);
50 
GetIncludeProtos()51     bool                GetIncludeProtos() const { return m_includeProtos; }
SetIncludeProtos(bool flag)52     void                SetIncludeProtos(bool flag) { m_includeProtos = flag; }
53 
GetkrFormating()54     bool                GetkrFormating() const { return m_krFormating; }
SetkrFormating(bool flag)55     void                SetkrFormating(bool flag) { m_krFormating = flag; }
56 
GetCompress()57     bool                GetCompress() const { return m_compress; }
SetCompress(bool flag)58     void                SetCompress(bool flag) { m_compress = flag; }
59 
GetNormalsOnMeshCreation()60     bool                GetNormalsOnMeshCreation() const
61                            { return m_normalsOnMeshCreation; }
SetNormalsOnMeshCreation(bool flag)62     void                SetNormalsOnMeshCreation(bool flag)
63                            { m_normalsOnMeshCreation = flag; }
64 
65     int                 writeWonderlandModule(const char* directory,
66                                               const char* name, Scene* scene,
67                                               bool manyClasses);
isWonderlandModuleExport(void)68     bool                isWonderlandModuleExport(void)
69                            { return m_wonderlandModuleExport != NULL; }
70     int                 writeWonderlandModuleArtPath(int filedes,
71                                                      const char* fileName);
72 
GetWonderlandModuleExportPath(void)73     const char         *GetWonderlandModuleExportPath(void)
74                            { return m_wonderlandModuleExportPath;}
75     void                SetWonderlandModuleExportPath(char *path);
76 
GetWonderlandModuleExportPrefix(void)77     const char         *GetWonderlandModuleExportPrefix(void)
78                            { return m_wonderlandModuleExportPrefix;}
79     void                SetWonderlandModuleExportPrefix(char *prefix);
80 
GetWonderlandModuleExportManyClasses(void)81     bool                GetWonderlandModuleExportManyClasses(void)
82                            { return m_wonderlandModuleExportManyClasses; }
SetWonderlandModuleExportManyClasses(bool flag)83     void                SetWonderlandModuleExportManyClasses(bool flag)
84                            { m_wonderlandModuleExportManyClasses = flag; }
85 
GetWonderlandModuleExportAllX3dClasses(void)86     bool                GetWonderlandModuleExportAllX3dClasses(void)
87                            { return m_wonderlandModuleExportAllX3dClasses; }
SetWonderlandModuleExportAllX3dClasses(bool flag)88     void                SetWonderlandModuleExportAllX3dClasses(bool flag)
89                            { m_wonderlandModuleExportAllX3dClasses = flag; }
90 
SetWrittenElementsPerJavaArray(int numberElements)91     void                SetWrittenElementsPerJavaArray(int numberElements)
92                            { m_writtenElementsPerJavaArray = numberElements; }
GetWrittenElementsPerJavaArray(void)93     int                 GetWrittenElementsPerJavaArray(void)
94                            { return m_writtenElementsPerJavaArray; }
95 
GetCattExportSrcRec(void)96     bool                GetCattExportSrcRec(void) { return m_cattExportSrcRec; }
97 
GetCattExportPath(void)98     const char         *GetCattExportPath(void)
99                            { return m_cattExportPath;}
100     void                SetCattExportPath(const char *path);
101 
GetX3domPath(void)102     const char         *GetX3domPath(void)
103                            { return m_x3domPath;}
104     void                SetX3domPath(const char *path);
105 
GetX3domParameter(void)106     const char         *GetX3domParameter(void)
107                            { return m_x3domParameter; }
108     void                SetX3domParameter(const char *parameter);
109 
GetXitePath(void)110     const char         *GetXitePath(void)
111                            { return m_xitePath;}
112     void                SetXitePath(const char *path);
113 
114     void                OutputSetDefaults();
115 
116     void                OutputLoadPreferences();
117     void                OutputSavePreferences();
118 
SkipMaterialNameBeforeFirstUnderscore(void)119     bool                SkipMaterialNameBeforeFirstUnderscore(void)
120                            { return m_skipMaterialNameBeforeFirstUnderscore; }
SetSkipMaterialNameBeforeFirstUnderscore(bool f)121     bool                SetSkipMaterialNameBeforeFirstUnderscore(bool f)
122                            { return m_skipMaterialNameBeforeFirstUnderscore = f;}
SkipMaterialNameAfterLastUnderscore(void)123     bool                SkipMaterialNameAfterLastUnderscore(void)
124                            { return m_skipMaterialNameAfterLastUnderscore; }
SetSkipMaterialNameAfterLastUnderscore(bool f)125     bool                SetSkipMaterialNameAfterLastUnderscore(bool f)
126                            { return m_skipMaterialNameAfterLastUnderscore = f;}
127 
IsMaterialNameBeforeLastUnderscore(void)128     bool                IsMaterialNameBeforeLastUnderscore(void)
129                            { return m_materialNameGeneration &
130                                     MATERIAL_NAME_BEFORE_LAST_UNDERSCORE; }
IsMaterialNameAfterFirstUnderscore(void)131     bool                IsMaterialNameAfterFirstUnderscore(void)
132                            { return m_materialNameGeneration &
133                                     MATERIAL_NAME_AFTER_FIRST_UNDERSCORE; }
134 
GetRevisionControlCheckinFlag(void)135     bool                GetRevisionControlCheckinFlag(void)
136                            { return m_revisionControlCheckinFlag; }
SetRevisionControlCheckinFlag(bool flag)137     void                SetRevisionControlCheckinFlag(bool flag)
138                            { m_revisionControlCheckinFlag = flag; }
139 
GetRevisionControlCheckinCommand(void)140     const char         *GetRevisionControlCheckinCommand(void)
141                            { return m_revisionControlCheckinCommand; }
SetRevisionControlCheckinCommand(const char * command)142     void                SetRevisionControlCheckinCommand(const char* command)
143                            {
144                            if (m_revisionControlCheckinCommand != NULL)
145                               free(m_revisionControlCheckinCommand);
146                            m_revisionControlCheckinCommand = strdup(command);
147                            }
148 
GetDefaultAc3dMaterialName(void)149     const char          *GetDefaultAc3dMaterialName(void)
150                            { return m_defaultAc3dMaterialName; }
SetDefaultAc3dMaterialName(const char * name)151     void                 SetDefaultAc3dMaterialName(const char *name)
152                            {
153                            if (m_defaultAc3dMaterialName != NULL)
154                               free(m_defaultAc3dMaterialName);
155                            m_defaultAc3dMaterialName = strdup(name);
156                            }
157 
GetAc3dExport4Raven(void)158     bool                GetAc3dExport4Raven(void) { return m_ac3dExport4Raven; }
SetAc3dExport4Raven(bool b)159     void                SetAc3dExport4Raven(bool b) { m_ac3dExport4Raven = b; }
160 
GetAc3dExportConvert2Gif(void)161     bool                GetAc3dExportConvert2Gif(void)
162 #ifdef HAVE_IMAGE_CONVERTER
163                            { return m_ac3dExportConvert2Gif; }
164 #else
165                            { return false; }
166 #endif
SetAc3dExportConvert2Gif(bool b)167     void                SetAc3dExportConvert2Gif(bool b)
168                            { m_ac3dExportConvert2Gif = b; }
169 
GetDefaultCattMaterialName(void)170     char                *GetDefaultCattMaterialName(void)
171                            { return m_defaultCattMaterialName; }
SetDefaultCattMaterialName(const char * name)172     void                 SetDefaultCattMaterialName(const char *name)
173                            {
174                            if (m_defaultCattMaterialName != NULL)
175                               free(m_defaultCattMaterialName);
176                            m_defaultCattMaterialName = strdup(name);
177                            }
178 
GetAntPath(void)179     char                *GetAntPath(void) { return m_antPath; }
SetAntPath(const char * path)180     void                 SetAntPath(const char *path)
181                            {
182                            if (m_antPath != NULL)
183                                free(m_antPath);
184                            m_antPath = strdup(path);
185                            }
GetAntCommand(void)186     const char          *GetAntCommand(void) { return m_antCommand; }
SetAntCommand(const char * command)187     void                 SetAntCommand(const char *command)
188                            {
189                            if (m_antCommand != NULL)
190                                free(m_antCommand);
191                            m_antCommand = strdup(command);
192                            }
GetAntOptions(void)193     const char          *GetAntOptions(void) { return m_antOptions; }
SetAntOptions(const char * opts)194     void                 SetAntOptions(const char *opts)
195                            {
196                            if (m_antOptions != NULL)
197                                free(m_antOptions);
198                            m_antOptions = strdup(opts);
199                            }
GetRunAnt(void)200     bool                 GetRunAnt(void) { return m_runAnt; }
SetRunAnt(bool flag)201     void                 SetRunAnt(bool flag) { m_runAnt = flag; }
202 
GetGit(void)203     bool                 GetGit(void) { return m_git; }
SetGit(bool flag)204     void                 SetGit(bool flag) { m_git = flag; }
205 
206     void                 runAnt(Scene *scene);
207 
GetRibTexturer(void)208     const char          *GetRibTexturer(void) { return m_ribTexturer; }
SetRibTexturer(const char * texturer)209     void                 SetRibTexturer(const char *texturer)
210                            {
211                            if (m_ribTexturer != NULL)
212                                free(m_ribTexturer);
213                            m_ribTexturer = strdup(texturer);
214                            }
215 
GetImageConverter(void)216     const char          *GetImageConverter(void) { return m_imageConverter; }
SetImageConverter(const char * converter)217     void                 SetImageConverter(const char *converter)
218                            {
219                            if (m_imageConverter != NULL)
220                                free((void*)m_imageConverter);
221                            m_imageConverter = strdup(converter);
222                            }
223 
224 private:
225     bool                    m_keepURLs;
226     int                     m_indent;
227     int                     m_floatDigits;
228     int                     m_oldFloatDigits;
229     bool                    m_useEFloatWriteFormat;
230     bool                    m_krFormating;
231     bool                    m_includeProtos;
232     bool                    m_compress;
233     bool                    m_normalsOnMeshCreation;
234     bool                    m_skipMaterialNameBeforeFirstUnderscore;
235     bool                    m_skipMaterialNameAfterLastUnderscore;
236     int                     m_materialNameGeneration;
237     char                   *m_downloadDirectory;
238     char                   *m_defaultAc3dMaterialName;
239     bool                    m_ac3dExport4Raven;
240     bool                    m_ac3dExportConvert2Gif;
241     char                   *m_defaultCattMaterialName;
242     bool                    m_revisionControlCheckinFlag;
243     char                   *m_revisionControlCheckinCommand;
244     WonderlandModuleExport *m_wonderlandModuleExport;
245     char                   *m_wonderlandModuleExportPath;
246     char                   *m_wonderlandModuleExportPrefix;
247     bool                    m_wonderlandModuleExportManyClasses;
248     bool                    m_wonderlandModuleExportAllX3dClasses;
249     int                     m_writtenElementsPerJavaArray;
250     bool                    m_cattExportSrcRec;
251     char                   *m_cattExportPath;
252     char                   *m_xitePath;
253     char                   *m_x3domPath;
254     char                   *m_x3domParameter;
255     char                   *m_antPath;
256     char                   *m_antCommand;
257     char                   *m_antOptions;
258     char                   *m_defaultAntCommand;
259     bool                    m_runAnt;
260     char                   *m_ribTexturer;
261     const char             *m_imageConverter;
262     bool                    m_git;
263 };
264 
265 
266