My Project
Static Public Member Functions | List of all members
ParaScripting::ParaTerrain Class Reference

Contains Terrain functions. More...

#include <ParaScriptingTerrain.h>

Static Public Member Functions

static ParaAttributeObject GetAttributeObject ()
 get the attribute object associated with the global terrain. More...
 
static void GetAttributeObject_ (ParaAttributeObject &output)
 used for API exportation. More...
 
static ParaAttributeObject GetBlockAttributeObject ()
 get block terrain manager's attribute object. More...
 
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 void GetTexturesInCell (float x, float y, const object &out)
 get all texture indices in the cell specified by point(x,y) GetTextureCount() returns all textures used by the entire terrain tile (i.e. More...
 
static bool RemoveTextureInCell (float x, float y, int nIndex)
 remove the given texture in the cell specified by the point(x,y). More...
 
static ParaAssetObject GetTexture (float x, float y, int nIndex)
 get the terrain detailed texture by index. More...
 
static void GetTexture__ (ParaAssetObject *pOut, float x, float y, int nIndex)
 only used for API exporting. More...
 
static bool ReplaceTexture (float x, float y, int nIndex, ParaAssetObject &TextureAsset)
 replace the texture at the given index. More...
 
static bool ReplaceTexture_ (float x, float y, int nIndex, const object &sTextureAsset)
 
static ParaAttributeObject GetAttributeObjectAt (float x, float y)
 get the attribute object associated with the terrain tile that contains the given point. More...
 
static void GetAttributeObjectAt_ (ParaAttributeObject &output, float x, float y)
 used for API exportation. More...
 
static float GetElevation (float x, float y)
 get the terrain height at the specified position. More...
 
static DWORD GetRegionValue (const char *sLayerName, float x, float y)
 get value of a given terrain region layer More...
 
static DWORD GetRegionValue4 (const char *sLayerName, float x, float y, const char *argb)
 get value of a given terrain region layer More...
 
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. More...
 
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. More...
 
static void SaveTerrain (bool bHeightMap, bool bTextures)
 save modified terrain to disk. More...
 
static void ReloadTerrain (bool bHeightMap, bool bTextures)
 reload terrain from disk. More...
 
static void UpdateTerrain ()
 update terrain. More...
 
static void UpdateTerrain1 (bool bForceUpdate)
 
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. More...
 
static float GetVertexSpacing ()
 Returns the number of real units between vertices in the terrain's mesh. More...
 
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. More...
 
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. More...
 
static void Flatten (float x, float y, float radius, int flatten_op, float elevation, float factor)
 Flatten the terrain both up and down to the specified elevation, using using the tightness parameter to determine how much the altered points are allowed to deviate from the specified elevation. More...
 
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]. More...
 
static void GaussianHill (float x, float y, float radius, float hscale, float standard_deviation, float smooth_factor)
 
static void Spherical (float x, float y, float radius, float offset)
 offset in a spherical region More...
 
static void Roughen_Smooth (float x, float y, float radius, bool roughen, bool big_grid, float factor)
 square filter for sharpening and smoothing. More...
 
static void Ramp (float x1, float y1, float x2, float y2, float radius, float borderpercentage, float factor)
 create a ramp (inclined slope) from (x1,y1) to (x2,y2). More...
 
static void AddHeightField (float x, float y, const char *filename, int nSmoothPixels)
 Add rectangular height field from file to the current terrain. More...
 
static void MergeHeightField (float x, float y, const char *filename, int mergeOperation=0, float weight1=1.0, float weight2=1.0, int nSmoothPixels=7)
 merge a rectangular height field from file to the current terrain. More...
 
static void UpdateHoles (float x, float y)
 Update all holes in the terrain tile that contains the input point. More...
 
static bool IsHole (float x, float y)
 Whether the terrain contains a hole at the specified location. More...
 
static void SetHole (float x, float y, bool bIsHold)
 set a new terrain hole at the specified location. More...
 
