My Project
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
ParaTerrain::Settings Class Reference

The Settings class is simply a manager of global variables. It provides a single place to set and retrieve all of the global settings that affect Demeter as a whole. More...

#include <Settings.h>

Public Types

enum  TESSELLATEMETHOD {
  TM_NEW = 0, TM_SCREEN_RECT = 1, TM_OLD_UPRIGHTONLY = 2, TM_2D_ROLLONLY = 3,
  TM_OLD_NEW = 4
}
 Enumerates the simplification heuristic methods for tessellation. More...
 

Public Member Functions

void SetMediaPath (const char *szPath)
 Sets the filesystem path that Demeter will look in when reading textures, elevation files, etc.
 
void GetMediaPath (char **szPath)
 Gets the filesystem path that Demeter will look in when reading textures, elevation files, etc.
 
const char * GetMediaPath ()
 get the media path pointer
 
void PrependMediaPath (const char *szFilename, char *szFullFilename)
 Prepends the current media path to the specified filename. It is the caller's responsibility to allocate szFullFilename with sufficient size to handle the entire filename.
 
void PrependMediaPath (const char *szFilename, char *szFullFilename, int bufferLength)
 Prepends the current media path to the specified filename. The bufferLength parameter specifies the length of the destination buffer; an exception will be thrown if the buffer is not big enough to receive the prepended filename.
 
bool IsMediaPathSet ()
 Indicates whether or not a call to SetMediaPath() has been made.
 
void SetVerbose (bool bVerbose)
 Specifies whether or not Demeter should output diagnostic information at runtime.
 
bool IsVerbose ()
 Indicates whether or not Demeter is outputting diagnostic information at runtime.
 
void SetScreenWidth (int width)
 Tells Demeter what the current width of the rendering surface is.
 
int GetScreenWidth ()
 Retrieves the current width of the rendering surface assumed by Demeter.
 
void SetScreenHeight (int height)
 Tells Demeter what the current height of the rendering surface is.
 
int GetScreenHeight ()
 Retrieves the current height of the rendering surface assumed by Demeter.
 
bool SetProperty (const char *szProperty, const char *szValue)
 Sets a named global property to the specified value.
 
bool GetProperty (const char *szProperty, char *szValue)
 Retrieves a named global property.
 
bool IsCompilerOnly ()
 Indicates whether or not the application that is using Demeter is a terrain compiler-like tool or a real application.
 
void SetCompilerOnly (bool bIsCompilerOnly)
 Determins whether or not the application that is using Demeter is a terrain compiler-like tool or a real application.
 
void SetUseDynamicTextures (bool useDynamic)
 Specifies whether or not textures should be unloaded when they are not visible. This allows larger amounts of texture data, but at the expense of performance.
 
bool UseDynamicTextures ()
 Forces Texture objects to use persisten buffers by default. See Texture::SetBufferPersistent() for details.
 
void SetTextureCompression (bool bCompress)
 Specifies whether or not textures should be compressed.
 
bool IsTextureCompression ()
 Indicates whether or not texture compression is used by Texture objects by default.
 
void SetHeadless (bool isHeadless)
 Puts Demeter in a non-graphics mode. More...
 
bool IsHeadless ()
 Indicates whether or not headless mode is on, as set by calling SetHeadless().
 
void SetEditor (bool isEditor)
 Puts Demeter in editor mode. More...
 
bool IsEditor ()
 Indicates whether or not SetEditor(true) has been called.
 
void SetTessellateMethod (int method)
 Set the tessellation heuristic method to use when tessellating. More...
 
int GetTessellateMethod ()
 Gets the current tessellation heuristic method.
 
void SetTessellateZWeight (float method)
 ZWeight to make screen Z coordinate more significant in level of detail decisions.
 
float GetTessellateZWeight ()
 Gets the ZWeight.
 
void SetHighResTextureRadius (float radius)
 set the radius in world coordinates, within eye position of which high-res textures will be used if possible.
 
float GetHighResTextureRadius ()
 Gets the radius setting as set in a call to SetHighResTextureRadius().
 
void SetPickThreshold (float threshold)
 Specifies the maximum distance between the surface of the terrain and a picked point that can be considered picking the terrain (as opposed to an application-specific object.)
 
float GetPickThreshold ()
 Gets the pick threshold as set in a call to SetPickThreshold().
 
void SetPreloadTextures (bool bPreload)
 Specifies whether or not all of a terrain's textures should be preloaded when the terrain is loaded. More...
 
bool GetPreloadTextures ()
 Gets the preload setting as set in a call to SetPreLoadTextures().
 
