My Project
Settings.h
1 #pragma once
2 
3 #include "TerrainCommon.h"
4 #include "ImageLoader.h"
5 
6 namespace ParaTerrain
7 {
8 
10  class Settings
11  {
12  public:
13  ~Settings();
15  static Settings *GetInstance();
17  void SetMediaPath(const char *szPath);
19  void GetMediaPath(char **szPath);
21  const char * GetMediaPath();
23  void PrependMediaPath(const char *szFilename, char *szFullFilename);
25  void PrependMediaPath(const char *szFilename, char *szFullFilename, int bufferLength);
27  bool IsMediaPathSet();
29  void SetVerbose(bool bVerbose);
31  bool IsVerbose();
33  void SetScreenWidth(int width);
35  int GetScreenWidth();
37  void SetScreenHeight(int height);
39  int GetScreenHeight();
41  bool SetProperty(const char *szProperty, const char *szValue);
43  bool GetProperty(const char *szProperty, char *szValue);
45  bool IsCompilerOnly();
47  void SetCompilerOnly(bool bIsCompilerOnly);
49  void SetUseDynamicTextures(bool useDynamic);
51  bool UseDynamicTextures();
53  void SetTextureCompression(bool bCompress);
55  bool IsTextureCompression();
57 
59  void SetHeadless(bool isHeadless);
61  bool IsHeadless();
63 
66  void SetEditor(bool isEditor);
68  bool IsEditor();
70 
73  void SetTessellateMethod(int method);
75  int GetTessellateMethod();
77  void SetTessellateZWeight(float method);
79  float GetTessellateZWeight();
80 
82  void SetHighResTextureRadius(float radius);
85 
87  void SetPickThreshold(float threshold);
89  float GetPickThreshold();
91 
93  void SetPreloadTextures(bool bPreload);
95  bool GetPreloadTextures();
97 
101  void SetUseNormals(bool bUseNormals);
103  bool UseNormals();
105  void SetUseBorders(bool bUseBorders);
107  bool UseBorders();
109  void SetUseVertexLocking(bool bUseVertexLocking);
111  bool UseVertexLocking();
112 
114  void SetBackupFilesOnSave(bool bBackupOnSave);
115 
117  bool IsBackupFilesOnSave();
118 
119 
121  void SetTextureMaskWidth(int width);
122  int GetTextureMaskWidth();
123  void SetTextureMaskHeight(int height);
124  int GetTextureMaskHeight();
125  void SetMaskReloadQueueActive(bool isQueueActive);
126  bool IsMaskReloadQueueActive();
127  void SetBaseTextureEnabled(bool enabled);
128  bool IsBaseTextureEnabled();
130  void SetDiagnostic(bool bDiagnostic);
132  bool IsDiagnostic();
133  void SetImageLoader(ParaTerrain::ImageLoader* pLoader);
134  ParaTerrain::ImageLoader* GetImageLoader();
137  {
139  TM_NEW = 0,
148  };
149  public:
150  static const int32 TextureMaskBitsPerPixel;
151  private:
152  Settings();
153  static Settings *m_pInstance;
154  char *m_szMediaPath;
155  bool m_bVerbose;
156  bool m_bIsCompilerOnly;
157  bool m_bCompressTextures;
158  int m_ScreenWidth, m_ScreenHeight;
159  bool m_IsHeadless;
160  bool m_UseDynamicTextures;
161  bool m_IsEditor;
162  int m_TessellateMethod;
163  float m_TessellateZWeight;
164  float m_PickThreshold;
165  bool m_bPreloadTextures;
166  bool m_bUseNormals;
167  bool m_bDiagnostic;
168  bool m_bUseBorders;
169  bool m_bUseVertexLocking;
170  int m_TextureMaskWidth, m_TextureMaskHeight;
171  bool m_bIsMaskReloadQueueActive;
172  bool m_IsBaseTextureEnabled;
173 
174  float m_fHighResTextureRadius;
176  bool m_bBackupFilesOnSave;
177 
178  ParaTerrain::ImageLoader* m_pImageLoader;
179  };
180 }
181 
bool UseBorders()
Indicates whether or not texture borders are on as set by calling SetUseBorders().
Definition: Settings.cpp:111
bool UseDynamicTextures()
Forces Texture objects to use persisten buffers by default. See Texture::SetBufferPersistent() for de...
Definition: Settings.cpp:191
Definition: SceneObject.h:15
int GetTessellateMethod()
Gets the current tessellation heuristic method.
Definition: Settings.cpp:343
void SetUseDynamicTextures(bool useDynamic)
Specifies whether or not textures should be unloaded when they are not visible. This allows larger am...
Definition: Settings.cpp:186
Not as general as TM_NEW; handles camera rolling by also looking at 2D screen size of Z axis of bound...
Definition: Settings.h:145
bool UseVertexLocking()
Indicates whether or not compiled vertex array support is on as set by calling SetUseVertexLocking()...
Definition: Settings.cpp:101
void SetPickThreshold(float threshold)
Specifies the maximum distance between the surface of the terrain and a picked point that can be cons...
Definition: Settings.cpp:167
bool IsMediaPathSet()
Indicates whether or not a call to SetMediaPath() has been made.
Definition: Settings.cpp:245
void SetUseNormals(bool bUseNormals)
Specifies whether or not vertex normals should be calculated and used.
Definition: Settings.cpp:76
void PrependMediaPath(const char *szFilename, char *szFullFilename)
Prepends the current media path to the specified filename. It is the caller's responsibility to alloc...
Definition: Settings.cpp:253
bool IsBackupFilesOnSave()
whether to backup critical files on save
Definition: Settings.cpp:61
void SetUseBorders(bool bUseBorders)
If set to true, instructs Demeter to use texture border extensions to eliminate texture seams when bi...
Definition: Settings.cpp:106
bool IsVerbose()
Indicates whether or not Demeter is outputting diagnostic information at runtime. ...
Definition: Settings.cpp:283
void SetTessellateZWeight(float method)
ZWeight to make screen Z coordinate more significant in level of detail decisions.
Definition: Settings.cpp:348
const char * GetMediaPath()
get the media path pointer
Definition: Settings.cpp:241
bool IsHeadless()
Indicates whether or not headless mode is on, as set by calling SetHeadless().
Definition: Settings.cpp:273
float GetTessellateZWeight()
Gets the ZWeight.
Definition: Settings.cpp:353
bool IsDiagnostic()
Indicates whether or not diagnostic mode as been activated as set by calling SetDiagnostic().
Definition: Settings.cpp:121
void SetBackupFilesOnSave(bool bBackupOnSave)
whether to backup critical files on save
Definition: Settings.cpp:56
void SetDiagnostic(bool bDiagnostic)
This option makes Demeter run slowly, so only use it for debuggin purposes.
Definition: Settings.cpp:116
int GetScreenHeight()
Retrieves the current height of the rendering surface assumed by Demeter.
Definition: Settings.cpp:308
void SetScreenWidth(int width)
Tells Demeter what the current width of the rendering surface is.
Definition: Settings.cpp:303
TESSELLATEMETHOD
Enumerates the simplification heuristic methods for tessellation.
Definition: Settings.h:136
Fast heuristic but overall worse performance; doesn't handle camera rolling at all.
Definition: Settings.h:143
void SetCompilerOnly(bool bIsCompilerOnly)
Determins whether or not the application that is using Demeter is a terrain compiler-like tool or a r...
Definition: Settings.cpp:323
void SetUseVertexLocking(bool bUseVertexLocking)
If set to true, instructs Demeter to use compiled vertex array extensions - this can cause significan...
Definition: Settings.cpp:96
void SetTextureMaskWidth(int width)
Puts Demeter in a diagnostic mode that checks for such things as memory leaks and unbound textures...
Definition: Settings.cpp:358
float GetPickThreshold()
Gets the pick threshold as set in a call to SetPickThreshold().
Definition: Settings.cpp:172
bool IsCompilerOnly()
Indicates whether or not the application that is using Demeter is a terrain compiler-like tool or a r...
Definition: Settings.cpp:318
The Settings class is simply a manager of global variables. It provides a single place to set and ret...
Definition: Settings.h:10
Fast but doesn't always approximate well - goes purely by 2D screen-size of terrain block...
Definition: Settings.h:141
int GetScreenWidth()
Retrieves the current width of the rendering surface assumed by Demeter.
Definition: Settings.cpp:298
void SetHighResTextureRadius(float radius)
set the radius in world coordinates, within eye position of which high-res textures will be used if p...
Definition: Settings.cpp:177
void SetPreloadTextures(bool bPreload)
Specifies whether or not all of a terrain's textures should be preloaded when the terrain is loaded...
Definition: Settings.cpp:157
void SetTextureCompression(bool bCompress)
Specifies whether or not textures should be compressed.
Definition: Settings.cpp:328
void SetScreenHeight(int height)
Tells Demeter what the current height of the rendering surface is.
Definition: Settings.cpp:313
void SetEditor(bool isEditor)
Puts Demeter in editor mode.
Definition: Settings.cpp:288
bool GetPreloadTextures()
Gets the preload setting as set in a call to SetPreLoadTextures().
Definition: Settings.cpp:162
void SetTessellateMethod(int method)
Set the tessellation heuristic method to use when tessellating.
Definition: Settings.cpp:338
Definition: ImageLoader.h:4
bool IsEditor()
Indicates whether or not SetEditor(true) has been called.
Definition: Settings.cpp:293
bool IsTextureCompression()
Indicates whether or not texture compression is used by Texture objects by default.
Definition: Settings.cpp:333
static Settings * GetInstance()
Returns the global instance of this class. The Settings class acts a singleton, so there is only one ...
Definition: Settings.cpp:49
void SetHeadless(bool isHeadless)
Puts Demeter in a non-graphics mode.
Definition: Settings.cpp:268
bool UseNormals()
Indicates whether or not normals are on as set by calling SetUseNormals().
Definition: Settings.cpp:81
bool GetProperty(const char *szProperty, char *szValue)
Retrieves a named global property.
Definition: Settings.cpp:139
void SetMediaPath(const char *szPath)
Sets the filesystem path that Demeter will look in when reading textures, elevation files...
Definition: Settings.cpp:196
float GetHighResTextureRadius()
Gets the radius setting as set in a call to SetHighResTextureRadius().
Definition: Settings.cpp:182
bool SetProperty(const char *szProperty, const char *szValue)
Sets a named global property to the specified value.
Definition: Settings.cpp:126
void SetVerbose(bool bVerbose)
Specifies whether or not Demeter should output diagnostic information at runtime. ...
Definition: Settings.cpp:278
Goes by "screen-space" 3D length of Z axis of bounding box.
Definition: Settings.h:147
Good general algorithm (handles camera roll and pitch) - uses skewed bounding boxes that closely fit ...
Definition: Settings.h:139