static bool IsModified ()
 return true, if the terrain is modified and should be saved. More...
 
static void SetContentModified (float x, float y, bool bIsModified)
 set the content of the terrain modified. More...
 
static void SetContentModified4 (float x, float y, bool bIsModified, DWORD dwModifiedBits)
 set the content of the terrain modified. More...
 
static void SetAllLoadedModified (bool bIsModified, DWORD dwModifiedBits)
 set all loaded terrain tile content modified. More...
 
static void EnableLighting (bool bEnable)
 Enable both global and local lighting. More...
 
static void PaintTerrainData (float x, float y, float radius, unsigned int data, unsigned int dataMask, unsigned int bitOffset)
 
static uint32 GetTerrainData (float x, float y, uint32 dataMask, byte bitOffset)
 
static void SetVisibleDataMask (uint32 mask, byte bitOffset)
 
static void EnterBlockWorld (float x, float y, float z)
 
static void LeaveBlockWorld ()
 
static bool IsInBlockWorld ()
 
static void SaveBlockWorld (bool saveToTemp)
 
static void DeleteAllBlocks ()
 
static void SetBlockTemplateId (float x, float y, float z, uint16_t templateId)
 
static void SetBlockTemplateIdByIdx (uint16_t x, uint16_t y, uint16_t z, uint32_t templateId)
 
static uint32_t GetBlockTemplateId (float x, float y, float z)
 
static uint32_t GetBlockTemplateIdByIdx (uint16_t x, uint16_t y, uint16_t z)
 
static void SetBlockUserData (float x, float y, float z, uint32_t data)
 
static void SetBlockUserDataByIdx (uint16_t x, uint16_t y, uint16_t z, uint32_t data)
 
static uint32_t GetBlockUserData (float x, float y, float z)
 
static uint32_t GetBlockUserDataByIdx (uint16_t x, uint16_t y, uint16_t z)
 
static object Pick (float rayX, float rayY, float rayZ, float dirX, float dirY, float dirZ, float fMaxDistance, const object &result, uint32_t filter=0xffffffff)
 
static object MousePick (float fMaxDistance, const object &result, uint32_t filter=0xffffffff)
 
static bool RegisterBlockTemplate (uint16_t templateId, const object &params)
 
static void SetTemplateTexture (uint16_t templateId, const char *fileName)
 
static void SetBlockWorldYOffset (float offset)
 
static object GetBlocksInRegion (int32_t startChunkX, int32_t startChunkY, int32_t startChunkZ, int32_t endChunkX, int32_t endChunkY, int32_t endChunkZ, uint32_t matchType, const object &result)
 get block in [startChunk,endChunk] More...
 
static object GetVisibleChunkRegion (const object &result)
 
static void SetBlockWorldSunIntensity (float value)
 
static void SelectBlock (uint16_t x, uint16_t y, uint16_t z, bool isSelect)
 add/remove block to/from highlight block list More...
 
static void SelectBlock1 (uint16_t x, uint16_t y, uint16_t z, bool isSelect, int nGroupID)
 
static void DeselectAllBlock1 (int nGroupID)
 
static void DeselectAllBlock ()
 
static void SetDamagedBlock (uint16_t x, uint16_t y, uint16_t z)
 
static void SetDamageDegree (float damagedDegree)
 
static int FindFirstBlock (uint16_t x, uint16_t y, uint16_t z, uint16_t nSide=4, uint32_t max_dist=32, uint32_t attrFilter=0xffffffff, int nCategoryID=-1)
 find a block in the side direction that matched filter from block(x,y,z) this function can be used to check for free space upward or download More...
 
static int GetFirstBlock (uint16_t x, uint16_t y, uint16_t z, int nBlockId, uint16_t nSide=4, uint32_t max_dist=32)
 get the y pos of the first block of nBlockID, start searching from x, y, z in the side direction
 
static int32_t GetChunkColumnTimeStamp (uint32_t chunkX, uint32_t chunkZ)
 get the time stamp of for the given chunk column 0 means not available, >1 means loaded before
 
static void SetChunkColumnTimeStamp (uint32_t chunkX, uint32_t chunkZ, uint32_t nTimeStamp)
 set chunk column time stamp. More...
 
static const std::string & GetMapChunkData (uint32_t chunkX, uint32_t chunkZ, bool bIncludeInit, uint32_t verticalSectionFilter)
 
static object ApplyMapChunkData (uint32_t chunkX, uint32_t chunkZ, uint32_t verticalSectionFilter, const std::string &chunkData, const object &out)
 
static void GetBlockFullData (uint16_t x, uint16_t y, uint16_t z, uint16_t *pId, uint32_t *pUserData)
 get block id and userdata at the given block position. More...
 

Detailed Description

Contains Terrain functions.

Member Function Documentation

§ AddHeightField()

void ParaScripting::ParaTerrain::AddHeightField ( float  x,
float  y,
const char *  filename,
int  nSmoothPixels 
)
static

Add rectangular height field from file to the current terrain.

Parameters
xcenter of the rect in world unit
ycenter of the rect in world unit
filename: the raw elevation or gray scale image file that contains the height field.
nSmoothPixelsthe 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.

§ DeselectAllBlock1()

void ParaScripting::ParaTerrain::DeselectAllBlock1 ( int  nGroupID)
static
Parameters
nGroupID0 for animated selection, 1 for wire frame selection. -1 for all

§ DigCircleFlat()

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.

Parameters
xcenter of the circle in world unit
ycenter of the circle in world unit
radiusradius of the inner circle in world unit
fFlatPercentagevalue is between [0,1]. fFlatPercentage*radius is the actual radius that got flattened.
factorvalue is between [0,1]. 1 means fully transformed; 0 means nothing is changed

§ EnableLighting()

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

§ FindFirstBlock()

int ParaScripting::ParaTerrain::FindFirstBlock ( uint16_t  x,
uint16_t  y,
uint16_t  z,
uint16_t  nSide = 4,
uint32_t  max_dist = 32,
uint32_t  attrFilter = 0xffffffff,
int  nCategoryID = -1 
)
static

find a block in the side direction that matched filter from block(x,y,z) this function can be used to check for free space upward or download

Parameters
side4 is top. 5 is bottom.
attrFilterattribute to match. 0 means air. default to any block
nCategoryID-1 means any category_id. default to -1
Returns
-1 if not found. otherwise distance to the first block that match in the side direction is returned.

§ Flatten()

void ParaScripting::ParaTerrain::Flatten ( float  x,
float  y,
float  radius,
int  flatten_op,
float  elevation,
float  factor 
)
static

Flatten the terrain both up and down to the specified elevation, using using the tightness parameter to determine how much the altered points are allowed to deviate from the specified elevation.