void SetUseNormals (bool bUseNormals)
 Specifies whether or not vertex normals should be calculated and used. More...
 
bool UseNormals ()
 Indicates whether or not normals are on as set by calling SetUseNormals().
 
void SetUseBorders (bool bUseBorders)
 If set to true, instructs Demeter to use texture border extensions to eliminate texture seams when bilinear filtering is enabled.
 
bool UseBorders ()
 Indicates whether or not texture borders are on as set by calling SetUseBorders().
 
void SetUseVertexLocking (bool bUseVertexLocking)
 If set to true, instructs Demeter to use compiled vertex array extensions - this can cause significant performance problems on older, flakey 3D hardware.
 
bool UseVertexLocking ()
 Indicates whether or not compiled vertex array support is on as set by calling SetUseVertexLocking().
 
void SetBackupFilesOnSave (bool bBackupOnSave)
 whether to backup critical files on save
 
bool IsBackupFilesOnSave ()
 whether to backup critical files on save
 
void SetTextureMaskWidth (int width)
 Puts Demeter in a diagnostic mode that checks for such things as memory leaks and unbound textures.
 
int GetTextureMaskWidth ()
 
void SetTextureMaskHeight (int height)
 
int GetTextureMaskHeight ()
 
void SetMaskReloadQueueActive (bool isQueueActive)
 
bool IsMaskReloadQueueActive ()
 
void SetBaseTextureEnabled (bool enabled)
 
bool IsBaseTextureEnabled ()
 
void SetDiagnostic (bool bDiagnostic)
 This option makes Demeter run slowly, so only use it for debuggin purposes.
 
bool IsDiagnostic ()
 Indicates whether or not diagnostic mode as been activated as set by calling SetDiagnostic().
 
void SetImageLoader (ParaTerrain::ImageLoader *pLoader)
 
ParaTerrain::ImageLoaderGetImageLoader ()
 

Static Public Member Functions

static SettingsGetInstance ()
 Returns the global instance of this class. The Settings class acts a singleton, so there is only one instance of this class per application.
 

Static Public Attributes

static const int32 TextureMaskBitsPerPixel = 8
 

Detailed Description

The Settings class is simply a manager of global variables. It provides a single place to set and retrieve all of the global settings that affect Demeter as a whole.

Member Enumeration Documentation

§ TESSELLATEMETHOD

Enumerates the simplification heuristic methods for tessellation.

Enumerator
TM_NEW 

Good general algorithm (handles camera roll and pitch) - uses skewed bounding boxes that closely fit Terrain blocks; measures the 3D length of the Z axis for error metric.

TM_SCREEN_RECT 

Fast but doesn't always approximate well - goes purely by 2D screen-size of terrain block.

TM_OLD_UPRIGHTONLY 

Fast heuristic but overall worse performance; doesn't handle camera rolling at all.

TM_2D_ROLLONLY 

Not as general as TM_NEW; handles camera rolling by also looking at 2D screen size of Z axis of bounding box.

TM_OLD_NEW 

Goes by "screen-space" 3D length of Z axis of bounding box.

Member Function Documentation

§ SetEditor()

void Settings::SetEditor ( bool  isEditor)

Puts Demeter in editor mode.

This makes memory usage much higher but makes dynamically editing the terrain easier for applications such as terrain editors.

§ SetHeadless()

void Settings::SetHeadless ( bool  isHeadless)

Puts Demeter in a non-graphics mode.

This prevents textures from being loaded, geometry from being built, etc. This allows terrains to be created on a server or other "headless" environment where only the elevation data itself is required.

§ SetPreloadTextures()

void Settings::SetPreloadTextures ( bool  bPreload)

Specifies whether or not all of a terrain's textures should be preloaded when the terrain is loaded.

This makes terrains load more slowly but they run more smoothly since textures aren't loaded as the user's camera moves.

§ SetTessellateMethod()

void Settings::SetTessellateMethod ( int  method)

Set the tessellation heuristic method to use when tessellating.

This setting determines which algorithm Demeter uses to simplify terrain blocks. Some settings are faster but less general and vice versa. The default setting is TM_NEW.

§ SetUseNormals()

void Settings::SetUseNormals ( bool  bUseNormals)

Specifies whether or not vertex normals should be calculated and used.

Turning this option on will make Demeter use more memory and will slow rendering slightly on most hardware. You will definitely need to turn this setting on if you want to use lighting on your Terrain objects instead of "baking" lighting into the terrain textures.


The documentation for this class was generated from the following files: