Static Public Member Functions | |
static ParaAttributeObject | GetAttributeObject () |
get the attribute object associated with the global terrain. | |
static void | GetAttributeObject_ (ParaAttributeObject &output) |
used for API exportation. | |
static int | GetTextureCount (float x, float y) |
get the total number of textures in the texture set of the terrain tile specified by a world position (x,y) One can get each of the textures by calling GetTexture() function. | |
static ParaAssetObject | GetTexture (float x, float y, int nIndex) |
get the terrain detailed texture by index. | |
static void | GetTexture__ (ParaAssetObject *pOut, float x, float y, int nIndex) |
only used for API exporting. | |
static bool | ReplaceTexture (float x, float y, int nIndex, ParaAssetObject &TextureAsset) |
replace the texture at the given index. | |
static ParaAttributeObject | GetAttributeObjectAt (float x, float y) |
get the attribute object associated with the terrain tile that contains the given point. | |
static void | GetAttributeObjectAt_ (ParaAttributeObject &output, float x, float y) |
used for API exportation. | |
static float | GetElevation (float x, float y) |
get the terrain height at the specified position. | |
static string | GetTerrainOnloadScript (float x, float y) |
get the on load script which created all objects on this terrain that contains the point (x,y) | |
static const char * | GetTerrainOnloadScript__ (float x, float y) |
solely used for API exporting. | |
static string | GetTerrainElevFile (float x, float y) |
get the height map file name for the terrain tile that contains the point (x,y) | |
static const char * | GetTerrainElevFile__ (float x, float y) |
solely used for API exporting. | |
static void | SaveTerrain (bool bHeightMap, bool bTextures) |
save modified terrain to disk. | |
static void | ReloadTerrain (bool bHeightMap, bool bTextures) |
reload terrain from disk. | |
static void | UpdateTerrain () |
update terrain. | |
static void | SnapPointToVertexGrid (float x, float y, float *vertex_x, float *vertex_y) |
snap any 2D point on the height map to a vertex position on the height map. | |
static float | GetVertexSpacing () |
Returns the number of real units between vertices in the terrain's mesh. | |
static void | Paint (const char *detailTexture, float brushRadius, float brushIntensity, float maxIntensity, bool erase, float x, float y) |
paint on the specified location of the global terrain. | |
static void | Paint_ (int nDetailTextureID, float brushRadius, float brushIntensity, float maxIntensity, bool erase, float x, float y) |
| |
static void | DigCircleFlat (float x, float y, float radius, float fFlatPercentage, float factor) |
flatten a land centered at x,y, with a specified radius. | |
static void | GaussianHill (float x, float y, float radius, float hscale, float standard_deviation, float smooth_factor) |
static void | RadialScale (float x, float y, float scale_factor, float min_dist, float max_dist, float smooth_factor) |
Note: terrain data should be in normalized space with height in the range [0,1]. | |
static void | Roughen_Smooth (float x, float y, float radius, bool roughen, bool big_grid, float factor) |
square filter for sharpening and smoothing. | |
static void | AddHeightField (float x, float y, const char *filename, int nSmoothPixels) |
Add rectangular height field from file to the current terrain. | |
static bool | IsModified () |
return true, if the terrain is modified and should be saved. | |
static void | SetContentModified (float x, float y, bool bIsModified) |
set the content of the terrain modified. | |
static void | SetContentModified4 (float x, float y, bool bIsModified, DWORD dwModifiedBits) |
set the content of the terrain modified. | |
static void | EnableLighting (bool bEnable) |
Enable both global and local lighting. |
ParaAttributeObject ParaScripting::ParaTerrain::GetAttributeObject | ( | ) | [static] |
get the attribute object associated with the global terrain.
void ParaScripting::ParaTerrain::GetAttributeObject_ | ( | ParaAttributeObject & | output | ) | [static] |
used for API exportation.
ParaAssetObject ParaScripting::ParaTerrain::GetTexture | ( | float | x, | |
float | y, | |||
int | nIndex | |||
) | [static] |
get the terrain detailed texture by index.
Please note that each terrain tile contains its own texture set. the total number of textures can be returned by GetTextureCount().
nIndex,: | this should be smaller than the total number of textures in the texture set. see GetTextureCount(). there are two reserved negative index for the common and main textures -1: common texture, which is repeated several times over each terrain tile surface. -2: main texture, which is chopped and mapped to the entire terrain surface. |
void ParaScripting::ParaTerrain::GetTexture__ | ( | ParaAssetObject * | pOut, | |
float | x, | |||
float | y, | |||
int | nIndex | |||
) | [static] |
only used for API exporting.
bool ParaScripting::ParaTerrain::ReplaceTexture | ( | float | x, | |
float | y, | |||
int | nIndex, | |||
ParaAssetObject & | TextureAsset | |||
) | [static] |
replace the texture at the given index.
nIndex,: | this should be smaller than the total number of textures in the texture set. see GetTextureCount(). there are two reserved negative index for the common and main textures -1: common texture, which is repeated several times over each terrain tile surface. -2: main texture, which is chopped and mapped to the entire terrain surface. |
ParaAttributeObject ParaScripting::ParaTerrain::GetAttributeObjectAt | ( | float | x, | |
float | y | |||
) | [static] |
get the attribute object associated with the terrain tile that contains the given point.
x | in world unit | |
y | in world unit |
void ParaScripting::ParaTerrain::GetAttributeObjectAt_ | ( | ParaAttributeObject & | output, | |
float | x, | |||
float | y | |||
) | [static] |
used for API exportation.
float ParaScripting::ParaTerrain::GetElevation | ( | float | x, | |
float | y | |||
) | [static] |
get the terrain height at the specified position.
x,: | position in world unit | |
y,: | position in world unit |
const char * ParaScripting::ParaTerrain::GetTerrainOnloadScript__ | ( | float | x, | |
float | y | |||
) | [static] |
solely used for API exporting.
Not thread-safe
const char * ParaScripting::ParaTerrain::GetTerrainElevFile__ | ( | float | x, | |
float | y | |||
) | [static] |
solely used for API exporting.
Not thread-safe
void ParaScripting::ParaTerrain::SaveTerrain | ( | bool | bHeightMap, | |
bool | bTextures | |||
) | [static] |
save modified terrain to disk.
bHeightMap,: | true to save height map | |
bTextures,: | true to save textures: alpha maps, etc |
void ParaScripting::ParaTerrain::ReloadTerrain | ( | bool | bHeightMap, | |
bool | bTextures | |||
) | [static] |
reload terrain from disk.
User will lose changes since last save operation. one can UNDO changes with this function.
bHeightMap,: | true to save height map | |
bTextures,: | true to save textures: alpha maps, etc |
void ParaScripting::ParaTerrain::UpdateTerrain | ( | ) | [static] |
update terrain.
this function is called, when the user changes the terrain surface.
void ParaScripting::ParaTerrain::SnapPointToVertexGrid | ( | float | x, | |
float | y, | |||
float * | vertex_x, | |||
float * | vertex_y | |||
) | [static] |
snap any 2D point on the height map to a vertex position on the height map.
in NPL, one should write as below: local x,y = ParaTerrain.SnapPointToVertexGrid(10,10);
x | arbitrary 2D point on the height map | |
y | arbitrary 2D point on the height map | |
vertex_x | [out] vertex position on the height map | |
vertex_y | [out] vertex position on the height map |
float ParaScripting::ParaTerrain::GetVertexSpacing | ( | ) | [static] |
Returns the number of real units between vertices in the terrain's mesh.
void ParaScripting::ParaTerrain::Paint | ( | const char * | detailTexture, | |
float | brushRadius, | |||
float | brushIntensity, | |||
float | maxIntensity, | |||
bool | erase, | |||
float | x, | |||
float | y | |||
) | [static] |
paint on the specified location of the global terrain.
detailTexture,: | the texture entity to paint on the terrain. The texture is usually tilable such as road and grass. if this is "", it means the base layer or layer 0. Since version 0.9.9, the base layer also has an editable alpha mask . | |
brushRadius | The width of the brush to paint with in DetailTexture layer pixels. There are typically 256 of these pixels across a TextureCell. | |
brushIntensity | The intensity with which to paint, ranging from 0.0 to 1.0. This determines how opaque the painted "splat" will be. | |
maxIntensity | The maximum intensity of the painted splat, ranging from 0.0 to 1.0, accounting for mixing with a splat that may already reside on the surface. | |
erase | Specifies whether to add the splat to the surface or remove existing splat texels already on the surface (pass false to paint and pass true to erase existing splats) | |
x | The x location of the point to paint on the Terrain's surface in world units. | |
y | The y location of the point to paint on the Terrain's surface in world units. |
void ParaScripting::ParaTerrain::Paint_ | ( | int | nDetailTextureID, | |
float | brushRadius, | |||
float | brushIntensity, | |||
float | maxIntensity, | |||
bool | erase, | |||
float | x, | |||
float | y | |||
) | [static] |
nDetailTextureID,: | multi-texture layer ID, beginning from 0. Such as 0,1,2,3. -1,-2 are reserved for special terrain editor textures. -1 means the base layer. |
void ParaScripting::ParaTerrain::DigCircleFlat | ( | float | x, | |
float | y, | |||
float | radius, | |||
float | fFlatPercentage, | |||
float | factor | |||
) | [static] |
flatten a land centered at x,y, with a specified radius.
Algorithm: (1) flatten a circle with radius same as fFlatPercentage*radius (2) smooth the entire region twice.
x,: | center of the circle in world unit | |
y,: | center of the circle in world unit | |
radius,: | radius of the inner circle in world unit | |
fFlatPercentage,: | value is between [0,1]. fFlatPercentage*radius is the actual radius that got flattened. | |
factor,: | value is between [0,1]. 1 means fully transformed; 0 means nothing is changed |
void ParaScripting::ParaTerrain::RadialScale | ( | float | x, | |
float | y, | |||
float | scale_factor, | |||
float | min_dist, | |||
float | max_dist, | |||
float | smooth_factor | |||
) | [static] |
Note: terrain data should be in normalized space with height in the range [0,1].
Picks a point and scales the surrounding terrain in a circular manner. Can be used to make all sorts of circular shapes. Still needs some work. radial_scale: pick a point (center_x, center_y) and scale the points where distance is mindist<=distance<=maxdist linearly. The formula we'll use for a nice sloping smoothing factor is (-cos(x*3)/2)+0.5.
x,: | center of the circle in world unit | |
y,: | center of the circle in world unit | |
scale_factor,: | height of the scaled portion in world unit. This value can be negative. |
void ParaScripting::ParaTerrain::Roughen_Smooth | ( | float | x, | |
float | y, | |||
float | radius, | |||
bool | roughen, | |||
bool | big_grid, | |||
float | factor | |||
) | [static] |
square filter for sharpening and smoothing.
Use neighbour-averaging to roughen or smooth the height field. The factor determines how much of the computed roughening is actually applied to the height field. In it's default invocation, the 4 directly neighboring squares are used to calculate the roughening. If you select big sampling grid, all 8 neighboring cells will be used.
x,: | center of the circle in world unit | |
y,: | center of the circle in world unit | |
radius,: | radius of the inner circle in world unit | |
roughen,: | true for sharpening, false for smoothing. | |
big_grid,: | true for 8 neighboring cells, false for 4. | |
factor,: | value is between [0,1]. 1 means fully transformed; 0 means nothing is changed |
void ParaScripting::ParaTerrain::AddHeightField | ( | float | x, | |
float | y, | |||
const char * | filename, | |||
int | nSmoothPixels | |||
) | [static] |
Add rectangular height field from file to the current terrain.
x,: | center of the rect in world unit | |
y,: | center of the rect in world unit | |
filename | : the raw elevation or gray scale image file that contains the height field. | |
nSmoothPixels,: | the number of pixels to smooth from the edge of the height field. if this is 0, the original height field will be loaded unmodified. if it is greater than 0, the loaded height field will be smoothed for nSmoothPixels from the edge, where the edge is always 0. |
bool ParaScripting::ParaTerrain::IsModified | ( | ) | [static] |
return true, if the terrain is modified and should be saved.
void ParaScripting::ParaTerrain::SetContentModified | ( | float | x, | |
float | y, | |||
bool | bIsModified | |||
) | [static] |
set the content of the terrain modified.
the terrain is specified by a 2D point. the on load script will be rebuilt once saving the terrain.
x,: | a position on the terrain where content is changed. | |
y,: | a position on the terrain where content is changed. | |
bIsModified,: | true to set modified. |
void ParaScripting::ParaTerrain::SetContentModified4 | ( | float | x, | |
float | y, | |||
bool | bIsModified, | |||
DWORD | dwModifiedBits | |||
) | [static] |
set the content of the terrain modified.
the terrain is specified by a 2D point. the on load script will be rebuilt once saving the terrain.
bIsModified,: | true to set modified. | |
dwModifiedBits,: | this is any combination of TERRAIN_MODIFIED_BITS. Default value is MODIFIED_ON_LOAD_SCRIPT (16) enum TERRAIN_MODIFIED_BITS { MODIFIED_NONE = 0, detailed terrain texture(with mask) has been modified. MODIFIED_TEXTURE = 0x1, height map has modified MODIFIED_HEIGHTMAP = 0x1<<1, configuration such as base texture, common file, holes, etc has been modified. MODIFIED_CONFIGURATION = 0x1<<2, holes have been changed. this should mean the same thing as MODIFIED_CONFIGURATION MODIFIED_HOLES = 0x1<<3, if static objects have been modified, so that we will need to update the on load script MODIFIED_ON_LOAD_SCRIPT = 0x1<<4, MODIFIED_ALL = 0xffff }; |
void ParaScripting::ParaTerrain::EnableLighting | ( | bool | bEnable | ) | [static] |
Enable both global and local lighting.
Turn off lighting will greatly improve performance, such as on slower computers