Parameters
xcenter of the circle in world unit
ycenter of the circle in world unit
radiusradius of the inner circle in world unit
flatten_openum FlattenOperation{ Fill_Op=0, //Flatten the terrain up to the specified elevation ShaveTop_Op=1, //Flatten the terrain down to the specified elevation Flatten_Op=2, //Flatten the terrain up and down to the specified elevation };
elevationthe desired height
factorvalue is between [0,1]. 1 means fully transformed; 0 means nothing is changed

§ GetAttributeObject()

ParaAttributeObject ParaScripting::ParaTerrain::GetAttributeObject ( )
static

get the attribute object associated with the global terrain.

§ GetAttributeObject_()

void ParaScripting::ParaTerrain::GetAttributeObject_ ( ParaAttributeObject output)
static

used for API exportation.

§ GetAttributeObjectAt()

ParaAttributeObject ParaScripting::ParaTerrain::GetAttributeObjectAt ( float  x,
float  y 
)
static

get the attribute object associated with the terrain tile that contains the given point.

Parameters
xin world unit
yin world unit
Returns

§ GetAttributeObjectAt_()

void ParaScripting::ParaTerrain::GetAttributeObjectAt_ ( ParaAttributeObject output,
float  x,
float  y 
)
static

used for API exportation.

§ GetBlockAttributeObject()

ParaAttributeObject ParaScripting::ParaTerrain::GetBlockAttributeObject ( )
static

get block terrain manager's attribute object.

§ GetBlockFullData()

void ParaScripting::ParaTerrain::GetBlockFullData ( uint16_t  x,
uint16_t  y,
uint16_t  z,
uint16_t *  pId,
uint32_t *  pUserData 
)
static

get block id and userdata at the given block position.

§ GetBlocksInRegion()

object ParaScripting::ParaTerrain::GetBlocksInRegion ( int32_t  startChunkX,
int32_t  startChunkY,
int32_t  startChunkZ,
int32_t  endChunkX,
int32_t  endChunkY,
int32_t  endChunkZ,
uint32_t  matchType,
const object result 
)
static

get block in [startChunk,endChunk]

Parameters
startChunkY,endChunkYif negative, and startChunkY == endChunkY, -startChunkY will be used as verticalSectionFilter(a bitwise filter).
Returns
{count,x{},y{},z{},tempId{}}

§ GetElevation()

float ParaScripting::ParaTerrain::GetElevation ( float  x,
float  y 
)
static

get the terrain height at the specified position.

Parameters
xposition in world unit
yposition in world unit
Returns
: the terrain height.

§ GetMapChunkData()

const std::string & ParaScripting::ParaTerrain::GetMapChunkData ( uint32_t  chunkX,
uint32_t  chunkZ,
bool  bIncludeInit,
uint32_t  verticalSectionFilter 
)
static
Parameters
verticalSectionFilterdefault to 0xffff. each bit is for one of the 16 vertical sections.

§ GetRegionValue()

DWORD ParaScripting::ParaTerrain::GetRegionValue ( const char *  sLayerName,
float  x,
float  y 
)
static

get value of a given terrain region layer

Parameters
sLayerNamethe layer name
xThe x location of the point on the Terrain's surface in world units.
yThe y location of the point on the Terrain's surface in world units.

§ GetRegionValue4()

DWORD ParaScripting::ParaTerrain::GetRegionValue4 ( const char *  sLayerName,
float  x,
float  y,
const char *  argb 
)
static

get value of a given terrain region layer

Parameters
sLayerNamethe layer name
xThe x location of the point on the Terrain's surface in world units.
yThe y location of the point on the Terrain's surface in world units.
argbit can be a string containing "argb", where the sum of them are returned. for example, specify "r" to get only the red channel value. specify "rgb" for the sum of the grey scale image. if this is empty string "", the 32bits color value is returned as int.

§ GetTerrainElevFile__()

const char * ParaScripting::ParaTerrain::GetTerrainElevFile__ ( float  x,
float  y 
)
static

solely used for API exporting.

Not thread-safe

§ GetTerrainOnloadScript__()

const char * ParaScripting::ParaTerrain::GetTerrainOnloadScript__ ( float  x,
float  y 
)
static

solely used for API exporting.

Not thread-safe

§ GetTexture()

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().

Parameters
nIndexTexture index in the current terrain tile. 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.
Returns
: The texture entity object is returned. The returned object may be invalid if nIndex is invalid.

§ GetTexture__()

void ParaScripting::ParaTerrain::GetTexture__ ( ParaAssetObject pOut,
float  x,
float  y,
int  nIndex 
)
static

only used for API exporting.

§ GetTexturesInCell()

void ParaScripting::ParaTerrain::GetTexturesInCell ( float  x,
float  y,
const object out 
)
static

get all texture indices in the cell specified by point(x,y) GetTextureCount() returns all textures used by the entire terrain tile (i.e.

500*500). however, each terrain tile is further subdevided into 8*8=64 terrain cell (each cell takes up about 64*64 meters). Alpha channels of a terrain texture is only created on a per cell basis. A single alpha image (128*128) will be created for each used texture in the cell.

Parameters
xin world unit
yin world unit
outthis should be an empty table to be filled with textures in the cell, so that {[1]=tex_index, [2]=tex_index, ...}.

§ GetVertexSpacing()

float ParaScripting::ParaTerrain::GetVertexSpacing ( )
static

Returns the number of real units between vertices in the terrain's mesh.

§ IsHole()

bool ParaScripting::ParaTerrain::IsHole ( float  x,
float  y 
)
static

Whether the terrain contains a hole at the specified location.

Currently, we allow user to load a low resolution hole maps at the beginning of terrain creation.

Parameters
xThe x location of the point on the Terrain's surface in world units.
yThe y location of the point on the Terrain's surface in world units.
Returns
: true if the position specified by (x,y) is inside a terrain hole

§ IsModified()

bool ParaScripting::ParaTerrain::IsModified ( )
static

return true, if the terrain is modified and should be saved.

§ MergeHeightField()

void ParaScripting::ParaTerrain::MergeHeightField ( float  x,
float  y,
const char *  filename,
int  mergeOperation = 0,
float  weight1 = 1.0,
float  weight2 = 1.0,
int  nSmoothPixels = 7 
)
static

merge a rectangular height field from file to the current terrain.

Parameters
xcenter of the rect in world unit
ycenter of the rect in world unit
filename: the raw elevation or gray scale image file that contains the height field.
MergeOperation{ Addition=0, Subtract=1, Multiplication=2, Division=3, Minimum=4, Maximum=5, };
weight1the destination merging weight
weight2the source file merging weight
nSmoothPixelsthe 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.

§ Paint()

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.

Parameters
detailTexturethe 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 .
brushRadiusThe width of the brush to paint with in DetailTexture layer pixels. There are typically 256 of these pixels across a TextureCell.
brushIntensityThe intensity with which to paint, ranging from 0.0 to 1.0. This determines how opaque the painted "splat" will be.
maxIntensityThe 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.
eraseSpecifies 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)
xThe x location of the point to paint on the Terrain's surface in world units.
yThe y location of the point to paint on the Terrain's surface in world units.

§ Paint_()

void ParaScripting::ParaTerrain::Paint_ ( int  nDetailTextureID,
float  brushRadius,
float  brushIntensity,
float  maxIntensity,
bool  erase,
float  x,
float  y 
)
static
See also
Paint().
Parameters
nDetailTextureIDmulti-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.

§ RadialScale()

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.

Parameters
xcenter of the circle in world unit
ycenter of the circle in world unit
scale_factorheight of the scaled portion in world unit. This value can be negative.

§ Ramp()

void ParaScripting::ParaTerrain::Ramp ( float  x1,
float  y1,
float  x2,
float  y2,
float  radius,
float  borderpercentage,
float  factor 
)
static

create a ramp (inclined slope) from (x1,y1) to (x2,y2).

The ramp's half width is radius. this is usually used to created a slope path connecting a high land with a low land.

Parameters
radiusThe ramp's half width
borderpercentageborderpercentage*radius is how long the ramp boarder is to linearly interpolate with the original terrain. specify 0 for sharp ramp border.
factorin range[0,1]. it is the smoothness to merge with other border heights.Specify 1.0 for a complete merge

§ RegisterBlockTemplate()

bool ParaScripting::ParaTerrain::RegisterBlockTemplate ( uint16_t  templateId,
const object params 
)
static
Parameters
paramsit can be attFlag of int type.

§ ReloadTerrain()

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.

Parameters
bHeightMaptrue to save height map
bTexturestrue to save textures: alpha maps, etc

§ RemoveTextureInCell()

bool ParaScripting::ParaTerrain::RemoveTextureInCell ( float  x,
float  y,
int  nIndex 
)
static

remove the given texture in the cell specified by the point(x,y).

Parameters
xin world unit
yin world unit
nIndexTexture index in the current terrain tile. this should be smaller than the total number of textures in the texture set. see GetTextureCount().

§ ReplaceTexture()

bool ParaScripting::ParaTerrain::ReplaceTexture ( float  x,
float  y,
int  nIndex,
ParaAssetObject TextureAsset 
)
static

replace the texture at the given index.

or append a new texture, or delete a texture if TextureAsset or sTextureAsset is NULL.

Parameters
nIndexif it is 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.
sTextureAssetfilename. if nil, texture will be removed.

§ Roughen_Smooth()

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.

Parameters
xcenter of the circle in world unit
ycenter of the circle in world unit
radiusradius of the inner circle in world unit
roughentrue for sharpening, false for smoothing.
big_gridtrue for 8 neighboring cells, false for 4.
factorvalue is between [0,1]. 1 means fully transformed; 0 means nothing is changed

§ SaveTerrain()

void ParaScripting::ParaTerrain::SaveTerrain ( bool  bHeightMap,
bool  bTextures 
)
static

save modified terrain to disk.

Parameters
bHeightMaptrue to save height map
bTexturestrue to save textures: alpha maps, etc

§ SelectBlock()

void ParaScripting::ParaTerrain::SelectBlock ( uint16_t  x,
uint16_t  y,
uint16_t  z,
bool  isSelect 
)
static

add/remove block to/from highlight block list

Parameters
x,y,zworld space block id;
isSelect: true to select block, false to de-select block
nGroupIDgroup id. 0 for highlight 1 for wireframe.

§ SetAllLoadedModified()

void ParaScripting::ParaTerrain::SetAllLoadedModified ( bool  bIsModified,
DWORD  dwModifiedBits 
)
static

set all loaded terrain tile content modified.

This is the refered way to perform a save all operation

§ SetChunkColumnTimeStamp()

void ParaScripting::ParaTerrain::SetChunkColumnTimeStamp ( uint32_t  chunkX,
uint32_t  chunkZ,
uint32_t  nTimeStamp 
)
static

set chunk column time stamp.

usually 0 for non-generated. 1 for generated. this is usually called by world generators, so that we will not generate again next time we load the world.

§ SetContentModified()

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.

Parameters
xa position on the terrain where content is changed.
ya position on the terrain where content is changed.
bIsModifiedtrue to set modified.

§ SetContentModified4()

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.

Parameters
bIsModifiedtrue to set modified.
dwModifiedBitsthis 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 };

§ SetHole()

void ParaScripting::ParaTerrain::SetHole ( float  x,
float  y,
bool  bIsHold 
)
static

set a new terrain hole at the specified location.

Currently, we will allow user to dynamically dig holes in terrain. After calling this function, the user must manually Call UpdateHoles() to inform that the holes in the terrain has been updated.

Parameters
xThe x location of the point on the Terrain's surface in world units.
yThe y location of the point on the Terrain's surface in world units.
See also
UpdateHoles();

§ SnapPointToVertexGrid()

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);

Parameters
xarbitrary 2D point on the height map
yarbitrary 2D point on the height map
vertex_x[out] vertex position on the height map
vertex_y[out] vertex position on the height map

§ Spherical()

void ParaScripting::ParaTerrain::Spherical ( float  x,
float  y,
float  radius,
float  offset 
)
static

offset in a spherical region

Parameters
xcenter of the circle in world unit
ycenter of the circle in world unit
radiusradius of the inner circle in world unit

§ UpdateHoles()

void ParaScripting::ParaTerrain::UpdateHoles ( float  x,
float  y 
)
static

Update all holes in the terrain tile that contains the input point.

Parameters
xThe x location of the point on the Terrain's surface in world units.
yThe y location of the point on the Terrain's surface in world units.

§ UpdateTerrain()

void ParaScripting::ParaTerrain::UpdateTerrain ( )
static

update terrain.

this function is called, when the user changes the terrain surface.

Parameters
bForceUpdateif true it will update the terrain even if the camera does not moves.

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